/* ==========================================================================
   STREAD design system
   One brand blue — the logo's #4A86F7, deepened to #2F6FEB wherever it carries
   white text — on calm, slightly cool neutrals. Hierarchy comes from type,
   spacing and surface contrast, not from colour floods or heavy shadows.

   Loaded on every page. The public marketing site adds site.css; the buyer
   storefront adds store.css, which re-points the brand scale at the shop's own
   accent. Token names (--color-primary-*) are shared with src/lib/theme.js, so
   a platform colour chosen in Admin → Platform re-colours everything at once.
   ========================================================================== */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/static/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- 1. Tokens */

:root {
  /* Brand — derived from the logo gradient (#4C88F7 → #3873EE) */
  --color-primary-25: #f5f8ff;
  --color-primary-50: #eef4ff;
  --color-primary-100: #dde8ff;
  --color-primary-200: #c2d6fe;
  --color-primary-300: #97b9fc;
  --color-primary-400: #6d9cf9;
  --color-primary-500: #4a86f7;
  --color-primary-600: #2f6feb;
  --color-primary-700: #2459d0;
  --color-primary-800: #1d48aa;
  --color-primary-900: #1b3c85;
  --color-primary-950: #132652;
  --color-primary-wash: rgb(74 134 247 / 0.16);

  /* Neutrals — cool, a whisper of the brand hue */
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f7;
  --gray-150: #eceef2;
  --gray-200: #e4e7ec;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;
  --gray-950: #0c111d;

  /* Semantic surfaces & text */
  --color-page: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-2: #f9fafb;
  --color-sunken: #f2f4f7;
  --color-text: #101828;
  --color-text-secondary: #475467;
  --color-text-muted: #667085;
  --color-text-subtle: #98a2b3;
  --color-border: #e4e7ec;
  --color-border-subtle: #eceef2;
  --color-border-strong: #d0d5dd;
  --color-line: rgb(16 24 40 / 0.08);
  --color-link: var(--color-primary-700);

  /* Status — text / solid / surface / border */
  --color-success: #067647;
  --color-success-solid: #17b26a;
  --color-success-bg: #ecfdf3;
  --color-success-border: #abefc6;
  --color-warning: #b54708;
  --color-warning-solid: #f79009;
  --color-warning-bg: #fffaeb;
  --color-warning-border: #fedf89;
  --color-danger: #b42318;
  --color-danger-solid: #d92d20;
  --color-danger-bg: #fef3f2;
  --color-danger-border: #fecdca;
  --color-info-bg: var(--color-primary-50);

  /* Legacy aliases still referenced by a few inline styles */
  --soft-blue: var(--color-primary-50);
  --soft-mint: var(--color-success-bg);
  --soft-peach: var(--color-warning-bg);
  --soft-lilac: #f4f3ff;
  --soft-rose: #fff1f3;
  --soft-sand: #f8f7f4;

  /* Type */
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --text-2xs: 0.6875rem;   /* 11 */
  --text-xs: 0.78125rem;   /* 12.5 */
  --text-sm: 0.84375rem;   /* 13.5 */
  --text-base: 0.9375rem;  /* 15 */
  --text-lg: 1.0625rem;    /* 17 */
  --text-h4: 0.9375rem;
  --text-h3: 1.0625rem;
  --text-h2: 1.3125rem;
  --text-h1: 1.75rem;

  /* Space (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Shape — controls, containers and pills each get their own radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-btn: 10px;
  --radius-input: 10px;
  --radius-md: 12px;
  --radius-card-sm: 14px;
  --radius-card: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-modal: 22px;
  --radius-pill: 999px;

  /* Depth — whisper-quiet; surfaces separate by contrast first */
  --shadow-xs: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-card: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 1px rgb(16 24 40 / 0.02);
  --shadow-sm: 0 1px 3px rgb(16 24 40 / 0.07), 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow-md: 0 6px 14px -4px rgb(16 24 40 / 0.08), 0 2px 4px -2px rgb(16 24 40 / 0.04);
  --shadow-lg: 0 16px 32px -10px rgb(16 24 40 / 0.14), 0 4px 8px -4px rgb(16 24 40 / 0.04);
  --shadow-xl: 0 28px 60px -16px rgb(16 24 40 / 0.22);
  --ring: 0 0 0 4px rgb(74 134 247 / 0.2);
  --ring-danger: 0 0 0 4px rgb(217 45 32 / 0.14);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.35, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 560ms;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --content-max: 1240px;
  --container: 1200px;
  --bottom-nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --z-sticky: 30;
  --z-nav: 40;
  --z-overlay: 55;
  --z-drawer: 60;
  --z-modal: 200;
  --z-toast: 300;
}

/* ---------------------------------------------------------------- 2. Base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

img, svg, video { max-width: 100%; }
img { display: block; height: auto; }
svg.i { display: inline-block; flex: none; vertical-align: -0.2em; }

a { color: var(--color-link); text-decoration: none; transition: color var(--dur-1) ease; }
a:hover { color: var(--color-primary-800); }
/* Inline links inside running text get an underline; UI links (rows, nav, buttons) never do. */
:is(p, .help, .alert, .guide-steps, .dns-foot, .prose, .text-list) a:not(.btn):not(.data-row) {
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px;
}
:is(p, .help, .alert, .guide-steps, .dns-foot, .prose, .text-list) a:not(.btn):not(.data-row):hover { text-decoration-color: currentColor; }

::selection { background: var(--color-primary-100); color: var(--color-primary-950); }

:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

h1, h2, h3, h4 { margin: 0 0 10px; color: var(--color-text); line-height: 1.25; text-wrap: balance; }
h1 { font-size: var(--text-h1); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: var(--text-h2); font-weight: 680; letter-spacing: -0.02em; }
h3 { font-size: var(--text-h3); font-weight: 650; letter-spacing: -0.012em; }
h4 { font-size: var(--text-h4); font-weight: 650; letter-spacing: -0.005em; }
p { margin: 0 0 12px; }
ul, ol { padding-left: 20px; }
b, strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: 20px 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--gray-100);
  color: var(--gray-800);
  box-shadow: inset 0 0 0 1px var(--gray-200);
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }
.hidden { display: none !important; }

.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: var(--z-toast);
  padding: 10px 16px; border-radius: var(--radius-btn);
  background: var(--gray-900); color: #fff; font-weight: 600; font-size: var(--text-sm);
  transform: translateY(-150%); transition: transform var(--dur-2) var(--ease-out);
}
.skip-link:focus { transform: none; color: #fff; }

/* ---------------------------------------------------------------- 3. Text & utilities */

small, .small { font-size: var(--text-sm); }
.muted { color: var(--color-text-muted); }
.secondary-text { color: var(--color-text-secondary); }
.subtle { color: var(--color-text-subtle); }
.mono { font-family: var(--font-mono); font-size: 0.85em; letter-spacing: -0.01em; }
.tabular { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.break { overflow-wrap: anywhere; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.danger-text { color: var(--color-danger) !important; }
.success-text { color: var(--color-success) !important; }
.warning-text { color: var(--color-warning) !important; }
h1.mono { font-family: var(--font-mono); font-size: clamp(1.15rem, 2.4vw, 1.5rem); letter-spacing: -0.02em; font-weight: 650; overflow-wrap: anywhere; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-primary-700);
}

/* Spacing utilities always win over a component's own margins. */
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px !important; } .mt-2 { margin-top: 16px !important; } .mt-3 { margin-top: 24px !important; } .mt-4 { margin-top: 40px !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px !important; } .mb-2 { margin-bottom: 16px !important; } .mb-3 { margin-bottom: 24px !important; } .mb-4 { margin-bottom: 40px !important; }

.flex { display: flex; gap: 10px; align-items: center; min-width: 0; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack > * { min-width: 0; }
.stack > .card + .card { margin-top: 0; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid > .card + .card { margin-top: 0; }
.grid.align-start { align-items: start; }

.divider { height: 1px; background: var(--color-border-subtle); margin: 18px 0; border: 0; }
.scroll-y { max-height: 460px; overflow-y: auto; }

/* ---------------------------------------------------------------- 4. Buttons */

.btn {
  --btn-bg: var(--color-primary-600);
  --btn-bg-hover: var(--color-primary-700);
  --btn-bg-active: var(--color-primary-800);
  --btn-fg: #fff;
  --btn-border: transparent;
  --btn-shadow: 0 1px 2px rgb(16 24 40 / 0.1), inset 0 1px 0 rgb(255 255 255 / 0.14), inset 0 -1px 0 rgb(0 0 0 / 0.08);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--btn-border); border-radius: var(--radius-btn);
  background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-size: 0.90625rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em;
  white-space: nowrap; text-decoration: none; cursor: pointer; user-select: none;
  box-shadow: var(--btn-shadow);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-fg); text-decoration: none; }
.btn:active { background: var(--btn-bg-active); transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; pointer-events: none; }
.btn .i { width: 1.1em; height: 1.1em; flex: none; }
/* On narrow phones a long label wraps inside its button instead of pushing past the edge. */
@media (max-width: 480px) {
  .btn { white-space: normal; max-width: 100%; text-align: center; }
}

.btn-secondary {
  --btn-bg: #fff; --btn-bg-hover: var(--gray-50); --btn-bg-active: var(--gray-100);
  --btn-fg: var(--gray-800); --btn-border: var(--gray-300);
  --btn-shadow: var(--shadow-xs);
}
.btn-ghost {
  --btn-bg: transparent; --btn-bg-hover: var(--gray-100); --btn-bg-active: var(--gray-150);
  --btn-fg: var(--gray-700); --btn-shadow: none;
}
.btn-soft {
  --btn-bg: var(--color-primary-50); --btn-bg-hover: var(--color-primary-100); --btn-bg-active: var(--color-primary-200);
  --btn-fg: var(--color-primary-700); --btn-shadow: none;
}
.btn-danger {
  --btn-bg: var(--color-danger-solid); --btn-bg-hover: #b42318; --btn-bg-active: #912018;
}
.btn-danger-soft {
  --btn-bg: var(--color-danger-bg); --btn-bg-hover: #fee4e2; --btn-bg-active: #fecdca;
  --btn-fg: var(--color-danger); --btn-shadow: none;
}
.btn-dark {
  --btn-bg: var(--gray-900); --btn-bg-hover: var(--gray-800); --btn-bg-active: var(--gray-950);
  --btn-shadow: 0 1px 2px rgb(16 24 40 / 0.18), inset 0 1px 0 rgb(255 255 255 / 0.1);
}
.btn-white {
  --btn-bg: #fff; --btn-bg-hover: var(--gray-50); --btn-bg-active: var(--gray-100);
  --btn-fg: var(--gray-900); --btn-shadow: 0 1px 2px rgb(16 24 40 / 0.2);
}
.btn-ghost.danger-text:hover, .btn-ghost.danger-text:focus-visible { --btn-bg-hover: var(--color-danger-bg); }

.btn-sm { min-height: 32px; padding: 0 12px; gap: 6px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 0.96875rem; border-radius: var(--radius-md); }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 40px; flex: 0 0 40px; }
.btn-sm.btn-icon { width: 32px; flex-basis: 32px; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent;
  animation: spin 0.6s linear infinite;
}

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-btn);
  background: transparent; color: var(--gray-600); cursor: pointer;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease, border-color var(--dur-1) ease;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.icon-btn .i { width: 20px; height: 20px; }

/* Two-bar menu glyph that folds into an × while its sheet is open */
.menu-glyph { position: relative; display: block; width: 18px; height: 12px; }
.menu-glyph i { position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px; background: currentColor; transition: transform var(--dur-3) var(--ease-out), top var(--dur-3) var(--ease-out); }
.menu-glyph i:first-child { top: 2px; }
.menu-glyph i:last-child { top: 8px; }
[aria-expanded="true"] > .menu-glyph i:first-child { top: 5px; transform: rotate(45deg); }
[aria-expanded="true"] > .menu-glyph i:last-child { top: 5px; transform: rotate(-45deg); }

/* Plus that turns into a minus for <details> accordions */
.faq-plus { position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--gray-100); transition: background-color var(--dur-2) ease, transform var(--dur-3) var(--ease-out); }
.faq-plus::before, .faq-plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px; border-radius: 2px; background: var(--gray-700); transition: transform var(--dur-3) var(--ease-out), background-color var(--dur-2) ease; }
.faq-plus::after { transform: rotate(90deg); }
details[open] > summary .faq-plus { background: var(--color-primary-600); transform: rotate(180deg); }
details[open] > summary .faq-plus::before, details[open] > summary .faq-plus::after { background: #fff; }
details[open] > summary .faq-plus::after { transform: rotate(0deg); }

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .btn-icon { width: 44px; flex-basis: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ---------------------------------------------------------------- 5. Forms */

.form-row { margin-bottom: 18px; min-width: 0; }
.form-row:last-child { margin-bottom: 0; }
form > .form-row:last-of-type { margin-bottom: 20px; }
/* Rows inside a grid are spaced by the gap, so fields never touch once the grid collapses to one column. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; margin-bottom: 18px; }
.form-grid:last-child { margin-bottom: 0; }
.form-grid > * { min-width: 0; }
.form-grid > .form-row { margin-bottom: 0; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.form-section + .form-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--color-border-subtle); }
.form-section-title { font-size: var(--text-h4); margin: 0 0 4px; }
.form-section-desc { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0 0 16px; }

label, .label { display: block; margin-bottom: 6px; font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); line-height: 1.4; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.form-row { margin-bottom: 18px; }
legend.label { padding: 0; }
label .muted { font-weight: 500; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-row label { margin-bottom: 6px; }
.label-row a { font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.label-row a:hover { text-decoration: underline; }

input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=tel], input[type=url], input[type=date], input[type=datetime-local],
input[type=time], input[type=month], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 13px;
  font: inherit; font-size: var(--text-base); line-height: 1.45; color: var(--color-text);
  background-color: #fff;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-input);
  box-shadow: var(--shadow-xs);
  appearance: none; -webkit-appearance: none;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), background-color var(--dur-2) ease;
}
input:hover, select:hover, textarea:hover { border-color: #b8c0cc; }
input:focus, select:focus, textarea:focus, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--color-primary-500); box-shadow: var(--shadow-xs), var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--gray-400); opacity: 1; }
input[readonly], textarea[readonly], input:disabled, select:disabled, textarea:disabled {
  background-color: var(--gray-50); color: var(--gray-600); box-shadow: none; border-color: var(--gray-200);
}
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: #fda29b; }
input[aria-invalid="true"]:focus { box-shadow: var(--shadow-xs), var(--ring-danger); border-color: var(--color-danger-solid); }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }
input[type=number] { font-variant-numeric: tabular-nums; }
/* Date and time pickers: the browser draws these from its own parts (a monospace
   field, a bare calendar icon), so each part is restyled to match the other inputs. */
input[type=date], input[type=datetime-local], input[type=time], input[type=month] {
  min-width: 0; text-align: left; font-variant-numeric: tabular-nums; cursor: text;
}
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit { padding: 0; font-family: inherit; }
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-date-and-time-value { text-align: left; min-height: 1.45em; }
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-fields-wrapper { padding: 0; }
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-text { padding: 0 2px; color: var(--gray-400); }
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-month-field:focus,
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-day-field:focus,
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-year-field:focus,
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-hour-field:focus,
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-minute-field:focus,
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-datetime-edit-ampm-field:focus {
  background: var(--color-primary-100); color: var(--color-primary-800); border-radius: 4px; outline: none;
}
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.55; padding: 4px; margin-left: 4px; border-radius: 6px; transition: opacity var(--dur-2) ease, background-color var(--dur-2) ease;
}
:is(input[type=date], input[type=datetime-local], input[type=time], input[type=month])::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: var(--gray-100); }
input[type=file] { width: 100%; font: inherit; font-size: var(--text-sm); color: var(--color-text-secondary); }
input[type=color] {
  width: 56px; height: 42px; padding: 4px; cursor: pointer;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-input); background: #fff;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 6px; }
