/* Camp Soft Landing — screen styles.
 *
 * Every colour here is a token from tokens.css (05_CONVENTIONS.md guardrail
 * 10). Nothing in this file may contain a raw colour value; scripts/check.js
 * enforces it.
 *
 * Territory colours are the one exception, and they are not written here at
 * all: they are rows in the `territory` table, so components paint them as an
 * inline style straight from the API. The rules below carry a neutral token as
 * the fallback for when that value is missing.
 *
 * Two layouts, one data source: a role-column grid above 768px, a day agenda
 * below it.
 */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--size-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  z-index: 80;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
}
.skip:focus { top: var(--space-3); }

/* --- top bar -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  /* A sticky element is only as wide as its containing block, which is the
   * viewport — so when the page scrolls sideways (an admin's seven Teahouse
   * columns in a narrow window) the bar would end where the *unscrolled*
   * viewport ended, leaving bare page beside it. `max-content` makes it span
   * whatever the widest thing on the page needs. */
  min-width: max-content;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  /* The design's bar is tighter than the page under it: 13px 20px against the
   * content's 22px clamp(15px, 2.4vw, 28px). */
  padding: 13px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-width: 0;
  /* Matches the icon button beside it — the bar is this tall either way, and
   * that height is the tap floor tokens.css sets, not a number chosen here. */
  min-height: var(--tap-min);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

/* The design's sizes exactly: 22px in the desktop bar, 21px on a phone. The
 * artwork is dark on transparent, so night mode inverts it — one file, both
 * themes, and nothing to keep in step. */
.brand-logo {
  display: block;
  height: 22px;
  width: auto;
}

.brand-logo[hidden] { display: none; }

[data-theme='night'] .brand-logo { filter: invert(1) brightness(1.06); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='sun']) .brand-logo { filter: invert(1) brightness(1.06); }
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  white-space: nowrap;
}

.wordmark[hidden] { display: none; }

.tagline { font-size: var(--size-micro); color: var(--soft); white-space: nowrap; }

/* The design drops the tagline below 1080px, where the centred nav starts
 * crowding it. Ours is the flagship territory's name, so it is long. */
@media (max-width: 1079px) {
  .tagline { display: none; }
}

.topbar-actions { display: flex; align-items: center; gap: var(--space-3); flex: none; }

/* --- navigation -----------------------------------------------------------
 *
 * Two arrangements of one list: a slim centred bar on a desktop, a bottom tab
 * bar on a phone — bottom because thumbs, and because it survives one-handed
 * use in the dark (04_DESIGN_HANDOFF.md § Modes).
 *
 * `is-lead` is the phase-aware emphasis: before the burn the app leads with
 * sign-up, during it with Live. Which one is computed from the season dates,
 * never chosen by hand (02_ARCHITECTURE.md).
 */

.topnav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
}

.nav-link {
  flex: none;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--soft);
  font: inherit;
  font-size: var(--size-small);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

/* Only the entry you are on wears a surface — the design's nav paints the
 * current screen and nothing else. Painting the phase's lead entry as well put
 * two lit tabs in the bar, and two lit tabs read as "where am I?". The
 * phase-aware emphasis lives in what the app *opens on*, not in bar paint. */
.nav-link.is-on { background: var(--card); color: var(--ink); font-weight: var(--weight-semibold); }

/* Fixed, so it survives a long scroll, and a fixed 64px tall. The page's bottom
 * padding and the toast's are both measured off that same 64 below, so the bar
 * can never end up sitting on the last shift of the week. Keep the three in
 * step if you change it. */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  /* app.js sets the real column count from the registry; this is only what the
   * bar looks like for the instant before the first render. */
  grid-template-columns: repeat(4, 1fr);
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: var(--space-1) var(--space-1) calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-1);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--soft);
  font: inherit;
  cursor: pointer;
}

