/* Fonts are bundled, not fetched. A shop PC on a flaky line, or no line at
   all, still gets the right typefaces. */
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/static/fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("/static/fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("/static/fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("/static/fonts/fraunces-latin-600-normal.woff2") format("woff2");
}

/* ═══════════════════════════════════════════════════════════════════
   The Apple Tree — rota

   Built like the paper rota that used to hang by the staff room door:
   ruled lines, printed shift times, names written into the boxes.
   Readable standing three feet from a wall tablet.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --ink:        #1A1D1A;
  --ink-soft:   #585C56;
  --ink-faint:  #8A8E86;
  --paper:      #FBFAF7;
  --card:       #FFFFFF;
  --line:       #D8D6CF;
  --line-soft:  #EBE9E3;

  --leaf:       #1F5D3A;
  --leaf-deep:  #16452B;
  --leaf-soft:  #E4EFE7;

  /* Availability. These three are fixed by how the shop reads them. */
  --yes:        #FFFFFF;
  --yes-edge:   #1F5D3A;
  --maybe:      #F6D174;
  --maybe-edge: #B98900;
  --maybe-ink:  #5C4300;
  --no:         #E8B4AE;
  --no-edge:    #B03A2B;
  --no-ink:     #7A2318;
  --shut:       #E8E6E0;

  --warn:       #B03A2B;
  --warn-soft:  #FBEDEB;

  --tap:        56px;
  --radius:     10px;
  --radius-sm:  6px;

  --shadow: 0 1px 2px rgba(26,29,26,.07), 0 4px 14px rgba(26,29,26,.05);

  --sans: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F0EFEA; --ink-soft: #AEB2A9; --ink-faint: #7C8178;
    --paper: #141714; --card: #1D211D; --line: #343A33; --line-soft: #272C26;
    --leaf: #6FBF8C; --leaf-deep: #8ED2A6; --leaf-soft: #1E2E24;
    --yes: #1D211D; --yes-edge: #6FBF8C;
    --maybe: #6A5312; --maybe-edge: #D9A520; --maybe-ink: #F7DE9E;
    --no: #52211A; --no-edge: #D4705F; --no-ink: #F3C4BB;
    --shut: #262B25;
    --warn: #E08575; --warn-soft: #3A201B;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --ink: #F0EFEA; --ink-soft: #AEB2A9; --ink-faint: #7C8178;
  --paper: #141714; --card: #1D211D; --line: #343A33; --line-soft: #272C26;
  --leaf: #6FBF8C; --leaf-deep: #8ED2A6; --leaf-soft: #1E2E24;
  --yes: #1D211D; --yes-edge: #6FBF8C;
  --maybe: #6A5312; --maybe-edge: #D9A520; --maybe-ink: #F7DE9E;
  --no: #52211A; --no-edge: #D4705F; --no-ink: #F3C4BB;
  --shut: #262B25;
  --warn: #E08575; --warn-soft: #3A201B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .7em; }
a  { color: var(--leaf); }

:focus-visible {
  outline: 3px solid var(--leaf);
  outline-offset: 2px;
  border-radius: 3px;
}

.muted  { color: var(--ink-soft); }
.faint  { color: var(--ink-faint); font-size: .92rem; }
.nums   { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────────── */

button, .btn {
  font: inherit; font-weight: 600;
  min-height: 44px; padding: .55em 1.1em;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover:not(:disabled) { border-color: var(--ink-faint); }
button:disabled { opacity: .45; cursor: not-allowed; }

.btn-main {
  background: var(--leaf); border-color: var(--leaf); color: #fff;
}
.btn-main:hover:not(:disabled) { background: var(--leaf-deep); border-color: var(--leaf-deep); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-quiet:hover:not(:disabled) { background: var(--line-soft); border-color: transparent; }

.btn-warn { color: var(--warn); border-color: var(--warn); background: transparent; }
.btn-warn:hover:not(:disabled) { background: var(--warn-soft); }

.btn-sm { min-height: 34px; padding: .25em .7em; font-size: .9rem; }

.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* ─────────────────────────────────────────────────────────────────
   FORM FIELDS
   ───────────────────────────────────────────────────────────────── */

input, select, textarea {
  font: inherit;
  padding: .5em .7em;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  min-height: 44px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--leaf); }

label.field { display: block; margin-bottom: .9rem; }
label.field > span {
  display: block; margin-bottom: .25rem;
  font-weight: 600; font-size: .95rem;
}

/* ─────────────────────────────────────────────────────────────────
   THE WALL TABLET
   ───────────────────────────────────────────────────────────────── */

.clock-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 400px);
  grid-template-rows: 1fr auto;
  gap: 1rem 3rem;
  align-items: center;
  padding: 3vh 5vw 1.5vh;
  max-width: 1400px; margin: 0 auto;
}

