/* Church of Night — shared styles */
:root {
  --bg: #0b0c0f;
  --surface: #13151a;
  --surface-2: #1a1d23;
  --surface-3: #22262e;
  --border: #262a32;
  --border-strong: #353a44;
  --text: #e8e9ec;
  --text-2: #a4a8b1;
  --text-3: #6d727c;
  --accent: #e5484d;
  --accent-strong: #f2555a;
  --accent-soft: rgba(229, 72, 77, .12);
  --accent-line: rgba(229, 72, 77, .38);
  --success: #3dd68c;
  --success-soft: rgba(61, 214, 140, .12);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, .12);
  --info: #6aa9ff;
  --info-soft: rgba(106, 169, 255, .12);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: .85rem; }
.xsmall { font-size: .75rem; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 12, 15, .88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; height: 58px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--text-2); padding: 7px 11px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-3); }
.nav-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 8px; flex: none; }
.nav-label { color: var(--text-3); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 0 6px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.clock-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-family: var(--mono); font-size: .85rem; font-variant-numeric: tabular-nums;
}
.clock-chip b { font-family: var(--font); font-size: .68rem; color: var(--text-3); letter-spacing: .08em; }

@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 8px 12px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 12px 8px; }
  .clock-chip { font-size: .8rem; padding: 4px 8px; }
  .topbar-right { gap: 4px; }
  .topbar-right .btn-sm { padding: 0 8px; }
  .brand { font-size: .95rem; min-width: 0; }
}

