:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --text: #101828;
  --muted: #667085;
  --border: #e4e7ec;
  --accent: #fdb022;
  --off: #d92d20;
  --shedding: #912018;
  --overdue: #c11574;
  --partial: #f79009;
  --scheduled: #2e90fa;
  --restored: #12b76a;
  --unknown: #98a2b3;
  --line-1: #2a78d6; --line-2: #eb6834; --line-3: #1baf7a; --line-4: #eda100;
  --line-5: #e87ba4; --line-6: #008300; --line-7: #4a3aa7; --line-8: #e34948;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --text: #f5f5f6; --muted: #94969c; --border: #2a303c;
    --off: #f97066; --shedding: #e04f43; --overdue: #f670c7; --partial: #fdb022; --scheduled: #53b1fd; --restored: #32d583; --unknown: #61646c;
    --line-1: #3987e5; --line-2: #d95926; --line-3: #199e70; --line-4: #c98500;
    --line-5: #d55181; --line-6: #008300; --line-7: #9085e9; --line-8: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --text: #f5f5f6; --muted: #94969c; --border: #2a303c;
  --off: #f97066; --shedding: #e04f43; --overdue: #f670c7; --partial: #fdb022; --scheduled: #53b1fd; --restored: #32d583; --unknown: #61646c;
    --line-1: #3987e5; --line-2: #d95926; --line-3: #199e70; --line-4: #c98500;
    --line-5: #d55181; --line-6: #008300; --line-7: #9085e9; --line-8: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex; flex-direction: column;
}
a { color: inherit; }
.muted { color: var(--muted); }

.unofficial { margin: 0; padding: 5px 16px; text-align: center; font-size: 12px; line-height: 1.35;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-bg { fill: #101828; } .brand-bolt { fill: var(--accent); }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.brand .scope { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; white-space: nowrap; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; align-items: center; gap: 10px; font-size: 12px; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 500; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.pill.live::before { background: var(--restored); box-shadow: 0 0 0 3px color-mix(in srgb, var(--restored) 25%, transparent); }
.pill.warn::before { background: var(--partial); }
.meta { position: relative; }
.refresh-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; flex: none; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.refresh-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.refresh-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refresh-btn.spin svg { animation: none; } }
.refresh-tip {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1100; width: min(270px, calc(100vw - 32px));
  padding: 8px 10px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12px; line-height: 1.4; box-shadow: var(--shadow);
}

.layout { flex: 1; display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 30px 0 0; background: var(--surface-2); }
/* Across the top of the map, so nobody reads the lines as exact. */
.map-note { position: absolute; top: 0; left: 0; right: 0; z-index: 600; height: 30px; margin: 0; padding: 0 12px; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; white-space: nowrap; overflow: hidden; color: var(--text); background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }
.map-note b { margin-right: 4px; }
.panel { overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border); padding: 14px 16px 24px; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }

/* "Your lines": a button per line */
.line-box { margin: 0 0 4px; }
.lb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lb-head h2 { margin-top: 0; }
.lb-head .link-btn { font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-region { flex-basis: 100%; margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip .sw.ln { width: 14px; height: 4px; }
.chip[aria-pressed="true"] { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--lc); }
.chip[aria-pressed="true"]::after { content: "✓"; font-size: 12px; color: color-mix(in srgb, var(--lc) 72%, var(--text)); }
.chip.all[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); box-shadow: none; }
.chip.all[aria-pressed="true"]::after { content: none; }
.chip.more { color: var(--muted); border-style: dashed; }

/* Day picker */
.days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: thin; }
.days button {
  display: grid; gap: 1px; padding: 6px 4px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: center; white-space: nowrap;
}
.days button i { font-style: normal; font-weight: 500; font-size: 11px; color: var(--muted); }
.days button.has i { color: var(--shedding); }
.days button.past:not(.on) { background: var(--surface-2); color: var(--muted); }
.days button.past.has:not(.on) i { color: var(--off); }
.days button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.days button.on i { color: var(--surface); opacity: .8; }

