/* ===========================================================================
   Pixel Chatting Hub — Design System v2  "Signal"
   ---------------------------------------------------------------------------
   A premium, agency-grade CRM surface tuned to the OnlyFans ecosystem.
   One signature hue: OnlyFans cyan (#00AFF0). Lightness + a cool neutral
   ladder do the structural work. Two fully-built themes:

     • LIGHT  (default)  — clean, editorial, white cards on a cool canvas.
     • DARK   ([data-theme="dark"]) — deep cool slate, cyan glows.

   Theming is token-driven. Every component reads semantic tokens; the dark
   theme only re-points the value-bearing tokens, so it all swaps in one place.
   Legacy/poetic aliases (--ember, --char, --candle, --dust, --blue …) are kept
   and mapped onto the new tokens so existing view JS keeps working untouched.
   ========================================================================= */

/* =======================================================================
   1 · SHARED PRIMITIVES  (hue ramps, scale, motion — theme-independent)
   ======================================================================= */
:root {
  /* OnlyFans cyan ramp — the one signature */
  --cy-50:  #e8f8fe;
  --cy-100: #c9effd;
  --cy-200: #93defb;
  --cy-300: #57caf8;
  --cy-400: #1db8f3;
  --cy-500: #00aff0;   /* brand */
  --cy-600: #0094d4;
  --cy-700: #0077ae;
  --cy-800: #0a5e86;
  --cy-900: #0e4d6d;

  /* radius */
  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius:    13px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* layout metrics */
  --sidebar-w: 264px;
  --topbar-h:  64px;
  --content-w: 1240px;

  /* z-scale */
  --z-rail: 5;
  --z-topbar: 20;
  --z-drawer: 50;
  --z-pop: 80;
  --z-modal: 100;
  --z-toast: 200;

  /* motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --t-fast: .12s;
  --t: .18s;
  --t-slow: .32s;

  /* type */
  --font:         "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono:    "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  color-scheme: light;
}

/* =======================================================================
   2 · LIGHT THEME  (default)  — semantic tokens
   ======================================================================= */
