/* NUSCM Finance — visual system.
   Palette and type are taken from nuscm.com so the finance system reads as part
   of the club, not a bolted-on tool. Chart colors are stepped from the brand hues
   and validated for colorblind separation against the cream surface; the gold slot
   sits near the contrast floor, so every chart also ships direct labels and a
   table view. */

:root {
  color-scheme: light;

  /* Brand */
  --turquoise:   #033e37;
  --turquoise-2: #06544a;
  --cream:       #f6eedb;
  --grey-green:  #8ca396;
  --purple:      #8a4686;
  --ink:         #091d3c;

  /* Planes */
  --page:      #efe4ca;
  --surface:   #f6eedb;
  --surface-2: #fbf6e9;
  --line:      #ded0ae;
  --line-soft: #e7dcc1;

  /* Ink */
  --text:      #091d3c;
  --text-2:    #3c4a45;
  --text-3:    #63756c;
  --on-dark:   #f6eedb;
  --on-dark-2: rgba(246, 238, 219, .68);

  /* Data series — validated on the cream surface */
  --s1: #00998a;
  --s2: #c2410c;
  --s3: #8a4686;
  --s4: #a97400;
  --track: #d9e8dd;

  /* Status */
  --good:     #0f7a4a;
  --warning:  #b8860b;
  --critical: #b3352f;
  --good-bg:     rgba(15, 122, 74, .12);
  --warning-bg:  rgba(184, 134, 11, .16);
  --critical-bg: rgba(179, 53, 47, .12);

  --radius:   16px;
  --radius-s: 10px;
  --display: 'Poppins', system-ui, -apple-system, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(9, 29, 60, .04), 0 8px 24px rgba(9, 29, 60, .06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:      #021c19;
  --surface:   #052e29;
  --surface-2: #073a33;
  --line:      #105046;
  --line-soft: #0c4239;

  --text:      #f6eedb;
  --text-2:    #bed2c8;
  --text-3:    #9ab0a5;

  --s1: #0f9c8b;
  --s2: #dd6a34;
  --s3: #ab63a7;
  --s4: #b58a20;
  --track: #0d453c;

  --good: #35b37e; --warning: #d2a53c; --critical: #e0705f;
  --good-bg: rgba(53,179,126,.16); --warning-bg: rgba(210,165,60,.18);
  --critical-bg: rgba(224,112,95,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }

/* Author `display` rules outrank the browser's own [hidden] styling, so every
   panel toggled with the hidden attribute needs this to actually hide. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }

/* Without this, native controls — the date picker's selected day, checkboxes,
   radios — are drawn in the operating system's accent colour, which on macOS is
   often purple and has nothing to do with this palette. */
:root { accent-color: #033e37; }
:root[data-theme="dark"] { accent-color: #0f9c8b; }

:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 2px; border-radius: 4px; }
:root[data-theme="dark"] :focus-visible { outline-color: var(--s1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ══ Sign in ══════════════════════════════════════════════════════════ */
.signin-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 24px 56px;
  position: relative;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(3,62,55,.10), transparent 60%),
    radial-gradient(700px 400px at 100% 110%, rgba(138,70,134,.10), transparent 60%),
    var(--page);
}
/* Pinned to the bottom of the viewport, and folded into a single centred column
   on a narrow screen so the two halves never collide. */
.signin-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 24px; font-size: 11.5px; color: var(--text-3);
}
.signin-foot a { color: var(--turquoise); text-decoration: none; font-weight: 500; }
.signin-foot a:hover { text-decoration: underline; }
:root[data-theme="dark"] .signin-foot a { color: var(--s1); }
@media (max-width: 620px) {
  .signin-foot { flex-direction: column; gap: 4px; text-align: center; }
}

.signin {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.signin .cap { background: var(--turquoise); padding: 22px 26px; }
.signin .cap b { display: block; font-family: var(--display); font-weight: 700;
                 color: var(--on-dark); font-size: 16px; letter-spacing: .04em; }
.signin .cap span { color: var(--on-dark-2); font-size: 11.5px; }
.signin .body { padding: 26px; }
.signin h1 { font-size: 19px; margin: 0 0 6px; }
.signin p.lede { color: var(--text-2); font-size: 13px; margin: 0 0 20px; }
.code-input {
  font-family: var(--body); font-size: 26px; font-weight: 600; text-align: center;
  letter-spacing: .34em; text-indent: .34em; padding: 12px;
}

/* ══ Shell ═══════════════════════════════════════════════════════════ */
#shell { display: flex; min-height: 100vh; }

nav.side {
  width: 208px; flex: 0 0 208px; background: var(--turquoise);
  color: var(--on-dark); display: flex; flex-direction: column;
  padding: 18px 0 14px; position: sticky; top: 0; height: 100vh;
}
nav.side .brand { padding: 0 18px 14px; }
nav.side .brand b { display: block; font-family: var(--display); font-weight: 700;
                    font-size: 14.5px; letter-spacing: .05em; }
nav.side .brand span { font-size: 10.5px; color: var(--on-dark-2); letter-spacing: .02em; }

nav.side .items { padding: 0 10px; display: flex; flex-direction: column; gap: 1px; }
nav.side button {
  all: unset; display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 10px; font-size: 13px; color: var(--on-dark-2);
  border-radius: 8px; line-height: 1.3;
}
nav.side button:hover { background: rgba(246,238,219,.09); color: var(--on-dark); }
nav.side button[aria-current="true"] {
  background: var(--cream); color: var(--turquoise); font-weight: 600;
}
nav.side .group {
  padding: 14px 10px 5px; font-size: 9.5px; letter-spacing: .13em;
  text-transform: uppercase; color: rgba(246,238,219,.42); font-weight: 600;
}
nav.side .foot {
  margin-top: auto; padding: 12px 18px 0; border-top: 1px solid rgba(246,238,219,.14);
  font-size: 11px; color: var(--on-dark-2);
}
nav.side .foot .who { color: var(--on-dark); font-weight: 600; font-size: 12px; }
nav.side .foot .row { display: flex; gap: 8px; margin-top: 9px; }
nav.side .foot button {
  all: unset; cursor: pointer; font-size: 11px; color: var(--on-dark-2);
  border: 1px solid rgba(246,238,219,.22); border-radius: 6px; padding: 3px 8px;
}
nav.side .foot button:hover { background: rgba(246,238,219,.1); color: var(--on-dark); }

main { flex: 1; min-width: 0; padding: 24px 30px 64px; max-width: 1480px; }

/* ══ Page header + tie-out strip ═════════════════════════════════════ */
header.page { margin-bottom: 20px; }
header.page .top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
header.page h1 { font-size: 23px; margin: 0; }
header.page .sub { color: var(--text-2); font-size: 12.5px; }
header.page .spacer { flex: 1; }

/* The model proves itself: six checks that must all read zero. */
.tieout { display: flex; align-items: center; gap: 7px; margin-top: 10px;
          font-size: 11px; color: var(--text-3); }
.tieout .marks { display: flex; gap: 3px; }
.tieout i {
  width: 22px; height: 4px; border-radius: 2px; background: var(--good);
  display: block; opacity: .55;
}
.tieout i.bad { background: var(--critical); opacity: 1; height: 6px; margin-top: -1px; }

/* ══ Cards ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card > h2 {
  font-family: var(--body); font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-3); margin: 0 0 16px; font-weight: 600;
}
.card > h2 .note { text-transform: none; letter-spacing: 0; color: var(--text-3);
                   font-weight: 400; margin-left: 8px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
/* Grid and flex children default to min-width:auto, which refuses to shrink below
   their content. A scrollable table inside one therefore pushes its whole column
   wider instead of scrolling, and the page ends up wider than the screen. */
.grid > *, .card, .stage { min-width: 0; }
.grid:last-child { margin-bottom: 0; }
.card > .grid:last-child { margin-bottom: 0; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1120px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } }

/* ══ Hero: the budget as one depleting bar ═══════════════════════════ */
.hero { background: var(--turquoise); border-radius: var(--radius); padding: 24px 26px;
        margin-bottom: 16px; color: var(--on-dark); }
.hero .lede { display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap;
              margin-bottom: 30px; }
.hero .label { font-size: 11.5px; color: var(--on-dark-2); letter-spacing: .06em;
               text-transform: uppercase; margin-bottom: 4px; }
.hero .figure { font-family: var(--display); font-size: 46px; font-weight: 700;
                line-height: 1; letter-spacing: -.02em; }
.hero .of { font-size: 13px; color: var(--on-dark-2); }

.depletion { position: relative; }
.depletion .bar { display: flex; gap: 2px; height: 30px; }
.depletion .seg:first-child { border-radius: 8px 0 0 8px; }
.depletion .seg:last-child  { border-radius: 0 8px 8px 0; }
.depletion .seg { height: 100%; position: relative; overflow: hidden; }
.depletion .spent { height: 100%; }
.depletion .pace {
  position: absolute; top: -7px; height: 44px; width: 2px; background: var(--cream);
}
.depletion .pace::after {
  content: attr(data-label); position: absolute; top: -17px; left: 50%;
  transform: translateX(-50%); font-size: 10px; color: var(--on-dark-2);
  white-space: nowrap; letter-spacing: .04em;
}
.depletion .keys { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap;
                   font-size: 11.5px; color: var(--on-dark-2); }
.depletion .keys span { display: inline-flex; align-items: center; gap: 6px; }
.depletion .keys i { width: 9px; height: 9px; border-radius: 2px; }
.depletion .keys b { color: var(--on-dark); font-weight: 600; }

/* ══ Stat tiles ══════════════════════════════════════════════════════ */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(162px, 1fr));
         gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line-soft);
        border-radius: var(--radius-s); padding: 14px 16px; }
