/* app/css/dashboard.css — the design system for the admin panel and the
   customer / vendor / sales-rep portal. Loaded last by both, and by neither the
   public storefront nor /login, so the token overrides below stay scoped to the
   dashboards.

   Sections: tokens · base + components · shell + sidebar · dashboard layout ·
   stat tiles · cards · charts · lists + tables · states · responsive */

/* ------------------------------- tokens ---------------------------------- */
:root{
  --bg:#F7F7F8;
  --surface:#FFFFFF;
  --surface-2:#F2F2F4;
  --bg-soft:#F7F7F8;
  --card:#FFFFFF;
  --ink:#18181B;
  --ink-soft:#52525B;
  --ink-faint:#71717A;
  --line:#E4E4E7;
  --line-soft:#F0F0F2;
  --line-strong:#D4D4D8;
  --row-hover:#FAFAFB;
  --seg-bg:#ECECEF;
  --skel-a:#EFEFF1;
  --skel-b:#F7F7F8;
  --topbar-bg:rgba(255,255,255,.92);
  --teal:#0F766E;
  --teal-soft:#E3F3F0;

  /* brand: the logo's maroon, lifted slightly so it holds up as a UI colour */
  --accent:#8F1D3F;
  --accent-dark:#731533;
  --accent-ink:#FFFFFF;
  --accent-soft:#F9EEF1;
  --gold:#C8921B;

  /* The accent family's defaults. For any other colour or mode, app/js/theme.js
     works these out from the one chosen colour and sets them on <html>. */
  --accent-border:#EBCFD8;
  --accent-rgb:143,29,63;
  --btn-shadow-rgb:115,21,51;
  --btn-light-ink:#731533;
  --btn-light-hover:#FBF3F5;
  --avatar-from:#B23A60;
  --avatar-to:#731533;
  --spot-from:#3A0A1B;
  --spot-to:#6B1231;
  --spot-glow:#A92C55;
  --spot-glow-rgb:169,44,85;
  --spot-shadow-rgb:90,15,40;

  --success:#15803D;
  --success-soft:#E8F5EC;
  --warning:#B45309;
  --warning-soft:#FBF1E3;
  --danger:#B91C1C;
  --danger-soft:#FBEAEA;
  --info:#1D4ED8;
  --info-soft:#EBF0FD;

  /* chart palette, validated for colour-blind separation. Assign by entity:
     c1 revenue · c2 orders/sales · c3 reps · c4 paid · c5 customers · c6 alerts */
  --c1:#A41E4B;
  --c2:#2F6FB5;
  --c3:#D9A227;
  --c4:#1E9E8F;
  --c5:#7A5AC8;
  --c6:#E0713C;
  --c1-soft:#F8E9EE; --c1-text:#A41E4B;
  --c2-soft:#E9F1F9; --c2-text:#2F6FB5;
  --c3-soft:#FBF3DD; --c3-text:#9A7110;
  --c4-soft:#E4F5F3; --c4-text:#14796D;
  --c5-soft:#F0ECFA; --c5-text:#7A5AC8;
  --chart-muted:#B4B4BC;
  --chart-band:rgba(24,24,27,.045);

  --radius-sm:8px;
  --radius:10px;
  --radius-lg:14px;
  --radius-pill:999px;

  --shadow-sm:0 1px 2px rgba(24,24,27,.05);
  --shadow-md:0 1px 2px rgba(24,24,27,.05), 0 8px 20px -8px rgba(24,24,27,.12);
  --shadow-lg:0 20px 50px -14px rgba(24,24,27,.25);

  --ease:cubic-bezier(.2,.8,.2,1);
  --sidebar-w:272px;
  --sidebar-rail:72px;
}

/* Dark mode's neutrals and status colours. The accent family and chart series
   come from app/js/theme.js. Text tokens hold 4.5:1 on --surface and --bg. */
:root[data-theme="dark"]{
  color-scheme:dark; /* native inputs, selects, scrollbars and date pickers */
  --bg:#111114;
  --surface:#1B1B1F;
  --surface-2:#28282D;
  --bg-soft:#222227;
  --card:#1B1B1F;
  --ink:#F4F4F5;
  --ink-soft:#C4C4CC;
  --ink-faint:#9B9BA5;
  --line:#34343A;
  --line-soft:#28282D;
  --line-strong:#4A4A52;
  --row-hover:#232328;
  --seg-bg:#28282D;
  --skel-a:#28282D;
  --skel-b:#34343A;
  --topbar-bg:rgba(27,27,31,.92);
  --teal:#2DD4BF;
  --teal-soft:#133A36;

  --success:#4ADE80;
  --success-soft:#14321F;
  --warning:#FBBF24;
  --warning-soft:#3A2C0C;
  --danger:#F87171;
  --danger-soft:#3D1A1A;
  --info:#7AA7FF;
  --info-soft:#1A2848;

  --chart-muted:#71717A;
  --chart-band:rgba(255,255,255,.06);
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow-md:0 1px 2px rgba(0,0,0,.4), 0 8px 20px -8px rgba(0,0,0,.6);
  --shadow-lg:0 20px 50px -14px rgba(0,0,0,.75);
}

/* Colours only change smoothly while a theme is being changed, so nothing else
   on the page picks up an extra transition. */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after{
  transition:background-color .28s ease, border-color .28s ease, color .28s ease, fill .28s ease, stroke .28s ease, box-shadow .28s ease !important;
}

/* ---------------------------- base + components ----------------------------
   Restyles the components every page already uses, so all the existing pages
   pick up the system without template changes. */