input[type=color]::-moz-color-swatch { border: none; border-radius: 6px; }

/* iOS zooms into any field under 16px — keep typing comfortable on phones. */
@media (max-width: 767px), (pointer: coarse) {
  input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=search], input[type=tel], input[type=url], input[type=date], input[type=datetime-local],
  input[type=time], input[type=month], select, textarea { font-size: 16px; min-height: 44px; }
  :is(input, textarea, select).mono, .copy-field input, .gwapp-actions input[name="note"] { font-size: 16px; }
}

/* Color input with its hex value and a live accent sample. */
.color-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.accent-preview { --preview-accent: var(--color-primary-600); --preview-on: #fff; display: inline-flex; align-items: center; gap: 12px; margin-left: auto; padding: 8px 12px; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.accent-preview-btn { padding: 6px 14px; border-radius: 999px; font-size: var(--text-xs); font-weight: 650; color: var(--preview-on); background: var(--preview-accent); }
.accent-preview-link { font-size: var(--text-xs); font-weight: 650; color: var(--preview-accent); }
.form-actions-end { justify-content: flex-end; }
.how-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: var(--text-sm); font-weight: 650; }
.how-title .i { width: 15px; height: 15px; color: var(--color-primary-600); }
.bullet-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: var(--text-sm); line-height: 1.55; color: var(--gray-700); }
.bullet-list li::marker { color: var(--gray-400); }
/* Admin billing */
.billing-list { display: grid; gap: 12px; }
.billing-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.billing-body > :only-child { grid-column: 1 / -1; }
.billing-claim { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--color-primary-25); box-shadow: inset 0 0 0 1px var(--color-primary-100); }
.billing-amount { font-size: 1rem; font-weight: 700; }
.billing-proof { display: block; width: fit-content; max-width: 200px; overflow: hidden; border-radius: var(--radius-sm); box-shadow: 0 0 0 1px var(--color-line); }
.billing-proof img { max-height: 220px; object-fit: cover; }
.reject-form { display: flex; gap: 6px; flex: 1 1 260px; max-width: 420px; }
.reject-form input { min-height: 34px; padding-block: 5px; }
.input-narrow { width: 84px !important; flex: none; }
.extend-form { display: flex; gap: 8px; flex-wrap: wrap; }
.extend-form select { flex: 1 1 220px; width: auto; min-width: 0; }
.extend-form .btn { flex: none; }
.restore-card { border-color: var(--color-warning-border); box-shadow: 0 0 0 3px var(--color-warning-bg), var(--shadow-card); }
.restore-input { max-width: 240px; letter-spacing: 0.08em; }
.audit-meta { min-width: 220px; max-width: 420px; font-family: var(--font-mono); font-size: 0.75rem; overflow-wrap: anywhere; }
.trouble-box { align-self: start; padding: 16px; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }

input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 0; flex: none;
  display: inline-grid; place-content: center;
  background: #fff; border: 1.5px solid var(--gray-300);
  cursor: pointer; vertical-align: middle;
  transition: background-color var(--dur-1) ease, border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
input[type=checkbox] { border-radius: 5px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before {
  content: ""; width: 10px; height: 10px; background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0); transition: transform var(--dur-1) var(--ease-spring);
}
input[type=radio]::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
  transform: scale(0); transition: transform var(--dur-1) var(--ease-spring);
}
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--color-primary-600); border-color: var(--color-primary-600); }
input[type=checkbox]:checked::before, input[type=radio]:checked::before { transform: scale(1); }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--color-primary-400); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: var(--ring); }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: 0.5; cursor: not-allowed; }

/* Radios that drive a custom card/segment stay in the DOM for keyboard and form
   use but never paint — including when disabled, which would otherwise win. */
:is(.method-option, .variant-option, .pdx-seg, .pdx-tabs) input[type=radio] {
  position: absolute; width: 1px; height: 1px; opacity: 0 !important; pointer-events: none;
}

.checkbox { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; color: var(--gray-700); cursor: pointer; }
.checkbox input { margin: 0; }

.help { margin-top: 6px; font-size: var(--text-xs); line-height: 1.55; color: var(--color-text-muted); }
.help:empty { display: none; }
.error-text { margin-top: 6px; font-size: var(--text-xs); line-height: 1.5; color: var(--color-danger); }

/* Switch — a checkbox inside .switch-row renders as a toggle */
.switch-row {
  display: flex; align-items: flex-start; gap: 12px; margin: 0;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle);
  font-weight: 500; cursor: pointer; transition: background-color var(--dur-2) ease;
}
.switch-row:hover { background: var(--gray-100); }
.switch-row > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: var(--gray-800); }
.switch-row > span .small { font-weight: 450; line-height: 1.55; }
.switch-row input[type=checkbox] {
  width: 36px; height: 20px; margin-top: 1px; border: 0; border-radius: 999px;
  background: var(--gray-300); place-content: center start; padding: 2px;
}
.switch-row input[type=checkbox]::before {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; clip-path: none;
  transform: none; box-shadow: 0 1px 2px rgb(16 24 40 / 0.2);
  transition: translate var(--dur-2) var(--ease-out);
}
.switch-row input[type=checkbox]:checked { background: var(--color-primary-600); }
.switch-row input[type=checkbox]:checked::before { translate: 16px 0; }

.input-prefix { display: flex; align-items: stretch; min-width: 0; }
.input-prefix span {
  display: grid; place-items: center; padding: 0 12px; flex: none;
  font-size: var(--text-sm); font-weight: 600; color: var(--gray-500);
  background: var(--gray-50); border: 1px solid var(--color-border-strong); border-right: 0;
  border-radius: var(--radius-input) 0 0 var(--radius-input);
}
.input-prefix input { border-radius: 0 var(--radius-input) var(--radius-input) 0; min-width: 0; }

.copy-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-field input { flex: 1 1 auto; min-width: 0; width: 1%; font-family: var(--font-mono); font-size: 0.8125rem; }
@media (max-width: 767px) { .copy-field input { font-size: 14px; } }

.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--gray-500); cursor: pointer;
}
.password-eye:hover { background: var(--gray-100); color: var(--gray-800); }
.password-eye svg { width: 19px; height: 19px; }
.password-eye .eye-closed { display: none; }
.password-eye[aria-pressed="true"] .eye-open { display: none; }
.password-eye[aria-pressed="true"] .eye-closed { display: block; }

