/* Frontline house style (styles/frontline): crimson + condensed heads. */
:root {
  --bg: #080808;
  --panel: #0d0d0d;
  --panel-2: #161616;
  --line: #1e1e1e;
  /* Form controls need a 3:1 boundary (WCAG 1.4.11); the hairline is decorative. */
  --line-field: #6a6a6a;
  --text: #f0f0f0;
  --muted: rgba(240, 240, 240, 0.62);
  /* Crimson is only 3.4:1 on black — fills and large type only. */
  --accent: #c41e1e;
  --accent-hover: #e02424;
  --accent-ink: #ffffff;
  /* Small accent text needs its own lighter tint (7.9:1). */
  --accent-text: #ff7a7a;
  --danger: #ff6b6b;
  --ok: #6ee08a;
  --radius: 3px;
  --font-head: "Barlow Condensed", "Arial Narrow", "Roboto Condensed",
    sans-serif-condensed, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: var(--radius);
  z-index: 10;
}
.skip-link:focus { left: 12px; top: 12px; }

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

h1, h2, h3, .wordmark, .tab, button.primary {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wordmark { font-weight: 400; font-size: 1.25rem; }
.wordmark b { font-weight: 700; color: var(--accent-text); }
.wordmark.big { font-size: 2.4rem; margin: 0 0 4px; line-height: 1; }
.rule {
  width: 42px;
  height: 3px;
  background: var(--accent);
  margin: 0 0 14px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar .who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

main {
  padding: 16px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
  max-width: 1240px;
  margin: 0 auto;
}

h1 { font-size: 1.35rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 4px 0 12px; }

/* ---- login ---- */
.login-card {
  max-width: 380px;
  margin: 14dvh auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
}
.lede { color: var(--muted); margin-top: 0; }
.hint { color: var(--muted); font-size: 0.85rem; }

/* ---- forms ---- */
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 0.9rem; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-field);
  border-radius: var(--radius);
}
input[type="checkbox"] {
  width: 22px; height: 22px; min-height: 0; accent-color: var(--accent);
}

button {
  min-height: 48px;
  padding: 10px 18px;
  font-size: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
button.linklike {
  background: none;
  border: none;
  min-height: 44px;
  padding: 12px 8px;
  color: var(--accent-text);
  text-decoration: underline;
  font-size: 0.9rem;
}

button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.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;
}

.field-error {
  color: #ffb4b4;
  background: #2b1516;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 10px 0 0;
  font-size: 0.9rem;
}

input[aria-invalid="true"] { border-color: var(--danger); }

h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
p.field-error[tabindex="-1"]:focus { outline: 3px solid var(--accent-text); outline-offset: 4px; }

td.empty { padding: 16px 10px; color: var(--muted); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
#login-form button { width: 100%; margin-top: 18px; }

.tabs { display: flex; gap: 6px; }
.tab { min-height: 40px; padding: 6px 14px; border-radius: 999px; }
.tab[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

/* ---- roster ---- */
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.summary { color: var(--muted); font-size: 0.9rem; }
table.roster { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.roster th {
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
table.roster td { padding: 0; border-bottom: 1px solid var(--line); }
table.roster td button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  padding: 12px 10px;
}
table.roster tr:hover td { background: var(--panel); }
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.off { color: var(--danger); border-color: var(--danger); }
.pill.admin { color: var(--accent-text); border-color: var(--accent-text); }
.missing { color: var(--danger); }

/* ---- festivals ---- */
.fest-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}
.fest-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.fest-days { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.fest-day {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.85rem;
}
.fest-day .target { color: var(--muted); }
.fest-day input {
  width: 64px;
  min-height: 36px;
  padding: 4px 8px;
  margin-left: 6px;
}
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---- availability: day choice ---- */
.day-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 10px 0;
  background: var(--panel);
}
.day-row > .day-name {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choices label {
  flex: 1 1 0;
  min-width: 88px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line-field);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.choices input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; }
.choices label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.choices label:has(input:focus-visible) { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.note-wrap { margin-top: 10px; }
.note-wrap label { margin-top: 0; }

/* ---- availability board ---- */
.count-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.count-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--panel);
  font-size: 0.85rem;
}
.count-chip b { font-family: var(--font-head); font-size: 1.15rem; letter-spacing: 0.04em; }
.count-chip .sub { color: var(--muted); }
.count-chip.short { border-color: var(--danger); }
.count-chip.met { border-color: var(--ok); }

.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
table.board { border-collapse: collapse; width: 100%; min-width: 520px; }
table.board th, table.board td {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  font-size: 0.9rem;
}
table.board thead th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
table.board th[scope="row"] { font-weight: 400; }
table.board th.name button {
  background: none;
  border: none;
  padding: 10px 4px;
  min-height: 44px;
  text-align: left;
  width: 100%;
  color: var(--text);
}
.count-chip .tag {
  font-family: var(--font-head);
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}
.count-chip.short .tag { color: var(--danger); }
.count-chip.met .tag { color: var(--ok); }
.mark { font-weight: 700; }
.mark.in { color: var(--ok); }
.mark.partial { color: #ffc76b; }
.mark.out { color: var(--danger); }
.mark.none { color: var(--muted); }
.by-admin { color: var(--muted); font-size: 0.75rem; }

.chase {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
}
.chase h2 { margin: 0 0 6px; font-size: 1rem; }
.chase .names { color: var(--muted); font-size: 0.9rem; line-height: 1.6; }

/* ---- schedule board ---- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.count-chip .tag.warn { color: var(--accent-text); }
.shift {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ok);
}
.shift.cut { color: var(--muted); text-decoration: line-through; }
.lockmark { font-size: 0.8rem; }

.groups { margin: 10px 0; }
.groups summary {
  cursor: pointer;
  padding: 10px 0;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.bucket-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.bucket-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 6px 4px 12px;
  background: var(--panel);
  font-size: 0.9rem;
}
.bucket-chip button {
  min-height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
}
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1 1 220px; }

.my-shifts {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
  background: var(--panel-2);
}
.my-shifts h4 {
  margin: 0 0 8px;
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}
.my-shift { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }
.my-shift.cut { color: var(--muted); text-decoration: line-through; }
.small { font-size: 0.85rem; }

/* Changing an answer stays possible but deliberately out of the way. */
.tucked .reveal { padding: 10px 0; }
.tucked-body { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }

/* ---- crew home ---- */
.crew-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 12px 0;
}
.crew-card h3 { margin: 0 0 6px; }
.crew-card .muted { color: var(--muted); margin: 0; }

/* ---- toast ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 92vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--danger); }

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

/* ---- desktop: admin panes go side by side ---- */
.pane-split { display: block; }
.pane-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}
@media (min-width: 1024px) {
  .pane-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
  }
  .pane-detail { position: sticky; top: 76px; margin-top: 0; }
  h1 { font-size: 1.6rem; }
}
