/* Kosher Store — Admin. Modern, theme-aware design system. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e3e7ef;
  --text: #1a1d29;
  --text-dim: #626b81;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fe;
  --success: #0ea15f;
  --success-soft: #e6f6ee;
  --danger: #dc2b46;
  --danger-soft: #fdecef;
  --warning: #d97706;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1017; --surface: #171a24; --surface-2: #1e2230; --border: #2a2f3d;
    --text: #e8eaf0; --text-dim: #9098ac; --primary: #7c74ff; --primary-hover: #8f88ff;
    --primary-soft: #201f3a; --success: #2fbd7e; --success-soft: #10261d; --danger: #f2607a;
    --danger-soft: #2a1620; --warning: #e0a244;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--primary-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brand-badge { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; font-weight: 800; }
.brand h1 { font-size: 18px; margin: 0; }
.login-card p.sub { color: var(--text-dim); margin: 0 0 22px; font-size: 13px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 6px 8px 16px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-dim); font-weight: 550; border: none; background: none; width: 100%; text-align: left;
  font-size: 14px; transition: .12s; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.who { font-size: 12.5px; color: var(--text-dim); padding: 0 8px 8px; }
.who b { color: var(--text); display: block; font-size: 13.5px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar h2 { margin: 0; font-size: 18px; }
.content { padding: 24px 28px; }

/* ---------- Cards / stats ---------- */
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.stat { padding: 18px 20px; }
.stat .label { color: var(--text-dim); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.panel { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 15px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.app-icon { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); }
.muted { color: var(--text-dim); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; }

/* ---------- Badges / buttons ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.gray { background: var(--surface-2); color: var(--text-dim); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.indigo { background: var(--primary-soft); color: var(--primary); }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; transition: .12s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 550; }
input, textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 14px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 90px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 320px; }
.search input { padding-left: 34px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-dim); }
.switch { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,12,20,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { padding: 12px 16px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 13.5px; min-width: 220px; border-left: 3px solid var(--primary); }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--success); }

.empty { padding: 48px; text-align: center; color: var(--text-dim); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; padding: 60px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: .2s; width: 248px; }
  .sidebar.open { transform: none; }
  .form-2 { grid-template-columns: 1fr; }
}