.tile .label { color: var(--text-3); font-size: 11px; letter-spacing: .03em;
               margin-bottom: 5px; }
.tile .value { font-family: var(--display); font-size: 24px; font-weight: 600;
               line-height: 1.1; }
.tile .delta { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.tile .delta.good { color: var(--good); }
.tile .delta.bad { color: var(--critical); }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--turquoise); }

/* ══ Tables ══════════════════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 10.5px;
     text-transform: uppercase; letter-spacing: .07em; padding: 0 10px 9px;
     border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: rgba(3,62,55,.035); }
:root[data-theme="dark"] tbody tr:hover { background: rgba(246,238,219,.04); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: none;
              background: rgba(3,62,55,.05); }
:root[data-theme="dark"] tr.total td { background: rgba(246,238,219,.05); }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px;
          margin-right: 8px; }
.muted { color: var(--text-3); }
.wrap-cell { max-width: 300px; white-space: normal; }

/* ══ Charts ══════════════════════════════════════════════════════════ */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px;
          color: var(--text-2); margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
svg .grid-line { stroke: var(--line-soft); stroke-width: 1; }
svg .axis-line { stroke: var(--line); stroke-width: 1; }
svg text { fill: var(--text-2); font-size: 11px; font-family: var(--body); }
svg text.value-label { fill: var(--text); font-weight: 600; }
svg text.axis-tick { fill: var(--text-3); font-variant-numeric: tabular-nums; }

