:root {
  --bg: #0b0f1a;
  --bg-soft: #131a2b;
  --card: #172033;
  --line: #26314b;
  --text: #eef2fb;
  --muted: #93a0bd;
  --primary: #3b82f6;
  --primary-ink: #fff;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
.topbar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(11,15,26,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; color: var(--warn); }
.brand span { color: var(--text); }
.net-status { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.net-status.online { background: var(--ok); }
.net-status.offline { background: var(--danger); }

main { padding: 16px; max-width: 640px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

.report-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.report-title { font-size: 19px; font-weight: 700; }
.report-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.report-head { margin-bottom: 14px; }
.report-result { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.report-result.possible { background: rgba(245,158,11,.12); color: var(--warn); border: 1px solid rgba(245,158,11,.35); }
.report-result.confirmed { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.35); }
.report-result.dupe { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); }
.report-result.ok { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.35); }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text); background: var(--bg-soft); transition: transform .05s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-lg { width: 100%; padding: 16px; font-size: 17px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.section-head h2 { font-size: 16px; margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.callout { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); margin-top: 12px; }

#map { height: 240px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-bottom: 14px; background: var(--bg-soft); }
.leaflet-container { background: var(--bg-soft); font-family: inherit; }

.outage-list, .zone-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.outage-item, .zone-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.dot.confirmed { background: var(--danger); box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
.dot.possible { background: var(--warn); box-shadow: 0 0 0 4px rgba(245,158,11,.15); }
.dot.resolved, .dot.expired { background: var(--ok); box-shadow: 0 0 0 4px rgba(34,197,94,.15); }
.outage-main { flex: 1; min-width: 0; }
.outage-place { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outage-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 3px 8px; border-radius: 999px; }
.badge.confirmed { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge.possible { background: rgba(245,158,11,.15); color: var(--warn); }
.badge.resolved, .badge.expired { background: rgba(34,197,94,.15); color: #86efac; }
.pill-btn { background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
.pill-btn:active { transform: scale(.97); }
.empty { color: var(--muted); text-align: center; padding: 20px; font-size: 14px; }

.zone-item .outage-main { cursor: default; }
.zone-actions { display: flex; gap: 6px; }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 8px; font-size: 12px; cursor: pointer; }
.icon-btn.on { color: var(--ok); border-color: rgba(34,197,94,.4); }

.input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); font-size: 15px; margin-bottom: 10px; }
.input:focus { outline: none; border-color: var(--primary); }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0; }
.account-row { margin-bottom: 12px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  display: flex; background: rgba(11,15,26,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; cursor: pointer; }
.tab.active { color: var(--primary); }

.toast-root { position: fixed; left: 0; right: 0; bottom: calc(74px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 900; pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: pop .2s ease; max-width: 90%; }
.toast.ok { border-color: rgba(34,197,94,.4); }
.toast.err { border-color: rgba(239,68,68,.4); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 640px; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); animation: slideup .2s ease; }
@keyframes slideup { from { transform: translateY(30px); } to { transform: translateY(0); } }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.radius-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.radius-row button { flex: 1; }
.radius-row button.sel { background: var(--primary); color: #fff; }
#pickMap { height: 200px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin: 10px 0; }
.code-box { background: var(--bg); border: 1px dashed var(--warn); color: var(--warn); border-radius: 10px; padding: 12px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; text-align: center; letter-spacing: .5px; margin: 10px 0; user-select: all; }
@media (min-width: 560px) { .modal { border-radius: 18px; margin-bottom: 40px; } .modal-backdrop { align-items: center; } }
