/* ══════════════════════════════════════════════════════════════════
   DARK THEME FOR THE FELLOGTM DESIGN SYSTEM
   Loaded after ds-app.css on every page. public/theme.js sets
   <html data-theme="light|dark"> before the page paints, from the
   person's pick (System, Light, Dark; System by default).

   The same brand at night: the cream turns to a deep navy ink, navy turns
   to the light ink, salmon stays salmon. Surfaces climb toward the light
   as they lift (canvas, stage, raised, plate), the way the cream steps
   down in light. Every value below is a dark value for a token the system
   already names; components don't change, only what the tokens hold.

   Two rules the light theme relies on, kept here:
   - var(--color-white) is the colour of words on a solid fill (primary
     buttons, selected chips). In dark the fill is the light ink, so the
     words are the deep ink.
   - rgba(var(--ink-rgb), a) is a wash of the ink (tracks, faint borders);
     rgba(var(--shade-rgb), a) is a shadow or a scrim. Both are navy in
     light; in dark the wash is light and the shade is black.
   ══════════════════════════════════════════════════════════════════ */

:root {
  --ink-rgb: 9, 53, 85;
  --shade-rgb: 9, 53, 85;
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink-rgb: 232, 237, 243;
  --shade-rgb: 0, 0, 0;

  /* Surfaces: canvas → stage → raised → plate → pressed */
  --ws-page: #0a1118;
  --color-background: #0f1922;
  --color-bg-page: #0f1922;
  --color-white: #131e28;
  --color-gray-1: #131e28;
  --color-surface-stripe: #131e28;
  --ws-tint-accent: #131e28;
  --ws-surface-sunk: #17232e;
  --ws-surface-press: #1e2b38;
  --color-gray-2: #1a2631;
  --ws-well: #0b141c;
  --ws-field: #0b141c;
  --color-dropdown-bg: #16222d;
  --ws-sidebar-hover: #121c25;
  --ws-sidebar-press: #17222d;
  --ws-menu-hover: #1a2631;
  --color-nav-hover-bg: rgba(232, 237, 243, 0.04);
  --ws-chart-foot: #0c151d;
  --ws-scrim: rgba(2, 6, 10, 0.62);

  /* Ink: navy becomes the light ink */
  --color-brand-navy: #e8edf3;
  --color-tertiary-dark-blue: #e8edf3;
  --color-text-heading: #e8edf3;
  --color-bg-dark: #e8edf3;
  --color-text-primary: #cdd6e0;
  --color-text-body: #b0bbc7;
  --color-gray-7: #b0bbc7;
  --color-gray-8: #e1e7ee;
  --color-text-muted: #8494a5;
  --color-gray-6: #8494a5;
  --color-gray-5: #607184;
  --color-brand-mid-blue: #93a6dc;
  --color-text-interactive: #93a6dc;

  /* Edges */
  --color-gray-stroke: #1e2a36;
  --color-border-default: #1e2a36;
  --ws-edge: #1e2a36;
  --color-gray-3: #273544;
  --color-border-hairline: #273544;
  --ws-edge-card: #273544;
  --ws-edge-chip: #2c3b4b;
  --ws-edge-tray: #2c3b4b;
  --ws-edge-slot: #1f2c39;
  --ws-chart-cell-edge: #1f2c39;
  --ws-menu-line: #223040;

  /* Tones: brighter so they read on the ink, tints mixed into the stage */
  --ws-word-needs: #ff8b78;
  --ws-word-positive: #4fc7be;
  --color-stat-positive: #3bb8b2;
  --color-feedback-error: #ff7d63;
  --color-feedback-success-text: #9bcf72;
  --color-feedback-success-bg: #1b2f22;
  --color-alert: #ff5a5a;
  --ws-tint-needs: #2e252a;
  --ws-tint-live: #0e2931;
  --ws-card-tint-blue: #1b2637;
  --ws-card-tint-done: #10262b;

  /* Charts */
  --ws-chart-finished: #23a8a3;
  --ws-chart-past-half: #9a84ee;
  --ws-chart-empty: #1a2631;
  --ws-chart-dot: #1c2834;
  --ws-chart-navy-light: #6e9cc4;
  --ws-chart-navy-fade: #2a4560;
  --ws-chart-salmon-fade: #5c342e;
  --ws-chart-purple-fade: #3a325e;
  --ws-chart-teal-fade: #1a4446;
  --ws-chart-finished-tint: #1c4d4b;
  --ws-chart-past-half-tint: #3a3366;
  --ws-chart-under-half-tint: #4b3a2b;

  /* Shadows: black, and a faint light edge so a lifted thing has a rim */
  --ws-shadow-hairline: 0 0 0 0.5px #34465a;
  --ws-shadow-band: inset 0 0.5px 0 #22303e, inset 0 10px 6px 0 rgba(0, 0, 0, 0.06), inset 0 4px 4px 0 rgba(0, 0, 0, 0.1), inset 0 1px 2px 0 rgba(0, 0, 0, 0.14);
  --ws-shadow-lift: 0 0 0 0.5px rgba(232, 237, 243, 0.08), 0 6px 14px rgba(0, 0, 0, 0.32), 0 16px 40px rgba(0, 0, 0, 0.42);
  --shadow-card-default: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.24);
  --shadow-card-hover: 0 0 0 0.5px rgba(232, 237, 243, 0.08), 0 6px 14px rgba(0, 0, 0, 0.32), 0 16px 40px rgba(0, 0, 0, 0.42);
  --shadow-dropdown: 0 0 0 0.5px rgba(232, 237, 243, 0.08), 0 8px 17px rgba(0, 0, 0, 0.3), 0 30px 30px rgba(0, 0, 0, 0.26), 0 68px 41px rgba(0, 0, 0, 0.16);
  --ws-ring-selected: 0 0 0 2px rgba(232, 237, 243, 0.7);
  --ws-card-ring-lit: 0 0 0 2px rgba(232, 237, 243, 0.32);
  --ws-card-ring-person: inset 0 0 0 1px rgba(232, 237, 243, 0.14);
  --ws-focus-inset: inset 0 0 0 2px #93a6dc;
  --shadow-focus-ring: 0 0 0 3px rgba(255, 114, 92, 0.38);

  /* The older pages' names (styles.css :root) */
  --ink: #e8edf3;
  --paper: #0f1922;
  --warm-white: #131e28;
  --rule: #1e2a36;
  --muted: #8494a5;
  --body-text: #b0bbc7;
}

