/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #162032;
  --surface-hover: #253349;
  --input: #0f172a;
  --border: #334155;
  --border-soft: #2a3649;

  --text: #f1f5f9;
  --text-muted: #a3b1c6;
  --text-subtle: #7d8ba1;

  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --on-accent: #0b1220;

  /* Severity ramp, ordered by AWS rank: impacted < degraded < disrupted. */
  --impacted: #facc15;
  --degraded: #fb923c;
  --disrupted: #f87171;
  --resolved: #2dd4bf;
  --operational: #34d399;
  --informational: #93a4bd;
  --unknown: #7d8ba1;
  --no-data: #334155;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.55);
}

/* Light theme: explicit choice, or "auto" on a light system. */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --surface-hover: #eef2f7;
  --input: #f1f4f8;
  --border: #d9e0ea;
  --border-soft: #e6ebf2;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent: #0369a1;
  --accent-soft: rgba(3, 105, 161, 0.1);
  --on-accent: #ffffff;
  --impacted: #b58a00;
  --degraded: #ea580c;
  --disrupted: #dc2626;
  --resolved: #0d9488;
  --operational: #059669;
  --informational: #64748b;
  --unknown: #94a3b8;
  --no-data: #dfe5ee;
  --shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.18);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f1f4f8;
    --surface-hover: #eef2f7;
    --input: #f1f4f8;
    --border: #d9e0ea;
    --border-soft: #e6ebf2;
    --text: #0f172a;
    --text-muted: #475569;
    --text-subtle: #64748b;
    --accent: #0369a1;
    --accent-soft: rgba(3, 105, 161, 0.1);
    --on-accent: #ffffff;
    --impacted: #b58a00;
    --degraded: #ea580c;
    --disrupted: #dc2626;
    --resolved: #0d9488;
    --operational: #059669;
    --informational: #64748b;
    --unknown: #94a3b8;
    --no-data: #dfe5ee;
    --shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.18);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 0.85em; }
button { font: inherit; color: inherit; }
body.modal-open { overflow: hidden; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 8px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* ---------- Buttons & inputs ---------- */
.btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover, .icon-btn:hover { background: var(--surface-hover); text-decoration: none; }
.icon-btn { width: 36px; padding: 0; color: var(--text-muted); }
.icon-btn:hover { color: var(--text); }

.link-btn {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
}
.seg-btn {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.seg-btn:disabled { opacity: 0.4; cursor: default; }
.seg-arrow { font-size: 1.1rem; line-height: 1; padding: 0 10px; color: var(--text); }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--text-subtle);
  flex: 1 1 280px;
  min-width: 0;
}
.search-field:focus-within { border-color: var(--accent); }
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.search-field input::placeholder { color: var(--text-subtle); }
.search-field-sm { height: 34px; flex: none; margin-bottom: 12px; }

