/* ==========================================================================
   Checklist: the daily tick surface
   Language: design.md (Mintlify documentation system)
   Read:     dense ops surface for a shift crew on tablets and phones,
             dial ENERGY 2 / RHYTHM 2 / MOTION 1.

   Why these choices (one line each, per antislop R-31):
   - Flat canvas + hairline rules, no glows and no gradient background: this is
     the guide's documentation surface, and its atmospheric sky bands belong to
     marketing pages, not to a screen someone reads at 5am in a car park.
   - Inter for prose, Geist Mono for every number and type label: the guide's
     "the typeface assignment IS the brand voice", and here the machine data is
     the clock, the counts, the readings and the entry kinds.
   - Ink (#0a0a0a) pill for primary actions and the active tab: the guide's
     button-primary and pill-tab-active, and the one strong shape moment the app
     has. Mint is spent only on "this is done / this is saved", nowhere else.
   - Hairline item rows instead of a pill inside a card: the guide's property-row,
     and a checklist is a list of rows, not a grid of cards.
   - Radius carries meaning: 9999 for actions, 12 for panels, 8 for inputs, 6 for
     chips and boxes. Nothing else is rounded.
   - Shadow only where something is actually above something else: the bar once
     content scrolls under it, and the toast. Everything else sits flat.
   - No blur anywhere: the guide's surfaces are solid, and a working surface is
     read in sunlight.
   - Control borders use stone, not the hairline, so the box a person has to hit
     passes 3:1 against the page (WCAG 1.4.11); hairlines stay for dividers.
   - Edges come in three levels (--line-soft, --edge, --line-strong) so an outline
     tells you what kind of boundary it is before you read a word of it.
   - Motion is feedback only: a tick that confirms, a flag that says saved, a
     toast that arrives. No entrance choreography, nothing looping.
   ========================================================================== */

/* --- Fonts -------------------------------------------------------------
   Self-hosted rather than pulled from a font CDN: the app is installed as a PWA
   and is used where the signal is not there, and a third render-blocking
   stylesheet would hold up first paint for somebody else's server. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/geist-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/geist-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokens ------------------------------------------------------------
   Light values are the guide's own tokens. The guide publishes no dark palette
   (its Known Gaps says so), so dark is derived from the four dark surfaces it
   does publish - canvas-dark, hairline-dark, surface-code and on-dark-muted -
   on the same logic: one near-black canvas, a step lighter for surfaces, a
   hairline two steps up, and mint unchanged because it carries 10:1 on black. */

:root {
  color-scheme: light;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  /* ink */
  --ink: #0a0a0a;
  --charcoal: #1c1c1e;
  --slate: #3a3a3c;
  --steel: #5a5a5c;        /* small text on any surface here: 6.4:1 or better */
  --stone: #8a8a8c;        /* borders and non-text only, never body text */
  --muted: #a8a8aa;        /* disabled text and decoration only */

  /* surfaces */
  --canvas: #ffffff;
  --surface: #f5f5f5;
  --surface-soft: #fafafa;
  --line: #e5e5e5;
  --line-soft: #ededed;
  /* Three edge levels, so an outline says what kind of thing it is:
     --line-soft  a rule between rows inside a panel (quietest, repeated 52 times)
     --edge       the outline of a thing: a panel, a pill, a tray, an empty slot
     --line-strong the edge of something you hit or fill in (3.45:1) */
  --edge: #c9c9cb;         /* 1.66:1 on the canvas: visible in daylight, not a grey box */
  --line-strong: #8a8a8c;  /* control edges: 3.45:1 against the canvas */

  /* accent: spent on done and saved, nowhere else */
  --mint: #00d4a4;
  --mint-deep: #00b48a;
  --mint-wash: rgba(0, 212, 164, .08);
  --on-mint: #0a0a0a;      /* mint is the same in both themes, so its ink is too */
  --ok-ink: #0b7a55;       /* green text that clears 4.5:1 (the guide's mint does not) */

  /* semantic states */
  --warn: #c37d0d;         /* icons and borders: 3.35:1 */
  --warn-ink: #8f5c08;     /* text: 5.67:1 */
  --warn-wash: rgba(195, 125, 13, .09);
  --danger: #b03b3b;
  --danger-ink: #a92f36;   /* 6.67:1 */
  --danger-wash: rgba(212, 86, 86, .10);

  --on-ink: #ffffff;
  --focus: #0a0a0a;        /* the ring is 2px solid this, on the canvas: 19.8:1 */

  /* shape: radius is a hierarchy signal, so it is capped to these four steps */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 9999px;

  /* elevation: 0 by default; 1 when something scrolls under a bar; 2 for the toast */
  --el-1: 0 1px 2px rgba(10, 10, 10, .06);
  --el-2: 0 8px 24px rgba(10, 10, 10, .14);

  --pad: clamp(1rem, 4vw, 1.75rem);
  --tap: 44px;
  --dur: .16s;             /* the guide's recommended 150-200ms */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --maxw: 620px;

  /* real height of the sticky app bar; the script keeps this exact */
  --appbar-h: 104px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --ink: #ffffff;
  --charcoal: #ededed;
  --slate: #c9c9cb;
  --steel: #b3b3b3;        /* the guide's on-dark-muted: 8.8:1 on a surface */
  --stone: #8a8a8c;
  --muted: #77777a;

  --canvas: #0a0a0a;
  --surface: #141414;
  --surface-soft: #101010;
  --line: #1f1f1f;
  --line-soft: #26262a;    /* row rules: lifted, or 52 rows read as one grey block */
  --edge: #3a3a3c;         /* the same perceptual step as light's #c9c9cb: 1.74:1 */
  --line-strong: #6a6a6c;  /* 3.5:1 on the canvas */

  --mint: #00d4a4;
  --mint-deep: #7cebcb;
  --mint-wash: rgba(0, 212, 164, .12);
  --on-mint: #0a0a0a;
  --ok-ink: #7cebcb;

  --warn: #e8a15a;
  --warn-ink: #e8a15a;     /* 8.5:1 on a dark surface */
  --warn-wash: rgba(232, 161, 90, .12);
  --danger: #ff8f8f;
  --danger-ink: #ff8f8f;
  --danger-wash: rgba(212, 86, 86, .16);

  --on-ink: #0a0a0a;
  --focus: #00d4a4;        /* 10.3:1 on the dark canvas */

  --el-1: 0 1px 2px rgba(0, 0, 0, .5);
  --el-2: 0 8px 24px rgba(0, 0, 0, .6);
}

