:root {
  /* Telescope Design System tokens (Notion: styling guidelines; frontend src/index.css) */
  --background:#f5f5f5;       /* neutral-100 */
  --card:#ffffff;
  --foreground:#111827;       /* neutral-900 */
  --foreground-secondary:#4b5563; /* neutral-600 */
  --muted-foreground:#6b7280; /* neutral-500: neutral-400 is too faint for small text on white */
  --muted:#f5f5f5;            /* neutral-100 */
  --accent:#f5f5f5; --accent-foreground:#374151; /* hover: neutral-100 / neutral-700 */
  --border:#d4d4d4;           /* neutral-300 */
  --input:#e5e5e5;            /* neutral-200 */
  --primary:#111827; --primary-foreground:#ffffff;
  --secondary:#2563eb;        /* blue-600: links */
  --ring:#3b82f6;             /* blue-500: focus */
  --font-heading:"Poppins", system-ui, sans-serif;
  --font-body:"Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm:6px; --radius-md:8px; --radius-lg:12px;
  --shadow:0 1px 2px rgba(17,24,39,.06), 0 4px 16px rgba(17,24,39,.08);
  /* Sequential red, light -> dark: the design system's risk colours (Tailwind red 200/300/500/700/900),
     which stand apart from the basemap's blue water */
  --q0:#fecaca; --q1:#fca5a5; --q2:#ef4444; --q3:#b91c1c; --q4:#7f1d1d;
  --seen:#9ca3af;             /* neutral-400: in an NVE zone, so seen */
  color-scheme: light;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { height:100%; margin:0; background:var(--background); color:var(--foreground);
  font:14px/1.5 var(--font-body); -webkit-font-smoothing:antialiased; }
:focus-visible { outline:2px solid var(--ring); outline-offset:2px; }
#map { position:absolute; inset:0; }
.card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow); }
button, input { font:inherit; color:inherit; }
a { color:var(--secondary); }

#panel { position:absolute; left:12px; top:12px; bottom:12px; width:368px; z-index:4; display:flex;
  flex-direction:column; overflow:hidden; }
#panel .scroll { flex:1 1 auto; min-height:0; overflow-y:auto; scrollbar-gutter:stable; padding:24px; }
.brand { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:16px; }
.brand img { display:block; height:15px; width:auto; }
.brandlink { font-size:12px; font-weight:500; text-decoration:none; white-space:nowrap; }
.brandlink:hover { text-decoration:underline; }
.eyebrow { font-size:12px; font-weight:500; text-transform:uppercase; letter-spacing:.05em; color:var(--muted-foreground); }
h1 { font-family:var(--font-heading); font-size:20px; line-height:1.3; margin:4px 0 8px; font-weight:500; letter-spacing:-.01em; }
h2 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted-foreground); font-weight:500; margin:16px 0 8px; }
.fine { font-size:12px; color:var(--muted-foreground); margin:8px 0 0; }

.seg { display:flex; flex-wrap:wrap; gap:2px; background:var(--muted); border:1px solid var(--input); border-radius:var(--radius-md); padding:2px; }
.seg button { flex:1 1 auto; border:0; background:none; padding:4px 8px; border-radius:var(--radius-sm); cursor:pointer; font-size:12px;
  font-weight:500; color:var(--foreground-secondary); white-space:nowrap; }
.seg button:hover { color:var(--foreground); }
.seg button[aria-pressed="true"] { background:var(--card); color:var(--foreground); box-shadow:0 1px 2px rgba(17,24,39,.1); }
.seg button:focus-visible { outline-offset:1px; }

.tiles { display:grid; gap:8px; margin-top:16px; }
.tile { border:1px solid var(--border); border-radius:var(--radius-md); padding:12px 16px; background:var(--card); }
.tile > small { display:block; font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted-foreground); font-weight:500; margin-bottom:4px; }
.tile > b { display:block; font-family:var(--font-heading); font-size:28px; font-weight:500; letter-spacing:-.01em; font-variant-numeric:tabular-nums; line-height:1.2; }
.tile > span { display:block; font-size:12px; color:var(--foreground-secondary); line-height:1.4; margin-top:4px; }
.tile > b em { font-style:normal; font-family:var(--font-body); font-size:14px; font-weight:400; color:var(--foreground-secondary); letter-spacing:0; }

.info { border:0; background:none; padding:0 2px; margin:0; cursor:help; color:var(--muted-foreground); font-size:12px; line-height:1;
  vertical-align:baseline; text-transform:none; letter-spacing:0; font-weight:400; }
.info:hover, .info:focus-visible { color:var(--secondary); }
h1 .info { font-size:14px; }