.meter-row { margin-bottom: 16px; }
.meter-head { display: flex; justify-content: space-between; gap: 12px;
              margin-bottom: 6px; align-items: baseline; }
.meter-track { position: relative; height: 16px; background: var(--track);
               border-radius: 0 4px 4px 0; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; }
.meter-over { position: absolute; top: 0; bottom: 0; background: var(--critical);
              border-radius: 0 4px 4px 0; box-shadow: -2px 0 0 var(--surface); }

.tooltip {
  position: fixed; pointer-events: none; z-index: 90; opacity: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 10px 12px; font-size: 12px;
  box-shadow: var(--shadow); transition: opacity .1s; max-width: 280px;
}
.tooltip b { display: block; margin-bottom: 5px; font-family: var(--display); }
.tooltip .row { display: flex; justify-content: space-between; gap: 16px;
                font-variant-numeric: tabular-nums; }

/* ══ Status ══════════════════════════════════════════════════════════ */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
        border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.pill.good     { background: var(--good-bg);     color: var(--good); }
.pill.warning  { background: var(--warning-bg);  color: var(--warning); }
.pill.critical { background: var(--critical-bg); color: var(--critical); }
.pill.neutral  { background: rgba(140,163,150,.2); color: var(--text-2); }
.pill.brand    { background: rgba(3,62,55,.1);    color: var(--turquoise); }
:root[data-theme="dark"] .pill.brand { background: rgba(246,238,219,.12); color: var(--on-dark); }

