/* LightKeeper 2 — single stylesheet. Dark, high-contrast, grid shell. */

@font-face { font-family: Inter; font-weight: 400; src: url(../vendor/fonts/inter-400.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 500; src: url(../vendor/fonts/inter-500.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 600; src: url(../vendor/fonts/inter-600.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 700; src: url(../vendor/fonts/inter-700.woff2) format("woff2"); font-display: swap; }

:root {
  --bg: #0f1923;
  --bg-1: #141f2b;
  --bg-2: #1a2634;
  --bg-3: #223040;
  --line: #2b3a4c;
  --text: #e6edf5;
  --text-2: #a9b7c6;
  --text-3: #74859a;
  --accent: #4f9dff;
  --accent-2: #2f7be6;
  --green: #35c983;
  --yellow: #f5c542;
  --orange: #ff9a3c;
  --red: #ff5f6d;
  --cyan: #3ad0e8;
  --purple: #9b8cff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --top-h: 48px;
  --rail-w: 56px;
  --panel-w: 360px;
  --status-h: 24px;
  --font: Inter, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-rows: var(--top-h) 1fr var(--status-h);
  grid-template-columns: var(--rail-w) var(--panel-w) 1fr;
  grid-template-areas: "top top top" "rail panel map" "status status status";
  overflow: hidden;
  user-select: none;
}
body.panel-hidden { grid-template-columns: var(--rail-w) 0 1fr; }
body.panel-hidden #panel { display: none; }
body.panel-hidden #progress { left: calc(var(--rail-w) + 14px); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg:not(.tchart) { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line); }
[hidden] { display: none !important; }

/* ── Top bar ── */
#topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.brand img { width: 24px; height: 24px; }
.brand-name { font-size: 16px; font-weight: 500; letter-spacing: .2px; }
.brand-name b { font-weight: 700; }
.brand-ver { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.search { position: relative; flex: 1; max-width: 520px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
#search {
  width: 100%; height: 32px; padding: 0 12px 0 32px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); outline: none;
}
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-3); }
#search-results {
  position: absolute; top: 36px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  max-height: 60vh; overflow: auto; z-index: 1300;
}
#search-results li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
#search-results li:hover, #search-results li.active { background: var(--bg-3); }
#search-results .kind { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); min-width: 56px; }
#search-results .sub { color: var(--text-3); font-size: 11px; margin-left: auto; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#district-select, .select {
  height: 32px; padding: 0 28px 0 10px; border-radius: 8px;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b7c6' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
  border: 1px solid var(--line); appearance: none; -webkit-appearance: none; color: var(--text);
}
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; color: var(--text-2); }
.seg button.on { background: var(--bg-3); color: var(--text); }
.chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2);
  border-radius: 999px; padding: 5px 11px; font-weight: 500;
}
.chip.on { border-color: var(--accent); color: var(--text); background: rgba(79, 157, 255, .15); }
.chip-count { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Rail ── */
#rail {
  grid-area: rail;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  padding: 8px 6px;
  background: var(--bg-1); border-right: 1px solid var(--line);
  z-index: 1100;
}
#rail button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-3);
  font-size: 10px; font-weight: 500;
}
#rail button:hover { background: var(--bg-2); color: var(--text-2); }
#rail button.on { background: rgba(79, 157, 255, .15); color: var(--accent); }
.rail-spacer { flex: 1; }
#rail-collapse svg { transition: transform .2s; }
body.panel-hidden #rail-collapse svg { transform: rotate(180deg); }

