/* ===========================================================================
   sjcc-theme.css — the SJCC Operations design system (2026-08-18 makeover).
   ---------------------------------------------------------------------------
   WHY THIS FILE EXISTS
     Before this, the app used 207 distinct hex colours, ~5 near-identical
     indigos/violets, two competing grey scales (#e2e8f0 vs #e5e7eb vs #cbd5e1
     all used as "the border"), 12+ font stacks and arbitrary radii/shadows.
     Nothing was named, so every tool re-invented its own accent. That is what
     made the app read as unfinished rather than institutional.

     This file is the SINGLE source of visual truth: one navy-and-slate palette
     named as tokens, one type scale, one spacing scale, one radius scale, three
     elevations, and a small set of opt-in `sjcc-*` components.

   ⚠ TOOLS ARE SEPARATE DOCUMENTS
     Each tool is its own document inside an iframe, so CSS custom properties do
     NOT inherit from the hub. Every tool that wants tokens must link this file
     itself:
         <link rel="stylesheet" href="../../shared/sjcc-theme.css">
     (the hub links it as  href="shared/sjcc-theme.css").

   ⚠ THIS FILE IS DELIBERATELY NON-INVASIVE
     It declares tokens and `sjcc-`prefixed classes ONLY. It does not restyle
     bare element selectors and does not touch existing tool class names
     (.card / .box / .pill / .tile all exist in tools with their own meanings).

   ⚠⚠ THE `sjcc-` PREFIX WAS ALREADY OCCUPIED — CHECK BEFORE NAMING A COMPONENT
     "Prefixed, therefore safe" is FALSE here. Shared modules have used this
     prefix since Phase 43, and a pre-deploy review caught two live collisions in
     this very file's first draft:
       • `.sjcc-note`  is owned by shared/sjcc-notices-ui.js:427 as the Office
         Note CARD wrapper. Its children (.from/.bd/.tag/.acts/.reply) stack, and
         notices-ui never declares `display` on the wrapper — so a `display:flex`
         here WON and turned every faculty member's Office Note into a cramped
         horizontal row. Renamed to `.sjcc-notice`.
       • `.sjcc-hint`  is owned by shared/sjcc-field-hints.js:170 as the hint
         BUTTON. Renamed to `.sjcc-helptext`.
     Already-owned names, as of 2026-08-18, across the shared modules: sjcc-af-card,
     sjcc-auth-note, sjcc-empty-state, sjcc-help-hidden, sjcc-hint, sjcc-mdl*,
     sjcc-note, sjcc-note-card, sjcc-note-modal, sjcc-pwa-*, sjcc-tool-nudge-*.
     `test/design-system.test.mjs` now fails on any new intersection — do not
     silence it, rename the component.

   ⚠ AND THE SCREENSHOT PROOF DID NOT CATCH IT
     The zero-visual-change claim was verified with byte-identical screenshots of
     all 22 preview harnesses — and it still missed the collision above, because
     dev/fixtures/home.json carries two notices that render ZERO `.sjcc-note`
     elements (measured). A fixture that does not reproduce the live shape cannot
     catch a bug caused by that shape. Pixel proof bounds the risk; it does not
     replace reading who already owns a name.
     Consequence: linking it into a tool is a provable ZERO-visual-change step —
     which is what lets the makeover ship tool-by-tool instead of as one
     untestable big-bang. Migration happens by replacing hardcoded values with
     var(--…) in each tool, verified in the browser at desktop + 390px.

   CONVENTIONS
     • Colour tokens are FLAT (one hex per role). No gradients: a flat surface
       reads as stable, a wash reads as decorative.
     • Every status has a matching fg / bg / border triple so a pill is never
       hand-assembled from three unrelated hexes again.
     • Light-only on purpose. This is a daytime office tool; a half-done dark
       mode across 21 documents would be worse than none.
   =========================================================================== */