.flag { display: flex; gap: 10px; padding: 10px 13px; border-radius: var(--radius-s);
        font-size: 12.5px; margin-bottom: 8px; align-items: flex-start; }
.flag.critical { background: var(--critical-bg); color: var(--critical); }
.flag.warning  { background: var(--warning-bg);  color: var(--warning); }
.flag.good     { background: var(--good-bg);     color: var(--good); }
.flag .icon { font-weight: 700; flex: 0 0 auto; }
.flag span:last-child { color: var(--text); }
.flag.critical span:last-child, .flag.warning span:last-child,
.flag.good span:last-child { color: inherit; filter: brightness(.75); }
:root[data-theme="dark"] .flag span:last-child { filter: none; }

/* ══ Forms ═══════════════════════════════════════════════════════════ */
form.stack { display: grid; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
          gap: 14px; }
label.field { display: grid; gap: 5px; font-size: 11.5px; color: var(--text-2); }
label.field > span { font-weight: 500; }
label.field .hint { color: var(--text-3); font-weight: 400; font-size: 11px; }
input, select, textarea {
  font: inherit; font-size: 13px; padding: 9px 11px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  width: 100%;
}
input[type="file"] { padding: 7px; background: transparent; border-style: dashed; }
textarea { min-height: 64px; resize: vertical; }
label.check { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px;
              color: var(--text); }
label.check input { width: auto; flex: 0 0 auto; margin-top: 2px; }

button.btn {
  font: inherit; font-size: 13px; font-weight: 500; padding: 9px 16px;
  border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); cursor: pointer;
}
button.btn:hover { border-color: var(--turquoise); }
button.btn.primary { background: var(--turquoise); border-color: var(--turquoise);
                     color: var(--on-dark); font-weight: 600; }
button.btn.primary:hover { background: var(--turquoise-2); }
button.btn.approve { border-color: var(--good); color: var(--good); }
button.btn.deny { border-color: var(--critical); color: var(--critical); }
button.btn.tiny { padding: 4px 10px; font-size: 11.5px; }
button.btn:disabled { opacity: .5; cursor: default; }
/* Anchors styled as buttons must restate color, or the browser's default
   link/visited purple shows through and the download row stops matching. */
a.btn, a.btn:link, a.btn:visited, a.btn:hover, a.btn:active {
  text-decoration: none; display: inline-block; color: var(--text);
}
a.btn:hover { border-color: var(--turquoise); }
a.btn.download, a.btn.download:link, a.btn.download:visited {
  background: transparent; border-color: var(--line);
  color: var(--text-2); font-weight: 500; padding: 5px 13px;
}
a.btn.download:hover { background: var(--turquoise); border-color: var(--turquoise);
                       color: var(--on-dark); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
           margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }

/* ══ Pipeline ════════════════════════════════════════════════════════ */
.stage { border: 1px solid var(--line-soft); border-radius: var(--radius);
         background: var(--surface); padding: 15px 16px; }
.stage h3 { font-family: var(--body); font-size: 10.5px; text-transform: uppercase;
            letter-spacing: .09em; color: var(--text-3); margin: 0 0 6px; font-weight: 600; }
.stage .count { font-family: var(--display); font-size: 22px; font-weight: 600; }
.stage .count small { font-family: var(--body); font-size: 12.5px; font-weight: 400;
                      color: var(--text-3); margin-left: 6px; }
.rr { border-top: 1px solid var(--line-soft); padding: 10px 0; font-size: 12.5px; }
.rr .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rr .who { color: var(--text-3); font-size: 11.5px; }

/* ══ Receipts ════════════════════════════════════════════════════════ */
.receipts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.receipt {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px;
  background: var(--surface-2); text-decoration: none; color: var(--text);
}
.receipt:hover { border-color: var(--turquoise); }
.receipt .x { color: var(--text-3); cursor: pointer; font-weight: 700; }
.receipt .x:hover { color: var(--critical); }

