:root {
  --bar: #12161d;
  --panel: #161b23;
  --mapbg: #0d1117;
  --line: #2a3340;
  --text: #e8edf4;
  --muted: #8b97a6;
  --tor: #e24b4b;
  --watch: #d59a1a;
  --svr: #c9b43a;
  --tvs: #ff7a18;
  --path: #f4f7fb;
  --forecast: #ffb020;
  --accent: #6ec8b8;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bar);
}

#app {
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.tabs {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.tab.on {
  background: #2a3340;
  color: var(--text);
}

.live {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid #2d5d55;
  padding: 1px 6px;
  border-radius: 3px;
}

.live.err {
  color: var(--tor);
  border-color: #6a2a2a;
}

.counts {
  display: flex;
  gap: 6px;
  flex: 1;
}

.pill {
  border: 1px solid var(--line);
  background: #1b212b;
  color: var(--text);
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 12px;
}

.pill b {
  font-size: 13px;
  margin-right: 3px;
}

.pill.tor b {
  color: var(--tor);
}
.pill.watch b {
  color: var(--watch);
}
.pill.svr b {
  color: #d6c45a;
}
.pill.tvs b {
  color: var(--tvs);
}

.pill.on,
.pill:hover {
  border-color: #4a5668;
  background: #232b36;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.top-actions button,
.rail button {
  border: 1px solid var(--line);
  background: #1b212b;
  color: var(--text);
  border-radius: 4px;
  padding: 4px 9px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#btn-notify.on {
  border-color: #6a2a2a;
  color: #f0b4b4;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px 1fr 332px;
}

.map-wrap {
  position: relative;
  min-width: 0;
  background: var(--mapbg);
}

#map {
  position: absolute;
  inset: 0;
}

.rail {
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.rail-sec {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
}

.rail-sec h2 {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.rail-sec .chk {
  margin: 5px 0;
}

.rail-sec .chk.range {
  flex-wrap: wrap;
  gap: 6px;
}

.rail-sec .chk.range input {
  width: 100%;
}

.seg.stacked {
  flex-direction: column;
}

.seg.stacked button {
  text-align: left;
  padding: 6px 8px;
}

.rail-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.rail-actions button {
  flex: 1;
}

#btn-reset {
  width: 100%;
  color: var(--muted);
}

.chk-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chk-line:has(.chk.range) {
  align-items: flex-start;
}

.chk-line .chk {
  flex: 1;
  min-width: 0;
}

.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 6px;
  padding: 0;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: 700 9px/1 var(--font);
  cursor: help;
  user-select: none;
}

.help:hover {
  border-color: var(--text);
  color: var(--text);
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.seg button {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.seg button.on {
  background: #2a3340;
}

.chk {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.chk.range input {
  width: 72px;
  accent-color: var(--accent);
}

.loop-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 2px 4px;
}

.loop-status {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  line-height: 1.2;
}

.loop-status[hidden] {
  display: none;
}

.legend {
  font-size: 11px;
  color: var(--muted);
}

.legend[hidden],
.legend-block[hidden] {
  display: none !important;
}

.legend-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

.legend i.now {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--tor);
  vertical-align: -1px;
}

.legend i.path {
  background: var(--forecast);
}

.legend i.tvs {
  background: var(--tvs);
}

.legend i.me {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  vertical-align: -1px;
}

.legend i.r2 { background: #73b2ff; height: 8px; }
.legend i.r5 { background: #3d7dcc; height: 8px; }
.legend i.r10 { background: #ffff00; height: 8px; }
.legend i.r15 { background: #ff9900; height: 8px; }


.radar-tiles {
  pointer-events: none;
}

.leaflet-radarWipe-pane {
  clip-path: inset(0 100% 0 0);
}

.leaflet-radarWipe-pane.reveal {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.outlook-meta {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  line-height: 1.45;
}

.outlook-text {
  margin: 0;
  padding: 10px 12px 16px;
  overflow: auto;
  flex: 1;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: #c5ced8;
}

#panel-outlook {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#outlook-day {
  margin-top: 8px;
}

body[data-tab="outlook"] .counts {
  opacity: 0.35;
  pointer-events: none;
}

.you-status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  max-width: min(520px, calc(100% - 80px));
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--line);
  background: rgba(18, 22, 29, 0.94);
}

.you-status.in {
  background: #4a1515;
  border-color: #8a2a2a;
  color: #ffd0d0;
}

.you-status.near {
  background: #3a2a10;
  border-color: #8a6a20;
  color: #ffe7b0;
}

.legend i.lsr {
  background: #b57bff;
}

.side {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-height: 0;
}

#panel-live {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.side-head {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.side-head h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #10141b;
  color: var(--muted);
  border-radius: 99px;
  padding: 3px 8px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.chip.on {
  background: #232b36;
  color: var(--text);
  border-color: #556274;
}

#feed-search {
  width: 100%;
  border: 1px solid var(--line);
  background: #10141b;
  color: var(--text);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
}

.feed {
  overflow: auto;
  padding: 8px;
}

.card {
  border: 1px solid var(--line);
  background: #1b212b;
  border-radius: 5px;
  padding: 8px 10px;
  margin-bottom: 7px;
  cursor: pointer;
}

.card:hover,
.card.active {
  border-color: #556274;
}

.card.fresh {
  border-left: 3px solid var(--tor);
}

.kind {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.card.warning .kind,
.card.emergency .kind {
  color: var(--tor);
}
.card.watch .kind {
  color: var(--watch);
}
.card.svr .kind {
  color: #d6c45a;
}

.card h3 {
  margin: 3px 0 5px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--tor);
  color: #fff;
  font-size: 9px;
}

.badge.new {
  background: var(--accent);
  color: #10221e;
}

.empty {
  color: var(--muted);
  padding: 20px 8px;
  text-align: center;
  font-size: 13px;
}

.toasts {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(340px, calc(100% - 24px));
  pointer-events: none;
}

.toasts .toast {
  pointer-events: auto;
}

.toast {
  background: var(--panel);
  border: 1px solid #6a2a2a;
  color: var(--text);
  border-radius: 5px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.toast b {
  display: block;
  font-size: 11px;
  color: var(--tor);
  margin-bottom: 2px;
}

.leaflet-container {
  font-family: var(--font);
  background: var(--mapbg);
}

.leaflet-control-zoom {
  border: 0 !important;
  margin-left: 10px !important;
  margin-top: 10px !important;
}

.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  width: 28px !important;
  height: 28px !important;
  line-height: 26px !important;
}

.leaflet-control-attribution {
  background: rgba(18, 22, 29, 0.8) !important;
  color: #8b97a6 !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #1b212b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.leaflet-popup-content {
  margin: 9px 11px;
  font-size: 13px;
}

.popup-k {
  color: var(--tor);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pin {
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #000;
}

.pin.storm {
  background: var(--tor);
}

.pin.tvs {
  background: var(--tvs);
  border-radius: 2px;
  transform: rotate(45deg);
}

.pin.lsr {
  background: #b57bff;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
}

.pin.me {
  background: #3b82f6;
  border: 3px solid #fff;
  width: 16px;
  height: 16px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.28);
}

.pin.flash {
  animation: storm-blink 0.5s step-end infinite;
}

path.flash-warn {
  animation: storm-blink 0.5s step-end infinite;
}

@keyframes storm-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.12;
  }
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1117;
}

.boot.out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.boot-card {
  width: min(360px, calc(100vw - 40px));
}

.boot-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.boot-step {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.boot-bar {
  height: 4px;
  background: #1b212b;
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.boot-bar i {
  display: block;
  height: 100%;
  width: 6%;
  background: var(--accent);
  transition: width 0.25s ease;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr 34vh;
  }
  .rail {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail-sec {
    min-width: 168px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }
  .side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
