:root {
  --bg: #eef3f5;
  --panel: #ffffff;
  --panel-2: #f4f7f8;
  --ink: #12232e;
  --ink-2: #4a5d68;
  --ink-3: #7b8c96;
  --line: #dde5e9;
  --accent: #0e7c86;
  --accent-ink: #ffffff;
  --accent-soft: #dff1f2;
  --warn: #c2410c;
  --warn-soft: #fdeee6;
  --danger: #b91c1c;
  --shadow: 0 10px 30px rgba(14, 40, 55, .14);
  --radius: 14px;
  --heat-0: #eef2f4;
  --heat-1: #c9e6e3;
  --heat-2: #6cc0b8;
  --heat-3: #0e7c86;

  --t-troll: #0e7c86;
  --t-mooch: #2563eb;
  --t-drift: #7c3aed;
  --t-jig: #db2777;
  --t-bottom: #a16207;
  --t-shore: #16a34a;
  --t-ramp: #475569;
  --t-marina: #475569;
  --t-hazard: #dc2626;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1418;
    --panel: #111d23;
    --panel-2: #16252c;
    --ink: #e4eef1;
    --ink-2: #a9bbc3;
    --ink-3: #74878f;
    --line: #22343c;
    --accent: #3cc0c4;
    --accent-ink: #062126;
    --accent-soft: #143238;
    --warn: #fb923c;
    --warn-soft: #3a2116;
    --danger: #f87171;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --heat-0: #1a2a31;
    --heat-1: #1d4a4c;
    --heat-2: #2a8a8a;
    --heat-3: #3cc0c4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1418; --panel: #111d23; --panel-2: #16252c; --ink: #e4eef1; --ink-2: #a9bbc3; --ink-3: #74878f;
  --line: #22343c; --accent: #3cc0c4; --accent-ink: #062126; --accent-soft: #143238; --warn: #fb923c; --warn-soft: #3a2116;
  --danger: #f87171; --shadow: 0 10px 30px rgba(0,0,0,.45); --heat-0: #1a2a31; --heat-1: #1d4a4c; --heat-2: #2a8a8a; --heat-3: #3cc0c4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }

.app { display: grid; grid-template-columns: 400px 1fr; height: 100dvh; }

/* ---------- Panel ---------- */
.panel { position: relative; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; z-index: 2; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; }
.brand h1 { font-family: var(--display); font-size: 20px; line-height: 1.1; letter-spacing: -.01em; }
.tagline { margin: 2px 0 0; color: var(--ink-3); font-size: 12.5px; }
.now-pill { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.now-pill.flood { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.now-pill.ebb { background: #e8ecfb; color: #3046b5; border-color: transparent; }
.now-pill.slack { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .now-pill.ebb { background: #1d2547; color: #9fb0ff; } }

.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 10px 8px 11px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.view { display: none; padding: 16px 20px 24px; }
.view.is-active { display: block; }
.panel-foot { padding: 10px 20px 12px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line); background: var(--panel); }

/* search + filters */
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; color: var(--ink-3); }
.search input { width: 100%; padding: 11px 12px 11px 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit; font-size: 15px; outline: none; }
.search input:focus { border-color: var(--accent); background: var(--panel); }
.filter-group { margin-top: 14px; }
.filter-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--ink-3); margin-bottom: 7px; display: flex; justify-content: space-between; }
.link-btn { background: none; border: 0; color: var(--accent); font-size: 11.5px; padding: 0; text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; font-weight: 500; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.is-on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip.season::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.chip.is-on.season::after { background: var(--panel); }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.seg button.is-active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.list-head { margin: 18px 0 6px; font-size: 12px; color: var(--ink-3); }
.spot-list { list-style: none; margin: 0; padding: 0; }
.spot-item { display: flex; gap: 12px; padding: 11px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer; align-items: flex-start; }
.spot-item:hover, .spot-item.is-hover { background: var(--panel-2); }
.spot-item .pin { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.spot-item h4 { margin: 0; font-size: 14.5px; font-weight: 600; }
.spot-item .meta { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.spot-item .sp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.sp-tag { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.sp-tag.hot { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.empty { color: var(--ink-3); padding: 20px 0; text-align: center; }

/* finder */
.intro { margin: 0 0 14px; color: var(--ink-2); }
.finder-form { display: grid; gap: 12px; }
.finder-form label:not(.toggle) { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.finder-form select, .finder-form input[type=date] { padding: 10px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit; font-size: 14px; font-weight: 400; width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; padding: 12px; font-weight: 700; font-size: 15px; }
.btn-primary:hover { filter: brightness(1.07); }
.finder-results { margin-top: 18px; }
.f-summary { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 13px; margin-bottom: 12px; }
.f-summary strong { color: var(--accent); }
.f-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; background: var(--panel); }
.f-card:hover { border-color: var(--accent); }
.f-card .rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: 12px; font-weight: 700; margin-right: 8px; }
.f-card h4 { margin: 0; display: flex; align-items: center; font-size: 15px; }
.f-card .score { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.f-card .why { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 8px; }
.f-card .rig { font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); }
.f-card .rig b { color: var(--ink); }

/* tides */
.tide-now { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--ink-2); }
.day-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.day-chips button { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 6px 10px; font-size: 12px; line-height: 1.2; text-align: center; }
.day-chips button b { display: block; font-size: 14px; }
.day-chips button.is-active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chart-wrap { position: relative; height: 210px; margin: 12px 0 6px; }
.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 16px 0 6px; }
.tide-table { display: grid; gap: 4px; }
.tide-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--panel-2); font-size: 13px; font-variant-numeric: tabular-nums; align-items: center; }
.tide-row.past { opacity: .5; }
.tide-row .lbl { font-weight: 600; }
.tide-row .badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 6px; }
.badge.flood { background: var(--accent-soft); color: var(--accent); }
.badge.ebb { background: #e8ecfb; color: #3046b5; }
.badge.slack { background: var(--warn-soft); color: var(--warn); }
.badge.high { background: var(--accent-soft); color: var(--accent); }
.badge.low { background: var(--panel); color: var(--ink-2); border: 1px solid var(--line); }
.fine { font-size: 11.5px; color: var(--ink-3); margin-top: 14px; }
.notice { padding: 12px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: 13px; }

/* ---------- Detail ---------- */
.detail { position: absolute; inset: 0; background: var(--panel); transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto; z-index: 5; padding: 14px 20px 28px; }
.detail.is-open { transform: none; }
.back { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; }
.d-type { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 12px; }
.d-type .dot { width: 9px; height: 9px; border-radius: 50%; }
.detail h2 { font-family: var(--display); font-size: 26px; line-height: 1.15; margin-top: 4px; }
.d-aka { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.d-desc { margin: 12px 0; color: var(--ink-2); font-size: 14px; }
.d-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.d-facts .stat .v { font-size: 14px; font-weight: 600; }
.hazard-box { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: 13px; margin: 12px 0; border-left: 3px solid var(--warn); }
.heat { display: grid; grid-template-columns: 76px repeat(12, 1fr); gap: 2px; font-size: 11px; align-items: center; }
.heat .m { text-align: center; color: var(--ink-3); font-size: 10px; }
.heat .m.now { color: var(--accent); font-weight: 700; }
.heat .n { font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat .c { height: 18px; border-radius: 3px; background: var(--heat-0); }
.heat .c.l1 { background: var(--heat-1); } .heat .c.l2 { background: var(--heat-2); } .heat .c.l3 { background: var(--heat-3); }
.heat .c.now { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat-key { display: flex; gap: 12px; font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.heat-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.lure { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.lure h5 { margin: 0; font-size: 13.5px; }
.lure p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.lure .colors { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.d-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.d-links a { font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.sources { font-size: 11.5px; color: var(--ink-3); word-break: break-all; padding-left: 16px; }
.conf { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }

/* ---------- Map ---------- */
.map-wrap { position: relative; min-width: 0; isolation: isolate; z-index: 0; }
#map { position: absolute; inset: 0; background: #aad3df; }
.leaflet-container { font-family: var(--font); }
.spot-marker { background: none; border: 0; }
.spot-marker .pin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); transition: transform .15s; }
.spot-marker.facility .pin { border-radius: 4px; width: 14px; height: 14px; }
.spot-marker.hazard .pin { border-radius: 3px; transform: rotate(45deg); }
.spot-marker.is-active .pin, .spot-marker.is-hover .pin { transform: scale(1.45); }
.spot-marker.hazard.is-active .pin, .spot-marker.hazard.is-hover .pin { transform: rotate(45deg) scale(1.45); }
.spot-marker.is-dim { opacity: .28; }
.spot-marker .rank-badge { position: absolute; top: -12px; left: 9px; background: var(--ink); color: var(--panel); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 17px; }
.leaflet-tooltip.spot-label { background: rgba(255,255,255,.94); color: #12232e; border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.3); border-radius: 6px; padding: 2px 7px; font-weight: 600; font-size: 12px; }
.leaflet-tooltip.spot-label::before { display: none; }
.leaflet-tooltip.spot-label.leaflet-interactive { cursor: pointer; }
.map-zoom-low .leaflet-tooltip.spot-label.minor { display: none; }
.map-zoom-far .leaflet-tooltip.spot-label { display: none; }
.leaflet-tooltip.spot-label.is-dim { opacity: .3; }

.legend { position: absolute; left: 12px; bottom: 22px; z-index: 500; background: var(--panel); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12px; display: grid; grid-template-columns: auto auto; gap: 4px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.leaflet-control-layers { border-radius: 12px !important; border: 0 !important; box-shadow: var(--shadow) !important; }

/* ---------- Mobile: full-screen guide or full-screen map ---------- */
.mode-btn, .peek { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .map-wrap { grid-row: 1; grid-column: 1; }
  .panel { position: fixed; inset: 0; height: 100dvh; border-right: 0; z-index: 1100; transition: transform .28s ease, visibility .28s; padding-top: env(safe-area-inset-top); }
  body.map-mode .panel { transform: translateY(100%); visibility: hidden; }
  .brand { padding: 10px 16px 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand h1 { font-size: 17px; }
  .tagline { display: none; }
  .tabs { padding: 0 8px; }
  .tab { padding: 10px 4px 11px; }
  .view { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .detail { padding: 10px 16px calc(96px + env(safe-area-inset-bottom)); }
  .panel-foot { display: none; }
  .legend { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body:not(.map-mode) .legend { display: none; }
  .leaflet-bottom { bottom: calc(70px + env(safe-area-inset-bottom)); }

  .mode-btn { display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 1200; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); padding: 12px 22px; border: 0; border-radius: 999px; background: var(--ink); color: var(--panel); font-weight: 700; font-size: 15px; box-shadow: var(--shadow); }
  .mode-btn svg { width: 20px; height: 20px; }

  .peek { position: fixed; z-index: 1150; left: 12px; right: 12px; bottom: calc(74px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 12px 10px 12px 14px; background: var(--panel); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
  .peek[hidden], body:not(.map-mode) .peek { display: none; }
  .peek .dot { width: 12px; height: 12px; border-radius: 50%; }
  .peek .pk-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
  .peek .pk-meta { font-size: 12px; color: var(--ink-3); }
  .peek .pk-open { border: 0; border-radius: 10px; padding: 9px 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
  .peek .pk-close { border: 0; background: none; color: var(--ink-3); font-size: 20px; line-height: 1; padding: 6px; }
}
.btn-map { display: none; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-weight: 600; }
@media (max-width: 820px) { .btn-map { display: flex; } }

/* Area 13 limits */
.limits { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.limit-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; font-size: 13px; border-top: 1px solid var(--line); }
.limit-row:first-child { border-top: 0; }
.limit-row .lname { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.limit-row .lname small { font-weight: 400; color: var(--ink-3); }
.limit-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.limit-row .lval { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.lstatus { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.lstatus.open { background: var(--accent-soft); color: var(--accent); }
.lstatus.closed { background: var(--warn-soft); color: var(--danger); }
.lstatus.nr { background: var(--warn-soft); color: var(--warn); }

/* Fish ID guide */
.id-groups { margin-bottom: 12px; flex-wrap: wrap; }
.id-card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--panel); }
.id-card > summary { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; list-style: none; }
.id-card > summary::-webkit-details-marker { display: none; }
.id-card > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: -3px 4px 0 2px; transition: transform .15s; flex: none; }
.id-card[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.id-card > summary .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.id-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.id-name b { font-size: 14.5px; }
.id-name small { font-size: 12px; color: var(--ink-3); }
.id-body { padding: 0 14px 14px; font-size: 13px; color: var(--ink-2); }
.id-body > p:first-child { margin-top: 0; }
.id-body h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); }
.id-body ul { margin: 0; padding-left: 18px; }
.id-body li { margin: 3px 0; }
.lookalike { margin: 4px 0; }
.size-rules { margin-top: 8px !important; font-size: 12.5px; }
.measure svg { width: 100%; max-width: 360px; height: auto; display: block; margin: 4px 0; color: var(--ink-2); }
.measure p { margin: 4px 0 0; }
.measure + .measure { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.dim-label { font: 600 12px var(--font); fill: var(--accent); }
.id-sources { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }
.muted { color: var(--ink-3); }
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 4px; }
.cmp { border-collapse: collapse; font-size: 12px; min-width: 520px; width: 100%; }
.cmp th, .cmp td { padding: 6px 8px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.cmp thead th { border-top: 0; background: var(--panel-2); color: var(--ink); }
.cmp tbody th { color: var(--ink); font-weight: 600; white-space: nowrap; background: var(--panel-2); position: sticky; left: 0; }
.cmp td { color: var(--ink-2); }
.tab { white-space: nowrap; }

.id-thumb { width: 56px; height: 38px; object-fit: cover; border-radius: 6px; flex: none; background: #fff; }
.id-fig { margin: 0 0 10px; }
.id-fig img { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: #fff; }
.id-fig figcaption { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
.id-fig .credit { color: var(--ink-3); font-size: 11px; }

/* Tomic plug picker */
.plug-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 14px 0 4px; background: var(--panel); }
.plug-controls { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.plug-seg { flex-wrap: wrap; }
.plug-seg button { padding: 5px 9px; font-size: 12px; }
.plug-auto { font-size: 12px; color: var(--ink-3); margin: 8px 0; }
.plug-note { font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--ink); margin: 0 0 10px; }
.plug-size { font-size: 13px; margin: 4px 0; }
.plug-size span { color: var(--ink-3); font-size: 12px; }
.plug-picks { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: pp; }
.plug-picks li { padding: 8px 0; border-top: 1px solid var(--line); }
.pp-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pp-code { font: 700 12px var(--font); background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 2px 7px; }
.pp-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.pp-why { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.pp-why i { color: var(--ink-3); font-style: normal; font-size: 11.5px; }
.plug-rig { margin-top: 8px; font-size: 13px; }
.plug-rig summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.plug-rig ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.pp-fits { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.pp-fits span { padding: 1px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); }

/* Clean first screen: filters behind one toggle, low-key hazards */
.filters-toggle { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.filters-toggle[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.filters-count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.filters-count[hidden] { display: none; }
.filters-box { margin-top: 4px; }
.filters-box[hidden] { display: none; }
.legend[hidden] { display: none !important; }
.spot-marker.hazard .pin { width: 11px; height: 11px; border-width: 2px; opacity: .85; margin: 2px; }
.known-for { margin-bottom: 4px; }

/* ---------- Correction mode (?edit=1) ---------- */
.edit-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 1300; height: 48px; padding: 0 10px calc(0px) 14px; padding-top: env(safe-area-inset-top); display: flex; align-items: center; gap: 8px; background: #7c2d12; color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); font-size: 13px; }
.edit-bar .eb-title { font-weight: 700; margin-right: auto; white-space: nowrap; }
.edit-bar button { border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.edit-bar .eb-primary { background: #fff; color: #7c2d12; border-color: #fff; }
.edit-bar.is-armed { background: #b45309; }
body.edit-mode .app { height: calc(100dvh - 48px); margin-top: 48px; }
body.edit-mode .spot-marker .pin { transform: scale(1.3); cursor: grab; }
body.edit-mode .spot-marker.hazard .pin { transform: rotate(45deg) scale(1.3); }
.edit-form { border: 2px solid #b45309; border-radius: 12px; padding: 12px; margin: 12px 0; background: var(--panel-2); display: grid; gap: 10px; }
.ef-head { font-weight: 700; color: #b45309; display: flex; justify-content: space-between; }
.ef-head span { color: var(--danger); font-size: 12px; }
.ef-hint { margin: 0; font-size: 12px; color: var(--ink-3); }
.edit-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.edit-form input:not([type=checkbox]), .edit-form textarea, .edit-form select { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 16px; }
.edit-form fieldset { border: 0; padding: 0; margin: 0; }
.edit-form legend { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.ef-species { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-form .ef-chip { display: inline-flex; grid: none; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-weight: 500; font-size: 13px; color: var(--ink); }
.ef-chip input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.ef-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ef-actions button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; }
.ef-actions .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ef-actions .ef-danger { color: var(--danger); }
.edit-sheet { position: fixed; inset: 0; z-index: 1400; background: rgba(0,0,0,.45); display: grid; place-items: end center; padding: 12px; }
.edit-sheet[hidden] { display: none; }
.es-card { width: min(520px, 100%); max-height: 85dvh; overflow: auto; background: var(--panel); color: var(--ink); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); margin-bottom: env(safe-area-inset-bottom); }
.es-card h3 { font-family: var(--display); font-size: 20px; margin-bottom: 8px; }
.es-card p { font-size: 14px; color: var(--ink-2); }
.es-list, .es-help { padding-left: 18px; font-size: 13.5px; color: var(--ink-2); }
.es-help li { margin: 6px 0; }
.es-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.es-actions button, .es-reset { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-weight: 600; }
.es-actions .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.es-raw { margin-top: 12px; font-size: 13px; }
.es-raw textarea { width: 100%; margin-top: 6px; font: 12px ui-monospace, monospace; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.es-reset { margin-top: 14px; color: var(--danger); background: none; }
.edit-toast { position: fixed; z-index: 1450; left: 50%; transform: translateX(-50%); top: 58px; max-width: calc(100vw - 32px); background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); }
.edit-toast[hidden] { display: none; }
@media (max-width: 820px) {
  body.edit-mode .app { height: 100dvh; margin-top: 0; }
  body.edit-mode .panel { top: 48px; height: calc(100dvh - 48px); }
  body.edit-mode .leaflet-top { top: 48px; }
  .edit-bar { padding-left: 10px; gap: 6px; }
  .edit-bar .eb-title { font-size: 12px; }
  .edit-bar button { padding: 6px 10px; font-size: 12.5px; }
}