:root {
  /* ── Brand: institutional navy ─────────────────────────────────────────────
     Replaces the indigo/violet family (#4338ca #4f46e5 #6366f1 #3730a3 #7c3aed
     #6d28d9 #818cf8) and the teal accents (#0d9488 #0f766e). Navy already
     matches the college crest and the existing dark header (#0f172a), so the
     app finally looks like one system rather than a stack of features. */
  --brand:            #1e3a5f;   /* primary actions, links, active state       */
  --brand-hover:      #17304f;   /* hover on a filled brand surface            */
  --brand-active:     #122741;   /* pressed                                    */
  --brand-soft:       #eef2f7;   /* selected row, subtle fill, info background  */
  --brand-soft-hover: #e3ebf3;
  --brand-line:       #d3dde8;   /* border that belongs to a soft brand fill    */
  --brand-ink:        #ffffff;   /* text on a filled brand surface              */

  /* ── Ink (text) ────────────────────────────────────────────────────────────
     Three levels, and that is all. Every other grey the app used for text
     (#1f2937 #334155 #64748b #94a3b8 #7c8798 …) collapses into these. */
  --ink:     #0f172a;            /* headings, primary text, emphatic values     */
  --ink-2:   #475569;            /* body copy, labels                           */
  --ink-3:   #6b7a8d;            /* meta, captions, placeholders, disabled      */
  --ink-inv: #ffffff;            /* text on any dark or brand-filled surface    */

  /* ── Surfaces ──────────────────────────────────────────────────────────────
     Page is a very light cool grey so white cards read as raised without a
     shadow doing all the work. Sunken is for inset areas (table heads, rails). */
  --page:    #f6f8fa;
  --surface: #ffffff;
  --sunken:  #f1f4f8;
  --dark:    #0f172a;            /* the app header / inverted panels            */
  --dark-2:  #1b2438;            /* a raised block inside a dark panel          */

  /* ── Lines ─────────────────────────────────────────────────────────────────
     One border colour, plus a stronger and a subtler variant. This alone
     removes most of the visual noise: the app previously mixed three border
     greys on adjacent elements, which is read as misalignment. */
  --line:        #dde3ea;
  --line-strong: #c3ccd8;        /* inputs, dividers that must be seen          */
  --line-subtle: #eef1f5;        /* row separators inside a card                */

  /* ── Status ────────────────────────────────────────────────────────────────
     Each status is fg + bg + border. The SAME status must use the SAME triple
     everywhere — an event "pending", a venue "requested" and a service request
     "pending" all mean *waiting on someone*, so they share the pending triple.
     Faculty then learn the colour once instead of per-tool. */
  --ok:          #15803d;  --ok-bg:      #eaf6ee;  --ok-line:      #c3e3ce;
  --warn:        #b45309;  --warn-bg:    #fdf5e7;  --warn-line:    #f2ddb4;
  --danger:      #b91c1c;  --danger-bg:  #fdeeee;  --danger-line:  #f3c9c9;
  --danger-hover:#a11717;
  --info:        #1e3a5f;  --info-bg:    #eef2f7;  --info-line:    #d3dde8;
  --pending:     #92400e;  --pending-bg: #fef6e7;  --pending-line: #f5e0b8;
  --neutral:     #475569;  --neutral-bg: #f1f4f8;  --neutral-line: #dde3ea;

  /* ── Focus ────────────────────────────────────────────────────────────────
     One visible focus ring, everywhere, keyboard-only. */
  --focus: #2f6fb0;

  /* ── Type ─────────────────────────────────────────────────────────────────
     ONE UI stack and ONE mono stack. No webfont: it costs a network round trip
     under a strict CSP, risks a flash of unstyled text, and the system stack
     already looks native and institutional on every device faculty use. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Scale. `--fs-body` (13px) is the app's existing default size, kept so
     migration does not resize every tool. */
  --fs-micro: 11px;   /* meta, timestamps, tile owner lines                    */
  --fs-small: 12px;   /* secondary text, table cells, chips                    */
  --fs-body:  13px;   /* default body / controls                               */
  --fs-body-lg: 14px; /* emphasis body, tile titles                            */
  --fs-h4:    16px;   /* card titles                                          */
  --fs-h3:    19px;   /* tool/page titles                                     */
  --fs-h2:    24px;   /* landing title                                        */

  --lh-tight: 1.25;   /* headings                                             */
  --lh-body:  1.5;    /* prose                                                */

  --fw-normal: 400;
  --fw-med:    500;
  --fw-semi:   600;
  --fw-bold:   700;

  /* Uppercase section label — the one place letter-spacing is used. */
  --track-caps: .5px;

  /* ── Spacing (4px base) ───────────────────────────────────────────────── */
  --s1:  4px;   --s2:  8px;   --s3: 12px;   --s4: 16px;
  --s5: 20px;   --s6: 24px;   --s8: 32px;   --s10: 40px;

  /* ── Radius ───────────────────────────────────────────────────────────────
     Three values. The app previously mixed 4/6/8/9/10/11/12/13/14/16px, which
     is exactly the kind of near-miss inconsistency that reads as "flimsy". */
  --r-sm:   6px;    /* inputs, small buttons, badges                          */
  --r-md:  10px;    /* buttons, cards, tiles                                  */
  --r-lg:  14px;    /* modals, large panels                                   */
  --r-pill: 999px;

  /* ── Elevation: exactly three ─────────────────────────────────────────── */
  --sh-1: 0 1px 2px rgba(15, 23, 42, .06);              /* resting card       */
  --sh-2: 0 4px 12px rgba(15, 23, 42, .08);             /* hover / raised     */
  --sh-3: 0 18px 44px rgba(15, 23, 42, .18);            /* modal / popover    */

  /* ── Motion ───────────────────────────────────────────────────────────────
     Short and few. Nothing that moves layout: a card that lifts on hover
     shifts the text under the cursor and is a documented "unstable" cue. */
  --t-fast: .12s ease;
  --t:      .16s ease;

  /* Minimum touch target (CLAUDE.md §2.9 mobile parity). */
  --touch: 44px;
}