/* ── Panel ── */
#panel {
  grid-area: panel;
  background: var(--bg-1); border-right: 1px solid var(--line);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0;
  z-index: 1000;
}
.view { display: none; flex: 1; flex-direction: column; min-height: 0; }
.view.on { display: flex; }
.view-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.view-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.view-head h2 .count { font-size: 11px; font-weight: 500; color: var(--text-3); }
.view-head p { margin: 4px 0 0; color: var(--text-3); font-size: 12px; }
.view-body { flex: 1; overflow: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.view-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

/* ── Controls ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-weight: 500;
}
.btn:hover { background: var(--bg-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--red); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select, .field textarea {
  height: 34px; padding: 0 10px; border-radius: 8px; width: 100%;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text); outline: none;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.row > .btn { flex: 1 1 auto; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2);
  border-radius: 999px; padding: 4px 10px; font-size: 12px;
}
.pill.on { border-color: currentColor; background: var(--bg-3); color: var(--text); }
.pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.empty { padding: 28px 12px; text-align: center; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.switch input { width: 36px; height: 20px; appearance: none; background: var(--bg-3); border-radius: 999px; position: relative; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 18px; background: #fff; }

/* ── Lists ── */
.list { display: flex; flex-direction: column; gap: 4px; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid transparent;
  cursor: pointer;
}
.item:hover { border-color: var(--line); }
.item.sel { border-color: var(--accent); background: rgba(79, 157, 255, .12); }
.item .ico { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .right { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.item input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; padding: 2px 7px; border-radius: 999px; background: var(--bg-3); color: var(--text-2); }
.badge.light { color: var(--yellow); } .badge.buoy { color: var(--green); } .badge.daybeacon { color: var(--orange); }
.badge.bridge { color: var(--text-2); } .badge.ramp, .badge.marina { color: var(--cyan); } .badge.hotel, .badge.motel, .badge.resort, .badge.campground { color: var(--purple); }
.badge.park { color: var(--green); } .badge.dam { color: var(--red); } .badge.tide, .badge.current { color: var(--cyan); } .badge.gage { color: var(--accent); }

/* ── Cards (used by detail + trip days) ── */
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.box h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; }
.kv dt { color: var(--text-3); white-space: nowrap; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--bg-2); border-radius: 8px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 15px; }
.stat span { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }

/* ── Charts (detail card) ── */
.kv dd.wide, .kv dt.wide { grid-column: 1 / -1; }
.tchart { display: block; width: 100%; height: auto; margin: 2px 0 4px; overflow: visible; stroke: none; }
.tchart text { stroke: none; }
.tc-grid { stroke: var(--line); stroke-width: 1; }
.tc-zero { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.tc-axis { fill: var(--text-3); font-size: 9px; }
.tc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tc-area { fill: var(--accent); opacity: .12; }
.tc-dot { fill: var(--bg-1); stroke: var(--accent); stroke-width: 2; }
.tc-label { fill: var(--text); font-size: 9.5px; font-weight: 600; }
.tc-now { stroke: var(--yellow); stroke-width: 1; stroke-dasharray: 2 3; }
.tc-cross { stroke: var(--text-3); stroke-width: 1; }
.tc-hover { fill: var(--accent); }
.tc-readout { fill: var(--text); font-size: 10px; font-weight: 600; paint-order: stroke; stroke: var(--bg-1); stroke-width: 3px; }
.tc-muted { fill: var(--text-3); font-size: 11px; }

/* Animated "loading…" dots for live cells */
.loading-dots { color: var(--text-3); }
.loading-dots::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ── Detail card ── */
#detail {
  position: absolute; right: 16px; bottom: calc(var(--status-h) + 16px);
  width: 360px; max-height: calc(100vh - var(--top-h) - var(--status-h) - 32px);
  display: flex; flex-direction: column; z-index: 900; overflow: hidden;
}
#detail .d-head { display: flex; gap: 10px; align-items: flex-start; padding: 14px 14px 8px; }
#detail .d-head h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
#detail .d-head .badge { margin-top: 2px; }
#detail .d-close { margin-left: auto; border: 0; background: transparent; color: var(--text-3); font-size: 20px; line-height: 1; padding: 0 2px; }
#detail .d-close:hover { color: var(--text); }
#detail .d-body { padding: 0 14px 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
#detail .d-photo { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; background: var(--bg-2); }
#detail .d-line { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; }
#detail .d-line svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--text-3); }
#detail .d-line a { color: var(--accent); }
#detail .d-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 2px; }
#detail .d-src { font-size: 11px; color: var(--text-3); }