.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 10px; }
.pw-meter span { height: 4px; border-radius: 999px; background: var(--gray-200); transition: background-color var(--dur-2) ease; }
.pw-meter[data-score="1"] span:nth-child(-n+1) { background: #f04438; }
.pw-meter[data-score="2"] span:nth-child(-n+2) { background: #f79009; }
.pw-meter[data-score="3"] span:nth-child(-n+3) { background: #47cd89; }
.pw-meter[data-score="4"] span { background: #17b26a; }
.pw-meter-label { margin-top: 7px; font-size: var(--text-xs); color: var(--color-text-muted); }
.pw-meter-label b { color: var(--gray-700); }
.pw-rules { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.pw-rules li { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--color-text-muted); transition: color var(--dur-2) ease; }
.pw-tick { width: 17px; height: 17px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--gray-100); color: var(--gray-400); transition: background-color var(--dur-2) ease, color var(--dur-2) ease; }
.pw-tick svg { width: 10px; height: 10px; }
.pw-rules li.is-ok { color: var(--color-success); }
.pw-rules li.is-ok .pw-tick { background: var(--color-success-bg); color: var(--color-success); }
.pw-hint { min-height: 18px; }
.pw-hint.is-error { color: var(--color-danger); }
.pw-hint.is-ok { color: var(--color-success); }

.otp-input { font-family: var(--font-mono); font-size: 1.375rem !important; letter-spacing: 0.4em; text-align: center; font-weight: 600; padding-left: 0.4em; }

/* Drop-zone that replaces the native "choose file" button (built by app.js) */
.upload {
  position: relative; display: flex; align-items: center; gap: 14px; margin: 0;
  padding: 12px 14px; border-radius: var(--radius-md); cursor: pointer; font-weight: 400;
  background: var(--gray-50); border: 1.5px dashed var(--gray-300);
  transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.upload:hover, .upload.is-drag { border-color: var(--color-primary-400); background: var(--color-primary-25); }
.upload.is-drag { box-shadow: var(--ring); }
.upload.has-file { border-style: solid; border-color: var(--color-border); background: #fff; }
.upload.is-error { border-color: var(--color-danger-solid); background: var(--color-danger-bg); }
.upload:has(.upload-input:focus-visible) { border-color: var(--color-primary-500); box-shadow: var(--ring); }
.upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-preview {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: var(--radius-sm); overflow: hidden;
  display: grid; place-items: center; background: #fff; color: var(--gray-400); box-shadow: inset 0 0 0 1px var(--color-border);
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.4; }
.upload-title { font-size: var(--text-sm); font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-sub { font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload.is-error .upload-title { color: var(--color-danger); }
.upload-btn {
  flex: none; padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 600; color: var(--gray-700);
  background: #fff; box-shadow: inset 0 0 0 1px var(--gray-300), var(--shadow-xs);
  transition: background-color var(--dur-2) ease, color var(--dur-2) ease;
}
.upload:hover .upload-btn { color: var(--color-primary-700); }
.form-row:has(.upload) { container-type: inline-size; }
@container (max-width: 380px) {
  .upload { gap: 10px; }
  .upload-btn { display: none; }
  .upload-sub { white-space: normal; }
}

/* ---------------------------------------------------------------- 6. Cards & page structure */

.card {
  --card-pad: 20px;
  position: relative; min-width: 0;
  padding: var(--card-pad);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }
/* In grids and flex rows the gap does the spacing; a stacked-card margin would double it. */
:is(.grid, .dash-grid, .kpi-stack, .stack, .flex, .flex-col, .cluster, .member-list, .billing-list) > .card + .card { margin-top: 0; }
.card-lg { --card-pad: 24px; border-radius: var(--radius-lg); }
.card-flush { padding: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-header > div:first-child { min-width: 0; flex: 1 1 220px; }
.card-title { margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: -0.012em; line-height: 1.35; }
.card-subtitle { margin: 3px 0 0; font-size: var(--text-sm); line-height: 1.5; color: var(--color-text-muted); }
.card-icon {
  width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center;
  border-radius: 10px; background: var(--color-primary-50); color: var(--color-primary-600);
}
.card-icon .i { width: 18px; height: 18px; }
.card-icon.tint-mint { background: var(--color-success-bg); color: var(--color-success); }
.card-icon.tint-peach { background: var(--color-warning-bg); color: var(--color-warning); }
.card-icon.tint-gray { background: var(--gray-100); color: var(--gray-600); }
.card-foot { margin: 16px calc(var(--card-pad) * -1) calc(var(--card-pad) * -1); padding: 12px var(--card-pad); border-top: 1px solid var(--color-border-subtle); background: var(--gray-25); border-radius: 0 0 var(--radius-card) var(--radius-card); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.card-muted { background: var(--gray-50); box-shadow: none; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  flex-wrap: wrap; margin-bottom: 24px;
}
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head .eyebrow { margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.page-head .page-desc, .page-head > div > p { margin: 6px 0 0; max-width: 68ch; color: var(--color-text-secondary); font-size: var(--text-base); line-height: 1.6; }
.page-head .badge { vertical-align: middle; }
.page-head .help { max-width: 64ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

/* Main column + side column that sticks while the form scrolls (live previews, tips). */
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.split-layout > * { min-width: 0; }
.split-main > .card + .card { margin-top: 16px; }
.split-aside { position: sticky; top: calc(var(--topbar-h) + 20px); display: grid; gap: 16px; }
.split-aside > .card + .card { margin-top: 0; }
.split-main > .form-actions { margin-top: 16px; justify-content: flex-end; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted);
}
.back-link:hover { color: var(--color-primary-700); }
.back-link .i { width: 16px; height: 16px; transition: transform var(--dur-2) var(--ease-out); }
.back-link:hover .i { transform: translateX(-2px); }

.section-title-sm { display: flex; align-items: center; gap: 10px; margin: 32px 0 14px; }
.section-title-sm h2 { margin: 0; font-size: 1.0625rem; }
.section-title-sm .step-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--color-primary-600);
}

/* ---------------------------------------------------------------- 7. Badges & chips */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem; font-weight: 600; line-height: 1.3; white-space: nowrap;
  background: var(--gray-100); color: var(--gray-700);
  box-shadow: inset 0 0 0 1px var(--gray-200);
}
.badge .i { width: 12px; height: 12px; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); box-shadow: inset 0 0 0 1px var(--color-success-border); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); box-shadow: inset 0 0 0 1px var(--color-warning-border); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); box-shadow: inset 0 0 0 1px var(--color-danger-border); }
.badge-info { background: var(--color-primary-50); color: var(--color-primary-700); box-shadow: inset 0 0 0 1px var(--color-primary-200); }
.badge-neutral { background: var(--gray-50); color: var(--gray-600); box-shadow: inset 0 0 0 1px var(--gray-200); }
.badge-solid { background: var(--color-primary-600); color: #fff; box-shadow: none; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-count { min-width: 20px; min-height: 20px; padding: 0 6px; justify-content: center; font-size: 0.6875rem; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border-radius: var(--radius-pill); white-space: nowrap;
  font-size: var(--text-sm); font-weight: 550; color: var(--gray-700);
  background: #fff; box-shadow: inset 0 0 0 1px var(--gray-200);
  transition: background-color var(--dur-2) ease, box-shadow var(--dur-2) ease, color var(--dur-2) ease;
}
.chip:hover { color: var(--gray-900); box-shadow: inset 0 0 0 1px var(--gray-300); }
.chip.active { color: var(--color-primary-700); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-200); }

.code-chip {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: var(--radius-xs);
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  color: var(--gray-700); background: var(--gray-100); box-shadow: inset 0 0 0 1px var(--gray-200);
}

.channel-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.channel-chip .i { width: 12px; height: 12px; }
.ch-telegram { background: #eef6ff; color: #1c6fb5; box-shadow: inset 0 0 0 1px #cfe5fa; }
.ch-whatsapp { background: #edfcf2; color: #16833d; box-shadow: inset 0 0 0 1px #c3efd2; }
.ch-web { background: var(--gray-50); color: var(--gray-700); box-shadow: inset 0 0 0 1px var(--gray-200); }

/* ---------------------------------------------------------------- 8. Alerts, banners, toasts */

.alert {
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; padding: 12px 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--gray-50); color: var(--gray-700);
  font-size: var(--text-sm); line-height: 1.55;
}
.alert::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px;
  background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat;
  mask: var(--alert-icon) center / contain no-repeat;
}
.alert:has(> .alert-icon)::before { display: none; }
.alert > div { flex: 1 1 auto; min-width: 0; }
.alert b, .alert strong { font-weight: 650; }
.alert .small { font-size: var(--text-sm); opacity: 0.92; }
.alert .btn { margin-left: auto; flex: none; align-self: center; }
.alert-success {
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 4.5-5'/%3E%3C/svg%3E");
  background: var(--color-success-bg); border-color: var(--color-success-border); color: #085d3a;
}
.alert-warning {
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #93370d;
}
.alert-danger {
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E");
  background: var(--color-danger-bg); border-color: var(--color-danger-border); color: #912018;
}
.alert-info { background: var(--color-primary-25); border-color: var(--color-primary-200); color: var(--color-primary-800); }
.alert .alert-icon { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.alert-list { margin: 6px 0 0; padding-left: 18px; }
.alert-list li + li { margin-top: 3px; }

.announce {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; padding: 12px 12px 12px 16px;
  border-radius: var(--radius-md); background: var(--gray-900); color: #fff;
  font-size: var(--text-sm); line-height: 1.55; box-shadow: var(--shadow-md);
}
.announce > .i { margin-top: 2px; color: var(--color-primary-300); }
.announce-body { flex: 1; min-width: 0; white-space: pre-line; }
.announce-body b { display: block; font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-primary-200); margin-bottom: 2px; }
.announce .icon-btn { width: 32px; height: 32px; color: rgb(255 255 255 / 0.7); margin: -4px -4px -4px 0; }
.announce .icon-btn:hover { background: rgb(255 255 255 / 0.1); color: #fff; }

.toast-stack {
  position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(24px + var(--safe-b));
  display: grid; gap: 8px; justify-items: center; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-radius: var(--radius-md); background: var(--gray-900); color: #fff;
  font-size: var(--text-sm); font-weight: 550; box-shadow: var(--shadow-lg);
  animation: toast-in var(--dur-3) var(--ease-out) both;
}
.toast .i { width: 18px; height: 18px; color: #6ce9a6; }
.toast.is-error .i { color: #fda29b; }
.toast.is-leaving { animation: toast-out var(--dur-2) ease both; }

/* ---------------------------------------------------------------- 9. Tables & data lists */

/* position:relative keeps absolutely-positioned bits (sr-only labels) inside the scroller. */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
th, td { padding: 13px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--color-border-subtle); }
th {
  padding-top: 10px; padding-bottom: 10px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  color: var(--color-text-muted); background: var(--gray-50);
  border-bottom-color: var(--color-border);
}
td { color: var(--gray-700); }
td b, td strong { color: var(--color-text); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--dur-1) ease; }
tbody tr:hover { background: var(--gray-25); }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * { vertical-align: middle; }
td.actions > * + *, td.actions form + form, td.actions .btn + form, td.actions form + .btn { margin-left: 6px; }
td.actions form { display: inline-block; margin: 0; }
td.num, th.num { text-align: right; }
td.truncate { max-width: 220px; }
td a:not(.btn) { font-weight: 600; }

/* A table that is a card's content runs edge to edge, like a sheet. */
.card > .table-wrap, .card > .table-scroll-y > .table-wrap { margin-inline: calc(var(--card-pad) * -1); border-top: 1px solid var(--color-border); }
.card > .table-wrap:last-child { margin-bottom: calc(var(--card-pad) * -1); border-radius: 0 0 calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px); }
.card > .table-wrap th:first-child, .card > .table-wrap td:first-child { padding-left: var(--card-pad); }
.card > .table-wrap th:last-child, .card > .table-wrap td:last-child { padding-right: var(--card-pad); }
.card > .card-header + .table-wrap { margin-top: 0; }
.card > .table-wrap:first-child { margin-top: calc(var(--card-pad) * -1); border-top: 0; border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 0 0; }
.card > .table-wrap:first-child:last-child { border-radius: calc(var(--radius-card) - 1px); }
.card > .table-wrap + .help, .card > .table-wrap + .pager { margin-top: 16px; }

/* Compact list for data that reads better as rows than as a table on phones. */
.data-list { list-style: none; margin: 0; padding: 0; }
.data-list > li + li { border-top: 1px solid var(--color-border-subtle); }
.data-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  color: inherit; min-width: 0;
}
a.data-row:hover { color: inherit; }
.card > .data-list { margin-inline: calc(var(--card-pad) * -1); border-top: 1px solid var(--color-border-subtle); }
.card > .data-list:last-child { margin-bottom: calc(var(--card-pad) * -1); }
.card > .data-list .data-row { padding-inline: var(--card-pad); }
.card > .data-list a.data-row:hover { background: var(--gray-25); }
.card > .data-list:last-child > li:last-child > .data-row { border-radius: 0 0 calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px); }
.data-row-icon {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: var(--gray-100); color: var(--gray-600);
  font-size: 0.875rem; font-weight: 650;
}
.data-row-icon .i { width: 18px; height: 18px; }
.data-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; line-height: 1.35; }
.data-row-main > b { font-size: var(--text-sm); font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-row-main > span:not(.badge) { font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-row-main > .badge { align-self: flex-start; margin-top: 2px; }
.data-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; line-height: 1.3; text-align: right; }
.data-row-side > b { font-size: var(--text-sm); font-weight: 650; color: var(--color-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-row-side > span:not(.badge) { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }
.data-row > .cell-thumb { width: 38px; height: 38px; flex-basis: 38px; }
.data-row .chev { color: var(--gray-400); width: 16px; height: 16px; }

.show-mobile { display: none !important; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.pager-info { font-size: var(--text-sm); color: var(--color-text-muted); }
.pager-links { display: flex; gap: 8px; }

/* Definition list: label left, value right */
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 10px 0; font-size: var(--text-sm); border-bottom: 1px solid var(--color-border-subtle);
}
.detail-list > div:last-child { border-bottom: 0; }
.detail-list span, .detail-list dt { color: var(--color-text-muted); flex: none; }
.detail-list b, .detail-list dd { margin: 0; font-weight: 600; color: var(--color-text); text-align: right; min-width: 0; overflow-wrap: anywhere; }

.kv { display: grid; gap: 8px; font-size: var(--text-sm); }
.kv > div { display: flex; justify-content: space-between; gap: 16px; }
.kv > div > span:first-child { color: var(--color-text-muted); }
.kv > div > :last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- 10. Tabs */

.status-tabs, .channel-tabs, .variant-tabs, .seg-tabs {
  display: flex; gap: 2px; padding: 3px; width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
  background: var(--gray-100); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}
.status-tabs::-webkit-scrollbar, .channel-tabs::-webkit-scrollbar, .variant-tabs::-webkit-scrollbar, .seg-tabs::-webkit-scrollbar { display: none; }
.status-tab, .channel-tab, .variant-tab, .seg-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 34px; padding: 0 12px; border-radius: 9px;
  font-size: var(--text-sm); font-weight: 550; white-space: nowrap; color: var(--gray-600);
  transition: background-color var(--dur-2) ease, color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.status-tab:hover, .channel-tab:hover, .variant-tab:hover, .seg-tab:hover { color: var(--gray-900); }
.status-tab.active, .channel-tab.active, .variant-tab.active, .seg-tab.active {
  color: var(--gray-900); background: #fff; box-shadow: var(--shadow-sm);
}
.status-tab span, .channel-tab-count, .variant-tab-count, .seg-tab span {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 0.6875rem; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--gray-600); background: var(--gray-200);
}
.status-tab.active span, .channel-tab.active .channel-tab-count, .variant-tab.active .variant-tab-count, .seg-tab.active span {
  color: var(--color-primary-700); background: var(--color-primary-50);
}

/* ---------------------------------------------------------------- 11. Empty, loading */

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 36px 16px; color: var(--color-text-muted);
}
/* Generic inbox tile for empty states that do not bring their own icon. */
.empty::before {
  content: ""; flex: none; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1Z'/%3E%3C/svg%3E") center / 22px no-repeat;
  box-shadow: inset 0 0 0 1px var(--gray-200), 0 1px 2px rgb(16 24 40 / 0.05);
}
.empty:has(> .empty-icon)::before { display: none; }
.empty h3 { margin: 0 0 4px; font-size: 0.96875rem; color: var(--color-text); }
.empty p { margin: 0 auto; max-width: 46ch; font-size: var(--text-sm); line-height: 1.55; }
.empty .btn { margin-top: 16px; }
.empty-soft {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 180px; padding: 24px; border-radius: var(--radius-md);
  background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle);
  color: var(--color-text-muted); font-size: var(--text-sm);
}
.empty-soft b { color: var(--color-text); font-weight: 650; margin-top: 8px; }
.empty-soft .btn { margin-top: 12px; }
.empty-icon {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px;
  background: #fff; color: var(--gray-500); box-shadow: inset 0 0 0 1px var(--gray-200), 0 1px 2px rgb(16 24 40 / 0.05);
}
.empty > .empty-icon { margin-bottom: 14px; }
.empty-icon .i { width: 22px; height: 22px; }
.empty-icon.tone-success { color: var(--color-success); background: var(--color-success-bg); box-shadow: inset 0 0 0 1px var(--color-success-border); }
.empty-icon.tone-warning { color: var(--color-warning); background: var(--color-warning-bg); box-shadow: inset 0 0 0 1px var(--color-warning-border); }
.empty-icon.tone-danger { color: var(--color-danger); background: var(--color-danger-bg); box-shadow: inset 0 0 0 1px var(--color-danger-border); }
.empty-icon.tone-brand { color: var(--color-primary-600); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-100); }

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 45%, var(--gray-100) 65%) 0 0 / 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--gray-300); border-right-color: var(--color-primary-600); animation: spin 0.7s linear infinite; }

/* ---------------------------------------------------------------- 12. Modal, menus */

body.modal-open, body.drawer-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(12 17 29 / 0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in var(--dur-2) ease both; }
.modal-panel {
  position: relative; width: min(420px, 100%); padding: 24px;
  background: #fff; border-radius: var(--radius-modal); box-shadow: var(--shadow-xl);
  animation: modal-rise var(--dur-3) var(--ease-out) both;
}
.modal-icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px;
  border-radius: 12px; background: var(--color-primary-50); color: var(--color-primary-600);
  box-shadow: 0 0 0 6px var(--color-primary-25);
}
.modal-icon svg { width: 22px; height: 22px; }
.modal-panel.is-danger .modal-icon { background: var(--color-danger-bg); color: var(--color-danger-solid); box-shadow: 0 0 0 6px #fffbfa; }
.modal-title { margin: 0 0 6px; font-size: 1.125rem; }
.modal-body { margin: 0 0 24px; color: var(--color-text-secondary); font-size: var(--text-sm); line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn { flex: 1; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-overlay);
  min-width: 232px; padding: 6px; border-radius: var(--radius-md);
  background: #fff; box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-line);
  transform-origin: top right; animation: menu-in var(--dur-2) var(--ease-out) both;
}
.menu-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--color-border-subtle); margin-bottom: 6px; min-width: 0; }
.menu-head b { display: block; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head span { display: block; font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
  font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--gray-700); text-align: left;
}
.menu-item:hover { background: var(--gray-100); color: var(--gray-900); }
.menu-item .i { width: 17px; height: 17px; color: var(--gray-500); }
.menu-item.is-danger { color: var(--color-danger); }
.menu-item.is-danger .i { color: currentColor; }
.menu-sep { height: 1px; margin: 6px 0; background: var(--color-border-subtle); }

/* ---------------------------------------------------------------- 13. Charts */

.chart { position: relative; width: 100%; height: 220px; }
.chart:empty { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--gray-50) 25%, #fff 45%, var(--gray-50) 65%) 0 0 / 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--gray-150); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .base-line { stroke: var(--gray-200); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--color-primary-500); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart .bar { fill: var(--color-primary-200); transition: fill var(--dur-1) ease; }
.chart .bar.is-current { fill: var(--color-primary-500); }
.chart .bar.is-hover { fill: var(--color-primary-600); }
.chart .axis { font-family: var(--font); font-size: 11px; fill: var(--gray-400); }
.chart .dot { fill: #fff; stroke: var(--color-primary-600); stroke-width: 2; }
.chart .crosshair { stroke: var(--gray-300); stroke-width: 1; stroke-dasharray: 3 3; }
.chart.is-drawn .line { animation: draw-line 1.1s var(--ease-out) both; }
.chart.is-drawn .area { animation: fade-in 0.9s ease 0.2s both; }
.chart.is-drawn .bar { animation: grow-bar 0.7s var(--ease-out) both; transform-box: fill-box; transform-origin: bottom; }
.chart-tooltip {
  position: absolute; z-index: 5; top: 0; left: 0; pointer-events: none;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--gray-900); color: #fff; box-shadow: var(--shadow-lg);
  font-size: 0.75rem; line-height: 1.45; white-space: nowrap;
  opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity var(--dur-1) ease;
}
.chart-tooltip b { display: block; font-size: 0.8125rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-tooltip span { color: var(--gray-400); }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--color-text-muted); font-size: var(--text-sm); text-align: center; padding: 0 16px; }

/* ---------------------------------------------------------------- 14. App shell — sidebar, topbar, bottom nav */

.app-body { background: var(--color-page); }
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; z-index: var(--z-drawer);
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
  background: var(--color-page);
  border-right: 1px solid var(--color-line);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 14px; }
.sidebar-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text); min-width: 0; }
.sidebar-brand:hover { color: var(--color-text); }
.sidebar-brand img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.sidebar-wordmark { font-size: 1.0625rem; font-weight: 750; letter-spacing: 0.02em; }
.sidebar-tag {
  padding: 2px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-primary-700); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-100);
}
.sidebar-close { display: none; }