h1 { font-variant-numeric:tabular-nums; }
.sub { margin:0; font-size:14px; color:var(--foreground-secondary); }
.stage { display:flex; align-items:center; gap:8px; margin-top:16px; font-size:14px; color:var(--foreground-secondary); }
.stage > span { white-space:nowrap; }
.stage .seg { flex:1; }
/* Button/primary */
.cta { display:flex; align-items:center; justify-content:center; height:40px; margin-top:24px; padding:0 16px;
  border-radius:var(--radius-md); background:var(--primary); color:var(--primary-foreground);
  text-decoration:none; font-weight:500; font-size:14px; }
.cta:hover { background:rgb(17 24 39 / .9); }
.region { display:flex; align-items:baseline; gap:8px; margin-top:16px; }
.region .fine { margin:0; }
#area { border:0; background:transparent; padding:0 16px 0 0; font-size:16px; font-weight:500; color:var(--foreground); cursor:pointer; appearance:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234b5563' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 2px center; }
#area:focus-visible { border-radius:var(--radius-sm); }
/* Button/ghost, as a link */
.link { border:0; background:none; padding:2px 6px; border-radius:var(--radius-sm); color:var(--foreground-secondary); cursor:pointer; font-size:12px; font-weight:500; white-space:nowrap; }
.link:hover { background:var(--accent); color:var(--accent-foreground); }
.funnel { margin-top:16px; }
.frow { display:grid; grid-template-columns:1fr auto; gap:4px 8px; font-size:14px; }
.frow .bar { grid-column:1 / -1; height:8px; border-radius:4px; background:var(--muted); overflow:hidden; display:flex; gap:2px; }
.frow .bar i { display:block; height:100%; border-radius:4px; }
.frow b { font-variant-numeric:tabular-nums; font-weight:600; }
.keys { display:flex; flex-wrap:wrap; gap:4px 16px; margin-top:8px; font-size:12px; color:var(--foreground-secondary); }
.keys b { color:var(--foreground); font-variant-numeric:tabular-nums; font-weight:600; }
.key { display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:5px; vertical-align:baseline; }

.bank { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:14px; color:var(--foreground-secondary); margin-top:16px; }
.bank input { width:80px; height:32px; padding:0 8px; border:1px solid var(--input); border-radius:var(--radius-sm); background:var(--card); color:var(--foreground);
  text-align:right; font-variant-numeric:tabular-nums; }
.bank input:focus-visible { outline-offset:0; border-color:var(--ring); }
.bankOut { margin:8px 0 0; font-size:12px; color:var(--foreground-secondary); }
.bankOut b { font-variant-numeric:tabular-nums; font-weight:600; color:var(--foreground); }

/* The map legend, on the map */
#legend { position:absolute; right:12px; bottom:32px; z-index:3; width:248px; padding:12px; font-size:12px; color:var(--foreground-secondary); }
#legend .seg { margin-bottom:8px; }
#legend .ltitle { font-size:12px; }
#legend .ramp { display:flex; gap:2px; margin-top:4px; }
#legend .ramp i { flex:1; height:10px; border-radius:2px; }
/* One label per swatch, at its lower bound */
#legend .ticks { display:grid; grid-template-columns:repeat(5, 1fr); gap:2px; margin-top:4px; font-variant-numeric:tabular-nums; color:var(--muted-foreground); font-size:12px; }

details { margin-top:24px; border-top:1px solid var(--border); padding-top:16px; }
summary { cursor:pointer; font-weight:500; font-size:14px; border-radius:var(--radius-sm); }
details p { font-size:14px; color:var(--foreground-secondary); }
table { width:100%; border-collapse:collapse; font-size:12px; }
th { text-align:left; color:var(--muted-foreground); font-weight:500; border-bottom:1px solid var(--border); padding:4px 8px 4px 0; }
td { vertical-align:top; border-bottom:1px solid var(--input); padding:8px 8px 8px 0; color:var(--foreground-secondary); }
td:first-child { color:var(--foreground); font-weight:500; }
.tag { display:inline-block; font-size:12px; font-weight:500; padding:0 6px; border:1px solid var(--input); border-radius:var(--radius-sm); background:var(--muted);
  color:var(--accent-foreground); white-space:nowrap; }