:root {
  /* surfaces — cool near-white ladder */
  --bg:         #eef3f8;   /* page canvas */
  --surface:    #ffffff;   /* cards */
  --surface-2:  #f5f9fc;   /* hover / dropdown / raised */
  --surface-3:  #e9f1f8;   /* active wells / thumbs */
  --field:      #f7fafd;   /* inputs / tracks (subtly recessed) */
  --sidebar-bg: #ffffff;
  --topbar-bg:  rgba(255, 255, 255, .82);
  --hover-tint: rgba(8, 32, 52, .035);
  --scrim:      rgba(14, 30, 46, .42);

  /* text — deep cool slate */
  --text:       #0c1a26;
  --text-2:     #44586a;
  --text-3:     #566776;   /* AA on white/canvas/surface-2 (eyebrows, table headers, meta) */
  --text-muted: #5f7180;   /* AA on white/field/canvas (placeholders, chevron affordances) */

  /* lines */
  --border:         rgba(11, 36, 56, .10);
  --border-soft:    rgba(11, 36, 56, .055);
  --border-strong:  rgba(11, 36, 56, .16);
  --border-accent:  rgba(0, 175, 240, .42);
  --control-border: #8593a0;   /* form controls: ≥3:1 on white + field so empty fields read (AA UI) */

  /* accent — OnlyFans cyan */
  --accent:        #00aff0;
  --accent-2:      #1db8f3;   /* bright / hover */
  --accent-strong: #0094d4;   /* deep / gradient end */
  --accent-fg:     #042530;   /* ink that sits on a cyan fill (AA on bright cyan) */
  --accent-soft:   rgba(0, 175, 240, .12);
  --accent-soft-2: rgba(0, 175, 240, .18);
  --accent-line:   rgba(0, 175, 240, .42);
  --accent-ink:    #00688f;   /* readable cyan for text/links — AA on canvas + accent-soft fills */

  /* gold — the win, money, rank #1 */
  --gold:      #c89a2e;
  --gold-soft: rgba(200, 154, 46, .15);
  --gold-ink:  #7c5b10;

  /* categorical (stat tiles / charts) */
  --c-blue:    #4f7bf0;  --c-blue-soft:   rgba(79, 123, 240, .14);  --c-blue-ink:   #2e54bd;
  --c-violet:  #00aff0;  --c-violet-soft: rgba(0, 175, 240, .12);   --c-violet-ink: #00688f;

  /* semantics */
  --ok:   #16a34a;  --ok-soft:   rgba(22, 163, 74, .13);   --ok-ink:   #137334;
  --bad:  #e5484d;  --bad-soft:  rgba(229, 72, 77, .13);   --bad-ink:  #b22d33;
  --warn: #d97706;  --warn-soft: rgba(217, 119, 6, .14);   --warn-ink: #984607;

  /* depth — soft, present (light leans on shadow) */
  --shadow-sm: 0 1px 2px rgba(16, 42, 66, .06), 0 1px 1px rgba(16, 42, 66, .04);
  --shadow:    0 1px 3px rgba(16, 42, 66, .07), 0 10px 28px -14px rgba(16, 42, 66, .20);
  --shadow-lg: 0 24px 60px -18px rgba(16, 42, 66, .26), 0 8px 22px -12px rgba(16, 42, 66, .14);
  --ring:      0 0 0 3px rgba(0, 175, 240, .22), 0 0 0 1px rgba(0, 175, 240, .55);

  /* signature gradients */
  --charge: linear-gradient(90deg, #0a5e86 0%, #0094d4 42%, #00aff0 78%, #5bd0ff 100%);
  --accent-glow: radial-gradient(120% 130% at 30% 130%, #5bd0ff 0%, #00aff0 46%, #0077ae 100%);
  --grad-brand: linear-gradient(102deg, #00aff0 0%, #4f7bf0 100%);
  --ambient: radial-gradient(1100px 540px at 94% -12%, rgba(0, 175, 240, .07), transparent 60%);
}

/* =======================================================================
   3 · DARK THEME  — re-point value-bearing tokens
   ======================================================================= */
[data-theme="dark"] {
  --bg:         #0a1117;
  --surface:    #0f1820;
  --surface-2:  #16222d;
  --surface-3:  #1f303d;
  --field:      #090f14;
  --sidebar-bg: #0c141b;
  --topbar-bg:  rgba(11, 18, 24, .72);
  --hover-tint: rgba(180, 222, 247, .04);
  --scrim:      rgba(3, 8, 12, .70);

  --text:       #e9f2f8;
  --text-2:     #a6bac8;
  --text-3:     #738a9b;
  --text-muted: #6d8494;   /* AA on dark surface/field for placeholders & affordances */

  --border:         rgba(180, 222, 247, .10);
  --border-soft:    rgba(180, 222, 247, .055);
  --border-strong:  rgba(180, 222, 247, .17);
  --border-accent:  rgba(0, 175, 240, .44);
  --control-border: rgba(180, 222, 247, .42);   /* form controls: ≥3:1 resting edge on dark surfaces (AA UI) */

  --accent:        #14b5f2;
  --accent-2:      #4ecbff;
  --accent-strong: #0094d4;
  --accent-fg:     #04222e;
  --accent-soft:   rgba(0, 175, 240, .16);
  --accent-soft-2: rgba(0, 175, 240, .24);
  --accent-line:   rgba(0, 175, 240, .44);
  --accent-ink:    #5bd0ff;

  --gold:      #e3b94e;
  --gold-soft: rgba(227, 185, 78, .16);
  --gold-ink:  #e9c46a;

  --c-blue:    #7c8cff;  --c-blue-soft:   rgba(124, 140, 255, .16);  --c-blue-ink:   #9aa6ff;
  --c-violet:  #14b5f2;  --c-violet-soft: rgba(0, 175, 240, .16);    --c-violet-ink: #5bd0ff;

  --ok:   #4ade80;  --ok-soft:   rgba(74, 222, 128, .15);   --ok-ink:   #6ee7a0;
  --bad:  #f2776e;  --bad-soft:  rgba(242, 119, 110, .16);  --bad-ink:  #ff9a92;
  --warn: #f0b43e;  --warn-soft: rgba(240, 180, 62, .15);   --warn-ink: #f5c768;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .40);
  --shadow:    0 2px 6px rgba(0, 0, 0, .42), 0 16px 40px -18px rgba(0, 0, 0, .62);
  --shadow-lg: 0 30px 72px -20px rgba(0, 0, 0, .72), 0 10px 28px -14px rgba(0, 0, 0, .5);
  --ring:      0 0 0 3px rgba(0, 175, 240, .26), 0 0 0 1px rgba(0, 175, 240, .6);

  --charge: linear-gradient(90deg, #0a5e86 0%, #0094d4 40%, #16b6f3 75%, #7cdbff 100%);
  --accent-glow: radial-gradient(120% 130% at 30% 130%, #6fd6ff 0%, #00aff0 46%, #0a5e86 100%);
  --grad-brand: linear-gradient(102deg, #14b5f2 0%, #7c8cff 100%);
  --ambient: radial-gradient(1150px 560px at 92% -12%, rgba(0, 175, 240, .10), transparent 62%);

  color-scheme: dark;
}

/* =======================================================================
   4 · LEGACY / POETIC ALIASES  → map onto semantic tokens (JS depends on these)
   ======================================================================= */
:root {
  --ink: var(--bg);  --char: var(--surface);  --smoke: var(--surface-2);  --ash: var(--surface-3);  --sunken: var(--field);
  --candle: var(--text);  --taupe: var(--text-2);  --dust: var(--text-3);  --mute: var(--text-muted);
  --line: var(--border);  --line-soft: var(--border-soft);  --line-strong: var(--border-strong);  --line-hot: var(--border-accent);

  --ember: var(--accent);  --ember-hot: var(--accent-2);  --ember-deep: var(--accent-strong);
  --ember-soft: var(--accent-soft);  --ember-line: var(--accent-line);
  --brass: var(--gold);  --brass-soft: var(--gold-soft);
  --blush: var(--c-blue);  --blush-soft: var(--c-blue-soft);

  --bg-2: var(--field);  --text-dim: var(--text-2);  --text-faint: var(--text-3);
  --accent-grad: var(--accent);
  --heat: var(--charge);  --ember-glow: var(--accent-glow);

  --good: var(--ok);  --good-soft: var(--ok-soft);
  --green: var(--ok);  --green-soft: var(--ok-soft);
  --red: var(--bad);   --red-soft: var(--bad-soft);
  --amber: var(--warn);  --amber-soft: var(--warn-soft);
  --blue: var(--c-blue); --blue-soft: var(--c-blue-soft);
  --violet: var(--c-violet); --violet-soft: var(--c-violet-soft);
}

/* =======================================================================
   5 · BASE
   ======================================================================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image: var(--ambient);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
a { color: var(--accent-ink); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 {
  margin: 0; font-family: var(--font-display);
  font-weight: 600; letter-spacing: -0.018em; line-height: 1.12;
  font-optical-sizing: auto; color: var(--text);
}
img { max-width: 100%; }
::selection { background: var(--accent-soft-2); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 7px; }

/* recurring micro-label: tracked uppercase mono (the field-manual texture) */
.eyebrow, .nav-group-label, .stat .k, .q-num, table.tbl th, .quiz-card .qc-cat {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 500;
}

/* scrollbars */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 9px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* =======================================================================
   6 · APP SHELL
   ======================================================================= */
#app { min-height: 100%; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 14px 16px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--accent-glow);
  display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 700; color: #04222e; font-size: 20px; flex: none;
  box-shadow: 0 6px 18px -4px rgba(0, 175, 240, .5), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.brand .name { font-family: var(--font-display); font-weight: 600; font-size: 16.5px; letter-spacing: -0.02em; line-height: 1.05; color: var(--text); }
.brand .sub { font-size: 11px; color: var(--text-3); margin-top: 2px; font-family: var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }

.nav-group-label { font-size: 10px; color: var(--text-3); padding: 16px 10px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-weight: 550; font-size: 14px; position: relative;
  border: 1px solid transparent; transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--hover-tint); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft-2); color: var(--accent-ink);
  border-color: transparent; font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item .ico { width: 18px; display: inline-flex; align-items: center; justify-content: center; opacity: .92; }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; border-bottom: 1px solid var(--border); background: var(--topbar-bg);
  backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4);
  position: sticky; top: 0; z-index: var(--z-topbar);
}
.topbar .page-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.content { padding: 30px 28px 56px; max-width: var(--content-w); width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 31px; letter-spacing: -0.026em; }
.page-head p { color: var(--text-2); margin: 7px 0 0; font-size: 14.5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* theme toggle */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  display: grid; place-items: center; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.theme-toggle:hover { background: var(--surface-3); color: var(--accent); border-color: var(--border-strong); }
.theme-toggle .ic-svg { width: 18px; height: 18px; }

/* user menu */
.usermenu { position: relative; }
.usermenu .who { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px 8px 5px 5px; border-radius: 11px; transition: background var(--t-fast); }
.usermenu .who:hover { background: var(--surface-2); }
.avatar { width: 33px; height: 33px; border-radius: 50%; background: var(--accent-glow);
  display: grid; place-items: center; color: #04222e; font-weight: 700; font-size: 13px; flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.usermenu .meta { line-height: 1.18; }
.usermenu .meta .nm { font-size: 13.5px; font-weight: 600; color: var(--text); }
.usermenu .meta .rl { font-size: 11px; color: var(--text-3); }
.dropdown {
  position: absolute; right: 0; top: 48px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; z-index: var(--z-drawer);
}
.dropdown .item { padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--text-2);
  display: flex; align-items: center; gap: 10px; transition: background var(--t-fast), color var(--t-fast); }
.dropdown .item:hover { background: var(--surface-2); color: var(--text); }
.dropdown .item .ic-svg { width: 16px; height: 16px; opacity: .9; }
.hidden { display: none !important; }

/* =======================================================================
   7 · CARDS / GRID / STATS
   ======================================================================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: 16px; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); }
.grid > * { min-width: 0; }   /* safety: long content never forces horizontal page scroll */

/* dark: a glassy top-edge highlight reads as real elevation (dark shadows barely register) */
[data-theme="dark"] .card,
[data-theme="dark"] .stat { border-color: var(--border-strong); box-shadow: var(--shadow), inset 0 1px 0 rgba(180, 222, 247, .05); }

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 18px 17px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
/* a quiet color identity at rest — the tile's metric color as a left edge marker */
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--bar, var(--accent)); }
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat .k { font-size: 10.5px; color: var(--text-3); }
.stat .v { font-family: var(--font-display); font-size: 40px; font-weight: 600; margin-top: 5px; letter-spacing: -0.032em; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.05; }
.stat .v small { font-family: var(--font); font-size: 14px; color: var(--text-2); font-weight: 500; letter-spacing: 0; }
.stat .ico-badge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }

/* =======================================================================
   8 · BUTTONS
   ======================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13.5px;
  cursor: pointer; font-family: inherit; transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform .05s;
  white-space: nowrap; line-height: 1;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); border: 1px solid var(--accent-strong); color: var(--accent-fg);
  box-shadow: 0 1px 2px rgba(0, 42, 64, .12), inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 2px 10px -3px rgba(0, 175, 240, .5); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { background: transparent; }
.btn-danger { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 34%, transparent); color: var(--bad-ink); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 20%, transparent); }
.btn-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 34%, transparent); color: var(--ok-ink); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

/* =======================================================================
   9 · FORMS
   ======================================================================= */
.field { margin-bottom: 15px; }
.form-col { display: flex; flex-direction: column; gap: 4px; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.label .req { color: var(--accent); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; background: var(--field); border: 1px solid var(--control-border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.textarea { resize: vertical; min-height: 76px; }
.select { appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%2300aff0' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.field-error { color: var(--bad-ink); font-size: 12.5px; margin-top: 6px; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }

/* =======================================================================
   10 · BADGES / PILLS / TAGS
   ======================================================================= */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; border: 1px solid transparent; line-height: 1.4; }
.badge.green  { background: var(--ok-soft);   color: var(--ok-ink); }
.badge.red    { background: var(--bad-soft);  color: var(--bad-ink); }
.badge.amber  { background: var(--warn-soft); color: var(--warn-ink); }
.badge.blue   { background: var(--c-blue-soft); color: var(--c-blue-ink); }
.badge.violet { background: var(--accent-soft); color: var(--accent-ink); }
.badge.gold   { background: var(--gold-soft); color: var(--gold-ink); }
.badge.gray   { background: var(--surface-3); color: var(--text-2); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag { font-size: 11px; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 7px; font-weight: 600; }

/* =======================================================================
   11 · TABLES
   ======================================================================= */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 10.5px;
  color: var(--text-3); font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background var(--t-fast), box-shadow var(--t-fast); }
table.tbl tbody tr:hover { background: var(--hover-tint); box-shadow: inset 2px 0 0 var(--accent-line); }
table.tbl td.num, table.tbl th.num { text-align: right; }
table.tbl .muted { color: var(--text-3); }
/* leaderboard: rank #1 is the gold "win" moment */
table.tbl tr.is-rank1 { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
table.tbl tr.is-rank1:hover { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.clickable { cursor: pointer; }

/* =======================================================================
   12 · PROGRESS  (the charge — it brightens as it fills)
   ======================================================================= */
.progress { position: relative; height: 8px; background: var(--field); border-radius: 999px; overflow: hidden; border: 1px solid var(--border-soft); }
.progress::before { content: ""; position: absolute; inset: 0; background: var(--charge); opacity: .10; }
.progress > span { position: relative; display: block; height: 100%; background: var(--charge);
  border-radius: 999px; transition: width .5s var(--ease-out); box-shadow: 0 0 12px -2px rgba(0, 175, 240, .55); }
.progress.green > span { background: var(--ok); box-shadow: none; }
.progress.red > span { background: var(--bad); box-shadow: none; }

/* =======================================================================
   13 · TABS
   ======================================================================= */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab { padding: 10px 14px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--t-fast); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-ink); border-color: var(--accent); }

/* =======================================================================
   14 · MODAL
   ======================================================================= */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(5px);
  display: grid; place-items: center; z-index: var(--z-modal); padding: 24px; animation: fade .14s ease; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; animation: pop .16s var(--ease-out); }
.modal.lg { max-width: 780px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.x-btn { cursor: pointer; color: var(--text-3); font-size: 22px; line-height: 1; padding: 2px 7px; border-radius: 7px; transition: background var(--t-fast), color var(--t-fast); }
.x-btn:hover { background: var(--surface-3); color: var(--text); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* =======================================================================
   15 · TOAST
   ======================================================================= */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: var(--z-toast); }
.toast { background: var(--surface); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: 11px; padding: 12px 16px; box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px;
  font-size: 14px; animation: slidein .2s var(--ease-out); }
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--bad); }
.toast .t-title { font-weight: 650; margin-bottom: 2px; color: var(--text); }
.toast .t-msg { color: var(--text-2); font-size: 13px; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* =======================================================================
   16 · AUTH  (split-screen)
   ======================================================================= */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 620px at 14% 2%, rgba(0, 175, 240, .30), transparent 56%),
    radial-gradient(820px 600px at 98% 102%, rgba(0, 148, 212, .16), transparent 52%),
    var(--surface);
  border-right: 1px solid var(--border); padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
/* a faint engineered dot-grid, masked toward the top-left, so the panel never reads empty */
.auth-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(130% 95% at 10% 6%, #000 0%, transparent 60%);
  mask-image: radial-gradient(130% 95% at 10% 6%, #000 0%, transparent 60%);
  opacity: .5;
}
.auth-art > * { position: relative; z-index: 1; }
[data-theme="dark"] .auth-art { background:
    radial-gradient(1100px 620px at 14% 2%, rgba(0, 175, 240, .24), transparent 58%),
    radial-gradient(820px 600px at 98% 102%, rgba(0, 148, 212, .18), transparent 54%),
    var(--field); }
.auth-art .big { font-family: var(--font-display); font-size: 45px; font-weight: 600; letter-spacing: -0.028em; line-height: 1.04; max-width: 480px; color: var(--text); }
.auth-art .big .grad, .grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art .lede { color: var(--text-2); margin-top: 18px; max-width: 430px; font-size: 15.5px; }
.auth-feat { display: flex; flex-direction: column; gap: 14px; margin-top: 32px; }
.auth-feat .f { display: flex; gap: 12px; align-items: flex-start; }
.auth-feat .f .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); border: 1px solid var(--accent-line); display: grid; place-items: center; flex: none; }
.auth-feat .f .ic .ic-svg { width: 16px; height: 16px; color: var(--accent-ink); }
.auth-form-side { display: grid; place-items: center; padding: 40px; position: relative; }
.auth-card { width: 100%; max-width: 392px; }
.auth-card .brand { padding-left: 0; padding-right: 0; }
.auth-card h2 { font-size: 27px; margin-bottom: 6px; }
.auth-card .muted { color: var(--text-2); margin-bottom: 24px; font-size: 14px; }
.auth-toggle { position: absolute; top: 22px; right: 22px; }
@media (max-width: 900px) { .auth-art { display: none; } .auth-wrap { grid-template-columns: 1fr; } }

/* =======================================================================
   17 · QUIZ CARDS / RUNNER / RESULT
   ======================================================================= */
.quiz-card { display: flex; flex-direction: column; gap: 0; overflow: hidden; transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast); }
.quiz-card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.quiz-card .qc-body { padding: 18px; flex: 1; }
.quiz-card .qc-cat { font-size: 10.5px; color: var(--accent-ink); }
.quiz-card h3 { font-size: 17px; margin: 9px 0 6px; }
.quiz-card .desc { color: var(--text-2); font-size: 13.5px; min-height: 38px; }
.quiz-card .qc-meta { display: flex; gap: 14px; color: var(--text-3); font-size: 12.5px; margin-top: 12px; flex-wrap: wrap; }
.quiz-card .qc-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); }