.store-chip {
  display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; padding: 8px 10px 8px 8px;
  border-radius: var(--radius-md); background: #fff; color: var(--color-text);
  box-shadow: 0 0 0 1px var(--color-line), var(--shadow-xs);
  transition: box-shadow var(--dur-2) ease;
}
.store-chip:hover { color: var(--color-text); box-shadow: 0 0 0 1px var(--color-border-strong), var(--shadow-sm); }
.store-chip-avatar {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: 9px; background: var(--color-primary-50); color: var(--color-primary-700);
  font-weight: 700; font-size: 0.875rem;
}
.store-chip-avatar img { width: 100%; height: 100%; object-fit: cover; }
.store-chip-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.store-chip-copy b { font-size: var(--text-sm); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-chip-copy span { font-size: 0.71875rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-chip .i { width: 15px; height: 15px; color: var(--gray-400); }

.sidebar-nav {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -6px; padding: 0 6px 12px;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.sidebar-nav:hover { scrollbar-color: var(--gray-300) transparent; }
.nav-section + .nav-section { margin-top: 18px; }
.nav-title {
  padding: 0 10px 6px; font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gray-400);
}
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 10px; margin: 1px 0;
  border-radius: var(--radius-sm); border: 0; background: none; width: 100%;
  font: inherit; font-size: var(--text-sm); font-weight: 550; color: var(--gray-600); text-align: left; cursor: pointer;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.nav-link .i { width: 18px; height: 18px; color: var(--gray-400); transition: color var(--dur-1) ease; }
.nav-link > span:not(.badge):not(.nav-dot) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover { background: rgb(16 24 40 / 0.045); color: var(--gray-900); }
.nav-link:hover .i { color: var(--gray-600); }
.nav-link.is-active, .nav-link.active { background: #e9f0ff; color: var(--color-primary-800); font-weight: 650; }
.nav-link.is-active .i, .nav-link.active .i { color: var(--color-primary-600); }
.nav-link.is-active::before, .nav-link.active::before {
  content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--color-primary-600);
}
.nav-link .badge { margin-left: auto; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-left: auto; background: var(--gray-300); }
.nav-dot.is-on { background: var(--color-success-solid); box-shadow: 0 0 0 3px rgb(23 178 106 / 0.16); }

.sidebar-foot { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--color-line); }
.plan-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md);
  background: #fff; color: var(--color-text); box-shadow: 0 0 0 1px var(--color-line);
  font-size: var(--text-xs); line-height: 1.35;
}
.plan-chip:hover { color: var(--color-text); box-shadow: 0 0 0 1px var(--color-border-strong); }
.plan-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--color-success-solid); }
.plan-chip.is-trial .plan-chip-dot { background: var(--color-primary-500); }
.plan-chip.is-grace .plan-chip-dot { background: var(--color-warning-solid); }
.plan-chip.is-ended .plan-chip-dot { background: var(--color-danger-solid); }
.plan-chip-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.plan-chip-copy b { font-size: var(--text-xs); font-weight: 650; }
.plan-chip-copy span { color: var(--color-text-muted); }
.plan-chip-cta { font-weight: 650; color: var(--color-primary-700); white-space: nowrap; }
.plan-chip.is-grace, .plan-chip.is-ended { box-shadow: 0 0 0 1px var(--color-warning-border); background: var(--color-warning-bg); }
.plan-chip.is-ended { box-shadow: 0 0 0 1px var(--color-danger-border); background: var(--color-danger-bg); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 4px 2px 6px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font-size: 0.8125rem; font-weight: 700; color: var(--color-primary-800);
  background: linear-gradient(145deg, var(--color-primary-100), var(--color-primary-200));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.6);
}
.user-chip-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.user-chip-copy b { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-copy span { font-size: 0.71875rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip form { margin: 0; }
.user-chip .icon-btn { width: 34px; height: 34px; }
.user-chip .icon-btn .i { width: 18px; height: 18px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h); display: flex; align-items: center;
  background: rgb(245 246 248 / 0.82);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease;
}
body.is-scrolled .topbar { border-bottom-color: var(--color-line); background: rgb(245 246 248 / 0.9); }
.topbar-inner { display: flex; align-items: center; gap: 12px; width: 100%; max-width: calc(var(--content-max) + 80px); margin-inline: auto; padding: 0 40px; min-width: 0; }
.topbar-menu { display: none; margin-left: -8px; }
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; font-size: var(--text-sm); }
.topbar-crumb { color: var(--color-text-muted); font-weight: 500; white-space: nowrap; }
.topbar-sep { color: var(--gray-300); }
.topbar-page { font-weight: 650; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.lang-switch {
  display: inline-grid; place-items: center; min-width: 36px; height: 32px; padding: 0 8px;
  border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--gray-600); background: transparent; box-shadow: inset 0 0 0 1px var(--color-border);
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.lang-switch:hover { color: var(--gray-900); background: #fff; }
.avatar-btn { display: inline-flex; align-items: center; gap: 6px; padding: 2px; border-radius: 999px; }
.avatar-btn .i { width: 16px; height: 16px; color: var(--gray-500); margin-right: 4px; }
.menu[open] > .avatar-btn, .avatar-btn:hover { background: rgb(16 24 40 / 0.05); }

.content {
  width: 100%; max-width: calc(var(--content-max) + 80px); margin-inline: auto;
  padding: 20px 40px 72px; min-width: 0;
}
.content > h1:first-child, .content > .page-head:first-child { margin-top: 4px; }
.content > h1 { margin-bottom: 20px; }

.bottom-nav { display: none; }
.backdrop {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: rgb(12 17 29 / 0.4); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: fade-in var(--dur-2) ease both;
}

@media (max-width: 1279px) {
  :root { --sidebar-w: 240px; }
  .topbar-inner { padding: 0 28px; }
  .content { padding: 16px 28px 64px; }
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto;
    width: min(88vw, 300px); flex-basis: auto;
    background: #fff; border-right: 0; box-shadow: var(--shadow-xl);
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: calc(12px + var(--safe-b));
    transform: translateX(-104%); visibility: hidden;
    transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
  }
  .sidebar.open {
    transform: none; visibility: visible;
    transition: transform var(--dur-3) var(--ease-out), visibility 0s;
  }
  .sidebar-close { display: inline-grid; }
  .sidebar .store-chip, .sidebar .plan-chip { background: var(--gray-25); }
  .topbar-menu { display: inline-grid; }
  .topbar-crumb, .topbar-sep { display: none; }
  .topbar-page { font-size: var(--text-base); }
  .topbar-inner { padding: 0 20px; }
  .content { padding: 12px 20px 56px; }
}

@media (max-width: 767px) {
  :root { --topbar-h: 56px; }
  .topbar-inner { padding: 0 12px 0 16px; gap: 8px; }
  .topbar-store { display: none; }
  .avatar-btn .i { display: none; }
  .content { padding: 8px 16px calc(var(--bottom-nav-h) + var(--safe-b) + 28px); }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
    display: flex; align-items: stretch;
    height: calc(var(--bottom-nav-h) + var(--safe-b)); padding: 4px 6px var(--safe-b);
    background: rgb(255 255 255 / 0.94);
    backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--color-line);
  }
  .bottom-nav a, .bottom-nav button {
    position: relative; flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 0 2px; border: 0; border-radius: var(--radius-md); background: none; cursor: pointer;
    font: inherit; font-size: 0.6875rem; font-weight: 600; color: var(--gray-500);
  }
  .bottom-nav a > span, .bottom-nav button > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav .i { width: 22px; height: 22px; }
  .bottom-nav .is-active { color: var(--color-primary-700); }
  .bottom-nav .is-active .i { color: var(--color-primary-600); }
  .bottom-nav .is-active::before {
    content: ""; position: absolute; top: -4px; left: 50%; width: 22px; height: 3px; margin-left: -11px;
    border-radius: 0 0 3px 3px; background: var(--color-primary-600);
  }
  .bottom-nav .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-height: 16px; padding: 0 5px; font-size: 0.625rem; }
  .toast-stack { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 16px); }
  body:not(.app-body) .toast-stack { bottom: calc(24px + var(--safe-b)); }
}

/* ---------------------------------------------------------------- 15. Dashboard */

.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-head h1 { margin: 0; font-size: 1.875rem; }
.dash-head p { margin: 6px 0 0; color: var(--color-text-secondary); }
.dash-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.link-pill {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
  padding: 3px 4px 3px 12px; border-radius: 999px; background: #fff;
  box-shadow: 0 0 0 1px var(--color-line), var(--shadow-xs); font-size: var(--text-xs);
}
.link-pill a { color: var(--gray-700); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link-pill a:hover { color: var(--color-primary-700); }
.link-pill .btn { min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 0.71875rem; }

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.dash-grid > * { min-width: 0; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }

/* The one number that matters most gets the stage. */
.kpi-hero { --card-pad: 24px; display: flex; flex-direction: column; overflow: hidden; }
.kpi-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-secondary); }
.kpi-label .i { width: 16px; height: 16px; color: var(--color-primary-600); }
.kpi-hero-value {
  margin: 8px 0 6px; font-size: clamp(2rem, 1.4rem + 2vw, 2.75rem); font-weight: 720; letter-spacing: -0.035em; line-height: 1.05;
  font-variant-numeric: tabular-nums; color: var(--color-text);
}
.kpi-hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--text-sm); color: var(--color-text-muted); }
.kpi-hero .chart { height: 190px; margin-top: 16px; }
.kpi-hero-foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 20px calc(var(--card-pad) * -1) calc(var(--card-pad) * -1); border-top: 1px solid var(--color-border-subtle); }
.kpi-hero-foot > div { padding: 14px var(--card-pad); min-width: 0; }
.kpi-hero-foot > div + div { border-left: 1px solid var(--color-border-subtle); }
.kpi-hero-foot span { display: block; font-size: var(--text-xs); color: var(--color-text-muted); }
.kpi-hero-foot b { display: block; margin-top: 2px; font-size: 1.0625rem; font-weight: 680; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.delta {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.delta .i { width: 13px; height: 13px; }
.delta-up { color: var(--color-success); background: var(--color-success-bg); }
.delta-down { color: var(--color-danger); background: var(--color-danger-bg); }
.delta-flat { color: var(--gray-600); background: var(--gray-100); }

.kpi-stack { display: grid; gap: 16px; grid-template-rows: repeat(3, auto); align-content: start; }
.kpi {
  display: flex; align-items: flex-start; gap: 14px; color: inherit;
  transition: box-shadow var(--dur-2) ease, transform var(--dur-2) var(--ease-out);
}
a.kpi:hover { color: inherit; box-shadow: 0 0 0 1px var(--color-border-strong), var(--shadow-md); }
.kpi-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px;
  background: var(--gray-100); color: var(--gray-600);
}
.kpi-icon .i { width: 19px; height: 19px; }
.kpi-icon.tone-brand { background: var(--color-primary-50); color: var(--color-primary-600); }
.kpi-icon.tone-success { background: var(--color-success-bg); color: var(--color-success); }
.kpi-icon.tone-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.kpi-body { min-width: 0; flex: 1; }
.kpi-body span { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.kpi-body b { display: block; margin: 2px 0 1px; font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-body small { display: block; font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .chev { width: 16px; height: 16px; color: var(--gray-300); margin-top: 12px; transition: transform var(--dur-2) var(--ease-out), color var(--dur-2) ease; }
a.kpi:hover .chev { transform: translateX(2px); color: var(--gray-500); }

/* Store readiness */
.health-ring { --pct: 0; position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%; background: conic-gradient(var(--color-primary-500) calc(var(--pct) * 1%), var(--gray-150) 0); }
.health-ring::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.health-ring span { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; font-size: 0.6875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.health-ring.is-done { background: conic-gradient(var(--color-success-solid) 100%, var(--gray-150) 0); }
.health-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.health-list > li, .health-row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0;
  font-size: var(--text-sm); color: var(--color-text-secondary);
}
.health-list > li + li { border-top: 1px solid var(--color-border-subtle); }
.health-ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--gray-100); color: var(--gray-600); }
.health-ico .i { width: 16px; height: 16px; }
.health-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.health-name b { color: var(--color-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-name small { font-size: var(--text-xs); color: var(--color-text-muted); }
.health-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 550; white-space: nowrap; color: var(--color-text-muted); }
.health-state.is-ok { color: var(--color-success); }
.health-list .btn { flex: none; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--gray-300); }
.health-dot.ok { background: var(--color-success-solid); box-shadow: 0 0 0 3px rgb(23 178 106 / 0.15); }
.health-dot.idle { background: var(--gray-300); }
.health-dot.warn { background: var(--color-warning-solid); box-shadow: 0 0 0 3px rgb(247 144 9 / 0.15); }
.health-dot.bad { background: var(--color-danger-solid); box-shadow: 0 0 0 3px rgb(217 45 32 / 0.13); }
.health-row { padding: 10px 0; }
.health-row + .health-row { border-top: 1px solid var(--color-border-subtle); }
.health-row b { margin-left: auto; color: var(--color-text); font-variant-numeric: tabular-nums; }

/* Legacy metric blocks (buyer detail, affiliate, admin detail) — neutral stat cards */
.metric {
  position: relative; min-width: 0; padding: 18px 20px;
  background: #fff; border: 1px solid var(--color-line); border-radius: var(--radius-card); box-shadow: var(--shadow-card);
}
.metric-top { display: flex; align-items: center; gap: 10px; }
.metric-icon {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px;
  font-size: 0.8125rem; font-weight: 700; background: var(--gray-100); color: var(--gray-600);
}
.metric-icon .i { width: 16px; height: 16px; }
.mi-blue { background: var(--color-primary-50); color: var(--color-primary-600); }
.mi-lilac { background: #f4f3ff; color: #5925dc; }
.mi-mint { background: var(--color-success-bg); color: var(--color-success); }
.mi-peach { background: var(--color-warning-bg); color: var(--color-warning); }
.metric-label { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.metric-value { margin-top: 6px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-top + .metric-value { margin-top: 12px; }
.metric-meta { margin-top: 2px; font-size: var(--text-xs); color: var(--color-text-muted); }

.rank-list { display: grid; gap: 2px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: inherit; transition: background-color var(--dur-1) ease; }
a.rank-row:hover { background: var(--gray-50); color: inherit; }
.rank-num { width: 18px; text-align: center; font-size: var(--text-xs); font-weight: 650; color: var(--gray-400); font-variant-numeric: tabular-nums; }
.rank-avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--color-primary-50); color: var(--color-primary-700); font-weight: 700; font-size: 0.875rem; }
.rank-main { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.rank-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main b { font-size: var(--text-sm); font-weight: 600; }
.rank-stat { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; line-height: 1.35; }
.rank-stat b { font-size: var(--text-sm); font-weight: 650; font-variant-numeric: tabular-nums; }

.attention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attention-list > li, .health-list > li { min-width: 0; }
.attention-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); color: inherit;
  transition: box-shadow var(--dur-2) ease, background-color var(--dur-2) ease;
}
a.attention-item:hover { color: inherit; background: #fff; box-shadow: inset 0 0 0 1px var(--color-border-strong), var(--shadow-sm); }
.attention-item .health-ico { background: #fff; box-shadow: inset 0 0 0 1px var(--color-border); }
.attention-item.is-warn .health-ico { color: var(--color-warning); background: var(--color-warning-bg); box-shadow: none; }
.attention-item.is-ok .health-ico { color: var(--color-success); background: var(--color-success-bg); box-shadow: none; }
.attention-item .chev { width: 16px; height: 16px; color: var(--gray-400); margin-left: auto; }

/* Subscription strip (dashboard) */
.period-strip {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 10px 12px 10px 16px;
  border-radius: var(--radius-md); background: #fff; box-shadow: 0 0 0 1px var(--color-line), var(--shadow-xs);
  font-size: var(--text-sm);
}
.period-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--color-success-solid); }
.period-strip-label { color: var(--color-text-muted); }
.period-strip-badge { padding: 1px 9px; border-radius: 999px; font-size: 0.71875rem; font-weight: 650; color: var(--color-success); background: var(--color-success-bg); }
.period-strip-note { flex: 1 1 auto; min-width: 0; color: var(--gray-700); }
.period-strip .btn { flex: none; }
.period-strip.is-trial .period-dot { background: var(--color-primary-500); }
.period-strip.is-trial .period-strip-badge { color: var(--color-primary-700); background: var(--color-primary-50); }
.period-strip.is-grace { background: var(--color-warning-bg); box-shadow: 0 0 0 1px var(--color-warning-border); }
.period-strip.is-grace .period-dot { background: var(--color-warning-solid); }
.period-strip.is-grace .period-strip-badge { color: var(--color-warning); background: #fff; }
.period-strip.is-ended { background: var(--color-danger-bg); box-shadow: 0 0 0 1px var(--color-danger-border); }
.period-strip.is-ended .period-dot { background: var(--color-danger-solid); }
.period-strip.is-ended .period-strip-badge { color: var(--color-danger); background: #fff; }

.setup-progress { height: 6px; border-radius: 999px; overflow: hidden; background: var(--gray-150); }
.setup-progress span { display: block; height: 100%; border-radius: inherit; background: var(--color-primary-500); transition: width var(--dur-4) var(--ease-out); }

/* ---------------------------------------------------------------- 16. Member pages */

/* Filter toolbar above a list: search field, selects and a submit. */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar > * { margin: 0; }
.toolbar select { width: auto; flex: 0 1 200px; min-width: 0; }
.toolbar .btn { flex: none; }
.toolbar-end { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-field { position: relative; flex: 1 1 240px; max-width: 360px; min-width: 0; }
.search-field > .i { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.search-field > input { padding-left: 38px; }
.card > .toolbar:first-child { margin-bottom: 16px; }

/* A table cell that leads with a thumbnail: product, buyer, member. */
.cell-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-thumb {
  width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; overflow: hidden;
  border-radius: 11px; font-size: 0.875rem; font-weight: 700; color: var(--gray-600);
  background: var(--gray-100); box-shadow: inset 0 0 0 1px var(--color-line);
}
.cell-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cell-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.35; }
.cell-item-text > a, .cell-item-text > b { font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-item-text > a:hover { color: var(--color-primary-700); }
.cell-item-text > span { font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num-muted { color: var(--color-text-muted); }

/* Product editor */
.pe-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.pe-thumb { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: var(--gray-100); box-shadow: inset 0 0 0 1px var(--color-line); }
.pe-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pe-thumb span { font-size: 1.5rem; font-weight: 700; color: var(--gray-500); }
.pe-title { flex: 1 1 220px; min-width: 0; }
.pe-title h1 { margin: 0 0 8px; font-size: 1.625rem; overflow-wrap: anywhere; }
.pe-actions { gap: 8px; }
.pe-actions form { margin: 0; }
.pe-section { margin-top: 32px; }
.pe-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pe-section-head h2 { margin: 0; font-size: 1.0625rem; }
.pe-section-desc { font-size: var(--text-sm); color: var(--color-text-muted); }
.pe-step { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 0.75rem; font-weight: 700; color: #fff; background: var(--color-primary-600); }

.variant-card { scroll-margin-top: calc(var(--topbar-h) + 16px); transition: box-shadow var(--dur-3) ease; }
.variant-card.just-saved { box-shadow: 0 0 0 2px var(--color-success-border), var(--shadow-md); }
.variant-card.is-inactive { background: var(--gray-25); }
/* Product editor: variants are collapsed rows; the form opens on click. */
details.variant-card { padding: 0; margin-bottom: 10px; }
.variant-sum { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--radius-card); }
.variant-sum::-webkit-details-marker { display: none; }
.variant-sum:hover { background: var(--gray-25); }
.variant-sum-main { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-width: 0; flex: 1 1 200px; }
.variant-sum-name { font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.variant-sum-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.variant-sum-price { font-weight: 650; font-variant-numeric: tabular-nums; }
.variant-sum-chev { display: grid; place-items: center; color: var(--gray-500); transition: transform var(--dur-3) ease; }
details.variant-card[open] > .variant-sum { border-bottom: 1px solid var(--color-border-subtle); border-radius: var(--radius-card) var(--radius-card) 0 0; }
details.variant-card[open] .variant-sum-chev { transform: rotate(180deg); }
.variant-body { padding: 18px; }
.variant-body .variant-foot { margin-top: 4px; }
.variant-body .variant-extra { margin-top: 14px; justify-content: flex-end; }
.variant-card-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border-subtle); }
.variant-card-head :is(h2, h3) { margin: 0; font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
.variant-card-head + .small { margin-top: -6px; }
.flex-help { display: flex; align-items: flex-start; gap: 6px; }
.flex-help .i { flex: none; width: 14px; height: 14px; margin-top: 2px; }
tbody tr.is-editing, .data-row.is-editing { background: var(--color-primary-25); box-shadow: inset 3px 0 0 var(--color-primary-500); }
.variant-card-head .code-chip { margin-left: auto; }
.variant-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.variant-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; flex: 1 1 520px; min-width: 0; }
.variant-meta { display: flex; align-items: center; gap: 8px; padding-top: 28px; }
.variant-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.variant-foot > .flex { flex-wrap: wrap; }
.variant-extra { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--color-border-subtle); }
.variant-extra form { margin: 0; }
.stock-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.stock-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: var(--text-xs); color: var(--gray-600); background: var(--gray-100); }
.stock-pill b { font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.stock-pill.ok { color: var(--color-success); background: var(--color-success-bg); }
.stock-pill.ok b { color: var(--color-success); }
.stock-pill.warn { color: var(--color-warning); background: var(--color-warning-bg); }
.stock-pill.warn b { color: var(--color-warning); }
.add-variant { padding: 0; }
.add-variant > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 20px; font-weight: 650; color: var(--color-primary-700); border-radius: var(--radius-card); }
.add-variant > summary::-webkit-details-marker { display: none; }
.add-variant > summary:hover { background: var(--gray-25); }
.add-variant[open] > summary { border-bottom: 1px solid var(--color-border-subtle); border-radius: var(--radius-card) var(--radius-card) 0 0; }
.add-variant > form { padding: 20px; margin: 0; }
.add-variant.card-muted { border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.add-variant.card-muted > summary { border-radius: var(--radius-md); }
.add-plus { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--color-primary-50); color: var(--color-primary-600); }
.add-plus .i { width: 16px; height: 16px; }
.sold-list summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--gray-700); }
.sold-list ul { list-style: none; padding: 0; margin: 10px 0 4px; display: grid; gap: 4px; max-height: 240px; overflow-y: auto; }
.sold-list li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--gray-50); font-size: var(--text-xs); min-width: 0; }
.sold-list li .mono { overflow-wrap: anywhere; min-width: 0; }

