:root {
  --bg: #ffffff; --fg: #1c1b1f; --muted: #5f5b66; --line: #e3dfe8; --surface: #f7f4f9;
  --primary: #b4530a; --on-primary: #ffffff; --error: #b3261e;
  --cheap: #1b8a3a; --mid: #b7791f; --dear: #c62828;
  --vat: #5c6bc0; --excise: #8e24aa; --rest: #26a69a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151317; --fg: #e8e1e9; --muted: #aaa3ad; --line: #332f36; --surface: #1f1c22; --primary: #e8913a; --on-primary: #1c1b1f; --error: #f2b8b5; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--fg); display: flex; flex-direction: column; }
button, select, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.grow { flex: 1; }

.bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 17px; margin: 0 6px 0 0; color: var(--primary); }
.bar select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); min-width: 0; max-width: 46vw; }
button.icon { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
button.icon:hover, button.icon.on { background: var(--line); }
button.icon:disabled { opacity: .4; }

main { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; }
#list { position: absolute; inset: 0; z-index: 3; overflow: auto; background: var(--bg); padding-bottom: 44px; }
#list ol { list-style: none; margin: 0; padding: 0; }
#list li, .near li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
#list li:hover, .near li:hover { background: var(--surface); }
.row-main { flex: 1; min-width: 0; }
.row-main b, .row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { color: var(--muted); }
.row-price { text-align: right; font-weight: 700; }
.row-price small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cheap { color: var(--cheap); } .mid { color: var(--mid); } .dear { color: var(--dear); }
.logo { width: 36px; height: 36px; flex: none; }

.chips { display: flex; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 4px 12px; cursor: pointer; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip:disabled { opacity: .4; cursor: default; }

#status { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 6px 12px; padding-bottom: max(6px, env(safe-area-inset-bottom)); font-size: 13px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-top: 1px solid var(--line); }
#status.error { background: var(--error); color: var(--bg); }

#panel { position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; width: min(420px, 100%); overflow: auto; background: var(--bg); border-left: 1px solid var(--line); box-shadow: -4px 0 16px #0002; padding: 12px 16px 56px; }
@media (max-width: 640px) {
  #panel { top: auto; left: 0; width: 100%; max-height: 75%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px #0003; }
}
#panel h2 { font-size: 19px; margin: 0; }
#panel h3 { font-size: 14px; margin: 16px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.head { display: flex; gap: 12px; align-items: center; }
.head .grow { min-width: 0; }
.close { position: sticky; top: 0; float: right; }
.actions { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.actions a, .actions button { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; background: var(--bg); text-decoration: none; color: inherit; cursor: pointer; font-size: 14px; }

.prices details { border-bottom: 1px solid var(--line); }
.prices summary { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; cursor: pointer; list-style: none; }
.prices summary::-webkit-details-marker { display: none; }
.prices summary .name small { display: block; color: var(--muted); font-size: 12px; }
.prices details.sel summary { font-weight: 700; }
.prices .plain summary { cursor: default; }
.claims { font-size: 13px; padding: 0 0 8px 12px; }
.claims ul { margin: 0; padding-left: 16px; }
.claims .note { color: var(--muted); font-size: 12px; }
.effective { color: var(--primary); font-size: 13px; margin: 2px 0 4px 8px; }

.bar-tax { display: flex; height: 22px; border-radius: 6px; overflow: hidden; margin: 6px 0; }
.bar-tax span:nth-child(1) { background: var(--vat); } .bar-tax span:nth-child(2) { background: var(--excise); } .bar-tax span:nth-child(3) { background: var(--rest); }
.legend { font-size: 13px; }
.legend div { display: flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .v { margin-left: auto; font-variant-numeric: tabular-nums; }
.warn { color: var(--error); font-size: 13px; }
.src { color: var(--muted); font-size: 12px; }

.near { list-style: none; margin: 0; padding: 0; }
.near li { padding: 6px 0; }
.near li.this { font-weight: 700; cursor: default; }
.near .logo { width: 28px; height: 28px; }
.plan { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 14px; }
.plan small { display: block; color: var(--muted); }
.linkish { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 4px 0; text-decoration: underline; }

svg.chart { width: 100%; height: 150px; display: block; }
svg.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; }
svg.chart .grid { stroke: var(--line); }
.chart-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, 94vw); max-height: 90vh; background: var(--bg); color: var(--fg); box-shadow: 0 8px 32px #0005; }
dialog form { display: flex; flex-direction: column; max-height: 90vh; padding: 16px; }
dialog h2 { margin: 0 0 6px; font-size: 19px; }
dialog h3 { margin: 12px 0 4px; font-size: 15px; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 12px 0 0; padding: 0; }
dialog menu button, .btn { border: 1px solid var(--line); background: var(--bg); padding: 6px 14px; border-radius: 18px; cursor: pointer; }
.primary { background: var(--primary) !important; color: var(--on-primary) !important; border-color: var(--primary) !important; }
.tabs { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.options { overflow: auto; min-height: 0; flex: 1; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 0; }
.options label { display: flex; gap: 8px; padding: 4px 0; align-items: center; }
#settings-body { overflow: auto; }
.maplibregl-popup-content { color: #1c1b1f; }
/* Keep the map's attribution above the status line. */
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 34px; }
@media (max-width: 480px) { .bar h1 { display: none; } .bar { gap: 2px; padding-left: 8px; padding-right: 8px; } button.icon { width: 34px; height: 34px; font-size: 18px; } }

/* Search: a bar under the header; results float over the map. */
.searchbar { position: relative; z-index: 6; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.searchbar[hidden] { display: none; }
.searchbar input { width: 100%; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); }
#search-results { position: absolute; left: 8px; right: 8px; top: 100%; max-height: min(60vh, 420px); overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px #0003; padding: 4px 12px 8px; }
#search-results h4 { margin: 8px 0 2px; font-size: 12px; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }
#search-results ul { list-style: none; margin: 0; padding: 0; }
#search-results li { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
#search-results li:hover { background: var(--surface); }
#search-results li small { display: block; color: var(--muted); font-size: 12px; }
#search-results .ico { width: 20px; text-align: center; }

/* "Outside your region" card, above the status line. */
#outside { position: absolute; left: 12px; right: 12px; bottom: 44px; z-index: 4; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 18px #0003; padding: 10px 12px; }
#outside[hidden] { display: none; }
#outside p { margin: 0 0 8px; }
#outside menu { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; }
#outside menu button { border: 1px solid var(--line); background: var(--bg); padding: 6px 14px; border-radius: 18px; cursor: pointer; }