/* ══ Viewing as someone else ════════════════════════════════════════ */
.viewas {
  position: sticky; top: 0; z-index: 60; display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap; background: var(--purple); color: #fff;
  padding: 9px 30px; font-size: 12.5px; margin: -24px -30px 20px;
}
.viewas b { font-weight: 600; }
.viewas button {
  all: unset; cursor: pointer; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.5); border-radius: 7px; padding: 4px 11px;
}
.viewas button:hover { background: rgba(255,255,255,.16); }
@media (max-width: 860px) { .viewas { margin: -18px -16px 16px; padding: 9px 16px; } }

/* ══ Misc ════════════════════════════════════════════════════════════ */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
         background: var(--turquoise); color: var(--on-dark); padding: 11px 20px;
         border-radius: var(--radius-s); font-size: 13px; opacity: 0;
         transition: opacity .18s; pointer-events: none; z-index: 200; max-width: 70vw;
         box-shadow: var(--shadow); }
#toast.show { opacity: 1; }
#toast.bad { background: var(--critical); }
.empty { color: var(--text-3); font-size: 12.5px; padding: 16px 0; }
.section-gap { height: 4px; }

/* An earlier attempt at small screens lived here: it stacked the sidebar above
   the content, laid the links out as a wrapped row and hid the group headings.
   The drawer below replaces it — and while it survived, it kept overriding the
   drawer, which is why the nav read as two links per line with no headings. */

/* ══ Monthly-plan drill-down ═════════════════════════════════════════ */
td.drill { cursor: pointer; border-radius: 4px; }
td.drill:hover { background: rgba(3, 62, 55, .07); box-shadow: inset 0 0 0 1px var(--turquoise); }
:root[data-theme="dark"] td.drill:hover { background: rgba(246, 238, 219, .08); }
table.flow tr.band-top td { border-top: 1px solid var(--line); }

.drill-panel { border: 1px solid var(--turquoise); border-radius: var(--radius);
               padding: 16px 18px; margin-bottom: 16px; background: var(--surface-2); }
.drill-head { display: flex; justify-content: space-between; align-items: flex-start;
              gap: 16px; margin-bottom: 12px; }
.drill-head h3 { margin: 0 0 3px; font-family: var(--display); font-size: 14px; }
.drill-total { font-family: var(--display); font-size: 20px; font-weight: 700;
               font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ══ Settings rows and inactive people ═══════════════════════════════ */
.setting-row { display: flex; justify-content: space-between; align-items: center;
               gap: 16px; padding: 12px 14px; border: 1px solid var(--line-soft);
               border-radius: var(--radius-s); background: var(--surface-2); }
tr.row-off td { opacity: .5; }
.rowsub { display: none; }

/* ══ Long forms (the two request forms) ══════════════════════════════ */
.form-lede { font-size: 12.5px; color: var(--text-2); margin: 0 0 4px; }
.form-help { font-size: 11.5px; color: var(--text-3); margin: -4px 0 4px; line-height: 1.55; }
.form-help a, .attest a { color: var(--turquoise); }
:root[data-theme="dark"] .form-help a { color: var(--s1); }

h3.form-section {
  font-family: var(--body); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-3); font-weight: 600;
  margin: 16px 0 -2px;
}

.checklist { display: flex; flex-direction: column; gap: 9px;
             padding: 13px 15px; border: 1px solid var(--line-soft);
             border-radius: var(--radius-s); background: var(--surface-2); }

.attest { border: 1px solid var(--line); border-radius: var(--radius-s);
          padding: 15px 17px; background: var(--surface-2); margin-top: 6px; }
.attest h3 { font-family: var(--body); font-size: 10.5px; text-transform: uppercase;
             letter-spacing: .1em; color: var(--text-3); font-weight: 600; margin: 0 0 9px; }
.attest p { font-size: 11.5px; color: var(--text-2); line-height: 1.6; margin: 0 0 9px; }
.attest input[disabled] { opacity: .6; }

/* ══ Process flow map ════════════════════════════════════════════════ */
.flowmap { display: flex; gap: 0; list-style: none; margin: 0; padding: 0;
           flex-wrap: wrap; counter-reset: step; }