body{ background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased; font-feature-settings:"cv11","ss03"; }
body.shell-locked{ overflow:hidden; }
h1,h2,h3,h4{ letter-spacing:-.011em; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.app-splash{ min-height:100vh; display:grid; place-items:center; }
.app-splash img{ height:40px; width:auto; border-radius:9px; animation:mgPulse 1.3s ease-in-out infinite; }
@keyframes mgPulse{ 50%{ opacity:.45; transform:scale(.95); } }

.page-head{ margin-bottom:22px; align-items:center; }
.page-head h2{ font-size:22px; font-weight:650; text-transform:none; letter-spacing:-.018em; line-height:1.25; }
.page-head p{ color:var(--ink-faint); margin-top:3px; font-size:13.5px; }

.btn{ border-radius:var(--radius-sm); font-weight:600; font-size:13.5px; padding:9px 16px; transition:background .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s; }
.btn:active{ transform:translateY(.5px); }
.btn-sm{ padding:6px 12px; font-size:12.5px; }
.btn-primary{ box-shadow:0 1px 2px rgba(var(--btn-shadow-rgb),.3), inset 0 1px 0 rgba(255,255,255,.1); }
.btn-secondary{ box-shadow:var(--shadow-sm); }
.btn-secondary:hover:not(:disabled){ background:var(--bg); border-color:var(--line-strong); }
.btn-icon{ border-radius:var(--radius-sm); }
.btn-icon-only{ width:32px; height:32px; padding:0; }
.btn-light{ background:#fff; color:var(--btn-light-ink); }
.btn-light:hover:not(:disabled){ background:var(--btn-light-hover); }
.btn-ghost-light{ background:rgba(255,255,255,.12); color:#fff; border-color:rgba(255,255,255,.18); }
.btn-ghost-light:hover:not(:disabled){ background:rgba(255,255,255,.2); }

.badge{ font-size:11.5px; font-weight:600; padding:2px 8px; border-radius:6px; text-transform:none; letter-spacing:0; white-space:nowrap; }

.form-row label{ font-size:12.5px; font-weight:600; text-transform:none; letter-spacing:0; color:var(--ink-soft); }
.form-row input, .form-row textarea, .form-row select{
  border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface);
  transition:border-color .15s, box-shadow .15s;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); background:var(--surface); }
.form-section-label{ font-size:12px; font-weight:650; text-transform:none; letter-spacing:0; color:var(--ink); }

.search-box, .select-wrap, .ofb-search{ border-radius:var(--radius-sm); border-width:1px; }
.search-box{ padding:7px 12px; box-shadow:var(--shadow-sm); }
.search-box:focus-within{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.select-wrap select{ font-weight:500; padding:7px 34px 7px 12px; }
.select-wrap:hover{ border-color:var(--line-strong); }
.ofb-search{ background:var(--surface); padding:7px 12px; }

.filter-pill, .chip{ border-radius:var(--radius-sm); font-weight:500; padding:5px 11px; }
.filter-pill:hover, .chip:hover{ border-color:var(--line-strong); }
.filter-pill.is-active{ background:var(--accent-soft); color:var(--accent-dark); border-color:var(--accent-border); }
.page-btn{ border-radius:var(--radius-sm); border-width:1px; font-weight:500; }
.page-btn:hover:not(:disabled){ border-color:var(--line-strong); }
.page-btn.is-active{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }

.popup-overlay{ background:rgba(24,24,27,.42); backdrop-filter:blur(3px); }
.popup-card{ border-radius:16px; border:1px solid var(--line); animation:mgRise .22s var(--ease); }
@keyframes mgRise{ from{ opacity:0; transform:translateY(8px) scale(.99); } to{ opacity:1; transform:none; } }
.toast{ border-radius:var(--radius); }

/* plain cards used across the older pages */
.home-module-card, .admin-stat-tile, .orders-filterbar, .activity-feed, .review-card{
  border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); border:1px solid var(--line);
}
.home-module-card{ padding:18px 20px 20px; }
.home-module-card:hover{ transform:none; box-shadow:var(--shadow-md); }
.home-module-title{ font-size:14px; font-weight:650; }
.home-modules-grid{ grid-template-columns:repeat(auto-fill,minmax(min(340px,100%),1fr)); gap:16px; margin-bottom:24px; }
.home-icon-badge{ width:30px; height:30px; border-radius:8px; }
.home-module-bar{ height:5px; }
.admin-stats-row{ gap:12px; }
.admin-stat-tile{ padding:14px 16px; }
.admin-stat-tile .v{ font-size:22px; font-weight:650; letter-spacing:-.02em; }
.admin-stat-tile .l{ font-size:12px; font-weight:500; text-transform:none; letter-spacing:0; }
.home-module-card .admin-stats-row{ gap:8px; grid-template-columns:repeat(auto-fit,minmax(66px,1fr)); }
.home-module-card .admin-stat-tile{ box-shadow:none; border-color:var(--line-soft); padding:10px 12px; border-radius:var(--radius); }
.home-module-card .admin-stat-tile .v{ font-size:16px; }
.home-module-card .admin-stat-tile .l{ font-size:11px; }
.home-icon-badge.c-vendors{ background:var(--accent-soft); color:var(--accent); }
.home-module-bar-fill.c-vendors{ background:var(--accent); }

#admin-main table.order-table{ font-size:13px; }
#admin-main table.order-table thead th{ background:var(--row-hover); font-size:12px; font-weight:600; text-transform:none; letter-spacing:0; color:var(--ink-faint); padding:10px 16px; }
#admin-main table.order-table td{ padding:12px 16px; border-color:var(--line-soft); }
#admin-main table.order-table tbody tr:hover{ background:var(--row-hover); }
.orders-grid tbody tr:hover{ background:var(--row-hover) !important; }
#admin-main .assoc-table-wrap{ border-radius:var(--radius-lg); }
.detail-row-label{ font-size:12px; font-weight:600; text-transform:none; letter-spacing:0; }
.ord-num{ font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:12px; font-weight:500; background:var(--surface-2); border:0; border-radius:5px; padding:2px 6px; }
.rep-target-fill{ background:var(--accent); }
.rep-target-fill.is-hot{ background:var(--c4); }

.rank-badge{ background:var(--surface-2); color:var(--ink-soft); font-weight:600; box-shadow:none; flex-basis:24px; height:24px; font-size:11.5px; }
.rank-badge.rank-1, .rank-badge.rank-2, .rank-badge.rank-3{ background:var(--accent-soft); color:var(--accent-dark); box-shadow:none; }
.rank-name, .rank-value{ font-weight:600; font-size:13px; }
.rank-item{ padding:9px 8px; }
.rank-item:hover{ background:var(--bg); }
.rank-bar{ height:4px; margin-top:7px; }
.rank-bar span{ background:var(--accent); }

/* ------------------------------ shell + sidebar --------------------------- */
.admin-shell{ display:flex; min-height:100vh; }
.admin-content{ flex:1; min-width:0; }
#admin-main{ max-width:none; margin:0; padding:28px 32px 64px; animation:mgIn .22s var(--ease); }
@keyframes mgIn{ from{ opacity:0; transform:translateY(4px); } to{ opacity:1; transform:none; } }

.admin-sidebar{
  width:var(--sidebar-w); flex-shrink:0; position:sticky; top:0; height:100vh; z-index:40;
  display:flex; flex-direction:column; background:var(--surface); border-right:1px solid var(--line); color:var(--ink);
}
.is-animating .admin-sidebar{ transition:width .22s var(--ease); }
.admin-sidebar-brand{ display:flex; align-items:center; gap:9px; padding:16px 12px 12px 14px; min-height:64px; }
.admin-sidebar-brand .brand-logo{ height:32px; width:auto; border-radius:7px; flex-shrink:0; box-shadow:none; }
.shell-brand-text{ min-width:0; flex:1; display:flex; flex-direction:column; line-height:1.2; overflow:hidden; white-space:nowrap; }
.shell-brand-text span{ font-size:11.5px; color:var(--ink-faint); white-space:nowrap; }

.shell-icon-btn{
  width:30px; height:30px; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center;
  border:0; border-radius:7px; background:none; color:var(--ink-faint); cursor:pointer;
  transition:background .15s, color .15s;
}
.shell-icon-btn:hover{ background:var(--surface-2); color:var(--ink); }
.shell-drawer-close, .shell-topbar, .shell-backdrop{ display:none; }

.admin-nav-search{ position:relative; margin:0 12px 6px; display:flex; align-items:center; }
.admin-nav-search .icon{ position:absolute; left:10px; color:var(--ink-faint); pointer-events:none; }
.admin-nav-search input{
  width:100%; height:34px; padding:0 10px 0 31px; font:inherit; font-size:13px; color:var(--ink);
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius-sm);
  transition:border-color .15s, box-shadow .15s, background .15s;
}
.admin-nav-search input::placeholder{ color:var(--ink-faint); }
.admin-nav-search input:focus{ outline:none; background:var(--surface); border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }

.admin-nav{
  display:flex; flex-direction:column; gap:1px; padding:6px 12px 12px; flex:1; min-height:0;
  overflow-y:auto; scrollbar-width:thin; scrollbar-color:transparent transparent;
}
.admin-nav:hover{ scrollbar-color:var(--line-strong) transparent; }
.admin-nav-item{
  position:relative; display:flex; align-items:center; gap:10px; width:100%; min-height:34px;
  padding:6px 10px; border:0; border-radius:var(--radius-sm); background:none; cursor:pointer; text-align:left;
  font:inherit; font-size:13.5px; font-weight:500; color:var(--ink-soft);
  transition:background .14s, color .14s;
}
.admin-nav-item .icon{ flex-shrink:0; width:17px; height:17px; color:var(--ink-faint); transition:color .14s, transform .18s var(--ease); }
.admin-nav-item:hover{ background:var(--surface-2); color:var(--ink); }
.admin-nav-item:hover .icon{ color:var(--ink-soft); transform:translateX(1px); }
.admin-nav-item.is-active{ background:var(--accent-soft); color:var(--accent-dark); font-weight:600; }
.admin-nav-item.is-active .icon{ color:var(--accent); }
.admin-nav-item.is-active::before{
  content:""; position:absolute; left:-12px; top:7px; bottom:7px; width:3px;
  border-radius:0 3px 3px 0; background:var(--accent);
}
.admin-nav-text{ min-width:0; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-nav-item [hidden], .admin-nav [hidden]{ display:none !important; }

.admin-nav-group{ display:flex; flex-direction:column; gap:1px; margin-top:14px; }
.admin-nav-group-label{
  display:flex; align-items:center; gap:6px; width:100%; margin:0 0 2px; padding:3px 10px; border:0; background:none;
  font:inherit; font-size:11.5px; font-weight:500; color:var(--ink-faint); text-align:left; border-radius:6px; cursor:pointer;
}
.admin-nav-group-label.is-static{ cursor:default; }
button.admin-nav-group-label:hover{ color:var(--ink); }
.admin-nav-group-label .icon{ margin-left:auto; opacity:0; transition:transform .18s var(--ease), opacity .15s; }
.admin-nav-group:hover .admin-nav-group-label .icon, .admin-nav-group-label:focus-visible .icon, .admin-nav-group.is-collapsed .admin-nav-group-label .icon{ opacity:.8; }
.admin-nav-group.is-collapsed .admin-nav-group-label .icon{ transform:rotate(-90deg); }
.admin-nav-group-items{ display:flex; flex-direction:column; gap:1px; }
.admin-nav-group.is-collapsed .admin-nav-group-items{ display:none; }
.admin-nav.is-filtering .admin-nav-group.is-collapsed .admin-nav-group-items{ display:flex; }
.admin-nav.is-filtering .admin-nav-group-label .icon{ visibility:hidden; }
.admin-nav-group .nav-badge--group{ display:none; }
.admin-nav-group.is-collapsed .nav-badge--group{ display:inline-flex; }
.admin-nav-empty{ margin:10px; font-size:12.5px; color:var(--ink-faint); }

.nav-badge, .portal-nav-count{
  margin-left:auto; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center;
  min-width:18px; height:18px; padding:0 5px; border-radius:6px;
  font-size:11px; font-weight:600; line-height:1; letter-spacing:0; text-transform:none;
  color:var(--ink-soft); background:var(--surface-2);
}
.admin-nav-item:hover .nav-badge, .admin-nav-item:hover .portal-nav-count{ background:var(--line); }
.admin-nav-item.is-active .nav-badge, .admin-nav-item.is-active .portal-nav-count{ color:var(--accent-ink); background:var(--accent); }
.admin-nav-group-label .nav-badge{ margin-left:6px; }

.admin-sidebar-footer{ flex-shrink:0; display:flex; align-items:center; gap:4px; padding:10px 10px 10px 12px; border-top:1px solid var(--line); }
.admin-user{ display:flex; align-items:center; gap:10px; min-width:0; flex:1; }
.admin-user-info{ min-width:0; flex:1; }
.admin-user-name{ font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.3; }
.admin-user-role{ font-size:11.5px; color:var(--ink-faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.3; }
.admin-sidebar-footer .vendor-avatar{
  width:32px; height:32px; flex-shrink:0; border-radius:9px; font-size:12px; font-weight:650; letter-spacing:.02em;
  color:#fff; background:linear-gradient(145deg,var(--avatar-from),var(--avatar-to));
}
.admin-footer-actions{ display:flex; gap:0; flex-shrink:0; }
.admin-footer-actions .shell-icon-btn{ width:28px; height:28px; }

/* icon rail (desktop only; on mobile the sidebar is always a full drawer) */
@media (min-width:861px){
  .is-rail .admin-sidebar{ width:var(--sidebar-rail); }
  .is-rail .admin-sidebar-brand{ flex-direction:column; padding:14px 0 10px; gap:10px; }
  .is-rail .admin-sidebar-brand .brand-logo{ height:auto; width:54px; border-radius:5px; }
  .is-rail .shell-brand-text, .is-rail .admin-nav-search, .is-rail .admin-nav-text,
  .is-rail .admin-user-info, .is-rail .admin-nav-group-label, .is-rail .admin-nav-empty{ display:none; }
  .is-rail .admin-nav{ padding:4px 14px 12px; scrollbar-width:none; }
  .is-rail .admin-nav-item{ justify-content:center; padding:0; height:40px; min-height:40px; }
  .is-rail .admin-nav-item .icon{ width:18px; height:18px; }
  .is-rail .admin-nav-item:hover .icon{ transform:none; }
  .is-rail .admin-nav-item.is-active::before{ left:-14px; }
  .is-rail .admin-nav-group{ margin-top:8px; padding-top:8px; border-top:1px solid var(--line-soft); }
  .is-rail .admin-nav-group.is-collapsed .admin-nav-group-items{ display:flex; }
  .is-rail .nav-badge:not(.nav-badge--group), .is-rail .portal-nav-count{
    position:absolute; top:4px; right:3px; min-width:15px; height:15px; padding:0 3px; font-size:9.5px; border-radius:5px;
    color:var(--accent-ink); background:var(--accent); box-shadow:0 0 0 2px var(--surface);
  }
  .is-rail .admin-sidebar-footer{ flex-direction:column; padding:10px 0; gap:6px; }
  .is-rail .admin-user{ flex:none; }
  .is-rail .admin-footer-actions{ flex-direction:column; gap:2px; }
}
.shell-rail-tip{
  position:fixed; z-index:300; transform:translateY(-50%) translateX(-4px); padding:5px 9px; border-radius:7px;
  font-size:12.5px; font-weight:500; color:#fff; background:#27272A; box-shadow:var(--shadow-md); white-space:nowrap;
  pointer-events:none; opacity:0; transition:opacity .12s, transform .12s var(--ease);
}
.shell-rail-tip.is-on{ opacity:1; transform:translateY(-50%); }

/* portal: admin-set banner and targeted banners above the page */
.admin-content > .portal-banner{ margin:16px 32px 0; }

/* --------------------------- dashboard layout ----------------------------- */
.dash-head{ display:flex; align-items:center; justify-content:space-between; gap:14px 20px; flex-wrap:wrap; margin-bottom:20px; }
.dash-head h1{ font-size:24px; font-weight:650; letter-spacing:-.022em; line-height:1.2; }
.dash-head p{ margin-top:3px; font-size:13.5px; color:var(--ink-faint); }
.dash-head-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.dash-body{ transition:opacity .2s; }
.dash-body.is-refreshing{ opacity:.55; pointer-events:none; }

.dash-grid{ display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
.span-4{ grid-column:span 4; } .span-5{ grid-column:span 5; } .span-6{ grid-column:span 6; }
.span-7{ grid-column:span 7; } .span-8{ grid-column:span 8; } .span-12{ grid-column:span 12; }
/* older pages using the auto-fit chart row */
.dash-charts{ display:grid; grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr)); gap:16px; margin-bottom:24px; }

.dash-section{ margin:32px 0 14px; padding-top:22px; border-top:1px solid var(--line); }
.dash-section h2{ font-size:15px; font-weight:650; letter-spacing:-.012em; text-transform:none; }
.dash-section p{ margin-top:2px; font-size:12.5px; color:var(--ink-faint); }
.home-section-title{ font-size:15px; font-weight:650; }

/* date range: one row, above everything it scopes */
.seg{ display:inline-flex; padding:3px; gap:2px; background:var(--seg-bg); border-radius:9px; max-width:100%; overflow-x:auto; scrollbar-width:none; }
.seg-btn{
  border:0; background:none; padding:5px 11px; border-radius:6px; font:inherit; font-size:12.5px; font-weight:500;
  color:var(--ink-soft); cursor:pointer; white-space:nowrap; transition:background .14s, color .14s, box-shadow .14s;
}
.seg-btn:hover{ color:var(--ink); }
.seg-btn.is-active{ background:var(--surface); color:var(--ink); font-weight:600; box-shadow:0 1px 2px rgba(24,24,27,.1); }

/* needs attention */
.attn-strip{ display:flex; align-items:center; flex-wrap:wrap; gap:6px 8px; margin-bottom:16px; }
.attn-label{ font-size:12.5px; font-weight:500; color:var(--ink-faint); margin-right:4px; }
.attn-chip{
  display:inline-flex; align-items:center; gap:6px; padding:4px 10px 4px 8px; border:1px solid var(--line); border-radius:var(--radius-sm);
  background:var(--surface); font:inherit; font-size:12.5px; color:var(--ink-soft); cursor:pointer; box-shadow:var(--shadow-sm);
  transition:border-color .14s, background .14s, transform .14s var(--ease);
}
.attn-chip b{ font-weight:650; color:var(--ink); }
.attn-chip .icon{ color:var(--warning); }
.attn-chip:hover{ border-color:var(--line-strong); transform:translateY(-1px); }
.attn-chip.is-danger .icon, .attn-chip.is-danger b{ color:var(--danger); }

/* spotlight: the one figure this role most needs */
.dash-spotlight{
  position:relative; overflow:hidden; display:flex; align-items:center; flex-wrap:wrap; gap:18px 40px;
  padding:24px 28px; margin-bottom:16px; border-radius:var(--radius-lg); color:#fff;
  background:radial-gradient(120% 180% at 100% 0%, var(--spot-glow) 0%, rgba(var(--spot-glow-rgb),0) 55%), linear-gradient(115deg,var(--spot-from) 0%,var(--spot-to) 100%);
  box-shadow:0 12px 28px -14px rgba(var(--spot-shadow-rgb),.55);
}
.dash-spotlight-main{ flex:1 1 280px; min-width:0; }
.dash-spotlight-label{ font-size:12.5px; font-weight:500; color:rgba(255,255,255,.72); }
.dash-spotlight-figure{ display:block; margin-top:2px; font-size:38px; font-weight:650; letter-spacing:-.03em; line-height:1.15; }
.dash-spotlight-main p{ margin-top:6px; font-size:13px; color:rgba(255,255,255,.78); }
.dash-spotlight-meter{ height:6px; max-width:420px; margin-top:12px; border-radius:99px; background:rgba(255,255,255,.18); overflow:hidden; }
.dash-spotlight-meter span{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,#F0C75E,#E5A92F); animation:mgGrow .7s var(--ease); transform-origin:left; }
@keyframes mgGrow{ from{ transform:scaleX(0); } }
.dash-spotlight-stats{ display:flex; gap:32px; margin:0; }
.dash-spotlight-stats dt{ font-size:12px; color:rgba(255,255,255,.66); }
.dash-spotlight-stats dd{ margin:2px 0 0; font-size:17px; font-weight:600; letter-spacing:-.012em; }
.dash-spotlight-actions{ display:flex; gap:8px; flex-wrap:wrap; }

/* ------------------------------- stat tiles ------------------------------- */
.kpi-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(min(170px,100%),1fr)); gap:12px; margin-bottom:16px; }
.kpi-grid-primary{ grid-template-columns:repeat(auto-fit,minmax(min(160px,100%),1fr)); }
@media (max-width:1320px){ .kpi-grid-primary{ grid-template-columns:repeat(3,minmax(0,1fr)); } }
.kpi-card{
  position:relative; display:flex; flex-direction:column; min-width:0; padding:14px 16px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm);
  font:inherit; text-align:left; color:inherit; overflow:hidden;
  transition:box-shadow .18s, transform .18s var(--ease), border-color .18s;
}
.kpi-card.is-link{ cursor:pointer; }
.kpi-card.is-link:hover{ border-color:var(--line-strong); box-shadow:var(--shadow-md); transform:translateY(-1px); }
.kpi-top{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.kpi-label{ font-size:12.5px; font-weight:500; color:var(--ink-faint); min-width:0; }
.kpi-icon{ flex-shrink:0; width:26px; height:26px; display:flex; align-items:center; justify-content:center; border-radius:7px; background:var(--surface-2); color:var(--ink-soft); }
.kpi-icon svg{ width:14px; height:14px; }
.kpi-value{ margin-top:6px; font-size:25px; font-weight:650; letter-spacing:-.025em; line-height:1.2; overflow-wrap:anywhere; }
.kpi-sub{ display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; margin-top:4px; font-size:12px; color:var(--ink-faint); line-height:1.35; }
.kpi-delta{ display:inline-flex; align-items:center; font-weight:600; font-size:12px; white-space:nowrap; }
.kpi-delta.up{ color:var(--success); }
.kpi-delta.down{ color:var(--danger); }
.kpi-delta.flat{ color:var(--ink-faint); }
.kpi-spark{ display:block; width:calc(100% + 32px); height:34px; margin:10px -16px -14px; margin-top:auto; padding-top:8px; box-sizing:content-box; flex-shrink:0; }
.kpi-meter{ height:5px; margin-top:8px; border-radius:99px; background:var(--surface-2); overflow:hidden; }
.kpi-meter span{ display:block; height:100%; border-radius:99px; background:var(--accent); animation:mgGrow .7s var(--ease); transform-origin:left; }
.kpi-card.tone-success .kpi-icon{ background:var(--success-soft); color:var(--success); }
.kpi-card.tone-success .kpi-meter span{ background:var(--c4); }
.kpi-card.tone-warning .kpi-icon{ background:var(--warning-soft); color:var(--warning); }
.kpi-card.tone-danger .kpi-icon{ background:var(--danger-soft); color:var(--danger); }
.kpi-card.tone-info .kpi-icon{ background:var(--info-soft); color:var(--info); }

/* ---------------------------------- cards --------------------------------- */
.chart-card{
  min-width:0; padding:16px 18px 16px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); display:flex; flex-direction:column;
}
.chart-card.wide{ grid-column:1 / -1; }
.chart-card.is-flush{ padding-bottom:0; overflow:hidden; }
.chart-card-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:12px; min-height:26px; }
.chart-card-titles{ min-width:0; }
.chart-card-head h3{ font-size:14px; font-weight:600; letter-spacing:-.008em; line-height:1.35; }
.chart-card-head p{ margin-top:1px; font-size:12px; color:var(--ink-faint); line-height:1.35; }
.chart-card-head .btn-ghost{ flex-shrink:0; margin:-3px -6px 0 0; padding:4px 8px; font-size:12px; font-weight:500; color:var(--ink-faint); }
.chart-card-head .btn-ghost:hover{ color:var(--ink); }
.chart-card-figure{ display:flex; align-items:baseline; flex-wrap:wrap; gap:2px 8px; margin:-4px 0 12px; }
.chart-card-figure strong{ font-size:26px; font-weight:650; letter-spacing:-.025em; line-height:1.2; }
.chart-card-figure span:last-child:not(.kpi-delta){ font-size:12.5px; color:var(--ink-faint); }