.clock-face { min-width: 0; }

.clock-time {
  font-family: var(--display);
  font-size: clamp(5rem, 15vw, 11rem);
  font-weight: 600;
  line-height: .85;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.clock-time small {
  font-size: .3em; font-weight: 600;
  color: var(--ink-soft); margin-left: .18em;
}
.clock-date {
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  color: var(--ink-soft); margin-top: .6rem;
}
.clock-shop {
  font-family: var(--display);
  font-size: 1.15rem; color: var(--leaf);
  margin-bottom: 1.6rem;
}

.onnow { margin-top: 2.5rem; border-top: 1.5px solid var(--line); padding-top: 1.2rem; }
.onnow h2 { font-size: 1rem; color: var(--ink-soft); font-weight: 600; margin-bottom: .7rem; }
.onnow ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.onnow li {
  background: var(--leaf-soft); color: var(--leaf-deep);
  border: 1.5px solid var(--leaf); border-radius: 100px;
  padding: .35em .9em; font-weight: 600;
}
.onnow li span { font-weight: 400; opacity: .75; margin-left: .4em; }

.keypad { display: grid; gap: .7rem; }
.pin-display {
  height: 72px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  gap: .8rem; font-size: 2.4rem; letter-spacing: .3em;
}
.pin-display .dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--leaf);
}
.pin-display .ghost { color: var(--ink-faint); font-size: 1.05rem; letter-spacing: 0; }