/* Live preview while adding a product */
.preview-wrap { display: grid; place-items: center; padding: 4px 0; }
.preview-card { width: 100%; max-width: 240px; pointer-events: none; }
.product-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-card); background: #fff; box-shadow: 0 0 0 1px var(--color-line), var(--shadow-md); color: inherit; }
.product-thumb { position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; background: var(--gray-100); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.t0 { background: linear-gradient(150deg, #eef4ff, #dde8ff) !important; }
.t1 { background: linear-gradient(150deg, #ecfdf3, #d1fadf) !important; }
.t2 { background: linear-gradient(150deg, #fffaeb, #fef0c7) !important; }
.t3 { background: linear-gradient(150deg, #f4f3ff, #ebe9fe) !important; }
.t4 { background: linear-gradient(150deg, #f0fdf9, #ccfbef) !important; }
.t5 { background: linear-gradient(150deg, #fff1f3, #ffe4e8) !important; }
.product-initial {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 700; color: var(--gray-700); background: rgb(255 255 255 / 0.9); box-shadow: var(--shadow-md);
}
.product-body { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 12px 14px 14px; }
.product-stock { align-self: flex-start; margin-bottom: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 650; }
.product-stock.in { color: var(--color-success); background: var(--color-success-bg); }
.product-stock.out { color: var(--color-danger); background: var(--color-danger-bg); }
.product-cat { font-size: var(--text-xs); color: var(--color-text-muted); }
.product-name { font-size: 0.9375rem; font-weight: 650; line-height: 1.35; color: var(--color-text); overflow-wrap: anywhere; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.product-price { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.product-price .from { display: block; font-size: 0.6875rem; font-weight: 500; color: var(--color-text-muted); }
.product-cta { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 650; color: #fff; background: var(--color-primary-600); }

.tip-list { display: grid; gap: 8px; }
.tip { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius-md); background: var(--gray-50); font-size: var(--text-sm); }
.tip b { font-weight: 650; color: var(--color-text); }
.tip-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #fff; color: var(--color-primary-600); box-shadow: inset 0 0 0 1px var(--color-border); }
.tip-icon .i { width: 16px; height: 16px; }

/* Stock notepad */
.notepad { overflow: hidden; border-radius: var(--radius-md); background: #fff; box-shadow: 0 0 0 1px var(--color-border-strong), var(--shadow-xs); transition: box-shadow var(--dur-2) ease; }
.notepad:focus-within { box-shadow: 0 0 0 1px var(--color-primary-500), var(--ring); }
.notepad.has-error { box-shadow: 0 0 0 1px var(--color-danger-solid), var(--ring-danger); }
.notepad-bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--gray-50); border-bottom: 1px solid var(--color-border); font-size: var(--text-xs); color: var(--gray-600); }
.notepad-dots { display: flex; gap: 5px; }
.notepad-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-300); }
.notepad-file { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.notepad-file .i { width: 14px; height: 14px; color: var(--gray-400); }
.notepad-count { margin-left: auto; font-weight: 650; white-space: nowrap; color: var(--color-primary-700); }
.notepad-body { display: flex; align-items: stretch; max-height: 460px; overflow: hidden; }
.notepad-gutter {
  flex: none; min-width: 44px; padding: 12px 8px 12px 10px; text-align: right; user-select: none; overflow: hidden; white-space: pre;
  font-family: var(--font-mono); font-size: 13px; line-height: 22px; color: var(--gray-400); background: var(--gray-25); border-right: 1px solid var(--color-border-subtle);
}
.notepad-gutter .bad { color: #fff; background: var(--color-danger-solid); border-radius: 4px; padding: 0 4px; }
.notepad textarea {
  flex: 1; min-height: 200px; max-height: 460px; padding: 12px 14px; resize: vertical;
  border: 0; border-radius: 0; box-shadow: none !important; background: transparent; white-space: pre; overflow: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 22px; color: var(--gray-800);
}
.notepad textarea:focus { border: 0; }
.notepad-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 14px; font-size: var(--text-xs); color: var(--color-text-muted); background: var(--gray-50); border-top: 1px solid var(--color-border-subtle); }
.notepad-foot .is-bad { color: var(--color-danger); font-weight: 650; }
.notepad-keys { white-space: nowrap; }
.notepad-errors { padding: 12px 14px; background: var(--color-danger-bg); color: #912018; font-size: var(--text-sm); border-top: 1px solid var(--color-danger-border); }
.notepad-errors ul { margin: 6px 0 0; padding-left: 18px; }

/* Payment method radio cards */
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.method-option {
  position: relative; display: flex; align-items: flex-start; gap: 14px; margin: 0; padding: 16px;
  border-radius: var(--radius-card-sm); background: #fff; cursor: pointer; font-weight: 400;
  box-shadow: inset 0 0 0 1px var(--color-border-strong);
  transition: box-shadow var(--dur-2) ease, background-color var(--dur-2) ease;
}
.method-option:hover { box-shadow: inset 0 0 0 1px var(--color-primary-300); }
.method-option.selected { background: var(--color-primary-25); box-shadow: inset 0 0 0 2px var(--color-primary-500); }
.method-option.disabled { opacity: 0.6; cursor: not-allowed; }
.method-option input { position: absolute; opacity: 0; pointer-events: none; }
.method-option:has(input:focus-visible) { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.method-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--color-primary-50); color: var(--color-primary-600); }
.method-icon .i { width: 20px; height: 20px; }
.method-option.tint-mint .method-icon { background: var(--color-success-bg); color: var(--color-success); }
.method-option.tint-peach .method-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.method-body { flex: 1; min-width: 0; }
.method-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.90625rem; font-weight: 650; color: var(--color-text); }
.method-desc { display: block; margin-top: 3px; font-size: var(--text-xs); line-height: 1.55; color: var(--color-text-muted); }
.method-note { display: block; margin-top: 6px; font-size: var(--text-xs); color: var(--color-warning); font-weight: 550; }
.method-radio { width: 20px; height: 20px; flex: none; margin-top: 2px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--gray-300); background: #fff; transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease; }
.method-option.selected .method-radio { border-color: var(--color-primary-600); background: var(--color-primary-600); }
.method-option.selected .method-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }

/* Variant radio (billing plan picker reuses it) */
.variant-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.variant-option {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0;
  padding: 14px 16px; border-radius: var(--radius-card-sm); cursor: pointer; font-weight: 400;
  background: #fff; box-shadow: inset 0 0 0 1px var(--color-border-strong);
  transition: box-shadow var(--dur-2) ease, background-color var(--dur-2) ease;
}
.variant-option:hover { box-shadow: inset 0 0 0 1px var(--color-primary-300); }
.variant-option.selected { background: var(--color-primary-25); box-shadow: inset 0 0 0 2px var(--color-primary-500); }
.variant-option.sold-out { opacity: 0.5; cursor: not-allowed; }
.variant-option:has(input:focus-visible) { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.plan-list { display: grid; gap: 10px; }
.plan-option input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.plan-option .plan-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 650; color: var(--color-text); }
.plan-option .plan-sub { font-size: var(--text-xs); color: var(--color-text-muted); }
.plan-option .plan-price { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-option .plan-price s { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); }
.plan-check { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--gray-300); background: #fff; }
.variant-option.selected .plan-check { border-color: var(--color-primary-600); background: var(--color-primary-600); }
.variant-option.selected .plan-check::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }

/* Billing */
.bill-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bill-summary > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.bill-summary .amount-lg { font-size: 1.125rem; overflow-wrap: anywhere; }
.bill-summary .amount-lg span { margin-left: 2px; font-weight: 500; }
.pending-invoice { padding: 16px; border-radius: var(--radius-card-sm); background: var(--color-warning-bg); box-shadow: inset 0 0 0 1px var(--color-warning-border); }
.pending-amount { display: block; margin: 2px 0; font-size: 1.5rem; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pending-timer { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.pending-timer b { font-size: 1.25rem; font-weight: 700; color: var(--color-warning); font-variant-numeric: tabular-nums; }
.pending-timer.center { align-items: center; }
.claim-box { margin-top: 16px; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--color-border); }
.claim-box > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: var(--text-sm); }
.claim-box > summary::-webkit-details-marker { display: none; }
.claim-box > summary::after { content: ""; width: 16px; height: 16px; flex: none; background: var(--gray-500); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform var(--dur-2) var(--ease-out); }
.claim-box[open] > summary::after { transform: rotate(180deg); }
.claim-box > :not(summary) { margin-inline: 14px; }
.claim-box > form { margin-bottom: 14px; }
.uniq-code { color: var(--color-primary-700); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }

.qr-box { display: grid; place-items: center; gap: 14px; padding: 24px 16px; border-radius: var(--radius-card-sm); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.qr-box img { width: 232px; height: 232px; padding: 10px; border-radius: var(--radius-md); background: #fff; box-shadow: 0 0 0 1px var(--color-line), var(--shadow-md); }
.qr-box .metric-value { margin-top: 0; }
.pairing-code { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 1.625rem; font-weight: 700; letter-spacing: 0.14em; color: var(--color-text); }
.qr-box .qr-wait { display: grid; place-items: center; gap: 10px; min-height: 160px; color: var(--color-text-muted); font-size: var(--text-sm); text-align: center; }

.credential {
  margin: 0; padding: 14px 16px; border-radius: var(--radius-md);
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.75; color: var(--gray-800);
  background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border);
  white-space: pre-wrap; word-break: break-all; overflow-x: auto;
}

/* Connection log (bots) */
.conn-log { list-style: none; margin: 0; padding: 0; display: grid; max-height: 360px; overflow-y: auto; }
.conn-log-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--color-border-subtle); }
.conn-log-item:last-child { border-bottom: 0; }
.conn-log-dot { width: 8px; height: 8px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--gray-400); }
.conn-log-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.conn-log-text { font-size: var(--text-sm); color: var(--gray-800); overflow-wrap: anywhere; }
.conn-log-time { font-size: var(--text-xs); color: var(--color-text-muted); }
.conn-ok .conn-log-dot { background: var(--color-success-solid); }
.conn-warn .conn-log-dot { background: var(--color-warning-solid); }
.conn-bad .conn-log-dot { background: var(--color-danger-solid); }
.conn-info .conn-log-dot { background: var(--color-primary-500); }

/* Telegram banners & emoji */
.banner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.banner-slot { padding: 16px; border-radius: var(--radius-card-sm); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); min-width: 0; }
.banner-slot-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.banner-slot p { margin: 0 0 12px; }
.banner-slot .form-row { margin-bottom: 12px; }
.banner-slot form { margin: 0; }
.banner-preview { margin-bottom: 12px; border-radius: var(--radius-md); overflow: hidden; background: var(--gray-100); box-shadow: inset 0 0 0 1px var(--color-line); }
.banner-preview img { width: 100%; max-height: 220px; object-fit: cover; }

/* ---------------------------------------------------------------- Store settings: category tabs + banner galleries */

.st-tabs { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--color-border); }
.st-tabs::-webkit-scrollbar { display: none; }
.st-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 12px 16px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; color: var(--gray-600);
  transition: color var(--dur-2) ease, border-color var(--dur-2) ease;
}
.st-tab .i { color: var(--gray-400); transition: color var(--dur-2) ease; }
.st-tab:hover { color: var(--gray-900); }
.st-tab[aria-selected="true"] { color: var(--color-primary-700); border-bottom-color: var(--color-primary-600); }
.st-tab[aria-selected="true"] .i { color: var(--color-primary-600); }
.st-panel { max-width: 860px; }
.st-panel-wide { max-width: 1040px; }
.st-panel[hidden] { display: none; }
.st-panel + .st-panel { margin-top: 28px; }
.st-panel > .card + .card { margin-top: 16px; }
.st-intro { max-width: 72ch; margin: 0 0 16px; font-size: var(--text-sm); line-height: 1.6; color: var(--gray-600); }
.st-savebar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  max-width: 860px; margin-top: 20px; padding: 12px 12px 12px 18px; border-radius: 16px;
  background: rgb(255 255 255 / 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px var(--color-line), var(--shadow-lg);
}
.st-savebar[hidden] { display: none; }

.bn-card + .bn-card { margin-top: 16px; }
.bn-card .card-header { align-items: flex-start; }
.bn-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bn-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--color-primary-700); background: var(--color-primary-50); }
.bn-grid { list-style: none; display: grid; gap: 14px; margin: 0 0 16px; padding: 0; }
.bn-grid-desktop { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.bn-grid-mobile { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.bn-tile { min-width: 0; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--color-border), var(--shadow-xs); }
.bn-thumb { position: relative; overflow: hidden; background: var(--gray-100); }
.bn-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bn-thumb-desktop { aspect-ratio: 16 / 5; }
.bn-thumb-mobile { aspect-ratio: 2 / 1; }
/* Right third of a desktop banner: where the "Picked for you" box can sit on top of it. */
.bn-thumb-desktop::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 34%; border-left: 1px dashed rgb(255 255 255 / 0.9); background: repeating-linear-gradient(135deg, rgb(16 24 40 / 0.34) 0 6px, rgb(16 24 40 / 0.18) 6px 12px); pointer-events: none; }
.bn-num { position: absolute; top: 8px; left: 8px; z-index: 1; min-width: 24px; height: 24px; padding: 0 8px; display: grid; place-items: center; border-radius: 999px; font-size: 0.75rem; font-weight: 700; color: #fff; background: rgb(16 24 40 / 0.72); }
.bn-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; }
.bn-bar form { margin: 0; }
.bn-move { display: flex; gap: 2px; }
.bn-empty { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 18px; border-radius: 14px; border: 1.5px dashed var(--gray-300); background: var(--gray-50); color: var(--gray-500); font-size: var(--text-sm); }
.bn-upload { margin: 0; }
.bn-drop {
  position: relative; display: flex; align-items: center; gap: 14px; margin: 0; padding: 18px; border-radius: 14px; cursor: pointer;
  border: 1.5px dashed var(--gray-300); background: var(--gray-50); font-weight: 400;
  transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.bn-drop:hover, .bn-drop.is-drag { border-color: var(--color-primary-400); background: var(--color-primary-25); }
.bn-drop.is-drag { box-shadow: var(--ring); }
.bn-drop:focus-within { border-color: var(--color-primary-500); box-shadow: var(--ring); }
.bn-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.bn-drop-ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--color-primary-700); background: #fff; box-shadow: inset 0 0 0 1px var(--color-border); }
.bn-drop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.4; }
.bn-drop-text b { font-size: var(--text-sm); color: var(--color-text); }
.bn-drop-text span { font-size: var(--text-xs); color: var(--color-text-muted); }
.bn-upload.is-busy .bn-drop { opacity: 0.6; pointer-events: none; }
.bn-status { margin: 8px 0 0; font-size: var(--text-sm); color: var(--gray-600); }
.bn-status:empty { display: none; }
.bn-status.is-error { color: var(--color-danger); }
.bn-notes { margin: 14px 0 0; padding: 12px 14px 12px 30px; border-radius: 12px; background: var(--gray-50); font-size: var(--text-xs); line-height: 1.6; color: var(--gray-600); }
.bn-notes li + li { margin-top: 2px; }
.bn-note-info { color: var(--color-primary-800); font-weight: 600; }
/* Store announcement form */
#announcement-form > .card + .card { margin-top: 16px; }
.an-current { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px; border-radius: 14px; background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border); }
.an-current img { display: block; width: 88px; height: 88px; flex: none; object-fit: cover; border-radius: 10px; background: #fff; }
.an-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
@media (max-width: 640px) {
  .st-tab { padding: 12px 12px; }
  .st-savebar { bottom: 76px; }
  .bn-drop { padding: 14px; }
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.emoji-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); min-width: 0; }
.emoji-glyph { flex: none; width: 30px; font-size: 1.375rem; line-height: 1; text-align: center; }
.emoji-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.emoji-label { margin: 0; font-size: var(--text-xs); font-weight: 500; color: var(--gray-600); }
.command-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.command-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: var(--text-sm); }
.command-group h3 .i { width: 16px; height: 16px; color: var(--color-primary-600); }
.command-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.command-list li { font-size: var(--text-sm); color: var(--gray-600); line-height: 1.5; }
.command-list code { font-size: 0.8125rem; }