/* ---------- Layout ---------- */
.page { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 96px; flex: 1; }
.page.narrow { max-width: 920px; }
@media (max-width: 600px) { .page { padding: 20px 16px 110px; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { color: var(--accent); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 62ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.section { margin-top: 28px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head p { color: var(--text-3); font-size: .85rem; margin-top: 2px; }
.card.flush { padding: 0; overflow: hidden; }
.card.danger { border-color: var(--accent-line); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { color: var(--text-3); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.65rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-sub { color: var(--text-3); font-size: .8rem; margin-top: 2px; }
.stat.success .stat-value { color: var(--success); }
.stat.warning .stat-value { color: var(--warning); }
.stat.accent .stat-value { color: var(--accent-strong); }

.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.progress.success > span { background: var(--success); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: 600 .9rem/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:focus-visible, .input:focus-visible, .chip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { background: transparent; border-color: var(--accent-line); color: var(--accent-strong); }
.btn-danger:hover { background: var(--accent-soft); }
.btn-success { background: transparent; border-color: rgba(61, 214, 140, .4); color: var(--success); }
.btn-success:hover { background: var(--success-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: .8rem; }
.btn-xs { height: 24px; padding: 0 8px; font-size: .72rem; border-radius: 5px; }
.btn-block { width: 100%; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 1rem; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 12px; }
.label { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.hint { font-size: .78rem; color: var(--text-3); }
.input, select.input {
  height: 40px; width: 100%; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: .95rem;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.input-sm { height: 32px; font-size: .85rem; padding: 0 9px; }
.input.num { text-align: right; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
form.inline { display: inline; margin: 0; }

/* Chips (checkbox pickers / filters) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span, button.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2);
  font: 500 .82rem/1.2 var(--font); cursor: pointer; user-select: none;
}
.chip span:hover, button.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip input:checked + span, button.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.chip-list { max-height: 210px; overflow-y: auto; padding: 2px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 650; letter-spacing: .02em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--accent-soft); color: var(--accent-strong); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Flash messages ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: .92rem;
}
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--info); }
.flash.success { border-color: rgba(61, 214, 140, .35); background: var(--success-soft); }
.flash.success::before { background: var(--success); }
.flash.error { border-color: var(--accent-line); background: var(--accent-soft); }
.flash.error::before { background: var(--accent); }
.flash.warning { border-color: rgba(245, 165, 36, .35); background: var(--warning-soft); }
.flash.warning::before { background: var(--warning); }
.flash .close { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; padding: 10px 14px; font-size: .72rem; font-weight: 650; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; white-space: nowrap;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); text-decoration: none; }
.table th.sorted a { color: var(--text); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.table .r { text-align: right; }
.table .c { text-align: center; }
.table td.num, .table th.num { text-align: right; }
.table tr.dim td { opacity: .45; }
.table .name { font-weight: 600; }
.table-empty { padding: 40px 16px; text-align: center; color: var(--text-3); }
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table-tools .input { max-width: 260px; }
.rank-pos { color: var(--text-3); font-family: var(--mono); width: 1%; }
.medal { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .75rem; font-weight: 700; color: #111; }
.medal.m1 { background: #f2c94c; } .medal.m2 { background: #c0c4cc; } .medal.m3 { background: #cd8a4d; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.empty svg { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 12px; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 46ch; margin: 0 auto; }

/* ---------- Schedule (sign-up / view / war room) ---------- */
.now-banner {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; align-items: center;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--accent-line);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%); margin-bottom: 22px;
}
.now-banner .when { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; }
.now-banner .who { display: flex; gap: 18px; flex-wrap: wrap; }
.now-banner .who div { display: flex; flex-direction: column; }
.now-banner .who small { color: var(--text-3); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.now-banner .who b { font-weight: 650; }
.now-banner .who b.open { color: var(--warning); }

.day { margin-top: 26px; }
.day-head {
  position: sticky; top: 58px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.day-head h2 { font-size: .95rem; }
.day-head .subtle { font-size: .8rem; }
@media (max-width: 860px) { .day-head { top: 96px; } }

.hour {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: stretch;
  padding: 6px; border-radius: var(--radius); border: 1px solid transparent;
}
.hour + .hour { margin-top: 4px; }
.hour.is-now { border-color: var(--accent-line); background: var(--accent-soft); }
.hour.is-past { opacity: .42; }
.hour-time { display: flex; flex-direction: column; justify-content: center; padding-left: 6px; }
.hour-time .tct { font-family: var(--mono); font-size: 1.12rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hour-time .local { color: var(--text-3); font-size: .74rem; font-variant-numeric: tabular-nums; }
.hour-time .now-tag { color: var(--accent-strong); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.slot {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 9px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); min-width: 0;
}
.slot-role { color: var(--text-3); font-size: .64rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.slot-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.slot-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-name .check { color: var(--success); margin-left: 4px; }
.slot.open .slot-name { color: var(--text-3); font-weight: 500; }
.slot.mine { border-color: rgba(61, 214, 140, .45); background: var(--success-soft); }
.slot.mine .slot-role::after { content: " · you"; color: var(--success); }
.slot-actions { display: flex; gap: 6px; align-items: center; flex: none; }

/* selectable open slots */
label.slot.pick { cursor: pointer; transition: border-color .12s, background .12s; }
label.slot.pick:hover { border-color: var(--text-3); }
label.slot.pick input { position: absolute; opacity: 0; pointer-events: none; }
.tick {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); flex: none;
  display: grid; place-items: center; transition: all .12s;
}
.tick svg { width: 13px; height: 13px; color: #fff; opacity: 0; }
label.slot.pick input:checked ~ .tick { background: var(--accent); border-color: var(--accent); }
label.slot.pick input:checked ~ .tick svg { opacity: 1; }
label.slot.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.slot.pick:has(input:checked) .slot-name { color: var(--text); }
label.slot.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.slot .pin { font-family: var(--mono); font-size: .78rem; color: var(--text-3); cursor: pointer; user-select: none; }
.slot .pin.shown { color: var(--warning); }

@media (max-width: 600px) {
  .hour { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 8px; gap: 6px 8px; }
  .hour-time { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; align-items: baseline; gap: 10px; padding-left: 2px; }
  .slot.has-release { padding-right: 10px; }
  .slot.has-release .slot-actions { position: absolute; top: 5px; right: 5px; }
  .slot.has-release .slot-actions .btn-xs { height: 20px; font-size: .66rem; padding: 0 6px; }
  .hour.mode-admin { grid-template-columns: minmax(0, 1fr); }
  .now-banner { grid-template-columns: 1fr; }
  .slot { min-height: 52px; padding: 8px 10px; }
}

/* sticky action bar */
.action-bar {
  position: fixed; left: 50%; bottom: 18px; z-index: 40; transform: translate(-50%, 140%);
  width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 18px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow); transition: transform .22s ease;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.action-bar.show { transform: translate(-50%, 0); }
.action-bar .count { font-weight: 650; }
.action-bar .spacer { flex: 1; }

/* ---------- Dialog ---------- */
dialog {
  width: min(440px, calc(100% - 24px)); padding: 0; border-radius: 14px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(2px); }
.dialog-head { padding: 18px 20px 0; }
.dialog-head p { color: var(--text-2); font-size: .9rem; margin-top: 4px; }
.dialog-body { padding: 16px 20px; }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.summary-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.summary-list li { font-family: var(--mono); font-size: .78rem; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); }

/* ---------- Login ---------- */
.auth { max-width: 380px; margin: 8vh auto 0; }
.auth .card { padding: 28px; }
.auth-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.auth-icon svg { width: 22px; height: 22px; }

/* ---------- OC tracker ---------- */
.oc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.oc { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.oc-title { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.oc-title b { font-weight: 650; }
.oc-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.oc-slot { font-size: .75rem; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); }
.oc-slot.filled { background: var(--success-soft); color: var(--success); }
.oc-slot em { font-style: normal; opacity: .7; margin-right: 4px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); color: var(--text-3); font-size: .8rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 18px 20px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
@media (max-width: 420px) {
  .clock-chip b { display: none; }
}
