.stage-card { border-right: 1px solid var(--line); min-width: 0; padding: 5px 14px 4px; position: relative; }
.stage-card:last-child { border-right: 0; }
.stage-card::before { background: var(--line-strong); bottom: 5px; content: ""; left: 0; position: absolute; top: 5px; width: 3px; }
.stage-card.good::before { background: var(--green); }
.stage-card.watch::before { background: var(--amber); }
.stage-card.critical::before { background: var(--red); }
.stage-top { align-items: center; display: flex; justify-content: space-between; }
.stage-top b { font-size: 11px; }
.stage-top span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.stage-value { align-items: baseline; display: flex; gap: 7px; margin: 5px 0 4px; min-height: 21px; }
.stage-value strong { font-size: 19px; font-variant-numeric: tabular-nums; line-height: 1; }
.stage-value em { color: var(--muted); font-size: 10px; font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-meta { color: var(--muted); display: flex; font-size: 9px; justify-content: space-between; }
.stage-meta span, .stage-meta time { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-meta time { flex: 0 1 52%; font-variant-numeric: tabular-nums; text-align: right; }
.stage-skeleton { animation: pulse 1.4s ease-in-out infinite; background: #e9ecf0; border-radius: 3px; height: 14px; margin-top: 10px; width: 72%; }
@keyframes pulse { 50% { opacity: .45; } }

.count-badge { align-items: center; background: var(--red-soft); border-radius: 10px; color: var(--red); display: flex; font-size: 10px; font-weight: 700; height: 21px; justify-content: center; min-width: 21px; padding: 0 6px; }
.filter-chip, .region-chip { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; height: 25px; padding: 0 9px; white-space: nowrap; }
.filter-chip:hover, .region-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-chip.active, .region-chip.active { background: #23272e; border-color: #23272e; color: #fff; }
.situation-row { background: var(--surface); border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 4px; display: grid; gap: 5px; margin-bottom: 4px; padding: 10px 9px 9px 12px; position: relative; text-align: left; width: 100%; }
.situation-row::before { background: var(--red); bottom: 8px; content: ""; left: 3px; position: absolute; top: 8px; width: 3px; }
.situation-row:hover { background: var(--surface-muted); }
.situation-row.active { background: var(--red-soft); border-color: #f2b8b2; }
.situation-row.warning::before { background: var(--amber); }
.situation-row.warning.active { background: var(--amber-soft); border-color: #eed49b; }
.situation-row.stale { border-style: dashed; }
.situation-head { align-items: center; display: flex; gap: 7px; justify-content: space-between; }
.situation-head b { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.severity-tag { background: var(--red-soft); border: 1px solid #f1c4c0; border-radius: 3px; color: var(--red); font-size: 8px; font-weight: 800; padding: 2px 4px; text-transform: uppercase; }
.situation-row.warning .severity-tag { background: var(--amber-soft); border-color: #eed49b; color: #946108; }
.situation-row p { font-size: 11px; font-weight: 600; line-height: 1.35; }
.situation-metric { align-items: center; color: var(--muted); display: flex; font-size: 9px; justify-content: space-between; }
.situation-metric strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.situation-source { color: var(--faint); font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.situation-evidence { color: var(--muted); font-size: 9px; line-height: 1.35; }
.empty-state { align-items: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; justify-content: center; min-height: 180px; padding: 24px; text-align: center; }
.empty-state svg { color: var(--green); height: 25px; width: 25px; }
.empty-state b { color: var(--ink); font-size: 12px; }
.empty-state p { font-size: 10px; line-height: 1.45; }

.search-box { align-items: center; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 5px; display: flex; height: 34px; padding: 0 8px; width: 180px; }
.search-box svg { color: var(--muted); height: 14px; width: 14px; }
.search-box input { background: transparent; border: 0; font-size: 11px; min-width: 0; outline: 0; padding: 0 6px; width: 100%; }
.facility-type-control { align-items: center; display: flex; flex: 0 0 auto; gap: 6px; }
.facility-type-control span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.facility-type-control select { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; color: var(--ink); font-size: 10px; height: 28px; max-width: 150px; padding: 0 24px 0 8px; }
.map-mode-control { flex: 0 0 auto; }
.map-mode-control button { height: 28px; padding: 0 8px; white-space: nowrap; }
.map-status, .map-legend { background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); color: var(--muted); font-size: 9px; padding: 6px 8px; }
.map-status.ready { color: var(--green); }
.map-status.error { color: var(--red); }
.map-legend { display: flex; gap: 10px; }
.map-legend span { align-items: center; display: flex; gap: 5px; }
.legend-dot { border: 1px solid #fff; border-radius: 50%; display: inline-block; height: 8px; width: 8px; }
.legend-dot.facility { background: #4f6c68; }
.legend-dot.critical { background: var(--red); box-shadow: 0 0 0 2px rgba(230, 54, 42, .18); }
.legend-dot.warning { background: var(--amber); box-shadow: 0 0 0 2px rgba(215, 151, 26, .18); }
.facility-marker { background: #3c625e; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 5px rgba(0, 0, 0, .28); height: 9px; width: 9px; }
.facility-marker.critical { background: var(--red); box-shadow: 0 0 0 4px rgba(230, 54, 42, .18), 0 2px 7px rgba(0, 0, 0, .25); height: 13px; width: 13px; }
.facility-marker.warning { background: var(--amber); box-shadow: 0 0 0 4px rgba(215, 151, 26, .18), 0 2px 7px rgba(0, 0, 0, .25); height: 13px; width: 13px; }
.leaflet-popup-content-wrapper { border-radius: 5px; box-shadow: var(--shadow); }
.leaflet-popup-content { font: 11px/1.4 Inter, sans-serif; margin: 9px 11px; }
.leaflet-control-zoom { border: 1px solid var(--line) !important; border-radius: 4px !important; overflow: hidden; }
.leaflet-control-zoom a { border-bottom-color: var(--line) !important; color: var(--ink) !important; }

.brain-header > img { background: #fff; border-radius: 50%; height: 48px; margin-right: 8px; object-fit: cover; object-position: center; width: 48px; }
.brain-header > div span { color: var(--muted); display: block; font-size: 9px; margin-top: 2px; }
.brain-live { background: var(--purple); border: 3px solid var(--purple-soft); border-radius: 50%; height: 11px; width: 11px; }
.brain-header.pointing > img { animation: pointOnce .7s ease-out 1; }
@keyframes pointOnce { 35% { transform: translateX(-5px) rotate(-3deg); } }
.brain-brief { display: grid; gap: 8px; }
.brain-verdict { border-left: 3px solid var(--purple); padding-left: 9px; }
.brain-verdict b { display: block; font-size: 12px; line-height: 1.4; }
.brain-verdict p { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 3px; }
.evidence-line { align-items: center; display: flex; flex-wrap: wrap; gap: 5px; }
.evidence-chip { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 8px; padding: 3px 5px; }
.brain-actions button { align-items: center; background: transparent; border-right: 1px solid var(--line); color: var(--muted); display: flex; flex-direction: column; font-size: 9px; gap: 4px; justify-content: center; min-height: 48px; padding: 5px; }
.brain-actions button:last-child { border-right: 0; }
.brain-actions button:hover { background: var(--purple-soft); color: var(--purple); }
.brain-actions svg { height: 15px; width: 15px; }
.chat-message { border-radius: 5px; font-size: 10px; line-height: 1.5; margin-bottom: 8px; max-width: 92%; padding: 8px 9px; white-space: pre-wrap; }
.chat-message.brain { background: var(--purple-soft); border: 1px solid #ded2fa; }
.chat-message.user { background: #242830; color: #fff; margin-left: auto; }
.chat-message.pending { color: var(--muted); }
.brain-composer { align-items: flex-end; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; display: flex; gap: 6px; padding: 6px; }
.brain-composer:focus-within { border-color: var(--purple); box-shadow: 0 0 0 2px var(--purple-soft); }
.brain-composer textarea { border: 0; max-height: 100px; min-height: 34px; outline: 0; padding: 5px; resize: none; width: 100%; }
.send-btn { align-items: center; background: var(--purple); border-radius: 5px; color: #fff; display: flex; flex: 0 0 34px; height: 34px; justify-content: center; }

.segmented { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; display: flex; overflow: hidden; }
.segmented button { background: transparent; border-right: 1px solid var(--line); color: var(--muted); font-size: 10px; height: 30px; min-width: 42px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: #242830; color: #fff; }
.trend-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-height: 230px; padding: 14px; }
.trend-card header { align-items: flex-start; display: flex; justify-content: space-between; }
.trend-card header span { color: var(--muted); font-size: 9px; }
.trend-latest { font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.trend-card canvas { display: block; height: 135px; margin-top: 12px; width: 100%; }
.trend-legend { color: var(--muted); display: flex; font-size: 9px; gap: 12px; }
.trend-legend i { border-radius: 50%; display: inline-block; height: 7px; margin-right: 4px; width: 7px; }
.trend-legend .nsl { background: var(--blue); }
.trend-legend .gsl { background: var(--amber); }
.mode-pill { background: var(--amber-soft); border: 1px solid #eed49b; border-radius: 10px; color: #946108; font-size: 10px; padding: 4px 8px; }
.action-row { align-items: center; border-bottom: 1px solid var(--line); display: grid; gap: 10px; grid-template-columns: 34px 1fr auto; padding: 12px; }
.action-row:last-child { border-bottom: 0; }
.action-icon { align-items: center; background: var(--purple-soft); border-radius: 5px; color: var(--purple); display: flex; height: 32px; justify-content: center; width: 32px; }
.action-row b { display: block; font-size: 11px; }
.action-row p { color: var(--muted); font-size: 9px; margin-top: 2px; }
.action-state { color: var(--amber); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.action-policy { padding: 14px; }
.action-policy h2 { margin-bottom: 10px; }
.policy-line { border-top: 1px solid var(--line); display: flex; font-size: 10px; justify-content: space-between; padding: 9px 0; }
.policy-line span { color: var(--muted); }
.policy-line b { text-align: right; }

@media (max-width: 1280px) {
  .brain-actions button { border-bottom: 1px solid var(--line); border-right: 0; flex-direction: row; min-height: 34px; }
  .brain-actions button:last-child { border-bottom: 0; }
}

@media (max-width: 760px) {
  .facility-type-control { min-width: 0; padding: 5px 7px; }
  .facility-type-control select { max-width: 128px; }
  .map-mode-control { margin-right: 6px; }
}
