/* Storm Spotter Suite: dark, map-centric operations layout (see "UI Layout" in docs/requirements.md). */
:root {
  --bg: #0b0f16;
  --panel: #111723;
  --panel-border: #1f2937;
  --text: #e5e7eb;
  --muted: #8b95a5;
  --accent: #7cc4fa;   /* primary actions */
  --warn: #f0a830;     /* ACTIVE, send */
  --danger: #f2706a;   /* warnings, unsent */
  --ok: #4ade80;       /* verified / relayed */
  --radius: 8px;
  --gap: 8px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.mono, .clock { font-family: var(--mono); }
.muted { color: var(--muted); }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  margin: var(--gap) var(--gap) 0; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--accent); }
.spacer { flex: 1; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  background: var(--warn); color: #1a1205;
}
.badge-admin { background: var(--danger); }

main { flex: 1; min-height: 0; padding: var(--gap); }
.panel {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 12px; min-height: 0; overflow: auto;
}

/* Desktop operations grid: left | map | right, with a log strip underneath. */
.ops-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(220px, 1fr) 2.4fr minmax(240px, 1fr);
  grid-template-rows: 1fr minmax(110px, 18vh);
  grid-template-areas: "left map right" "bottom bottom bottom";
}
.panel-left { grid-area: left; }
.panel-map { grid-area: map; display: flex; flex-direction: column; }
.panel-right { grid-area: right; }
.panel-bottom { grid-area: bottom; }
/* Flash messages on the home page float over the grid instead of taking a cell, and fade. */
.ops-grid > .flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 2000; width: min(520px, calc(100% - 24px)); box-shadow: 0 6px 24px #000a; animation: flash-out 0.6s ease 8s forwards; }
.ops-grid > .flash p { margin: 0; background: #0f2a1a; padding: 12px 14px; font-weight: 600; }
.ops-grid > .flash p.err { background: #2a1214; }
@keyframes flash-out { to { opacity: 0; visibility: hidden; } }
.panel-map { padding: 8px; overflow: hidden; }
.map-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.map-head h2 { margin: 0; }
.live-map { flex: 1; min-height: 360px; border-radius: 6px; border: 1px solid var(--panel-border); background: #0e1520; }

/* Phones: stack the panels, map first. */
@media (max-width: 800px) {
  .ops-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "map" "left" "right" "bottom";
    overflow-y: auto; align-content: start;
  }
  .ops-grid > .panel { overflow: visible; min-height: auto; }
  .panel-map { display: block; }
  .live-map { height: 62vh; min-height: 320px; }
}

.footer { padding: 4px 14px 8px; font-size: 12px; color: var(--muted); }

/* --- Admin console ------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs a {
  color: var(--muted); text-decoration: none; padding: 4px 10px; border-radius: 6px;
  border: 1px solid transparent;
}
.tabs a:hover { color: var(--text); border-color: var(--panel-border); }
.tabs a.on { color: var(--text); background: #18202e; border-color: var(--panel-border); }

main.console { overflow: auto; }
.console-grid {
  display: grid; gap: var(--gap); align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}
.console-grid .wide { grid-column: 1 / -1; }
.console p { margin: 6px 0; }
a { color: var(--accent); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; }
table.data th, table.data td { padding: 6px 8px; border-bottom: 1px solid var(--panel-border); vertical-align: top; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row.nowrap { flex-wrap: nowrap; margin-top: 0; }
label { display: flex; flex-direction: column; gap: 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
fieldset { border: 1px solid var(--panel-border); border-radius: 6px; padding: 8px 10px; }
fieldset ul, fieldset div { list-style: none; margin: 0; padding: 0; }
/* Checkbox/radio groups: Django wraps each input in its own <label>; keep box and text on
   one line (the generic label rule above stacks them for text fields). */
fieldset label {
  flex-direction: row; align-items: center; gap: 8px;
  padding: 3px 0; cursor: pointer;
}
fieldset input[type=checkbox], fieldset input[type=radio], label.check input {
  margin: 0; flex: none; width: 16px; height: 16px; accent-color: var(--accent);
}
legend { color: var(--muted); padding: 0 4px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  background: #0e1520; color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 8px 10px; font: inherit;
}
select[multiple] { min-height: 180px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  background: #18202e; color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #06121c; border-color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.on { border-color: var(--ok); color: var(--ok); }

.chip {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px;
  border: 1px solid var(--panel-border); color: var(--muted); margin-right: 4px;
}
.chip.ok { color: var(--ok); border-color: var(--ok); }
.chip.primary { color: var(--warn); border-color: var(--warn); }
.ok { color: var(--ok); }
.err { color: var(--danger); }
.result { padding: 8px 10px; border-radius: 6px; border: 1px solid var(--panel-border); }
.result.ok { border-color: var(--ok); }
.result.err { border-color: var(--danger); color: var(--danger); }
.errorlist { color: var(--danger); margin: 0; padding-left: 16px; }
ol.steps { padding-left: 20px; }
ol.steps li { margin: 6px 0; }

/* Event types page */
table.events td { vertical-align: middle; }
table.events input.emoji { width: 5em; text-align: center; font-size: 16px; }
table.events input[type=color] {
  width: 44px; height: 28px; padding: 0; border: 1px solid var(--panel-border);
  background: none; vertical-align: middle; cursor: pointer;
}
.swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px;
  vertical-align: middle; border: 1px solid rgba(255, 255, 255, .35);
}

/* Status page: Feeds and Events side by side, ~50/50 (stacked on narrow screens). */
.split { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.events-log { max-height: 420px; overflow-y: auto; }
.events-log p { margin: 0 0 8px; overflow-wrap: anywhere; line-height: 1.45; }

/* --- Accounts / sign-in ------------------------------------------------------------------ */
.small { font-size: 12px; }
.result.warn { border-color: var(--warn); color: var(--warn); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
input[type=email], input[type=tel], input[type=date], input[type=number] {
  background: #0e1520; color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 8px 10px; font: inherit;
}
main.auth { overflow: auto; display: flex; flex-direction: column; align-items: center; gap: var(--gap); }
main.auth.manage { align-items: stretch; }
main.auth > * { flex: none; }
main.auth .panel { overflow: visible; }
main.auth > .flash { width: min(560px, 100%); }
main.auth.manage > .flash { width: auto; }
main.auth > section, main.auth > form:not(.profile), main.auth > h1, main.auth > p, main.auth > article {
  width: min(560px, 100%);
}
main.auth.manage > section, main.auth.manage > h1, main.auth.manage > p { width: auto; }
main.auth h1 { font-size: 20px; margin: 0 0 12px; }
main.auth .auth-form input:not([type=checkbox]):not([type=radio]), main.auth .auth-form select { width: 100%; }
.auth-card { padding: 20px 24px; }
.auth-card .auth-form { margin-top: 4px; }
.auth-form p { margin: 0; display: flex; flex-direction: column; gap: 4px; }
label.check { align-items: flex-start; }
label.check input { margin-top: 2px; }
.provider-buttons { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.provider-buttons form { margin: 0; }
.btn.provider { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 14px; }
.btn.provider.prominent { font-size: 16px; padding: 14px; }
.btn.provider-slack.prominent { background: #4a154b; border-color: #6b2c6c; color: #fff; }
.btn.provider-google.prominent { background: #fff; border-color: #dadce0; color: #1f1f1f; }
.btn.provider-microsoft { background: #2f2f2f; border-color: #5e5e5e; color: #fff; }
.provider-mark { width: 18px; height: 18px; border-radius: 3px; flex: none; }
.provider-slack .provider-mark { background: conic-gradient(#36c5f0 0 25%, #2eb67d 0 50%, #ecb22e 0 75%, #e01e5a 0); }
.provider-google .provider-mark { background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); border-radius: 50%; }
.provider-microsoft .provider-mark { background: conic-gradient(#7fba00 0 25%, #00a4ef 0 50%, #ffb900 0 75%, #f25022 0); border-radius: 0; }
.btn.passkey { width: 100%; }
.provider-list { display: flex; flex-direction: column; gap: 8px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 6px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--panel-border); }
.auth-panel { margin-bottom: var(--gap); }
ul.links { padding-left: 18px; margin: 0; }
ul.links li { margin: 6px 0; }
table.phones input, table.phones select { width: 100%; }
article.policy { line-height: 1.6; max-width: 820px; width: min(820px, 100%) !important; }
article.policy h1 { font-size: 22px; }
article.policy h2 { font-size: 16px; margin-top: 18px; }

.usermenu { position: relative; }
.usermenu summary {
  list-style: none; cursor: pointer; padding: 4px 10px; border: 1px solid var(--panel-border);
  border-radius: 6px; color: var(--text);
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary::after { content: " ▾"; color: var(--muted); }
.usermenu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1000; min-width: 200px;
  display: flex; flex-direction: column; padding: 6px; gap: 2px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.usermenu .menu a, .usermenu .menu button {
  text-align: left; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none;
  background: none; border: 0; font: inherit; cursor: pointer;
}
.usermenu .menu a:hover, .usermenu .menu button:hover { background: #18202e; }
.usermenu .menu form { margin: 0; border-top: 1px solid var(--panel-border); padding-top: 2px; }
/* Authenticator-app QR code: dark modules need a light quiet zone to scan. */
main.auth img[src^="data:image/svg"] {
  display: block; width: 240px; height: auto; background: #fff; padding: 14px; border-radius: 8px;
}
main.auth.manage > *:not(form.profile) { max-width: 900px; }
.count-badge {
  display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; text-align: center;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
}

/* --- Spotter report page (mobile first, FR-116/131) ----------------------------------------- */
main.report-main { overflow: auto; display: flex; justify-content: center; }
.report-card { width: min(560px, 100%); padding: 16px 18px; overflow: visible; }
.report-card h1 { font-size: 20px; margin: 0 0 6px; }
.report-card input[type=text], .report-card input[type=number], .report-card input[type=datetime-local],
.report-card textarea { width: 100%; font-size: 16px; }  /* 16px: no iOS zoom-on-focus */
.report-card textarea {
  background: #0e1520; color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 16px;
}
.report-alert { margin: 4px 0; padding: 8px 10px; border-left: 3px solid var(--warn); background: #18202e; border-radius: 4px; }
.report-test { margin: 4px 0; padding: 8px 10px; border: 2px dashed #c792ea; background: #221a2e; border-radius: 4px; color: #e8d8ff; }
.chip.test-chip { background: #c792ea; color: #14101c; font-weight: 700; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.btn.send { margin-top: 6px; }
.report-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 6px; }
.report-actions .btn { margin: 0; text-align: center; text-decoration: none; box-sizing: border-box; }
.report-map { height: 260px; border-radius: 6px; border: 1px solid var(--panel-border); }
.hazard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.hazard { min-height: 64px; font-size: 16px; }
.btn.hazard.on { border-width: 2px; color: #fff; }
.btn.hazard-hail.on { background: #0b6b0b; border-color: #00c000; }
.btn.hazard-wind_damage.on { background: #0f4c8a; border-color: #1e90ff; }
.btn.hazard-flooding.on { background: #035f5f; border-color: #00a0a0; }
.btn.hazard-tornado_funnel.on { background: #8a1010; border-color: #ff3b3b; }
fieldset.hazards { border: 0; padding: 0; margin: 0; }
.field-error { color: var(--danger); font-size: 13px; }
.field-error:empty { display: none; }
.queue-status ul { margin: 6px 0; padding-left: 18px; }
.recent-report { padding: 6px 0; border-bottom: 1px solid var(--panel-border); }
.recent-report:last-child { border-bottom: 0; }
.chip.hazard-hail { color: #4ade80; border-color: #4ade80; }
.chip.hazard-wind_damage { color: #7cc4fa; border-color: #7cc4fa; }
.chip.hazard-flooding { color: #2dd4bf; border-color: #2dd4bf; }
.chip.hazard-tornado_funnel { color: #f87171; border-color: #f87171; }
.chip.hazard-other { color: #cbd5e1; border-color: #94a3b8; }
.chip.nws-chip { color: #93c5fd; border-color: #3b82f6; font-weight: 600; }
.trained-badge { color: #fcd34d; }
.report-filter { margin: 0 0 6px; font-size: 0.9em; }
.report-filter summary { cursor: pointer; color: var(--muted, #9aa4b2); }
.report-filter form { display: grid; gap: 6px; padding: 6px 0; }
.report-filter fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.report-filter legend { padding: 0; font-size: 0.85em; color: var(--muted, #9aa4b2); width: 100%; }
.report-filter label { flex-direction: row; align-items: center; gap: 4px; margin: 0; }
main.report-main { align-items: flex-start; }
.report-card { flex: none; }
/* Narrow screens: let the top bar wrap instead of widening the page; drop the clock. */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; margin: 6px 6px 0; }
  .topbar .clock { display: none; }
  .tabs { flex-wrap: wrap; margin-left: 0; }
  main { padding: 6px; }
  .report-card { padding: 12px; }
  .usermenu summary { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* --- Live map (home) --------------------------------------------------------------------- */
.alert-row {
  display: block; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: #0e1520; border: 1px solid var(--panel-border); border-left: 4px solid var(--alert-color, var(--muted));
  border-radius: 6px; padding: 6px 8px; margin-bottom: 6px;
}
.alert-row:hover:not([disabled]) { background: #18202e; }
.alert-row[disabled] { cursor: default; opacity: 0.8; }
.alert-row .alert-title { display: block; }
.recent-report[data-report-id] { cursor: pointer; }
.recent-report[data-report-id]:hover { background: #18202e; }
.warn-text { color: var(--warn); }
.leaflet-container { font: inherit; background: #0e1520; }
.leaflet-container .leaflet-popup-content-wrapper, .leaflet-container .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); }
.leaflet-container .leaflet-popup-content { margin: 10px 12px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container .leaflet-tooltip { background: var(--panel); color: var(--text); border-color: var(--panel-border); }
.leaflet-control-attribution { background: rgba(17, 23, 35, 0.8) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--accent); }
.leaflet-container .leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--panel-border); }
.leaflet-container .leaflet-bar a:hover { background: #18202e; }
.map-popup { display: grid; gap: 4px; }
.map-popup .btn { margin-top: 4px; justify-self: start; text-decoration: none; }
.map-control, .map-legend {
  background: rgba(17, 23, 35, 0.92); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 6px 8px; font-size: 13px;
}
.map-control summary, .map-legend summary { cursor: pointer; font-weight: 600; }
.map-control label { flex-direction: row; align-items: center; gap: 6px; margin: 4px 0; white-space: nowrap; }
.map-control select { background: #0e1520; color: var(--text); border: 1px solid var(--panel-border); border-radius: 4px; padding: 2px 4px; }
.map-legend { max-height: 40vh; overflow: auto; max-width: 240px; }
.map-legend .legend-rows > div { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.map-legend .legend-row { display: flex; align-items: center; gap: 6px; width: 100%; margin: 1px 0; padding: 2px 4px; background: none; border: 1px solid transparent; border-radius: 4px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.map-legend .legend-row:hover, .map-legend .legend-row:focus-visible { border-color: var(--panel-border); background: rgba(255,255,255,.05); }
.map-legend .legend-row.off .legend-label { text-decoration: line-through; opacity: .5; }
.map-legend .legend-row.off .sw { opacity: .3; }
.map-legend .legend-hint { margin: 2px 0 4px; }
.map-legend .legend-all { margin-top: 6px; }
.map-legend .legend-sub { color: var(--muted); margin-top: 6px; }
.map-legend .sw { display: inline-block; flex: none; }
.map-legend .sw-area { width: 16px; height: 10px; border: 2px solid; border-radius: 2px; }
.map-legend .sw-area[data-dashed] { border-style: dashed; }
.map-legend .sw-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #0b0f17; }
.map-legend .sw-diamond { width: 9px; height: 9px; transform: rotate(45deg); border: 2px solid #f1f5f9; }
.lsr-icon span { display: block; width: 10px; height: 10px; margin: 2px; transform: rotate(45deg); border: 2px solid #f1f5f9; box-shadow: 0 0 0 1px #0b0f17; }

/* Live map: dark base map without a dark tile server, radar options, caption + colour bar. */
.leaflet-container .basemap-darkened { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.55); }
.map-control .radar-opts { margin: 0 0 4px 22px; display: grid; gap: 4px; }
.map-control .radar-opts label { margin: 0; }
.map-control .radar-site { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-control .radar-site .btn { padding: 2px 8px; }
.radar-caption {
  background: rgba(17, 23, 35, 0.9); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; min-width: 160px; max-width: 260px;
}
.radar-caption.problem { color: var(--warn); }
.radar-caption .radar-next { color: var(--muted); font-size: 11px; margin-top: 2px; }
.refresh-in { color: var(--muted); font-size: 11px; font-weight: 400; font-family: var(--mono); margin-left: 6px; }
.radar-caption .colorbar { height: 8px; border-radius: 2px; margin-top: 4px; }
.radar-caption .colorbar-labels { position: relative; height: 14px; font-size: 10px; color: var(--muted); }
.radar-caption .colorbar-labels span { position: absolute; transform: translateX(-50%); }
.live-map.picking { cursor: crosshair; }
/* While pinning a spot, shapes and markers let the click through to the map. */
.live-map.picking.pinning .leaflet-interactive { pointer-events: none; }

/* Live map, light mode: light panels to match the light base map. */
.leaflet-container.map-light { background: #e5e7eb; }
.leaflet-container.map-light .map-control, .leaflet-container.map-light .map-legend,
.leaflet-container.map-light .radar-caption {
  background: rgba(255, 255, 255, 0.94); color: #111827; border-color: #cbd5e1;
}
.leaflet-container.map-light .map-control select { background: #fff; color: #111827; border-color: #cbd5e1; }
.leaflet-container.map-light .muted, .leaflet-container.map-light .legend-sub,
.leaflet-container.map-light .colorbar-labels { color: #475569; }
.leaflet-container.map-light .leaflet-popup-content-wrapper,
.leaflet-container.map-light .leaflet-popup-tip,
.leaflet-container.map-light .leaflet-tooltip { background: #fff; color: #111827; border-color: #cbd5e1; }
.leaflet-container.map-light .leaflet-bar a { background: #fff; color: #111827; border-color: #cbd5e1; }
.leaflet-container.map-light .leaflet-bar a:hover { background: #f1f5f9; }
.leaflet-container.map-light .leaflet-control-attribution { background: rgba(255, 255, 255, 0.85) !important; color: #475569; }
.leaflet-container.map-light .leaflet-control-attribution a { color: #1d4ed8; }
.leaflet-container.map-light .radar-caption.problem { color: #b45309; }
.leaflet-container.map-light .warn-text { color: #b45309; }
.leaflet-container.map-light .map-control .btn { background: #f1f5f9; color: #111827; border-color: #cbd5e1; }

/* Storm report form: source, then collapsible sections. */
.rf-section { border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px 10px; margin: 0; background: #0e1520; }
fieldset.rf-section { display: grid; gap: 6px; }
.rf-section > legend, .rf-section > summary { font-weight: 700; font-size: 16px; }
.rf-section > summary { cursor: pointer; padding: 4px 0; list-style-position: inside; }
details.rf-section[open] > summary { margin-bottom: 8px; }
.rf-recap { font-weight: 400; font-size: 13px; color: var(--muted); }
.rf-recap.ok { color: var(--ok); }
.rf-sub { margin: 0 0 6px 26px; display: grid; gap: 6px; }
.rf-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.rf-mode { flex-direction: row; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border: 1px solid var(--panel-border); border-radius: 6px; cursor: pointer; background: var(--panel); }
.rf-mode:has(input:checked) { border-color: var(--accent); background: #13243a; }
.rf-groups .rf-mode { flex: 1; justify-content: center; font-weight: 600; }
.rf-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rf-row2 .rf-state { max-width: 6em; }
.rf-group { display: grid; gap: 6px; }
.rf-fs { border: 1px solid var(--panel-border); border-radius: 6px; padding: 6px 8px; margin: 4px 0; display: grid; gap: 4px; }
.rf-fs legend { font-weight: 600; padding: 0 4px; }
.rf-group label.check, .rf-fs label.check { flex-direction: row; align-items: flex-start; gap: 8px; margin: 2px 0; }
.rf-group label.check input, .rf-fs label.check input { margin-top: 3px; }
.rf-beaufort { padding: 4px 0; }
.rf-casualties .result { margin: 0; }
.rf-ack { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
@media (max-width: 480px) { .rf-row2 { grid-template-columns: 1fr; } .rf-sub { margin-left: 8px; } }

/* --- Net control (FR-125-130) ------------------------------------------------------------ */
.net-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(240px, 1fr) 2.2fr minmax(260px, 1.1fr);
  grid-template-rows: auto minmax(0, 1.3fr) minmax(0, 1fr) minmax(140px, 26vh);
  grid-template-areas: "header header header" "stations map queue" "stations map tasks" "log log log";
}
.net-grid > .flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 2000; width: min(520px, calc(100% - 24px)); box-shadow: 0 6px 24px #000a; animation: flash-out 0.6s ease 8s forwards; }
.net-grid > .flash p { margin: 0; background: #0f2a1a; padding: 12px 14px; font-weight: 600; }
.net-grid > .flash p.err { background: #2a1214; }
.net-header { grid-area: header; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 8px 12px; overflow: visible; }
.net-title { display: flex; align-items: baseline; gap: 8px; }
.net-title strong { font-size: 16px; }
.net-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.net-elapsed { font-size: 16px; color: var(--warn); }
.net-id { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 6px; border: 1px solid transparent; }
.net-id-due { font-size: 16px; }
.net-id.soon { border-color: var(--warn); }
.net-id.soon .net-id-due { color: var(--warn); }
.net-id.overdue { border-color: var(--danger); background: rgba(255, 80, 80, 0.12); }
.net-id.overdue .net-id-due { color: var(--danger); animation: net-id-pulse 1.2s ease-in-out infinite alternate; }
@keyframes net-id-pulse { to { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .net-id.overdue .net-id-due { animation: none; } }
.net-actions { margin-left: auto; display: flex; gap: 6px; }
.net-freq strong { color: var(--accent); }
.net-freq-form { display: flex; gap: 6px; align-items: center; }
.net-freq-form input { width: 15em; }
.chip.net-active { color: #06121c; background: var(--warn); border-color: var(--warn); font-weight: 700; }
.chip.net-new { color: var(--warn); border-color: var(--warn); }
.net-error { grid-column: 1 / -1; margin: 0; }
.net-error:empty { display: none; }
.net-error:not(:empty) { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; background: #2a1214; padding: 10px 14px; border: 1px solid var(--danger); border-radius: 6px; color: var(--danger); }
.net-stations { grid-area: stations; }
.net-map-panel { grid-area: map; }
.net-queue { grid-area: queue; }
.net-tasks { grid-area: tasks; }
.net-log { grid-area: log; display: flex; flex-direction: column; }
.net-sub { font-size: 12px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.net-checkin input[name=callsign] { width: 100%; font-family: var(--mono); font-size: 16px; text-transform: uppercase; }
.net-checkin-more { display: flex; gap: 6px; margin: 6px 0 4px; flex-wrap: wrap; }
/* Station type: a row of buttons (radios underneath, so Tab reaches the group once and the
   arrow keys move within it). */
.net-kinds { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.net-kind-opt { position: relative; }
.net-kind-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.net-kind-opt span {
  display: inline-block; padding: 4px 9px; border: 1px solid var(--panel-border); border-radius: 6px;
  font-size: 12px; color: var(--muted); cursor: pointer; user-select: none;
}
.net-kind-opt span:hover { color: var(--text); }
.net-kind-opt input:checked + span { color: #0b0f17; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.net-kind-opt input:focus-visible + span { outline: 2px solid var(--warn); outline-offset: 2px; }
.net-pin-note { margin: 2px 0; color: var(--warn); }
.net-checkin-help { margin: 2px 0 10px; line-height: 1.5; }
.net-checkin-help kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--panel-border); border-radius: 3px; padding: 0 3px; }
.telemetry-chip { font-size: 10px; padding: 0 5px; }
.net-checkin-more input { flex: 1; min-width: 100px; }
.net-roster, .net-out, .net-reports, .net-checklist { list-style: none; margin: 0; padding: 0; }
.net-station { padding: 6px 0; border-bottom: 1px solid var(--panel-border); display: flex; flex-direction: column; gap: 4px; }
.net-station.status-standby { border-left: 3px solid var(--warn); padding-left: 6px; background: #f0a83010; }
.net-station-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.net-station-actions .btn { padding: 2px 8px; }
.net-out li { padding: 2px 0; }
.net-report { padding: 8px 0; border-bottom: 1px solid var(--panel-border); }
.net-report.state-new { border-left: 3px solid var(--warn); padding-left: 6px; }
.net-report.state-relayed .net-state { color: var(--ok); border-color: var(--ok); }
.net-report.state-not_relayed { opacity: 0.75; }
.net-report.state-rejected { opacity: 0.55; }
.net-report.state-rejected strong { text-decoration: line-through; }
.net-report.state-rejected .net-state { color: var(--danger); border-color: var(--danger); }
.net-report.state-new .net-state { color: var(--warn); border-color: var(--warn); }
.net-report-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.net-report-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px solid #0008; }
.net-report-actions { margin-top: 4px; }
.net-not-relayed summary { list-style: none; cursor: pointer; }
.net-not-relayed summary::-webkit-details-marker { display: none; }
.net-not-relayed[open] form { margin-top: 6px; }
.net-checklist li { padding: 3px 0; }
.net-map-tabs { display: flex; gap: 4px; }
.net-log-entry { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.net-log-entry input[name=callsign] { width: 8em; text-transform: uppercase; }
.net-log-entry input[name=text] { flex: 1; }
.net-log-lines { flex: 1; overflow-y: auto; min-height: 0; }
.net-log-table td:first-child, .net-log-table td:nth-child(2) { white-space: nowrap; width: 1%; }
.net-kind { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 4px; }
.net-log-table tr.kind-check_in .net-kind, .net-log-table tr.kind-report_received .net-kind { color: var(--accent); }
.net-log-table tr.kind-traffic .net-kind, .net-log-table tr.kind-ncs_change .net-kind { color: var(--warn); }
.net-log-table tr.kind-report_disposition .net-kind, .net-log-table tr.kind-checklist .net-kind { color: var(--ok); }
.net-secured .net-header { border-color: var(--panel-border); }
.station-icon span { display: block; width: 14px; height: 14px; border: 2px solid #0b0f17; box-shadow: 0 0 0 1px #fff8; }
.repeater-icon span { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 3px; background: #1f2937; color: #e5e7eb; border: 1px solid #e5e7eb; font: 700 10px/1 var(--mono); }
.net-card h2 { font-size: 16px; }
.topbar .net-link.live::before { content: "●"; color: var(--warn); margin-right: 4px; }
@media (max-width: 900px) {
  .net-grid {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto;
    grid-template-areas: "header" "stations" "queue" "map" "log" "tasks";
    overflow-y: auto; align-content: start;
  }
  .net-grid > .panel { overflow: visible; min-height: auto; min-width: 0; }
  .net-checkin-help { display: none; }  /* keyboard tips: desktop only */
  .net-map-panel { display: block; }
  .net-map-panel .live-map { height: 55vh; min-height: 300px; }
  .net-log-lines { max-height: 50vh; }
  .net-actions { margin-left: 0; }
}

/* --- Storm report popup (report-detail.js) ------------------------------------------- */
.report-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0;
  background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); border-radius: var(--radius);
}
.report-dialog::backdrop { background: rgba(5, 8, 14, 0.6); }
.report-dialog-close { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 8px 10px 0; background: var(--panel); margin: 0; }
.report-dialog-body { padding: 0 16px 16px; }
.report-detail h2 { font-size: 16px; margin: 0 0 2px; display: flex; align-items: center; gap: 6px; }
.report-detail h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 12px 0 4px; }
.report-detail section p { margin: 2px 0; }
.report-detail .plain { list-style: none; margin: 0; padding: 0; }
.report-detail .report-notes { white-space: normal; border-left: 2px solid var(--panel-border); padding-left: 8px; margin-top: 6px; }
.report-ids { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 4px 0 0; font-size: 13px; }
.report-ids dt { color: var(--muted); }
.report-ids dd { margin: 0; }
.report-casualties { border: 1px solid var(--danger); border-radius: 6px; padding: 6px 10px 8px; margin-top: 12px; }
.report-casualties h3 { color: var(--danger); margin-top: 0; }
.popup-reporter { margin-top: 2px; }
.popup-actions { margin-top: 6px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font: inherit; }
.report-detail .sw-diamond { display: inline-block; width: 10px; height: 10px; transform: rotate(45deg); border: 2px solid #f1f5f9; flex: none; margin: 0 2px; }
.lsr-text {
  font-size: 12px; line-height: 1.35; white-space: pre; overflow: auto;
  max-height: 50vh; margin: 4px 0 0; padding: 8px; background: var(--bg); border: 1px solid var(--panel-border); border-radius: 6px;
}
.lsr-text .lsr-this { display: inline-block; min-width: 100%; background: rgba(250, 204, 21, 0.18); color: inherit; outline: 1px solid rgba(250, 204, 21, 0.55); }
.report-detail .sw-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #0b0f17; flex: none; }
.map-pick-hint {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: rgba(17, 23, 35, 0.95); color: var(--warn); border: 1px solid var(--warn);
  border-radius: 6px; padding: 4px 10px; font-size: 13px; pointer-events: none;
}
.relayed-chip { color: var(--ok); border-color: var(--ok); }
.report-rejected { color: var(--danger); border: 1px solid var(--danger); border-radius: 6px; padding: 4px 8px; margin: 6px 0; }

/* --- Storm report log (FR-81) ------------------------------------------------------------- */
.report-log-filter { flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 8px 0; }
.report-log-filter label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.report-log-filter label.check { flex-direction: row; align-items: center; }
.table-scroll { overflow-x: auto; }
.report-log td { min-width: 0; }
.report-log td:first-child { white-space: nowrap; }
.report-log tr.is-rejected td { opacity: 0.6; }
.chip.danger-chip { color: var(--danger); border-color: var(--danger); }

/* --- Report edits, flags and moderation (FR-66, FR-106, FR-107) ---------------------------- */
.chip.warn-chip { color: var(--warn); border-color: var(--warn); }
.report-edits li { padding: 4px 0; border-bottom: 1px solid var(--panel-border); }
.report-edits li:last-child { border-bottom: 0; }
.report-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--panel-border); }
.report-detail-actions:empty { display: none; }
.report-flag { width: 100%; }
.report-flag > summary { list-style: none; display: inline-block; cursor: pointer; }
.report-flag > summary::-webkit-details-marker { display: none; }
.report-flag form { margin-top: 8px; }
.report-moderation { border: 1px solid var(--warn); border-radius: var(--radius); padding: 4px 10px 10px; margin-top: 12px; }
.report-moderation form { margin: 0; }
.moderation-queue td form { margin: 0 0 6px; }

/* Storm report photos (FR-56) and share links (FR-117) */
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-item img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--panel-border); background: #000; display: block; }
.photo-item.photo-hidden img, .photo-strip .photo-hidden img { opacity: .35; outline: 2px dashed var(--danger); }
.photo-link { overflow-wrap: anywhere; }
.photo-meta { line-height: 1.3; }
.share-page .photo-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.share-page .photo-item img { height: 200px; }
.photo-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-picks:empty { display: none; }
.photo-pick-item { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 104px; }
.photo-pick-item img { width: 104px; height: 80px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--panel-border); }
.photo-pick-item.removing img { opacity: .3; }
.photo-pick { align-self: flex-start; cursor: pointer; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; align-items: center; }
.photo-strip img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--panel-border); display: block; }
.report-share { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; }
.report-share-out { align-self: stretch; }
.report-share-out { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.report-share-out input { flex: 1 1 260px; min-width: 0; }
.report-share-out p { flex-basis: 100%; margin: 0; }
.share-page { max-width: 820px; margin: 0 auto; }

/* My places (Home / Work) */
.place-icon { background: none; border: none; }
.place-icon span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; font-size: 16px; border-radius: 50%; background: #111723; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.places-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.3fr); gap: 12px; align-items: start; }
.places-map { height: 340px; border-radius: var(--radius); border: 1px solid var(--panel-border); }
.place-row { border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 8px; margin: 0; }
.place-row .row input[type=text] { flex: 1 1 180px; min-width: 0; }
.my-places { margin-top: 12px; }
@media (max-width: 800px) { .places-grid { grid-template-columns: 1fr; } .places-map { height: 280px; } }

/* Resizable panels with minimize / restore (panes.js) */
.ops-grid, .net-grid { position: relative; }
.ops-grid > .panel, .net-grid > .panel { position: relative; }
.pane-tools { float: right; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 2px; margin: -6px -6px 0 6px; }
.panel-map > .pane-tools { position: absolute; top: 6px; right: 8px; margin: 0; float: none; }
.pane-btn { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 4px; font: inherit; font-size: 14px; line-height: 1; width: 22px; height: 22px; padding: 0; cursor: pointer; }
.pane-btn:hover, .pane-btn:focus-visible { color: var(--text); border-color: var(--panel-border); background: #18202e; }
.pane-strip-title { display: none; font-weight: 600; font-size: 13px; color: var(--muted); }
/* Minimized: only the title and the restore button. */
.panel.pane-min { overflow: hidden; cursor: pointer; padding: 6px 10px; min-height: 36px; }
.panel.pane-min > :not(.pane-tools) { display: none !important; }
.panel.pane-min > .pane-tools { float: none; position: static; margin: 0; justify-content: space-between; width: 100%; }
.panel.pane-min .pane-strip-title { display: inline; }
.panel.pane-min:hover { border-color: var(--accent); }
/* A minimized side panel: a thin strip with its name written down it. */
.panel.pane-col { padding: 6px 0; }
.panel.pane-col > .pane-tools { flex-direction: column-reverse; justify-content: flex-end; gap: 8px; height: 100%; }
.panel.pane-col .pane-strip-title { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
/* Borders you can drag. */
.pane-gutter { position: absolute; z-index: 20; touch-action: none; }
.pane-gutter-col { cursor: col-resize; }
.pane-gutter-row { cursor: row-resize; }
.pane-gutter::after { content: ""; position: absolute; inset: 0; border-radius: 3px; transition: background .15s; }
.pane-gutter-col::after { inset: 0 -3px; }
.pane-gutter-row::after { inset: -3px 0; }
.pane-gutter:hover::after, .pane-gutter:focus-visible::after { background: rgba(124, 196, 250, .45); }
.pane-gutter:focus-visible { outline: none; }
.panes-dragging { user-select: none; }
.panes-dragging-col, .panes-dragging-col * { cursor: col-resize !important; }
.panes-dragging-row, .panes-dragging-row * { cursor: row-resize !important; }
.panes-dragging .leaflet-container { pointer-events: none; }
/* The map filling the page (⤢); the net header stays. */
.panes-maxed > .panel:not(.pane-maxed):not(.net-header) { display: none; }
.ops-grid.panes-maxed { grid-template-columns: 1fr; grid-template-rows: 1fr; grid-template-areas: "map"; }
.net-grid.panes-maxed { grid-template-columns: 1fr; grid-template-rows: auto 1fr; grid-template-areas: "header" "map"; }
.panel-map .map-head { padding-right: 60px; }