/* --------------------------------- charts --------------------------------- */
.mg-chart{ margin:0; min-width:0; display:flex; flex-direction:column; flex:1; }
.mg-plot{ position:relative; min-width:0; }
.mg-plot[hidden]{ display:none; }
.mg-plot canvas{ display:block; }
.mg-foot{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-top:auto; padding-top:10px; }
.chart-legend{ display:flex; flex-wrap:wrap; gap:2px 4px; min-width:0; margin:0; font-size:12px; color:var(--ink-soft); }
.mg-legend-item{
  display:inline-flex; align-items:center; gap:6px; padding:2px 6px; margin-left:-6px; margin-right:6px; border:0; border-radius:5px;
  background:none; font:inherit; color:inherit; cursor:pointer; text-align:left; transition:background .14s, opacity .14s;
}
.mg-legend-item:hover{ background:var(--surface-2); }
.mg-legend-item.is-off{ opacity:.45; text-decoration:line-through; }
.mg-legend-item b{ font-weight:500; color:var(--ink-faint); font-variant-numeric:tabular-nums; }
.mg-key{ flex-shrink:0; width:9px; height:9px; border-radius:3px; }
.mg-key-line{ width:12px; height:2px; border-radius:2px; }
.mg-view-toggle{
  flex-shrink:0; margin-left:auto; padding:2px 7px; border:1px solid transparent; border-radius:5px; background:none;
  font:inherit; font-size:11.5px; font-weight:500; color:var(--ink-faint); cursor:pointer; transition:background .14s, color .14s;
}
.mg-view-toggle:hover{ background:var(--surface-2); color:var(--ink); }