/* ── Map ── */
#map { grid-area: map; position: relative; background: #0b1218; }
.leaflet-container { font: inherit; background: #0b1218; }
.leaflet-control-zoom a { background: var(--bg-2) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { background: rgba(15, 25, 35, .7) !important; color: var(--text-3) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg-1); color: var(--text); box-shadow: var(--shadow); }
.leaflet-tooltip { background: var(--bg-1); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; padding: 3px 7px; }
.leaflet-tooltip-top::before { border-top-color: var(--line); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(79, 157, 255, .25); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: rgba(79, 157, 255, .8); color: #fff; font: 600 11px var(--font); }
.m { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .75); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .55); }
.m.light { background: var(--yellow); }
.m.buoy { background: var(--green); }
.m.daybeacon { background: var(--orange); }
.m.bridge { background: #94a3b8; border-radius: 3px; }
.m.other { background: #64748b; }
.m.sel { box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px rgba(79, 157, 255, .35); }
.m-poi { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; border: 2px solid rgba(255, 255, 255, .8); box-shadow: 0 2px 6px rgba(0, 0, 0, .6); background: var(--bg-3); }
.m-poi.ramp, .m-poi.marina { background: #0e7490; }
.m-poi.hotel, .m-poi.motel, .m-poi.resort, .m-poi.campground { background: #5b4bd6; }
.m-poi.park { background: #15803d; }
.m-poi.dam { background: #b91c1c; }
.m-poi.tide, .m-poi.current { background: #0891b2; }
.m-poi.gage { background: #2563eb; }
.m-poi.wp { width: 18px; height: 18px; font-size: 10px; font-weight: 700; background: var(--accent); color: #fff; }
.m-day { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 10px var(--font); color: #fff; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 800;
  background: rgba(20, 31, 43, .9); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 11px; color: var(--text-2); display: grid; grid-template-columns: auto auto; gap: 3px 12px; backdrop-filter: blur(4px);
}
.map-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--c); }
#map.measuring { cursor: crosshair; }
#ctx-menu {
  position: absolute; left: 0; top: 0; width: 230px; z-index: 950; padding: 4px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
#ctx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text); padding: 6px 10px; border-radius: 6px; text-align: left; font-size: 12.5px; }
#ctx-menu button:hover { background: var(--bg-3); }
.ctx-glyph { width: 16px; text-align: center; color: var(--text-2); }
.ctx-sep { border-top: 1px solid var(--line); margin: 4px 6px; }
#hover-hint {
  position: absolute; left: 0; top: 0; max-width: 220px; z-index: 850; pointer-events: none;
  background: rgba(20, 31, 43, .92); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
  font-size: 11px; color: var(--text-2); backdrop-filter: blur(3px); box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.hh-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--text); }
.hh-glyph { width: 14px; text-align: center; }
.hh-glyph.tide, .hh-glyph.current { color: var(--cyan); } .hh-glyph.gage { color: var(--accent); } .hh-glyph.dam { color: var(--red); }
.hh-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-dist { color: var(--text-3); }
.hh-tip { color: var(--text-3); font-size: 10.5px; }
.hh-row + .hh-tip { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 3px; }
.measure-label { background: var(--bg-1); color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; white-space: nowrap; }

/* ── Progress strip ── */
#progress {
  position: absolute; left: calc(var(--rail-w) + var(--panel-w) + 14px); bottom: calc(var(--status-h) + 14px);
  width: min(460px, 45vw); z-index: 850;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 10px 14px 12px;
}
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.progress-row span { flex: 1; }
#progress-close { border: 0; background: transparent; color: var(--text-3); font-size: 18px; line-height: 1; }
.progress-track { height: 4px; background: var(--bg-3); border-radius: 2px; margin-top: 8px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 2px; transition: width .3s; }
#progress-fill.indeterminate { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ── Status bar ── */
#statusbar {
  grid-area: status;
  display: flex; align-items: center; gap: 20px; padding: 0 14px;
  background: var(--bg-1); border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-3);
}
#sb-online { margin-left: auto; }
#sb-online.online::before, #sb-online.offline::before { content: "●"; margin-right: 5px; }
#sb-online.online { color: var(--green); }
#sb-online.offline { color: var(--yellow); }

.known-issues summary { cursor: pointer; font-weight: 600; color: var(--yellow); list-style: revert; }
.known-issues[open] summary { margin-bottom: 2px; }
.todo-list summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: revert; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 3000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal { width: min(440px, calc(100vw - 32px)); background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 10px; font-size: 16px; }
.modal p { margin: 6px 0; font-size: 13px; color: var(--text-2); }

/* ── First-launch import screen ── */
#firstrun { position: fixed; inset: 0; z-index: 2500; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.fr-card { width: min(560px, calc(100vw - 32px)); background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; box-shadow: var(--shadow); text-align: center; }
.fr-card img { width: 48px; height: 48px; }
.fr-card h2 { margin: 8px 0 6px; font-size: 20px; }
.fr-card p { margin: 0 0 14px; color: var(--text-2); font-size: 13px; }
#fr-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 2px; transition: width .3s; }
#fr-status { margin: 8px 0 10px; min-height: 16px; }
#fr-log { text-align: left; margin: 0; padding: 8px 10px 8px 34px; height: 180px; overflow: auto; background: var(--bg-2); border-radius: 8px; font-size: 11.5px; color: var(--text-2); font-family: Consolas, "Cascadia Mono", monospace; }
#fr-log li { padding: 1px 0; }
#fr-log li.ok { color: var(--green); }
#fr-log li.warn { color: var(--yellow); }
.fr-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }

/* ── Toasts ── */
#toasts { position: fixed; bottom: calc(var(--status-h) + 14px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 2000; pointer-events: none; }
.toast { padding: 9px 16px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 500; animation: toast-in .2s ease; pointer-events: auto; }
.toast.ok { border-left: 3px solid var(--green); } .toast.warn { border-left: 3px solid var(--yellow); } .toast.err { border-left: 3px solid var(--red); } .toast.info { border-left: 3px solid var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Trip plan ── */
.day { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-2); cursor: pointer; }
.day-head .m-day { flex-shrink: 0; }
.day-head b { font-weight: 600; }
.day-head .sub { font-size: 11px; color: var(--text-3); margin-left: auto; white-space: nowrap; }
.day-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.day.collapsed .day-body { display: none; }
.place { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--bg-2); border-radius: 8px; cursor: pointer; }
.place:hover { background: var(--bg-3); }
.place .m-poi { flex-shrink: 0; width: 22px; height: 22px; font-size: 11px; }
.place .pl-main { min-width: 0; flex: 1; }
.place .pl-title { font-weight: 500; }
.place .pl-sub { font-size: 11px; color: var(--text-3); }
.place .pl-role { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.aid-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.aid-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.aid-table td:first-child { color: var(--text-3); width: 20px; }
.aid-table td.eta { color: var(--text-3); white-space: nowrap; text-align: right; }
.warn-list { color: var(--yellow); font-size: 12px; padding-left: 16px; margin: 0; }
.note-list { color: var(--text-2); font-size: 12px; padding-left: 16px; margin: 0; }

/* ── Weather ── */
.wx-period { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--bg-2); border-radius: 8px; }
.wx-period img { width: 36px; height: 36px; border-radius: 6px; }
.wx-period .wx-name { font-weight: 600; }
.wx-period .wx-temp { margin-left: auto; font-size: 18px; font-weight: 600; }
.wx-period .wx-sub { font-size: 11px; color: var(--text-3); }
.alert { padding: 8px 10px; border-radius: 8px; background: rgba(255, 95, 109, .12); border: 1px solid rgba(255, 95, 109, .4); font-size: 12px; }
.alert b { display: block; color: var(--red); }