.runner { max-width: 760px; margin: 0 auto; }
.runner-top { position: sticky; top: var(--topbar-h); background: var(--bg); padding: 12px 0 16px; z-index: var(--z-rail); }
.q-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; transition: border-color var(--t-fast), box-shadow var(--t-fast); box-shadow: var(--shadow-sm); }
.q-block:focus-within { border-color: var(--border-strong); }
.q-num { font-size: 10.5px; color: var(--text-3); }
.q-text { font-size: 18px; font-weight: 600; margin: 10px 0 18px; line-height: 1.45; color: var(--text); }
.opt {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 10px; transition: border-color var(--t-fast), background var(--t-fast); background: var(--field);
}
.opt:hover { border-color: var(--accent-line); background: var(--surface-2); }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; transition: border-color var(--t-fast), background var(--t-fast); }
.opt.multi .mark { border-radius: 6px; }
.opt.selected .mark { border-color: var(--accent); background: var(--accent); }
.opt.selected .mark::after { content: "✓"; color: var(--accent-fg); font-size: 13px; font-weight: 800; }
.opt .otext { font-size: 14.5px; color: var(--text); }

/* result screen — the close. it glows when you land it. */
.result-hero { text-align: center; padding: 32px 20px; }
.result-ring { width: 156px; height: 156px; border-radius: 50%; margin: 0 auto 20px; display: grid; place-items: center;
  background: conic-gradient(var(--ring-color, var(--accent)) calc(var(--pct, 0) * 1%), var(--surface-3) 0); position: relative; }