/* Drawn marks, not typed ones.
 *
 * Every icon in the chrome used to be a literal Unicode character (`▤ ◷ ＋ ☰`),
 * pinned to the text face so the system would not swap in its emoji font. They
 * are letters, they render differently on every platform, and two screens drew
 * the same one. `components/icons.js` builds the set instead: one stroke width,
 * one grid, and `currentColor` throughout — so a lit tab's mark is lit in the
 * same colour as its label, and night mode needs no second copy.
 *
 * `stroke-width` is set here rather than per shape so the whole set stays in
 * step; the icon module writes no colour of its own at all, which is also what
 * keeps it clear of guardrail 10. */
.nav-icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A dot is a filled shape, not a stroked ring — the only exception. */
.nav-icon .icon-dot { fill: currentColor; stroke: none; }

/* Inside the identity chip's 30px circle. */
.nav-icon--chip { width: 18px; height: 18px; }

.tab-label {
  font-size: var(--size-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* The active tab is tea green (the design's own accent); everything else stays
 * soft. One lit tab, not a lit tab plus a coloured one. */
.tab.is-on { color: var(--t-tea-deep); }
.tab.is-on .tab-label { font-weight: var(--weight-bold); }

/* --- the clock and the season --------------------------------------------- */

.whenbox {
  margin: 0;
  flex: none;
  text-align: right;
  line-height: 1.25;
  white-space: nowrap;
}

.whenbox-clock {
  display: block;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.whenbox-season { display: block; font-size: var(--size-kicker); color: var(--soft); }

/* `display: flex` outranks the browser's `[hidden] { display: none }`, so the
 * chip has to say it twice or an anonymous device shows an empty pill. */
.chip[hidden] { display: none; }

/* The design's chip: a 30px initials avatar in a pill, 4px of padding around it
 * and 13px on the label side. Ours clears --tap-min rather than the design's
 * 40px, because on a phone this is a control somebody presses in the dark. */
.chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: var(--space-1) 13px var(--space-1) var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  max-width: 46vw;
}

/* Signed out, the chip is the way in and reads as the primary action. */
.chip--out { border-color: var(--t-tea); background: var(--t-tea); color: var(--t-tea-fg); }
.chip--out .chip-avatar { background: var(--card); color: var(--t-tea-deep); }

.chip-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--t-tea);
  color: var(--t-tea-fg);
  font-size: var(--size-micro);
  font-weight: var(--weight-bold);
}

.chip-name {
  font-size: 13px;
  font-weight: var(--weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The theme toggle, and on a phone the only control that is on every screen —
 * so it is the one that has to clear --tap-min without an argument. */
.icon-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

/* Below 1180px the name goes and the chip becomes what the design draws on a
 * phone: one circle, the same size as the theme button beside it, initials
 * inside — or the drawn figure for a device camp has not met. No pill, no
 * nested avatar disc, no label. Two identical circles read as one pair of
 * controls; a 40x48 pill wrapped around a 30px disc read as neither.
 *
 * The two sizes are the same token on purpose. Writing 48 here would be a
 * number that has to be kept in step with .icon-btn by hand, which is exactly
 * how the pair drifted out of alignment in the first place. */
@media (max-width: 1179px) {
  .chip-name { display: none; }

  .chip {
    justify-content: center;
    width: var(--tap-min);
    height: var(--tap-min);
    min-height: var(--tap-min);
    max-width: none;
    padding: 0;
    border-radius: var(--radius-pill);
  }

  .chip-avatar {
    width: 100%;
    height: 100%;
    background: none;
    color: inherit;
    font-size: 15px;
  }

  /* Signed out the whole circle is the green invitation, and the figure sits on
   * it — rather than a green dot floating inside a pale ring. The mark grows
   * with the circle it is now drawn on: 18px inside a 30px avatar disc, 22px
   * inside the 48px circle this rule makes. */
  .chip--out .chip-avatar { background: none; color: inherit; }
  .chip--out .nav-icon--chip { width: 22px; height: 22px; }
}

/* --- layout & type -------------------------------------------------------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-5) clamp(15px, 2.4vw, 28px) var(--space-6);
}

.display {
  font-family: var(--font-display);
  font-size: var(--size-display);
  font-weight: var(--weight-normal);
  line-height: 1.1;
  margin: 0;
}

.display-sm {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  font-weight: var(--weight-normal);
  line-height: 1.2;
  margin: 0;
}

.lede { color: var(--soft); font-size: var(--size-small); margin: var(--space-1) 0 0; }
.muted { color: var(--soft); font-size: var(--size-small); margin: 2px 0 0; }
.note { color: var(--soft); font-size: var(--size-small); margin: var(--space-4) 0 0; }

.sched-head { margin-bottom: var(--space-4); }

/* --- buttons -------------------------------------------------------------- */

/* The design's quiet button is an outline on the page, not a raised chip:
 * `border: 1px solid var(--line); background: none`. Filling it with --panel
 * put a second surface under every "Try again" and every footer link, which is
 * the thing that made the page read busier than the design. */
.btn {
  min-height: var(--tap-min);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--size-small);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  white-space: nowrap;
}

.btn--primary { border-color: var(--t-tea); background: var(--t-tea); color: var(--t-tea-fg); }
.btn--danger { border-color: var(--gap); background: transparent; color: var(--gap); }
.btn--small { min-height: var(--tap-min); padding: var(--space-2) var(--space-3); }

/* Going somewhere, not doing something. The design writes these at 14px with no
 * weight at all — semibold is for the button that finishes a job. */
.btn--quiet { font-weight: var(--weight-normal); }

/* The design's in-banner escape hatch is a pill, so it never reads as the same
 * kind of thing as the buttons that claim and release. */
.btn--pill { border-radius: var(--radius-pill); padding: var(--space-3) var(--space-4); }

.btn[disabled] { opacity: 0.55; cursor: default; }

.linkish {
  border: 0;
  background: none;
  color: var(--soft);
  font: inherit;
  font-size: var(--size-micro);
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  cursor: pointer;
  padding: var(--space-2);
  min-height: var(--tap-min);
}

/* --- filter chips ---------------------------------------------------------
 *
 * FilterChips from the design's component inventory (04_DESIGN_HANDOFF.md): an
 * on/off pill that narrows what a screen is showing. One primitive, used by the
 * tally's sort and the agenda's expand-all. Screens add their own
 * `--modifier.is-on` where a chip carries a meaning of its own — "only gaps"
 * is red because a gap is red everywhere. */
.filter-chip {
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--soft);
  font: inherit;
  font-size: var(--size-small);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  cursor: pointer;
}

.filter-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* --- territory picker ----------------------------------------------------- */

.terr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.terr-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 78px;
  text-align: left;
  padding: 11px 13px;
  border: 2px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.terr-box.is-active { border-color: var(--ink); background: var(--card); }

.terr-box-head { display: flex; align-items: center; gap: var(--space-2); }
.terr-box-emoji { font-size: 16px; }
.terr-box-name { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.terr-box-times { flex: 1; font-size: var(--size-kicker); color: var(--soft); line-height: 1.3; }

.terr-box-status { font-size: var(--size-micro); font-weight: var(--weight-bold); }
.terr-box-status.is-gap { color: var(--gap); }
.terr-box-status.is-live { color: var(--live); }
.terr-box-status.is-soft { color: var(--soft); }

/* --- banners & mode toggle ------------------------------------------------ */

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-card);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--size-small);
  line-height: 1.45;
}