/* ── Responsive ── */
@media (max-width: 1280px) { :root { --panel-w: 320px; } .chips .chip { padding: 5px 9px; } }
@media (max-width: 1100px) {
  .brand-ver, #rail button span { display: none; }
  :root { --rail-w: 46px; --panel-w: 300px; }
  .search { max-width: 360px; }
}
@media (max-width: 900px) {
  body { grid-template-columns: var(--rail-w) 0 1fr; }
  #panel { position: absolute; left: var(--rail-w); top: var(--top-h); bottom: var(--status-h); width: min(360px, calc(100vw - var(--rail-w))); box-shadow: var(--shadow); }
  body.panel-hidden #panel { display: none; }
body.panel-hidden #progress { left: calc(var(--rail-w) + 14px); }
  #detail { width: calc(100vw - 32px); right: 16px; }
  .chips { display: none; }
}
@media print {
  #topbar, #rail, #panel, #statusbar, #progress, #toasts, #detail { display: none !important; }
  body { display: block; background: #fff; color: #000; }
}

/* Loading-map overlay (fast zoom) */
#map-veil { position: absolute; inset: 0; z-index: 700; display: flex; align-items: center; justify-content: center;
  background: rgba(11, 18, 24, .35); backdrop-filter: blur(2px); pointer-events: none; }
