:root {
  --night: #081E2A;
  --ocean-deep: #0E3346;
  --ocean: #1A4A63;
  --ocean-mid: #2A6280;
  --mist: #D7E4EA;
  --muted: #A9C0CC;
  --ivory: #FFFBF5;
  --gold: #C6A15B;
  --gold-light: #E0C988;
  --good: #7FC4A8;
  --warn: #E0C988;
  --bad: #F0B6A8;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night);
  color: var(--ivory);
  font: 16px/1.45 'Source Sans 3', system-ui, sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--gold-light); }
a:hover { color: #F3E6C8; }
h1, h2, h3 { margin: 0; }
h1 { font: 500 34px/1.15 'Playfair Display', Georgia, serif; }
h2 { font-size: 18px; font-weight: 600; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--bad); min-height: 1.4em; margin: 0; }

button, input, select {
  font: inherit;
  color: inherit;
}
button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--ocean-mid);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}
button.primary { background: var(--gold); color: var(--ocean-deep); border-color: var(--gold); }
button.ghost.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
textarea { font: inherit; color: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--ocean-mid); background: var(--night); width: 100%; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input, select {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--ocean-mid);
  background: var(--night);
  width: 100%;
}

/* Brand */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-logo { display: block; width: 86px; height: auto; }
.brand-login { align-items: center; text-align: center; }
.brand-login .brand-logo { width: 120px; }
.brand small { display: block; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(420px, 100%);
  background: var(--ocean-deep);
  border-radius: 18px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-card h1 { margin-top: 18px; }
.login-card label { font-weight: 600; margin-top: 6px; }
.login-card button { margin-top: 8px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 104px;
  flex-shrink: 0;
  background: var(--ocean-deep);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
}
.rail-brand { align-self: center; display: block; margin-bottom: 10px; }
.rail-brand img { width: 44px; height: 44px; display: block; }
.rail { display: flex; flex-direction: column; gap: 4px; }
.rail a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 12px; color: var(--mist); text-decoration: none; font-size: 12.5px; font-weight: 600; text-align: center;
}
.rail a:hover { background: rgba(255, 255, 255, 0.05); color: var(--ivory); }
.rail a[aria-current="page"] { background: var(--ocean); color: var(--ivory); font-weight: 700; }
.rail a[aria-current="page"] svg { stroke: var(--gold-light); }
.me { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.me .link { font-size: 12.5px; min-height: 32px; align-self: center; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--ocean-mid); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; color: var(--ivory); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.main { flex: 1; min-width: 0; padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; }
.main:focus { outline: none; }
/* The page band (the Coreline Hub's layout, Sunbed's colours): section,
   title and buttons, optional figures, and the section's pages as tabs. The
   selected tab is the page's own colour, so it joins the page below. */
.band { background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--ocean) 60%, var(--ocean-mid) 100%); border-radius: 18px; padding: 20px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.band.solo { padding-bottom: 20px; }
.band-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; }
.band-top h1 { font-size: 30px; }
.band-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.band-acts .muted { color: rgba(255, 251, 245, 0.72); }
.band-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.band-kpis .kpi { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.band-kpis .kpi span { font-size: 11.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: rgba(255, 251, 245, 0.72); }
.band-kpis .kpi b { font-size: 26px; font-weight: 700; line-height: 1.15; }
.band-tabs { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; scrollbar-width: none; }
.band-tab {
  flex: 0 0 auto; min-height: 0; padding: 10px 18px; border: 0; border-radius: 10px 10px 0 0; background: transparent;
  color: rgba(255, 251, 245, 0.75); font: 700 14.5px 'Source Sans 3', system-ui, sans-serif; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.band-tab:hover { color: var(--ivory); background: rgba(255, 255, 255, 0.08); }
.band-tab[aria-current="page"] { background: var(--night); color: var(--ivory); }
.eyebrow { font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); display: block; margin-bottom: 4px; }

/* Cards and grids */
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.card { background: var(--ocean-deep); border-radius: var(--radius); padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.accent { border: 1px solid var(--gold); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stat { font-size: 32px; font-weight: 600; line-height: 1.1; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); flex-shrink: 0; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }

.notice { background: var(--night); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.notice b { font-weight: 600; }
.notice.bad b { color: var(--bad); }
.notice.warn b { color: var(--warn); }
.notice p { margin: 0; font-size: 14px; color: var(--mist); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--ocean); }
td { padding: 10px; border-top: 1px solid var(--ocean); vertical-align: top; }
tr:first-child td { border-top: 0; }
td.mono a, td.mono { color: var(--gold-light); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--ocean-mid); white-space: nowrap; }
.pill.good { border-color: var(--good); color: var(--good); }
.pill.warn { border-color: var(--warn); color: var(--warn); }
.pill.bad { border-color: var(--bad); color: var(--bad); }

.toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; min-width: 220px; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.loading { color: var(--muted); }

@media (max-width: 1100px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 30; width: auto; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35); }
  .rail-brand, .me { display: none; }
  .rail { flex-direction: row; flex: 1; justify-content: space-around; }
  .rail a { flex: 1; padding: 6px 2px; font-size: 11px; border-radius: 10px; }
  .main { padding: 16px 16px 96px; }
  .band { padding: 16px 14px 0; border-radius: 16px; }
  .band.solo { padding-bottom: 16px; }
  .band-top h1 { font-size: 26px; }
  .band-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .band-kpis .kpi b { font-size: 22px; }
  .band-tab { padding: 9px 13px; font-size: 13.5px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 28px; }
}

