/*
  dark.css — the dark palette (owner's request 2026-11-12). PREVIEW STAGE.
  ======================================================================
  Loaded last. Does nothing unless <html data-theme="dark">, which the small
  script in base.html sets from ?theme=dark (remembered on this device) — so
  the light site is untouched. Revert: delete this file, its <link> and that
  script in base.html.

  Design rules (the same values go into the iPhone app's Tokens.swift):
    • Not black: deep blue-grey from the brand ink (#1C2433), three steps —
      page < card < raised — so depth reads by lightness; shadows are black
      and short because a dark page cannot show a soft grey one.
    • Text is off-white; every text/background pair below meets WCAG AA
      (4.5:1) — measured, see the numbers beside each group.
    • Brand blue splits in two: a FILL under white text (5.1:1) and a lighter
      blue for text, icons and borders on dark (6.7:1).
    • The four phases keep their gradient headers (a little deeper); their
      bodies are dark tints of the same hue instead of pastels.
    • Status colours keep their meaning: dark tint + light text of the hue.
*/
:root[data-theme="dark"] {
  color-scheme: dark;

  /* ===== Surfaces & borders ===== */
  --bg: #0F141D;            /* page */
  --surface: #171E2B;       /* cards, header, grids, drawers */
  --surface-warm: #111723;  /* inputs and control wells: recessed */
  --border: #2C3648;
  --border-2: #262F40;
  --border-3: #222A3A;
  --line: #2C3648;
  --line2: #202838;
  --wk-divider: rgba(160, 180, 220, .14);

  /* ===== Text (on card: 13.9 / 6.8 / 5.1) ===== */
  --text: #E6EAF2;
  --ink: #E6EAF2;
  --muted: #9BA6B9;
  --faint: #8590A4;
  --faint-2: #8590A4;
  --placeholder: #7C879B;

  /* ===== Brand blue ===== */
  --primary: #7EA2F8;        /* text / icons / borders (6.7 on card) */
  --accent: #7EA2F8;
  --primary-fill: #3A66DB;   /* fills under white text (5.1) */
  --primary-hover: #A9C2FF;  /* stronger blue text */
  --accentD: #A9C2FF;
  --primary-soft: #1A2848;
  --accentT: #1A2848;
  --primary-shadow: rgba(0, 0, 0, .45);
  --lit: rgba(255, 255, 255, .07);
  --neutral-edges-2: 0 1px 0 0 #121824, 0 2px 0 0 #0E131C;
  --cell-cast: -4px 10px 18px -6px rgba(0, 0, 0, .50);
  --flash: rgba(126, 162, 248, .17);
  --flash-peak: rgba(126, 162, 248, .30);
  --accent-line: #3A55A0;
  --accent-edges: 0 1px 0 0 #1E2F5C, 0 2px 0 0 #1A2850, 0 3px 0 0 #152043;
  --accent-edges-2: 0 1px 0 0 #1E2F5C, 0 2px 0 0 #172449;
  --danger-edges-2: 0 1px 0 0 #3B1F1C, 0 2px 0 0 #2C1614;
  --key-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 1px 2px rgba(0, 0, 0, .40), 0 2px 6px rgba(0, 0, 0, .22);
  --btn: #273247;            /* the quiet button: raised, a clear step lighter than a card */
  --btn-hover: #2F3C55;
  --btn-border: #3C4963;

  /* ===== Status (text on its tint: 8.5 / 9.3 / 7.3 / 9.2 / 7.9) ===== */
  --confirmed-dot: #2FB07B; --confirmed-bg: #12291F; --confirmed-border: #1E4A36; --confirmed-text: #6FD3A6;
  --pending-dot: #E3A33B;   --pending-bg: #2C2311;   --pending-border: #4E3D1A;   --pending-text: #EEC272;
  --requested-dot: #5B8CF0; --requested-bg: #16233F; --requested-border: #273D6B; --requested-text: #8FB2F7;
  --give-dot: #E09A2B;      --give-bg: #2E2410;      --give-card: #3A2D12;      --give-border: #57431B;      --give-text: #F0C36A;
  --swap-dot: #E57466;      --swap-bg: #311A18;      --swap-border: #5C2D28;      --swap-text: #F2A093;
  --swap-fill: var(--swap-dot);   /* on the dark page the red tag keeps its bright red, under dark words */
  --cAcc: #2FB07B; --cTint: #12291F; --cText: #6FD3A6;
  --pAcc: #E3A33B; --pTint: #2C2311; --pText: #EEC272;
  --rAcc: #5B8CF0; --rTint: #16233F; --rText: #8FB2F7;
  --sAcc: #E57466; --sTint: #311A18; --sText: #F2A093;
  --danger-text: #F2A093; --danger-border: #5C2D28; --danger-bg: #311A18;

  /* ===== Phases (text on its tint: 9.5 / 8.6 / 8.3 / 8.5) ===== */
  --morning-dot: #E09A2B; --morning-bg: #2B2212; --morning-border: #4A3A1B; --morning-text: #F0C27A;
  --morning-pill: #2B2212; --morning-count: #F0C27A;
  --morning-grad: linear-gradient(135deg, #A8660B 0%, #864605 100%);
  --noon-dot: #45A3E2; --noon-bg: #12273A; --noon-border: #1F405A; --noon-text: #8FC9F2;
  --noon-pill: #12273A; --noon-count: #8FC9F2;
  --noon-grad: linear-gradient(135deg, #257AB3 0%, #13639F 100%);
  --evening-dot: #9D7BEA; --evening-bg: #251D40; --evening-border: #3C2F64; --evening-text: #C6B0F8;
  --evening-pill: #251D40; --evening-count: #C6B0F8;
  --evening-grad: linear-gradient(135deg, #A85A8C 0%, #6B43BD 58%, #4D3292 100%);
  --night-dot: #7B93D6; --night-bg: #1A2238; --night-border: #2B3758; --night-text: #AEBDE8;
  --night-pill: #1A2238; --night-count: #AEBDE8;
  --night-grad: linear-gradient(135deg, #3B4B86 0%, #222E5C 100%);
  --mAcc: #E09A2B; --mTint: #2B2212; --mText: #F0C27A; --mBorder: #4A3A1B; --mGrad: var(--morning-grad);
  --nAcc: #45A3E2; --nTint: #12273A; --nText: #8FC9F2; --nBorder: #1F405A; --nGrad: var(--noon-grad);
  --eAcc: #9D7BEA; --eTint: #251D40; --eText: #C6B0F8; --eBorder: #3C2F64; --eGrad: var(--evening-grad);
  --gAcc: #7B93D6; --gTint: #1A2238; --gText: #AEBDE8; --gBorder: #2B3758; --gGrad: var(--night-grad);

  /* ===== Shadows: black, tighter ===== */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-card-hover: 0 4px 13px rgba(0, 0, 0, .50);
  --shadow-primary: 0 2px 8px rgba(0, 0, 0, .45);
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, .65);
  --shadow-popover: 0 16px 44px rgba(0, 0, 0, .55);
  --shadow-drawer: 14px 0 44px rgba(0, 0, 0, .55);

  /* ===== Depth (depth.css recipe, dark values) ===== */
  --paper: linear-gradient(165deg, #1E2738 0%, #1A2231 60%, #171E2B 100%);
  --sheet-top: inset 0 1px 0 rgba(255, 255, 255, .07);
  --sheet-bottom: inset 0 -1px 0 rgba(0, 0, 0, .35);
  --sheet-edges: 0 1px 0 0 #121824, 0 2px 0 0 #0E131C, 0 3px 0 0 #0A0E15;
  --sheet-contact: 0 2px 4px rgba(0, 0, 0, .50);
  --sheet-cast: -8px 16px 28px -8px rgba(0, 0, 0, .55);
  --float: var(--sheet-top), var(--sheet-bottom), var(--sheet-edges), var(--sheet-contact),
           -10px 24px 40px -8px rgba(0, 0, 0, .60), 0 48px 80px -20px rgba(0, 0, 0, .70);
  --note-rest: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .40), 0 4px 8px -2px rgba(0, 0, 0, .45);
  --note-lift: inset 0 1px 0 rgba(255, 255, 255, .09), 0 2px 4px rgba(0, 0, 0, .40), 0 12px 22px -6px rgba(0, 0, 0, .60);
  --note-press: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 1px rgba(0, 0, 0, .40);
  --under-bar: inset 0 9px 9px -9px rgba(0, 0, 0, .55);
}

@media (max-width: 680px) {
  :root[data-theme="dark"] {
    --sheet-cast: -4px 8px 14px -6px rgba(0, 0, 0, .50);
    --float: var(--sheet-top), var(--sheet-bottom), var(--sheet-edges), var(--sheet-contact), 0 20px 44px -10px rgba(0, 0, 0, .65);
    --note-rest: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .40), 0 3px 6px -2px rgba(0, 0, 0, .45);
  }
}

/* ---- Rules that carried their own light colour ---- */
[data-theme="dark"] ::selection { background: #2F4C8F; }

/* things that used the ink as a dark FILL (ink is now the light text colour) */
[data-theme="dark"] .toast, [data-theme="dark"] .undo-toast { background: #2A3448; color: #fff; border: 1px solid #3A465D; }

/* blue fills: hover goes one step lighter, text stays white */
[data-theme="dark"] .btn-primary:hover, [data-theme="dark"] .btn-new:hover,
[data-theme="dark"] .confirm-btn.primary:hover, [data-theme="dark"] .btn-block.primary:hover,
[data-theme="dark"] .btn-sm.primary:hover { background: #4370E2; }
[data-theme="dark"] .btn-primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(0, 0, 0, .40), 0 4px 10px rgba(0, 0, 0, .35); }
[data-theme="dark"] .btn-ghost { box-shadow: inset 0 1px 0 var(--lit), 0 1px 2px rgba(0, 0, 0, .35); }

/* the chosen option in a switch (tabs, my-shifts/everyone): raised above its well */
[data-theme="dark"] .tab.active, [data-theme="dark"] .focus-opt.active,
[data-theme="dark"] .seg-opt input:checked + span {
  background: #28324A; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 3px rgba(0, 0, 0, .45);
}

[data-theme="dark"] .wk-head.today:hover { background: #223360; }
[data-theme="dark"] .inbox-item.req { border-color: #45526A; }
[data-theme="dark"] .btn-sm.danger-soft:hover, [data-theme="dark"] .btn-danger:hover,
[data-theme="dark"] .btn-xs.danger-sm:hover, [data-theme="dark"] .btn-sm.danger-sm:hover,
[data-theme="dark"] .confirm-btn.danger:hover, [data-theme="dark"] .btn-block.danger:hover { background: #45221F; }

/* sign-in card (a notepad on the photo) */
[data-theme="dark"] .login-card {
  background: linear-gradient(165deg, #1E2738 0%, #1A2231 60%, #171E2B 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 -1px 0 rgba(0, 0, 0, .35),
              0 1px 0 0 #121824, 0 2px 0 0 #0E131C, 0 3px 0 0 #0A0E15,
              0 2px 3px rgba(0, 0, 0, .50), -6px 12px 22px -6px rgba(0, 0, 0, .55), -18px 34px 48px -14px rgba(0, 0, 0, .60);
}

/* small solid tags: a bright fill carries dark text on a dark page (6:1+),
   where white text would drop to under 3:1 */
[data-theme="dark"] .shift-card .status-pill.mini,
[data-theme="dark"] .giveaway-tag,
[data-theme="dark"] .contest-tag,
[data-theme="dark"] .setup-step.done .setup-check { color: #0F141D; }

/* ---- Full pass (2026-11-12) ---- */
/* a field with a mistake */
[data-theme="dark"] input.is-invalid, [data-theme="dark"] select.is-invalid, [data-theme="dark"] textarea.is-invalid,
[data-theme="dark"] .field input.is-invalid, [data-theme="dark"] .form-field select.is-invalid,
[data-theme="dark"] .time-select select.is-invalid { border-color: #B8584C; background-color: #2A1716; }
/* soft buttons: their lit top edge was a white line */
[data-theme="dark"] .btn-xs.danger-sm, [data-theme="dark"] .btn-sm.danger-sm,
[data-theme="dark"] .confirm-btn.danger { box-shadow: inset 0 1px 0 var(--lit), 0 1px 2px rgba(0, 0, 0, .35); }
[data-theme="dark"] .confirm-btn.ghost { box-shadow: inset 0 1px 0 var(--lit), 0 1px 2px rgba(0, 0, 0, .35); }
[data-theme="dark"] .confirm-btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(0, 0, 0, .40), 0 4px 10px rgba(0, 0, 0, .35); }
/* sign-in pages: the daytime photo is dimmed to dusk so the dark card belongs on it */
[data-theme="dark"] .login-wrap {
  background-image: linear-gradient(rgba(9, 13, 22, .62), rgba(9, 13, 22, .72)), var(--login-bg, none);
  background-position: center; background-size: cover; background-repeat: no-repeat;
}

/* Buttons with a body (2026-11-14): in the dark the lit edge is faint and the
   shadows are black; the quiet button's top edge is a touch brighter so it
   reads as raised, not as a hole. */
[data-theme="dark"] .btn-sm.primary, [data-theme="dark"] .btn-block.primary {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(0, 0, 0, .40), 0 3px 8px rgba(0, 0, 0, .30);
}
[data-theme="dark"] .btn-sm.ghost, [data-theme="dark"] .btn-block.ghost, [data-theme="dark"] .btn-xs,
[data-theme="dark"] .btn-ghost, [data-theme="dark"] .confirm-btn.ghost, [data-theme="dark"] .btn-sm.danger-soft,
[data-theme="dark"] .btn-block.danger {
  box-shadow: var(--key-shadow);
}
[data-theme="dark"] .btn-sm:active, [data-theme="dark"] .btn-block:active, [data-theme="dark"] .btn-xs:active,
[data-theme="dark"] .btn-ghost:active, [data-theme="dark"] .confirm-btn:active {
  box-shadow: var(--well-dark, inset 0 1px 3px rgba(0, 0, 0, .45));
}

/* Day panel, dark: the phase box's stacked edges deepen toward black. */
[data-theme="dark"] .section {
  --own-shadow: inset 0 1px 0 var(--lit), 0 1px 0 0 var(--pe),
                0 2px 0 0 color-mix(in srgb, var(--pe) 62%, #000), 0 4px 7px rgba(0, 0, 0, .35);
}

/* New-shift window, dark (2026-11-14): shadows turn black; the chosen day key
   and the pressed keys lose the blue glow that only works on a light page. */
[data-theme="dark"] .form-section, [data-theme="dark"] .dd-section {
  box-shadow: inset 0 1px 0 var(--lit), var(--neutral-edges-2), 0 3px 5px rgba(0, 0, 0, .30);
}
[data-theme="dark"] .worker-picker, [data-theme="dark"] .seg { box-shadow: var(--well-dark, inset 0 1px 3px rgba(0, 0, 0, .40)); }
[data-theme="dark"] .weekday-chip input:checked + span {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(0, 0, 0, .40), 0 3px 8px rgba(0, 0, 0, .30);
}
[data-theme="dark"] .time-exact-toggle:active { box-shadow: var(--well-dark, inset 0 1px 3px rgba(0, 0, 0, .45)); }
[data-theme="dark"] .time-min-exact { box-shadow: var(--well-dark, inset 0 1px 3px rgba(0, 0, 0, .40)); }

/* The last flat controls, dark (2026-11-14): pressed keys and wells shade to black. */
[data-theme="dark"] .bell-btn:active, [data-theme="dark"] .user-btn:active, [data-theme="dark"] .icon-btn:active,
[data-theme="dark"] .lang-btn:active, [data-theme="dark"] .notif-clear:active, [data-theme="dark"] .pick-cancel:active,
[data-theme="dark"] .wk-dayoff:active, [data-theme="dark"] .sec-remove:active, [data-theme="dark"] .cap-chip:active,
[data-theme="dark"] .nav-arrow:active, [data-theme="dark"] .nav-today:active, [data-theme="dark"] .btn-danger:active,
[data-theme="dark"] .day-applying-btn:active,
[data-theme="dark"] .restore-btn:active { box-shadow: var(--well-dark, inset 0 1px 3px rgba(0, 0, 0, .45)); }
[data-theme="dark"] .day-applying-btn.end {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(0, 0, 0, .40), 0 3px 8px rgba(0, 0, 0, .30);
}
[data-theme="dark"] .field input, [data-theme="dark"] .search input, [data-theme="dark"] .board-compose textarea,
[data-theme="dark"] .board-reply textarea, [data-theme="dark"] .settings-card input[type="number"],
[data-theme="dark"] .settings-card input[type="text"], [data-theme="dark"] .settings-card input[type="email"],
[data-theme="dark"] .settings-card input[type="password"],
[data-theme="dark"] .wd-window-days input[type="number"] { box-shadow: var(--well-dark, inset 0 1px 3px rgba(0, 0, 0, .40)); }

/* Day panel's card, dark (2026-11-15). */
[data-theme="dark"] .day-limits { box-shadow: inset 0 1px 0 var(--lit), var(--neutral-edges-2), 0 3px 5px rgba(0, 0, 0, .30); }
[data-theme="dark"] .staff-box { box-shadow: inset 0 1px 0 var(--lit), var(--neutral-edges-2), 0 3px 5px rgba(0, 0, 0, .30); }
[data-theme="dark"] .wk-others > summary { box-shadow: inset 0 1px 0 var(--lit), var(--neutral-edges-2), 0 3px 5px rgba(0, 0, 0, .30); }
[data-theme="dark"] .wk-others > summary:active { box-shadow: inset 0 1px 0 var(--lit), 0 1px 0 0 var(--border); }
/* The white key (add / request), dark: the same sheet as the "N more" key. */
[data-theme="dark"] .wk-add, [data-theme="dark"] .add-btn, [data-theme="dark"] .day-timeoff-btn,
[data-theme="dark"] .wk-restore, [data-theme="dark"] .wk-addphase-btn, [data-theme="dark"] .day-addphase-btn {
  box-shadow: inset 0 1px 0 var(--lit), var(--neutral-edges-2), 0 3px 5px rgba(0, 0, 0, .30);
}
[data-theme="dark"] .wk-add:active, [data-theme="dark"] .add-btn:active, [data-theme="dark"] .day-timeoff-btn:active,
[data-theme="dark"] .wk-restore:active, [data-theme="dark"] .wk-addphase-btn:active, [data-theme="dark"] .day-addphase-btn:active {
  box-shadow: inset 0 1px 0 var(--lit), 0 1px 0 0 var(--border);
}
[data-theme="dark"] .wk-add.closed-note, [data-theme="dark"] .add-btn.closed-note { box-shadow: none; }

/* ---- Dark mode review (2026-11-17) ---- */
/* The veil behind an open window. The light page's veil is a 40% wash of the
   brand ink (#1C2433) — but that ink is LIGHTER than the dark page, so here
   the page behind a window turned paler instead of darker and the window did
   not stand out. On a dark page the veil is near-black. */
[data-theme="dark"] .scrim, [data-theme="dark"] .confirm-scrim, [data-theme="dark"] .ps-more-dim { background: rgba(2, 4, 9, .62); }
/* The chosen day's date on the phone's day strip: softened white on the dark
   blue measured 4.2:1; full white is 5.1:1. */
[data-theme="dark"] .wk-day-btn.active .wk-day-btn-date { color: #fff; }