/* ── What tokens alone can't move ── */
:root[data-theme="dark"] body { background: var(--ws-page); }
:root[data-theme="dark"] .ws-card { outline-color: var(--ws-edge-card); }
@media (max-resolution: 1.49dppx) { :root[data-theme="dark"] .ws-card { outline-color: var(--ws-edge-card); } }

/* Lifted things sit a step above the stage, so they read without a shadow. */
:root[data-theme="dark"] :is(.ws-menu, .ds-pick) { background: var(--color-dropdown-bg); }

/* Scrims behind drawers and dialogs: the night, not a navy wash. */
:root[data-theme="dark"] :is(.cm-drawer-overlay, .cm-modal-overlay, .mo-layer, .pe-overlay, .eg-overlay, .modal-overlay, .feature-drawer-overlay),
:root[data-theme="dark"] body.ws-app :is(.modal-overlay, .feature-drawer-overlay),
:root[data-theme="dark"] body.ws-nav-open::after { background: var(--ws-scrim); }

/* The North Star stays the brand's navy panel, a step lit off the night. */
:root[data-theme="dark"] .eg-north { background: linear-gradient(135deg, #0d3b60, #093555 60%); color: #fff; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.1); }

/* Sign in: the night behind the card, not the light ink. */
:root[data-theme="dark"] .login-wrap { background: var(--ws-page); }
:root[data-theme="dark"] .login-card { border-color: var(--ws-edge-card); border-radius: var(--ws-radius-panel); }

/* Meetings' own tones (styles.css .mt-page). */
:root[data-theme="dark"] .mt-page {
  --mt-green: #4fc7be; --mt-green-bg: #0e2931;
  --mt-amber: #e0a35e; --mt-amber-bg: #2a2219;
  --mt-red: #ff8b78;   --mt-red-bg: #2e252a;
  --mt-soft: #17232e;
}
/* The share preview is the email as it will arrive: it stays on white. */
:root[data-theme="dark"] .mt-share-preview { background: #fff; color-scheme: light; }

/* The older pages' one-off tints (styles.css), each to its dark twin. */
:root[data-theme="dark"] :is(.mt-carried, .cm-tag.carried, .cm-tag.ticket, .cm-spill) { background: var(--ws-card-tint-blue); }
:root[data-theme="dark"] .cm-tag.ticket { color: var(--color-text-heading); }
:root[data-theme="dark"] .mt-share-fmts button.on { background: var(--ws-tint-needs); }
:root[data-theme="dark"] :is(.cm-b-add .cm-hint, .cm-steps li:not(.done):not(.cur), .cm-commit-off) { color: var(--color-gray-5); }
:root[data-theme="dark"] .cm-b-title::placeholder { color: var(--color-gray-5); }
:root[data-theme="dark"] .cm-proj:hover { background: var(--ws-surface-press); }
:root[data-theme="dark"] .cm-proj.ops { background: var(--ws-surface-sunk); color: var(--color-text-body); }
:root[data-theme="dark"] :is(.cm-pcard.draft, .cm-pcard.leave) { background: var(--color-bg-page); }
:root[data-theme="dark"] .cm-live-pill.staging { background: var(--ws-card-tint-blue); color: var(--color-brand-mid-blue); }
:root[data-theme="dark"] .rm-commit-chip { background: var(--ws-tint-needs); color: var(--ws-word-needs); }
:root[data-theme="dark"] .rm-commit-chip:hover { background: #3a2a2c; }
:root[data-theme="dark"] .cm-notes textarea:hover { border-color: var(--ws-edge-chip); }
:root[data-theme="dark"] .cm-lock { background: var(--ws-tint-live); }
:root[data-theme="dark"] .cm-away-chip { border-color: #2a3a52; }
:root[data-theme="dark"] .cm-away-chip.sudden { border-color: #5a4030; }
:root[data-theme="dark"] .orbit-chip-confirmed { color: #8fd19e; border-color: #2f6b3b; background: #15281b; }
:root[data-theme="dark"] .eg-edge { stroke: #34465a; }

/* ── The switch (System · Light · Dark) at the foot of the nav ── */
.ws-theme { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); margin-top: auto; padding: var(--space-xs) var(--space-xs) var(--space-xxs); }
.ws-theme + .ws-nav__person { margin-top: 0; }
.ws-theme__label { font-size: var(--ws-text-dense); line-height: 16px; color: var(--color-text-muted); }
.ws-theme .ws-segmented { flex: none; }
.ws-theme .ws-segmented__item { width: 28px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ws-theme .ws-segmented__item i { font-size: var(--ws-icon); }
.ws-theme .ws-segmented__item[aria-checked="true"] { background: var(--color-text-heading); color: var(--color-white); }
.ws-theme-switching *, .ws-theme-switching *::before, .ws-theme-switching *::after { transition: none !important; }
