/* GloSIS Discovery Hub — base styles */

:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #eef0ea;
  --ink: #18201c;
  --muted: #5d675f;
  --line: #dadfd5;
  --primary: #1f6f4a;
  --primary-ink: #ffffff;
  --primary-soft: #e1efe6;
  --accent: #b8651f;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #b3361f;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .08);
  --radius: 10px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1411;
    --surface: #161e1a;
    --surface-2: #1d2722;
    --ink: #e5ebe6;
    --muted: #9aa69d;
    --line: #2a362f;
    --primary: #4cbc85;
    --primary-ink: #08130d;
    --primary-soft: #1b3428;
    --accent: #e39a52;
    --ok: #4cbc85;
    --warn: #e3b252;
    --bad: #ec7a5f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1411; --surface: #161e1a; --surface-2: #1d2722; --ink: #e5ebe6; --muted: #9aa69d;
  --line: #2a362f; --primary: #4cbc85; --primary-ink: #08130d; --primary-soft: #1b3428;
  --accent: #e39a52; --ok: #4cbc85; --warn: #e3b252; --bad: #ec7a5f; color-scheme: dark;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- Top bar: fully transparent --- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  height: 56px; padding: 0 16px;
  background: transparent; border: 0;
  position: relative; z-index: 6;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand-name span { color: var(--primary); }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.nav a:hover { color: var(--ink); }
.topbar .spacer { flex: 1; }

/* Language switch: borderless globe glyph + menu (as in OpenNSIS) */
.lang-switch { position: relative; }
.glyph-btn {
  background: none; border: 0; padding: 6px; line-height: 0; cursor: pointer; color: var(--ink);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.4);
}
.glyph-btn:hover { transform: scale(1.15); }
.glyph-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 50%; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 140px; z-index: 20;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); overflow: hidden;
}
.lang-menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 8px 14px; font-size: 13.5px; cursor: pointer;
}
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button[aria-checked="true"] { font-weight: 700; background: var(--primary-soft); color: var(--primary); }

