:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --card: #fffdf8;
  --card-soft: #fbf6ed;
  --text: #241c15;
  --muted: #75695d;
  --primary: #7a3f22;
  --primary-dark: #56301f;
  --accent: #d97745;
  --accent-soft: #fff0df;
  --sage: #687a56;
  --sage-soft: #eef3e7;
  --border: #e4d7c8;
  --shadow: 0 18px 50px rgba(65, 45, 27, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 119, 69, .16), transparent 34rem),
    linear-gradient(180deg, #fbf7ef 0%, var(--bg) 100%);
  color: var(--text);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: clamp(.85rem, 2vw, 1.5rem);
  align-items: center;
  padding: .55rem clamp(.85rem, 2.5vw, 2rem);
  background: linear-gradient(135deg, #3a2418, #7a3f22 58%, #a55d32);
  color: #fff8ec;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.eyebrow {
  margin: 0 0 .4rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  font-weight: 800;
  color: var(--accent);
}

.hero .eyebrow { color: #f1c18f; }
.hero-brand {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: clamp(.5rem, 1.2vw, .85rem);
  min-width: 0;
}
.hero-brand > div { min-width: 0; }
.hero-logo {
  display: block;
  flex: 0 1 auto;
  width: auto;
  max-width: min(34rem, 34vw);
  height: clamp(4.65rem, 6.7vw, 6.1rem);
  object-fit: contain;
}
h1, h2, h3, p { margin-top: 0; }
.hero-title { margin: 0; font-size: clamp(1.65rem, 2.55vw, 2.4rem); line-height: 1; font-weight: 800; }
h1 { font-size: clamp(1.65rem, 2.55vw, 2.4rem); line-height: 1; margin-bottom: 0; }
.hero h1, .hero-title { white-space: normal; }
h2 { margin-bottom: 0; font-size: 1.35rem; }

.container { width: min(1440px, calc(100% - 2rem)); margin: .9rem auto 3rem; }

.alert, .empty-card, .filters, .desktop-summary, .transmission-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  box-shadow: var(--shadow);
}

.alert { padding: 1rem; color: #9b1c1c; margin-bottom: 1rem; }
.empty-card { padding: 1.5rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }

.desktop-summary {
  padding: 1.2rem;
  margin-bottom: 1.25rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: .75rem;
}

.section-heading time, .refresh-note { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.summary-briefing-header { max-width: 58rem; margin-bottom: .75rem; }
.summary-briefing-header h2 { margin-bottom: .25rem; }
.summary-meta { margin-bottom: .5rem; color: var(--muted); font-size: .86rem; font-weight: 600; }
.summary-executive { max-width: 68rem; margin-bottom: .8rem; font-size: 1.01rem; line-height: 1.45; }
.desktop-summary-text { margin-bottom: 0; white-space: pre-line; font-size: 1.02rem; line-height: 1.55; }
.summary-section { max-width: 72rem; margin-top: .65rem; }
.summary-section h3 { margin: 0 0 .45rem; font-size: .98rem; letter-spacing: .01em; color: #4f4338; }
.incident-list { display: grid; gap: 10px; }
.incident-card {
  padding: 12px 16px;
  border: 1px solid #eadfd1;
  border-radius: .68rem;
  background: #fffefa;
}
.incident-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .65rem; margin-bottom: 2px; }
.incident-card h4 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.03rem; font-weight: 850; line-height: 1.18; letter-spacing: -.005em; }
.incident-badge {
  display: inline-flex;
  align-items: center;
  gap: .22rem;
  flex: 0 0 auto;
  padding: .1rem .38rem;
  border: 1px solid #eadfce;
  border-radius: .42rem;
  background: #fcf8f1;
  color: #766655;
  font-size: .66rem;
  font-weight: 750;
  line-height: 1.2;
}
.incident-badge-icon { font-size: .78rem; line-height: 1; opacity: .78; }
.incident-meta { margin-bottom: 8px; color: #85776a; font-size: .82rem; font-weight: 600; line-height: 1.25; }
.incident-summary { margin-bottom: 8px; line-height: 1.38; }
.incident-highlights { display: block; margin-top: 0; }
.incident-highlights p { margin-bottom: 2px; color: #85776a; font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }
.incident-highlights ul { display: block; margin-top: 4px; margin-bottom: 0; padding-left: 20px; }
.notable-list { margin: 0; padding-left: 1.15rem; }
.incident-highlights li { display: list-item; margin: 0 0 3px; line-height: 1.28; }
.incident-highlights li:last-child { margin-bottom: 0; }
.notable-list li { margin: .18rem 0; line-height: 1.38; }
.notable-list { columns: 2; column-gap: 2rem; }
.notable-list li { break-inside: avoid; }
.routine-activity-section { margin-top: 1rem; }
.routine-activity {
  max-width: 72rem;
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.5;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(9rem, 1fr)) minmax(4rem, auto);
  gap: .75rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
  align-items: end;
}

label { display: grid; gap: .35rem; font-weight: 800; color: #4f4338; font-size: .9rem; }

input, select, button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: .66rem .78rem;
  font: inherit;
  background: white;
  color: var(--text);
}

button {
  cursor: pointer;
  border-color: var(--primary);
  background: var(--primary);
  color: #fff8ec;
  font-weight: 900;
}

button:hover { background: var(--primary-dark); }
.filter-actions { display: flex; gap: .7rem; align-items: center; }
.filter-actions a, .pagination a { color: var(--primary); font-weight: 900; text-decoration: none; }

.transmission-panel { padding: 1.15rem; }
.compact-heading { padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.transmission-table { display: grid; }

.transmission-row {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}

.transmission-row:last-child { border-bottom: 0; }
.row-time { color: var(--muted); font-weight: 800; font-size: .95rem; }
.row-copy p { margin-bottom: 0; line-height: 1.45; white-space: pre-wrap; }

.raw-transcript {
  margin-top: .55rem;
  max-width: 56rem;
  color: var(--muted);
}

.raw-transcript summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .22rem .65rem;
  background: var(--accent-soft);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: .78rem;
}

.raw-transcript p {
  margin-top: .55rem;
  padding: .75rem;
  border-radius: .75rem;
  background: var(--card-soft);
  border: 1px solid var(--border);
  font-size: .92rem;
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.25rem; color: var(--muted); }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { align-self: stretch; }
}

@media (max-width: 980px) {
  .hero { flex-wrap: wrap; }
  .hero h1, .hero-title { font-size: clamp(1.45rem, 3.6vw, 2.05rem); white-space: normal; }
  .hero-logo { max-width: min(32vw, 18rem); height: clamp(4rem, 8vw, 5.25rem); }
}

@media (max-width: 760px) {
  .section-heading, .transmission-row { grid-template-columns: 1fr; flex-direction: column; align-items: flex-start; }
  .hero { gap: .55rem; padding: .42rem .75rem; }
  .hero-brand { width: 100%; gap: .5rem; }
  .hero-logo { max-width: min(42vw, 13rem); height: clamp(3.35rem, 12vw, 4.4rem); }
  .hero h1, .hero-title { font-size: clamp(1.3rem, 5.9vw, 1.8rem); white-space: normal; }
  .filters { grid-template-columns: 1fr; }
  .section-heading time, .refresh-note { white-space: normal; }
  .notable-list { columns: 1; }
  .incident-card-header { flex-wrap: wrap; }
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .55rem;
  flex: 0 1 44rem;
  min-width: 18rem;
}
.hero-channel-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
}
.hero-channel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: .36rem .75rem;
  border: 1px solid rgba(255, 248, 236, .28);
  border-radius: 999px;
  color: #fff8ec;
  background: rgba(255, 255, 255, .1);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(36, 28, 21, .12);
}
.hero-channel-pill:hover,
.hero-channel-pill:focus-visible {
  background: rgba(255, 255, 255, .18);
}
.hero-channel-pill.is-active {
  border-color: #ffd2a8;
  background: #fff0df;
  color: var(--primary-dark);
}
.hero-nav { flex: 0 0 auto; margin-left: auto; }
.hero-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.85rem;
  padding: .42rem .72rem;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  color: #fff8ec;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 900;
  background: rgba(255,255,255,.1);
}
.compact-hero { justify-content: space-between; }
.hero-note { margin: .35rem 0 0; color: #ffe5c7; font-weight: 700; }
.location-chip {
  display: inline-flex;
  margin-top: .55rem;
  margin-bottom: 0;
  padding: .3rem .65rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: #3f5b35;
  border: 1px solid #cfdec4;
  font-size: .82rem;
  font-weight: 800;
}
.map-container { width: min(1600px, calc(100% - 1rem)); }
.map-filters { grid-template-columns: minmax(14rem, 1.4fr) repeat(4, minmax(9rem, 1fr)) minmax(4rem, auto); }
.map-shell {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  box-shadow: var(--shadow);
}
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  padding: .85rem;
  border-bottom: 1px solid var(--border);
}
.map-toolbar strong { margin-right: auto; color: var(--primary-dark); }
.map-toolbar button { width: auto; padding: .5rem .85rem; }
.transmission-map { min-height: min(72vh, 760px); width: 100%; background: #e8efe6; }
.map-note { margin: 0; padding: .65rem .85rem; color: #1f4f38; background: #ecfdf3; border-top: 1px solid var(--border); font-weight: 800; }
.map-warning { margin: 0; padding: .75rem .85rem; color: #7c2d12; background: #ffedd5; font-weight: 900; }
.map-popup { max-width: min(420px, 76vw); font: 13px/1.35 system-ui, sans-serif; color: #241c15; }
.map-popup p { margin: .4rem 0 0; }

@media (max-width: 1100px) {
  .map-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .hero-nav { margin-left: auto; }
  .hero-nav a { min-width: 3.55rem; padding: .38rem .64rem; font-size: .84rem; }
  .map-filters { grid-template-columns: 1fr; }
  .map-toolbar { align-items: stretch; }
  .map-toolbar strong { width: 100%; }
  .map-toolbar button { flex: 1 1 9rem; }
  .transmission-map { min-height: 70vh; }
}

.tiny-map-link {
  display: block;
  width: 13.75rem;
  max-width: 100%;
  margin-top: .6rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  overflow: hidden;
  background: #e8efe6;
  box-shadow: 0 8px 20px rgba(65, 45, 27, .08);
}
.tiny-map-img,
.tiny-map-canvas {
  display: block;
  width: 100%;
  height: 7.5rem;
  object-fit: cover;
}
.tiny-map-canvas { pointer-events: none; }

@media (max-width: 760px) {
  .tiny-map-link { width: 100%; }
}

.map-diagnostics,
.debug-panel {
  margin: 0 0 1rem;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  background: var(--card);
  box-shadow: var(--shadow);
}
.map-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: center;
  color: var(--primary-dark);
  font-weight: 800;
}
.map-diagnostics span { color: var(--muted); }
.debug-table { display: grid; gap: .45rem; }
.debug-row {
  display: grid;
  grid-template-columns: minmax(4rem, .55fr) minmax(10rem, 1.2fr) minmax(12rem, 1.4fr) minmax(5rem, .6fr) minmax(10rem, 1.2fr);
  gap: .6rem;
  align-items: start;
  padding: .65rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: #fffaf3;
  font-size: .86rem;
}
.debug-head {
  background: var(--sage-soft);
  color: var(--primary-dark);
  font-weight: 900;
}
.debug-row small { color: var(--muted); font-weight: 700; }
@media (max-width: 900px) {
  .debug-row { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .hero-brand { flex-direction: column; align-items: flex-start; }
  .hero-logo { max-width: min(100%, 15rem); height: clamp(3rem, 16vw, 3.8rem); }
}
.map-status {
  margin: 0;
  padding: .85rem;
  border-top: 1px solid var(--border);
  background: #fff7ed;
  color: #7c2d12;
  font-weight: 900;
}
.map-status[data-status="error"] {
  background: #fef2f2;
  color: #9b1c1c;
}

.directory-panel {
  padding: clamp(1rem, 2.5vw, 1.4rem);
  border: 1px solid rgba(228, 215, 200, .9);
  border-radius: 1.35rem;
  background: rgba(255, 253, 248, .92);
  box-shadow: var(--shadow);
}

.channel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}
.channel-pills-compact {
  padding-top: .15rem;
}
.directory-pills {
  margin-top: .35rem;
}
.channel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: .46rem .9rem;
  border: 1px solid #eadccb;
  border-radius: 999px;
  background: #fffaf3;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(65, 45, 27, .07);
  transition: transform .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.channel-pill:hover,
.channel-pill:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(217, 119, 69, .68);
  background: #fff5e8;
  box-shadow: 0 10px 24px rgba(65, 45, 27, .1);
}
.channel-pill.is-active {
  border-color: var(--accent);
  background: var(--primary);
  color: #fff8ec;
  box-shadow: 0 10px 28px rgba(122, 63, 34, .18);
}

.page-title-panel {
  margin-bottom: 1.25rem;
  padding: 1.2rem;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(228, 215, 200, .9);
  border-radius: 1.2rem;
  box-shadow: var(--shadow);
}

.page-title-panel h2 { margin-bottom: .4rem; }
.page-title-panel p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.5; }

.channel-switcher {
  margin-bottom: 2.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(228, 215, 200, .85);
  border-radius: 1.2rem;
  background: rgba(255, 253, 248, .86);
  box-shadow: 0 14px 36px rgba(65, 45, 27, .08);
}

.site-footer {
  width: min(1440px, calc(100% - 2rem));
  margin: 2rem auto 2.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(228, 215, 200, .85);
  border-radius: 1.1rem;
  background: rgba(255, 253, 248, .72);
  color: var(--muted);
  text-align: center;
  box-shadow: 0 10px 28px rgba(65, 45, 27, .06);
}
.site-footer p { margin: .18rem 0; font-size: .92rem; line-height: 1.45; }

@media (max-width: 760px) {
  .channel-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: .2rem;
    scrollbar-width: thin;
  }
  .channel-pill { flex: 0 0 auto; }
  .channel-switcher { margin-bottom: 1.8rem; }
}

