/* ==========================================================================
   TCC themes: Onyx (black and gold) and Emerald (emerald and gold).
   Loaded after member/app.css (and desk/desk.css) on every page after sign-in.

   Linen is the base look in member/app.css (November 2026 redesign) and needs nothing here.
   The dark themes re-point that file's variables, so its rules serve all three; what is left
   below are the few places that need a different hand on a dark ground, and the desk.

   Set by /shared/theme.js: <html data-theme="onyx|emerald" class="theme-dark">.
   Grain: /assets/app/grain.png at 8% with a screen blend, over the glows, under the content.
   ========================================================================== */

/* ---- 1. tokens ----------------------------------------------------------- */
html[data-theme="onyx"] {
  --bg:            #0F0D0B;
  --surface:       #1A1612;
  --surface-sunk:  #13110E;
  --line:          rgba(241,235,224,.08);
  --line-strong:   rgba(214,178,122,.24);
  --ink:           #F1EBE0;
  --ink-2:         #CFC6B8;
  --muted:         #A1988C;
  --plate-bg:      linear-gradient(180deg, #1D1915, #15120F);
  --side:          rgba(29,25,21,.86);
  --page-glow:     radial-gradient(120% 60% at 50% -10%, rgba(201,162,106,.14), transparent 60%), linear-gradient(180deg, #1A1612 0%, #0F0D0B 45%, #0B0A08 100%);
  --topbar-bg:     rgba(20,17,14,.78);
  --glass-bg:      rgba(38,32,26,.62);
  --card-base:     linear-gradient(155deg, #2A2520 0%, #16130F 46%, #0B0A08 100%);
  --card-inner:    rgba(11,10,8,.9);
}
html[data-theme="emerald"] {
  --bg:            #040C09;
  --surface:       #0B1D17;
  --surface-sunk:  #07140F;
  --line:          rgba(214,178,122,.09);
  --line-strong:   rgba(214,178,122,.24);
  --ink:           #EEF3EF;
  --ink-2:         #C6D1CB;
  --muted:         #93A69D;
  --plate-bg:      linear-gradient(180deg, #0C201A, #071510);
  --side:          rgba(12,32,26,.86);
  --page-glow:     radial-gradient(120% 55% at 50% -8%, rgba(63,191,154,.17), transparent 62%), radial-gradient(120% 50% at 50% 108%, rgba(16,70,50,.45), transparent 62%);
  --topbar-bg:     rgba(6,18,14,.78);
  --glass-bg:      rgba(14,40,33,.58);
  --card-base:     radial-gradient(90% 80% at 15% 0%, rgba(80,190,150,.18) 0%, transparent 55%), linear-gradient(155deg, #1A4A3B 0%, #0D2D23 46%, #051510 100%);
  --card-inner:    rgba(5,21,16,.92);
}
/* Shared by both dark themes: the gold is identical. */
html.theme-dark {
  color-scheme: dark;
  --g1: #F4E6C3; --g2: #D4B27A; --g3: #9C7A43;
  --soft: rgba(212,178,122,.10);
  --rule2: rgba(241,235,224,.05);
  --gold:      #E2C48E;
  --gold-deep: #D4B27A;
  --gold-tint: rgba(212,178,122,.12);
  --gold-rim:  linear-gradient(135deg, #F4E6C3, #9C7A43);
  --gold-fill: linear-gradient(145deg, #F1DDB0, #C9A26A 55%, #9C7A43);
  --obsidian:  #0B0A08;
  --ok: #8FCB9B;  --ok-tint: rgba(143,203,155,.08);
  --warn: #E3B26E; --warn-tint: rgba(212,178,122,.10);
  --stop: #EBA79F; --stop-tint: rgba(208,103,95,.10);
  --shadow: none;
  --shadow-lift: 0 24px 60px rgba(0,0,0,.55);
  --menu-shadow: 0 24px 60px rgba(0,0,0,.55);
  --scrim: rgba(0,0,0,.55);
  --plate-border: 1px solid rgba(214,178,122,.10);
  --plate-shadow: inset 0 1px 0 rgba(214,178,122,.28), 0 18px 40px rgba(0,0,0,.35);
  --track: rgba(241,235,224,.06);
  --orn: rgba(214,178,122,.11);
  --pri-bg: linear-gradient(145deg, #F1DDB0, #C9A26A 55%, #9C7A43);
  --pri-fg: #15110C;
  --pri-shadow: 0 14px 32px rgba(201,162,106,.26);
  --tile-bg: rgba(212,178,122,.12);
  --tile-fg: #E2C48E;
  --glass-border: rgba(214,178,122,.16);
  --glass-shadow: 0 20px 44px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,236,200,.10);
  --nav-on: #E2C48E;
  --nav-off: rgba(241,235,224,.58);
  --nav-pill: rgba(212,178,122,.14);
  --grain-opacity: .08;
  --card-fg: #EADBB8;
  --card-sheen: rgba(246,231,196,.10);
  --card-eng: rgba(217,185,127,.16);
  --card-eng2: rgba(217,185,127,.07);
  --card-brush: rgba(255,255,255,.022);
  --card-rim: rgba(217,185,127,.45);
  --card-rim2: rgba(217,185,127,.22);
  --card-shadow: 0 28px 56px rgba(0,0,0,.6);
  --card-num: linear-gradient(180deg, #F6E7C4 0%, #D9B97F 55%, #A88246 100%);
  --card-name: #CDB98F;
  --card-emboss: 0 1px 0 rgba(0,0,0,.65), 0 -1px 0 rgba(255,236,200,.12);
  --card-logo: url("/assets/tcc-mark-light.svg");
  background: var(--bg);
}

/* ---- 2. what a dark ground needs ------------------------------------------ */
.theme-dark ::selection { background: rgba(212,178,122,.35); color: var(--ink); }
.theme-dark .mark img,
.theme-dark .brand-mark img { filter: invert(1) sepia(.15) brightness(.95); }
.theme-dark .notice-warn { border-color: rgba(212,178,122,.26); }
.theme-dark .notice-ok   { border-color: rgba(143,203,155,.20); }
.theme-dark .notice-stop { border-color: rgba(235,167,159,.28); }
.theme-dark .notice-warn .notice-dot { color: var(--g2); }
.theme-dark .switch-track { background: var(--line-strong); }
.theme-dark .switch-track::after { background: var(--ink); box-shadow: none; }
.theme-dark .switch input:checked + .switch-track::after { background: #15110C; }
.theme-dark .sheet { background: var(--scrim); }
.theme-dark .sheet-in { border: 1px solid rgba(214,178,122,.12); box-shadow: var(--menu-shadow); }
.theme-dark .spend-tip { background: var(--surface-sunk); color: var(--ink); border: 1px solid var(--line); }
.theme-dark .spend-bar.is-empty .spend-fill { fill: var(--line-strong); }
.theme-dark .charges { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.theme-dark .charges::backdrop { background: var(--scrim); }
.theme-dark .charges-sub, .theme-dark .charge-l i, .theme-dark .charge.is-free .charge-v,
.theme-dark .charges-note, .theme-dark .charges-later { color: var(--muted); }
.theme-dark .charges-list, .theme-dark .charge { border-color: var(--line); }
.theme-dark .charge-l b, .theme-dark .charge-v { color: var(--ink); }
.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.theme-dark select, .theme-dark textarea { background: var(--surface-sunk); color: var(--ink); border-color: var(--line-strong); }
.theme-dark input::placeholder, .theme-dark textarea::placeholder { color: var(--muted); opacity: 1; }
.theme-dark .cta:disabled { background: var(--track); color: var(--muted); box-shadow: none; }
/* Pages' own dark-on-light pieces. */
.theme-dark .step.done .step-ic { background: var(--g2); border-color: var(--g2); color: #15110C; }
.theme-dark .step.done .step-ic svg { stroke: #15110C; }
.theme-dark .step-n { background: var(--soft); color: var(--g1); }
.theme-dark .filter[aria-pressed="true"] { background: var(--soft); color: var(--ink); border-color: var(--g2); }
.theme-dark .opt[aria-pressed="true"] { border-color: var(--g2); background: var(--soft); }
.theme-dark .qrwrap { background: #fff; }

/* ---- 4. the desk ---------------------------------------------------------- */
.theme-dark .desk-shell { gap: 0; }
.theme-dark .desk-side {
  background: var(--side); color: var(--ink); border-right: 1px solid var(--line);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
@media (min-width: 861px) {
  .theme-dark .desk-shell { grid-template-columns: 216px minmax(0, 1fr); }
  .theme-dark .desk-side { margin: 14px 0 14px 14px; border: 1px solid var(--line); border-radius: 22px;
    position: sticky; top: 14px; height: calc(100vh - 28px); box-sizing: border-box; }
}
.theme-dark .desk-side .brand span { color: var(--ink); }
.theme-dark .desk-side nav a { color: var(--muted); font-size: 14.5px; font-weight: 500; border-radius: 12px; }
.theme-dark .desk-side nav a:hover { background: var(--soft); color: var(--ink); }
.theme-dark .desk-side nav a[aria-current="page"] { background: var(--soft); color: var(--ink); font-weight: 600; }
.theme-dark .desk-side nav a[aria-current="page"]::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--g2); margin-right: 9px; }
.theme-dark .menu-btn { color: var(--ink); background: transparent; border-color: var(--line); border-radius: 999px; }
.theme-dark .desk-top { background: transparent; border-bottom-color: var(--line); }
.theme-dark .role { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.theme-dark .role-admin { border-color: color-mix(in srgb, var(--g2) 55%, transparent); color: var(--g2); }
.theme-dark .feed-btn { background: transparent; border-color: var(--line); color: var(--ink); }
.theme-dark .feed-btn:hover { border-color: var(--g2); }
.theme-dark .badge { background: var(--g2); color: #15171A; }
.theme-dark .desk-content h1 { font-size: 40px; letter-spacing: -.02em; }
.theme-dark .lede { color: var(--muted); font-family: var(--serif); font-size: 16px; }

/* Desk buttons: many per screen, so they are gold-stroke outlines, not fills. */
.theme-dark body.desk .btn {
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gold-rim) border-box;
  border: 1px solid transparent; color: var(--g1); border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; padding: 9px 18px;
  transition: background 150ms ease;
}
.theme-dark body.desk .btn:hover:not(:disabled) { background: linear-gradient(var(--soft), var(--soft)) padding-box, var(--gold-rim) border-box; }
.theme-dark body.desk .btn-quiet { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); border-radius: 999px; }
.theme-dark body.desk .btn-quiet:hover:not(:disabled) { background: var(--soft); border-color: var(--line-strong); }
.theme-dark body.desk .btn-danger { background: var(--stop-tint); border: 1px solid var(--stop); color: #F2C3BE; border-radius: 999px; }
.theme-dark body.desk .btn-danger:hover:not(:disabled) { background: rgba(208, 103, 95, .2); }
.theme-dark body.desk .btn-danger-quiet { color: var(--stop); }

.theme-dark body.desk .tab { background: transparent; border-color: var(--line); color: var(--muted); }
.theme-dark body.desk .tab[aria-pressed="true"] { background: var(--soft); color: var(--ink); border-color: var(--g2); }

.theme-dark .desk-table th { border-bottom-color: var(--line); padding-top: 14px; padding-bottom: 12px; }
.theme-dark .desk-table td { border-top-color: var(--rule2); padding-top: 14px; padding-bottom: 14px; }
.theme-dark .desk-table tr.clickable:hover td { background: var(--rule2); }
@media (max-width: 640px) {
  .theme-dark .table-wrap { background: transparent; border: 0; }
  .theme-dark .desk-table tr { background: var(--surface); border-color: var(--line); border-radius: 16px; }
}
.theme-dark .figure { border-color: var(--line); background: transparent; }
.theme-dark .figure.break { border-color: var(--warn); background: var(--warn-tint); }
.theme-dark .inline-form { background: var(--surface-sunk); border-color: var(--line); }
.theme-dark .all-clear { background: transparent; border: 1px solid var(--line); color: var(--ink-2); font-family: var(--serif); }
.theme-dark .state { border-color: var(--line-strong); color: var(--ink-2); }
.theme-dark .state-empty { background: transparent; font-family: var(--serif); }
.theme-dark .state-failed { background: var(--stop-tint); border-color: var(--stop); color: #F2C3BE; }
.theme-dark .state-failed strong { color: #F2C3BE; }
.theme-dark .state-unconfigured { background: var(--warn-tint); border-color: var(--warn); color: #F4CBA2; }
.theme-dark .state-unconfigured strong { color: #F4CBA2; }
.theme-dark .breaks li { background: var(--warn-tint); color: #F4CBA2; }

.theme-dark .feed { background: var(--surface); border-left-color: var(--line); box-shadow: var(--menu-shadow); }
.theme-dark .feed header { border-bottom-color: var(--line); }
.theme-dark .feed-list li a:hover { background: var(--soft); }
.theme-dark .toast { background: var(--surface-sunk); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--menu-shadow); border-radius: 16px; }
.theme-dark .toast-error { border-color: var(--stop); color: #F2C3BE; }
.theme-dark .changed { background: rgba(201, 169, 97, .12); }

/* ---- 5. the theme picker (all themes) --------------------------------------
 * Drawn by theme.js into any [data-theme-picker]. Lives outside .theme-dark so it looks right
 * in Light too. */
.theme-pick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.theme-pick button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px;
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 999px;
  transition: border-color 150ms ease, background 150ms ease;
}
.theme-pick button:hover { border-color: var(--ink-2); }
.theme-pick button[aria-pressed="true"] { color: var(--ink); font-weight: 600; border-color: var(--gold-deep); box-shadow: inset 0 0 0 1px var(--gold-deep); }
.theme-swatch { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .45); position: relative; }
.theme-swatch::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 7px; height: 7px; border-radius: 50%; background: #C9A961; box-shadow: 0 0 0 1.5px var(--surface); }
.theme-pick button[data-theme-id="light"] .theme-swatch::after { background: #EDD899; }
.theme-dark .theme-pick button { background: var(--surface); border-color: var(--line); color: var(--muted); }
.theme-dark .theme-pick button:hover { border-color: var(--line-strong); color: var(--ink); }
.theme-dark .theme-pick button[aria-pressed="true"] { background: var(--soft); color: var(--ink); border-color: var(--g2); box-shadow: none; }
/* The compact picker in the desk's top bar. */
.theme-pick.compact { gap: 4px; }
.theme-pick.compact button { min-height: 32px; padding: 0 11px 0 8px; font-size: 12.5px; gap: 6px; }
.theme-pick.compact .theme-swatch { width: 13px; height: 13px; }
.theme-pick.compact .theme-swatch::after { width: 6px; height: 6px; }
@media (max-width: 860px) { .theme-pick.compact button { min-height: 44px; } }

@media (prefers-reduced-motion: reduce) {
  .theme-dark .cta:active, .theme-dark .ask-yes:active { transform: none; }
}
