/* Elements marked hidden stay hidden even when a rule sets display. */
[hidden] { display: none !important; }

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1d2320;
  --muted: #5d665f;
  --line: #dcdfd8;
  --accent: #1f6f50;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0e8;
  --warn: #8a4b00;
  --warn-soft: #fbefdc;
  --danger: #a12a2a;
  --focus: #2457c5;
  --radius: 10px;
  --space: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816; --surface: #1d2320; --ink: #e9ece8; --muted: #a5ada6; --line: #333b36;
    --accent: #59b88c; --accent-ink: #0d1a14; --accent-soft: #1f3a2d; --warn: #f0b264; --warn-soft: #3a2c17;
    --danger: #f08a8a; --focus: #8fb2ff; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 10px var(--space); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: 4px; order: 3; width: 100%; overflow-x: auto; }
.nav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
@media (min-width: 768px) { .nav { order: 0; width: auto; } }

main { max-width: 880px; margin: 0 auto; padding: var(--space); }
main:focus { outline: none; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 8px 0 4px; }
h2 { font-size: 1.1rem; margin: 28px 0 8px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.loading, .empty { color: var(--muted); padding: 24px 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px var(--space); }
.stack > * + * { margin-top: 10px; }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters .wide { grid-column: 1 / -1; }
@media (min-width: 768px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; } .filters .wide { grid-column: auto; } }

label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: 0; }
.field { margin-bottom: 14px; }
.field .error { color: var(--danger); font-size: 0.9rem; margin-top: 4px; }
[aria-invalid="true"] { border-color: var(--danger); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 4px; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.row2 { display: grid; gap: 0 12px; }
@media (min-width: 600px) { .row2 { grid-template-columns: 1fr 1fr; } }

button, .button {
  font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.quiet { color: var(--muted); }
button.link { border: 0; background: none; color: var(--accent); padding: 8px; min-height: 44px; }
button[disabled] { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event-list a { display: block; color: inherit; text-decoration: none; }
.event-list a:hover .name { text-decoration: underline; }
.name { font-weight: 650; }
.meta { color: var(--muted); font-size: 0.925rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.ready { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.chip.missing { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.calendar { border-color: var(--focus); color: var(--focus); }
.chip.published { border-color: var(--accent); color: var(--accent); }
.count { color: var(--muted); font-size: 0.9rem; margin: 4px 0 10px; }

.blockers { margin: 8px 0 0; padding-left: 20px; }
.blockers li { margin: 2px 0; }
.ready-note { color: var(--accent); font-weight: 600; margin: 8px 0 0; }

dl.facts { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 6px 12px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.edit { margin-left: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; }

.evidence-item .src, .muted { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: calc(100% - 32px); z-index: 20; }
.toast:not(:empty) { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 12px; }
.notice.ok { background: var(--accent-soft); color: var(--ink); }
.signin { max-width: 420px; margin: 8vh auto 0; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space); width: min(560px, calc(100% - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
h2.first { margin-top: 0; }