@media (max-width: 760px) {
  .hero-actions { width: 100%; min-width: 0; align-items: stretch; }
  .hero-channel-pills { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: thin; }
  .hero-channel-pill { flex: 0 0 auto; }
}

.archive-panel,
.channel-switcher,
.page-title-panel {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  background: var(--card);
  box-shadow: var(--shadow);
}
.archive-links,
.archive-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}
.archive-links a,
.archive-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: .42rem .75rem;
  border: 1px solid #eadccb;
  border-radius: 999px;
  background: #fffaf3;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 900;
}
.archive-links a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--primary);
  color: #fff8ec;
}
.archive-nav { margin: 0 0 1.25rem; }
@media (max-width: 760px) {
  .archive-links,
  .archive-nav { align-items: stretch; flex-direction: column; }
  .archive-links a,
  .archive-nav a { width: 100%; }
}

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

.header-search {
  position: relative;
  align-self: flex-end;
}
.header-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: .7rem;
  background: transparent;
  color: rgba(255, 248, 236, .92);
  line-height: 1;
  box-shadow: none;
}
.header-search-icon {
  display: block;
  width: 1.18rem;
  height: 1.18rem;
}
.header-search-toggle:hover,
.header-search-toggle:focus-visible {
  border-color: rgba(255, 248, 236, .24);
  background: rgba(255, 248, 236, .12);
  color: #fffaf3;
}
.header-search-panel {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(12rem, 20rem) auto;
  gap: .45rem;
  width: min(26rem, calc(100vw - 2rem));
  padding: .55rem;
  border: 1px solid rgba(228, 215, 200, .95);
  border-radius: .85rem;
  background: var(--card);
  box-shadow: 0 18px 50px rgba(36, 28, 21, .2);
}
.header-search-panel[hidden] { display: none; }
.header-search-panel input,
.header-search-panel button {
  min-height: 2.2rem;
  padding: .5rem .65rem;
  border-radius: .65rem;
}
.header-search-panel button { width: auto; }