.veil-box { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; background: var(--bg-1); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 500; }
.veil-spin { width: 16px; height: 16px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }

/* ── Aid card: light preview, glance tiles, sections, live tiles, action bar ── */
#detail .d-title { min-width: 0; }
.light-preview { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: #0b1218; border: 1px solid var(--line); display: grid; place-items: center; }
.lp-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px 2px var(--c), 0 0 18px 5px color-mix(in srgb, var(--c) 40%, transparent); transition: background-color 60ms, box-shadow 60ms; }
.lp-dot.off { background: #26313d; box-shadow: none; }
.light-preview.unlit .lp-dot { width: 10px; height: 10px; background: transparent; border: 2px solid var(--c); box-shadow: none; }

.ac-tiles { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; }
.ac-tile { min-width: 0; padding: 8px 9px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.ac-v { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ac-v.none { color: var(--text-3); font-weight: 500; }
.ac-k { margin-top: 2px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }

.d-sec { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.d-sec h4 { margin: 0; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); }
.d-sec .kv { margin: 0; }
.ac-coords { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }

.lt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.live-tile { position: relative; display: flex; gap: 8px; align-items: flex-start; min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.lt-ico svg { width: 16px; height: 16px; margin-top: 1px; color: var(--accent); }
.lt-main { flex: 1; min-width: 0; padding-right: 10px; }
.lt-label { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.lt-value { margin-top: 1px; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.lt-value a { color: var(--accent); }
.lt-sub { margin-top: 2px; font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }
.live-tile.na .lt-value { color: var(--text-3); font-weight: 500; }
.fresh { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--bg-3); }
.fresh.ok { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.fresh.old { background: var(--yellow); }
.fresh.na { background: var(--text-3); opacity: .6; }
.skel { display: block; width: 75%; height: 12px; margin: 3px 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-3) 25%, #2e4053 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

#detail .d-bar { flex-shrink: 0; display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg-1); }
#detail .d-bar .btn { flex: 1 1 auto; white-space: nowrap; }
#detail .d-bar .btn.icon { flex: 0 0 auto; width: 32px; padding: 0; display: inline-grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } .lp-dot { transition: none; } }