.mg-chart-donut .mg-foot{ position:relative; flex-direction:column; align-items:stretch; }
.mg-chart-donut .chart-legend{ flex-direction:column; gap:1px; }
.mg-chart-donut .mg-legend-item{ width:100%; margin:0; padding:3px 6px; }
.mg-chart-donut .mg-legend-item b{ margin-left:auto; padding-left:10px; white-space:nowrap; }
.mg-chart-donut .mg-view-toggle{ align-self:flex-end; }
.mg-donut-center{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; pointer-events:none; text-align:center; }
.mg-donut-center strong{ font-size:21px; font-weight:650; letter-spacing:-.02em; line-height:1.15; }
.mg-donut-center span{ font-size:11.5px; color:var(--ink-faint); margin-top:1px; }
.chart-donut-wrap{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.chart-donut-wrap svg{ max-width:100%; height:auto; }

.mg-table{ overflow:auto; max-height:320px; border:1px solid var(--line-soft); border-radius:var(--radius-sm); }
.mg-table[hidden]{ display:none; }
.mg-data{ width:100%; border-collapse:collapse; font-size:12.5px; }
.mg-data th, .mg-data td{ padding:6px 10px; text-align:right; border-bottom:1px solid var(--line-soft); font-variant-numeric:tabular-nums; white-space:nowrap; }
.mg-data thead th{ position:sticky; top:0; background:var(--row-hover); font-weight:600; color:var(--ink-faint); }
.mg-data th:first-child{ text-align:left; font-weight:500; }
.mg-data tbody tr:last-child th, .mg-data tbody tr:last-child td{ border-bottom:0; }

.mg-tip{
  position:fixed; z-index:400; min-width:110px; max-width:280px; padding:8px 10px; border-radius:9px; pointer-events:none;
  background:var(--surface); border:1px solid var(--line); box-shadow:0 10px 28px -8px rgba(24,24,27,.22), 0 2px 5px rgba(24,24,27,.05);
  font-size:12.5px; opacity:0; transition:opacity .1s, left .08s linear, top .08s linear;
}
.mg-tip-title{ font-size:11.5px; color:var(--ink-faint); margin-bottom:4px; }
.mg-tip-row{ display:flex; align-items:center; gap:7px; line-height:1.55; white-space:nowrap; }
.mg-tip-row b{ font-weight:650; font-variant-numeric:tabular-nums; }
.mg-tip-row span{ color:var(--ink-faint); overflow:hidden; text-overflow:ellipsis; }
.mg-tip-key{ flex-shrink:0; width:10px; height:2.5px; border-radius:2px; }

/* -------------------------------- lists + tables -------------------------- */
.mg-rows-wrap{ overflow-x:auto; margin:0 -18px; }
.chart-card.is-flush .mg-rows-wrap{ margin-top:-2px; }
.mg-rows-wrap.is-scroll{ max-height:330px; overflow-y:auto; }
.mg-rows-wrap.is-scroll thead th{ position:sticky; top:0; z-index:1; }
.mg-rows{ width:100%; border-collapse:collapse; font-size:13px; }
.mg-rows th{ padding:7px 12px; text-align:left; font-size:12px; font-weight:500; color:var(--ink-faint); background:var(--row-hover); border-block:1px solid var(--line-soft); white-space:nowrap; }
.mg-rows td{ padding:10px 12px; border-bottom:1px solid var(--line-soft); vertical-align:middle; }
.mg-rows th:first-child, .mg-rows td:first-child{ padding-left:18px; }
.mg-rows th:last-child, .mg-rows td:last-child{ padding-right:18px; }
.mg-rows tbody tr:last-child td{ border-bottom:0; }
.mg-rows .num{ text-align:right; font-variant-numeric:tabular-nums; font-weight:500; white-space:nowrap; }
.mg-rows-primary{ font-weight:500; max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mg-rows-muted{ color:var(--ink-faint); white-space:nowrap; }
.mg-rows tbody tr{ transition:background .12s; }
.mg-rows tbody tr[tabindex]{ cursor:pointer; }
.mg-rows tbody tr:hover{ background:var(--row-hover); }
.mg-rows tbody tr:focus-visible{ outline-offset:-2px; }

.mg-timeline{ list-style:none; margin:0; padding:0; }
.mg-timeline-item{ position:relative; display:flex; align-items:flex-start; gap:11px; padding:8px 0; }
.mg-timeline-item:not(:last-child)::before{ content:""; position:absolute; left:13px; top:36px; bottom:-8px; width:1px; background:var(--line); }
.mg-timeline-dot{ flex-shrink:0; width:27px; height:27px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:var(--surface-2); color:var(--ink-soft); }
.mg-timeline-dot.t-c1{ background:var(--c1-soft); color:var(--c1-text); }
.mg-timeline-dot.t-c2{ background:var(--c2-soft); color:var(--c2-text); }
.mg-timeline-dot.t-c3{ background:var(--c3-soft); color:var(--c3-text); }
.mg-timeline-dot.t-c4{ background:var(--c4-soft); color:var(--c4-text); }
.mg-timeline-dot.t-c5{ background:var(--c5-soft); color:var(--c5-text); }
.mg-timeline-body{ flex:1; min-width:0; padding-top:1px; }
.mg-timeline-title{ font-size:13px; font-weight:500; line-height:1.35; overflow-wrap:anywhere; }
.mg-timeline-meta{ margin-top:1px; font-size:12px; color:var(--ink-faint); line-height:1.35; overflow-wrap:anywhere; }
.mg-timeline-when{ flex-shrink:0; padding-top:2px; font-size:11.5px; color:var(--ink-faint); white-space:nowrap; }

.team-target{ padding:10px 12px; margin-bottom:10px; background:var(--bg); border-radius:var(--radius); }
.team-target-top{ display:flex; justify-content:space-between; align-items:baseline; font-size:12.5px; color:var(--ink-soft); margin-bottom:6px; }
.team-target-top strong{ font-size:15px; font-weight:650; color:var(--ink); }
.team-target-sub{ font-size:11.5px; color:var(--ink-faint); margin-top:5px; }
.rep-target-bar{ height:5px; margin-bottom:0; background:var(--surface-2); }
.rep-perf{ list-style:none; margin:0; padding:0; }
.rep-perf-row{ display:flex; align-items:flex-start; gap:10px; padding:9px 0; border-top:1px solid var(--line-soft); }
.rep-perf-row:first-child{ border-top:0; }
.rep-perf-rank{ flex-shrink:0; width:22px; height:22px; display:grid; place-items:center; border-radius:6px; background:var(--surface-2); font-size:11.5px; font-weight:600; color:var(--ink-soft); }
.rep-perf-row:first-child .rep-perf-rank{ background:var(--accent-soft); color:var(--accent-dark); }
.rep-perf-main{ flex:1; min-width:0; }
.rep-perf-top{ display:flex; justify-content:space-between; gap:10px; margin-bottom:5px; }
.rep-perf-top .rep-name-link{ font-size:13px; font-weight:500; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.rep-perf-value{ font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; flex-shrink:0; }
.rep-perf-sub{ margin-top:4px; font-size:11.5px; color:var(--ink-faint); }

.acct-list{ margin:0; display:flex; flex-direction:column; }
.acct-row{ display:flex; justify-content:space-between; gap:16px; padding:8px 0; border-top:1px solid var(--line-soft); font-size:13px; }
.acct-row:first-child{ border-top:0; padding-top:0; }
.acct-row dt{ flex-shrink:0; color:var(--ink-faint); font-size:12.5px; }
.acct-row dd{ margin:0; text-align:right; font-weight:500; overflow-wrap:anywhere; min-width:0; }

.quick-links{ display:flex; flex-direction:column; gap:2px; margin:-4px -8px; }
.quick-link{
  display:flex; align-items:center; gap:10px; width:100%; padding:8px; border:0; border-radius:var(--radius-sm); background:none;
  font:inherit; font-size:13px; font-weight:500; color:var(--ink); cursor:pointer; text-align:left; transition:background .14s;
}
.quick-link .icon:first-child{ color:var(--ink-faint); }
.quick-link .icon:last-child{ margin-left:auto; color:var(--ink-faint); opacity:0; transform:translateX(-3px); transition:opacity .14s, transform .18s var(--ease); }
.quick-link:hover{ background:var(--surface-2); }
.quick-link:hover .icon:last-child{ opacity:1; transform:none; }

.winback-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; border-top:1px solid var(--line-soft); }
.winback-row:first-child{ border-top:0; padding-top:0; }
.winback-main{ min-width:0; }
.wb-name{ font-size:13px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wb-sub{ font-size:12px; color:var(--ink-faint); margin-top:1px; }

/* --------------------------------- states --------------------------------- */
.mg-empty{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-height:170px; padding:20px; text-align:center; }
.mg-empty-icon{ display:flex; align-items:center; justify-content:center; width:42px; height:42px; margin-bottom:7px; border-radius:11px; background:var(--surface-2); color:var(--ink-faint); }
.mg-empty-title{ font-size:13px; font-weight:600; color:var(--ink-soft); }
.mg-empty-sub{ max-width:300px; font-size:12.5px; color:var(--ink-faint); line-height:1.4; }
.chart-card.is-flush .mg-empty{ padding-bottom:30px; }

.mg-skel{
  display:block; height:11px; border-radius:6px; background:linear-gradient(90deg,var(--skel-a) 25%,var(--skel-b) 50%,var(--skel-a) 75%);
  background-size:200% 100%; animation:mgShimmer 1.3s linear infinite;
}
.mg-skel-lg{ height:22px; }
.mg-skel-plot{ height:190px; margin-top:16px; border-radius:var(--radius); }
.mg-skel-card{ gap:10px; pointer-events:none; }
@keyframes mgShimmer{ to{ background-position:-200% 0; } }

/* -------------------------------- theme fixes ------------------------------
   Rules in style.css (shared with the storefront, so left alone) and admin.css
   that pair --ink as a background with fixed white text, or a saturated status
   colour with white text. In dark mode those colours turn light. */
.chip.is-active, .cpd-nav-btn:hover .page-btn, .pb-seg input:checked + span, .pb-pill, .cm-chip input:checked + span{ color:var(--surface); }
.pb-pill button{ color:var(--surface); background:rgba(127,127,127,.35); }
.shop-gallery-nav{ color:#2A2420; }
.btn-primary:focus-visible{ outline-color:var(--accent-dark); }
:root[data-theme="dark"] .toast.is-success{ background:#15803D; }
:root[data-theme="dark"] .toast.is-error{ background:#B91C1C; }
:root[data-theme="dark"] .toast:not(.is-success):not(.is-error){ background:#2E2E34; }
:root[data-theme="dark"] .delivery-tracker-step.is-complete .delivery-tracker-dot{ color:#0B2A16; }
:root[data-theme="dark"] .shell-rail-tip{ background:#3A3A41; }
:root[data-theme="dark"] .cp-field input:focus, :root[data-theme="dark"] .cp-field textarea:focus, :root[data-theme="dark"] .cp-field select:focus{ background:var(--surface); }

/* ------------------------------- appearance -------------------------------- */
.theme-layout{ display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:16px; align-items:start; }
.theme-settings{ display:flex; flex-direction:column; gap:16px; min-width:0; }
.theme-group{ margin:0; min-inline-size:0; padding-top:10px; }
.theme-group legend{ float:left; width:100%; margin-bottom:12px; padding:0; font-size:14px; font-weight:600; color:var(--ink); }
.theme-group legend + *{ clear:both; }
.theme-note{ margin:8px 0 0; font-size:12px; color:var(--ink-faint); }
.theme-note:empty{ display:none; }

.theme-modes{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.theme-mode{ position:relative; cursor:pointer; }
.theme-mode input, .theme-swatch input{ position:absolute; opacity:0; width:100%; height:100%; inset:0; margin:0; cursor:pointer; }
.theme-mode span{
  display:flex; align-items:center; justify-content:center; gap:8px; height:42px; padding:0 8px;
  border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface);
  font-size:13px; font-weight:500; color:var(--ink-soft); transition:border-color .14s, background .14s, color .14s;
}
.theme-mode:hover span{ border-color:var(--line-strong); }
.theme-mode input:checked + span{ background:var(--accent-soft); border-color:var(--accent); color:var(--accent-dark); font-weight:600; }
.theme-mode input:focus-visible + span{ outline:2px solid var(--accent); outline-offset:2px; }

.theme-swatches{ display:grid; grid-template-columns:repeat(auto-fill,minmax(58px,1fr)); gap:12px 6px; }
.theme-swatch{ position:relative; display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; }
.theme-swatch-dot{
  display:flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:50%; color:transparent;
  box-shadow:0 0 0 2px var(--surface), 0 0 0 3px transparent; transition:box-shadow .14s, transform .14s var(--ease);
}
.theme-swatch:hover .theme-swatch-dot{ transform:scale(1.07); }
.theme-swatch input:checked + .theme-swatch-dot{ color:#fff; box-shadow:0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.theme-swatch input:focus-visible + .theme-swatch-dot{ outline:2px solid var(--ink); outline-offset:5px; }
.theme-swatch-name{ font-size:12px; color:var(--ink-soft); }
.theme-swatch input:checked ~ .theme-swatch-name{ color:var(--ink); font-weight:600; }

.theme-custom{ margin-top:18px; padding-top:14px; border-top:1px solid var(--line-soft); }
.theme-custom label{ display:block; margin-bottom:6px; font-size:12.5px; font-weight:600; color:var(--ink-soft); }
.theme-custom-row{ display:flex; gap:8px; max-width:240px; }
#theme-custom-picker{ flex-shrink:0; width:42px; height:38px; padding:3px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); cursor:pointer; }
#theme-custom-hex{
  flex:1; min-width:0; height:38px; padding:0 10px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface);
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:13px; color:var(--ink); transition:border-color .15s, box-shadow .15s;
}
#theme-custom-hex:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
#theme-custom-hex[aria-invalid="true"]{ border-color:var(--danger); }

.theme-preview-card{ position:sticky; top:20px; }
.theme-preview-card h3{ font-size:14px; font-weight:600; }
.theme-preview-card > p{ margin:1px 0 12px; font-size:12px; color:var(--ink-faint); }
.theme-preview{ border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; background:var(--bg); }
.theme-preview-nav{ position:relative; display:flex; flex-direction:column; gap:1px; padding:8px 8px 8px 12px; background:var(--surface); border-bottom:1px solid var(--line); overflow:hidden; }
.theme-preview-nav .admin-nav-item{ cursor:default; font-size:12.5px; min-height:30px; }
.theme-preview-body{ display:flex; flex-direction:column; gap:10px; padding:12px; }
.theme-preview-stat{ display:flex; align-items:baseline; flex-wrap:wrap; gap:2px 8px; }
.theme-preview-stat .kpi-label{ width:100%; }
.theme-preview-stat strong{ font-size:20px; font-weight:650; letter-spacing:-.02em; color:var(--ink); }
.theme-preview-bars{ display:flex; align-items:flex-end; gap:6px; height:64px; padding-bottom:1px; border-bottom:1px solid var(--line); }
.theme-preview-bars span{ flex:1; border-radius:3px 3px 0 0; }
.theme-preview-input{ margin:0; }
.theme-preview-input input{ width:100%; height:34px; padding:0 10px; font:inherit; font-size:12.5px; color:var(--ink); border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.theme-preview-row{ display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.theme-preview-row .btn{ cursor:default; }
.theme-preview-row a{ font-size:12.5px; font-weight:500; color:var(--accent); text-decoration:underline; }

.theme-actions{
  position:sticky; bottom:0; z-index:5; display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:8px;
  margin:16px -8px -8px; padding:10px 8px; background:var(--bg);
}
.theme-status{ margin-right:auto; font-size:12.5px; font-weight:500; color:var(--ink-soft); }
@media (max-width:1040px){
  .theme-layout{ grid-template-columns:minmax(0,1fr); }
  .theme-preview-card{ position:static; }
}
@media (max-width:560px){
  .theme-status{ width:100%; }
  .theme-actions .btn{ flex:1 1 auto; justify-content:center; }
}

/* ------------------------------- responsive ------------------------------- */
@media (max-width:1180px){
  .span-4{ grid-column:span 6; } .span-5, .span-7, .span-8{ grid-column:span 12; }
  .dash-grid > .span-4:last-child:nth-child(odd){ grid-column:span 12; }
}
@media (max-width:860px){
  .admin-sidebar{
    position:fixed; top:0; left:0; bottom:0; width:min(290px,86vw); height:auto; z-index:210;
    transform:translateX(-102%); transition:transform .24s var(--ease); box-shadow:none;
  }
  .is-drawer-open .admin-sidebar{ transform:none; box-shadow:var(--shadow-lg); }
  .shell-backdrop{
    display:block; position:fixed; inset:0; z-index:200; background:rgba(24,24,27,.42);
    opacity:0; pointer-events:none; transition:opacity .2s;
  }
  .is-drawer-open .shell-backdrop{ opacity:1; pointer-events:auto; }
  .shell-rail-toggle{ display:none; }
  .shell-drawer-close{ display:inline-flex; }
  .shell-topbar{
    display:flex; align-items:center; gap:10px; position:sticky; top:0; z-index:30; height:54px; padding:0 12px;
    background:var(--topbar-bg); backdrop-filter:blur(8px); border-bottom:1px solid var(--line);
  }
  .shell-topbar .brand-logo{ height:28px; width:auto; border-radius:6px; box-shadow:none; }
  .shell-topbar-title{ font-size:13px; font-weight:500; color:var(--ink-faint); }
  .admin-nav-item{ min-height:40px; }
  #admin-main{ padding:20px 16px 48px; }
  .admin-content > .portal-banner{ margin:12px 16px 0; }
  .dash-head{ align-items:flex-start; flex-direction:column; }
  .dash-head-actions{ width:100%; }
  .dash-head-actions .seg{ flex:1 1 auto; }
  .dash-head-actions .seg-btn{ flex:1 1 auto; }
  .span-4, .span-5, .span-6, .span-7, .span-8, .span-12{ grid-column:span 12; }
  .dash-spotlight{ padding:20px; gap:14px 28px; }
  .dash-spotlight-figure{ font-size:32px; }
  .hide-md{ display:none; }
}
@media (max-width:560px){
  .kpi-grid, .kpi-grid-primary{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .kpi-card{ padding:12px 13px; }
  .kpi-value{ font-size:20px; }
  .kpi-spark{ width:calc(100% + 26px); margin-left:-13px; margin-right:-13px; margin-bottom:-12px; }
  .chart-card{ padding:14px 14px; }
  .mg-rows-wrap{ margin:0 -14px; }
  .mg-rows th:first-child, .mg-rows td:first-child{ padding-left:14px; }
  .mg-rows th:last-child, .mg-rows td:last-child{ padding-right:14px; }
  .mg-rows-primary{ max-width:130px; }
  .hide-sm{ display:none; }
  .dash-spotlight-stats{ width:100%; gap:24px; }
  .home-modules-grid{ grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce){
  *, *::before, *::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
@media print{
  .shell-topbar, .shell-backdrop{ display:none !important; }
}