/* --- Base -------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -.006em;
  color: var(--charcoal);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

button { -webkit-appearance: none; appearance: none; }

a { color: var(--ink); }

/* Every control says it can be used (antislop R-39), set once, here. */
a[href], button, label[for], select,
input[type="checkbox"], input[type="date"], input[type="submit"] { cursor: pointer; }

:disabled, .abtn:disabled, .icon-btn:disabled { cursor: not-allowed; }

/* A dark ring, not the mint: mint on white is 1.9:1 and an indicator nobody can
   see is not an indicator. Inputs add the guide's mint border on top of it. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Data, not prose: clock, counts, dates, units, entry kinds. */
.mono {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* The guide's micro-uppercase label, used for section heads and field names. */
.label-micro {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--steel);
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm { width: 17px; height: 17px; }

/* --- App bar -----------------------------------------------------------
   The guide's documentation top nav: solid canvas, one hairline under it, no
   glass. It goes flat until content scrolls beneath it, and only then lifts. */

.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: var(--canvas);
  border-bottom: 1px solid var(--edge);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.appbar.is-scrolled { box-shadow: var(--el-1); }

.appbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .6rem var(--pad) .45rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;          /* the day row drops to a line of its own */
  gap: .4rem .75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--tap);   /* the whole tile is a link, so the link is 44 tall */
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
}

/* Ink tile, mint tick: the guide's primary-on-light with its one accent. */
.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  color: var(--mint);
  background: var(--ink);
}

[data-theme="dark"] .brand-mark { background: var(--surface); border: 1px solid var(--line); }

.brand-mark .icon { stroke-width: 2.6; }

.brand-name {
  font-weight: 600;
  letter-spacing: -.02em;
  font-size: 15px;
  white-space: nowrap;
}

.appbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* --- Tabs ---------------------------------------------------------------
   The guide's pill-tab: hairline pill at rest, ink pill when it is the page you
   are on. No dot: the pill already says which one is current. */

.tabs {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad) .6rem;
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: var(--tap);
  padding: 0 .95rem;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--canvas);
  color: var(--steel);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  touch-action: manipulation;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}

.tab:hover { color: var(--ink); border-color: var(--line-strong); }

.tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  font-weight: 500;
}

[data-theme="dark"] .tab.is-active { background: var(--ink); color: var(--on-ink); }

/* --- Segmented (User / Admin) ------------------------------------------
   Same ink pill as the active tab, sitting in the guide's surface tray, so the
   two ways of switching views agree with each other. */

.segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--surface);
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: var(--tap);
  padding: 0 .7rem;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--steel);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.seg:hover { color: var(--ink); }

.seg.is-active {
  background: var(--ink);
  color: var(--on-ink);
}

/* --- Icon buttons -------------------------------------------------------
   The guide's button-icon-circular: 1px hairline, round, quiet. */

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--canvas);
  color: var(--steel);
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}

