:root {
  --brand: #0b7285;
  --brand-dark: #095c6b;
  --ok: #2b8a3e;
  --warn: #e67700;
  --bad: #c92a2a;
  --muted: #868e96;
  --bg: #f8f9fa;
  --panel-w: 400px;
  --topbar-h: 56px;
  --filters-h: 40px;
  --footer-h: 28px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #212529; background: var(--bg); }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #fff; border-bottom: 1px solid #dee2e6; position: relative; z-index: 1001; }
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--brand); font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 16px; }
.search { position: relative; flex: 1; display: flex; max-width: 560px; }
.search input { flex: 1; padding: 8px 12px; border: 1px solid #ced4da; border-radius: 8px 0 0 8px; min-width: 0; }
.search button { border: 1px solid #ced4da; border-left: 0; background: #fff; border-radius: 0 8px 8px 0; padding: 0 12px; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 60vh; overflow: auto; }
.search-results li { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.search-results li:hover { background: #e7f5ff; }
.search-results li small { color: var(--muted); display: block; }
.search-results .group { padding: 6px 12px 2px; font-size: 11px; text-transform: uppercase; color: var(--muted); cursor: default; }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.btn { border: 1px solid #ced4da; background: #fff; border-radius: 8px; padding: 7px 12px; white-space: nowrap; }
.btn:hover { background: #f1f3f5; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-sm { padding: 4px 8px; font-size: 13px; }
.btn-danger { color: var(--bad); border-color: #f1aeb5; }

.filters { height: var(--filters-h); display: flex; align-items: center; gap: 14px; padding: 0 12px; background: #fff; border-bottom: 1px solid #e9ecef; font-size: 13px; overflow-x: auto; white-space: nowrap; }
.filters label { display: inline-flex; align-items: center; gap: 4px; }
.count { margin-left: auto; color: var(--muted); }

.layout { position: relative; height: calc(100% - var(--topbar-h) - var(--filters-h) - var(--footer-h)); display: flex; }
#map { flex: 1; height: 100%; }
#map.picking { cursor: crosshair; }
.panel { width: var(--panel-w); max-width: 100%; height: 100%; overflow: auto; background: #fff; border-left: 1px solid #dee2e6; padding: 16px; position: relative; }
.panel-close { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; font-size: 18px; color: var(--muted); z-index: 2; }
.panel h2 { margin: 4px 32px 4px 0; font-size: 20px; }
.panel h3 { margin: 18px 0 6px; font-size: 14px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; background: #e9ecef; }
.badge-ok { background: #d3f9d8; color: #2b8a3e; }
.badge-bad { background: #ffe3e3; color: #c92a2a; }
.badge-warn { background: #fff3bf; color: #e67700; }
.badge-info { background: #d0ebff; color: #1864ab; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: 14px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.directions { background: #fff9db; border-left: 3px solid #fab005; padding: 8px 10px; border-radius: 4px; font-size: 14px; white-space: pre-wrap; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.photos a img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.photos figcaption { font-size: 11px; color: var(--muted); }
.reports li, .history li { font-size: 13px; margin-bottom: 4px; }
.reports small, .history small { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.outlet-list { list-style: none; padding: 0; margin: 0; }
.outlet-list li { padding: 8px; border: 1px solid #e9ecef; border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.outlet-list li:hover { background: #f1f3f5; }
.attrib { font-size: 12px; color: var(--muted); margin-top: 16px; }

form.edit label { display: block; font-size: 13px; margin: 10px 0 3px; color: #495057; }
form.edit input[type=text], form.edit input[type=number], form.edit input[type=url], form.edit select, form.edit textarea { width: 100%; padding: 7px 9px; border: 1px solid #ced4da; border-radius: 6px; }
form.edit textarea { min-height: 70px; }
form.edit .row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
form.edit .checks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; font-size: 13px; }
form.edit .checks label { display: flex; gap: 6px; align-items: center; margin: 0; }
form.edit fieldset { border: 1px solid #e9ecef; border-radius: 8px; padding: 8px 10px; margin: 10px 0; }
form.edit legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
form.edit .hint { font-size: 12px; color: var(--muted); }
.place-options { list-style: none; padding: 0; margin: 4px 0; max-height: 160px; overflow: auto; }
.place-options li { padding: 6px 8px; border: 1px solid #e9ecef; border-radius: 6px; margin-bottom: 4px; cursor: pointer; font-size: 13px; }
.place-options li.selected { border-color: var(--brand); background: #e3fafc; }
.errors { color: var(--bad); font-size: 13px; }

.toast { position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%); background: #212529; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 2000; font-size: 14px; max-width: 90vw; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 1500; padding: 16px; }
.modal-card { background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 420px; position: relative; }
.modal-card h2 { margin-top: 0; }

.attribution-bar { height: var(--footer-h); font-size: 11px; color: var(--muted); display: flex; gap: 16px; align-items: center; padding: 0 12px; background: #fff; border-top: 1px solid #e9ecef; overflow: hidden; white-space: nowrap; }

.marker { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: grid; place-items: center; font-size: 13px; color: #fff; font-weight: 700; }
.marker-working { background: var(--ok); }
.marker-unknown { background: #4c6ef5; }
.marker-faulty { background: var(--bad); }
.marker-removed { background: #495057; }
.marker-pick { background: var(--warn); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.15); } }
.leaflet-popup-content { font-size: 13px; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 14px; }

.hidden-meter { display: inline-flex; gap: 2px; }
.hidden-meter i { width: 10px; height: 10px; border-radius: 2px; background: #dee2e6; display: inline-block; }
.hidden-meter i.on { background: var(--warn); }

@media (max-width: 760px) {
  .hide-sm { display: none; }
  .brand-name { display: none; }
  .layout { flex-direction: column; }
  .panel { width: 100%; height: 55%; border-left: 0; border-top: 1px solid #dee2e6; }
  .attribution-bar span:last-child { display: none; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { margin: 12px 16px; max-width: 60ch; }

.outlet-static dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 12px 0; }
.outlet-static dt { color: #5c7a80; }
.outlet-static dd { margin: 0; }
