/*
 * Volunteer app styles, on @q1/brand's semantic tokens only (root ADR 0006).
 * No colour is written here: every colour is a token, so the brand check
 * guards contrast in light, dark and backstage.
 */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
}

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

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--space-4); top: var(--space-2); z-index: 2; background: var(--surface); color: var(--text); padding: var(--space-2) var(--space-3); }

/* ---- The bar: deck in every theme ---- */
.bar {
  background: var(--chrome);
  color: var(--chrome-text);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  padding: 0 var(--gutter);
}
.bar-button { white-space: nowrap; }
.bar :focus-visible { outline-color: var(--chrome-focus); }
.lockup { display: flex; align-items: center; gap: var(--space-2); color: var(--chrome-text); text-decoration: none; min-height: 44px; }
.lockup .mark { font-family: var(--font-mono); font-weight: 600; border: 2px solid var(--chrome-accent); color: var(--chrome-accent); border-radius: var(--radius); padding: 0 var(--space-1); }
.lockup .app { font-family: var(--font-display); font-weight: 800; font-size: var(--text-lg); }
.bar-end { margin: 0; }
.bar-nav { display: flex; gap: var(--space-1); margin-right: auto; overflow-x: auto; }
.bar-nav a { color: var(--chrome-muted); text-decoration: none; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; padding: 0 var(--space-3); border-bottom: 3px solid transparent; }
.bar-nav a[aria-current='page'] { color: var(--chrome-text); border-bottom-color: var(--chrome-accent); }
.bar-button {
  background: transparent;
  color: var(--chrome-text);
  border: var(--border-hair) solid var(--chrome-rule);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 0 var(--space-4);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ---- Page ---- */
main { max-width: 1040px; margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-8); }
h1 { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); line-height: var(--leading-tight); margin: 0; }
h2 { font-size: var(--text-lg); margin: 0; }
h3 { font-size: var(--text-md); margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.muted { color: var(--text-muted); }
.label { font-family: var(--font-mono); font-weight: 500; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--text-muted); margin: var(--space-6) 0 var(--space-3); }
.data { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- Cards ---- */
.card { background: var(--surface); border: var(--border-hair) solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.card + .card { margin-top: var(--space-4); }
.event-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); align-items: baseline; }
.event-when { color: var(--text-muted); }

/* ---- Gaps: the loudest thing on the coordinator's page (brief, journey 2) ---- */
.gaps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.gap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) var(--space-4); background: var(--surface); color: var(--text); text-decoration: none; border: var(--border-hair) solid var(--border); border-left: 4px solid var(--signal-live-edge); border-radius: var(--radius); }
.gap:hover { border-color: var(--border-strong); border-left-color: var(--signal-live-edge); }
.gap.tonight, .gap.tonight:hover { border-left-color: var(--signal-act-fill); }
.gap-what { font-weight: 600; }