/* ===========================================================================
   OPT-IN COMPONENTS
   All prefixed `sjcc-` so they can be introduced next to a tool's existing
   markup without collision. Adopt incrementally; delete the tool's local copy
   once it is switched over.
   =========================================================================== */

/* ── Section label ──────────────────────────────────────────────────────────
   The replacement for the landing's five heavy heading blocks: a quiet
   uppercase label with an optional right-aligned count. No sub-description —
   if a section needs explaining, the label is wrong. */
.sjcc-sec {
  display: flex; align-items: center; gap: var(--s3);
  margin: 0 0 var(--s3);
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  letter-spacing: var(--track-caps); text-transform: uppercase;
  color: var(--ink-3);
}
.sjcc-sec::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.sjcc-sec > .sjcc-sec-count {
  flex: 0 0 auto; font-weight: var(--fw-semi); color: var(--ink-3);
  letter-spacing: 0; text-transform: none;
}

/* ── Buttons ────────────────────────────────────────────────────────────────
   Four variants. Height is driven by padding + line-height so a button never
   depends on a fixed height; `min-height:var(--touch)` is applied on phones. */
.sjcc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 8px 14px;
  font: inherit; font-size: var(--fs-body); font-weight: var(--fw-semi); line-height: 1.2;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.sjcc-btn:hover        { background: var(--sunken); }
.sjcc-btn:active       { background: var(--line-subtle); }
.sjcc-btn:focus-visible{ outline: 2px solid var(--focus); outline-offset: 2px; }
.sjcc-btn[disabled], .sjcc-btn[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed; background: var(--surface);
}

.sjcc-btn--primary {
  color: var(--brand-ink); background: var(--brand); border-color: var(--brand);
}
.sjcc-btn--primary:hover  { background: var(--brand-hover); border-color: var(--brand-hover); }
.sjcc-btn--primary:active { background: var(--brand-active); border-color: var(--brand-active); }

.sjcc-btn--danger {
  color: var(--ink-inv); background: var(--danger); border-color: var(--danger);
}
.sjcc-btn--danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.sjcc-btn--ghost {
  background: transparent; border-color: transparent; color: var(--ink-2);
  font-weight: var(--fw-med);
}
.sjcc-btn--ghost:hover { background: var(--sunken); color: var(--ink); }

.sjcc-btn--sm { padding: 5px 10px; font-size: var(--fs-small); border-radius: var(--r-sm); }

/* Icon-only button stays square and keeps a real hit area. */
.sjcc-btn--icon { padding: 8px; width: 34px; height: 34px; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.sjcc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.sjcc-card--pad  { padding: var(--s4); }
.sjcc-card--flat { box-shadow: none; }

/* ── Status pill ────────────────────────────────────────────────────────────
   One shape, six meanings. Use the meaning, not the tool's word: a venue
   "requested" and an event "submitted" are both `--pending`. */
.sjcc-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: var(--fs-micro); font-weight: var(--fw-semi); line-height: 1.6;
  border-radius: var(--r-pill); border: 1px solid transparent;
  white-space: nowrap;
}
.sjcc-pill--ok      { color: var(--ok);      background: var(--ok-bg);      border-color: var(--ok-line); }
.sjcc-pill--pending { color: var(--pending); background: var(--pending-bg); border-color: var(--pending-line); }
.sjcc-pill--warn    { color: var(--warn);    background: var(--warn-bg);    border-color: var(--warn-line); }
.sjcc-pill--danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-line); }
.sjcc-pill--info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-line); }
.sjcc-pill--neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-line); }

/* ── Filter chip (selectable) ─────────────────────────────────────────────── */
.sjcc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font: inherit; font-size: var(--fs-small); font-weight: var(--fw-med);
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.sjcc-chip:hover { background: var(--sunken); }
.sjcc-chip[aria-pressed="true"], .sjcc-chip.is-on {
  color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line);
  font-weight: var(--fw-semi);
}
.sjcc-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Inputs ─────────────────────────────────────────────────────────────────
   16px on phones is deliberate: anything smaller makes iOS Safari zoom on
   focus, which looks like the app broke. */