.banner > span { flex: 1 1 240px; min-width: 0; }
.banner--signup { background: var(--card); color: var(--soft); }
.banner--offline { background: var(--soon-bg); color: var(--ink); }

/* --- the section row and filters -------------------------------------------
 *
 * The design's row above the grid: the territory re-states itself on the left
 * — Fraunces, with its hours and fill under it — and Pod and Day hang off the
 * right-hand end of the same row. */
.sched-sectionrow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-3);
}

.sched-section { flex: 1 1 220px; min-width: 0; }
.sched-section .muted { margin-top: 2px; }

.filter {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 0 1 150px;
}

.filter-label { font-size: var(--size-micro); color: var(--soft); }

.field {
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--size-body);
}

.field:disabled { color: var(--soft); }

/* --- coverage bars -------------------------------------------------------- */

.bars { display: inline-flex; gap: 3px; align-items: flex-end; height: 15px; flex: none; }
.bars--compact { gap: 2px; height: 13px; }
.bar { width: 4px; border-radius: 1px; background: var(--line); }
.bars--compact .bar { width: 3px; }
.bar--on { background: currentColor; }

.level--empty, .level--critical { color: var(--gap); }
.level--thin { color: var(--soon); }
.level--covered, .level--strong { color: var(--live); }

/* --- desktop grid --------------------------------------------------------- */