/* ---- Pills: state only, always with words ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-pill); font-family: var(--font-mono); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 10px; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-short { background: var(--signal-live); color: var(--signal-live-text); }
.pill-act { background: var(--signal-act-bg); color: var(--signal-act-text); }
.pill-ok { background: var(--signal-ok-bg); color: var(--signal-ok-text); }

/* ---- Positions ---- */
.positions { list-style: none; margin: var(--space-4) 0 0; padding: 0; }
.position { border-top: var(--border-hair) solid var(--border); padding: var(--space-3) 0; display: grid; gap: var(--space-2); }
.position-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.position-head h3 { margin-right: auto; }
.position p, .event-head p { margin: 0; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.person { display: inline-flex; align-items: center; height: 40px; background: var(--surface); border: var(--border-hair) solid var(--border); border-radius: var(--radius-pill); padding-left: var(--space-3); }
/* The x keeps a 44px target while the chip stays 40px tall. */
.person-remove { width: 44px; height: 44px; margin: -2px -2px -2px 0; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: var(--text-lg); line-height: 1; cursor: pointer; border-radius: 50%; }
.person-remove:hover { color: var(--text); }

/* ---- Forms ---- */
form.inline { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; }
.field { display: grid; gap: var(--space-1); min-width: 0; }
.field input, .field select { width: 100%; }
.field label { font-weight: 600; }
.grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
input, select, textarea {
  font: inherit;
  font-size: var(--text-md);
  min-height: 48px;
  padding: 0 var(--space-3);
  background: var(--field);
  color: var(--field-text);
  border: var(--border-hair) solid var(--field-border);
  border-radius: var(--radius);
}
input[type='checkbox'] { min-height: auto; width: 20px; height: 20px; }
.check { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; }
.button {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 0 var(--space-5);
  border-radius: var(--radius);
  border: var(--border-input) solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.button-secondary { background: transparent; color: var(--text); border-color: var(--border); font-weight: 600; }
/* Scoped to the page's own content: the Q1 menu has <details> too (its
   organisation switcher), and must keep its own look. */
main details { margin-top: var(--space-3); }
main summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: var(--space-2); list-style: none; color: var(--accent); }
main summary::-webkit-details-marker { display: none; }
main summary::before { content: '+'; font-family: var(--font-mono); font-weight: 600; width: 1ch; }
main details[open] > summary::before { content: '\2212'; }
main details > form, main details > div { margin-top: var(--space-3); }

.notice { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius); border: var(--border-hair) solid var(--border); background: var(--surface); }
.notice-error { color: var(--signal-act-text); background: var(--signal-act-bg); border-color: var(--signal-act-fill); }
.notice-ok { color: var(--signal-ok-text); background: var(--signal-ok-bg); border-color: var(--signal-ok-fill); }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.notice-action { min-height: 44px; padding: 0 var(--space-4); border: var(--border-input) solid currentColor; border-radius: var(--radius); background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.empty { padding: var(--space-6) var(--space-4); text-align: center; }

@media (min-width: 1024px) {
  main { padding-top: var(--space-6); }
  h1 { font-size: var(--text-2xl); }
}

/* ---- Tonight (brief, journey 6) ---- */
.tonight-event + .tonight-event { margin-top: var(--space-6); }
.tonight-event > h2 { margin-bottom: var(--space-3); }
.tonight-event .card + .card { margin-top: var(--space-3); }
.checkin-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.checkin-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; border-top: var(--border-hair) solid var(--border); }
.checkin-name { font-size: var(--text-lg); font-weight: 600; }
.checkin-row .pill, .checkin-row .missed { grid-column: 1; justify-self: start; }
.checkin-row .button, .checkin-row .link-quiet { grid-column: 2; grid-row: 1 / span 2; }
/* A check, not a dot: confirmed state carries the tick and the time. */
.pill-check::before { display: none; }
.button-checkin { min-height: 56px; min-width: 9rem; font-size: var(--text-lg); }
.button-small { min-height: 44px; padding: 0 var(--space-4); }
.missed { color: var(--text-muted); font-weight: 600; }
.toggle[aria-pressed='true'] { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.link-quiet { min-height: 44px; min-width: 44px; padding: 0 var(--space-3); border: 0; background: transparent; color: var(--text-muted); font: inherit; text-decoration: none; cursor: pointer; }
.link-quiet:hover, .link-quiet:focus-visible { text-decoration: underline; }

/* ---- Hours given (brief, journey 7) ---- */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--space-3); margin-bottom: var(--space-4); }
.toolbar a.button { display: inline-flex; align-items: center; text-decoration: none; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: var(--border-hair) solid var(--border); border-radius: var(--radius); }
.table caption { text-align: left; padding: var(--space-2) 0; caption-side: top; }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-4); border-top: var(--border-hair) solid var(--border); }
.table th { font-family: var(--font-mono); font-weight: 500; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--text-muted); }
.table .num { text-align: right; }
.hours-total { font-size: var(--text-lg); }
.plain-list { list-style: none; margin: 0; }
.plain-list li + li { margin-top: var(--space-2); }

@media (max-width: 600px) {
  /* The page links get their own row under the lockup. */
  .bar-nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--space-3)); }
  .checkin-row { grid-template-columns: 1fr auto; }
  /* The one big action, Check in or Arrived late, spans the row; Undo stays small. */
  .checkin-row:not(.state-arrived) .button { grid-column: 1 / -1; grid-row: auto; width: 100%; }
}

/* ---- My shifts ---- */
.my-shifts { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.my-shift h2 { margin-bottom: var(--space-1); }
.my-shift p { margin: 0; }

/* ---- Backstage: the primary is outlined, never a solid fill (Brand's rule
   for every app's backstage mode). A full-width fill is the brightest thing
   on a dark phone, whatever its colour. Light and dark keep the solid one. */
:root[data-theme='backstage'] .button:not(.button-secondary) {
  background: var(--surface);
  color: var(--accent);
  border: var(--border-input) solid var(--accent);
}

/* ---- Inside the Q1 menu: one left-aligned 760px content column, as on the
   Q1 pages (Brand). Outside it, behind the app's own bar, main stays centred. */
.q1-workspace > main {
  justify-self: start;
  width: 100%;
  max-width: calc(760px + 2 * var(--space-6));
  margin: 0;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}
.my-shifts-org { margin-top: var(--space-6); }