/* Sign-in steps */
.step { display: flex; flex-direction: column; gap: 10px; }
.step h1 { margin-top: 18px; }
.step label { font-weight: 600; margin-top: 6px; }
.step .primary { margin-top: 8px; }
button.link { background: none; border: 0; min-height: 40px; padding: 0; color: var(--gold-light); font-weight: 500; text-decoration: underline; align-self: flex-start; }
button.ghost { background: transparent; }
.note { color: var(--good); margin: 0; min-height: 0; }
.note:empty, .error:empty { display: none; }
.qr { background: #fff; border-radius: 12px; padding: 12px; width: 220px; height: 220px; align-self: center; }
.qr svg { width: 100%; height: 100%; display: block; }
.manual summary { cursor: pointer; color: var(--muted); }
.manual code { display: block; margin-top: 8px; word-break: break-all; font-family: 'JetBrains Mono', monospace; color: var(--gold-light); }
.backup-codes { margin: 4px 0; padding: 14px 14px 14px 36px; background: var(--night); border-radius: 10px; columns: 2; font-family: 'JetBrains Mono', monospace; font-size: 15px; line-height: 1.9; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.account-grid form, .account-grid .card > div { display: flex; flex-direction: column; gap: 10px; }
.account-grid label { font-weight: 600; font-size: 14px; }
@media (max-width: 900px) { .account-grid { grid-template-columns: minmax(0, 1fr); } }

/* Team */
.team-invite { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.team-invite label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.team-invite .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.team-invite .check input { width: 20px; height: 20px; min-height: 0; }
.team-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.team-actions button { min-height: 34px; padding: 0 10px; font-size: 13px; }
button.danger { border-color: var(--bad); color: var(--bad); }
button.primary.danger { background: var(--bad); color: var(--night); }
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box input { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.activity li { display: flex; gap: 12px; }
.activity time { color: var(--muted); min-width: 120px; }
dialog.confirm { border: 0; border-radius: 16px; padding: 0; background: var(--ocean-deep); color: var(--ivory); width: min(420px, calc(100% - 32px)); }
dialog.confirm::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.confirm form { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
@media (max-width: 900px) { .team-invite { grid-template-columns: minmax(0, 1fr); } }

.signin-note { position: fixed; right: 16px; bottom: 16px; max-width: 420px; z-index: 20; display: flex; gap: 12px; align-items: flex-start; }
.signin-note p { margin: 0; }

.branch-row { cursor: pointer; }
.branch-row:hover td, .branch-row:focus-visible td { background: rgba(255, 255, 255, 0.04); }
.branch-commits > td { padding: 4px 0 16px 24px; }
details.older { margin-top: 16px; }
details.older summary { cursor: pointer; color: var(--muted, #9fb3c0); }

/* Actions */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { min-height: 36px; padding: 0 14px; font-size: 14px; }
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--ocean); border-color: var(--gold); }
.act-filters label { min-width: 180px; }
.act-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.act-col { background: var(--ocean-deep); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.act-meeting { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.act-list { display: flex; flex-direction: column; gap: 8px; }
.act-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; width: 100%; min-height: 0; padding: 12px; background: var(--night); border: 1px solid var(--ocean); border-radius: 10px; font-weight: 400; }
.act-card:hover { border-color: var(--ocean-mid); }
.act-card.high { border-left: 3px solid var(--bad); }
.act-card b { font-weight: 600; overflow-wrap: anywhere; }
.act-top:empty { display: none; }
.act-top, .act-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; }
.due { font-size: 13px; color: var(--mist); }
.due.bad { color: var(--bad); font-weight: 600; }
.due.warn { color: var(--warn); font-weight: 600; }
.act-row { cursor: pointer; }
.act-row:hover td, .act-row:focus-visible td { background: rgba(255, 255, 255, 0.04); }
.act-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.act-form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; min-width: 0; }
.act-form-grid .wide { grid-column: 1 / -1; }
.act-form-grid .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; min-height: 44px; }
.act-form-grid .check input { width: 20px; height: 20px; min-height: 0; }
dialog.act-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 32px); }
dialog.act-dialog form.act-form-grid { display: grid; padding: 0; }
dialog.act-dialog form.act-note { display: flex; flex-direction: row; padding: 0; }
.act-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.act-note { display: flex; gap: 8px; align-items: flex-end; }
@media (max-width: 1100px) { .act-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .act-board, .act-meeting { grid-template-columns: minmax(0, 1fr); }
  dialog.act-dialog form.act-form-grid { grid-template-columns: minmax(0, 1fr); }
  dialog.act-dialog form.act-note { flex-direction: column; align-items: stretch; }
  .act-body { padding: 18px; }
  .act-form-grid { grid-template-columns: minmax(0, 1fr); }
  .act-filters label { min-width: 0; flex: 1 1 140px; }
  .act-note { flex-direction: column; align-items: stretch; }
}
.act-note button { white-space: nowrap; }

/* Segmented buttons (Actions views, Updates filters) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(8, 30, 42, 0.45); align-self: flex-start; }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; font-size: 14px; color: var(--mist); }
.seg button[aria-pressed="true"] { background: var(--ocean-mid); color: var(--ivory); }
.main > .seg { background: var(--ocean-deep); }

/* Updates and Huddle */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; }
.post-head h2 { font: 600 21px/1.25 'Playfair Display', Georgia, serif; margin-top: 4px; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-body > summary { cursor: pointer; color: var(--gold-light); font-weight: 600; min-height: 32px; }
.prose { max-width: 78ch; line-height: 1.6; color: var(--mist); }
.prose h3 { color: var(--ivory); font-size: 16px; margin: 18px 0 6px; }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose b { color: var(--ivory); }
.minute-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.minute-h { font-size: 15px; margin: 4px 0 8px; }
.minute-actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.minute-actions li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: center; padding: 8px 10px; background: var(--night); border-radius: 8px; font-size: 14px; }
.minute-actions a { color: var(--ivory); text-decoration: none; overflow-wrap: anywhere; }
.minute-actions a:hover { color: var(--gold-light); }
.act-form-grid .wide-2 { grid-column: span 2; }
@media (max-width: 900px) { .minute-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .act-form-grid .wide-2 { grid-column: auto; }
  .minute-actions li { grid-template-columns: minmax(0, 1fr) auto; }
  .minute-actions li a { grid-column: 1 / -1; }
}
.stack { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }

