/* Border map page (/map). Same tokens and font as the dashboard (web/style.css), plus map colours.
   JAO = --series-1 (blue), SEE CAO = --series-2 (orange), Transelectrica = --series-tel (pink), as on the dashboard (src/sources.ts).
   Moving = aqua, implicit = violet (--st-*). Legend order validated, light + dark. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-tel: #c2389e;
  --st-moving: #1baf7a;
  --st-implicit: #6250d6;
  --off: #9a998f;
  --sea: #d3dde6;
  --land: #e9e8e2;
  --land-edge: #f9f9f7;
  --ours: #fcfcfb;
  --ours-edge: #898781;
  --hi: #e8b40c;
  --hi-wash: rgba(232, 180, 12, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-tel: #d659b3;
    --st-moving: #199e70;
    --st-implicit: #9085e9;
    --off: #6f6e68;
    --sea: #17202a;
    --land: #262624;
    --land-edge: #17202a;
    --ours: #3a3a37;
    --ours-edge: #898781;
    --hi: #f2c230;
    --hi-wash: rgba(242, 194, 48, 0.16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-tel: #d659b3;
  --st-moving: #199e70;
  --st-implicit: #9085e9;
  --off: #6f6e68;
  --sea: #17202a;
  --land: #262624;
  --land-edge: #17202a;
  --ours: #3a3a37;
  --ours-edge: #898781;
  --hi: #f2c230;
  --hi-wash: rgba(242, 194, 48, 0.16);
}

* { box-sizing: border-box; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0 auto;
  max-width: 1400px;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  display: grid;
  gap: 12px;
}
h1 { font-size: 20px; margin: 0; font-weight: 650; }
.sub { color: var(--text-secondary); margin: 2px 0 0; }
.top { display: flex; align-items: end; justify-content: space-between; padding: 18px 0 0; gap: 12px; flex-wrap: wrap; }
.back { color: var(--series-1); text-decoration: none; }
.back:hover { text-decoration: underline; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { overflow: visible; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
@media (max-width: 900px) { .main { grid-template-columns: minmax(0, 1fr); } }

.mapbox { background: var(--sea); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mapbox svg { display: block; width: 100%; height: auto; }
.zone { fill: var(--land); stroke: var(--land-edge); stroke-width: 0.8; }
.zone.ours { fill: var(--ours); stroke: var(--ours-edge); stroke-width: 0.9; }
.lbl { font-size: 11px; fill: var(--text-muted); text-anchor: middle; pointer-events: none; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.lbl.ours { font-size: 15px; font-weight: 650; fill: var(--text-primary); font-family: inherit; }

.bline { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 4; }
.bhit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; }
.dot { stroke: var(--surface-1); stroke-width: 2; cursor: pointer; }
.src-JAO { stroke: var(--series-1); }
.src-SEECAO { stroke: var(--series-2); }
.dot.src-JAO { fill: var(--series-1); }
.dot.src-SEECAO { fill: var(--series-2); }
.src-TEL { stroke: var(--series-tel); }
.dot.src-TEL { fill: var(--series-tel); }
/* Every kind of border has its own colour, no dashes (validated: neighbouring pairs in legend order, light + dark). */
.st-moving { stroke: var(--st-moving); }
.st-implicit { stroke: var(--st-implicit); }
.st-moved { stroke: var(--off); }
.dot.st-moving { fill: var(--st-moving); }
.dot.st-implicit { fill: var(--st-implicit); }
.dot.dot.st-moved { fill: var(--off); }
/* Not the main concern: thinner and faded, full strength again on hover / selection. */
.bline.st-moving, .bline.st-implicit, .bline.dot.st-moving, .dot.st-implicit, .dotg.b:focus { outline: none; }
g.b.on .bline { stroke: var(--hi); stroke-width: 7; }
g.b.on .dot { fill: var(--hi); r: 9; }
g.b.on .bline, g.b.on .dot { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .bline, .dot { transition: stroke 0.15s, fill 0.15s, stroke-width 0.15s; } }

.side { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; display: grid; min-width: 0; }
.detail { padding: 14px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; align-content: start; min-height: 190px; }
.detail h2 { margin: 0; font-size: 18px; font-weight: 650; }
.detail p { margin: 0; }
.names, .note { color: var(--text-secondary); }
.help { color: var(--text-primary); }
.eic { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.entry { display: grid; gap: 3px; padding-top: 8px; border-top: 1px dashed var(--border); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 7px; border-radius: 99px; border: 1px solid currentColor; margin-right: 6px; }
.p-JAO { color: var(--series-1); }
.p-SEECAO { color: var(--series-2); }
.p-TEL { color: var(--series-tel); }
.p-off { color: var(--off); }

.list h3 { margin: 0; padding: 12px 16px 4px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.list ul { list-style: none; margin: 0; padding: 0 8px 8px; }
.list button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.list button:hover, .list button.on { background: var(--hi-wash); }
.list button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.list .k { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; }
.list .n { color: var(--text-secondary); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12px; color: var(--text-muted); }

.foot { color: var(--text-muted); font-size: 12px; }

/* Inside the dashboard overlay: no own header (title, back link), less space at the top. */
.embed .top { display: none; }
.embed body { padding-top: 12px; }