/* Map page: the bar floats over the map, white glyphs with a drop shadow */
.map-page .topbar { position: absolute; top: 0; left: 0; right: 0; }
.map-page .brand, .map-page .nav a, .map-page .glyph-btn { color: #fff; }
.map-page .brand-name, .map-page .nav a { text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.map-page .brand img, .map-page .glyph-btn { filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.map-page .brand-name span { color: #8fe0b5; }
.map-page .nav a:hover { color: #fff; background: rgba(255,255,255,.12); }
.map-page .nav a[aria-current="page"] { background: rgba(255,255,255,.18); color: #fff; }
/* Light basemaps (Relief, Streets): dark glyphs with a light halo */
.map-page.light-basemap .brand, .map-page.light-basemap .nav a,
.map-page.light-basemap .glyph-btn { color: #1b1f24; }
.map-page.light-basemap .brand-name, .map-page.light-basemap .nav a { text-shadow: 0 1px 3px rgba(255,255,255,.9); }
.map-page.light-basemap .brand img, .map-page.light-basemap .glyph-btn { filter: drop-shadow(0 1px 2px rgba(255,255,255,.9)); }
.map-page.light-basemap .brand-name span { color: #1f6f4a; }
.map-page.light-basemap .nav a:hover { color: #1b1f24; background: rgba(0,0,0,.08); }
.map-page.light-basemap .nav a[aria-current="page"] { background: rgba(0,0,0,.1); color: #1b1f24; }

/* --- Buttons, chips, pills --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
  text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; cursor: pointer;
}
.chip .n { color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .8; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); }
.pill.bad { color: var(--bad); }
.pill.warn { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* --- Map page: map edge to edge under the bar, panel as a floating card --- */
.map-layout { position: relative; height: 100vh; height: 100dvh; }
.map-wrap { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; }
.panel {
  /* As tall as its cards, up to the bottom of the screen; then it scrolls. */
  position: absolute; top: 64px; right: 12px; width: 380px; z-index: 4;
  max-height: calc(100% - 76px); display: flex; flex-direction: column;
  overflow: hidden; overflow: clip;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
}
/* The scroll area is an inner wrapper: when the floating card itself scrolls,
   Chrome paints a black box over the WebGL map above it. */
.panel-scroll { min-height: 0; overflow-y: auto; }
.step { padding: 18px 18px 20px; border-bottom: 1px solid var(--line); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 13px;
}
.step.inactive .step-num { background: var(--surface-2); color: var(--muted); }
.step h2 { font-size: 16px; }
.step p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

#sec-points:not([hidden]) + #sec-rasters { margin-top: 14px; }
.data-section > .layer-sec-title { margin-top: 0; margin-bottom: 10px; }
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 6px; }
.sec-title .n {
  background: var(--primary-soft); color: var(--primary); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 700;
}
.subhead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 14px 0 8px; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
  background: var(--surface);
}
.card.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.card h3 { font-size: 14.5px; }
.card .meta { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.card select { width: 100%; margin-bottom: 8px; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface-2); }
.card-top { display: flex; align-items: flex-start; gap: 10px; }
.card-main { flex: 1; min-width: 0; }
.card-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card-side .btn { min-width: 76px; }
.card-icons { display: flex; gap: 0; margin-right: -6px; }
.icon-link {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  color: var(--muted); transition: background .15s, color .15s;
}
.icon-link:hover { background: var(--surface-2); color: var(--primary); }
.icon-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.card .legend-img { display: block; max-width: 100%; margin-top: 8px; background: #fff; border-radius: 4px; }
.opacity { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.opacity input { flex: 1; accent-color: var(--primary); }

.node-group { margin-bottom: 14px; }
.node-group h3 { font-size: 14px; margin-bottom: 2px; }
.node-group .note { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.prop-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px;
}
.prop-row .code { font-weight: 700; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
.prop-row .counts { flex: 1; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prop-row.active { border-color: var(--primary); background: var(--primary-soft); }

.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Map overlays */
#legends {
  display: flex; flex-direction: column-reverse; gap: 8px; align-items: flex-end;
  max-height: 50vh; overflow-y: auto;
}
#legends:empty { display: none; }
.legend-box {
  max-width: 260px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; font-size: 12.5px;
}
.legend-box h4 { margin: 0 0 6px; font-size: 12.5px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.legend-row i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); }
.maplibregl-popup-content {
  background: var(--surface); color: var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; font: 13.5px/1.45 var(--font); max-width: 300px;
}
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; padding: 2px 6px; }
.popup h3 { font-size: 15px; margin-bottom: 2px; }
.popup .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 8px 0; }
.popup .stats b { display: block; font-size: 15px; }
.popup table { border-collapse: collapse; width: 100%; margin-top: 6px; font-variant-numeric: tabular-nums; }
.popup th, .popup td { text-align: left; padding: 2px 6px 2px 0; border-bottom: 1px solid var(--line); }

/* --- Nodes page --- */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 16px 60px; }
.page-head h1 { font-size: 26px; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin: 6px 0 22px; max-width: 70ch; }
/* One card per row; each card laid out horizontally: identity | numbers | details */
.node-grid { display: flex; flex-direction: column; gap: 12px; }
.node-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(150px, 1fr) max-content minmax(190px, 1fr);
  gap: 22px; align-items: start;
}
.node-card .identity { min-width: 0; }
.node-card.offline { opacity: .85; }
.node-card header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.node-card img.logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; }
.node-card h2 { font-size: 17px; }
.node-card .country { color: var(--muted); font-size: 13.5px; }
.node-card .url { font-size: 13px; word-break: break-all; }
.node-card .stats { display: flex; gap: 8px; margin: 0; }
.node-card .stats > div { flex: 1 0 auto; }
.node-card .stats div { background: var(--surface-2); border-radius: 8px; padding: 8px; }
.node-card .stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.node-card .stats div { padding: 8px 10px; }
.node-card .stats span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.node-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.node-card dt { color: var(--muted); }
.node-card dd { margin: 0; }
.node-card .reason { color: var(--bad); }

/* --- Admin --- */
.form { display: grid; gap: 10px; max-width: 520px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.form input, .form select, .form textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.admin { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.admin th, table.admin td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.admin th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.admin .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); margin: 10px 0; font-size: 14px; }
.notice.error { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); color: var(--bad); }
.block { margin-top: 30px; }
.block h2 { font-size: 18px; margin-bottom: 12px; }

/* --- Small screens --- */
@media (max-width: 760px) {
  .topbar { gap: 10px; }
  .brand-name { display: none; }
  .map-layout { height: auto; display: flex; flex-direction: column-reverse; }
  .map-wrap { position: relative; height: 60vh; }
  .panel { position: static; width: auto; border-radius: 0; box-shadow: none; }
  .panel-scroll { height: auto; overflow: visible; }
}
/* Narrower screens: the horizontal card stacks again */
@media (max-width: 1100px) {
  .node-card { grid-template-columns: 1fr; gap: 14px; }
  .node-card .stats { grid-template-columns: repeat(2, 1fr); }
}

/* --- About page --- */
.prose { max-width: 760px; }
.prose .lead { font-size: 17px; color: var(--ink); }
.prose section { margin-top: 28px; }
.prose h2 { font-size: 19px; margin-bottom: 8px; letter-spacing: -.01em; }
.prose p { margin: 0 0 10px; max-width: 68ch; }
.prose .steps { padding-left: 22px; margin: 0 0 10px; }
.prose .steps li { margin-bottom: 8px; padding-left: 4px; }
.prose .steps li::marker { color: var(--primary); font-weight: 700; }


/* Globe: dark space around the earth; basemap switch on the map */
/* Plain black space behind the globe */
#map { background: #000; }
/* Bottom-right stack, top to bottom: points legend, 2D/3D, Imagery/Streets, ⓘ */
.maplibregl-ctrl-bottom-right { display: flex; flex-direction: column; align-items: flex-end; }
.maplibregl-ctrl-bottom-right > .maplibregl-ctrl { margin-bottom: 0; margin-top: 8px; }
.maplibregl-ctrl-bottom-right > .maplibregl-ctrl-attrib { margin-bottom: 10px; }
.legend-ctrl { background: none; box-shadow: none; }
.basemap-switch {
  display: flex; background: var(--surface); border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.basemap-switch button {
  border: 0; background: none; padding: 6px 12px; font: 600 12.5px/1 var(--font);
  color: var(--muted); cursor: pointer;
}
.basemap-switch button + button { border-left: 1px solid var(--line); }
.basemap-switch button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }

/* Scale bar + zoom level, bottom right below Imagery/Relief/Streets */
.scale-zoom {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  background: var(--surface); color: var(--ink); border-radius: 8px; box-shadow: var(--shadow);
  font: 600 11.5px/1 var(--font); font-variant-numeric: tabular-nums;
}
.scale-zoom .maplibregl-ctrl-scale {
  background: none; color: inherit; border: 2px solid var(--ink); border-top: 0;
  padding: 2px 4px 1px; font: inherit; box-sizing: border-box;
}
.scale-zoom .zoom-level { color: var(--muted); }

/* Node card: the system's name is the link to it */
.popup .node-link { color: inherit; text-decoration: none; }
.popup .node-link span { color: var(--primary); font-size: 13px; }
.popup .node-link:hover { color: var(--primary); text-decoration: underline; }

/* Point data cards: one per national system */
.card .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prop-codes { margin-top: 6px; font: 600 11.5px/1.5 ui-monospace, "SFMono-Regular", Menlo, monospace; color: var(--muted); }
.colour-by { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.colour-by select { flex: 1; margin: 0; }
.popup-scroll { max-height: 260px; overflow-y: auto; margin-top: 6px; }
.popup tr.group-start td { border-top: 2px solid var(--line); }

/* Panel on the right: the bottom-right map controls move to its left while it
   is open (desktop only; on phones the panel sits below the map). */
@media (min-width: 761px) {
  .map-layout.ctrl-shift .maplibregl-ctrl-bottom-right { right: 392px; }
}

/* "On the map" panel (left): appears while layers are added */
.layers-panel {
  position: absolute; top: 64px; left: 12px; width: 340px; z-index: 4;
  max-height: calc(100% - 76px); display: flex; flex-direction: column;
  overflow: hidden; overflow: clip; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
}
.layers-panel .panel-scroll { padding: 14px 16px 6px; }
.layer-item { padding: 10px 0 12px; border-top: 1px solid var(--line); }
.layer-head { display: flex; align-items: flex-start; gap: 8px; }
.layer-head > div { flex: 1; min-width: 0; }
.layer-item h3 { font-size: 14px; margin: 0; }
.layer-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.layer-remove {
  flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.layer-remove:hover { background: var(--surface-2); color: var(--bad); }
.layer-item .legend-note { margin: 8px 0 4px; }
@media (max-width: 760px) {
  .layers-panel { position: static; width: auto; max-height: none; border-radius: 0; box-shadow: none;
    border-top: 1px solid var(--line); }
}

/* "On the map" entries: remove + icons on the right; full-width dropdown */
.layer-head .card-side { gap: 2px; }
.layer-item select {
  width: 100%; margin: 8px 0 2px; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.layer-item .colour-by select { margin: 0; }

/* "On the map": Point data / Raster data sections */
.layer-section + .layer-section { margin-top: 10px; }
.layer-sec-title {
  font-size: 15px; font-weight: 700; margin: 12px 0 4px; padding: 7px 10px; border-radius: 8px;
  background: var(--primary-soft); color: var(--ink); cursor: pointer; list-style: none; user-select: none;
}
.layer-sec-title::-webkit-details-marker { display: none; }
.layer-sec-title::before {
  content: ""; width: 7px; height: 7px; flex: none; margin-right: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
.layer-section[open] > .layer-sec-title::before { transform: rotate(45deg); }
.layer-sec-title:hover { filter: brightness(.97); }
.layer-section > .layer-item:first-of-type { border-top: 0; }

/* Attribute table (bottom panel), as in OpenNSIS */
.map-layout { --attr-h: 38vh; }
.attr-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--attr-h); z-index: 6;
  display: flex; flex-direction: column; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
}
.attr-resizer { flex: none; height: 10px; cursor: ns-resize; position: relative; }
.attr-resizer::after {
  content: ""; position: absolute; left: 50%; top: 4px; width: 40px; height: 3px; margin-left: -20px;
  border-radius: 2px; background: var(--line);
}
.attr-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px 8px; }
.attr-head h3 { font-size: 14px; margin: 0; }
.attr-head .spacer { flex: 1; }
.attr-scroll { flex: 1; min-height: 0; overflow: auto; }
.attr-table { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.attr-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; white-space: nowrap;
  padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 700;
}
.attr-table th.asc::after { content: " ▲"; color: var(--primary); }
.attr-table th.desc::after { content: " ▼"; color: var(--primary); }
.attr-table td { padding: 4px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.attr-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.attr-table tbody tr { cursor: pointer; }
.attr-table tbody tr:hover { background: var(--surface-2); }
.attr-table tbody tr.selected { background: var(--primary-soft); }
.map-layout.attr-open .panel,
.map-layout.attr-open .layers-panel { max-height: calc(100% - 76px - var(--attr-h)); }
.map-layout.attr-open .maplibregl-ctrl-bottom-right { bottom: var(--attr-h); }
.attr-btn { margin-top: 8px; }
.layer-item .legend-row { font-size: 12.5px; }

/* Panel titles: "Federation results" (right) and "On the map" (left) */
.panel-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.panel-title h2 { flex: 1; font-size: 17px; letter-spacing: -.01em; margin: 0; }
.panel-toggle {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.panel-toggle:hover { background: var(--surface-2); color: var(--ink); }
.panel-toggle svg { transition: transform .15s; }
.collapsed .panel-toggle svg { transform: rotate(-90deg); }
/* Collapsed: just the title bar */
.collapsed .panel-title { margin: 0; padding: 0; border-bottom: 0; }
.panel.collapsed #what-body, .layers-panel.collapsed #layer-list { display: none; }
.paused-note { display: none; font-size: 12px; font-weight: 600; color: var(--warn); margin-left: 4px; }
.panel.collapsed .paused-note { display: inline; }

/* Attribute table: floating (undocked) card and dock zone */
.attr-head { cursor: move; user-select: none; }
.attr-head button { cursor: pointer; }
.attr-grip { flex: none; opacity: .5; }
.attr-panel.floating {
  position: fixed; bottom: auto; right: auto; z-index: 20; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  resize: both; overflow: hidden; min-width: 360px; min-height: 160px;
}
.attr-panel.floating .attr-resizer { visibility: hidden; height: 6px; }
.attr-dock-hint {
  position: fixed; left: 8px; right: 8px; bottom: 8px; height: min(240px, 30vh); z-index: 19;
  border: 2px dashed var(--primary); border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 14%, transparent); pointer-events: none;
}

/* Collapsed panels shrink to their title */
@media (min-width: 761px) {
  .panel.collapsed, .layers-panel.collapsed { width: auto; }
  .panel.collapsed .panel-title h2, .layers-panel.collapsed .panel-title h2 { white-space: nowrap; }
}