.result-ring.hot { box-shadow: 0 0 44px -6px rgba(0, 175, 240, .5); }
.result-ring::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); }
.result-ring .rv { position: relative; font-family: var(--font-display); font-size: 38px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.result-ring .rl { position: relative; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); letter-spacing: .04em; }

/* =======================================================================
   18 · MISC / UTILITIES
   ======================================================================= */
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .ico { font-size: 40px; opacity: .55; margin-bottom: 12px; display: grid; place-items: center; }
.empty .ico .ic-svg { width: 36px; height: 36px; }
.empty h3 { color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--text-3); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--font-mono); font-size: 12.5px; }
.kbd { font-family: var(--font-mono); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 12px; border: 1px solid var(--border); }
.text-dim { color: var(--text-2); }
.text-faint { color: var(--text-3); }
.text-green { color: var(--ok-ink); } .text-red { color: var(--bad-ink); }
.muted { color: var(--text-3); }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}

/* icons — one set, monochrome, inherits currentColor */
.icon-inline { display: inline-flex; align-items: center; vertical-align: middle; }
.ic-svg { display: block; flex: none; }
.btn .ic-svg { width: 15px; height: 15px; }
.btn-icon .ic-svg { width: 16px; height: 16px; }
.nav-item .ico .ic-svg { width: 18px; height: 18px; }
.ico-badge .ic-svg { width: 18px; height: 18px; }
.qc-meta .ic-svg { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; opacity: .75; margin-right: 3px; }
.hamburger .ic-svg { width: 18px; height: 18px; }