.icon-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--line-strong); background: var(--surface-soft); }
.icon-btn:active:not(:disabled) { transform: scale(.95); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.theme-btn { position: relative; overflow: hidden; }

.theme-btn .icon {
  position: absolute;
  transition: transform .28s var(--pop), opacity .2s var(--ease);
}

.theme-btn .i-sun { opacity: 1; transform: none; }
.theme-btn .i-moon { opacity: 0; transform: translateY(140%) rotate(45deg); }

[data-theme="dark"] .theme-btn .i-sun { opacity: 0; transform: translateY(-140%) rotate(-45deg); }
[data-theme="dark"] .theme-btn .i-moon { opacity: 1; transform: none; }

/* --- Layout ------------------------------------------------------------ */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--pad) + .25rem) var(--pad) calc(3rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* card-base in the guide: canvas, 12px corners, one hairline, no shadow. */
.card {
  background: var(--canvas);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  padding: 24px;
}

/* --- Banner -------------------------------------------------------------
   A banner marks a real state, so it gets a wash and a hairline; the text stays
   ink so it is readable, and only the icon carries the colour. */

.banner {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  font-size: 14px;
  background: var(--surface-soft);
  color: var(--charcoal);
}

.banner .banner-icon { flex: none; display: grid; place-items: center; color: var(--steel); }
.banner.is-warn { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.banner.is-warn .banner-icon { color: var(--warn); }
.banner strong { font-weight: 600; color: var(--ink); }

/* button-secondary: outlined pill, ink text. */
.banner-action {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: var(--tap);
  padding: .3rem .9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.banner-action:hover { background: var(--canvas); border-color: var(--ink); }

/* --- Admin code ---------------------------------------------------------
   The heading is the guide's heading-4; the note is body-md at 16/1.5, which the
   guide insists is never compressed. */

.eyebrow {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--steel);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.eyebrow .icon { width: 14px; height: 14px; }

/* --- Day navigation ----------------------------------------------------- */

.day-nav {
  order: 2;
  margin-left: .15rem;
  flex: none;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.day-nav .icon-btn { width: var(--tap); height: var(--tap); }

.today-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: var(--tap);
  padding: 0 .8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.today-pill .icon { width: 15px; height: 15px; }
.today-pill:hover { background: var(--surface); border-color: var(--ink); }

/* A date picker is an input, so it takes the guide's text-input shape. */
.date-input {
  min-height: var(--tap);
  padding: 0 .6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}

[data-theme="dark"] .date-input::-webkit-calendar-picker-indicator { filter: invert(.8); }

/* --- The day row in the app bar ---------------------------------------- */

.appbar-tools { order: 2; }   /* phone: brand on line 1, day row below it */

.bar-day {
  order: 3;
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .35rem .7rem;
}

.bar-title {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  min-width: 0;
  font-size: 18px;          /* heading-5 */
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.4;
  color: var(--ink);
}

.bar-title-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-title-day {
  flex: none;
  color: var(--steel);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.bar-date { display: none; }   /* the day word is enough on a phone */

/* --- The clock in the app bar -------------------------------------------- */

/* Ahead of the day arrows in the day row.  That row already says which day you are
   looking at; this says what time it is where that day ends - the thing a crew needs
   when a shift runs past midnight, and the thing that says whether the page in front
   of them is still current.  Amber is the day having moved on; see the clock section
   at the end of index.php.
   It is set in Geist Mono because it is a readout, not a button: the minutes change
   under tabular figures and do not jitter. */
.bar-clock {
  order: 1;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: var(--tap);        /* it links to today, so it is a 44px target */
  padding: 0 .7rem;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  color: var(--charcoal);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-decoration: none;
  touch-action: manipulation;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}

.bar-clock:hover { border-color: var(--line-strong); background: var(--surface); }
.bar-clock .icon { width: 15px; height: 15px; color: var(--steel); }

/* whose time it is, once there is room to say it; the pill's title always does */
.clock-zone { display: none; }

/* On a phone the day row is tight - the checklist's name, the day word, the two
   arrows and, for a past day, a Today pill all live on that line.  So there the time
   reads as part of the date rather than as another button: no frame, no padding. */
@media (max-width: 560px) {
  /* On a phone it reads as part of the date rather than as another button, but it
     is still a link, so the target stays 44 tall and only the frame goes away. */
  .bar-clock {
    min-height: var(--tap);
    padding: 0 .3rem;
    border-color: transparent;
    background: transparent;
  }

  .bar-clock:hover { background: transparent; border-color: transparent; }

  /* unless the day has moved on, when it earns the frame back */
  .bar-clock.is-rollover {
    padding: 0 .55rem;
    border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  }
}

.bar-clock.is-rollover {
  color: var(--warn-ink);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: var(--warn-wash);
}

.bar-clock.is-rollover .icon { color: var(--warn); }

@media (max-width: 359px) {
  .bar-title-day { display: none; }
  .bar-title-name { max-width: 52vw; }
  .bar-clock { padding: 0 .5rem; font-size: 12px; }
  .bar-clock .icon { display: none; }   /* a narrow phone needs the room for the time */
}

.bar-progress {
  flex: 0 1 auto;
  order: 3;
  margin-left: auto;      /* the meter sits at the far end of the day row */
  display: flex;
  align-items: center;
  min-width: 0;
}

.bar-progress .progress {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-width: 0;
}

.bar-progress .progress-top {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  margin: 0;
  white-space: nowrap;
  flex: none;      /* the words never shrink: the track is what gives */
}

.bar-progress .progress-count { margin-left: 0; }
.bar-progress .progress-label { display: none; }

/* The meter is the only part of this row allowed to shrink, so a tight bar loses a
   few pixels of track rather than cutting the count off mid-digit. */
.bar-progress { flex: 0 1 auto; min-width: 0; }

/* on a phone the meter is the thin line along the bottom of the bar, so the
   day, the arrows and the count all fit on one row above it */
.bar-progress .progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.bar-progress .progress-fill { border-radius: 0; }

.bar-progress-empty {
  flex: 1 1 100%;
  margin: 0;
  color: var(--steel);
  font-size: 13px;
}

/* --- Progress ---------------------------------------------------------- */

.progress { margin: 0; }

.progress-top {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .5rem;
}

.progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.progress-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* The track gets the same stone edge every other control has: a meter nobody can
   see is not a meter, and #f5f5f5 on white disappears. */
.progress-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* Solid mint, no gradient: the meter answers "how far along is the day", and one
   colour answers that on its own. */
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--mint);
  transition: width .45s var(--ease);
}

.progress.is-complete .progress-fill { background: var(--mint-deep); }
.progress.is-complete .progress-count { color: var(--ok-ink); }

.progress-empty { color: var(--steel); font-size: 14px; }

/* --- Category ----------------------------------------------------------
   A category is the guide's card-base; the lines inside it are its property
   rows: hairline dividers, not nested pills. The name is heading-5 and the
   count is mono, because the count is data. */

.category {
  background: var(--canvas);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  overflow: clip;
}

.category + .category { margin-top: 0; }

.category-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--edge);
}

.category-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

/* The count chip. Mono figures, and the mint wash only once the category is
   genuinely finished. */
.category-count {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  color: var(--charcoal);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.category-count.is-done {
  background: var(--mint-wash);
  border-color: color-mix(in srgb, var(--mint) 45%, transparent);
  color: var(--ok-ink);
}

.category-count .icon { width: 14px; height: 14px; }

/* --- Items ------------------------------------------------------------- */

.items {
  list-style: none;
  margin: 0;
  padding: 2px 20px;
  display: flex;
  flex-direction: column;
}

.item {
  position: relative;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: transparent;
  transition: background-color var(--dur) var(--ease);
}

.item:last-child { border-bottom: 0; }

.item:hover { background: var(--surface-soft); }

/* Done is a state, so it gets the guide's soft mint wash; the words go quiet and
   strike through rather than the row shouting. */
.item.is-done { background: var(--mint-wash); }

.item.is-saving { opacity: .55; }

.item-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 12px 12px;
  min-height: 52px;
}

.item-hit {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  min-height: var(--tap);   /* ticking the line by its words, not only by its box */
  flex: 1 1 auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.item-hit.is-static { cursor: default; }

/* The box: 24px with a 6px corner, stone border so the control clears 3:1 against
   the page, and an invisible 10px ring that makes the real target 44px. Checked, it
   takes the mint with an ink tick - the guide's own accent-on-done treatment. */
.item-cb {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 24px;
  height: 24px;
  flex: none;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--canvas);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.item-cb::before {
  /* invisible hit-area expander so the target is >=44px on touch screens */
  content: "";
  position: absolute;
  inset: -10px;
}

.item-cb:hover { border-color: var(--ink); }

.item-cb:checked {
  background: var(--mint);
  border-color: var(--mint);
  animation: cb-pop .22s var(--pop);
}

.item-cb:checked::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 5px;
  height: 10px;
  border: solid var(--on-mint);
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(43deg);
}

.item-cb:disabled { opacity: .45; cursor: not-allowed; }

@keyframes cb-pop {
  0% { transform: scale(.9); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.item-main { min-width: 0; }

.item-text {
  display: block;
  font-size: 16px;          /* body-md-medium, the guide's working size */
  font-weight: 500;
  letter-spacing: -.011em;
  line-height: 1.35;
  color: var(--ink);
  transition: color var(--dur) var(--ease);
}

.item.is-done .item-text {
  color: var(--steel);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--steel) 55%, transparent);
  text-decoration-thickness: 1px;
}

.item-comment {
  display: block;
  margin-top: .1rem;
  color: var(--steel);
  font-size: 13px;
  line-height: 1.4;
}

.item.is-done .item-comment { opacity: .75; }

/* --- Note input -------------------------------------------------------- */

.item-side {
  flex: none;
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-left: auto;
  position: relative;
}

.note-input {
  width: clamp(9rem, 26vw, 13.5rem);
  min-height: var(--tap);
  padding: .4rem .7rem .4rem 1.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px; /* keep >=16px so iOS never zooms on focus */
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.note-input::placeholder { color: var(--steel); }
.note-input:hover { border-color: var(--ink); }

/* The guide's focused input: the border thickens to 2px mint. The keyboard ring
   from :focus-visible stays on top of it, because mint alone is not visible
   enough to be the only indicator. */
.note-input:focus {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px var(--mint);
}

.note-input:disabled { background: var(--surface); color: var(--steel); cursor: not-allowed; }

.note-wrap { position: relative; display: flex; align-items: center; }

.note-wrap > .icon {
  position: absolute;
  left: .55rem;
  width: 15px;
  height: 15px;
  color: var(--stone);
  pointer-events: none;
}

/* Saved: the flag is the only mint that moves, and it only says "that is stored". */
.note-flag {
  position: absolute;
  right: .55rem;
  display: inline-flex;
  color: var(--mint-deep);
  opacity: 0;
  transform: scale(.7);
  transition: all .2s var(--pop);
  pointer-events: none;
}

.note-flag.is-on { opacity: 1; transform: none; }

/* --- Entry types: sub-headings, day fields, machine checks -------------- */

/* a sub-heading inside a card, e.g. the lift a run belongs to */
.item.is-heading {
  background: transparent;
  border-bottom: 0;
}

.item.is-heading:hover { background: transparent; }

.item-heading {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem 12px .35rem 2.9rem; /* lines up with the text under it */
  color: var(--steel);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.item-heading::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

/* a labelled value the crew fills in for the day */
.field-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.field-box { position: relative; display: inline-flex; align-items: center; }

/* A reading is data, so the figures a day fills in are set in Geist Mono. The size
   stays at 16px: below that iOS zooms the page in on focus and the crew loses the
   row they are typing in. */
.field-input {
  width: clamp(7rem, 20vw, 11.5rem);
  min-height: var(--tap);
  padding: .4rem 1.7rem .4rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px; /* >=16px so iOS never zooms on focus */
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.field-input::placeholder { color: var(--steel); }
.field-input:hover { border-color: var(--ink); }

.field-input:focus {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px var(--mint);
}

.field-input:disabled { background: var(--surface); color: var(--steel); cursor: not-allowed; }

/* prose, not a reading: back to Inter */
textarea.field-input.is-area {
  width: min(100%, 24rem);
  min-height: 52px;
  padding: .45rem .7rem;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.4;
  resize: vertical;
}

.field-unit {
  color: var(--steel);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

/* the two boxes a machine check gets: what is wrong, and what fixed it */
.item-side.is-wide {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .35rem;
}

.check-wrap { position: relative; display: inline-flex; align-items: center; }

.check-input {
  width: clamp(6.5rem, 17vw, 10.5rem);
  min-height: var(--tap);
  padding: .35rem 1.6rem .35rem .6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px; /* >=16px: no iOS focus zoom */
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.check-input::placeholder { color: var(--steel); }
.check-input:hover { border-color: var(--ink); }

.check-input:focus {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px var(--mint);
}

.check-input:disabled { background: var(--surface); color: var(--steel); cursor: not-allowed; }

/* the little OK tag on a machine check: the guide's badge-type chip, mono, and it
   changes once the check is actually ticked */
.item-tag {
  display: inline-block;
  margin-left: .45rem;
  padding: .1rem .45rem;
  border: 1px solid var(--edge);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--steel);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
}

.item.is-done .item-tag {
  background: var(--mint-wash);
  border-color: color-mix(in srgb, var(--mint) 45%, transparent);
  color: var(--ok-ink);
}

.note-static.is-empty { color: var(--steel); font-style: normal; }

/* the entry type, shown in Admin: check / task / group / field is a type
   signature, which is exactly what the guide sets in Geist Mono */
.kind-badge {
  flex: none;
  padding: .15rem .5rem;
  border: 1px solid var(--edge);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--steel);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

/* --- Grouped lines: one name, several boxes ----------------------------- */

.item.is-group .item-form { align-items: flex-start; }

.item-side.is-parts {
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
}

.part-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .3rem;
}

/* The padding lives on the label inside the pill, not on the pill, so the whole
   visible pill is the finger target rather than a 22px box in the middle of it. */
.part {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--canvas);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.part:hover { border-color: var(--line-strong); }

.part.is-done {
  background: var(--mint-wash);
  border-color: color-mix(in srgb, var(--mint) 45%, transparent);
}

.part-hit {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: var(--tap);
  padding: 0 .7rem 0 .45rem;
  cursor: pointer;
}

.part-label {
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.part.is-done .part-label { color: var(--ok-ink); }

/* a slightly smaller box inside the pill, with the tick grown to match */
.part .item-cb {
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
}

.part .item-cb::before { inset: -11px; }

.part .item-cb:checked::after {
  left: 7px;
  top: 4px;
  width: 4px;
  height: 9px;
  border-width: 0 2.2px 2.2px 0;
}

.note-form { display: inline-flex; }

/* --- Empty state ------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 2rem 1rem;
  color: var(--steel);
  font-size: 14px;
  text-align: center;
}

.empty .icon { width: 24px; height: 24px; color: var(--stone); }

/* --- Admin mode --------------------------------------------------------
   The same panel and row language as the day view, with one addition: a toggle
   that is on takes the ink pill, not the mint. Mint stays reserved for work that
   is finished, so a screen of admin toggles cannot dilute it. */

.acat {
  padding: 20px;
  border-radius: var(--r-lg);
}

.acat + .acat { margin-top: 1rem; }

.acat-head,
.arow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .5rem;
}

.acat-head {
  padding-bottom: .75rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid var(--edge);
}

.aitem {
  padding: .65rem 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  transition: background-color var(--dur) var(--ease);
}

.aitem:last-child { border-bottom: 0; }
.aitem:hover { background: var(--surface-soft); }

.aitems {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.agroup { display: flex; align-items: center; gap: .25rem; }
.arow-flags { margin-left: auto; }

.afield {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 1 1 12rem;
  min-width: 0;
}

.arow-text { flex: 1 1 14rem; }

.afield-label {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--steel);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ainput {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  padding: .4rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px; /* >=16px: no iOS focus zoom */
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.ainput:hover { border-color: var(--ink); }

.ainput:focus {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px var(--mint);
}

.ainput::placeholder { color: var(--steel); }
.ainput.is-name { font-weight: 600; color: var(--ink); }
.ainput.is-comment { color: var(--charcoal); }

/* Row tools are square (8px): the round buttons up in the bar are a different
   family, and these sit in a dense grid where squares pack better. */
.abtn {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--steel);
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}

.abtn:hover:not(:disabled) { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
.abtn:active:not(:disabled) { transform: scale(.95); }
.abtn:disabled { opacity: .35; cursor: not-allowed; }

.abtn.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.abtn.is-danger:hover:not(:disabled) {
  color: var(--danger-ink);
  border-color: var(--danger);
  background: var(--danger-wash);
}

.abtn.is-save:hover:not(:disabled) { color: var(--ok-ink); border-color: var(--ok-ink); }

.aadd { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }

.aadd .ainput { flex: 1 1 auto; min-height: 44px; }

/* button-primary: the ink pill. It goes to charcoal when pressed, which is the
   guide's own pressed state rather than a made-up one. */
.btn-add {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.btn-add:hover { background: var(--charcoal); border-color: var(--charcoal); }
.btn-add:active { transform: scale(.98); }
.btn-add:disabled { background: var(--line); border-color: var(--line); color: var(--muted); }

/* Adding a category is a form like any other, so it gets a panel and a hairline
   rather than a dashed outline pretending to be a drop zone. */
.aadd.is-dashed {
  margin: 1rem 0 0;
  padding: 20px;
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
}

.admin-hint {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--steel);
  font-size: 13px;
  margin-bottom: .75rem;
}

/* --- Admin code -------------------------------------------------------- */

.code-card .eyebrow { margin-bottom: .35rem; }

.code-title {
  margin: 0 0 .4rem;
  font-size: 22px;          /* heading-4 */
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--ink);
}

.code-note {
  margin: 0 0 1.1rem;
  max-width: 46ch;
  color: var(--slate);
  font-size: 16px;
  line-height: 1.5;
}

.code-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

/* Letter-spacing on four digits is what makes them read as a code rather than a number,
   and it leaves a gap after the last one, so the text is pushed back by half of it to
   sit centred in the box. */
.code-input {
  width: 10ch;
  min-height: var(--tap);
  padding: .4rem .5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 20px;          /* >=16px: iOS does not zoom in on focus */
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3em;
  text-align: center;
  text-indent: .15em;
  touch-action: manipulation;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.code-input:hover { border-color: var(--ink); }

.code-input:focus {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px var(--mint);
}

.code-input::placeholder { color: var(--stone); }

.code-denied {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .9rem 0 0;
  color: var(--danger-ink);
  font-size: 14px;
  font-weight: 600;
}

.code-denied .icon { width: 16px; height: 16px; flex: none; color: var(--danger); }

.code-hint {
  margin: .9rem 0 0;
  color: var(--steel);
  font-size: 13px;
}

/* The Lock button lives with a banner's actions, which are links, so it borrows their
   look and gives back everything a <button> brings with it. */
.banner-form {
  margin-left: auto;
  display: inline-flex;
}

.banner-form .banner-action { margin-left: 0; }

button.banner-action {
  font-family: inherit;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  touch-action: manipulation;
}

/* --- Toast -------------------------------------------------------------
   The guide's promo-banner inverted: ink surface, white type, one mint mark. It
   is the only thing on the page that floats, which is why it is the only thing
   with a real shadow. */

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  width: max-content;
  max-width: min(92vw, 30rem);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem .95rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: #0a0a0a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--el-2);
  animation: toast-in .24s var(--ease) both;
}

.toast.is-out { animation: toast-out .18s var(--ease) both; }
.toast .icon { width: 17px; height: 17px; color: var(--mint); }
.toast.is-error { background: #2a0f0f; border-color: #5a2222; }
.toast.is-error .icon { color: #ff8f8f; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* --- Motion ------------------------------------------------------------
   Dial MOTION 1: state feedback only (the tick, the saved flag, the toast). The
   staggered card entrance that used to be here is gone - nothing on this page
   needs to arrive in order. */

/* --- Utilities --------------------------------------------------------- */

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

/* The footer line is machine data about the sheet: counts and a timezone. */
.stack-note {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--steel);
  text-align: center;
  padding: .5rem 0 0;
}

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

/* --- Responsive -------------------------------------------------------- */

/* Hover effects only where hover is real, so states don't stick on touch. */
@media (hover: none) {
  .item:hover { background: transparent; }
  .item.is-done:hover { background: var(--mint-wash); }
  .aitem:hover { background: transparent; }
}

@media (max-width: 700px) {
  .item-side { width: auto; }
}

@media (max-width: 560px) {
  :root { --pad: 1rem; }

  .wrap { gap: .8rem; }

  .items { padding: 2px 12px; }
  .category-head { padding: 14px 16px 12px; }

  /* note input drops to its own line, aligned under the item text */
  .item-form { flex-wrap: wrap; gap: .5rem .6rem; padding: .6rem .7rem; }
  .item-hit { flex: 1 1 100%; }
  .item-side {
    flex: 1 1 100%;
    margin-left: 46px; /* checkbox width + gap => lines up with text */
  }
  .note-input { width: 100%; }

  /* the bar's day row stays tight: title left, arrows right, count under */
  .bar-day { gap: .25rem .5rem; }
  .bar-title { font-size: 17px; }
  .day-nav .icon-btn, .today-pill { flex: none; }
  .today-pill { padding: 0 .65rem; }
  .date-input { flex: 1 1 auto; min-width: 0; }

  /* admin rows collapse to a tidy two-line layout */
  .acat { padding: .8rem; }

  .acat-head,
  .arow {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .45rem .5rem;
  }

  .acat-name, .arow-text { grid-column: 1 / -1; grid-row: 1; }
  .acat-move, .arow-move { grid-column: 1; grid-row: 2; }
  .acat-tools, .arow-flags { grid-column: 2; grid-row: 2; justify-self: end; margin-left: 0; }

  .arow-sub { grid-column: 1 / -1; }
  .afield-label { width: auto; }
  .aadd { flex-wrap: nowrap; }
  .btn-add { padding: 0 .9rem; }
}

@media (max-width: 400px) {
  /* Only type shrinks here. The 44px targets hold all the way down: a narrow
     phone needs bigger things to hit, not smaller ones. */
  .brand-name { display: none; }
  .seg { padding: 0 .55rem; font-size: 12px; }
  .tab { padding: 0 .8rem; font-size: 13px; }
  .btn-add { padding: 0 .8rem; }
}

/* Category badge tick only shows once the category is finished. */
.count-icon { display: none; align-items: center; }
.category-count.is-done .count-icon { display: inline-flex; }

/* Read-only day: notes are shown as text, not as an editable field. The dot says
   "there is a note here", which is the only thing a dot is allowed to say. */
.note-static {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--charcoal);
  font-size: 14px;
}

.note-static::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--stone);
}

/* Banner stacks its action on narrow screens instead of wrapping mid-sentence. */
@media (max-width: 560px) {
  .banner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .4rem .6rem;
    align-items: center;
  }
  .banner-icon { grid-row: 1 / span 2; }
  .banner-action { grid-column: 2; justify-self: start; margin-left: 0; }
}

/* Touch ergonomics: no grey flash, no double-tap zoom delay, anchors clear the bar. */
a,
button,
label,
input[type="checkbox"],
input[type="submit"],
input[type="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html { scroll-padding-top: calc(var(--appbar-h) + 1rem); }

@media (max-width: 340px) {
  .btn-add .btn-label { display: none; }
  .btn-add { padding: 0 .7rem; }
}

/* Hint that the tab strip scrolls sideways on phones. */
.tabs {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
}

/* --- Entry types on small screens -------------------------------------- */

@media (max-width: 560px) {
  /* the sub-heading sits at the left edge, as the stacked item text does */
  .item-heading { padding-left: .7rem; }

  .item-side.is-wide { flex-direction: column; align-items: stretch; }

  /* the boxes of a grouped line wrap under the line they belong to */
  .item.is-group .item-form { align-items: center; }
  .item-side.is-parts { align-items: flex-start; }
  .part-list { justify-content: flex-start; }
  .note-form { width: 100%; }
  .note-form .note-wrap { width: 100%; }
  .field-box, .check-wrap { width: 100%; }
  .field-input, .check-input,
  textarea.field-input.is-area { width: 100%; }
  .field-unit { align-self: flex-start; }

  .arow-text { flex-wrap: wrap; }
}

/* --- Desktop layout ----------------------------------------------------- */

/* Additive on purpose: the phone keeps the single-column layout above.
   From 820px up the app bar runs the full width of the screen and the cards
   fill the row in as many columns as fit; from 1180px the day card turns into a
   sticky side rail, so the date, the day name and the progress bar stay on
   screen while the cards scroll past them. */

@media (min-width: 820px) {
  :root { --pad: clamp(1.25rem, 2.2vw, 2.25rem); }

  /* the bar is no longer tied to the reading column */
  .appbar-inner,
  .tabs { max-width: none; padding-inline: var(--pad); }

  .tabs {
    gap: .5rem;
    flex-wrap: wrap;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .tab { min-height: var(--tap); font-size: 14px; }

  .wrap {
    max-width: 1240px;
    gap: 1.25rem;
    padding: calc(var(--pad) + .5rem) var(--pad) 4rem;
  }

  /* as many cards side by side as fit, none narrower than 380px */
  .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 1.25rem;
    align-items: start;
  }

  /* admin cards carry inputs and toggles, so they get more room each */
  .cards.is-admin {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr));
  }

  /* one bar row: brand, then the day, then the mode switch at the far right */
  .appbar-inner { gap: 1rem 1.25rem; }
  .bar-day { order: 2; flex: 1 1 auto; gap: .5rem .9rem; }
  .appbar-tools { order: 3; }
  .bar-title { font-size: 20px; }
  .bar-title-name { max-width: 30ch; }
  .bar-title-day { font-size: 11px; }
  .bar-date {
    display: block;
    color: var(--steel);
    font-family: var(--font-mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .day-nav { gap: .45rem; }

  /* room to say whose time this is, rather than leaving it in the title */
  .clock-zone {
    display: inline;
    color: var(--steel);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  /* the meter reads as a meter again: a pill of track, label and count.
     Narrow enough that the bar still fits one row at 1280. */
  .bar-progress { flex: 0 1 214px; min-width: 176px; }
  .bar-progress .progress-track {
    position: static;
    flex: 1 1 112px;
    width: auto;
    min-width: 68px;
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--line);
    box-shadow: inset 0 0 0 1px var(--line-strong);
  }
  .bar-progress .progress-fill { border-radius: inherit; }
  .bar-progress .progress-label { display: inline; }
  .bar-progress-empty { flex: none; }

  .category { padding: 0; }

  /* on a long card (the groomed-run list) the name stays readable: solid canvas,
     one hairline, and the lift only once rows actually pass under it */
  .category-head {
    position: sticky;
    top: var(--appbar-h);   /* flush under the bar, so nothing peeks through */
    z-index: 3;
    padding: 18px 20px 14px;
    background: var(--canvas);
  }

  .items { padding: 4px 20px; }
  .item-form { padding: .65rem .8rem; flex-wrap: wrap; }
  .item-heading { padding-left: 3rem; } /* lines up with the item text beside it */

  /* a line that carries more than one box (a grouped line, or a machine check
     with its problem and solution fields) puts them under the text, lined up
     with it, instead of squeezing the text into a column */
  .item-side.is-wide,
  .item.is-group .item-side.is-parts {
    flex: 1 1 100%;
    margin-left: 46px;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .part-list { justify-content: flex-start; }

  /* problem and solution sit side by side when there is room, so a machine
     check is one line taller rather than three */
  .item-side.is-wide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }

  .check-wrap { width: 100%; }
  .check-input { width: 100%; }

  /* admin rows: the item text gets a line of its own instead of being
     squeezed between the toggles */
  .acat-head,
  .arow { flex-wrap: wrap; }
  .acat-name { flex: 1 1 14rem; min-width: 0; }
  .arow-text { flex: 1 1 15rem; min-width: 0; }
  .arow-text .ainput,
  .acat-name .ainput { min-width: 12rem; }

  .aadd.is-dashed { max-width: 640px; }
  .stack-note { text-align: left; padding-top: .25rem; }
}

@media (min-width: 1180px) {
  .wrap { max-width: 1560px; }
  .bar-date { font-size: 12px; }

  /* a long list takes the whole width and runs its lines down columns, which
     reads better than one tall column with a hole next to it */
  .cards > .category.is-long { grid-column: 1 / -1; }

  .is-long .items {
    display: block;
    columns: 2;
    column-gap: 12px;
  }

  .is-long .item { break-inside: avoid; margin: 0 0 .25rem; }
}

@media (min-width: 1400px) {
  .is-long .items { columns: 3; }
}

@media (min-width: 1700px) {
  .wrap { max-width: 1760px; }
  .cards { gap: 1.5rem; }
  .cards.is-admin { grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr)); }
}
