/* BEGIN grace-tokens.css */
:root {
  /* Brand: the same in both modes */
  --forest: #1F3B2C;        /* primary: header band, selected (light) */
  --forest-deep: #132619;   /* darkest: text on leaf and gold */
  --leaf: #76B04F;          /* accent from the old app; never white text on it */
  --gold: #E2B659;          /* highlight; always forest-deep text on it */
  --live: #E5383B;          /* the Live badge only; white text on it */

  /* Type */
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-label: 11px;       /* uppercase section labels, 600, letter-spacing .07em */
  --text-caption: 12px;     /* footers, timestamps */
  --text-small: 13px;       /* roster role names, field labels, row details */
  --text-button: 14px;      /* tabs and buttons, 600 */
  --text-body: 15px;        /* default text; card titles at 600 */
  --text-input: 16px;       /* inputs; never smaller (iOS zooms under 16px) */
  --text-dialog: 17px;      /* dialog titles, 600 */
  --text-date: 20px;        /* day number in a date tile, 600 */

  /* Shape and space */
  --radius-badge: 6px;
  --radius-control: 10px;   /* inputs, buttons, date tiles */
  --radius-track: 12px;     /* the tab track */
  --radius-card: 14px;
  --radius-sheet: 16px;     /* dialogs */
  --radius-pill: 999px;     /* filter chips, Live badge */
  --gutter: 16px;           /* page side margin */
  --inset-card: 14px;       /* padding inside cards and rows */
  --gap-card: 10px;         /* between stacked cards */
  --tap: 44px;              /* minimum button and input height */

  /* Theme: light */
  --page: #F6F4EF;          /* warm cream */
  --card: #FFFFFF;
  --line: #E4E0D6;          /* hairlines */
  --leaf-soft: #E6F1DD;     /* tab track, date tiles, badges */
  --leaf-line: #CFE2BF;     /* outlines on leaf-soft areas and chips */
  --ink: #16211A;           /* headings, primary text */
  --body: #3A4540;          /* paragraphs */
  --muted: #7A827D;         /* captions only: 3.6:1 on page, below AA for small text */
  --label: #1F3B2C;         /* uppercase section labels, text links */
  --selected: #1F3B2C;      /* selected tab, active chip, primary button */
  --on-selected: #FFFFFF;
  --on-forest: #FFFFFF;     /* titles on the header band */
  --on-forest-soft: #E6F1DD;/* subtitles on the header band */
  --out-soft: #FBE3E3;      /* cancelled services, "I'll be out" */
  --out-ink: #B42326;
  --note-soft: #E3EEFB;     /* service notes; blue kept from the old site */
  --note-ink: #0C447C;
  --danger: #B42326;
  --focus: #76B04F;
  --scrim: rgba(19, 38, 25, .5);
  --shadow-card: 0 1px 2px rgba(31, 59, 44, .06), 0 2px 8px rgba(31, 59, 44, .06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #15140F;
    --card: #211F19;
    --line: #35322A;
    --leaf-soft: #283A24;
    --leaf-line: #3B4E32;
    --ink: #F6F4EF;
    --body: #D8D4CB;
    --muted: #A8A396;
    --label: #8CC466;
    --selected: #76B04F;
    --on-selected: #132619;
    --out-soft: #4A1F22;
    --out-ink: #F7C1C1;
    --note-soft: #13283F;
    --note-ink: #B5D4F4;
    --danger: #F2B8B5;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-card: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #15140F;
  --card: #211F19;
  --line: #35322A;
  --leaf-soft: #283A24;
  --leaf-line: #3B4E32;
  --ink: #F6F4EF;
  --body: #D8D4CB;
  --muted: #A8A396;
  --label: #8CC466;
  --selected: #76B04F;
  --on-selected: #132619;
  --out-soft: #4A1F22;
  --out-ink: #F7C1C1;
  --note-soft: #13283F;
  --note-ink: #B5D4F4;
  --danger: #F2B8B5;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-card: none;
  color-scheme: dark;
}
/* END grace-tokens.css */

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--body);
  font-family: var(--font); font-size: var(--text-body); line-height: 1.4;
}
a { color: var(--label); font-weight: 500; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Header band ---------- */
.top { background: var(--forest); color: var(--on-forest); text-align: center; padding: 18px var(--gutter) 16px; }
.top img { height: 46px; width: auto; display: block; margin: 0 auto; }
.top p { margin: 6px 0 0; color: var(--on-forest-soft); font-size: var(--text-small); }

main { max-width: 560px; margin: 0 auto; padding: 16px var(--gutter) 120px; }

/* ---------- Cards and rows ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: var(--inset-card); margin-bottom: var(--gap-card);
}
.card.flush { padding: 0; overflow: hidden; }
.sec { font-size: var(--text-label); font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--label); margin: 22px 2px 8px; }
.muted { color: var(--muted); font-size: var(--text-caption); }
.small { font-size: var(--text-small); }

.event-head { display: flex; gap: 12px; align-items: flex-start; }
.tile { flex: 0 0 auto; width: 56px; border-radius: var(--radius-control); background: var(--leaf-soft);
  text-align: center; padding: 6px 0 7px; color: var(--ink); }
.tile b { display: block; font-size: var(--text-date); font-weight: 600; line-height: 1.1; }
.tile span { font-size: var(--text-label); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--label); }
.event-head h1 { font-size: 19px; line-height: 1.25; }
.event-head .when { font-size: var(--text-small); margin-top: 3px; }
.intro { margin: 12px 0 0; }
.note { background: var(--note-soft); color: var(--note-ink); border-radius: var(--radius-control);
  padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.notice { background: var(--leaf-soft); color: var(--ink); border-radius: var(--radius-control); padding: 10px 12px; font-size: 14px; }
.notice.out { background: var(--out-soft); color: var(--out-ink); }

.progress { margin-top: 14px; }
.bar { height: 8px; border-radius: var(--radius-pill); background: var(--leaf-soft); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--leaf); border-radius: inherit; transition: width .3s; }

.row { display: flex; align-items: center; gap: 12px; padding: 12px var(--inset-card); min-height: 60px;
  border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
label.row { cursor: pointer; }
.row .main { flex: 1; min-width: 0; }
.row .name { color: var(--ink); font-weight: 600; }
.row .detail { font-size: var(--text-small); color: var(--body); margin-top: 1px; }
.row .who { font-size: var(--text-caption); color: var(--muted); margin-top: 2px; }
.row.full .name { color: var(--body); font-weight: 500; }

.check { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 26px; height: 26px; margin: 0;
  border: 2px solid var(--muted); border-radius: 8px; background: var(--card); display: grid; place-items: center; cursor: pointer; }
.check:checked { background: var(--selected); border-color: var(--selected); }
.check:checked::after { content: ""; width: 7px; height: 12px; border: solid var(--on-selected); border-width: 0 3px 3px 0;
  transform: rotate(45deg) translate(-1px, -1px); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-badge);
  background: var(--leaf-soft); color: var(--label); white-space: nowrap; }
.badge.you { background: var(--gold); color: var(--forest-deep); }
.badge.out { background: var(--out-soft); color: var(--out-ink); }
.badge.note { background: var(--note-soft); color: var(--note-ink); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: var(--text-small); color: var(--body); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); font-size: var(--text-input); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--card); color: var(--ink);
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  padding: 0 18px; border-radius: var(--radius-control); border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: var(--text-button); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--selected); border-color: var(--selected); color: var(--on-selected); }
.btn.out { background: var(--out-soft); border-color: var(--out-soft); color: var(--out-ink); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

/* Sticky bar that appears once items are picked */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(19,38,25,.08); }
.dock .in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.dock .in div { flex: 1; color: var(--ink); font-weight: 600; font-size: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; background: var(--leaf-soft); border: 1px solid var(--leaf-line); border-radius: var(--radius-track);
  padding: 3px; gap: 3px; margin: 12px 0; overflow-x: auto; }
.tabs button { flex: 1; min-height: 38px; border: 0; background: transparent; border-radius: 9px; color: var(--ink);
  font-size: var(--text-button); font-weight: 600; cursor: pointer; white-space: nowrap; padding: 0 10px; }
.tabs button[aria-selected="true"] { background: var(--selected); color: var(--on-selected); }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: var(--radius-sheet); padding: 18px; width: min(460px, calc(100vw - 32px));
  background: var(--card); color: var(--body); box-shadow: 0 10px 40px rgba(0,0,0,.25); max-height: calc(100vh - 40px); }
dialog::backdrop { background: var(--scrim); }
dialog h2 { font-size: var(--text-dialog); margin-bottom: 10px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

footer { text-align: center; margin-top: 28px; }

@media print {
  .top, .tabs, .no-print, .dock, footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  main { padding: 0; max-width: none; }
}