/* rank badges (leaderboard) — gold is the win */
.rankbadge { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 50%;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.rankbadge.r1 { width: 31px; height: 31px; font-size: 13px; background: var(--gold); color: #2a1e05; box-shadow: 0 6px 16px -6px var(--gold); }
.rankbadge.r2 { background: var(--gold-soft); color: var(--gold-ink); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.rankbadge.r3 { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); }

/* general icon badge */
.ico-badge { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; }

/* =======================================================================
   19 · COURSES
   ======================================================================= */
.course-card { cursor: pointer; }
.course-card-top { height: 100px; display: grid; place-items: center; color: var(--accent-ink);
  background: radial-gradient(120% 140% at 30% 130%, var(--accent-soft) 0%, transparent 70%), var(--field);
  border-bottom: 1px solid var(--border); }
.course-card-top .ic-svg { width: 30px; height: 30px; }
.course-card .qc-foot { gap: 10px; }

.course-hero h1 { font-size: 27px; letter-spacing: -0.024em; }
.course-hero-pct { font-family: var(--font-display); font-size: 44px; font-weight: 600; line-height: 1;
  letter-spacing: -0.02em; color: var(--accent-ink); font-variant-numeric: tabular-nums; }

.section-block { overflow: hidden; }
.section-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.section-badge { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.section-badge.done { background: var(--accent); color: var(--accent-fg); }
.section-badge.done .ic-svg { width: 18px; height: 18px; }
.section-head h3 { font-size: 16.5px; }
.section-head.clickable-head { cursor: pointer; user-select: none; transition: background var(--t-fast); }
.section-head.clickable-head:hover { background: var(--surface-2); }
.section-toggle { color: var(--text-3); flex: none; display: grid; place-items: center; align-self: center; transition: transform .25s var(--ease); }
.section-toggle .ic-svg { width: 18px; height: 18px; }
.section-block.collapsed .section-toggle { transform: rotate(-90deg); }
.section-block.collapsed .section-head { border-bottom: 0; }
.section-body { overflow: hidden; max-height: 1800px; opacity: 1; transition: max-height var(--t-slow) var(--ease), opacity .25s var(--ease); }
.section-block.collapsed .section-body { max-height: 0; opacity: 0; }

.lesson-list { padding: 6px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; cursor: pointer; transition: background var(--t-fast); }
.lesson-row:hover { background: var(--surface-2); }
.lesson-check { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); color: var(--accent); }
.lesson-row.completed .lesson-check { background: var(--accent-soft); border-color: var(--accent-line); }
.lesson-check .ic-svg { width: 13px; height: 13px; }
.lesson-title { flex: 1; font-size: 14.5px; font-weight: 500; color: var(--text); }
.lesson-row.completed .lesson-title { color: var(--text-2); }
.lesson-go { color: var(--text-muted); display: grid; transform: rotate(-90deg); }
.lesson-go .ic-svg { width: 16px; height: 16px; }
.lesson-row:hover .lesson-go { color: var(--accent); }

.section-quiz { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 20px; border-top: 1px solid var(--border); background: var(--field); flex-wrap: wrap; }
.section-quiz.clickable { transition: background var(--t-fast); }
.section-quiz.clickable:hover { background: var(--surface-3); }
.quiz-badge { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); }
.quiz-badge.passed { background: var(--ok-soft); color: var(--ok-ink); }
.quiz-badge .ic-svg { width: 17px; height: 17px; }

/* =======================================================================
   20 · LESSON READER
   ======================================================================= */
.reader { max-width: 760px; margin: 0 auto; }
.lesson-body { font-size: 15.5px; line-height: 1.75; color: var(--text-2); }
.lesson-body > *:first-child { margin-top: 0; }
.lb-h { font-family: var(--font-display); color: var(--text); letter-spacing: -0.012em; line-height: 1.3; margin: 32px 0 12px; }
h2.lb-h { font-size: 23px; } h3.lb-h { font-size: 19px; } h4.lb-h { font-size: 16.5px; }
.lb-p { margin: 0 0 16px; }
.lb-p strong { color: var(--text); font-weight: 650; }
.lesson-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.lb-list { margin: 0 0 16px; padding-left: 22px; }
.lb-list li { margin: 6px 0; }
.lb-list li::marker { color: var(--accent); }
.lb-figure { margin: 22px 0; text-align: center; }
.lb-img { display: inline-block; max-width: 100%; max-height: 68vh; width: auto; height: auto;
  border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow);
  cursor: zoom-in; transition: transform .22s var(--ease), box-shadow .22s var(--ease); vertical-align: middle; }
