:root {
  --bg-app:     #f1f1f1;
  --bg-surface: #ffffff;
  --bg-sidebar: #ebebeb;
  --bg-hover:   #e3e3e3;
  --bg-active:  #dcdcdc;
  --border:       #e1e1e1;
  --border-strong:#cfcfcf;
  --text:      #1a1a1a;
  --text-soft: #4a4a4a;
  --text-mute: #6b6b6b;
  --accent:      #ff2f3a;
  --accent-dk:   #c4000a;
  --accent-soft: rgba(255,47,58,.08);
  --accent-line: rgba(255,47,58,.28);
  --shadow-sm: 0 1px 0 rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --radius:    10px;
  --radius-sm:  8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.16,1,.3,1);


  --brand:      #ff2f3a;
  --brand-soft: rgba(255,47,58,.08);
  --brand-line: rgba(255,47,58,.28);
  --ink:   #1a1a1a;
  --ink-2: #4a4a4a;
  --ink-3: #6b6b6b;
  --ink-4: #9a9a9a;
  --surface:   #ffffff;
  --surface-2: #f5f5f5;
  --surface-3: #efefef;
  --line:      #e1e1e1;
  --line-soft: rgba(0,0,0,.05);
  --line-hair: rgba(0,0,0,.04);
  --pos:      #16a34a;  --pos-soft:    rgba(22,163,74,.1);
  --warn:     #92510a;  --warn-soft:   rgba(217,119,6,.1);
  --info:     #2563eb;  --info-soft:   rgba(37,99,235,.1);
  --violet:   #7c3aed;  --violet-soft: rgba(124,58,237,.1);
  --chip:     #e8e8e8;
  --track:    #e5e5e5;
  --shadow:     var(--shadow-sm);
  --shadow-pop: var(--shadow-md);
  --rad:    var(--radius);
  --rad-sm: var(--radius-sm);
}

/* ─────────────────────────────────────────────────────────────────────────────
   DARK MODE — a full re-map of the SAME design tokens. Every admin component reads
   these vars, so flipping them recolours the whole UI at once (backgrounds AND text
   AND borders together → no "dark text on dark bg" gaps). Only active when the topbar
   toggle sets data-theme="dark"; light mode is byte-for-byte unchanged.
   ───────────────────────────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-app:     #0f1216;
  --bg-surface: #181b20;
  --bg-sidebar: #14171b;
  --bg-hover:   #23272e;
  --bg-active:  #2c313a;
  --border:       #2a2f37;
  --border-strong:#3b414c;
  --text:      #e7e9ec;
  --text-soft: #b6bcc4;
  --text-mute: #868d97;
  --accent:      #ff4b54;
  --accent-dk:   #ff2f3a;
  --accent-soft: rgba(255,75,84,.15);
  --accent-line: rgba(255,75,84,.34);
  --shadow-sm: 0 1px 0 rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,.55);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.62);
  --brand:      #ff4b54;
  --brand-soft: rgba(255,75,84,.15);
  --brand-line: rgba(255,75,84,.34);
  --ink:   #e7e9ec;
  --ink-2: #b6bcc4;
  --ink-3: #868d97;
  --ink-4: #6b727c;
  --surface:   #181b20;
  --surface-2: #20242b;
  --surface-3: #262b33;
  --line:      #2a2f37;
  --line-soft: rgba(255,255,255,.07);
  --line-hair: rgba(255,255,255,.05);
  --pos:    #34d17c;  --pos-soft:    rgba(52,209,124,.16);
  --warn:   #f0a83a;  --warn-soft:   rgba(240,168,58,.16);
  --info:   #5b9bff;  --info-soft:   rgba(91,155,255,.16);
  --violet: #a888f7;  --violet-soft: rgba(168,136,247,.16);
  --chip:   #262b33;
  --track:  #2a2f37;
}
/* Hardcoded light values in this shell's own CSS, remapped for dark (dark-scoped only,
   so light mode is untouched). btn-pri is the important one: its background is var(--text)
   (light in dark mode) with white text → would be invisible; give it dark ink instead. */
:root[data-theme="dark"] .btn-pri { color: var(--bg-app); }
/* Resting btn-pri bg is var(--text) (light) with dark ink; the light-mode :hover swaps bg to
   #000, which would leave the dark ink invisible on black — keep the hover light in dark. */