#tip { position:fixed; z-index:6; pointer-events:none; padding:8px 12px; font-size:12px; max-width:260px; border-radius:var(--radius-md); }
#tip b { font-variant-numeric:tabular-nums; }
.depthPopup .maplibregl-popup-content { padding:8px 24px 8px 12px; font-size:12px; color:var(--foreground-secondary); }
.depthPopup b { color:var(--foreground); font-weight:600; }
.depthPopup .warn { color:#b91c1c; }

body.loading #map { opacity:.4; }

@media (max-width:820px) {
  #panel { left:0; right:0; top:auto; bottom:0; width:auto; max-height:58vh; border-radius:var(--radius-lg) var(--radius-lg) 0 0; }
  #panel .scroll { padding:16px; }
  #legend { top:12px; bottom:auto; right:56px; width:236px; }
  #legend .seg { flex-wrap:nowrap; }
}

/* ---- SbNorge flood map additions ---- */
#panel { width:400px; }
.brand img.customer { height:20px; }
.filters { margin-top:16px; display:grid; gap:8px; }
.selects { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.selects select { height:32px; padding:0 24px 0 8px; border:1px solid var(--input); border-radius:var(--radius-sm); background:var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234b5563' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center;
  appearance:none; font:inherit; font-size:12px; color:var(--foreground); min-width:0; cursor:pointer; }
.filters .link { justify-self:start; }
.tiles.two { grid-template-columns:1fr 1fr; }
.tiles.four { grid-template-columns:1fr 1fr; }
.tile > b { font-size:24px; }

.badge { display:inline-block; font-size:12px; font-weight:600; padding:0 6px; border-radius:4px; white-space:nowrap; line-height:20px; }
.lv-VERY_HIGH { color:#b91c1c; background:#fee2e2; } .lv-HIGH { color:#c2410c; background:#ffedd5; }
.lv-MEDIUM { color:#a16207; background:#fef9c3; } .lv-LOW { color:#1d4ed8; background:#dbeafe; }
.lv-NOT_EXPOSED { color:#15803d; background:#dcfce7; }

.plist { list-style:none; margin:0; padding:0; border-top:1px solid var(--input); }
.plist li { border-bottom:1px solid var(--input); }
.plist button { display:grid; grid-template-columns:1fr auto; gap:0 8px; width:100%; text-align:left; border:0; background:none; padding:8px 4px; cursor:pointer; border-radius:var(--radius-sm); }
.plist button:hover { background:var(--accent); }
.plist .addr { font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.plist .meta { grid-column:1 / -1; font-size:12px; color:var(--muted-foreground); }
.more { margin-top:8px; }
.back { margin:16px 0 0 -6px; }

.dtitle { font-family:var(--font-heading); font-size:18px; font-weight:500; margin:8px 0 2px; line-height:1.3; }
.dtitle small { font-family:var(--font-body); font-size:12px; color:var(--muted-foreground); font-weight:500; margin-right:6px; }
.dmeta { font-size:12px; color:var(--foreground-secondary); margin:0; }
.note { font-size:12px; margin:8px 0 0; padding:8px 10px; border-radius:var(--radius-sm); background:#fffbeb; color:#92400e; border:1px solid #fde68a; }
.dtext { font-size:13px; color:var(--foreground-secondary); margin:12px 0 0; }
.blist { margin-top:8px; display:grid; gap:12px; }
.bhead { display:flex; justify-content:space-between; gap:8px; font-size:13px; }
.bhead b { font-weight:500; }
.bhead span { color:var(--muted-foreground); font-size:12px; white-space:nowrap; }
.strip { display:grid; grid-template-columns:repeat(9, 1fr); gap:2px; margin-top:4px; }
.strip div { text-align:center; font-size:10px; line-height:1.2; padding:3px 0; border-radius:3px; background:var(--muted); color:var(--muted-foreground); font-variant-numeric:tabular-nums; }
.strip div b { display:block; font-size:11px; font-weight:600; color:var(--foreground); }
.strip div.d0 b { color:var(--muted-foreground); font-weight:400; }
.d1 { background:#eff6ff !important; } .d2 { background:#dbeafe !important; } .d3 { background:#bfdbfe !important; }
.d4 { background:#93c5fd !important; } .d5 { background:#60a5fa !important; }
.flag { color:#b91c1c; }

.downloads { margin-top:24px; }
.downloads .cta { margin-top:0; }
.dl2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }
/* Button/outline */
.ghost { display:flex; align-items:center; justify-content:center; height:32px; border:1px solid var(--border); border-radius:var(--radius-md);
  text-decoration:none; color:var(--foreground); font-size:12px; font-weight:500; }
.ghost:hover { background:var(--accent); }

#legend { width:236px; }
#legend .ltitle { margin-top:8px; color:var(--foreground); font-weight:500; }
#legend .ltitle:first-child { margin-top:0; }
#legend .keys { margin-top:4px; }
#legend .ticks { grid-template-columns:repeat(9, 1fr); font-size:10px; }
.key.dot { border-radius:50%; border:1px solid #111827; }
.key.uncertain { background:rgba(185,28,28,.3); }
/* Nine return periods in the legend's width */
#legend #rpSeg button { padding:4px 0; }

/* Login */
.gate { margin-top:16px; }
.gate p { margin:0 0 12px; color:var(--foreground-secondary); }
.gate .cta { width:100%; margin-top:0; border:0; cursor:pointer; }
.gate .link { margin-left:-6px; }
.account { margin-top:16px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