.lb-img:hover { transform: translateY(-2px) scale(1.005); box-shadow: var(--shadow-lg); }
.lb-video { width: 100%; max-height: 68vh; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: #000; }
.lb-figure figcaption { font-size: 12.5px; color: var(--text-3); margin-top: 10px; font-style: italic; }
.lb-embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 22px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.lb-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lb-hr { border: 0; height: 1px; margin: 30px 0; background: linear-gradient(90deg, transparent, var(--border-strong) 22%, var(--border-strong) 78%, transparent); }

@keyframes lbRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
.reader { animation: lbFade .3s ease both; }
.lesson-body > * { animation: lbRise .5s var(--ease-out) both; animation-delay: .08s; }
.lesson-body > *:nth-child(1) { animation-delay: .04s; }
.lesson-body > *:nth-child(2) { animation-delay: .09s; }
.lesson-body > *:nth-child(3) { animation-delay: .14s; }
.lesson-body > *:nth-child(4) { animation-delay: .19s; }
.lesson-body > *:nth-child(5) { animation-delay: .24s; }
.lesson-body > *:nth-child(6) { animation-delay: .29s; }
.lesson-body h2.lb-h + .lb-p, .lesson-body h3.lb-h + .lb-p { margin-top: 0; }
.lesson-body > p.lb-p:first-of-type { font-size: 16.5px; color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.lb-resource { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 10px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color var(--t-fast), background var(--t-fast); }
.lb-resource:hover { border-color: var(--accent-line); background: var(--surface-2); }
.lb-resource-ico { width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); }
.lb-resource-ico .ic-svg { width: 19px; height: 19px; }
.lb-resource-body { flex: 1; min-width: 0; }
.lb-resource-label { color: var(--text); font-weight: 600; font-size: 14.5px; }
.lb-resource-host { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.lb-resource-go { color: var(--text-muted); transform: rotate(-90deg); display: grid; }
.lb-resource:hover .lb-resource-go { color: var(--accent); }

.reader-actions { margin-top: 26px; }
.quiz-nudge { border-color: var(--accent-line); }
.open-answer { min-height: 96px; resize: vertical; font-family: var(--font); line-height: 1.6; }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(4, 10, 16, .88); display: grid; place-items: center;
  padding: 32px; cursor: zoom-out; backdrop-filter: blur(4px); }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); box-shadow: var(--shadow-lg); }

/* reader flow polish */
.lesson-body > p.lb-p:first-child { font-size: 18px; line-height: 1.66; color: var(--text); margin: 0 0 26px; }
.lb-quote { margin: 22px 0; padding: 15px 20px; border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 68%), var(--surface-2);
  border-radius: 0 12px 12px 0; color: var(--text); font-size: 15px; line-height: 1.6; }
.lb-quote strong, .lb-quote b { color: var(--accent-ink); }
.lb-quote p { margin: 0; }
.lb-quote figure, .lb-quote blockquote { margin: 0; padding: 0; border: 0; background: none; }
.lesson-body .lb-p strong, .lesson-body .lb-list strong { color: var(--text); font-weight: 680; }
.lesson-body .lb-figure { margin: 26px 0; }
.lesson-body .lb-figure + .lb-figure { margin-top: 16px; }
.lesson-body h2.lb-h { margin-top: 38px; }
.lesson-body h3.lb-h { margin-top: 30px; }
.lesson-body > *:first-child.lb-h { margin-top: 0; }