.channel-archive-panel {
  display: grid;
  gap: .65rem;
  margin: .75rem 0 1rem;
  padding: .8rem .9rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(255, 253, 248, .94);
  box-shadow: 0 12px 32px rgba(65, 45, 27, .075);
}
.compact-panel-row {
  display: grid;
  grid-template-columns: minmax(9.5rem, .2fr) minmax(0, 1fr);
  gap: .75rem 1rem;
  align-items: center;
}
.compact-panel-label .eyebrow { margin-bottom: .18rem; }
.compact-panel-label h2 {
  margin: 0;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.15;
}
.compact-panel-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 10%, var(--border) 90%, transparent);
}
.compact-empty { margin: 0; }

.channel-row-actions,
.archive-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}
.channel-row-actions .channel-pills {
  min-width: 0;
}
.archive-row-actions .archive-links {
  justify-content: flex-start;
}
.archive-latest-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.9rem;
  padding: .32rem .7rem;
  border: 1px solid rgba(234, 220, 203, .9);
  border-radius: 999px;
  background: rgba(255, 250, 243, .72);
  color: var(--primary-dark);
  text-decoration: none;
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}
.archive-latest-link:hover,
.archive-latest-link:focus-visible {
  background: #fff5e8;
  border-color: rgba(217, 119, 69, .54);
}

@media (max-width: 760px) {
  .container { width: min(100% - 1rem, 1440px); margin-top: .55rem; }
  .has-header-search { flex-wrap: nowrap; }
  .has-header-search .hero-brand { flex: 1 1 auto; width: auto; }
  .has-header-search .hero-actions { flex: 0 0 auto; width: auto; min-width: 0; align-items: flex-end; }
  .header-search { align-self: flex-end; }
  .header-search-panel { right: 0; grid-template-columns: 1fr; }
  .compact-panel-row { grid-template-columns: 1fr; align-items: start; }
  .channel-row-actions { align-items: center; flex-wrap: nowrap; width: 100%; }
  .archive-row-actions { align-items: flex-start; flex-direction: column; width: 100%; }
  .channel-row-actions .channel-pills,
  .archive-row-actions .archive-links { width: 100%; }
  .archive-latest-link { white-space: normal; text-align: left; }
  .channel-archive-panel { margin-top: .55rem; padding: .7rem; gap: .55rem; }
  .archive-links { flex-direction: row; align-items: center; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .15rem; scrollbar-width: thin; }
  .archive-links a { flex: 0 0 auto; width: auto; }
  .filters { grid-template-columns: 1fr; padding: .75rem; }
}