/* Custom domain cards */
.domain-item { min-width: 0; padding: 16px; border-radius: var(--radius-card-sm); background: #fff; box-shadow: inset 0 0 0 1px var(--color-border); }
.domain-item + .domain-item { margin-top: 14px; }
.domain-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.domain-item-id { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.domain-name { font-size: 0.9375rem; line-height: 1.35; overflow-wrap: anywhere; }
.domain-item-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.domain-item-actions form { margin: 0; }
.dns-intro { margin-top: 12px; font-size: var(--text-xs); line-height: 1.6; color: var(--color-text-muted); }
.dns-problem { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--color-danger-bg); color: #912018; font-size: var(--text-xs); line-height: 1.6; overflow-wrap: anywhere; }
.dns-problem b { color: var(--color-danger); }
.dns-records { display: grid; gap: 10px; margin-top: 12px; }
.dns-rec { overflow: hidden; border-radius: var(--radius-md); background: var(--gray-25); box-shadow: inset 0 0 0 1px var(--color-border); }
.dns-rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; background: var(--gray-50); border-bottom: 1px solid var(--color-border-subtle); }
.dns-type { padding: 2px 9px; border-radius: 999px; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; color: var(--color-primary-700); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-100); }
.dns-rec-note { min-width: 0; font-size: var(--text-xs); line-height: 1.5; color: var(--gray-600); }
.dns-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 9px 14px; }
.dns-row + .dns-row { border-top: 1px dashed var(--color-border); }
.dns-key { font-size: 0.71875rem; font-weight: 600; color: var(--color-text-muted); }
.dns-val { min-width: 0; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.55; color: var(--gray-800); overflow-wrap: anywhere; word-break: break-word; }
.dns-copy { flex: none; min-height: 28px; padding: 4px 11px; border: 0; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 0.71875rem; font-weight: 650; white-space: nowrap; color: var(--color-primary-700); background: var(--color-primary-50); transition: background-color var(--dur-1) ease; }
.dns-copy:hover { background: var(--color-primary-100); }
.dns-note-inline { font-size: 0.71875rem; color: var(--color-text-muted); white-space: nowrap; }
.dns-foot { margin: 10px 0 0; font-size: 0.71875rem; line-height: 1.65; color: var(--color-text-muted); }
.dns-foot code { overflow-wrap: anywhere; }

.guide-steps { counter-reset: guide; list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.guide-steps > li { counter-increment: guide; position: relative; padding-left: 40px; min-width: 0; }
.guide-steps > li::before {
  content: counter(guide); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  font-size: 0.75rem; font-weight: 700; color: var(--color-primary-700); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-100);
}
.guide-steps > li > b { display: block; color: var(--color-text); }
.guide-steps p { margin: 4px 0 0; color: var(--color-text-secondary); }
.guide-steps ul { margin: 8px 0 0; padding-left: 18px; color: var(--color-text-secondary); }
.guide-steps ul li { margin-bottom: 6px; }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { position: relative; padding-left: 28px; font-size: var(--text-sm); line-height: 1.55; color: var(--gray-700); }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-success-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23067647' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.price-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.price-list li { position: relative; padding-left: 28px; font-size: var(--text-sm); line-height: 1.55; color: var(--gray-700); }
.price-list li::before {
  content: ""; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-success-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23067647' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.payout-target { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.payout-target > span:last-child { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }

/* "This needs your decision" banner: payment review, unpaid order. */
.decision-card { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.decision-card.tone-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); }
.decision-card.tone-info { background: var(--color-primary-25); border-color: var(--color-primary-200); }
.decision-main { display: flex; align-items: flex-start; gap: 14px; flex: 1 1 340px; min-width: 0; }
.decision-main h2 { margin: 0 0 3px; font-size: 1rem; }
.decision-main p { margin: 0; font-size: var(--text-sm); line-height: 1.55; color: var(--color-text-secondary); }
.decision-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--color-border); }
.decision-icon .i { width: 20px; height: 20px; }
.tone-warning .decision-icon { color: var(--color-warning); }
.tone-info .decision-icon { color: var(--color-primary-600); }
.decision-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.decision-actions form { margin: 0; }

/* Order detail */
.order-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex: 1 1 100%; }
.data-row-main > b.wrap-text { white-space: normal; overflow-wrap: anywhere; }
.kpi-body b.kpi-text { font-size: 1rem; font-weight: 650; white-space: normal; margin-top: 6px; }
.data-row-icon.tone-in { background: var(--color-success-bg); color: var(--color-success); }
.data-row-icon.tone-out { background: var(--color-danger-bg); color: var(--color-danger); }
.person h1 { margin: 0; font-size: 1.5rem; }
.reseller-mark { width: 13px; height: 13px; color: var(--color-primary-600); vertical-align: -2px; }
.amount-lg { font-size: 1.25rem; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--color-text); }
.empty-panel { border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.order-total b { font-size: 1.375rem; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--color-text); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: 14px; }
.person > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person b { font-weight: 650; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person span { font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-stack { display: grid; gap: 8px; }
.action-stack form { margin: 0; }
.action-stack .btn { width: 100%; }
.money-in { color: var(--color-success); font-weight: 650; }
.money-out { color: var(--color-danger); font-weight: 650; }

.review-card .card-header { align-items: center; }
.review-proof { display: block; overflow: hidden; border-radius: var(--radius-md); box-shadow: 0 0 0 1px var(--color-line); background: var(--gray-50); }
.review-proof img { width: 100%; max-height: 420px; object-fit: contain; }
.proof-thumb { display: block; width: 100%; max-width: 320px; overflow: hidden; border-radius: var(--radius-md); box-shadow: 0 0 0 1px var(--color-line); }
.proof-thumb img { width: 100%; }

.team-perm-line { color: var(--color-primary-700) !important; }
.team-row { align-items: flex-start; }
.team-row .cluster { flex: none; flex-wrap: nowrap; }
.team-perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }

.avatar-sq { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; font-weight: 700; font-size: 0.9375rem; color: var(--color-primary-700); background: var(--color-primary-50); }
.av-0 { background: var(--color-primary-50); color: var(--color-primary-700); }
.av-1 { background: #f4f3ff; color: #5925dc; }
.av-2 { background: var(--color-success-bg); color: var(--color-success); }
.av-3 { background: var(--color-warning-bg); color: var(--color-warning); }
.av-4 { background: #fff1f3; color: #c01048; }

/* ---------------------------------------------------------------- 17. Admin pages */

.member-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.member-search { position: relative; display: flex; align-items: center; gap: 8px; flex: 1 1 280px; max-width: 460px; min-width: 0; }
.member-search input { padding-left: 38px; }
.member-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; display: grid; }
.member-search-icon .i { width: 17px; height: 17px; }

.member-list-head, .member-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.9fr) minmax(0, 1.5fr) minmax(0, 1.2fr) auto; gap: 16px; align-items: center; }
.member-list-head { padding: 0 20px 8px; font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); }
.member-list-head .right, .member-sales { text-align: right; }
.member-list { display: grid; gap: 8px; }
.member-row { padding: 14px 20px; background: #fff; border-radius: var(--radius-card-sm); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-card); transition: box-shadow var(--dur-2) ease; }
.member-row:hover { box-shadow: 0 0 0 1px var(--color-border-strong), var(--shadow-sm); }
.member-id { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; }
.member-id:hover { color: inherit; }
.member-id:hover b { color: var(--color-primary-700); }
.member-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; font-weight: 700; font-size: 0.9375rem; }
.member-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.member-names > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-names b { font-size: 0.9375rem; font-weight: 650; transition: color var(--dur-1) ease; }
.member-names .mono { font-size: 0.71875rem; }
.member-cell { min-width: 0; }
.member-sales { display: flex; flex-direction: column; align-items: flex-end; }
.member-sales b { font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.member-actions { display: flex; gap: 6px; justify-content: flex-end; }
.period-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.period-top b { font-size: var(--text-sm); font-weight: 650; }
.period-bar { height: 5px; margin-top: 7px; border-radius: 999px; overflow: hidden; background: var(--gray-150); }
.period-bar i { display: block; height: 100%; border-radius: inherit; }
.tone-ok { color: var(--color-success); } .tone-bg-ok { background: var(--color-success-solid); }
.tone-warn { color: var(--color-warning); } .tone-bg-warn { background: var(--color-warning-solid); }
.tone-bad { color: var(--color-danger); } .tone-bg-bad { background: var(--color-danger-solid); }
.tone-idle { color: var(--color-text-muted); } .tone-bg-idle { background: var(--gray-300); }

.gwapp-list-head.member-list-head, .gwapp-row.member-row { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 1.1fr) auto; }
.gwapp-row.member-row { align-items: start; }
.gwapp-row .member-id, .gwapp-row .gwapp-actions { padding-top: 2px; }
.gwapp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gwapp-review-note { margin-top: 4px; font-size: var(--text-xs); line-height: 1.4; color: var(--color-text-muted); }
.gwapp-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.gwapp-actions form { margin: 0; display: flex; gap: 6px; }
.gwapp-actions input[name="note"] { max-width: 140px; min-height: 32px; padding: 6px 10px; font-size: var(--text-xs); }