/* Shrink-to-fit, not full-bleed. Campers see only the seat columns camp has
 * opened (04_DESIGN_HANDOFF.md § Where we knowingly depart), so the Teahouse is
 * three columns rather than seven — and three columns stretched across a
 * 1280px window stops reading as a timetable and starts reading as a sparse
 * roster. The panel hugs the table; the table stays left. */
/* `overflow: clip` rather than `auto`, and no `max-height`. The grid used to be
 * its own scroll container, which meant two scrollbars on one page and, on a
 * phone, a timetable you had to scroll *inside* while the page scrolled around
 * it. `clip` is the one overflow value that still clips the square cells out of
 * the panel's radius without creating a scrollport, which leaves the viewport
 * as the nearest one — so the page scrolls, and the sticky header and day
 * column stick to the window.
 *
 * `max-width` is unset for the same reason: `fit-content` already stops at the
 * available width, so seat tracks shrink toward their 112px floor first. Below
 * that floor the panel grows and pushes the page sideways, which is reachable.
 * `max-width: 100%` would have clipped those columns off with no way to get at
 * them. */
.grid-wrap {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
  overflow: clip;
}

/* No min-width: every track already carries its own floor (164px for the day,
 * 112px a seat), so the table cannot be crushed — and a blanket 620 left a band
 * of empty panel beside a one-seat territory like Love Kitchen. */
.grid { display: grid; justify-content: start; }

.gcell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 9px 11px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
}

button.gcell { cursor: pointer; }

.gcell-text {
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gcell-sub {
  font-size: var(--size-kicker);
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gcell-meta { display: flex; gap: var(--space-2); align-items: center; min-width: 0; }

.gcell--corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 5;
  background: var(--card);
  color: var(--soft);
  font-weight: var(--weight-bold);
  font-size: var(--size-kicker);
  letter-spacing: var(--track-kicker);
}

.gcell--colhead {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--card);
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

.gcell--rowhead {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--panel);
  font-weight: var(--weight-semibold);
}

.gcell--rowhead.is-premium { background: var(--t-prem-t); }

.gcell--absent { background: var(--card); color: var(--soft); }
.gcell--closed { background: var(--card); color: var(--soft); }
.gcell--open { background: var(--panel); }
.gcell--premium { background: var(--t-prem-t); }
.gcell--needed { background: var(--gap-bg); color: var(--gap); font-weight: var(--weight-bold); }
.gcell--filled { background: var(--card); color: var(--ink); }
.gcell--mine { background: var(--card); color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }

.gcell.is-dim { opacity: 0.38; }
.is-washing { animation: wash 200ms ease-out; }

/* --- mobile agenda --------------------------------------------------------
 *
 * Days are open outside the burn — a schedule on a phone reads as a stream you
 * scroll, not a stack of shut drawers (schedule-agenda.js says why). During
 * the burn the days already behind you fold up, one tap from opening again. */

/* The design does not draw a box around a day. A day is a kicker with a hairline
 * under it and its shifts below, separated from the next day by whitespace —
 * `margin-bottom: 20px` and nothing else. Panels around each day added a second
 * surface, a second radius and a second border to a screen whose only real box
 * is the shift card, and made a week of them read like a stack of drawers. */