.sjcc-input, .sjcc-select, .sjcc-textarea {
  width: 100%; padding: 8px 10px;
  font: inherit; font-size: var(--fs-body); color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
.sjcc-input::placeholder, .sjcc-textarea::placeholder { color: var(--ink-3); }
.sjcc-input:focus, .sjcc-select:focus, .sjcc-textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.sjcc-label {
  display: block; margin-bottom: var(--s1);
  font-size: var(--fs-small); font-weight: var(--fw-semi); color: var(--ink-2);
}
/* Helper text: exists, but stays small and one line. If it needs two lines the
   field name is wrong. */
.sjcc-helptext { margin-top: var(--s1); font-size: var(--fs-micro); color: var(--ink-3); }

/* ── Table ──────────────────────────────────────────────────────────────── */
.sjcc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.sjcc-table th {
  text-align: left; padding: 8px 10px;
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--ink-3);
  background: var(--sunken); border-bottom: 1px solid var(--line);
}
.sjcc-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-subtle); color: var(--ink-2); vertical-align: top; }
.sjcc-table tbody tr:hover td { background: var(--sunken); }

/* ── Icons ──────────────────────────────────────────────────────────────────
   Inline SVG from shared/sjcc-icons.js. Monochrome, inherits currentColor, so
   an icon is always the exact colour of the text beside it. */
.sjcc-i {
  display: inline-block; flex: 0 0 auto;
  width: 1.15em; height: 1.15em;
  vertical-align: -.16em;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.sjcc-i--lg { width: 20px; height: 20px; }
.sjcc-i--xl { width: 22px; height: 22px; stroke-width: 1.6; }

/* Icon in a tinted square — the tile / card affordance that replaces emoji. */
.sjcc-ibox {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  color: var(--brand); background: var(--brand-soft);
  border: 1px solid var(--brand-line);
}

/* ── Empty state ────────────────────────────────────────────────────────────
   Deliberately minimal: one line saying what would be here, and at most one
   action. The old pattern (icon + headline + sub + numbered 3-step tutorial)
   spent a whole screen teaching users who already know the tool. */
.sjcc-empty {
  padding: var(--s6) var(--s4); text-align: center;
  color: var(--ink-3); font-size: var(--fs-body);
}
.sjcc-empty > .sjcc-btn { margin-top: var(--s3); }

/* ── Inline notice ──────────────────────────────────────────────────────────
   For a rule or consequence the user must know (e.g. "Venue needs a start and
   end time"). NOT for descriptions of what a tool does. */
.sjcc-notice {
  display: flex; gap: var(--s2); align-items: flex-start;
  padding: 9px 12px; border-radius: var(--r-sm);
  font-size: var(--fs-small); line-height: var(--lh-body);
  color: var(--info); background: var(--info-bg); border: 1px solid var(--info-line);
}
.sjcc-notice--warn   { color: var(--warn);   background: var(--warn-bg);   border-color: var(--warn-line); }
.sjcc-notice--danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.sjcc-notice--ok     { color: var(--ok);     background: var(--ok-bg);     border-color: var(--ok-line); }

/* ── Utility ───────────────────────────────────────────────────────────── */
.sjcc-muted   { color: var(--ink-3); }
.sjcc-strong  { color: var(--ink); font-weight: var(--fw-semi); }
.sjcc-mono    { font-family: var(--mono); font-size: var(--fs-small); }
.sjcc-truncate{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sjcc-row     { display: flex; align-items: center; gap: var(--s2); }
.sjcc-spread  { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }

/* ── Phone ──────────────────────────────────────────────────────────────────
   One breakpoint for the whole app: 600px. (The app previously used 400 / 560 /
   600 / 640 / 760 / 900 in different tools, so a phone hit a different layout
   depending on which tool it opened.) */
@media (max-width: 600px) {
  .sjcc-btn        { min-height: var(--touch); padding: 10px 14px; }
  .sjcc-btn--sm    { min-height: 36px; }
  .sjcc-btn--icon  { width: var(--touch); height: var(--touch); }
  .sjcc-chip       { min-height: 36px; }
  .sjcc-input, .sjcc-select, .sjcc-textarea { font-size: 16px; }
  .sjcc-card--pad  { padding: var(--s3); }
}

@media (prefers-reduced-motion: reduce) {
  .sjcc-btn, .sjcc-chip { transition: none; }
}