.flowmap li {
  flex: 1 1 165px; display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 14px 13px 13px; position: relative; cursor: default;
  border: 1px solid var(--line-soft); border-right: 0; background: var(--surface);
}
/* Only the steps you file are actionable; the rest are a legend, not a menu. */
.flowmap li.go { cursor: pointer; background: var(--surface-2); }
.flowmap li:not(.go) .n { background: var(--text-3); }
.flowmap li:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.flowmap li.last { border-right: 1px solid var(--line-soft);
                   border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.flowmap li.go:hover { background: rgba(3, 62, 55, .09); border-color: var(--turquoise); }
:root[data-theme="dark"] .flowmap li.go:hover { background: rgba(246, 238, 219, .10); }
.flowmap li.on { background: var(--turquoise); border-color: var(--turquoise); }
.flowmap li.on b, .flowmap li.on .who { color: var(--on-dark); }
.flowmap li.on .note { color: var(--on-dark-2); }
.flowmap li.on .n { background: var(--cream); color: var(--turquoise); }

.flowmap .n {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  background: var(--turquoise); color: var(--on-dark); font-size: 11px;
  font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}
.flowmap .body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.flowmap b { font-family: var(--display); font-size: 12.5px; line-height: 1.25; }
.flowmap .who { font-size: 11px; color: var(--text-2); }
.flowmap .note { font-size: 10.5px; color: var(--text-3); }

/* The last step is SABO's, not the club's. */
.flowmap li.last { border-style: dashed; }

@media (max-width: 900px) {
  .flowmap li, .flowmap li:first-child, .flowmap li.last {
    flex: 1 1 100%; border-right: 1px solid var(--line-soft); border-radius: 0;
    border-bottom: 0;
  }
  .flowmap li:first-child { border-radius: var(--radius-s) var(--radius-s) 0 0; }
  .flowmap li.last { border-bottom: 1px solid var(--line-soft);
                     border-radius: 0 0 var(--radius-s) var(--radius-s); }
}

/* ══ Standing request balance ════════════════════════════════════════ */
.standing { margin: 8px 0 4px; padding: 9px 11px; border-radius: var(--radius-s);
            background: var(--surface-2); border: 1px solid var(--line-soft);
            font-variant-numeric: tabular-nums; }
.standing-top { display: flex; justify-content: space-between; gap: 12px;
                font-size: 11.5px; color: var(--text-2); }
.standing-top b.good { color: var(--good); }
.standing-top b.warning { color: var(--warning); }
.standing-top b.critical { color: var(--critical); }
.standing-track { height: 5px; border-radius: 3px; background: var(--track);
                  margin: 6px 0 5px; overflow: hidden; }
.standing-track i { display: block; height: 100%; border-radius: 3px; }
.standing-track i.good { background: var(--good); }
.standing-track i.warning { background: var(--warning); }
.standing-track i.critical { background: var(--critical); }
.standing-foot { font-size: 10.5px; color: var(--text-3); }
.standing-foot b.critical { color: var(--critical); }

/* ══ Stepped request forms ═══════════════════════════════════════════ */
form.formal { gap: 0; }
form.formal > .actions { margin-top: 20px; }

.fstep { display: grid; grid-template-columns: 232px 1fr; gap: 28px;
         padding: 20px 0; border-top: 1px solid var(--line-soft); }
.fstep:first-of-type { border-top: 0; padding-top: 4px; }

.fstep-head { display: flex; gap: 10px; align-items: flex-start; }
.fstep-n {
  flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%;
  background: var(--turquoise); color: var(--on-dark); font-size: 11px;
  font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}
.fstep-head h3 { font-family: var(--display); font-size: 14px; margin: 0; line-height: 1.3; }
.fstep-head p { font-size: 11.5px; color: var(--text-3); margin: 5px 0 0; line-height: 1.55; }
.fstep-head a { color: var(--turquoise); }
:root[data-theme="dark"] .fstep-head a { color: var(--s1); }

.fstep-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fstep-body > .fields { margin: 0; }
.fstep-note { font-size: 11.5px; color: var(--text-3); margin: 0; line-height: 1.55; }
.fstep-note a { color: var(--turquoise); }
.fstep .attest { margin-top: 0; }

@media (max-width: 900px) {
  .fstep { grid-template-columns: 1fr; gap: 14px; }
}

/* ══ Row action menu ═════════════════════════════════════════════════ */
.rowmenu { position: relative; display: inline-block; }
.rowmenu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 194px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 5px;
  display: flex; flex-direction: column; text-align: left;
}
.rowmenu-list button {
  all: unset; cursor: pointer; padding: 7px 10px; border-radius: 6px;
  font-size: 12.5px; color: var(--text); white-space: nowrap;
}
.rowmenu-list button:hover { background: var(--turquoise); color: var(--on-dark); }
.rowmenu-list button.danger { color: var(--critical); }
.rowmenu-list button.danger:hover { background: var(--critical); color: #fff; }

/* ══ Driver month grid ═══════════════════════════════════════════════ */
.monthgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.monthgrid label { display: flex; flex-direction: column; gap: 3px; }
.monthgrid span { font-size: 10px; color: var(--text-3); text-align: center;
                  letter-spacing: .04em; }
.monthgrid input { text-align: center; padding: 6px 2px; }
@media (max-width: 900px) { .monthgrid { grid-template-columns: repeat(6, 1fr); } }

/* ══ Collapsible card ════════════════════════════════════════════════ */
details.fold { padding: 0; }
details.fold > summary {
  list-style: none; cursor: pointer; padding: 16px 22px;
  display: flex; align-items: baseline; gap: 10px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: '▾'; margin-left: auto; color: var(--text-3); font-size: 12px;
  transition: transform .15s;
}
details.fold[open] > summary::after { transform: rotate(180deg); }
details.fold > summary h2 {
  font-family: var(--body); font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-2); margin: 0; font-weight: 600;
  line-height: 1;
}
details.fold > summary:hover h2 { color: var(--turquoise); }
:root[data-theme="dark"] details.fold > summary:hover h2 { color: var(--s1); }
.foldhint { font-size: 11.5px; color: var(--text-3); line-height: 1; }
details.fold > summary::after { line-height: 1; }
.foldbody { padding: 0 22px 20px; border-top: 1px solid var(--line-soft); padding-top: 18px; }