.select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---------- Severity marks ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--unknown); }
.dot-impacted { background: var(--impacted); }
.dot-degraded { background: var(--degraded); }
.dot-disrupted { background: var(--disrupted); }
.dot-resolved { background: var(--resolved); }
.dot-operational { background: var(--operational); }
.dot-informational { background: var(--informational); }
.dot-no_data { background: var(--no-data); box-shadow: inset 0 0 0 1px var(--border); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
}
.badge .dot { width: 6px; height: 6px; }
.badge-open { border-color: var(--accent); color: var(--accent); }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--border-soft); }
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { border-radius: 10px; flex: none; }
.brand h1 { font-size: 1.15rem; font-weight: 700; }
.subtitle { font-size: 0.85rem; color: var(--text-muted); }
.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.theme-icon { display: none; }
html:not([data-theme]) .theme-icon[data-mode="auto"],
[data-theme="light"] .theme-icon[data-mode="light"],
[data-theme="dark"] .theme-icon[data-mode="dark"] { display: block; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.menu-label { padding: 6px 10px 8px; font-size: 0.75rem; color: var(--text-subtle); }
.menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  font-size: 0.875rem;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); outline: none; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-header h2 { font-size: 1.05rem; font-weight: 600; }
.panel-sub { margin-top: 2px; font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 24px; }
.sidebar-panel { padding: 16px; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sidebar-header h2 { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.count-pill {
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}
.region-list { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 200px); overflow-y: auto; }
.region-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.region-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.region-item[aria-current="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.region-item[aria-current="true"] .count-pill { background: var(--accent); color: var(--on-accent); }
.region-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.region-pills { display: none; }

/* ---------- Overview ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.stat-value { margin-top: 4px; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.9rem; font-weight: 500; color: var(--text-subtle); }
.stat-sub { font-size: 0.78rem; color: var(--text-subtle); }

.daily { border-top: 1px solid var(--border-soft); padding-top: 16px; }
.daily-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.daily-head h3 { font-size: 0.9rem; font-weight: 600; }
.cal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-nav { align-items: center; }
.cal-label { min-width: 124px; padding: 0 8px; text-align: center; font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.45; cursor: default; }

.strip-stage { position: relative; margin-top: 12px; }
.bar { border-radius: 2px; background: var(--no-data); cursor: pointer; }
.bar-impacted { background: var(--impacted); }
.bar-degraded { background: var(--degraded); }
.bar-disrupted { background: var(--disrupted); }
.bar-resolved { background: var(--resolved); }
.bar-informational { background: var(--informational); }
.bar-unknown { background: var(--unknown); }
.bar-no_data { cursor: default; }
.bar-future { background: transparent; box-shadow: inset 0 0 0 1px var(--border-soft); cursor: default; }
.bar-ongoing { cursor: pointer; box-shadow: inset 0 calc(-1 * var(--line, 5px)) 0 var(--ongoing); }
.ongoing-impacted { --ongoing: var(--impacted); }
.ongoing-degraded { --ongoing: var(--degraded); }
.ongoing-disrupted { --ongoing: var(--disrupted); }
.bar:not(.bar-no_data):not(.bar-future):hover, .bar-ongoing:hover { opacity: 0.8; }
.bar:focus-visible { outline-offset: 1px; }
.bar-selected { outline: 2px solid var(--text); outline-offset: 1px; }
.legend-line { display: inline-block; width: 14px; height: 5px; border-radius: 1px; background: var(--disrupted); }

/* Month: one bar per day. */
.strip-month { display: flex; gap: 3px; height: 44px; }
.strip-month .bar { flex: 1 1 0; min-width: 2px; }

/* Year: weeks across, weekdays down. */
.strip-year { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-auto-columns: 1fr; gap: 3px; --line: 3px; }
.strip-year .bar, .bar-pad { aspect-ratio: 1; min-width: 0; }
.strip-months { display: grid; gap: 3px; margin-bottom: 4px; }
.month-label {
  grid-row: 1;
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-subtle);
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: pointer;
}
.month-label:hover:not(:disabled) { color: var(--accent); text-decoration: underline; }
.month-label:disabled { opacity: 0.4; cursor: default; }

.strip-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.75rem; color: var(--text-subtle); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--text-muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  pointer-events: none;
}
.tooltip-date { font-weight: 600; margin-bottom: 4px; }
.tooltip-status { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.tooltip-list { margin: 6px 0 0; padding: 0; list-style: none; color: var(--text-muted); }
.tooltip-list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Filters ---------- */
.filter-panel { padding: 14px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.active-filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.8rem;
}
.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.chip-remove:hover { background: var(--surface-hover); color: var(--text); }

/* ---------- Open incidents ---------- */
.open-list { display: flex; flex-direction: column; gap: 12px; }
.open-card { padding: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.open-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.open-title { font-size: 0.95rem; font-weight: 600; }
.open-meta { margin-top: 2px; font-size: 0.8rem; color: var(--text-muted); }
.service-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.service-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.78rem;
}
.muted { color: var(--text-subtle); }
.service-grid.is-collapsed > .service-chip:nth-child(n + 31) { display: none; }
.note { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Incident log ---------- */
.incident-list { display: flex; flex-direction: column; gap: 8px; }
.incident {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 0 14px;
  padding: 14px 14px 14px 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s;
}
.incident:hover { border-color: var(--border); }
.incident-rail { border-radius: 0 3px 3px 0; background: var(--unknown); }
.incident.sev-impacted .incident-rail { background: var(--impacted); }
.incident.sev-degraded .incident-rail { background: var(--degraded); }
.incident.sev-disrupted .incident-rail { background: var(--disrupted); }
.incident-title {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.incident-title:hover { text-decoration: underline; }
.incident-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 0.8rem; color: var(--text-muted); }
.incident-latest {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.incident-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pager { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.pager-bottom { justify-content: flex-end; margin-top: 14px; }
.page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.page-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.page-btn[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-arrow { font-size: 1.1rem; line-height: 1; }
.page-gap { padding: 0 2px; color: var(--text-subtle); }

.state { padding: 32px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.state-title { font-weight: 600; }
.state-desc { font-size: 0.85rem; color: var(--text-muted); }
.state-error .state-title { color: var(--disrupted); }
.skeleton { width: 100%; height: 76px; border-radius: var(--radius-sm); background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------- Service history grid ---------- */
.grid-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.date-field, .check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.events-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 12px; }
.events-toolbar .pager { margin-left: 0; margin-right: auto; }

.grid-wrap { overflow-x: auto; }
.svc-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.svc-table th, .svc-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.svc-table thead th { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-align: center; white-space: nowrap; }
.svc-table .svc-col { text-align: left; font-weight: 400; min-width: 200px; position: sticky; left: 0; background: var(--surface); }
.svc-table thead .svc-col { font-weight: 600; }
.svc-table tbody tr:hover .svc-col, .svc-table tbody tr:hover td { background: var(--surface-2); }
.svc-name { display: block; font-weight: 500; }
.svc-region { display: block; font-size: 0.76rem; color: var(--text-subtle); }
.day-col { width: 72px; text-align: center; }
.cell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.cell-btn:hover { background: var(--surface-hover); }
.cell-none { color: var(--text-subtle); opacity: 0.6; }
.sev-icon { flex: none; color: var(--unknown); }
.sev-color-impacted { color: var(--impacted); }
.sev-color-degraded { color: var(--degraded); }
.sev-color-disrupted { color: var(--disrupted); }
.sev-color-resolved { color: var(--resolved); }
.grid-legend { margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 40px;
  font-size: 0.8rem;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.6);
}
.modal {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: min(86vh, 900px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.modal:focus { outline: none; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-sub { margin-top: 4px; font-size: 0.82rem; color: var(--text-muted); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border-soft); }
.modal-section + .modal-section { margin-top: 20px; }
.modal-section h3 { margin-bottom: 10px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 16px 18px; border-left: 1px solid var(--border); margin-left: 4px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li > .dot { position: absolute; left: -4.5px; top: 6px; }
.timeline-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.timeline-desc { margin-top: 4px; font-size: 0.875rem; white-space: pre-line; overflow-wrap: anywhere; }
.timeline-desc a { text-decoration: underline; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  transition: opacity 0.2s, transform 0.2s;
}
.toast-leaving { opacity: 0; transform: translateY(6px); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .sidebar { display: none; }
  .region-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 0 16px 2px;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .region-pills::-webkit-scrollbar { display: none; }
  .region-pill {
    flex: none;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
  }
  .region-pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .header-inner { padding: 12px 16px; flex-wrap: wrap; }
  .subtitle { font-size: 0.8rem; }
  .panel { padding: 16px; }
  .panel-header { flex-wrap: wrap; }
  .filter-bar .segmented { width: 100%; }
  .filter-bar .seg-btn { flex: 1; padding: 0 6px; }
  .strip-year, .strip-months { gap: 1px; }
  .month-label:nth-child(even) { display: none; }
  .cal-label { min-width: 96px; }
  .svc-table .svc-col { min-width: 132px; }
  .svc-table th, .svc-table td { padding: 8px 6px; }
  .day-col { width: 44px; }
  .incident { grid-template-columns: 4px minmax(0, 1fr); }
  .incident-side { grid-column: 2; flex-direction: row; align-items: center; margin-top: 10px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
