/* =====================================================================
   Digital Store — Admin styles
   ===================================================================== */
:root{
  --bg:#f1f2f7; --surface:#fff; --surface-2:#f7f8fc; --ink:#1a1c2e; --muted:#6b7280;
  --brand:#4f46e5; --brand-dark:#4338ca; --brand-soft:#eef2ff;
  --line:#e6e8f0; --danger:#dc2626; --ok:#16a34a; --amber:#f59e0b;
  --radius:12px; --shadow:0 3px 14px rgba(20,23,60,.05);
  /* Sidebar in LIGHT mode = light/white so the dark/light toggle is visually obvious */
  --sidebar:#ffffff; --sidebar-ink:#1a1c2e; --sidebar-soft:rgba(79,70,229,.06);
  --sidebar-line:#e6e8f0; --sidebar-foot-bg:#f7f8fc;
  --topbar:#fff; --topbar-ink:#1a1c2e; --topbar-line:#e6e8f0;
}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);color:var(--ink)}
a{color:var(--brand);text-decoration:none}
.muted{color:var(--muted)}
h1,h2,h3{margin:0}

/* =====================================================================
   ADMIN LOGIN PAGE — modern centered branded card
   ===================================================================== */
.admin-login-page{
  min-height:100vh;display:grid;place-items:center;padding:24px;
  background:linear-gradient(135deg,#171933 0%,#312e81 50%,#4f46e5 100%);
  position:relative;overflow:hidden;
}
.admin-login-page .login-aurora{position:absolute;inset:-20%;z-index:0;pointer-events:none}
.admin-login-page .blob{position:absolute;border-radius:50%;filter:blur(60px);opacity:.55}
.admin-login-page .blob-1{width:380px;height:380px;background:#a855f7;top:8%;left:6%;animation:aurora 14s ease-in-out infinite alternate}
.admin-login-page .blob-2{width:340px;height:340px;background:#22d3ee;bottom:6%;right:8%;animation:aurora 16s ease-in-out infinite alternate-reverse}
.admin-login-page .blob-3{width:300px;height:300px;background:#f472b6;top:42%;left:48%;animation:aurora 12s ease-in-out infinite alternate}
@keyframes aurora{0%{transform:translate(-4%,-2%) rotate(0)}100%{transform:translate(4%,3%) rotate(8deg)}}

.login-wrap{position:relative;z-index:1;width:100%;max-width:420px;display:flex;flex-direction:column;align-items:center;gap:14px}
.login-card{
  width:100%;background:var(--surface);border:1px solid var(--line);border-radius:20px;
  padding:34px 32px 30px;box-shadow:0 30px 80px rgba(0,0,0,.35);
  display:flex;flex-direction:column;gap:14px;
}
.login-card-top{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;margin-bottom:6px}
.login-logo{max-height:54px;max-width:200px;object-fit:contain}
.login-brand-mark{display:inline-grid;place-items:center;width:54px;height:54px;border-radius:16px;
  background:linear-gradient(135deg,#6366f1,#a855f7);color:#fff;font-size:1.6rem;
  box-shadow:0 10px 26px rgba(124,58,237,.45)}
.login-brand-text h1{font-size:1.55rem;font-weight:700;margin:0}
.login-brand-text p{margin:4px 0 0;color:var(--muted);font-size:.92rem}

.login-alert{
  display:flex;align-items:center;gap:10px;
  background:#fef2f2;border:1px solid #fecaca;color:#991b1b;
  padding:11px 14px;border-radius:10px;font-size:.9rem;font-weight:500;
}
.login-alert-ico{font-size:1rem;flex-shrink:0}

.login-field{display:flex;flex-direction:column;gap:6px}
.login-field label{font-weight:600;font-size:.85rem;color:var(--ink);letter-spacing:.01em}
.login-input-wrap{position:relative;display:flex;align-items:center}
.login-input-wrap .login-input-ico{position:absolute;left:13px;font-size:.95rem;opacity:.7;pointer-events:none}
.login-input-wrap input{
  flex:1;width:100%;padding:12px 14px 12px 42px;border:1px solid var(--line);border-radius:11px;
  font-size:.95rem;font-family:inherit;background:var(--surface-2);color:var(--ink);
  transition:border-color .15s,box-shadow .15s,background .15s;
}
.login-input-wrap input::placeholder{color:var(--muted)}
.login-input-wrap input:focus{outline:none;border-color:var(--brand);background:var(--surface);box-shadow:0 0 0 3px var(--brand-soft)}
.login-pw-toggle{
  position:absolute;right:6px;width:38px;height:38px;border-radius:9px;border:none;
  background:transparent;cursor:pointer;font-size:.95rem;color:var(--muted);
  display:grid;place-items:center;transition:.15s;
}
.login-pw-toggle:hover{background:var(--surface-2);color:var(--ink)}

.login-submit{margin-top:6px;font-weight:700;letter-spacing:.01em}
.login-submit-ico{font-weight:700;transition:transform .15s}
.login-submit:hover .login-submit-ico{transform:translateX(3px)}
.login-hint{font-size:.8rem;margin:6px 0 0;text-align:center}
.login-back{margin:0;font-size:.88rem}
.login-back a{color:rgba(255,255,255,.85);font-weight:500}
.login-back a:hover{color:#fff;text-decoration:underline}

/* =====================================================================
   ADMIN LAYOUT — sidebar + main + topbar
   ===================================================================== */
.admin{display:flex;min-height:100vh}

/* ---------- Sidebar ---------- */
.sidebar{
  width:248px;background:var(--sidebar);color:var(--sidebar-ink);
  display:flex;flex-direction:column;position:fixed;top:0;bottom:0;left:0;z-index:50;
  box-shadow:0 0 0 1px var(--sidebar-line);
  border-right:1px solid var(--sidebar-line);
  transition:background .25s,color .25s,border-color .25s;
}
.sidebar-brand{
  display:flex;align-items:center;gap:10px;padding:20px 22px;
  font-weight:800;font-size:1.1rem;color:var(--ink);
  border-bottom:1px solid var(--sidebar-line);
  white-space:nowrap;overflow:hidden;
}
.sidebar-brand .brand-mark{color:var(--brand);font-size:1.15rem}
.sidebar-brand img{max-height:34px;max-width:170px;object-fit:contain;vertical-align:middle}
.sidebar-brand .brand-suffix{color:var(--muted);font-weight:500;font-size:.85rem;margin-left:4px}

.sidebar-nav{
  padding:14px 12px;flex:1;display:flex;flex-direction:column;gap:3px;
  overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent;
}
.sidebar-nav::-webkit-scrollbar{width:6px}
.sidebar-nav::-webkit-scrollbar-thumb{background:var(--sidebar-line);border-radius:3px}
.sidebar-nav a{
  display:flex;align-items:center;gap:12px;height:42px;
  padding:0 14px;border-radius:10px;color:var(--sidebar-ink);
  font-weight:500;font-size:.92rem;transition:background .15s,color .15s;
  white-space:nowrap;overflow:hidden;
}
.sidebar-nav a:hover{background:var(--sidebar-soft);text-decoration:none;color:var(--brand)}
.sidebar-nav a.active{
  background:linear-gradient(135deg,var(--brand),var(--brand-dark));color:#fff;
  box-shadow:0 6px 16px rgba(79,70,229,.4);
}
.sidebar-nav .ico{
  display:inline-grid;place-items:center;width:22px;height:22px;
  font-size:1rem;text-align:center;flex-shrink:0;
}

.sidebar-foot{
  padding:14px 16px;border-top:1px solid var(--sidebar-line);
  display:flex;flex-direction:column;gap:8px;background:var(--sidebar-foot-bg);
}
.sidebar-version{display:flex;flex-direction:column;gap:2px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.72rem;color:var(--muted);line-height:1.5}
.sidebar-version .vrow{display:flex;justify-content:space-between;gap:8px}
.sidebar-version .vrow b{color:var(--ink);font-weight:600}
.sidebar-foot a{color:var(--muted);font-size:.86rem;display:inline-flex;align-items:center;gap:6px}
.sidebar-foot a:hover{color:var(--brand)}

/* ---------- Main + Topbar ---------- */
.admin-main{margin-left:248px;flex:1;display:flex;flex-direction:column;min-width:0;min-height:100vh}
.admin-topbar{
  background:var(--topbar);color:var(--topbar-ink);
  border-bottom:1px solid var(--topbar-line);
  padding:16px 26px;display:flex;align-items:center;justify-content:space-between;
  position:sticky;top:0;z-index:40;gap:14px;
}
.admin-topbar h1{font-size:1.2rem;font-weight:700;letter-spacing:-.01em}
.admin-topbar-left{display:flex;align-items:center;gap:14px}
.admin-topbar-right{display:flex;align-items:center;gap:12px}
.admin-user{color:var(--muted);font-size:.88rem;font-weight:500;display:flex;align-items:center;gap:6px}
.admin-content{padding:28px;flex:1}

/* Mobile sidebar toggle (hamburger) — visible only below 900px */
.admin-mobile-toggle{
  display:none;width:42px;height:42px;border-radius:11px;border:1px solid var(--topbar-line);
  background:var(--topbar);color:var(--topbar-ink);cursor:pointer;font-size:1.2rem;
  align-items:center;justify-content:center;
}
.admin-backdrop{
  position:fixed;inset:0;z-index:45;background:rgba(8,9,20,.5);
  visibility:hidden;opacity:0;transition:opacity .25s,visibility .25s;
  backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
}
.admin-backdrop.open{visibility:visible;opacity:1}

@media(max-width:900px){
  .admin-mobile-toggle{display:inline-flex}
  .sidebar{
    transform:translateX(-100%);transition:transform .25s ease;z-index:60;
    box-shadow:0 0 60px rgba(0,0,0,.4);
  }
  .sidebar.open{transform:translateX(0)}
  .admin-main{margin-left:0}
  .admin-topbar{padding:12px 16px}
  .admin-content{padding:18px 14px}
}

/* =====================================================================
   Shared components
   ===================================================================== */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:18px;margin-bottom:26px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;box-shadow:var(--shadow)}
.stat-val{font-size:1.7rem;font-weight:800}
.stat-lbl{color:var(--muted);font-size:.85rem;margin-top:4px}
.stat-alert{border-color:#fcd34d;background:#fffbeb}

/* Panels + tables */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;margin-bottom:22px;box-shadow:var(--shadow)}
.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;gap:12px;flex-wrap:wrap}
.panel-head h3{font-size:1.1rem}
.panel-head h4{margin:0;font-size:.98rem}
.table{width:100%;border-collapse:collapse;font-size:.92rem}
.table th{text-align:left;padding:11px 12px;border-bottom:2px solid var(--line);color:var(--muted);font-size:.8rem;text-transform:uppercase;letter-spacing:.03em}
.table td{padding:12px;border-bottom:1px solid var(--line);vertical-align:middle}
.table tr:hover td{background:#fafbff}
.row-actions{display:flex;gap:6px}
.nowrap{white-space:nowrap}
.logs .log-payload{font-size:.78rem;color:#475569;word-break:break-all}

/* Filter tabs */
.filter-tabs{display:flex;gap:6px;flex-wrap:wrap}
.filter-tabs a{padding:6px 14px;border-radius:20px;font-size:.85rem;color:var(--muted);background:var(--bg)}
.filter-tabs a.active{background:var(--brand);color:#fff}

/* Key-value */
.kv{width:100%;border-collapse:collapse}
.kv td{padding:9px 0;border-bottom:1px solid var(--line);font-size:.92rem}
.kv td:first-child{color:var(--muted);width:42%}
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:22px}

/* Forms */
.admin-form .form-row{margin-bottom:16px;display:flex;flex-direction:column;gap:6px}
.admin-form label{font-weight:600;font-size:.88rem}
.admin-form input,.admin-form select,.admin-form textarea{
  padding:10px 12px;border:1px solid var(--line);border-radius:9px;font-size:.93rem;font-family:inherit;width:100%;background:#fff}
.admin-form input:focus,.admin-form select:focus,.admin-form textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px}
.checkbox-row{display:flex;gap:24px;flex-wrap:wrap;margin:10px 0}
.checkbox-row label{display:flex;align-items:center;gap:8px;font-weight:500}
.form-actions{display:flex;gap:12px;margin-top:20px}
.sticky-actions{position:sticky;bottom:0;background:var(--bg);padding:14px 0;border-top:1px solid var(--line)}
.switch{display:flex;align-items:center;gap:8px;font-size:.9rem;font-weight:600;color:var(--muted)}
.switch input{width:18px;height:18px;accent-color:var(--brand)}
.stack{display:flex;flex-direction:column;gap:10px}
.stack input[readonly]{background:var(--bg);cursor:pointer}

/* Buttons (shared subset) */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:9px 16px;border-radius:9px;
  border:1px solid var(--line);background:#fff;color:var(--ink);font-weight:600;cursor:pointer;font-size:.9rem;transition:.15s}
.btn:hover{border-color:#cfd3e3;text-decoration:none}
.btn-primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn-primary:hover{background:var(--brand-dark)}
.btn-danger{background:#fff;border-color:#f3c2c2;color:var(--danger)}
.btn-danger:hover{background:#fef2f2}
.btn-sm{padding:6px 11px;font-size:.8rem}
.btn-lg{padding:13px 24px;font-size:1rem}
.btn-block{width:100%}
.chip{display:inline-block;background:var(--brand-soft);color:var(--brand);font-size:.7rem;font-weight:700;padding:2px 9px;border-radius:20px}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:var(--bg);border:1px solid var(--line);
  padding:2px 7px;border-radius:6px;font-size:.85rem;font-weight:600}

.alert{padding:12px 16px;border-radius:9px;margin-bottom:16px;font-size:.9rem;border:1px solid}
.alert-success{background:#f0fdf4;border-color:#bbf7d0;color:#166534}
.alert-error{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.alert-info{background:#eff6ff;border-color:#bfdbfe;color:#1e40af}
.pill{display:inline-block;padding:3px 12px;border-radius:20px;font-size:.76rem;font-weight:700}
.pill-paid{background:#dcfce7;color:#166534}
.pill-verifying{background:#fef3c7;color:#92400e}
.pill-pending{background:#e5e7eb;color:#374151}
.pill-failed{background:#fee2e2;color:#991b1b}

@media(max-width:820px){
  .detail-grid,.grid-2,.grid-3{grid-template-columns:1fr}
}

/* Product gallery management */
.admin-gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px;margin-top:8px}
.admin-gallery-item{display:block;border:1px solid var(--line);border-radius:10px;padding:8px;background:#fff}
.admin-gallery-item img{width:100%;height:90px;object-fit:cover;border-radius:6px;display:block}
.admin-gallery-item span{display:flex;align-items:center;gap:6px;font-size:.82rem;margin-top:8px;color:var(--muted)}
.admin-fieldset{border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px 4px;margin:6px 0 4px;background:#fff}
.admin-fieldset legend{font-weight:700;padding:0 8px;font-size:.95rem}

/* Dashboard summary cards */
.stat-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:16px;margin-bottom:22px}
.stat-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:6px}
.stat-card .sc-ico{font-size:1.4rem}
.stat-card .sc-val{font-size:1.7rem;font-weight:800;line-height:1}
.stat-card .sc-label{color:var(--muted);font-size:.86rem;font-weight:600}
.stat-card.sc-accent{background:linear-gradient(135deg,var(--brand),var(--brand-dark));color:#fff;border:none}
.stat-card.sc-accent .sc-label{color:rgba(255,255,255,.85)}

/* Top-bar theme toggle */
.admin-theme-toggle{width:38px;height:38px;border-radius:10px;border:1px solid var(--topbar-line);background:var(--topbar);
  cursor:pointer;font-size:1.05rem;display:grid;place-items:center;color:var(--topbar-ink);transition:.15s;line-height:1}
.admin-theme-toggle:hover{border-color:var(--brand)}
.admin-theme-toggle .sun{display:none}
.admin-theme-toggle .moon{display:inline}

/* =====================================================================
   DARK MODE — shares the ds-theme choice with the storefront.
   The previous version only flipped --bg / --surface which left the
   topbar (header) visually unchanged because the admin-topbar rule
   relied on --surface while --topbar was a SEPARATE token that wasn't
   overridden in dark mode. This version also flips --topbar / --topbar-ink
   / --topbar-line so the topbar visibly changes with the theme too.
   The sidebar also flips properly: light/white in light mode, dark in
   dark mode — so the dark/light toggle is now visually obvious.
   ===================================================================== */
[data-theme="dark"]{
  --bg:#0f1119; --surface:#181b27; --surface-2:#1f2230; --ink:#e9eaf3; --muted:#9297ad;
  --brand:#7c72ff; --brand-dark:#6257e8; --brand-soft:#24263a;
  --line:#2a2d40; --danger:#f87171; --ok:#4ade80; --amber:#fbbf24;
  --shadow:0 3px 16px rgba(0,0,0,.4);
  --sidebar:#0c0e16; --sidebar-ink:#c4c8e0; --sidebar-soft:rgba(255,255,255,.06);
  --sidebar-line:#1e293b; --sidebar-foot-bg:#08090f;
  --topbar:#181b27; --topbar-ink:#e9eaf3; --topbar-line:#2a2d40;
}
/* explicit overrides so the topbar visibly follows the theme */
[data-theme="dark"] .admin-topbar{background:var(--topbar);color:var(--topbar-ink);border-bottom-color:var(--topbar-line)}
[data-theme="dark"] .admin-mobile-toggle{background:var(--topbar);color:var(--topbar-ink);border-color:var(--topbar-line)}
[data-theme="dark"] .admin-theme-toggle .sun{display:inline}
[data-theme="dark"] .admin-theme-toggle .moon{display:none}
[data-theme="dark"] .btn{background:var(--surface);color:var(--ink)}
[data-theme="dark"] .btn:hover{border-color:#3a3e56}
[data-theme="dark"] .btn-danger{background:var(--surface);border-color:#5b2b2b;color:var(--danger)}
[data-theme="dark"] .btn-danger:hover{background:#2a1616}
[data-theme="dark"] .admin-form input,
[data-theme="dark"] .admin-form select,
[data-theme="dark"] .admin-form textarea{background:var(--surface);color:var(--ink);border-color:var(--line)}
[data-theme="dark"] .admin-form input:focus,
[data-theme="dark"] .admin-form select:focus,
[data-theme="dark"] .admin-form textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
[data-theme="dark"] .table tr:hover td{background:rgba(255,255,255,.04)}
[data-theme="dark"] .stat-alert{background:#2c2410;border-color:#5c4a12}
[data-theme="dark"] .admin-gallery-item,
[data-theme="dark"] .admin-fieldset,
[data-theme="dark"] .filter-tabs a{background:var(--surface)}
[data-theme="dark"] .alert-success{background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.4);color:#86efac}
[data-theme="dark"] .alert-error{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.4);color:#fca5a5}
[data-theme="dark"] .alert-info{background:rgba(59,130,246,.12);border-color:rgba(59,130,246,.4);color:#93c5fd}
[data-theme="dark"] .pill-paid{background:rgba(34,197,94,.16);color:#86efac}
[data-theme="dark"] .pill-verifying{background:rgba(245,158,11,.16);color:#fcd34d}
[data-theme="dark"] .pill-pending{background:rgba(255,255,255,.08);color:#c7cce0}
[data-theme="dark"] .pill-failed{background:rgba(239,68,68,.16);color:#fca5a5}
[data-theme="dark"] code,[data-theme="dark"] .stack input[readonly]{background:#0c0e16}
[data-theme="dark"] .filter-tabs a{color:var(--muted)}

/* Login page — keep card readable in dark mode */
[data-theme="dark"] .login-card{background:var(--surface);border-color:var(--line);color:var(--ink)}
[data-theme="dark"] .login-brand-text p{color:var(--muted)}
[data-theme="dark"] .login-input-wrap input{background:var(--surface-2);border-color:var(--line);color:var(--ink)}
[data-theme="dark"] .login-input-wrap input:focus{background:var(--surface)}
[data-theme="dark"] .login-alert{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.4);color:#fca5a5}
[data-theme="dark"] .login-hint{color:var(--muted)}

/* Upgrade page */
.upgrade-log{background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:16px 18px;margin-top:14px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86rem;line-height:1.8;max-height:420px;overflow:auto}
.upgrade-log .ok{color:#16a34a}
.upgrade-log .skip{color:var(--muted)}
.upgrade-log .err{color:var(--danger)}
[data-theme="dark"] .upgrade-log .ok{color:#86efac}

/* =====================================================================
   ADMIN FOOTER BAR — version badge + copyright
   Sits at the bottom of .admin-main, full-width of the main column.
   ===================================================================== */
.admin-footer{
  margin-top:auto; /* pushes it to the bottom of the flex column .admin-main */
  background:var(--topbar);color:var(--topbar-ink);
  border-top:1px solid var(--topbar-line);
  padding:11px 26px;font-size:.8rem;
}
.admin-footer-inner{
  display:flex;align-items:center;justify-content:space-between;
  gap:14px;flex-wrap:wrap;
}
.admin-footer-left{color:var(--muted);font-weight:500}
.admin-footer-right{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:flex-end}
.admin-version-badge{
  display:inline-flex;align-items:center;gap:7px;
  background:var(--surface-2);border:1px solid var(--topbar-line);
  padding:4px 12px;border-radius:20px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.74rem;color:var(--ink-2);letter-spacing:.02em;
  white-space:nowrap;
}
.admin-version-badge.muted{color:var(--muted);background:transparent;border-color:transparent;padding:4px 0}
.admin-version-badge.muted b{color:var(--muted)}
.admin-version-badge b{color:var(--brand);font-weight:700}
.admin-version-badge .avb-dot{
  width:8px;height:8px;border-radius:50%;
  background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.22);
  display:inline-block;flex-shrink:0;
}
@media(max-width:600px){
  .admin-footer{padding:10px 14px}
  .admin-footer-inner{justify-content:center;text-align:center}
  .admin-footer-right{justify-content:center}
}

/* Dark mode explicit overrides for the footer bar */
[data-theme="dark"] .admin-footer{background:var(--topbar);color:var(--topbar-ink);border-top-color:var(--topbar-line)}
[data-theme="dark"] .admin-version-badge{background:var(--surface-2);border-color:var(--topbar-line);color:var(--ink-2)}
[data-theme="dark"] .admin-version-badge b{color:var(--brand)}
[data-theme="dark"] .admin-version-badge.muted,
[data-theme="dark"] .admin-version-badge.muted b{color:var(--muted)}


/* =====================================================================
   AUTO THEME — when no explicit data-theme attribute is set on <html>,
   fall back to the device's prefers-color-scheme preference. The admin
   boot script in admin/includes/admin_header.php only sets data-theme
   when the user explicitly chose 'light' or 'dark'; for 'auto', it
   leaves the attribute unset, so these rules kick in. This way the
   admin sidebar/topbar follow the user's device theme even on first
   visit, just like the storefront.
   ===================================================================== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:#0f1119; --surface:#181b27; --surface-2:#1f2230; --ink:#e9eaf3; --muted:#9297ad;
        --brand:#7c72ff; --brand-dark:#6257e8; --brand-soft:#24263a;
        --line:#2a2d40; --danger:#f87171; --ok:#4ade80; --amber:#fbbf24;
        --shadow:0 3px 16px rgba(0,0,0,.4);
        --sidebar:#0c0e16; --sidebar-ink:#c4c8e0; --sidebar-soft:rgba(255,255,255,.06);
        --sidebar-line:#1e293b; --sidebar-foot-bg:#08090f;
        --topbar:#181b27; --topbar-ink:#e9eaf3; --topbar-line:#2a2d40;
    }
    :root:not([data-theme="light"]) .admin-theme-toggle .sun { display: inline; }
    :root:not([data-theme="light"]) .admin-theme-toggle .moon { display: none; }
}