.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.keys button {
  height: var(--tap); font-size: 1.7rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.keys button.wide { grid-column: span 1; }
.key-go { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.key-go:hover:not(:disabled) { background: var(--leaf-deep); }

.clock-message {
  margin-top: 1rem; padding: 1rem 1.1rem;
  border-radius: var(--radius); border: 1.5px solid var(--leaf);
  background: var(--leaf-soft); color: var(--leaf-deep);
  font-size: 1.1rem; font-weight: 600;
  min-height: 0;
}
.clock-message.bad { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }

.tablet-foot {
  grid-column: 1 / -1;
  display: flex; justify-content: center; gap: .5rem;
  padding-top: 1rem;
}

@media (max-width: 900px) {
  .clock-screen { grid-template-columns: 1fr; gap: 1.5rem; padding: 3vh 5vw; }
  .clock-time { font-size: clamp(4rem, 22vw, 7rem); }
  .onnow { margin-top: 1.2rem; }
}

/* ─────────────────────────────────────────────────────────────────
   APP SHELL — one bar, never nested
   ───────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1.5px solid var(--line);
  background: var(--card);
  padding: 1.3rem 0;
  display: flex; flex-direction: column;
}
.brand {
  font-family: var(--display); font-size: 1.15rem; font-weight: 600;
  color: var(--leaf); padding: 0 1.3rem 1.2rem;
}
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .6rem; }
.nav button {
  border: none; background: transparent; text-align: left;
  padding: .7em .75em; border-radius: var(--radius-sm);
  font-size: 1.02rem; font-weight: 500; color: var(--ink-soft);
  display: flex; justify-content: space-between; align-items: center;
  min-height: 46px;
}
.nav button:hover { background: var(--line-soft); }
.nav button[aria-current="page"] {
  background: var(--leaf-soft); color: var(--leaf-deep); font-weight: 700;
}
.nav .tally {
  font-size: .8rem; font-weight: 700; min-width: 22px; text-align: center;
  background: var(--warn); color: #fff; border-radius: 100px; padding: .1em .45em;
}
.nav button[aria-current="page"] .tally { background: var(--leaf); }

.sidebar-foot { margin-top: auto; padding: 1rem 1.3rem 0; }

.main { min-width: 0; padding: 1.8rem 2rem 4rem; max-width: 1180px; }
.page-head { margin-bottom: 1.5rem; }
.page-head p { color: var(--ink-soft); margin: .3rem 0 0; max-width: 62ch; }

@media (max-width: 820px) {
  /* auto / 1fr, or the two rows share the viewport and the bar grows
     to half the screen. minmax(0,…) so a grid item can be narrower than
     its contents -- without it the nav's scroller widens the whole page. */
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sidebar {
    border-right: none; border-bottom: 1.5px solid var(--line);
    padding: .8rem 0 0; position: sticky; top: 0; z-index: 20;
    display: block; min-width: 0; overflow: hidden;
  }
  .main { min-width: 0; }
  .brand { padding: 0 1rem .7rem; }
  .nav {
    flex-direction: row; overflow-x: auto; padding: 0 .6rem .5rem;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { white-space: nowrap; min-height: 42px; }
  .sidebar-foot { display: none; }
  .main { padding: 1.2rem 1rem 5rem; }
}

/* ─────────────────────────────────────────────────────────────────
   CARDS AND LISTS
   ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.card > h2, .card > h3 { margin-bottom: .6rem; }

.stats { display: flex; flex-wrap: wrap; gap: 1.8rem; margin-bottom: 1.4rem; }
.stat .n {
  font-family: var(--display); font-size: 2.3rem; font-weight: 600;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.stat .k { color: var(--ink-soft); font-size: .95rem; margin-top: .25rem; }
.stat.alert .n { color: var(--warn); }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  padding: .7rem 0; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.plain-list li:last-child { border-bottom: none; }

.empty {
  padding: 2.2rem 1.2rem; text-align: center; color: var(--ink-soft);
  border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty strong { display: block; color: var(--ink); margin-bottom: .3rem; }

.notice {
  border-left: 4px solid var(--leaf); background: var(--leaf-soft);
  color: var(--leaf-deep); padding: .85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 1rem;
}
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }

/* ─────────────────────────────────────────────────────────────────
   THE ROTA GRID — shifts down the side, days across the top
   ───────────────────────────────────────────────────────────────── */

.rota-bar {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.rota-when { font-weight: 700; font-size: 1.1rem; min-width: 11ch; }

.grid-scroll { overflow-x: auto; padding-bottom: .4rem; }

.rota-grid {
  display: grid;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
  gap: 1px;
  min-width: 860px;
}

.rota-grid > * { background: var(--card); }

.gcell { padding: .5rem; min-height: 64px; }

.ghead {
  padding: .55rem .6rem; text-align: left;
  background: var(--paper);
  border-bottom: 1.5px solid var(--line);
}
.ghead .d { font-weight: 700; }
.ghead .n { color: var(--ink-soft); font-size: .9rem; }
.ghead.is-today { background: var(--leaf-soft); }
.ghead.is-today .d { color: var(--leaf-deep); }
.ghead button {
  border: none; background: none; padding: 0; text-align: left;
  min-height: 0; font: inherit; width: 100%; cursor: pointer;
}
.ghead button:hover .d { text-decoration: underline; }

.gside {
  background: var(--paper);
  padding: .6rem; border-right: 1.5px solid var(--line);
  display: flex; flex-direction: column; justify-content: center;
}
.gside .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.gside .nm { color: var(--ink-soft); font-size: .88rem; }

.gcell.shut {
  background: repeating-linear-gradient(
    -45deg, var(--shut), var(--shut) 7px, transparent 7px, transparent 14px);
  display: flex; align-items: center; justify-content: center;
}
.gcell.shut span { color: var(--ink-soft); font-size: .88rem; font-weight: 600; }

.gcell.drop-on { background: var(--leaf-soft); box-shadow: inset 0 0 0 2px var(--leaf); }

.who {
  display: block; width: 100%; text-align: left;
  background: var(--yes); border: 1.5px solid var(--yes-edge);
  border-radius: var(--radius-sm);
  padding: .35rem .55rem; margin-bottom: .35rem;
  font-weight: 600; font-size: .97rem;
  cursor: grab; min-height: 38px;
  touch-action: none;
}
.who:last-child { margin-bottom: 0; }
.who:active { cursor: grabbing; }
.who.dragging { opacity: .4; }
.who.lifted { box-shadow: 0 0 0 2px var(--leaf); }
.who.maybe { background: var(--maybe); border-color: var(--maybe-edge); color: var(--maybe-ink); }
.who.clash { background: var(--no); border-color: var(--no-edge); color: var(--no-ink); }
.who.open {
  background: transparent; border-style: dashed; border-color: var(--warn);
  color: var(--warn); font-weight: 600;
}

/* Adding somebody is routine, so it stays quiet until you reach for it. */
.add-here {
  display: block; width: 100%; min-height: 26px; padding: 0;
  border: none; background: none; color: var(--ink-faint);
  font-size: 1.1rem; line-height: 1; border-radius: var(--radius-sm);
  opacity: .5;
}
.add-here:hover, .add-here:focus-visible {
  opacity: 1; background: var(--leaf-soft); color: var(--leaf-deep);
  border: none;
}
.who .pin { float: right; opacity: .5; font-size: .85rem; }

.gfoot {
  background: var(--paper); border-top: 1.5px solid var(--line);
  padding: .45rem .6rem; font-variant-numeric: tabular-nums;
  font-size: .9rem; color: var(--ink-soft);
}
.gfoot b { color: var(--ink); font-weight: 700; }
.gfoot .last { font-style: italic; }

.drag-ghost {
  position: fixed; z-index: 999; pointer-events: none;
  background: var(--card); border: 1.5px solid var(--leaf);
  border-radius: var(--radius-sm); padding: .35rem .6rem;
  font-weight: 600; box-shadow: var(--shadow);
}

.bin {
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  padding: .5rem 1rem; color: var(--ink-soft); font-weight: 600;
}
.bin.drop-on { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }

/* ─────────────────────────────────────────────────────────────────
   AVAILABILITY — the three states, tapped to cycle
   ───────────────────────────────────────────────────────────────── */

.days-grid { display: grid; gap: .55rem; }
.day-row {
  display: grid; grid-template-columns: 5.5rem 1fr;
  gap: .55rem; align-items: stretch;
}
.day-row > .dname {
  display: flex; align-items: center; font-weight: 700;
}
.day-row .picks { display: grid; grid-auto-flow: column; gap: .55rem; }

.pick {
  border: 2px solid var(--yes-edge); background: var(--yes);
  border-radius: var(--radius-sm); padding: .5rem .4rem;
  min-height: 62px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; gap: .1rem;
}
.pick .when { font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; }
.pick .say  { font-size: .84rem; }
.pick.maybe { background: var(--maybe); border-color: var(--maybe-edge); color: var(--maybe-ink); }
.pick.no    { background: var(--no); border-color: var(--no-edge); color: var(--no-ink); }

.key-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.key-legend span { display: flex; align-items: center; gap: .4rem; font-size: .93rem; }
.swatch {
  width: 18px; height: 18px; border-radius: 4px;
  border: 2px solid var(--yes-edge); background: var(--yes);
}
.swatch.maybe { background: var(--maybe); border-color: var(--maybe-edge); }
.swatch.no    { background: var(--no); border-color: var(--no-edge); }

@media (max-width: 620px) {
  .day-row { grid-template-columns: 1fr; gap: .3rem; }
  .day-row > .dname { padding-top: .4rem; }
  .day-row .picks { grid-auto-flow: row; }
  .pick { min-height: 54px; flex-direction: row; justify-content: space-between;
          align-items: center; padding: .5rem .8rem; text-align: left; }
}

/* ─────────────────────────────────────────────────────────────────
   MY SHIFTS (phone)
   ───────────────────────────────────────────────────────────────── */

.next-shift {
  border: 2px solid var(--leaf); border-radius: var(--radius);
  background: var(--leaf-soft); color: var(--leaf-deep);
  padding: 1.3rem; margin-bottom: 1.2rem;
}
.next-shift .lead { font-size: .95rem; font-weight: 600; opacity: .8; }
.next-shift .big {
  font-family: var(--display); font-size: clamp(1.9rem, 7vw, 2.7rem);
  font-weight: 600; line-height: 1.1; margin: .2rem 0;
}
.next-shift .with { font-size: .97rem; }

.shift-line {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line-soft);
}
.shift-line:last-child { border-bottom: none; }
.shift-line .dt { font-weight: 700; }
.shift-line .tm { font-variant-numeric: tabular-nums; }

/* ─────────────────────────────────────────────────────────────────
   TABLES — only where a table is genuinely the right shape
   ───────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line-soft); }
th { font-weight: 700; font-size: .92rem; color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

/* ─────────────────────────────────────────────────────────────────
   SALES BARS — the day panel
   ───────────────────────────────────────────────────────────────── */

.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin: 1rem 0 .4rem; }
.bars .bar { flex: 1; background: var(--leaf); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .bar.quiet { background: var(--leaf-soft); border: 1px solid var(--leaf); }
.bar-axis { display: flex; justify-content: space-between; color: var(--ink-faint); font-size: .8rem; }

.reason {
  padding: .6rem 0; border-bottom: 1px solid var(--line-soft);
}
.reason:last-child { border-bottom: none; }
.reason .hd { font-weight: 700; }
.reason .bd { color: var(--ink-soft); font-size: .94rem; }

/* ─────────────────────────────────────────────────────────────────
   DIALOG
   ───────────────────────────────────────────────────────────────── */

dialog {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  padding: 1.4rem; max-width: 560px; width: calc(100vw - 2rem);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(20,23,20,.45); }
dialog h2 { margin-bottom: .8rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: .8rem 1.2rem; border-radius: var(--radius);
  font-weight: 600; box-shadow: var(--shadow); z-index: 500;
  max-width: calc(100vw - 2rem);
}
.toast.bad { background: var(--warn); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.nav-divider {
  font-size: .78rem; font-weight: 700; color: var(--ink-faint);
  padding: 1rem .75rem .3rem; border-top: 1px solid var(--line-soft);
  margin-top: .5rem;
}
@media (max-width: 820px) {
  .nav-divider {
    border-top: none; border-left: 1px solid var(--line);
    padding: .5rem .5rem .5rem .8rem; margin: 0 0 0 .3rem;
    align-self: center; white-space: nowrap;
  }
}

/* first run */
.setup-screen {
  max-width: 540px; margin: 0 auto; padding: 6vh 1.2rem 4rem;
}
.setup-screen .step { margin-bottom: 1.6rem; }
.setup-screen h1 { font-family: var(--display); font-size: 2rem; margin-bottom: .3rem; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .7rem 0; border-bottom: 1px solid var(--line-soft);
}
.check-list li:last-child { border-bottom: none; }
.check-mark { font-weight: 700; min-width: 1.4rem; }
.check-mark.ok { color: var(--leaf); }
.check-mark.no { color: var(--warn); }
.check-list .what { font-weight: 600; }
.check-list .why { color: var(--ink-soft); font-size: .93rem; }

/* A one-off shift at times outside the pattern. It is drawn as one band
   across every row its hours cover, so the span is visible rather than
   hidden behind a time written on a chip. */
.who.span {
  background: var(--leaf-soft);
  border: 1.5px dashed var(--leaf);
  color: var(--leaf-deep);
  border-radius: 0;
  margin: 0 0 .35rem;
  min-height: 42px;
  display: flex; flex-direction: column; justify-content: center;
}
.who.span.open {
  background: var(--warn-soft); border-color: var(--warn); color: var(--warn);
}
.who.span-top {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
  border-bottom: none; margin-bottom: 0;
}
.who.span-mid {
  border-top: none; border-bottom: none; margin-bottom: 0;
  min-height: 30px;
}
.who.span-bot {
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  border-top: none;
}
.who.span-top.span-bot {
  border: 1.5px dashed var(--leaf);
  border-radius: var(--radius-sm);
  margin-bottom: .35rem;
}
.who.span.open.span-top, .who.span.open.span-bot,
.who.span.open.span-mid { border-color: var(--warn); }
.span-name { font-weight: 700; font-size: .95rem; }
.span-when {
  font-size: .78rem; opacity: .8; font-variant-numeric: tabular-nums;
}
.span-name.faded { opacity: .62; font-weight: 600; }

/* ─────────────────────────────────────────────────────────────────
   FIRST PAINT — a slow load should never be a blank white screen
   ───────────────────────────────────────────────────────────────── */

.booting {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
  color: var(--ink-soft);
}
.booting-mark {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--leaf);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .booting-mark { animation: none; border-top-color: var(--line); }
}

/* ─────────────────────────────────────────────────────────────────
   PUTTING IT ON A PHONE
   ───────────────────────────────────────────────────────────────── */

.install-share { text-align: center; }
.install-share .qr {
  width: 230px; height: 230px; image-rendering: pixelated;
  background: #fff; padding: 10px; border-radius: var(--radius);
  border: 1.5px solid var(--line); margin: .6rem auto .4rem; display: block;
}
.install-share .addr {
  font-weight: 700; font-size: 1.05rem; word-break: break-all; margin: .2rem 0;
}

ol.steps { margin: .4rem 0 .8rem; padding-left: 1.3rem; }
ol.steps li { margin-bottom: .5rem; padding-left: .2rem; }

/* the whole install page prints as a sheet for the back room */
@media print {
  .sidebar, .page-head p, details, [data-install], .toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .card { border: none; page-break-inside: avoid; }
  .install-share .qr { width: 280px; height: 280px; }
}

/* a safe area for phones with a notch, now it opens full screen */
@supports (padding: max(0px)) {
  .main { padding-bottom: max(4rem, env(safe-area-inset-bottom)); }
  .clock-screen { padding-bottom: max(1.5vh, env(safe-area-inset-bottom)); }
}

/* ─────────────────────────────────────────────────────────────────
   FEELING LIKE AN APP, NOT A WEB PAGE
   ───────────────────────────────────────────────────────────────── */

/* No grey flash on tap, no long-press menu on buttons */
button, .btn, .pick, .who, .nav button, .add-here {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
button, .nav button, .pick, .who { user-select: none; }

/* Overscroll shows the app's own background, not the browser's white */
html { background: var(--paper); overscroll-behavior-y: none; }

/* A wait long enough to notice gets a quiet bar, not a blank screen */
body.busy::after {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 900;
  background: linear-gradient(90deg, transparent, var(--leaf), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: sweep 1.1s ease-in-out infinite;
}
@keyframes sweep {
  0%   { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.busy::after { animation: none; background: var(--leaf); opacity: .5; }
}

/* The phone nav scrolls, so show that it does rather than cutting a word off */
@media (max-width: 820px) {
  .nav {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .nav button { scroll-snap-align: start; }
}

/* In standalone mode there is no browser bar, so clear the status bar */
@media (display-mode: standalone) {
  .sidebar { padding-top: max(.8rem, env(safe-area-inset-top)); }
  .clock-screen { padding-top: max(3vh, env(safe-area-inset-top)); }
}

/* Choosing who works a slot */
.who-option {
  display: flex; width: 100%; justify-content: space-between;
  align-items: center; gap: 1rem; text-align: left;
  padding: .7rem .9rem; margin-bottom: .45rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); min-height: 54px;
}
.who-option:hover { border-color: var(--leaf); background: var(--leaf-soft); }
.who-option .tick {
  font-size: .85rem; font-weight: 700; white-space: nowrap;
  color: var(--leaf-deep);
}
.who-option .tick.maybe { color: var(--maybe-ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .who-option .tick.maybe { color: var(--maybe-edge); }
}

/* ──────────────────────────────────────────────────────────────────
   Guided setup — the Lightspeed walkthrough and remote access.
   Both used to be PowerShell scripts. The numbered rail is doing real
   work here: these are the only two places in the app where the order
   of the steps matters, because each one needs the step before it.
   ────────────────────────────────────────────────────────────────── */

.wizard { margin-top: .5rem; }

.wizard-step {
  position: relative;
  border-left: 2px solid var(--line-soft);
  margin-left: .6rem;
  padding: 0 0 1.2rem 1.3rem;
}
.wizard-step:last-child { border-left-color: transparent; padding-bottom: .2rem; }

.wizard-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.wizard-head h3 { margin: 0; font-family: var(--display); font-size: 1.05rem; }

.wizard-num {
  position: absolute; left: -.78rem; top: .05rem;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--leaf); color: #fff;
  font: 600 .8rem/1 var(--sans);
}

.wizard-body { font-size: .94rem; }
.wizard-body > p:first-child { margin-top: 0; }
.wizard-body code {
  background: var(--leaf-soft); color: var(--ink);
  padding: .1rem .35rem; border-radius: var(--radius-sm);
  font-size: .87em; word-break: break-all;
}

.setup-list { margin: .6rem 0; padding-left: 1.15rem; }
.setup-list li { display: list-item; margin: .4rem 0; line-height: 1.45; }

.link-btn {
  display: inline-flex; align-items: center;
  text-decoration: none; line-height: 1;
}

.sub-summary {
  cursor: pointer; padding: .45rem 0;
  font-weight: 600; font-size: .92rem; color: var(--ink-soft);
}

/* remote access */

.tailscale { margin: .3rem 0 1.2rem; }

.state-row { display: flex; align-items: center; gap: .55rem; margin-bottom: .3rem; }

.dot { width: .62rem; height: .62rem; border-radius: 50%; flex: none; }
.dot.on   { background: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }
.dot.warn { background: var(--maybe-edge); box-shadow: 0 0 0 3px var(--maybe); }
.dot.off  { background: var(--ink-faint); }

.address {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  background: var(--leaf-soft); border-radius: var(--radius);
  padding: .65rem .8rem; margin: .75rem 0;
}
.address a { font-weight: 600; word-break: break-all; color: var(--leaf-deep); }

.reach-title { margin: 1.2rem 0 .55rem; font-family: var(--display); font-size: .98rem; }

.reach-option {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem .85rem; margin-bottom: .55rem;
  background: var(--card);
}
.reach-option.current { border-color: var(--yes-edge); background: var(--leaf-soft); }
.reach-option .why {
  font-size: .85rem; color: var(--ink-soft);
  margin-top: .2rem; max-width: 46ch;
}
.reach-option button { flex: none; }

.pill {
  flex: none; font: 600 .76rem/1 var(--sans);
  background: var(--leaf); color: #fff;
  padding: .34rem .62rem; border-radius: 999px;
}

@media (max-width: 560px) {
  .reach-option { flex-direction: column; align-items: stretch; }
  .reach-option button { width: 100%; }
  .wizard-step { padding-left: 1.1rem; }
}

/* ──────────────────────────────────────────────────────────────────
   Tables on a phone.
   People and Hours have more columns than a 390px screen can hold, so
   the table gets a scrolling wrapper put round it at render time (see
   wrapTables in app.js). It has to be a wrapper rather than making the
   table itself scroll: splitting thead and tbody into separate display
   boxes gives each its own column widths, and the headings stop lining
   up with the figures underneath them.
   ────────────────────────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -.2rem;
  padding: 0 .2rem;
}
.table-scroll > table { min-width: 100%; }

@media (max-width: 760px) {
  .table-scroll > table th, .table-scroll > table td { white-space: nowrap; }
}

.said {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .6rem .7rem; margin: .3rem 0 0;
  font-size: .82rem; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
  max-height: 16rem; overflow: auto;
}

/* ──────────────────────────────────────────────────────────────────
   A month of availability.
   Seven columns, one cell per day, the shifts stacked inside it. Small
   on purpose: the whole month has to be visible at once or it stops
   being useful for the question people actually ask, which is "which
   days am I saying no to".
   ────────────────────────────────────────────────────────────────── */

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.month-head {
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--ink-faint); text-align: center; padding: .2rem 0 .3rem;
}

.month-cell {
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: .25rem; min-height: 4.6rem;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card);
}
.month-cell.empty { border: none; background: none; min-height: 0; }
.month-cell.shut { background: var(--shut); border-color: var(--line); }

.month-date {
  font-size: .76rem; font-weight: 700; color: var(--ink-soft);
  display: flex; align-items: center; gap: .2rem;
}
.on-rota { color: var(--leaf); font-size: .6rem; }

.month-note { font-size: .7rem; color: var(--ink-faint); }

.month-shift {
  min-height: 0; padding: .18rem .1rem;
  font: 600 .68rem/1.15 var(--sans);
  border-radius: 4px; border: 1.5px solid var(--yes-edge);
  background: var(--yes); color: var(--ink);
  text-align: center; width: 100%;
}
.month-shift.maybe { background: var(--maybe); border-color: var(--maybe-edge); color: var(--maybe-ink); }
.month-shift.no      { background: var(--no);    border-color: var(--no-edge);    color: var(--no-ink); }
.month-shift.theirs    { box-shadow: inset 0 0 0 1.5px var(--ink); }
.month-shift:disabled  { opacity: .55; }

.swatch.theirs-key { background: var(--yes); border-color: var(--yes-edge); box-shadow: inset 0 0 0 1.5px var(--ink); }

@media (max-width: 560px) {
  .month-cell { min-height: 3.9rem; padding: .18rem; }
  .month-shift { font-size: .6rem; padding: .14rem .05rem; }
  .month-date { font-size: .68rem; }
}

.sales-from {
  margin: .6rem .1rem 0;
  font-size: .78rem; line-height: 1.5;
  max-width: 78ch;
}