/* Sheets (line picker, more information) */
dialog.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 760px); padding: 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(16, 24, 40, .3);
}
dialog.sheet[open] { display: flex; flex-direction: column; gap: 10px; }
dialog.sheet::backdrop { background: rgba(16, 24, 40, .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet p { margin: 0; font-size: 13.5px; }
.sheet .x { border: 0; background: var(--surface-2); color: var(--text); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; }
.sheet-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-tools input { flex: 1 1 200px; min-width: 0; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.sheet button:not(.x) { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.sheet button.primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.sheet .hint { font-size: 12.5px; color: var(--scheduled); min-height: 1em; }
.sheet-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.line-pick { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 120px; }
.line-pick label { display: grid; grid-template-columns: 18px 18px 1fr; gap: 10px; align-items: start; padding: 8px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.line-pick li:first-child label { border-top: 0; }
.line-pick input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--text); }
.line-pick .sw.ln { margin-top: 7px; }
.line-pick small { display: block; color: var(--muted); font-size: 12px; }
.info-tabs { align-self: flex-start; box-shadow: none; }
.sheet [data-info-panel] { overflow-y: auto; display: grid; gap: 10px; align-content: start; }
/* Feedback: a small button at the bottom opens a pop-up. */
.info-links .fb-open {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600;
}
.info-links .fb-open svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.feedback .rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.feedback .rate button {
  padding: 8px 4px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.25; cursor: pointer;
}
.feedback .rate button[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.feedback form { display: grid; gap: 8px; }
.feedback textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; font: inherit; font-size: 13.5px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.fb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-row button { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--text); background: var(--text); color: var(--surface); cursor: pointer; }
.fb-row button:disabled { opacity: .6; cursor: default; }
.fb-msg { font-size: 12.5px; color: var(--muted); }
.fb-msg.ok { color: var(--restored); } .fb-msg.err { color: var(--off); }
.info-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border); }
.info-links a { font-size: 12.5px; color: var(--muted); text-underline-offset: 2px; }
.info-links button { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }


.list, .feed { list-style: none; margin: 0; padding: 0; }
.list li {
  display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start;
  padding: 9px 8px; margin: 0 -8px; border-radius: 8px; cursor: pointer;
}
.list li:hover { background: var(--surface-2); }
.list .name { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 12.5px; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--unknown); }
.dot.off { background: var(--off); } .dot.shedding { background: var(--shedding); }
.dot.partial { background: var(--partial); } .dot.restored { background: var(--restored); } .dot.scheduled { background: var(--scheduled); }
.dot.overdue { background: var(--overdue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--overdue) 25%, transparent); }
.kind { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.kind.off { background: color-mix(in srgb, var(--off) 14%, transparent); color: var(--off); }
.kind.shedding { background: color-mix(in srgb, var(--shedding) 14%, transparent); color: var(--shedding); }
.kind.overdue { background: color-mix(in srgb, var(--overdue) 14%, transparent); color: var(--overdue); }
.kind.partial { background: color-mix(in srgb, var(--partial) 18%, transparent); color: color-mix(in srgb, var(--partial) 70%, var(--text)); }
.kind.restored { background: color-mix(in srgb, var(--restored) 14%, transparent); color: var(--restored); }
.eta { font-size: 12.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.eta.late, .eta.late b { color: var(--overdue); }
.comment { font-size: 12.5px; margin-top: 3px; padding-left: 8px; border-left: 2px solid var(--border); color: var(--text); }
.incident { padding: 9px 10px; margin: 0 0 8px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px; }
.incident.on { border-color: var(--off); background: color-mix(in srgb, var(--off) 6%, var(--surface)); }
.incident.on.wide { border-width: 2px; }
.incident.back { border-color: color-mix(in srgb, var(--restored) 60%, var(--border)); }
.inc-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.inc-head b { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.incident.on .inc-head b { color: var(--off); } .incident.back .inc-head b { color: var(--restored); }
.inc-head time { color: var(--muted); font-variant-numeric: tabular-nums; }
.incident .sub { margin-top: 3px; color: var(--muted); }
/* A current outage stands out as a tinted card, like All clear but in its warning colour. */
.list li.alert { --c: var(--off); margin: 0 0 8px; border: 1px solid var(--c); border-left-width: 4px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.list li.alert.overdue { --c: var(--overdue); }
.list li.alert:hover { background: color-mix(in srgb, var(--c) 15%, var(--surface)); }
.list li.alert .name { font-size: 16px; }
.list li.alert .sub, .list li.alert .eta.muted { color: color-mix(in srgb, var(--c) 35%, var(--text)); }
.list li.all-clear {
  margin: 0; cursor: default;
  border: 1px solid color-mix(in srgb, var(--restored) 55%, var(--border));
  background: color-mix(in srgb, var(--restored) 10%, var(--surface));
}
.list li.all-clear:hover { background: color-mix(in srgb, var(--restored) 10%, var(--surface)); }
.list li.all-clear .name { color: color-mix(in srgb, var(--restored) 65%, var(--text)); }
.all-clear .tip {
  width: 18px; height: 18px; margin-left: 4px; padding: 0; border-radius: 50%; vertical-align: 2px;
  border: 1px solid currentColor; background: none; color: inherit; font: italic 700 11px/16px Georgia, serif; cursor: pointer;
}
.all-clear .tip[aria-expanded="true"] { background: color-mix(in srgb, var(--restored) 25%, transparent); }
.all-clear .tip-text { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.updates:not(:empty) { margin-top: 10px; }
.update { padding: 9px 10px; margin: 0 0 8px; border-radius: 10px; border: 1px solid var(--border); border-left: 3px solid var(--scheduled); font-size: 13px; }
.upd-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.upd-head b { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: color-mix(in srgb, var(--scheduled) 70%, var(--text)); }
.upd-head time { color: var(--muted); font-variant-numeric: tabular-nums; }
.upd-text { white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.upd-text.open { display: block; }
.history { margin-top: 14px; }
.history.day-record { margin-top: 0; }
.history h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 4px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--scheduled); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.history ul { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 92px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.history time { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.history time i { font-weight: 500; color: var(--muted); }
.history .hk { font-weight: 600; }
.history .areas-of, .win-areas .areas-of { color: var(--muted); }
.hk.off { color: var(--off); } .hk.shedding { color: var(--shedding); } .hk.overdue { color: var(--overdue); }
.hk.partial { color: color-mix(in srgb, var(--partial) 70%, var(--text)); }
.history p { font-size: 12px; margin: 4px 0 0; }
.near { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.near.shedding { border-color: var(--shedding); } .near.overdue { border-color: var(--overdue); } .near.off { border-color: var(--off); }
.near .sub { font-size: 12.5px; margin-top: 2px; }

.win { padding: 9px 10px; margin: 6px 0; border-radius: 10px; border: 1px solid var(--border); }
.win.now { border-color: color-mix(in srgb, var(--shedding) 55%, var(--border)); background: color-mix(in srgb, var(--shedding) 6%, var(--surface)); }
.win.overdue { border-color: var(--overdue); background: color-mix(in srgb, var(--overdue) 7%, var(--surface)); }
.win.ended { opacity: .65; }
.win-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.win-head time { font-weight: 700; font-variant-numeric: tabular-nums; }
.win .state { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.win.now .state { color: var(--shedding); } .win.overdue .state { color: var(--overdue); } .win.later .state { color: var(--scheduled); }
/* In doubt (it may not be going ahead as posted): dashed and plain, not the colour of power off. */
.win.unsure { border-style: dashed; border-color: var(--border); background: var(--surface-2); }
.win.unsure .state { color: var(--muted); }
.win-areas { margin-top: 2px; }
.win.plan { border-style: dashed; }
.win .supp { font-size: 12.5px; color: var(--muted); }
.plan-src { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.plan-note { font-size: 12px; color: var(--muted); margin: 4px 2px 0; }
.win-count { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.win.now .win-count b { color: var(--shedding); } .win.overdue .win-count b { color: var(--overdue); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--shedding); border-radius: 2px; }
.empty { color: var(--muted); padding: 6px 0; }

.day { font-weight: 600; margin: 10px 0 4px; }
.slot { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.slot:first-of-type { border-top: 0; }
.slot time { font-variant-numeric: tabular-nums; font-weight: 600; }
.slot.now time { color: var(--shedding); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; }
.badge.now { background: color-mix(in srgb, var(--shedding) 15%, transparent); color: var(--shedding); }
.badge.official { background: var(--surface-2); color: var(--muted); }

.feed li { padding: 10px 0; border-top: 1px solid var(--border); }
.feed li:first-child { border-top: 0; }
.feed .when { font-size: 12px; color: var(--muted); }
.feed .text { white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.feed .text.open { display: block; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; }
.tag.off { color: var(--off); } .tag.shedding, .tag.scheduled { color: var(--scheduled); }
.tag.partial { color: var(--partial); } .tag.restored { color: var(--restored); }
.fine { margin-top: 24px; font-size: 12px; color: var(--muted); }

.map-controls { position: absolute; top: 40px; right: 10px; z-index: 500; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.seg { display: flex; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.seg button { border: 0; background: none; color: var(--text); font: inherit; font-weight: 500; padding: 6px 12px; cursor: pointer; }
.seg button.on { background: var(--text); color: var(--surface); }
.sw.ln { border-radius: 2px; height: 5px; width: 18px; }
/* A line named anywhere on the page: its colour bar and its name in that colour. */
.ln-name { font-weight: 600; white-space: nowrap; color: color-mix(in srgb, var(--lc) 72%, var(--text)); }
.ln-name .sw.ln { display: inline-block; vertical-align: middle; margin: -2px 5px 0 0; width: 14px; height: 4px; }
.locate-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; padding: 6px 12px; border-radius: 8px; box-shadow: var(--shadow); cursor: pointer;
}
.locate-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.locate-btn circle:first-child { fill: var(--scheduled); stroke: none; }
.locate-card {
  position: absolute; left: 10px; right: 10px; bottom: 24px; z-index: 600; max-width: 360px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(16, 24, 40, .18); padding: 14px 16px;
}
.locate-card p { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.locate-row { display: flex; gap: 8px; flex-wrap: wrap; }
.locate-row button { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.locate-row button.primary { background: var(--text); color: var(--surface); border-color: var(--text); }
button:focus-visible { outline: 2px solid var(--scheduled); outline-offset: 2px; }
.list .areas { font-size: 12.5px; margin-top: 2px; }
.list .areas .likely { color: var(--muted); font-style: italic; }
.line-label {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--lc);
  border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap;
}
.line-label::before { display: none; }
.legend {
  position: absolute; left: 10px; bottom: 24px; z-index: 500; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-size: 12px; max-width: 230px;
}
.legend summary { font-weight: 600; cursor: pointer; }
.legend ul { list-style: none; margin: 6px 0 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.legend li.region { margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sw { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--unknown); }
.sw.off { background: var(--off); } .sw.shedding { background: var(--shedding); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--shedding); width: 10px; height: 10px; margin: 1px; }
.sw.partial { background: var(--partial); } .sw.scheduled { background: transparent; border: 2px dashed var(--scheduled); }
.sw.overdue { background: var(--overdue); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--overdue); width: 10px; height: 10px; margin: 1px; }
.sw.restored { background: var(--restored); } .sw.line { border-radius: 2px; height: 4px; width: 16px; background: var(--muted); }

.leaflet-container { font: inherit; }
.leaflet-tile-pane { filter: grayscale(.85) contrast(.9) brightness(1.04); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: grayscale(.9) invert(1) hue-rotate(180deg) brightness(.85) contrast(.85); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: grayscale(.9) invert(1) hue-rotate(180deg) brightness(.85) contrast(.85); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; }
.pop h3 { margin: 0 0 2px; font-size: 15px; }
.pop .st { font-weight: 600; }
.pop .st.off { color: var(--off); } .pop .st.shedding { color: var(--shedding); } .pop .st.partial { color: var(--partial); }
.pop .st.overdue { color: var(--overdue); } .pop .comment { margin-top: 4px; }
.pop .st.restored { color: var(--restored); } .pop .st.scheduled { color: var(--scheduled); } .pop .st.unknown { color: var(--muted); }
.pop .src { margin-top: 6px; font-size: 12px; color: var(--muted); white-space: pre-wrap; max-height: 110px; overflow: auto; }
.pop ul { margin: 4px 0 0; padding-left: 16px; }
.leaflet-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); }
.leaflet-control-attribution { font-size: 10px; }

@media (max-width: 820px) {
  body { display: block; }
  .layout { display: block; }
  .map-wrap { height: 56vh; }
  .panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .brand p { display: none; }
  .brand h1 { line-height: 1.2; }
  #updated { display: none; }
  .legend { bottom: 12px; }
  .legend:not([open]) { padding: 6px 10px; }
}

/* Outages flash on the map. */
@keyframes flash { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
.leaflet-interactive.flash { animation: flash 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .leaflet-interactive.flash { animation-duration: 3s; } }