.agenda { display: flex; flex-direction: column; gap: 20px; }

.day-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: var(--space-2) 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.day-caret { flex: none; width: 14px; color: var(--soft); align-self: center; }

/* The design's kicker, exactly: 11px, 700, 0.16em, uppercase. */
.day-weekday {
  font-size: var(--size-kicker);
  font-weight: var(--weight-bold);
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
}

.day-date { font-size: var(--size-micro); color: var(--soft); }

.day-count {
  margin-left: auto;
  font-size: var(--size-micro);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-gapcount { color: var(--gap); font-weight: var(--weight-semibold); }

.day-shifts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-3);
}

.agenda-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.shift-card {
  border-radius: var(--radius-control);
  border-left: 3px solid var(--line);
  background: var(--panel);
  padding: var(--space-3);
}

/* The badge carries the 2x; the accent just makes it findable while scrolling. */
.shift-card.is-premium { border-left-color: var(--t-prem); }

.shift-head {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

/* The shift's own hours: the single most-read thing on this screen, and the one
 * a camper matches against their memory of what they signed up for. A point
 * above --size-small on purpose. */
.shift-window {
  flex: 1;
  font-size: 15px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.shift-level { display: inline-flex; align-items: center; gap: var(--space-2); }
.shift-level-text {
  font-size: var(--size-micro);
  font-weight: var(--weight-semibold);
  text-transform: lowercase;
}

.badge {
  font-size: var(--size-micro);
  font-weight: var(--weight-semibold);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge--premium { background: var(--t-prem-t); color: var(--t-prem); }

.shift-slots { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.slot {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 124px;
  min-height: var(--tap-min);
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-slot);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.slot[disabled] { cursor: default; }
.slot-name { font-size: var(--size-small); font-weight: var(--weight-semibold); }
.slot-sub { font-size: var(--size-kicker); opacity: 0.82; }

.slot--premium { background: var(--t-prem-t); border-color: var(--t-prem); }
.slot--needed { background: var(--gap-bg); border-color: var(--gap); color: var(--gap); }
.slot--filled { background: var(--ink); border-color: var(--ink); color: var(--on); }
.slot--mine { background: var(--ink); border-color: var(--ink); border-width: 2px; color: var(--on); }
.slot--closed { background: var(--card); border-color: var(--line); color: var(--soft); }

/* --- panels, skeleton, errors --------------------------------------------- */

/* Fill separates, not a border. Every block of this shape in the design — the
 * admin password prompt, the claim sheet's warning, the "you" card — is a fill
 * with a radius and nothing drawn around it. */
.panel {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: var(--space-4) 18px;
}

.panel--error { background: var(--gap-bg); }
.panel-title { font-family: var(--font-display); font-size: var(--size-h2); font-weight: var(--weight-normal); margin: 0 0 var(--space-2); }
.panel p { margin: 0 0 var(--space-3); }

.skeleton { display: flex; flex-direction: column; gap: var(--space-2); }
.skeleton-row {
  height: 56px;
  border-radius: var(--radius-control);
  background: var(--card);
  animation: breathe 2.6s ease-in-out infinite;
}

.is-stale { opacity: 0.6; }

/* --- dialogs: bottom sheet on a phone, centred modal on a desktop ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-4);
}

/* A separate layer so the panel above it stays fully opaque. */
.scrim::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink);
  opacity: 0.45;
}

.sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  max-height: 100%;
  overflow-y: auto;
  padding: var(--space-5) var(--space-5) var(--space-5);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-raised);
  animation: rise 180ms ease-out;
}

.sheet-kicker {
  margin: 0 0 var(--space-1);
  font-size: var(--size-kicker);
  font-weight: var(--weight-bold);
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
  color: var(--soft);
}

.sheet-kicker--gap { color: var(--gap); }

.sheet-title {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  font-weight: var(--weight-normal);
  margin: 0 0 var(--space-1);
}