/* =======================================================================
   21 · GROUPS / PICKERS / CMS BLOCK EDITOR
   ======================================================================= */
.group-card { cursor: pointer; transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast); }
.group-card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.pick-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--field); }
.pick-row { display: flex; gap: 11px; align-items: center; padding: 10px 13px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.pick-label { font-size: 14px; color: var(--text); }
.pick-sub { font-size: 12px; color: var(--text-3); }

.be-addbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 14px; position: sticky; top: var(--topbar-h); z-index: var(--z-rail); box-shadow: var(--shadow-sm); }
.block-editor { display: flex; flex-direction: column; gap: 12px; }
.be-block { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.be-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; background: var(--field); border-bottom: 1px solid var(--border); }
.be-type { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.be-body { padding: 14px; }

.flagged-row { background: var(--bad-soft); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--hover-tint); }

/* =======================================================================
   22 · NOTION-STYLE INLINE LESSON EDITOR
   ======================================================================= */
.le-top { max-width: 780px; margin: 0 auto 10px; }
.le-title { width: 100%; background: transparent; border: 0; color: var(--text);
  font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; padding: 4px 0; }
.le-title:focus { outline: none; box-shadow: none; }
.le-title::placeholder { color: var(--text-muted); }
.le-foot { max-width: 780px; margin: 18px auto 60px; display: flex; align-items: center; justify-content: space-between; }

.lesson-editor { max-width: 780px; margin: 0 auto; font-size: 15.5px; line-height: 1.75; color: var(--text-2); }
.eb { position: relative; border-radius: 7px; transition: background var(--t-fast); }
.eb:hover { background: var(--hover-tint); }
.eb > .lb-h, .eb > .lb-p, .eb > .lb-quote, .eb > .lb-list, .eb > .lb-figure, .eb > .lb-resource, .eb > .lb-hr { margin-left: 0; margin-right: 0; }
.lesson-editor [contenteditable] { outline: none; }
.lesson-editor [contenteditable]:empty::before,
.lesson-editor li[contenteditable]:empty::before { content: attr(data-ph); color: var(--text-muted); pointer-events: none; }
.lesson-editor .lb-list li { outline: none; }

.eb-gutter { position: absolute; left: -46px; top: 2px; display: flex; gap: 2px; opacity: 0; transition: opacity var(--t-fast); }
.eb:hover .eb-gutter, .eb:focus-within .eb-gutter { opacity: 1; }
.eb-h { width: 22px; height: 24px; display: grid; place-items: center; border: 0; background: transparent;
  color: var(--text-3); border-radius: 6px; cursor: pointer; }
.eb-h:hover { background: var(--surface-2); color: var(--text); }
.eb-h svg { width: 15px; height: 16px; }

.le-pop { position: fixed; z-index: var(--z-pop); min-width: 212px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 6px; }
.le-pop-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.le-pop-item:hover { background: var(--surface-2); }
.le-pop-item.danger { color: var(--bad-ink); }
.le-pop-ico { width: 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.le-pop-sep { height: 1px; background: var(--border); margin: 5px 4px; }

.le-seltoolbar { position: fixed; z-index: 85; display: none; gap: 2px; padding: 4px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); }
.le-seltoolbar.show { display: flex; }
.le-stb { min-width: 30px; height: 28px; padding: 0 8px; border: 0; background: transparent; color: var(--text);
  border-radius: 7px; cursor: pointer; font-size: 14px; }
.le-stb:hover { background: var(--surface-2); color: var(--accent-ink); }
.le-stb.b { font-weight: 800; } .le-stb.i { font-style: italic; font-family: var(--font-display); }

.eb-media { position: relative; }
.eb-imgph { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 34px;
  text-align: center; color: var(--text-3); cursor: pointer; font-size: 13.5px; background: var(--field); }
.eb-imgph:hover { border-color: var(--accent-line); color: var(--text); }
.eb-mtool { margin-top: 8px; opacity: 0; transition: opacity var(--t-fast); }
.eb-media:hover .eb-mtool { opacity: 1; }
.eb-resource { cursor: default; }
.eb-resource .lb-resource-label { outline: none; min-width: 60px; }

/* =======================================================================
   23 · RESPONSIVE  /  MOBILE DRAWER
   ======================================================================= */
.hamburger { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 18px; cursor: pointer; place-items: center; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-drawer); }

