.archive-body { min-height: 100%; height: auto; overflow: hidden; }
.brand-link { color: inherit; text-decoration: none; }
.archive-page { height: calc(100vh - 64px); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.archive-search { padding: 16px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.archive-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.archive-title-row h2 { margin: 0; font-size: 17px; }
.archive-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.search-form { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(7, minmax(112px, 1fr)) auto; gap: 8px; align-items: end; }
.search-form label { display: grid; min-width: 0; gap: 5px; }
.search-form label > span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.search-form input, .search-form select {
  width: 100%; height: 36px; min-width: 0; padding: 0 9px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 11px;
}
.search-form input:focus, .search-form select:focus { outline: 2px solid rgba(35, 107, 77, .2); border-color: var(--accent); }
.search-submit { height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; color: white; background: var(--ink); border: 1px solid var(--ink); border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 700; }
.search-submit:hover { background: #2b3831; }
.search-submit svg { width: 15px; height: 15px; }

.archive-layout { min-height: 0; display: grid; grid-template-columns: minmax(620px, 1fr) 390px; background: var(--surface); }
.archive-results { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; border-right: 1px solid var(--line); }
.table-scroll { min-height: 0; overflow: auto; }
.event-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.event-table th { position: sticky; top: 0; z-index: 1; padding: 9px 10px; color: var(--muted); background: #f7f9f7; border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; text-transform: uppercase; white-space: nowrap; }
.event-table th:nth-child(5), .event-table td:nth-child(5) { text-align: right; }
.event-table td { padding: 10px; border-bottom: 1px solid #edf0ee; vertical-align: top; }
.event-row { cursor: pointer; }
.event-row:hover, .event-row.selected { background: #f4f7f5; }
.result-title { display: block; max-width: 360px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.result-location, .result-sources { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.result-sources { max-width: 210px; overflow-wrap: anywhere; }
.score-cell { font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.status-chip, .lifecycle-chip { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; font-size: 9px; line-height: 1.2; }
.status-chip[data-status="confirmed_fire"] { color: #8f241c; border-color: #e2b5b0; background: #fff1ef; }
.status-chip[data-status="probable_fire"] { color: #8b4813; border-color: #edc8a5; background: #fff6ec; }
.status-chip[data-status="suspected_fire"] { color: #72530a; border-color: #e7d497; background: #fff9e8; }
.status-chip[data-status="contained_or_inactive"] { color: #1d5477; border-color: #b7d2e3; background: #eef7fc; }
.status-chip[data-status="confirmed_flood"] { color: #0c536c; border-color: #9bc8d4; background: #e7f5f8; }
.status-chip[data-status="severe_flood_warning"] { color: #17647a; border-color: #add2da; background: #edf7f8; }
.status-chip[data-status="flood_warning"] { color: #286975; border-color: #bfdae0; background: #f1f8f9; }
.status-chip[data-status="critical_gauge"] { color: #7e3a17; border-color: #ddb99e; background: #fff3e9; }
.status-chip[data-status="elevated_gauge"] { color: #244d6f; border-color: #b6cadb; background: #edf3f8; }
.status-chip[data-status="extreme_rain_warning"] { color: #66367c; border-color: #d3b7df; background: #f8effb; }
.status-chip[data-status="severe_rain_warning"] { color: #4c568c; border-color: #c5cbea; background: #f2f3fb; }
.status-chip[data-status="heavy_rain_warning"] { color: #3d6685; border-color: #bfd4e4; background: #f0f6fa; }
.status-chip[data-status="extreme_thunderstorm_warning"] { color: #6d285c; border-color: #d8b1cf; background: #faeef7; }
.status-chip[data-status="severe_thunderstorm_warning"] { color: #7f3e27; border-color: #dfb9a8; background: #fff2ed; }
.status-chip[data-status="thunderstorm_warning"] { color: #705311; border-color: #ddcc99; background: #fff9e7; }
.status-chip[data-status="minor_earthquake"] { color: #4b5563; border-color: #cbd0d7; background: #f4f5f6; }
.status-chip[data-status="light_earthquake"] { color: #36597d; border-color: #b8cadc; background: #eff4f8; }
.status-chip[data-status="moderate_earthquake"] { color: #76540d; border-color: #dfcd9b; background: #fff8e8; }
.status-chip[data-status="strong_earthquake"] { color: #8a351c; border-color: #e4b9aa; background: #fff2ed; }
.status-chip[data-status="major_earthquake"] { color: #821923; border-color: #e1adb2; background: #fff0f1; }
.lifecycle-chip[data-lifecycle="active"] { color: #14523a; border-color: #b9dec9; background: #e5f4ec; }
.table-empty { padding: 40px !important; color: var(--muted); text-align: center; }
.pagination { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px; border-top: 1px solid var(--line); background: var(--surface); }
.pagination span { min-width: 90px; color: var(--muted); text-align: center; font-size: 10px; }

.archive-detail { min-width: 0; overflow-y: auto; padding: 18px; background: var(--surface); }
.archive-detail-empty { min-height: 60%; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.archive-detail-empty svg { width: 28px; height: 28px; }
.archive-detail-empty p { max-width: 210px; font-size: 11px; line-height: 1.5; }
.archive-detail h2 { margin: 6px 0 5px; padding-right: 40px; font-size: 19px; overflow-wrap: anywhere; }
.archive-kicker { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.archive-subtitle { margin: 0 0 13px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.archive-actions { display: flex; gap: 7px; margin-bottom: 14px; }
.archive-map-link { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; font-size: 10px; font-weight: 650; }
.archive-map-link:hover { background: var(--canvas); }
.archive-map-link svg { width: 14px; height: 14px; }
.archive-score { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 13px 0; border-block: 1px solid var(--line); }
.archive-score strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.archive-score-track { height: 7px; overflow: hidden; background: #e7ebe8; border-radius: 3px; }
.archive-score-fill { height: 100%; background: var(--probable); }
.archive-section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.archive-section h3 { margin: 0 0 9px; font-size: 11px; }
#archive-mini-map { width: 100%; height: 190px; background: #dfe5e0; }
.archive-history-chart { display: block; width: 100%; height: 100px; background: #fafbfa; border: 1px solid var(--line); }
.archive-history-line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.archive-history-grid { stroke: #e2e7e3; stroke-width: 1; }
.archive-history-label { fill: var(--muted); font: 8px Inter, sans-serif; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline-item { position: relative; padding: 0 0 14px 18px; border-left: 1px solid var(--line); }
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -4px; top: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.timeline-time { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8px; }
.timeline-title { display: block; font-size: 10px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.timeline-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.timeline-link { display: inline-block; margin-top: 4px; color: var(--accent); font-size: 9px; font-weight: 650; }
.historical-search-form { grid-template-columns: minmax(240px, 2fr) repeat(5, minmax(120px, 1fr)) auto; }
.historical-table th:nth-child(4), .historical-table td:nth-child(4) { text-align: right; }
.historical-area { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.historical-highlight { padding: 16px 0; border-block: 1px solid var(--line); }
.historical-highlight span { display: block; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.historical-highlight strong { display: block; margin-top: 5px; font-size: 28px; font-variant-numeric: tabular-nums; }
.historical-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.historical-metric { min-width: 0; padding: 9px; background: var(--surface); }
.historical-metric span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.historical-metric strong { display: block; margin-top: 4px; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.historical-source { color: var(--muted); font-size: 10px; line-height: 1.55; }
.ai-source-links { margin: 8px 0 0; padding-left: 16px; font-size: 9px; line-height: 1.45; }

@media (max-width: 1250px) {
  .search-form { grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(120px, 1fr)); }
  .archive-layout { grid-template-columns: minmax(560px, 1fr) 360px; }
}
@media (max-width: 900px) {
  .archive-body { overflow: auto; }
  .archive-page { height: auto; min-height: calc(100vh - 64px); }
  .search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-query { grid-column: 1 / -1; }
  .archive-layout { display: block; }
  .archive-results { min-height: 520px; border-right: 0; }
  .archive-detail { position: fixed; z-index: 1100; inset: 64px 0 0 auto; width: min(390px, 94vw); border-left: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(105%); transition: transform .2s ease; }
  .archive-detail.open { transform: translateX(0); }
}
@media (max-width: 560px) {
  .archive-page { min-height: calc(100vh - 58px); }
  .archive-search { padding: 12px; }
  .search-form { grid-template-columns: 1fr; }
  .search-query { grid-column: auto; }
  .archive-detail { inset: 58px 0 0 auto; }
  .event-table th:nth-child(2), .event-table td:nth-child(2),
  .event-table th:nth-child(4), .event-table td:nth-child(4),
  .event-table th:nth-child(7), .event-table td:nth-child(7) { display: none; }
}

/* Unified event discovery */
.archive-body { min-height: 100%; height: auto; overflow: auto; background: #f4f6f4; }
.archive-page { display: block; height: auto; min-height: calc(100vh - 64px); }
.archive-intro {
  display: flex; align-items: end; justify-content: space-between; gap: 32px; padding: 38px max(24px, calc((100vw - 1380px) / 2));
  color: #f7faf8; background: #1d2c25; border-bottom: 4px solid #d5603c;
}
.archive-intro > div { max-width: 760px; }
.archive-eyebrow { display: block; margin-bottom: 9px; color: #9fc9b2; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.archive-intro h1 { margin: 0; font-size: clamp(26px, 3vw, 42px); line-height: 1.08; letter-spacing: 0; }
.archive-intro p { max-width: 690px; margin: 12px 0 0; color: #c9d4ce; font-size: 13px; line-height: 1.6; }
.archive-primary-link { min-height: 40px; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 0 13px; color: #18231e; background: #fff; border-radius: 5px; text-decoration: none; font-size: 11px; font-weight: 750; }
.archive-primary-link:hover { background: #edf3ef; }
.archive-primary-link svg { width: 16px; height: 16px; }

.archive-controls { padding: 18px max(24px, calc((100vw - 1380px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line); }
.dataset-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 320px)); gap: 8px; margin-bottom: 16px; }
.dataset-button { min-height: 56px; display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; padding: 8px 11px; color: var(--ink); background: #f6f8f6; border: 1px solid var(--line); border-radius: 6px; text-align: left; cursor: pointer; }
.dataset-button:hover { border-color: #a9b5ae; }
.dataset-button.active { color: #174c37; background: #eaf4ef; border-color: #8bb6a1; box-shadow: inset 3px 0 #236b4d; }
.dataset-button > svg { width: 19px; height: 19px; }
.dataset-button span { display: grid; gap: 3px; }
.dataset-button strong { font-size: 11px; }
.dataset-button small { color: var(--muted); font-size: 9px; line-height: 1.3; }
.hazard-quick-filters { display: flex; gap: 5px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: thin; }
.hazard-filter { min-height: 34px; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; padding: 0 10px; color: #4e5a54; background: #fff; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; font-size: 10px; font-weight: 680; }
.hazard-filter:hover { background: #f5f7f5; }
.hazard-filter.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.hazard-filter svg { width: 14px; height: 14px; }

.archive-controls .search-form { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(170px, 240px) auto auto; gap: 8px; align-items: end; }
.archive-controls .search-form label { gap: 5px; }
.archive-controls .search-form input, .archive-controls .search-form select { height: 38px; border-radius: 4px; font-size: 11px; }
.archive-controls .search-submit, .reset-search { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border-radius: 4px; cursor: pointer; font-size: 10px; font-weight: 720; }
.reset-search { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.reset-search:hover { background: var(--canvas); }
.reset-search svg { width: 14px; height: 14px; }
.advanced-filters { grid-column: 1 / -1; }
.advanced-filters summary { width: max-content; min-height: 30px; display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 680; list-style: none; }
.advanced-filters summary::-webkit-details-marker { display: none; }
.advanced-filters summary svg { width: 14px; height: 14px; }
.active-filter-count { display: grid; width: 18px; height: 18px; place-items: center; color: #fff; background: var(--accent); border-radius: 50%; font-size: 8px; }
.advanced-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 8px; padding: 12px; background: #f6f8f6; border: 1px solid var(--line); border-radius: 5px; }

.archive-layout { width: min(1380px, 100%); min-height: 680px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 390px; background: var(--surface); border-inline: 1px solid var(--line); }
.archive-results { min-width: 0; min-height: 680px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.archive-result-head { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.archive-result-head h2 { margin: 0; font-size: 15px; }
.archive-result-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.archive-result-head > span { color: var(--muted); font-size: 9px; text-align: right; }
.event-result-list { flex: 1; }
.event-result-card { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) 70px; gap: 12px; align-items: start; min-height: 118px; padding: 16px; background: #fff; border-bottom: 1px solid #e7ebe8; cursor: pointer; }
.event-result-card:hover { background: #f8faf8; }
.event-result-card.selected { background: #eef5f1; box-shadow: inset 3px 0 var(--accent); }
.event-result-icon { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: #65736c; border-radius: 50%; }
.event-result-card[data-hazard="wildfire"] .event-result-icon { background: #bd3f32; }
.event-result-card[data-hazard="flood"] .event-result-icon { background: #26718a; }
.event-result-card[data-hazard="heavy_rain"] .event-result-icon { background: #59658f; }
.event-result-card[data-hazard="thunderstorm"] .event-result-icon { background: #836127; }
.event-result-card[data-hazard="earthquake"] .event-result-icon { background: #69557b; }
.event-result-icon svg { width: 19px; height: 19px; }
.event-result-copy { min-width: 0; }
.event-result-meta { display: flex; flex-wrap: wrap; gap: 4px 11px; color: var(--muted); font-size: 8px; font-weight: 680; text-transform: uppercase; }
.event-result-meta span + span, .event-result-meta time { position: relative; }
.event-result-meta span + span::before, .event-result-meta time::before { content: ""; position: absolute; left: -6px; top: 4px; width: 2px; height: 2px; background: #a4aea8; border-radius: 50%; }
.event-result-card h3 { margin: 6px 0 5px; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.event-result-card p { display: flex; align-items: center; gap: 4px; margin: 0; color: var(--muted); font-size: 9px; }
.event-result-card p svg { width: 12px; height: 12px; }
.event-result-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 10px; }
.source-summary { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9px; }
.source-summary svg { width: 11px; height: 11px; }
.event-result-score, .historical-result-area { align-self: center; display: grid; justify-items: end; }
.event-result-score strong { font-size: 23px; font-variant-numeric: tabular-nums; }
.event-result-score span, .historical-result-area span { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.event-result-score svg, .historical-result-area svg { width: 15px; height: 15px; margin-top: 8px; color: #8d9892; }
.historical-result-area strong { font-size: 12px; white-space: nowrap; }
.archive-list-empty { min-height: 360px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 30px; color: var(--muted); text-align: center; }
.archive-list-empty svg { width: 28px; height: 28px; }
.archive-list-empty strong { color: var(--ink); font-size: 12px; }
.archive-list-empty span { font-size: 10px; }
.archive-detail { position: sticky; top: 0; max-height: calc(100vh - 64px); min-width: 0; overflow-y: auto; padding: 20px; background: #fbfcfb; }

@media (max-width: 1000px) {
  .advanced-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .archive-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 900px) {
  .archive-layout { display: block; min-height: 0; border-inline: 0; }
  .archive-results { min-height: 580px; border-right: 0; }
  .archive-detail { position: fixed; z-index: 1100; top: 64px; right: 0; bottom: 0; width: min(390px, 94vw); max-height: none; transform: translateX(105%); }
  .archive-detail.open { transform: translateX(0); }
}
@media (max-width: 700px) {
  .archive-page { min-height: calc(100vh - 116px); }
  .archive-intro { align-items: start; padding: 25px 16px; }
  .archive-intro h1 { font-size: 27px; }
  .archive-intro p { font-size: 11px; }
  .archive-primary-link { display: none; }
  .archive-controls { padding: 14px 12px; }
  .dataset-switcher { grid-template-columns: 1fr; }
  .archive-controls .search-form { grid-template-columns: 1fr auto; }
  .search-query, .primary-country, .advanced-filters { grid-column: 1 / -1; }
  .advanced-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-result-head { align-items: start; }
  .archive-result-head > span { max-width: 140px; }
  .event-result-card { grid-template-columns: 34px minmax(0, 1fr); min-height: 0; padding: 14px 12px; }
  .event-result-icon { width: 32px; height: 32px; }
  .event-result-score, .historical-result-area { grid-column: 2; display: flex; align-items: baseline; justify-content: flex-start; gap: 5px; }
  .event-result-score svg, .historical-result-area svg { position: absolute; right: 10px; top: 40%; margin: 0; }
  .archive-detail { top: 58px; bottom: 58px; }
}
@media (max-width: 460px) {
  .advanced-filter-grid { grid-template-columns: 1fr; }
  .reset-search span { display: none; }
  .archive-result-head > span { display: none; }
}