.sheet-sub { margin: 0 0 var(--space-4); font-size: var(--size-small); color: var(--soft); }
.sheet-body { margin: 0 0 var(--space-4); font-size: var(--size-small); color: var(--soft); line-height: 1.55; }
.sheet-note { margin: 0; font-size: var(--size-micro); color: var(--soft); }

.sheet-error {
  min-height: 20px;
  margin: 0 0 var(--space-3);
  font-size: var(--size-small);
  color: var(--gap);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.sheet-actions .btn { font-size: var(--size-body); }

/* A row of buttons whose labels are sentences rather than verbs.
 *
 * `.btn` is `white-space: nowrap` on purpose — "Cancel" and "Seat them" must
 * never break in half — but "Open Backup · bkp for the whole week (28 shifts)"
 * is wider than a phone, and on 390px it ran off both edges of the sheet with
 * the ends of the words cut away. That is what a screenshot caught and no test
 * could. These stack full-width and wrap; the widths in the labels are the
 * point of them, so shortening the sentence was the wrong fix. */
.sheet-actions--stack { flex-direction: column; align-items: stretch; }
.sheet-actions--stack .btn { white-space: normal; text-align: center; }

/* --- the More sheet --------------------------------------------------------
 *
 * The phone bar fixes four entries and everything else lives here. Rows rather
 * than a second grid of tabs: there is room in a sheet for the sentence that
 * says what a screen is for, and somebody opening More is looking for something
 * they could not name — which is exactly when the hint earns its place.
 *
 * Each row is a full-width target well over --tap-min, because this sheet is
 * read at 3am by somebody wearing gloves. */
.morelist { list-style: none; margin: 0; padding: 0; }

.morelist-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.morelist-item:hover { background: var(--card); }

/* The screen you are on, if it is one of these — the same tea green the lit tab
 * wears, so the sheet answers "where am I" the moment it opens. */
.morelist-item.is-on { background: var(--card); color: var(--t-tea-deep); }

.morelist-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.morelist-label { font-weight: var(--weight-semibold); }
.morelist-hint { font-size: var(--size-small); color: var(--soft); }

.whoami {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  background: var(--card);
  border-radius: var(--radius-control);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}

.whoami-mark { font-size: 18px; }
.whoami-body { flex: 1; min-width: 0; }
.whoami-name { display: block; font-size: var(--size-small); font-weight: var(--weight-semibold); }
.whoami-pod { display: block; font-size: var(--size-micro); color: var(--soft); }

.fields { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.field-label { font-size: var(--size-small); color: var(--soft); margin-top: var(--space-2); }
.field-hint { opacity: 0.75; }

.warn {
  display: flex;
  gap: var(--space-3);
  border-radius: var(--radius-control);
  background: var(--soon-bg);
  color: var(--ink);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: var(--size-small);
  line-height: 1.45;
}

/* --- the identity picker ---------------------------------------------------
 *
 * "Who are you?", asked rather than guessed — components/identity-picker.js.
 * **One form, not two doors**: name, playa name and pod are all on screen from
 * the first frame, a list of real people appears under the name box as you type,
 * and picking one fills the other two in. There is no "I'm new" branch to style,
 * because being new is simply not having picked anybody.
 *
 * It appears in the claim sheet and on the sign-in panel, so it is styled here
 * rather than in either screen's stylesheet — one component, one look, both
 * doors.
 */

.idp { display: block; }
.idp-field { margin-top: var(--space-3); }
.idp-field--name { margin-top: 0; }
.idp .field-label { display: block; margin: 0 0 var(--space-1); }
.idp-input { width: 100%; }

/* A field that is holding camp's record rather than taking input. It recedes to
 * the card's own surface and wears the same green as the block that filled it,
 * so the three of them read as one answer — never by fading out: this app is
 * read in blinding sun through dust, and "disabled" at 55% opacity is the first
 * thing to disappear. */
.idp .field.is-locked {
  background: var(--card);
  border-color: var(--t-tea);
  color: var(--ink);
  opacity: 1;
  cursor: default;
}

/* The front door: these are the "which of you are you" options, and picking the
 * wrong one signs somebody in as another camper. 5px between adjacent 48px
 * targets is the tightest spacing in the app, on the highest-consequence tap. */
.idp-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: 6px; }

/* A row you press in the dark: the whole width, well over the tap floor, and
 * the pod on its own line because "which Mary" is the entire question. */
.idp-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.idp-option.is-active,
.idp-option:hover { border-color: var(--t-tea); background: var(--t-tea-t); }

.idp-option-name { font-size: var(--size-small); font-weight: var(--weight-semibold); }
.idp-option-sub { font-size: var(--size-micro); color: var(--soft); }
.idp-option.is-active .idp-option-sub { color: var(--t-tea-deep); }

.idp-status {
  margin: 6px 0 0;
  min-height: 18px;
  font-size: var(--size-micro);
  color: var(--soft);
}

.idp-error { color: var(--gap); font-size: var(--size-small); margin: var(--space-2) 0 0; }

/* --- the selected state ----------------------------------------------------
 *
 * The most important fact on the card is *which person* pressing the button
 * will sign you in as, and for a while it was the least visible thing on it: a
 * name in body text on `--card`, inside a panel that is also `--card`, with a
 * "Not me" link floating opposite. Nothing said "selected", because nothing was
 * different.
 *
 * So it is the same language the active row in the list already speaks — the
 * territory tint, its full-strength border, its deep text — plus a filled mark,
 * which is the part that survives both themes. The tint alone is only 1.08:1
 * against `--card` in sun and 1.17:1 in night, so the *border* and the *mark*
 * are what carry it: 5.8:1 in sun, 5.8:1 in night, measured off the tokens.
 */
.idp-chosen:not([hidden]) { margin-bottom: var(--space-3); }

.idp-picked {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border: 2px solid var(--t-tea);
  border-radius: var(--radius-control);
  background: var(--t-tea-t);
  color: var(--ink);
}

.idp-picked-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--t-tea);
  color: var(--t-tea-fg);
  font-size: var(--size-small);
  font-weight: var(--weight-bold);
}