:root[data-theme="dark"] .btn-pri:hover { background: #ffffff; }
:root[data-theme="dark"] a.notif-item:hover,
:root[data-theme="dark"] .notif-foot a:hover,
:root[data-theme="dark"] .metric:hover,
:root[data-theme="dark"] .fulfill-banner:hover,
:root[data-theme="dark"] .tbl tbody tr:hover td { background: var(--bg-hover); }
:root[data-theme="dark"] .kbd,
:root[data-theme="dark"] .search .kbd { background: var(--bg-active); color: var(--text-soft); }
/* Components that hardcode their own colors (not tokens) need dark-mode contrast fixes.
   Measured with a headless WCAG-contrast scan of every admin page in dark. */
/* Selected "Payment orchestration" card: hardcoded light-green bg + var(--text) label → the
   label went light-on-light (invisible). Recolour the card + its icon chip for dark. */
:root[data-theme="dark"] .orc-card.on { background: rgba(52,209,124,.12) !important; border-color: rgba(52,209,124,.42) !important; }
:root[data-theme="dark"] .orc-card.on .orc-card-ic { background: rgba(52,209,124,.16) !important; border-color: rgba(52,209,124,.42) !important; color: #34d17c !important; }
/* Email status pills hardcode dark-semantic text on translucent tints → too dark on dark. */
:root[data-theme="dark"] .em-status.sent    { color: #34d17c; }
:root[data-theme="dark"] .em-status.opened  { color: #6ea8ff; }
:root[data-theme="dark"] .em-status.bounced { color: #ff5c63; }
:root[data-theme="dark"] .em-status.failed  { color: #f0a83a; }
/* Same class of bug elsewhere (fixed light chip bg, or hardcoded dark-semantic text on a
   translucent tint) — found by the same headless WCAG dark scan. Dark-scoped only. */
/* Ctrl/K hint chips hardcode a light bg → light-on-dark chip; match the .kbd treatment. */
:root[data-theme="dark"] .kbd-wrap span { background: var(--bg-active); border-color: var(--border-strong); color: var(--text-soft); }
/* Table header rows hardcode #f7f7f7 with var(--text-soft) text → light-on-light in dark. */
:root[data-theme="dark"] .cust-table th,
:root[data-theme="dark"] .ab-table th { background: var(--surface-2); }
/* Grey status pills hardcode #ededed bg with var text → light-on-light in dark. */
:root[data-theme="dark"] .cust-pill { background: var(--bg-active); }
/* Alert banners + dashboard/WhatsApp status accents hardcode dark green/blue → too dark on
   dark tints; brighten to the dark-theme semantic colours (light mode keeps the deep hue). */
:root[data-theme="dark"] .a-ok,
:root[data-theme="dark"] .dsh-delta.up,
:root[data-theme="dark"] .dsh-stat-ic.g,
:root[data-theme="dark"] .dsh-glance-val.pos,
:root[data-theme="dark"] .wa-pill.sent { color: #34d17c; }
:root[data-theme="dark"] .a-info { color: #6ea8ff; }
/* Smooth cross-fade — enabled ONLY for ~260ms during a toggle (class added by JS),
   so no transition is ever attached to components in normal use. */
html.th-anim, html.th-anim *, html.th-anim *::before, html.th-anim *::after {
  transition: background-color .24s ease, border-color .24s ease, color .24s ease, fill .24s ease, box-shadow .24s ease !important;
}
#theme-toggle .th-sun { display: none; }
#theme-toggle .th-moon { display: block; }
:root[data-theme="dark"] #theme-toggle .th-sun { display: block; }
:root[data-theme="dark"] #theme-toggle .th-moon { display: none; }

*,*::before,*::after { box-sizing: border-box; }
html { margin: 0; height: 100%; }
body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
::selection { background: #c4000a; color: #fff; }
::-moz-selection { background: #c4000a; color: #fff; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 8px; border: 2px solid var(--bg-sidebar); }
*::-webkit-scrollbar-thumb:hover { background: #afafaf; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }


#root { height: 100vh; }
.app { display: grid; grid-template-rows: 56px 1fr; height: 100vh; }
.body-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; overflow: hidden; }
.sidebar-overlay { display: none; position: fixed; inset: 56px 0 0 0; z-index: 199; background: rgba(0,0,0,.35); backdrop-filter: blur(1px); }


.topbar {
  display: grid; grid-template-columns: 240px auto minmax(0, 1fr) auto;
  align-items: center; position: relative; z-index: 30;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-strong);
}


.site-switch { position: relative; padding-left: 12px; }
.site-switch-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 6px 10px; font-size: 13.5px; font-weight: 600;
  color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s;
}
.site-switch-btn:hover { border-color: var(--text-mute); }
.ssw-flag { display: flex; align-items: center; line-height: 0; flex: none; font-size: 16px; }
.ssw-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-switch-btn .chev { color: var(--text-mute); }
.site-switch-menu {
  position: absolute; top: calc(100% + 6px); left: 12px; z-index: 60; width: 264px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px; overflow: hidden;
}
.site-switch-menu[hidden] { display: none; }
.ssw-head { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-mute); padding: 8px 10px 6px; }
.ssw-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; transition: background .1s; }
.ssw-item:hover { background: var(--bg-hover); }
.ssw-item.sel { background: var(--bg-active); }
body.sm-open .ssw-all-sites { display:none !important; }
.ssw-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ssw-n { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssw-d { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssw-item .ssw-single { flex: 1; font-size: 13.5px; font-weight: 600; }
.ssw-check { margin-left: auto; color: var(--accent); opacity: 0; flex: none; }
.ssw-item.sel .ssw-check { opacity: 1; }
.ssw-sep { height: 1px; background: var(--border); margin: 5px 2px; }
.ssw-manage { color: var(--text-soft); font-weight: 600; font-size: 13px; }
.ssw-manage .ssw-flag { font-size: 15px; color: var(--text-mute); }


.brand { text-decoration: none; }
.brand-ico { border-radius: 7px; flex: none; display: block; object-fit: contain; }
.cur-switch { position: relative; }
.cur-switch .cur-btn { padding: 6px 9px; gap: 5px; }
.cur-switch .cur-sym { font-weight: 700; font-size: 14px; }
.cur-switch .cur-code { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.drop-menu.dm-right { left: auto; right: 0; min-width: 200px; }
.login-mark-img { width: 44px; height: 44px; border-radius: 12px; flex: none; box-shadow: 0 8px 22px -4px rgba(255,47,58,.45); }
@media (max-width: 1080px) { .cur-switch .cur-code { display: none; } }
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 16px; height: 100%; border-right: 1px solid var(--border-strong);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  display: grid; place-items: center;
  box-shadow: 0 4px 10px -3px rgba(255,47,58,.55);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--text); }
.search-wrap { padding: 0 14px; max-width: 580px; width: 100%; justify-self: center; }
.search {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 7px 10px; color: var(--text-mute);
  transition: border-color .15s, box-shadow .15s; cursor: text;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13.5px; color: var(--text); }
.search input::placeholder { color: var(--text-mute); }
.kbd-wrap { display: flex; gap: 3px; flex: none; }
.kbd-wrap span {
  font-size: 11px; background: #f1f1f1; border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 1px 5px; color: var(--text-mute); font-weight: 600;
}
.topbar-right { display: flex; align-items: center; gap: 5px; padding: 0 14px 0 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 0;
  background: transparent; display: grid; place-items: center;
  color: var(--text-soft); position: relative; transition: background .12s;
}
.icon-btn:hover, .icon-btn.on { background: var(--bg-hover); }
.dot-badge {
  position: absolute; top: 6px; right: 7px; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%; border: 1.5px solid var(--bg-sidebar);
}

.pk-trigger {
  position: relative; width: 34px; height: 34px; border-radius: 8px; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--accent); background: var(--accent-soft);
  transition: background .14s, transform .14s, color .14s; margin-right: 2px;
}
.pk-trigger:hover { background: var(--accent-line); transform: translateY(-1px); }
.pk-trigger.on { background: var(--accent); color: #fff; }
.pk-trigger svg { display: block; }
.pk-trigger .pk-trigger-dot {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
  background: #16a34a; border: 1.5px solid var(--bg-sidebar);
}
.pk-trigger.on .pk-trigger-dot { border-color: #fff; }
.avatar-btn {
  display: flex; align-items: center; gap: 8px; border: 0;
  background: transparent; padding: 4px 8px 4px 4px;
  border-radius: 8px; transition: background .12s;
}
.avatar-btn:hover { background: var(--bg-hover); }
.av {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 11.5px; letter-spacing: .02em;
}
.av-name { font-weight: 550; font-size: 13.5px; color: var(--text); }


.panel {
  position: absolute; top: 57px; z-index: 210;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md); overflow: hidden;
}

.panel[hidden] { display: none !important; }
.panel-notif { right: 52px; width: 356px; display: flex; flex-direction: column; }
.panel-prof  { right: 14px; width: 230px; }
.panel-head {
  padding: 13px 15px; border-bottom: 1px solid var(--border);
  font-weight: 650; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.panel-head .ph-l { display: flex; align-items: center; gap: 8px; }
.panel-head .ph-cnt {
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 20px; padding: 1px 8px;
}
.notif-list { max-height: min(424px, calc(100vh - 180px)); overflow-y: auto; overscroll-behavior: contain; }
.notif-item { display: flex; gap: 11px; padding: 12px 15px; border-bottom: 1px solid var(--border); transition: background .1s; }
a.notif-item:hover { background: #fafafa; }
.notif-item:last-child { border-bottom: 0; }
.notif-ico {
  width: 30px; height: 30px; border-radius: 8px; flex: none; margin-top: 1px;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-soft);
}
.notif-ico.t-order   { background: var(--info-soft);   border-color: rgba(37,99,235,.18);  color: var(--info); }
.notif-ico.t-shopify { background: var(--warn-soft);   border-color: rgba(217,119,6,.18);  color: var(--warn); }
.notif-ico.t-iframe  { background: var(--violet-soft); border-color: rgba(124,58,237,.18); color: var(--violet); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; margin-left: auto; flex: none; }
.notif-dot.read { background: transparent; }
.notif-txt { font-size: 13px; line-height: 1.45; color: var(--text); min-width: 0; }
.notif-txt b { font-weight: 650; }
.notif-txt .nb { color: var(--text-soft); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { color: var(--text-mute); font-size: 12px; margin-top: 2px; }
.notif-empty { padding: 34px 20px; text-align: center; }
.notif-empty .ne-ico {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 10px;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-mute);
}
.notif-empty .ne-t { font-size: 13.5px; font-weight: 650; }
.notif-empty .ne-d { font-size: 12.5px; color: var(--text-mute); margin-top: 2px; }
.notif-foot { border-top: 1px solid var(--border); flex: none; }
.notif-foot a {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 15px; font-size: 13px; font-weight: 600; color: var(--text-soft);
  transition: background .1s, color .1s;
}
.notif-foot a:hover { background: #fafafa; color: var(--text); }
.cnt-badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  border: 1.5px solid var(--bg-sidebar); font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
  .panel-notif { left: 8px; right: 8px; width: auto; }
}
.prof-head { padding: 11px 13px; border-bottom: 1px solid var(--border); }
.prof-head .nm { font-weight: 650; font-size: 13.5px; }
.prof-head .em { color: var(--text-mute); font-size: 12px; }


.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-strong);
  padding: 10px 12px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; text-align: left;
  padding: 7px 9px; border-radius: 8px; color: var(--text-soft);
  font-size: 13.5px; font-weight: 500; transition: background .1s, color .1s;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.nav-item .nav-ico { color: var(--text-mute); display: grid; place-items: center; flex: none; }
.nav-item.active .nav-ico, .nav-item:hover .nav-ico { color: var(--text); }
.nav-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.nav-sub { font-size: 13px; }
.nav-item.nav-child { padding-left: 22px; }
.nav-item.nav-child .nav-ico { opacity: .9; }
@media (max-width: 1080px) { .nav-item.nav-child { padding-left: 9px; } }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-toggle { width: 100%; cursor: pointer; }
.nav-group-toggle .grp-chev { margin-left: auto; color: var(--text-mute); transition: transform .18s var(--ease); }
.nav-group-toggle.collapsed .grp-chev { transform: rotate(-90deg); }
.nav-group-body { display: flex; flex-direction: column; gap: 2px; }
.nav-group-body[hidden] { display: none; }
@media (max-width: 1080px) { .nav-group-toggle .grp-chev { display: none; } }
.nav-badge {
  /* Fixed light-grey pill, so the number MUST use a fixed dark ink (a theme var like
     --text-soft flips to light in dark mode and vanishes on the light pill). */
  background: #d0d0d0; color: #2a2a2a; font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 6px;
  display: grid; place-items: center;
}
.nav-item.active .nav-badge { background: #bfbfbf; color: #1a1a1a; }
/* The live-sync badges are always in the DOM (so the poller can update them) and hidden via
   [hidden] when the count is 0. .nav-badge sets display:grid, which would otherwise beat the
   UA [hidden] rule and leave an empty grey pill — force it hidden. */
.nav-badge[hidden], .cnt-badge[hidden] { display: none !important; }
.sect-head {
  display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent;
  padding: 9px 9px 5px; color: var(--text-mute); font-size: 12px; font-weight: 650;
  letter-spacing: .01em; text-align: left; cursor: pointer;
}
.sect-head .s-chev { margin-left: auto; transition: transform .18s; }
.sect-head.collapsed .s-chev { transform: rotate(-90deg); }
.sect-body { display: flex; flex-direction: column; gap: 2px; }
.sidebar-spacer { flex: 1; }
.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 6px; }


.main { overflow-y: auto; background: var(--bg-app); }
.main-inner { max-width: 1180px; margin: 0 auto; padding: 22px 32px 80px; }


.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad, .cp { padding: 20px; }
.content-card { padding: 20px; margin-bottom: 14px; }
.content-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; }
.content-card p  { margin: 0 0 14px; color: var(--text-soft); font-size: 13.5px; line-height: 1.5; }
.section-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 4px 0 14px; }


.metric { padding: 14px 16px; cursor: pointer; transition: background .12s; }
.metric:hover { background: #fafafa; }
.metric-label {
  font-size: 13px; color: var(--text-soft); font-weight: 550; margin-bottom: 8px;
  border-bottom: 1px dashed var(--border-strong); padding-bottom: 2px; display: inline-block;
}
.metric-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.metric-num { font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.metric-toggle { display: grid; place-items: center; color: var(--text-mute); border: 0; background: transparent; cursor: pointer; }


.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.dropdown { position: relative; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 7px 11px; font-size: 13.5px; font-weight: 550;
  color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s; cursor: pointer;
}
.pill-btn:hover { border-color: var(--text-mute); }
.pill-btn .chev { color: var(--text-mute); }
.pill-static {
  margin-left: auto; background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 7px 12px; font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow-sm);
  min-width: 0; overflow-wrap: break-word;
}
.drop-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; display: none;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md); padding: 6px; min-width: 200px;
}
.drop-menu.open { display: block; }
.drop-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 7px; font-size: 13.5px;
  color: var(--text); text-align: left; cursor: pointer;
}
.drop-item:hover { background: var(--bg-hover); }
.drop-item .chk { color: var(--accent); opacity: 0; }
.drop-item.sel .chk { opacity: 1; }


.fulfill-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px; margin: 14px 0 22px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: background .12s; text-decoration: none;
}
.fulfill-banner:hover { background: #fafafa; }
.fulfill-banner .ico { color: var(--text-mute); }
.fulfill-banner .arr { margin-left: auto; color: var(--text-mute); }


.sect-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 4px 0 14px; }
.sh { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.sh-l .sh-t { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.sh-l .sh-d { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.sh-r { display: flex; align-items: center; gap: 8px; flex: none; }


.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tbody tr { transition: background .1s; cursor: pointer; }
.tbl tbody tr:hover td { background: #fafafa; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-actions { vertical-align: middle !important; white-space: nowrap; }
.tbl-actions .btn, .tbl-actions form { display: inline-flex; vertical-align: middle; }
.tbl-actions .btn, .tbl-actions form .btn { min-width: 64px; }
.tbl-actions .btn + .btn,
.tbl-actions form + .btn,
.tbl-actions .btn + form,
.tbl-actions form + form { margin-left: 5px; }


.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-sizing: border-box; min-height: 38px; line-height: 1;
  border-radius: 8px; padding: 0 16px; font-weight: 600;
  font-size: 13.5px; transition: .15s; border: 1px solid transparent;
  white-space: nowrap; cursor: pointer; font-family: inherit; text-align: center;
  vertical-align: middle;
}
.btn:hover { text-decoration: none; }
.btn svg, .btn img { flex: none; }
.btn-pri  { background: var(--text); color: #fff; box-shadow: var(--shadow-sm); }
.btn-pri:hover { background: #000; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 4px 12px -4px rgba(255,47,58,.5); }
.btn-accent:hover { background: var(--accent-dk); }
.btn-ghost { background: var(--bg-surface); border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-mute); }
.btn-danger { background: rgba(220,38,38,.08); color: #dc2626; border-color: rgba(220,38,38,.2); }
.btn-danger:hover { background: rgba(220,38,38,.14); }
.btn-sm  { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-xs  { min-height: 27px; padding: 0 10px; font-size: 11.5px; border-radius: 6px; gap: 5px; }
.link-btn { background: transparent; border: 0; color: var(--accent); font-weight: 600; font-size: 13.5px; padding: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }


.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--chip); color: var(--text-soft); }
.tag  { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.t-pos   { color: var(--pos);    background: var(--pos-soft); }
.t-warn  { color: var(--warn);   background: var(--warn-soft); }
.t-info  { color: var(--info);   background: var(--info-soft); }
.t-brand { color: var(--accent); background: var(--accent-soft); }
.t-violet{ color: var(--violet); background: var(--violet-soft); }
.t-mut   { color: var(--text-mute); background: var(--line-soft); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; }
.delta.up { color: var(--pos); } .delta.down { color: var(--accent); }


.fg { margin-bottom: 14px; }
.fl { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 5px; }
.fi,.fsel,.fta {
  width: 100%; padding: 8px 12px; background: var(--bg-surface);
  border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text);
  font-family: inherit; font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.fi:focus,.fsel:focus,.fta:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fta { resize: vertical; min-height: 110px; line-height: 1.5; }
.fsel option { background: var(--bg-surface); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .frow { grid-template-columns: 1fr; } }
.form-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.finput-prefix { display: flex; align-items: center; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.finput-prefix span { padding: 8px 12px; border-right: 1px solid var(--border-strong); color: var(--text-mute); font-size: 13.5px; white-space: nowrap; background: var(--bg-app); }
.finput-prefix input { border: none; background: none; padding: 8px 12px; color: var(--text); font-family: inherit; font-size: 13.5px; outline: none; flex: 1; }


.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; display: flex; align-items: flex-start; gap: 8px; }
.a-ok  { background: var(--pos-soft);   border: 1px solid rgba(22,163,74,.22);  color: #15803d; }
.a-err { background: var(--accent-soft); border: 1px solid var(--accent-line);  color: var(--accent-dk); }
.a-info{ background: var(--info-soft);  border: 1px solid rgba(37,99,235,.22);  color: #1d4ed8; }


hr.div { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.empty { text-align: center; padding: 44px 20px; color: var(--text-mute); }
.empty h3 { font-size: 15px; color: var(--text-soft); margin-bottom: 5px; }
.seg { display: inline-flex; background: var(--bg-app); border: 1px solid var(--border-strong); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { padding: 5.5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-mute); transition: .13s; font-family: inherit; cursor: pointer; border: none; background: none; }
.seg button.on { background: var(--bg-surface); color: var(--text); box-shadow: var(--shadow-sm); }


.fade { animation: fadeIn .35s var(--ease); }
@keyframes fadeIn { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: none; } }


.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  width: max-content; max-width: min(440px, calc(100vw - 32px));
  background: #1a1a1a; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.35; font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1400;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background:#1f2937; color:#fff; }
.toast.err { background:#991b1b; color:#fff; }
.toast.info { background:#1e3a8a; color:#fff; }


.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(145deg, #03071a, #0a1740); overflow: auto;
}
.login-glow {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 70% 10%, rgba(255,47,58,.18), transparent 45%),
              radial-gradient(circle at 5% 85%, rgba(255,47,58,.1), transparent 40%);
}
.login-card {
  width: 100%; max-width: 400px; background: rgba(10,19,48,.85);
  border: 1px solid #1c2c59; border-radius: 20px; padding: 38px;
  backdrop-filter: blur(20px); position: relative; z-index: 1;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), #c4000a);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px -4px rgba(255,47,58,.6);
}
.login-name { font-weight: 700; font-size: 20px; color: #fff; line-height: 1; }
.login-name small { display: block; font-size: 10.5px; color: #7886ad; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; margin-top: 3px; font-family: var(--font); }
.login-h   { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: #7886ad; margin-bottom: 22px; }
.login-card .fi { background: rgba(3,7,26,.5); border-color: #1c2c59; color: #fff; }
.login-card .fi:focus { border-color: rgba(255,47,58,.5); box-shadow: 0 0 0 3px rgba(255,47,58,.14); }
.login-card .fi::placeholder { color: #7886ad; }
.login-card .fl { color: #7886ad; }
.login-btn { width: 100%; justify-content: center; margin-top: 6px; padding: 11px; font-size: 14px; }
.login-card .btn-pri { background: var(--accent); box-shadow: 0 8px 20px -6px rgba(255,47,58,.6); }
.login-card .btn-pri:hover { background: #ff4349; }


#pl {
  position: fixed; inset: 0; z-index: 99999;
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease, transform .45s ease;
}
#pl.out { opacity: 0; transform: scale(1.012); pointer-events: none; }
.pl-c { display: flex; flex-direction: column; align-items: center; gap: 28px; animation: plIn .5s var(--ease); padding: 32px 24px; }
@keyframes plIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.pl-logo-img { height: 36px; width: auto; display: block; }
.pl-quote { max-width: 560px; text-align: center; }
.pl-qdeco { font-size: 68px; line-height: .65; color: var(--accent); font-family: Georgia,'Times New Roman',serif; margin-bottom: 14px; opacity: .75; display: block; }
.pl-qtext { font-size: 17px; font-weight: 500; color: var(--text); line-height: 1.65; letter-spacing: -.012em; }
.pl-qby { margin-top: 16px; font-size: 12px; font-weight: 600; color: var(--text-mute); letter-spacing: .06em; text-transform: uppercase; }
.pl-track { width: 200px; height: 2px; border-radius: 2px; background: var(--border-strong); overflow: hidden; }
.pl-bar { height: 100%; width: 0; border-radius: 2px; background: var(--accent); }


.mob-menu-btn {
  display: none; background: transparent; border: 0; padding: 8px; border-radius: 8px;
  color: var(--text-soft); cursor: pointer; transition: background .1s;
}
.mob-menu-btn:hover { background: var(--bg-hover); color: var(--text); }


@media (max-width: 1080px) {
  .body-grid { grid-template-columns: 64px minmax(0, 1fr); }
  .brand-name, .av-name { display: none; }
  .nav-item .lbl, .nav-section-label, .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 9px; }
  .brand { justify-content: center; padding: 0 8px; }
  .topbar { grid-template-columns: 64px auto minmax(0, 1fr) auto; }
  .ssw-name { display: none; }
  .main-inner { padding: 18px 16px 50px; }
}
@media (max-width: 720px) {
  .search-wrap { display: none; }
}


@media (max-width: 640px) {

  .mob-menu-btn { display: grid; place-items: center; }
  .brand-ico { display: none; }


  .topbar { grid-template-columns: auto 1fr auto; gap: 0; }

  .ssw-name { display: none; }


  .body-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 56px; bottom: 0; width: 240px; z-index: 200;
    transform: translateX(-100%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);

  }
  .sidebar .nav-item { justify-content: flex-start; padding: 7px 9px; }
  .sidebar .nav-item .lbl,
  .sidebar .nav-section-label,
  .sidebar .nav-badge { display: revert; }
  .sidebar.mob-open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; top: 56px; background: rgba(0,0,0,.35);
    z-index: 199; backdrop-filter: blur(1px);
  }
  .sidebar-overlay.mob-open { display: block; }


  .main-inner { padding: 14px 12px 60px; }


  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
  .tbl thead, .tbl tbody, .tbl tr { display: table; width: 100%; table-layout: fixed; }

  .g2, .g3, .g4 { grid-template-columns: 1fr !important; }
  .frow { grid-template-columns: 1fr !important; }


  .filter-row { gap: 7px; }
  .filter-row > * { flex-shrink: 0; }


  .page-hd { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-hd .btn { width: 100%; justify-content: center; }


  .pk-recent-wrap { display: none; }
}

@media (min-width: 480px) and (max-width: 640px) {
  .tbl thead { min-width: 520px; }
  .tbl tbody tr { min-width: 520px; }
}


@media (max-width: 420px) {
  .topbar-right { gap: 2px; padding-right: 8px; }
  .cur-switch { display: none; }
  .main-inner { padding: 10px 8px 60px; }
}


/* Wide data tables (orders, trials, subscribers) need a scroll container wherever they
   are wider than the screen — not just on phones. Measured on a real render, .ss-tbl runs
   6% past the viewport at 1100px and 28% past at 768px, and above 680px there was NO
   scroll container at all, so on a tablet the right-hand columns were simply cut off with
   no way to reach them. The treatment is the same one already trusted below 680px; it now
   starts where the overflow actually starts. */
@media (max-width: 1200px) {
  .main-inner table:not(.no-mobile-scroll) {
    display: block; width: 100%; max-width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
}
/* 9 Nov 2026 (owner, small Mac window): a table that already sits in its own scroll box (.tbl-wrap) stays a real
   table. As a block it shrank to its content, so rows stopped halfway across the card; as a table it fills the card,
   and the box still scrolls it sideways when it is wider than the screen. */
@media (max-width: 1200px) { .main-inner .tbl-wrap > table:not(.no-mobile-scroll) { display: table; } }

@media (max-width: 680px) {

  .main-inner [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  .main-inner input:not([type=checkbox]):not([type=radio]),
  .main-inner select,
  .main-inner textarea { max-width: 100% !important; }

  .main-inner img { max-width: 100%; height: auto; }

  .main-inner .filter-row,
  .main-inner .page-hd,
  .main-inner .toolbar,
  .main-inner .page-actions,
  .main-inner .pm-actions { flex-wrap: wrap; }
}


@media (max-width: 440px) {
  .an-kpi-grid, .an-traffic-kpis, .em-kpi-grid, .meta-stat-grid,
  .pg-grid, .dsh-kpis, .dsh-quick, .rev-health, .cust-summary {
    grid-template-columns: 1fr !important;
  }
}




@supports (height: 100dvh) {
  #root, .app { height: 100dvh; }
}


html, body { overflow-x: hidden; }
.app, .body-grid, .main, .main-inner { min-width: 0; }
.main-inner > *,
.filter-row > *, .ss-hd > *, .page-hd > * { min-width: 0; }


.main-inner p, .main-inner td, .main-inner dd,
.main-inner .card, .main-inner .content-card,
.main-inner .kv2 .v, .main-inner .mono { overflow-wrap: anywhere; }


@supports (padding: max(0px)) {
  .topbar  { padding-right: env(safe-area-inset-right); }
  .sidebar { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}


@media (max-width: 1024px) {
  .main-inner { padding-left: 22px; padding-right: 22px; }
}


@media (max-width: 768px) {
  .sidebar .nav-item { min-height: 42px; }
  .mob-menu-btn { min-width: 44px; min-height: 44px; }

  .main-inner .fi, .main-inner .fsel, .main-inner .fta,
  .main-inner input:not([type=checkbox]):not([type=radio]):not([type=range]),
  .main-inner select, .main-inner textarea { min-height: 44px; }
  .main-inner textarea { min-height: 88px; }

  .main-inner .btn:not(.btn-sm) { min-height: 44px; }

  .ss-pag-btn, .ss-pag-pages a, .sd-nav-btn { min-width: 36px; height: 36px; }

  .notif-foot a { min-height: 44px; }
  .notif-item { padding-top: 13px; padding-bottom: 13px; }

  /* The topbar cluster and the pill buttons were the gap in this block: measured on a
     real dashboard render they sit at 28-36px tall on a phone (site switcher 63x28,
     currency pill 47x31, theme/notif/parked-mode icons 34x34, avatar 62x36, the date
     and source pills 32). The admin is installed as a PWA and driven with a thumb, so
     these are the most-tapped controls on the screen and every one of them was under
     the 44px minimum. Width is left to the content - only the vertical hit area grows. */
  .icon-btn, .pk-trigger { width: 44px; height: 44px; }
  .site-switch-btn, .avatar-btn, .pill-btn { min-height: 44px; }

  /* Page-level controls the block above did not reach — measured on real renders at 390px:
     subscriber row actions 93x25, the sheet-section sort button 44x30, the analytics KPI
     segment tabs 115x35. The .btn rule nearby exempts .btn-sm on purpose, so these named
     classes are lifted explicitly rather than by loosening that exemption. */
  .sub-iact, .sub-btn, .ss-sort-btn, .kpi-seg-btn { min-height: 44px; }
}


@media (max-width: 640px) {
  .dsh-donut-row, .em-donut-wrap { flex-wrap: wrap; }
  .main-inner .fi, .main-inner .fsel, .main-inner .fta,
  .main-inner input:not([type=checkbox]):not([type=radio]):not([type=range]),
  .main-inner select, .main-inner textarea { font-size: 16px; }
}


@media (max-height: 480px) and (orientation: landscape) {
  .main-inner { padding-top: 12px; padding-bottom: 24px; }

  .sm-top { min-height: 40px; padding-top: calc(var(--sm-top, 0px) * 0.33); padding-bottom: 0; }
}


@media (max-width: 640px) {
  .topbar > .brand { display: none; }
}


@media (max-width: 360px) {
  .topbar-right { gap: 1px; padding-right: 6px; padding-left: 4px; }
  /* The narrowest phones carry five icons plus the site switcher in one row, so the
     full 44px square does not fit here. 40px keeps them comfortably tappable and still
     beats the 36px this used to be; the row is measured to fit at 320px. */
  .icon-btn, .pk-trigger { width: 40px; height: 40px; }
  .av { width: 26px; height: 26px; }
  .main-inner { padding-left: 8px; padding-right: 8px; }
  .site-switch { padding-left: 6px; }

  .sm-top { padding-left: 12px; padding-right: 12px; }
}


@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Owner 8 Nov 2026: from 1081 to 1141 px wide the top bar and the page were wider than the window (right edge cut off).
   The search box now shrinks instead, its Ctrl K hint goes when space is short, and the box hides where it would be too small to use. */
.search-wrap, .search { min-width: 0; }
.search input { min-width: 0; width: 0; }
@media (max-width: 1200px) { .search .kbd-wrap { display: none; } }
@media (max-width: 820px) { .search-wrap { display: none; } }

/* 9 Nov 2026 (owner: "keep fixing such misplacement issues, try all screens"): on phones the top bar was wider than
   the screen since the store switcher joined it - measured +21px at 375, +6 at 360/390, +36 at 430, +46 at 320 - so
   the avatar menu was cut off on every page. Nothing is removed: the currency switch hides up to 480 (it already did up
   to 420), the compact 40px icon row starts at 420 instead of 360, and the narrowest phones drop the small arrows.
   Measured to fit at 320, 340, 360, 375, 390, 414, 430, 480 and 640. */
@media (max-width: 480px) { .cur-switch { display: none; } }
@media (max-width: 420px) {
  .topbar-right { gap: 1px; padding-right: 6px; padding-left: 4px; }
  .icon-btn, .pk-trigger { width: 40px; height: 40px; }
  .av { width: 26px; height: 26px; }
}
@media (max-width: 360px) {
  .topbar .store-switch .store-btn { padding: 6px 8px; gap: 0; }
  .topbar .store-switch .chev { display: none; }
  .topbar .avatar-btn, .topbar .site-switch-btn { gap: 4px; }
}
@media (max-width: 340px) { .topbar .avatar-btn > svg, .topbar .site-switch-btn > .chev { display: none; } }