@media (max-width: 1024px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: min(var(--sidebar-w), 86vw); z-index: calc(var(--z-drawer) + 1);
    transform: translateX(-105%); transition: transform .22s var(--ease); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-backdrop.show { display: block; }
  .hamburger { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-4 { grid-template-columns: 1fr 1fr; }   /* KPIs as compact 2-up tiles, not banners */
  .auth-form-side { padding: 64px 24px 24px; }        /* clear the absolute theme toggle */
  .section-quiz { align-items: stretch; }
  .course-hero .row { flex-direction: column; align-items: flex-start !important; }
  .be-addbar { position: static; }
  .eb-gutter { left: -30px; }
  .lesson-editor, .le-top, .le-foot { max-width: 100%; }

  /* touch targets ≥ 44px for the most-tapped controls (one-handed all-day use) */
  .hamburger, .theme-toggle { width: 44px; height: 44px; }
  .nav-item { padding: 12px 11px; }
  .btn-icon { width: 40px; height: 40px; }
  .x-btn { padding: 8px 12px; }
  .btn-sm { padding: 8px 12px; min-height: 40px; }
  /* let dense in-table action rows wrap instead of forcing horizontal scroll */
  .tbl td .row { flex-wrap: wrap; justify-content: flex-end; }
  .tbl td .muted { max-width: 60vw !important; }   /* override inline desc width on phones */
}

/* ===== Multi-tenant additions (Supabase rebuild) ===== */
.lock-banner{display:flex;align-items:center;gap:10px;padding:10px 16px;background:#7a1f1f;color:#fff;font-size:13.5px;font-weight:600}
.lock-banner .btn{background:#fff;color:#7a1f1f;border:none}
.pricing-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px;margin-top:18px}
.pricing-card{text-align:center}
.pricing-name{font-weight:700;font-size:16px}
.pricing-price{font-size:30px;font-weight:800;margin:6px 0}
.pricing-price span{font-size:14px;font-weight:500}

/* ===== Super-admin console ===== */

/* Topbar workspace chip — makes the active tenant unambiguous */
.ws-chip { display:flex; align-items:center; gap:9px; padding:5px 12px 5px 11px; border:1px solid var(--border); border-radius:999px; background:var(--surface-2); max-width:240px; }
.ws-chip .icon-inline { color:var(--accent); display:flex; }
.ws-chip-text { display:flex; flex-direction:column; line-height:1.15; min-width:0; }
.ws-chip-label { font-size:9px; letter-spacing:.09em; text-transform:uppercase; color:var(--text-3); font-weight:700; }
.ws-chip-name { font-size:13px; font-weight:650; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ws-chip-select select.ws-switch { border:none; background:transparent; padding:0; margin:0; font-size:13px; font-weight:650; color:var(--text); max-width:160px; cursor:pointer; }
.ws-switch:focus { outline:none; }
.super-link { gap:6px; }

/* Toolbar + filter chips */
.admin-toolbar { margin-bottom:16px; gap:12px; align-items:center; }
.filter-chips { display:flex; gap:6px; flex-wrap:wrap; }
.chip { padding:6px 13px; border-radius:999px; border:1px solid var(--border); background:var(--surface); color:var(--text-2); font-size:13px; font-weight:600; cursor:pointer; transition:background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.chip:hover { background:var(--surface-2); color:var(--text); }
.chip.active { background:var(--accent-soft); color:var(--accent-ink); border-color:var(--accent-line); }

/* Table cells */
.ws-cell-name { font-weight:650; }
.cell-sub { font-size:12px; color:var(--text-3); margin-top:2px; }
.seat-cell { display:flex; flex-direction:column; gap:5px; min-width:64px; }
.seat-bar { height:4px; border-radius:999px; background:var(--surface-3); overflow:hidden; }
.seat-bar-fill { height:100%; background:var(--accent); border-radius:999px; }
.text-amber { color:var(--warn-ink); }

/* Slide-over detail drawer */
.drawer-overlay { position:fixed; inset:0; background:var(--scrim); backdrop-filter:blur(5px); z-index:var(--z-modal); display:flex; justify-content:flex-end; opacity:0; transition:opacity var(--t) var(--ease); }
.drawer-overlay.show { opacity:1; }
.drawer { width:min(560px, 100%); height:100%; background:var(--surface); border-left:1px solid var(--border); box-shadow:var(--shadow-lg); display:flex; flex-direction:column; transform:translateX(28px); transition:transform var(--t) var(--ease-out); }
.drawer-overlay.show .drawer { transform:translateX(0); }
.drawer-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:20px 22px; border-bottom:1px solid var(--border); flex:none; }
.drawer-head h3 { font-size:18px; letter-spacing:-0.02em; }
.drawer-sub { font-size:12.5px; color:var(--text-3); margin-top:3px; font-family:var(--font-mono); }
.drawer-body { padding:20px 22px 40px; overflow-y:auto; }
.drawer-sections { display:flex; flex-direction:column; gap:22px; }
.drawer-section-head { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.drawer-section-head .icon-inline { color:var(--accent); display:flex; }
.drawer-section-head h4 { font-size:12px; letter-spacing:.05em; text-transform:uppercase; color:var(--text-3); font-weight:700; }
.drawer-section.danger .drawer-section-head .icon-inline { color:var(--bad); }
.drawer-section.danger .drawer-section-head h4 { color:var(--bad-ink); }

/* key/value rows */
.kv { display:flex; flex-direction:column; gap:1px; border:1px solid var(--border-soft); border-radius:var(--radius-sm); overflow:hidden; }
.kv-row { display:flex; justify-content:space-between; gap:14px; padding:9px 13px; background:var(--surface-2); font-size:13.5px; }
.kv-k { color:var(--text-3); }
.kv-v { color:var(--text); font-weight:600; text-align:right; }

/* form grid (drawer + modals) */
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field-l { display:flex; flex-direction:column; gap:5px; }
.field-l > span { font-size:11px; letter-spacing:.04em; text-transform:uppercase; color:var(--text-3); font-weight:700; }
.field-l .input { width:100%; }

/* member / invite lists */
.member-list { display:flex; flex-direction:column; }
.member-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--border-soft); font-size:13.5px; }
.member-row:last-child { border-bottom:none; }

/* audit timeline */
.audit-list { display:flex; flex-direction:column; gap:2px; }
.audit-row { display:flex; gap:11px; padding:8px 0; font-size:13.5px; }
.audit-dot { width:7px; height:7px; border-radius:50%; background:var(--accent); margin-top:6px; flex:none; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns:1fr; }
  .drawer { width:100%; border-left:none; }
  .admin-toolbar { flex-direction:column; align-items:stretch; }
  .admin-toolbar .input { max-width:none !important; }
}