/* Wide enough that a long name and pod get a line of their own before "Not me"
 * wraps under them, rather than being squeezed into a three-word column. */
.idp-picked-body { flex: 1 1 8rem; min-width: 0; }

.idp-picked-kicker {
  display: block;
  font-size: var(--size-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
  color: var(--t-tea-deep);
}

.idp-picked-name {
  display: block;
  font-size: var(--size-body);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}

.idp-picked-note { display: block; font-size: var(--size-micro); color: var(--t-tea-deep); }

/* Ink on the tint, so it reads as an action inside the selected block rather
 * than a link that has come loose from it. */
.idp-not-me {
  flex: none;
  border-color: var(--t-tea-deep);
  color: var(--t-tea-deep);
}

/* The fork, caught before it happens. Amber, not red: nothing has gone wrong
 * yet, and that is exactly why this is worth reading. */
.idp-dupe-box {
  background: var(--soon-bg);
  color: var(--ink);
  border-radius: var(--radius-control);
  padding: var(--space-3);
  margin-top: var(--space-3);
}

.idp-dupe-copy { margin: 0 0 var(--space-3); font-size: var(--size-small); line-height: 1.45; }
.idp-dupe-list { display: flex; flex-direction: column; gap: var(--space-2); }
.idp-dupe-pick { width: 100%; text-align: left; background: var(--panel); white-space: normal; }
/* Saying "none of these are me" is one deliberate tick, not a shrug — the whole
 * control exists to stop a second Fritz being made by accident. Laid out as a
 * proper row so the box itself clears the tap floor. */
.idp-dupe-ack {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  min-height: var(--tap-min);
  margin-top: var(--space-3);
  font-size: var(--size-small);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.idp-dupe-check {
  flex: none;
  width: 22px;
  height: 22px;
  accent-color: var(--soon);
  cursor: pointer;
}

/* --- the admin password prompt -------------------------------------------
 *
 * `components/admin-prompt.js`. Somebody on the allowlist typed their name into
 * the camper sign-in, and the server refused to make them a session. This is
 * the second half of that one card, so it sits inside whatever panel or sheet
 * asked the question rather than looking like a screen of its own.
 *
 * The header band is the admin screen's own language — `--ink` under `--bg` —
 * so arriving here from the camper door and arriving from `?screen=admin` look
 * like the same place. That pair is the one `scripts/check.js` already holds to
 * 4.5:1 in both themes, which is why this borrows it rather than inventing a
 * pairing nothing measures.
 */
/* The same bottom margin `.whoami` and `.fields` carry, because in the claim
 * sheet this block stands exactly where one of those two would. Without it the
 * "Not me" button sits flush against the top edge of the arrival warning and
 * reads as overlapping it — caught in a 390px screenshot, not by a test. */
.adminpw { display: block; margin-bottom: var(--space-4); }

/* The same label spacing `.idp` gives its own fields. Without it the label sits
 * hard against the top border of the box it names, which on a phone reads as
 * one shape rather than two. */
.adminpw .field-label { display: block; margin: 0 0 var(--space-1); }
.adminpw .field { width: 100%; }

.adminpw-who {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--bg);
}

.adminpw-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--soft);
  font-size: var(--size-small);
}