td.diff-bad { color: var(--critical); font-weight: 600; }

td.diff-bad, .num.diff-bad { color: var(--critical); font-weight: 600; }
details.fold.sub { border: 1px solid var(--line-soft); border-radius: var(--radius-s);
                   margin-top: 16px; background: var(--surface-2); }
details.fold.sub > summary { padding: 12px 16px; }
details.fold.sub .foldbody { padding: 16px; }

/* One table for every category, so the number columns line up down the page. */
table.drivers thead th { white-space: nowrap; }
table.drivers td:first-child { min-width: 190px; }
table.drivers tr.groupname td {
  font-family: var(--body); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-3); font-weight: 600;
  padding-top: 16px; border-bottom: 1px solid var(--line);
}
table.drivers tr:first-child.groupname td { padding-top: 4px; }
table.drivers tr.grouptotal td {
  font-weight: 600; border-top: 1px solid var(--line-soft); color: var(--text-2);
}

/* Member rule list */
ul.rulelist { margin: 0; padding-left: 18px; display: flex; flex-direction: column;
              gap: 6px; font-size: 13px; }
ul.rulelist li { color: var(--text); }

/* The calendar button in a date field, tinted to match the rest. */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .55;
  filter: invert(18%) sepia(31%) saturate(1737%) hue-rotate(133deg) brightness(94%) contrast(101%);
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(85%) sepia(12%) saturate(600%) hue-rotate(120deg);
}

/* ══ Small screens ═══════════════════════════════════════════════════
   The layout is a fixed 208px sidebar beside the content, which on a phone
   leaves almost nothing for the content. Below 820px the sidebar becomes a
   drawer behind a top bar, and everything that is wider than the screen —
   chiefly the tables — is allowed to scroll on its own. */

.topbar { display: none; }
#scrim { display: none; }