/* Rehearsal stage */
.stage { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 300px); gap: 16px; align-items: start; }
.stage-cast ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.stage-cast li { display: flex; gap: 10px; align-items: center; }
.stage-cast li span b, .stage-cast li span small { display: block; }
.stage-cast li small { color: var(--muted); font-size: 12.5px; }
.cast-mark { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; color: var(--night); background: var(--mist); }
.cast-g1 { background: #E0C988; } .cast-g2 { background: #7FC4A8; } .cast-g3 { background: #F0B6A8; }
.cast-g4 { background: #A9C9E8; } .cast-g5 { background: #D9B8E8; } .cast-g6 { background: #F2D6A2; }
.cast-venue { background: var(--gold); } .cast-check { background: var(--ocean-mid); color: var(--ivory); }
.stage-script { max-height: 78vh; overflow-y: auto; }
.stage-act h3 { font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold-light); margin: 6px 0 8px; }
.stage-beats { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.beat { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border-radius: 10px; background: var(--night); border: 1px solid transparent; transition: border-color 0.2s, opacity 0.2s; }
.beat.waiting { opacity: 0.45; }
.beat.now { border-color: var(--gold); }
.beat.fail { border-color: var(--bad); }
.beat-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.beat-kind { font-size: 12px; color: var(--muted); }
.beat-say { margin: 4px 0 0; font-style: italic; color: var(--mist); font-size: 14px; }
.beat-say span { font-style: normal; color: var(--muted); }
.beat-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.stage-venue-top { margin-bottom: 10px; }
.stage-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.stage-totals div { background: var(--night); border-radius: 10px; padding: 8px 10px; }
.stage-totals span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stage-totals b { font-size: 20px; }
@media (max-width: 1100px) { .stage { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); } .stage-cast { grid-column: 1 / -1; } .stage-cast ul { flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 760px) { .stage { grid-template-columns: minmax(0, 1fr); } .stage-script { max-height: none; } .stage-venue { order: -1; } }

/* Venue sign-ups */
.applications { display: flex; flex-direction: column; gap: 12px; }
details.application > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 4px; }
details.application > summary::-webkit-details-marker { display: none; }
details.application[open] > summary { padding-bottom: 12px; border-bottom: 1px solid var(--ocean-mid); }
.application-body { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; min-width: 0; }
.application-body h3 { margin: 6px 0 0; font-size: 1rem; }
.application-photo img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; object-fit: cover; }
dl.facts { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { dl.facts { grid-template-columns: 1fr; } }
ul.plain { margin: 0; padding-left: 1.1em; }