.billing-list { display: grid; gap: 12px; }
.billing-claim { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--color-primary-25); box-shadow: inset 0 0 0 1px var(--color-primary-100); }
.billing-amount { font-size: 1rem; font-variant-numeric: tabular-nums; }
.billing-proof { max-width: 200px; max-height: 240px; object-fit: cover; border-radius: var(--radius-sm); box-shadow: 0 0 0 1px var(--color-line); }
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.billing-actions form { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.billing-actions input[name="note"] { width: 200px; min-height: 32px; padding: 6px 10px; font-size: var(--text-xs); }

.tp-form { display: grid; gap: 18px; }
.tp-row { display: flex; gap: 16px; align-items: center; }
.tp-preview { flex: 0 0 132px; height: 84px; display: flex; overflow: hidden; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: 0 0 0 1px var(--color-line); }
.tp-side { flex: 0 0 30%; background: var(--gray-100); border-right: 1px solid var(--color-line); position: relative; }
.tp-side::after { content: ""; position: absolute; left: 6px; right: 6px; top: 12px; height: 8px; border-radius: 4px; background: color-mix(in oklab, var(--tp) 22%, #fff); }
.tp-main { flex: 1; padding: 10px; display: grid; gap: 6px; align-content: start; }
.tp-main i { display: block; height: 12px; border-radius: 4px; background: var(--gray-150); }
.tp-main b { display: block; width: 46%; height: 16px; border-radius: 6px; background: var(--tp); }
.tp-fields { flex: 1; min-width: 0; }
.tp-input { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-tag { padding: 2px 10px; border-radius: 999px; font-size: 0.71875rem; font-weight: 650; color: var(--gray-600); background: var(--gray-100); }
.tp-reset { margin-top: 8px; font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); }

/* ---------------------------------------------------------------- 18. Auth */

.auth-body { background: #fff; }
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: 100vh; min-height: 100dvh; }
.auth-main { display: flex; flex-direction: column; padding: 28px 40px; min-width: 0; }
.auth-main-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text); font-weight: 750; font-size: 1.0625rem; letter-spacing: 0.02em; }
.auth-logo:hover { color: var(--color-text); }
.auth-logo img { width: 30px; height: 30px; border-radius: 8px; }
.auth-center { flex: 1; display: grid; place-items: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card > h1 { font-size: 1.75rem; margin-bottom: 8px; }
.auth-card > .auth-lead, .auth-lead { margin: 0 0 28px; color: var(--color-text-secondary); font-size: var(--text-base); line-height: 1.6; }
.auth-card form .btn-block { margin-top: 6px; }
.auth-alt { margin-top: 24px; font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; }
.auth-alt a { font-weight: 650; text-decoration: none; }
.auth-foot { font-size: var(--text-xs); color: var(--color-text-subtle); }
.auth-title { margin: 0 0 8px; font-size: 1.5rem; }
.auth-email { color: var(--color-text); overflow-wrap: anywhere; }
.auth-icon {
  width: 52px; height: 52px; margin-bottom: 20px; display: grid; place-items: center;
  border-radius: 14px; color: var(--color-primary-600); background: var(--color-primary-50);
  box-shadow: 0 0 0 8px var(--color-primary-25);
}
.auth-icon svg { width: 26px; height: 26px; }
.auth-icon-mail { color: var(--color-success); background: var(--color-success-bg); box-shadow: 0 0 0 8px #f6fef9; }
.auth-icon-warn { color: var(--color-warning); background: var(--color-warning-bg); box-shadow: 0 0 0 8px #fffcf5; }
.auth-steps { display: grid; gap: 10px; margin: 4px 0 20px; padding: 0; list-style: none; }
.auth-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--color-border-subtle); font-size: var(--text-sm); line-height: 1.45; }
.auth-step b { color: var(--color-text); }
.auth-step-n { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 0.71875rem; font-weight: 700; color: var(--color-primary-700); background: var(--color-primary-100); }

.auth-aside {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  margin: 12px 12px 12px 0; padding: 48px; border-radius: 28px;
  background: #0b1530; color: #fff;
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 50% at 85% 0%, rgb(74 134 247 / 0.45), transparent 70%),
    radial-gradient(50% 45% at 0% 100%, rgb(47 111 235 / 0.35), transparent 70%);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.35;
  background-image: linear-gradient(rgb(255 255 255 / 0.06) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(80% 70% at 70% 30%, #000, transparent);
  mask-image: radial-gradient(80% 70% at 70% 30%, #000, transparent);
}
.auth-aside > div:first-child { margin: auto 0; }
.auth-aside-badge { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 12px 6px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; color: rgb(255 255 255 / 0.9); background: rgb(255 255 255 / 0.08); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14); }
.auth-aside-badge i { width: 8px; height: 8px; border-radius: 50%; background: #47cd89; box-shadow: 0 0 0 3px rgb(71 205 137 / 0.25); }
.auth-aside h2 { margin: 20px 0 16px; max-width: 16ch; color: #fff; font-size: clamp(1.75rem, 1rem + 1.8vw, 2.5rem); line-height: 1.12; letter-spacing: -0.03em; font-weight: 720; }
.auth-aside p { color: rgb(255 255 255 / 0.72); max-width: 44ch; }
.auth-aside .check-list li { color: rgb(255 255 255 / 0.86); }
.auth-aside .check-list li::before { background-color: rgb(255 255 255 / 0.12); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2397b9fc' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E"); }
.auth-price { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius-lg); background: rgb(255 255 255 / 0.06); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.auth-price small { display: block; font-size: var(--text-xs); color: rgb(255 255 255 / 0.6); }
.auth-price b { font-size: 1.5rem; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.auth-price b span { font-size: var(--text-sm); font-weight: 500; color: rgb(255 255 255 / 0.6); }
.auth-price > span { font-size: var(--text-xs); color: rgb(255 255 255 / 0.6); }
.auth-aside-foot { font-size: var(--text-xs); color: rgb(255 255 255 / 0.5); }

.auth-mock { position: relative; margin-top: 8px; padding: 16px; border-radius: 18px; background: rgb(255 255 255 / 0.96); color: var(--color-text); box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.5); max-width: 420px; }
.auth-mock-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; font-size: var(--text-xs); }
.auth-mock-row + .auth-mock-row { border-top: 1px solid var(--color-border-subtle); }
.auth-mock-row .data-row-icon { width: 30px; height: 30px; border-radius: 8px; }
.auth-mock-row b { font-size: var(--text-xs); }
.auth-mock-row .badge { margin-left: auto; }

.auth-simple { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; background: var(--color-page); }
.auth-simple .auth-card { max-width: 420px; }
.auth-simple .auth-card-wide { max-width: 560px; }
.auth-simple .card { --card-pad: 28px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-line); border: 0; }
.auth-simple-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; text-align: center; }
.auth-simple-brand img { width: 44px; height: 44px; border-radius: 12px; }

@media (max-width: 1023px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 20px; }
  .auth-center { padding: 32px 0 24px; align-items: start; }
}
@media (max-width: 480px) {
  .auth-card > h1, .auth-title { font-size: 1.5rem; }
  .auth-simple { padding: 20px 16px; place-items: start center; }
  .auth-simple .card { --card-pad: 20px; }
}

/* ---------------------------------------------------------------- 19. Error pages */

.error-page { display: grid; place-items: center; min-height: calc(100vh - 320px); padding: 64px 20px; text-align: center; }
.error-inner { max-width: 520px; }
.error-code {
  display: inline-block; margin-bottom: 18px; padding: 4px 12px; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em;
  color: var(--color-primary-700); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-100);
}
.error-number {
  display: block; margin: 0 0 8px; font-size: clamp(5rem, 3rem + 10vw, 9rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.06em;
  background: linear-gradient(180deg, var(--gray-900) 30%, var(--gray-400)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-page h1 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); }
.error-page p { color: var(--color-text-secondary); margin: 0 auto 28px; max-width: 44ch; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.error-detail { margin: 0 auto 24px; max-width: 520px; text-align: left; }

/* ---------------------------------------------------------------- 20. Motion */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes draw-line { from { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); } to { stroke-dasharray: var(--len, 2000); stroke-dashoffset: 0; } }
@keyframes grow-bar { from { transform: scaleY(0.02); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }

.fade-up { animation: fadeUp 0.7s var(--ease-out) both; }
.fade-up-2 { animation: fadeUp 0.7s var(--ease-out) 0.08s both; }
.fade-up-3 { animation: fadeUp 0.7s var(--ease-out) 0.16s both; }
.content > * { animation: rise-in 0.4s var(--ease-out) both; }
.content > *:nth-child(2) { animation-delay: 0.03s; }
.content > *:nth-child(3) { animation-delay: 0.06s; }
.content > *:nth-child(n+4) { animation-delay: 0.09s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* Platform settings: one tab per concern, nav on the left (a pill strip on small screens). */
.settings-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav {
  position: sticky; top: 84px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px;
  background: #fff; border-radius: var(--radius-card); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-card);
}
.settings-nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--gray-700); text-decoration: none; transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.settings-nav-link:hover { background: var(--gray-50); color: var(--gray-900); }
.settings-nav-link.is-active { background: var(--color-primary-50); color: var(--color-primary-700); }
.settings-nav-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--gray-100); color: var(--gray-600); }
.settings-nav-link.is-active .settings-nav-icon { background: #fff; color: var(--color-primary-600); box-shadow: 0 0 0 1px var(--color-primary-100); }
.settings-nav-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.settings-nav-text b { font-size: var(--text-sm); font-weight: 650; }
.settings-nav-text small { font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-nav-flag { margin-left: auto; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--color-danger-solid); }
.settings-panel { display: grid; gap: 16px; min-width: 0; align-content: start; }
.settings-panel > *, .settings-panel > .card + .card { margin-top: 0; margin-bottom: 0; }
.settings-panel > form.stack > .form-actions { margin-top: 0; }

.price-rows { margin: 0 calc(var(--card-pad) * -1) 18px; border-top: 1px solid var(--color-border-subtle); }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--card-pad); border-bottom: 1px solid var(--color-border-subtle); }
.price-row-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.price-row-label label { margin: 0; font-size: var(--text-sm); }
.price-row-input { flex: 0 0 230px; }
.input-suffix { display: flex; align-items: stretch; min-width: 0; }
.input-suffix input { border-radius: var(--radius-input) 0 0 var(--radius-input); min-width: 0; }
.input-suffix span {
  display: grid; place-items: center; padding: 0 12px; flex: none;
  font-size: var(--text-sm); font-weight: 600; color: var(--gray-500);
  background: var(--gray-50); border: 1px solid var(--color-border-strong); border-left: 0;
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
}
.settings-hint { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; transition: box-shadow var(--dur-2) ease; }
.settings-hint:hover { color: inherit; box-shadow: 0 0 0 1px var(--color-border-strong), var(--shadow-sm); }
.settings-hint .grow { display: flex; flex-direction: column; gap: 2px; }
.settings-hint b { font-size: var(--text-sm); font-weight: 650; }
.settings-hint .chev { color: var(--gray-400); flex: none; }

.status-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.status-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 12px 14px;
  border-radius: var(--radius-md); background: var(--gray-25); box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}
.status-tile > .small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.announce-preview { margin-bottom: 18px; box-shadow: none; }