@media (max-width: 820px) {
  #shell { display: block; }

  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 60;
    background: var(--turquoise); color: var(--on-dark);
    padding: 12px 16px;
  }
  .topbrand { display: flex; flex-direction: column; line-height: 1.15; }
  .topbar b { font-family: var(--display); font-size: 14px; letter-spacing: .05em; }
  .topbrand span { font-size: 10.5px; color: var(--on-dark-2); letter-spacing: .02em; }
  .topbar button {
    all: unset; cursor: pointer; width: 40px; height: 40px;   /* a real tap target */
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    padding: 0 8px; margin-left: -8px;
  }
  .topbar button span {
    display: block; height: 2px; background: var(--on-dark); border-radius: 2px;
  }

  nav.side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 80;
    width: 258px; flex-basis: 258px; height: 100%;
    transform: translateX(-100%); transition: transform .18s ease-out;
  }
  /* The list scrolls, not the whole sidebar. Scrolling the sidebar itself
     defeats `margin-top: auto` on the footer, which is why the name and the
     sign-out row ended up jammed under the last nav item instead of sitting at
     the bottom the way they do on a desktop. */
  nav.side .items { flex: 1 1 auto; overflow-y: auto; padding-bottom: 8px; }
  nav.side .foot { flex: 0 0 auto; padding-bottom: 14px; }
  body.nav-open nav.side { transform: none; }

  #scrim {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(9, 29, 60, .45); opacity: 0; pointer-events: none;
    transition: opacity .18s;
  }
  body.nav-open #scrim { opacity: 1; pointer-events: auto; }

  main { padding: 16px 14px 56px; }

  /* Everything was sized for a desktop column roughly three times this wide. */
  body { font-size: 13.5px; }
  header.page h1 { font-size: 19px; }
  header.page .sub { font-size: 12px; }
  .tile .value { font-size: 19px; }
  .tile .label { font-size: 10.5px; }
  .stage .count { font-size: 18px; }
  .stage .count small { font-size: 11.5px; }
  .drill-total { font-size: 17px; }
  .fstep-head h3 { font-size: 13px; }
  .card table { font-size: 12.5px; }
  .attest p { font-size: 11px; }
  .card { padding: 16px 14px; border-radius: 12px; }
  details.fold > summary { padding: 14px 16px; flex-wrap: wrap; }
  details.fold > summary .foldhint { flex-basis: 100%; }
  details.fold .foldbody { padding: 0 14px 16px; }

  /* Every table can scroll, not just the seven that were wrapped by hand. */
  .card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card table thead, .card table tbody { display: table; width: 100%; min-width: 300px; }

  /* Columns that are reference rather than action are hidden rather than made
     to scroll: the roster is eight columns wide and the useful ones are who
     they are and what you can do about it. */
  .hide-sm { display: none !important; }
  .rowsub { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }

  /* Fingers, not cursors. */
  button.btn, a.btn { padding: 11px 16px; }
  button.btn.tiny, a.btn.tiny { padding: 8px 12px; font-size: 12px; }
  .rowmenu-list button { padding: 11px 12px; }
  label.check input { width: 20px; height: 20px; }
  input, select, textarea { font-size: 16px; }   /* stops iOS zooming on focus */

  .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .drill-head { flex-direction: column; gap: 6px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .actions { gap: 8px; }
}

@media (max-width: 420px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  header.page h1 { font-size: 18px; }
  .monthgrid { grid-template-columns: repeat(4, 1fr); }
}

/* A receipt chip: open it, save it, or remove it. */
.receipt .dl {
  color: var(--text-3); text-decoration: none; font-weight: 600; padding: 0 2px;
  line-height: 1;
}
.receipt .dl:hover { color: var(--turquoise); }
:root[data-theme="dark"] .receipt .dl:hover { color: var(--s1); }

/* Each half of the tile's split is its own destination. */
.tile .tilelink { cursor: pointer; text-decoration: underline;
                  text-decoration-color: rgba(9,29,60,.25); text-underline-offset: 2px; }
.tile .tilelink:hover { color: var(--turquoise); }
.tile .tilelink.none { text-decoration: none; cursor: default; opacity: .65; }
:root[data-theme="dark"] .tile .tilelink:hover { color: var(--s1); }