.adminpw-body { flex: 1 1 8rem; min-width: 0; }

.adminpw-kicker {
  display: block;
  font-size: var(--size-kicker);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
}

.adminpw-name {
  display: block;
  font-size: var(--size-body);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}

.adminpw-note { display: block; font-size: var(--size-micro); }

.adminpw-copy {
  margin: var(--space-3) 0 0;
  font-size: var(--size-small);
  line-height: 1.45;
  color: var(--soft);
}

/* The password first and "Not me" beside it, both above the tap floor: on a
 * 390px phone this card is what stands between an organiser and camp, and it
 * has already cost them one round trip. */
.adminpw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.adminpw-go { flex: 1 1 10rem; }
.adminpw-back { flex: none; }

/* --- toast ---------------------------------------------------------------- */

#toast-root {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  transform: translateX(-50%);
  z-index: 70;
  pointer-events: none;
  max-width: 88vw;
}

.toast {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-5);
  font-size: var(--size-small);
  font-weight: var(--weight-medium);
  text-align: center;
  box-shadow: var(--shadow-raised);
  animation: rise 180ms ease-out;
}

/* --- phone ---------------------------------------------------------------- */

@media (max-width: 767px) {
  /* The tab bar is fixed over the page, so the page has to end above it, or the
   * last shift of the week lives permanently under a thumb. 64px is the bar;
   * the rest is breathing room and the home indicator below it. */
  .wrap { padding-bottom: calc(64px + var(--space-5) + env(safe-area-inset-bottom, 0px)); }

  .topnav { display: none; }
  .tabbar { display: grid; }

  /* The season line is the header's first casualty on a narrow bar; the clock
   * is the part nobody on playa can do without. */
  .whenbox-season { display: none; }
  .topbar { gap: var(--space-2); padding: 11px 15px; }
  .topbar-actions { gap: 9px; }
  .brand-logo { height: 21px; }

  .terr-grid { grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); }

  /* Pod and Day stay side by side, as they are in the design. Stacking them
   * into two full-width rows costs ~76px of the one screenful a phone has, and
   * on the territory schedule that is the difference between opening the page
   * on a shift and opening it on a pair of dropdowns. */
  .filter { flex: 1 1 140px; min-width: 0; }

  /* Primary actions sit at the bottom of the sheet, inside thumb reach. */
  .scrim { align-items: flex-end; padding: 0; }

  .sheet {
    max-width: none;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    padding-bottom: var(--space-6);
  }

  .sheet-actions .btn { flex: 1 1 auto; }

  /* Clear of the tab bar, or the confirmation lands behind it. */
  #toast-root { bottom: calc(64px + var(--space-3) + env(safe-area-inset-bottom, 0px)); }
}