/* Vouchers */
.voucher-code, .code-display .mono {
  display: inline-block; padding: 3px 9px; border-radius: 7px; font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.03em; text-decoration: none;
  color: var(--color-primary-700); background: var(--color-primary-25); border: 1px dashed var(--color-primary-300);
}
.voucher-code { white-space: nowrap; }
a.voucher-code:hover { background: var(--color-primary-50); color: var(--color-primary-800); }
.voucher-note { max-width: 240px; margin-top: 5px; }
.voucher-table .usage { min-width: 120px; }
.voucher-table .usage .period-bar { max-width: 150px; margin-top: 6px; }
tr.is-muted td, .redemption-list > li.is-muted .data-row { opacity: 0.55; }
.voucher-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.voucher-title .mono { letter-spacing: 0.02em; }
.kpi-body b small.kpi-inline { display: inline; font-size: 0.875rem; font-weight: 500; color: var(--color-text-muted); }
.voucher-lookup-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.voucher-lookup-head .card-subtitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.voucher-lookup.is-used { box-shadow: 0 0 0 1px var(--color-warning-border), var(--shadow-card); }
.voucher-lookup.is-fresh { box-shadow: 0 0 0 1px var(--color-success-border), var(--shadow-card); }
.voucher-lookup > .data-list { margin-top: 16px; }
.voucher-form-layout { max-width: 860px; }
.code-display { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.input-medium { max-width: 240px; }
.input-wide { max-width: 440px; }
.batch-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0;
  margin: 0 calc(var(--card-pad) * -1) calc(var(--card-pad) * -1); border-top: 1px solid var(--color-border-subtle);
}
.batch-item { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px var(--card-pad); border-bottom: 1px solid var(--color-border-subtle); }
.batch-item:nth-child(odd) { border-right: 1px solid var(--color-border-subtle); }
.batch-no { width: 22px; flex: none; font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.batch-who { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item.is-used .voucher-code { text-decoration: line-through; opacity: 0.7; }
.btn-icon-spacer { width: 32px; flex: none; }
.batch-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-weight: 600; }
.voucher-form-layout:has(input[name="mode"][value="bulk"]:checked) .only-single,
.voucher-form-layout:has(input[name="mode"][value="single"]:checked) .only-bulk { display: none; }
.choice-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-card { position: relative; margin: 0; cursor: pointer; font-weight: inherit; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card-body {
  display: flex; align-items: flex-start; gap: 12px; height: 100%; padding: 12px 14px; border-radius: var(--radius-md);
  background: #fff; box-shadow: inset 0 0 0 1px var(--color-border-strong); transition: box-shadow var(--dur-2) ease, background-color var(--dur-2) ease;
}
.choice-card-body > .i { flex: none; margin-top: 1px; color: var(--gray-500); }
.choice-card-body > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-card-body b { font-size: var(--text-sm); font-weight: 650; color: var(--gray-900); }
.choice-card-body small { font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); line-height: 1.45; }
.choice-card:hover .choice-card-body { box-shadow: inset 0 0 0 1px var(--gray-400); }
.choice-card input:checked + .choice-card-body { background: var(--color-primary-25); box-shadow: inset 0 0 0 2px var(--color-primary-600); }
.choice-card input:checked + .choice-card-body > .i { color: var(--color-primary-600); }
.choice-card input:focus-visible + .choice-card-body { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
fieldset:disabled .choice-card { cursor: not-allowed; opacity: 0.6; }

/* Member billing: voucher field */
.voucher-input {
  display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; border-radius: var(--radius-input);
  background: #fff; border: 1px solid var(--color-border-strong); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.voucher-input:focus-within { border-color: var(--color-primary-500); box-shadow: var(--shadow-xs), var(--ring); }
.voucher-input input, .voucher-input input:hover, .voucher-input input:focus {
  flex: 1; min-width: 0; min-height: 32px; padding: 4px 0; border: 0; box-shadow: none; background: transparent; text-transform: uppercase;
}
.voucher-input input::placeholder { text-transform: none; font-family: inherit; }
.voucher-input.is-invalid { border-color: var(--color-danger); }
.voucher-input.is-valid { border-color: var(--color-success-border); background: var(--color-success-bg); }
.voucher-input-icon { display: grid; color: var(--gray-400); }
.voucher-input.is-valid .voucher-input-icon { color: var(--color-success); }
.voucher-form .help { margin-top: 6px; }
.voucher-applied { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--color-success-bg); color: #085d3a; }
.voucher-applied > .i { flex: none; color: var(--color-success); }
.voucher-applied > span { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.45; }
.voucher-applied .btn { flex: none; }
.plan-option .plan-price .small { display: block; font-weight: 500; }

@media (min-width: 1024px) {
  .settings-save { position: sticky; bottom: 16px; z-index: 5; justify-content: flex-end; padding: 12px 16px; border-radius: var(--radius-card);
    background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-md); }
}

@media (max-width: 1023px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .settings-nav { position: static; display: flex; gap: 4px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-link { flex: none; gap: 8px; padding: 7px 12px 7px 7px; }
  .settings-nav-icon { width: 28px; height: 28px; border-radius: 8px; }
  .settings-nav-text small { display: none; }
  .batch-list { grid-template-columns: minmax(0, 1fr); }
  .batch-item:nth-child(odd) { border-right: 0; }
}

@media (max-width: 767px) {
  .price-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .price-row-input { flex-basis: auto; }
  .status-tiles, .choice-cards { grid-template-columns: minmax(0, 1fr); }
  .voucher-lookup-head .btn { width: 100%; }
  .voucher-applied { flex-wrap: wrap; }
  .batch-item { flex-wrap: wrap; row-gap: 4px; }
  .batch-item .badge { margin-left: auto; }
  .batch-who { order: 5; flex-basis: 100%; padding-left: 34px; }
  .voucher-applied .btn { margin-left: 26px; }
  .input-medium, .input-wide { max-width: none; }
  /* KPI tiles stay two per row on phones: icon above the number instead of beside it. */
  .grid-4 > .kpi { flex-direction: column; gap: 10px; }
  .grid-4 > .kpi .kpi-icon { width: 34px; height: 34px; border-radius: 10px; }
  .grid-4 > .kpi .kpi-icon .i { width: 17px; height: 17px; }
  .grid-4 > .kpi .kpi-body b { font-size: 1.125rem; }
  .grid-4 > .kpi .kpi-body small { white-space: normal; }
}

/* ---------------------------------------------------------------- 21. Responsive */

@media (max-width: 1279px) {
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .split-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-8, .span-4 { grid-column: span 12; }
  .kpi-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; }
  .member-list-head, .member-row { grid-template-columns: minmax(0, 2fr) minmax(0, 0.9fr) minmax(0, 1.4fr) minmax(0, 1.1fr) auto; }
}

@media (max-width: 1023px) {
  .grid-3, .grid-2, .grid-3-2, .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); }
  .span-7, .span-6, .span-5, .span-3 { grid-column: span 12; }
  .command-grid { grid-template-columns: 1fr; }
  .member-list-head { display: none; }
  .member-row, .gwapp-row.member-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; }
  .member-cell::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 0.71875rem; font-weight: 600; color: var(--color-text-muted); }
  .member-actions::before, .member-sales::before { content: none !important; }
  .member-id { grid-column: 1; grid-row: 1; }
  .member-cell[data-label="Status"] { grid-column: 2; grid-row: 1; align-self: start; justify-self: end; }
  .member-cell[data-label="Status"]::before { content: none; }
  .member-period { grid-column: 1 / -1; }
  .member-sales { align-items: flex-start; text-align: left; }
  .member-actions { justify-self: end; align-self: end; }
  .gwapp-row.member-row { grid-template-columns: minmax(0, 1fr); }
  .gwapp-row .member-cell[data-label="Status"] { grid-column: auto; grid-row: auto; justify-self: start; }
  .gwapp-row .member-cell[data-label="Status"]::before { content: attr(data-label); }
  .gwapp-actions { justify-content: flex-start; }
}

@media (max-width: 767px) {
  :root { --text-h1: 1.5rem; }
  body { font-size: 0.9375rem; }
  .card { --card-pad: 16px; border-radius: var(--radius-card-sm); }
  .card-lg, .kpi-hero { --card-pad: 18px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid { gap: 12px; }
  .dash-grid { gap: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { margin-bottom: 18px; gap: 14px; align-items: stretch; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-head .page-desc, .page-head > div > p { font-size: var(--text-sm); }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > form, .page-actions > a { flex: 1 1 auto; }
  .page-actions > form .btn { width: 100%; }
  .dash-head { margin-bottom: 18px; }
  .dash-head h1 { font-size: 1.5rem; }
  .dash-head > .btn { width: 100%; }
  .kpi-stack { grid-template-columns: minmax(0, 1fr); }
  .kpi-hero .chart { height: 150px; }
  .kpi-hero-foot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-hero-foot > div { padding: 12px 12px; }
  .kpi-hero-foot > div:first-child { padding-left: var(--card-pad); }
  .kpi-hero-foot b { font-size: 0.9375rem; }
  .metric { padding: 14px 16px; }
  .metric-value { font-size: 1.25rem; }
  .method-grid, .variant-list, .team-perms { grid-template-columns: minmax(0, 1fr); }
  .variant-fields { grid-template-columns: minmax(0, 1fr); flex-basis: 100%; }
  .variant-meta { padding-top: 0; }
  .variant-foot > .flex { width: 100%; }
  .variant-foot > .flex > .btn { flex: 1 1 auto; }
  .notepad-keys { display: none; }
  .dns-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 12px; }
  .dns-key { grid-column: 1 / -1; }
  .domain-item { padding: 14px; }
  .domain-item-actions { width: 100%; margin-left: 0; }
  .domain-item-actions form:first-child { flex: 1 1 auto; }
  .domain-item-actions form:first-child .btn { width: 100%; }
  .qr-box img { width: 208px; height: 208px; }
  .tp-row { flex-direction: column; align-items: stretch; }
  .tp-preview { flex-basis: auto; width: 100%; }
  .member-toolbar > * { width: 100%; max-width: none; }
  .split-main > .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .sr-only-mobile { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bill-summary { grid-template-columns: minmax(0, 1fr); }
  .billing-body { grid-template-columns: minmax(0, 1fr); }
  .reject-form { max-width: none; }
  .form-actions-end > .btn { flex: 1 1 auto; }
  .decision-actions { width: 100%; }
  .decision-actions > form { flex: 1 1 auto; }
  .decision-actions .btn { width: 100%; }
  .search-field { flex-basis: 100%; max-width: none; }
  .toolbar select { flex: 1 1 140px; }
  .toolbar .btn { flex: 1 1 auto; }
  .toolbar-end { margin-left: 0; width: 100%; }
  .toolbar-end > .btn { flex: 1 1 auto; }
  .status-tabs, .channel-tabs, .variant-tabs, .seg-tabs { width: 100%; }
  .show-mobile { display: revert !important; }
  .show-mobile.data-list { display: block !important; }
  .hide-mobile { display: none !important; }
  .detail-list > div { flex-wrap: wrap; gap: 2px 16px; }
  .modal { place-items: end center; padding: 12px; padding-bottom: calc(12px + var(--safe-b)); }
  .modal-panel { width: 100%; border-radius: var(--radius-lg); animation-name: sheet-up; }
  .modal-actions { flex-direction: column-reverse; }
  .alert { flex-wrap: wrap; }
  .alert .btn { margin-left: 28px; }
  .period-strip { border-radius: var(--radius-md); }
  .period-strip .btn { margin-left: 20px; }
  .card-foot { flex-direction: column; align-items: stretch; }

  /* Tables become compact two-column cards: first cell is the title, actions sit at the foot. */
  table.responsive, table.responsive tbody { display: block; }
  table.responsive thead { display: none; }
  table.responsive tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 14px var(--card-pad, 16px); border-bottom: 1px solid var(--color-border-subtle); }
  table.responsive tbody tr:last-child { border-bottom: 0; }
  table.responsive tbody tr:hover { background: transparent; }
  table.responsive td { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 0 !important; border: 0; font-size: var(--text-sm); overflow-wrap: anywhere; text-align: left; }
  table.responsive td::before { content: attr(data-label); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em; color: var(--color-text-muted); }
  table.responsive td:first-child { grid-column: 1 / -1; font-weight: 650; color: var(--color-text); }
  table.responsive td:first-child::before { content: none; }
  table.responsive td[colspan], table.responsive td.wide { grid-column: 1 / -1; }
  table.responsive td.actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 8px; white-space: normal; padding-top: 4px !important; }
  table.responsive td.actions::before { content: none; }
  table.responsive td.actions > * + * { margin-left: 0; }
  table.responsive td.actions .btn { flex: 1 1 auto; }
  table.responsive td.actions > form { display: flex; flex: 1 1 auto; }
  table.responsive td.actions > form .btn { width: 100%; }
  table.responsive td.actions > details { width: 100%; }
  table.responsive td:empty { display: none; }
  .card > .table-wrap { border-top: 1px solid var(--color-border-subtle); }
  .card > .table-wrap:has(table.responsive) { overflow: visible; }
}

@media (max-width: 400px) {
  .kpi-hero-foot { grid-template-columns: minmax(0, 1fr); }
  .kpi-hero-foot > div, .kpi-hero-foot > div:first-child { padding: 10px var(--card-pad); }
  .kpi-hero-foot > div + div { border-left: 0; border-top: 1px solid var(--color-border-subtle); }
  .kpi-hero-foot > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .kpi-hero-foot b { margin: 0; }
}

/* ---- Auto TRX / testimonial channel ---- */
.trx-steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: trx; display: grid; gap: 10px; }
.trx-steps li { counter-increment: trx; display: flex; gap: 12px; align-items: flex-start; font-size: var(--text-sm); line-height: 1.55; color: var(--color-text-secondary); }
.trx-steps li::before {
  content: counter(trx); flex: none; width: 24px; height: 24px; border-radius: 999px; margin-top: -1px;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700;
  color: var(--color-primary-700); background: var(--color-primary-50); box-shadow: inset 0 0 0 1px var(--color-primary-200);
}
.trx-channel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2);
}
.trx-channel-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--color-primary-700); background: var(--color-primary-50); }
.trx-channel-main { flex: 1 1 200px; min-width: 0; display: grid; gap: 2px; }
.trx-channel-main b { overflow-wrap: anywhere; }
.trx-channel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.trx-template { line-height: 1.55; min-height: 220px; resize: vertical; white-space: pre; overflow-x: auto; }
.trx-template-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 6px; }
.trx-ph-title { font-size: var(--text-sm); font-weight: 650; margin-bottom: 8px; }
.trx-ph-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; }
.trx-ph-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.trx-chip {
  flex: none; font: inherit; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1; padding: 6px 9px; cursor: pointer;
  color: var(--color-primary-700); background: var(--color-primary-50); border: 0; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--color-primary-200); transition: background 0.15s;
}
.trx-chip:hover { background: var(--color-primary-100); }
.trx-chip:focus-visible { outline: 0; box-shadow: var(--ring); }
.trx-bubble {
  max-width: 420px; margin: 0 auto; overflow: hidden; border-radius: 16px 16px 16px 4px;
  background: #fff; border: 1px solid var(--color-border); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
.trx-bubble-img { display: block; width: 100%; height: auto; background: var(--gray-100); }
.trx-bubble-text { margin: 0; padding: 10px 14px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 0.875rem; line-height: 1.5; color: var(--color-text); }
.trx-warn { color: var(--color-warning); }
.trx-sticky { position: sticky; top: 84px; }
@media (max-width: 1023px) { .trx-sticky { position: static; } }

@keyframes sheet-up { from { opacity: 0.4; transform: translateY(40px); } }

/* Bundle editor: one row per item (variant · qty · remove), then the live total. */
.bundle-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.bundle-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto; gap: 8px; align-items: center; }
.bundle-row input { text-align: center; }
.bundle-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius-md, 10px); background: var(--gray-50); }
.bundle-sum > div { display: flex; flex-direction: column; gap: 2px; }
.bundle-sum b { font-variant-numeric: tabular-nums; }
.bundle-thumb { border-radius: 8px; object-fit: cover; }
/* What is in a bundle, in the list: wraps onto two lines instead of stretching the table
   past its card and pushing the action buttons out of sight. */
.cell-item-text > .bundle-contents {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  max-width: 340px; white-space: normal; overflow: hidden; line-height: 1.45;
}

@media print {
  .sidebar, .topbar, .bottom-nav, .btn, .buy-bar, .announce, .toast-stack { display: none !important; }
  .content { padding: 0; max-width: none; }
  body, .app { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
