/* colmap styles. Hand-written (no build step), served under a strict CSP:
   nothing here needs inline styles or external fonts. */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --control: #64748b; /* 4.8:1 on the surface; borders of controls need 3:1 */
  --on-strong: #ffffff; /* text on --danger and --ok backgrounds */
  --accent: #0f766e; /* teal; 5.5:1 on white */
  --c-projects: #0f766e; --c-grants: #b45309; --c-stats: #1d4ed8; --c-organisations: #7e22ce;
  --c-people: #be185d; --c-data: #0e7490; --c-messages: #0369a1; --c-account: #475569;
  --tint: #ecfdf5; /* faint accent wash for headings and hovered rows */
  --accent-text: #ffffff;
  --danger: #b91c1c;
  --ok: #047857;
  --warn: #b45309;
  --focus: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 3px rgb(15 23 42 / 12%), 0 1px 2px rgb(15 23 42 / 8%);
  --topbar: 60px;
  --toggle: 56px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --line: #475569;
    --control: #94a3b8;
    --on-strong: #0f172a;
    --accent: #2dd4bf;
    --c-projects: #2dd4bf; --c-grants: #fbbf24; --c-stats: #60a5fa; --c-organisations: #c084fc;
    --c-people: #f472b6; --c-data: #22d3ee; --c-messages: #38bdf8; --c-account: #94a3b8;
    --tint: #134e4a;
    --accent-text: #0f172a;
    --danger: #f87171;
    --ok: #34d399;
    --warn: #fbbf24;
    --focus: #93c5fd;
  }
}

/* The side panel is always dark, whatever the page theme. These repeat the dark tokens above
   (a test checks they agree); the brand colours are not needed inside the panel. */
.sidebar {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --line: #475569;
  --control: #94a3b8;
  --on-strong: #0f172a;
  --accent: #2dd4bf;
  --c-projects: #2dd4bf; --c-grants: #fbbf24; --c-stats: #60a5fa; --c-organisations: #c084fc;
  --c-people: #f472b6; --c-data: #22d3ee; --c-messages: #38bdf8; --c-account: #94a3b8;
  --tint: #134e4a;
  --accent-text: #0f172a;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --focus: #93c5fd;
}

* { box-sizing: border-box; }

/* Skip link: visible only while it has keyboard focus. */
.skip { position: absolute; left: 0.5rem; top: -4rem; z-index: 20; background: var(--accent); color: var(--accent-text); padding: 0.6rem 1rem; border-radius: var(--radius); }
.skip:focus { top: 0.5rem; }
#main:focus, .tab-panel:focus { outline: none; }
main { display: block; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; color: var(--accent); }
h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0; }
.icon { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; margin-right: 0.3em; }

/* Top bar: see topbar.css (the banner). */
.user-nav { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.bell { position: relative; display: inline-flex; align-items: center; }
.badge { background: var(--danger); color: var(--on-strong); border-radius: 999px; font-size: 0.7rem; padding: 0 0.4rem; margin-left: -0.5rem; align-self: flex-start; }
.live { font-size: 0.8rem; padding: 0.1rem 0.6rem; border-radius: 999px; background: #fff; border: 1px solid var(--warn); color: #92400e; }

/* Account drop-down */
.menu { position: relative; }
.menu-button { display: inline-flex; align-items: center; gap: 0.4rem; padding-left: 0.3rem; }
.menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 10rem; }
.menu-button .icon { margin: 0; }
.menu-button[aria-expanded="true"] .icon:last-child { transform: rotate(180deg); }
.menu-list { position: fixed; right: var(--menu-right, 0.5rem); top: var(--menu-top, 3.5rem); z-index: 40; min-width: 14rem; max-width: calc(100vw - 1rem); padding: 0.25rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(15 23 42 / 30%); }
.menu-head { display: grid; gap: 0.1rem; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); margin-bottom: 0.25rem; overflow-wrap: anywhere; }
.menu-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 44px; padding: 0.4rem 0.75rem; font: inherit; text-align: left; color: var(--text); background: none; border: 0; border-radius: calc(var(--radius) - 2px); cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--tint); }
.menu-icon { display: inline-grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: color-mix(in srgb, var(--tone) 16%, var(--surface)); color: var(--tone); --tone: var(--accent); }
.menu-icon .icon { margin: 0; }
.tone-ok { --tone: var(--ok); }
.tone-warn { --tone: var(--warn); }
.tone-danger { --tone: var(--danger); }
.tone-info { --tone: var(--c-messages); }
.menu-item:hover .menu-icon, .menu-item:focus-visible .menu-icon { background: color-mix(in srgb, var(--tone) 26%, var(--surface)); }
.head-actions, .message-head .menu { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; text-decoration: none; font: inherit; min-height: 44px; padding: 0.4rem 0.9rem; border-radius: var(--radius); border: 1px solid var(--control); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.small { min-height: 40px; padding: 0.2rem 0.6rem; font-size: 0.9rem; }
.btn.small.icon-button { min-width: 44px; min-height: 44px; padding: 0.2rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn .icon { margin: 0; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 0.5rem 0; }
.links { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.75rem 0 0; }
.actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }
/* The "← All projects" / "← All grants" button above a record, at the right like other buttons. */
.panel-back { display: flex; justify-content: flex-end; margin-bottom: 0.25rem; }
/* Buttons that act on a form or a list sit at the right: the Add buttons above lists, and a submit button placed straight in a form. */
.add-button, :is(.panel, .dialog) form > button[type="submit"] { display: flex; margin-left: auto; }

.field { margin: 0 0 0.75rem; flex: 1; min-width: 0; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
input, select, textarea { width: 100%; font: inherit; min-height: 44px; padding: 0.4rem 0.6rem; border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); color: var(--text); }
textarea { resize: vertical; }
input[aria-invalid], select[aria-invalid], textarea[aria-invalid] { border-color: var(--danger); }
.field.required > label::after { content: " *"; color: var(--danger); font-weight: 700; }
.field.required > label::after { margin-left: 0.15rem; }
.required-mark { color: var(--danger); font-weight: 700; }
.required-note { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 0.2rem 0 0; }
.field-error, .form-error { color: var(--danger); font-size: 0.9rem; margin: 0.25rem 0; }
.notice { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-left: 4px solid var(--warn); padding: 0.5rem 0.75rem; font-size: 0.85rem; margin: 0.5rem 0; }
.filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-row .field { min-width: 8rem; }
.readonly input, .readonly select, .readonly textarea { opacity: 0.85; }

/* Auth */
.auth { display: grid; place-items: start center; padding: 1.5rem 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.auth-card { width: 100%; max-width: 34rem; }

/* Workspace: sidebar beside the map */
/* The map fills the workspace on the left; the side panel floats over its right edge. */
.workspace { --side-w: min(480px, 45vw); position: relative; height: calc(100dvh - var(--topbar)); } /* the panel's width: dragged by the splitter (resize.css) */
.sidebar { position: absolute; top: 0; right: 0; bottom: 0; z-index: 4; width: var(--side-w); max-width: 70vw; display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--line); background: rgb(15 23 42 / 88%); color: var(--text); color-scheme: dark; }
/* The blur sits on a pseudo-element: backdrop-filter on the panel itself would make it the
   containing block of the fixed-position row menus and misplace them. */
.sidebar::before { content: ""; position: absolute; inset: 0; z-index: -1; backdrop-filter: blur(6px); }
.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: none; padding: 0.5rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 75%, transparent); }
.tab { --tab: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; flex: 1 1 auto; min-height: 44px; padding: 0.4rem 0.85rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tab .icon { margin: 0; color: var(--tab); }
.tab:hover { border-color: var(--tab); background: color-mix(in srgb, var(--tab) 10%, var(--surface)); }
.tab[aria-selected="true"] { font-weight: 700; color: var(--text); border-color: var(--tab); background: color-mix(in srgb, var(--tab) 18%, var(--surface)); box-shadow: inset 0 -3px 0 var(--tab); }
.tab-projects { --tab: var(--c-projects); } .tab-grants { --tab: var(--c-grants); } .tab-stats { --tab: var(--c-stats); }
.tab-organisations { --tab: var(--c-organisations); } .tab-people { --tab: var(--c-people); } .tab-members { --tab: var(--c-people); } .tab-data { --tab: var(--c-data); }
.tab-messages { --tab: var(--c-messages); } .tab-account { --tab: var(--c-account); }
/* Positioned so absolutely placed helpers (such as .visually-hidden in the project cards) are
   contained and clipped by the panel; otherwise they sit at their offset in the page and
   give the whole window a scrollbar. */
.panel { flex: 1; overflow-y: auto; padding: 1rem; position: relative; }
.plain { padding-left: 1.2rem; margin: 0.25rem 0; }

.map-pane { position: absolute; inset: 0; }
.map { position: absolute; inset: 0; }
.regions { position: absolute; top: 0.5rem; left: 4.25rem; display: flex; gap: 0.4rem; flex-wrap: wrap; z-index: 2; max-width: calc(100% - 5rem); }
.popup { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 3; min-width: 270px; max-width: min(340px, 90vw); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 10px 25px -5px rgb(0 0 0 / 20%), 0 8px 10px -6px rgb(0 0 0 / 10%); }
/* The pointer under the box, as in the legacy prototype (a border-coloured triangle behind a surface-coloured one). */
.popup::before, .popup::after { content: ""; position: absolute; top: 100%; left: 50%; height: 0; width: 0; border: solid transparent; pointer-events: none; }
.popup::before { border-top-color: var(--line); border-width: 11px; margin-left: -11px; }
.popup::after { border-top-color: var(--surface); border-width: 10px; margin-left: -10px; }
.popup p { margin: 0.2rem 0; }
.popup-close { position: absolute; top: 0.1rem; right: 0.3rem; background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; min-width: 44px; min-height: 44px; }

/* Map hover hint and group popup lists (the popup follows the legacy prototype's look) */
.map-hint { display: flex; flex-direction: column; gap: 0.1rem; max-width: 15rem; padding: 0.4rem 0.7rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 5px solid var(--hint, var(--accent)); border-radius: var(--radius); box-shadow: 0 4px 14px rgb(0 0 0 / 28%); font-size: 0.85rem; pointer-events: none; }
.hint-title { font-weight: 800; }
.hint-status { align-self: flex-start; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.05rem 0.45rem; border-radius: 6px; color: #0f172a; background: #fde68a; }
.hint-status.status-running { background: #34d399; }
.hint-status.status-finished { background: #93c5fd; }
.map-hint[hidden] { display: none; }
.map-hint span { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.popup-list { list-style: none; margin: 0.4rem 0; padding: 0; max-height: 14rem; overflow-y: auto; display: grid; gap: 0.35rem; }
.popup-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 0.1rem 0.4rem; align-items: center; }
.popup-list .muted { grid-column: 2; font-size: 0.8rem; text-transform: capitalize; }
.popup-list .btn { grid-column: 3; grid-row: 1 / span 2; }
.popup-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 1.6rem 0.4rem 0; }
.pill { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; padding: 0.15rem 0.55rem; border-radius: 6px; }
.pill-discipline { background: color-mix(in srgb, var(--pill, var(--accent)) 22%, var(--surface)); border: 1px solid var(--pill, var(--accent)); color: var(--text); }
.pill-status { color: #0f172a; background: #fde68a; }
.pill-status.status-running { background: #34d399; }
.pill-status.status-finished { background: #93c5fd; }
.popup-title { display: block; margin: 0 0 0.25rem; font-size: 1.05rem; line-height: 1.25; }
.popup-line { font-size: 0.9rem; }
.popup-line .muted-value, .popup-line.muted-value { color: var(--muted); }
.popup-description { color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); padding-top: 0.4rem; margin-top: 0.4rem; }
.popup-actions { display: flex; justify-content: flex-end; margin-top: 0.5rem; }
.popup-btn { min-height: 36px; padding: 0 1rem; border: 0; border-radius: 8px; font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.popup-edit { background: #f59e0b; color: #1c1917; }
.popup-btn:hover { filter: brightness(0.93); }
.link-button { background: none; border: 0; padding: 0.4rem 0; font: inherit; font-weight: 600; color: var(--accent); text-align: left; cursor: pointer; min-height: 44px; }
.link-button:hover { text-decoration: underline; }
@media (hover: none) { .map-hint { display: none; } }

/* Lists */
.cards { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.5rem; }
.project-card { display: grid; grid-template-columns: auto 1fr auto; gap: 0.25rem 0.6rem; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; align-items: center; }
.project-card:hover { border-color: var(--accent); }
.card-row { display: flex; align-items: stretch; gap: 0.4rem; --dot: var(--accent); }
.card-row .project-card { flex: 1; min-width: 0; border-left: 5px solid var(--dot); }
.card-row > .menu { align-self: center; }
.card-row:hover .project-card { box-shadow: 0 2px 8px rgb(15 23 42 / 18%); }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.card-meta { grid-column: 2 / -1; color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.dot { width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--dot, var(--accent)); }
.chip { font-size: 0.75rem; padding: 0.05rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); text-transform: capitalize; }
.chip.running, .chip.active { color: var(--ok); border-color: var(--ok); }
.chip.proposal { color: var(--warn); border-color: var(--warn); }
.chip.archived, .chip.finished { color: var(--muted); }

/* Stats */
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; z-index: 10; max-width: calc(100vw - 2rem); }
.toast { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.4rem 0.4rem 0.4rem 0.9rem; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: 0 2px 10px rgb(0 0 0 / 30%); }
.toast p { margin: 0.35rem 0; flex: 1; }
.toast.error { background: var(--danger); color: var(--on-strong); }
.toast.success { background: var(--ok); color: var(--on-strong); }
.toast-close { background: none; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; min-width: 44px; min-height: 44px; }

.view-toggle { display: none; }

/* Narrow screens: one pane at a time, switched from a bar at the bottom. */
@media (max-width: 768px) {
  .sidebar { width: 100%; max-width: none; border-left: 0; background: var(--bg); } /* one pane at a time here, so it is opaque */
  .sidebar::before { display: none; }
  .workspace { height: calc(100dvh - var(--topbar) - var(--toggle)); }
  .workspace[data-view="map"] .sidebar { display: none; }
  .workspace[data-view="panel"] .map-pane { display: none; }
  .view-toggle { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--toggle); background: var(--surface); border-top: 1px solid var(--line); z-index: 5; }
  .toggle { flex: 1; font: inherit; border: 0; background: none; color: var(--muted); cursor: pointer; }
  .toggle[aria-pressed="true"] { color: var(--accent); font-weight: 600; border-top: 3px solid var(--accent); }
  .toasts { bottom: calc(var(--toggle) + 0.5rem); }
  /* Icons only: every nav button carries an aria-label for its name. */
  .nav-label { display: none; }
  .tabs { gap: 0.3rem; padding: 0.4rem; }
  .tab { flex-direction: column; gap: 0.1rem; padding: 0.3rem 0.4rem; font-size: 0.8rem; border-radius: var(--radius); flex: 1 1 4.5rem; }
  .user-nav { gap: 0.35rem; }
  .menu-button { padding: 0.2rem 0.4rem; }
  .menu-button > .icon { display: none; } /* the avatar alone is the menu button */
  .user-nav { flex: none; }
  .panel { padding: 0.75rem; }
  /* 16 px text in controls stops iOS zooming the page when a field is focused. */
  input, select, textarea { font-size: 1rem; min-height: 48px; }
  .btn { min-height: 48px; }
  .form-section { padding: 0.75rem; }
  .filter-row .field { min-width: 100%; }
  /* The save bar stays in reach while a long form scrolls. */
  .form-actions { position: sticky; bottom: -0.75rem; z-index: 4; margin: 0.75rem -0.75rem -0.75rem; padding: 0.6rem 0.75rem; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgb(15 23 42 / 12%); }
  .form-actions .btn { flex: 1 1 8rem; }
}

/* Dialogs (native <dialog>; Esc and focus trapping come from the browser) */
.dialog { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 0; border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgb(15 23 42 / 60%); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 1rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Share and team dialog */
.rows { list-style: none; padding: 0; margin: 0.25rem 0 0.75rem; display: grid; gap: 0.4rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.row-name { flex: 1 1 10rem; overflow-wrap: anywhere; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.row input:not([type="checkbox"]) { flex: 1 1 8rem; min-width: 0; }
.documents { margin: 1rem 0; }
.documents h3 { margin: 0 0 0.25rem; }
.documents-list { margin-bottom: 0.25rem; }
.add-row { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem; margin: 0.5rem 0; }
.add-row .field { flex: 1 1 12rem; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; }
.check input { width: 1.25rem; min-height: 0; height: 1.25rem; }

/* Messages and people */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }
.toolbar .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.message { display: grid; gap: 0.35rem; }
.message-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.message-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.offer { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.chip.unread { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.chip.accepted { color: var(--ok); border-color: var(--ok); }
.chip.declined { color: var(--muted); }
.bell { gap: 0; }

/* Organisation tree */
.tree, .tree ul { list-style: none; margin: 0; padding-left: 1rem; }
.org-tree > .tree { padding-left: 0; }
.tree-node { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; border-radius: var(--radius); padding: 0.6rem 0.5rem; min-height: 44px; cursor: pointer; }
button.tree-node:hover { background: var(--surface); }
.tree-node[aria-current="true"] { background: var(--surface); outline: 2px solid var(--accent); font-weight: 600; }
span.tree-node { cursor: default; }
.org-detail { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* Account details */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0.5rem 0 1rem; }
.details dt { font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Drop-down under a filter box */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 6; top: calc(100% + 2px); left: 0; right: 0; margin: 0; padding: 0.25rem 0; list-style: none; max-height: 16rem; overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--control); border-radius: var(--radius); box-shadow: 0 4px 16px rgb(0 0 0 / 25%); }
.combo-option { padding: 0.6rem 0.75rem; cursor: pointer; overflow-wrap: anywhere; }
.combo-option[aria-selected="true"], .combo-option:hover { background: var(--bg); outline: 2px solid var(--accent); outline-offset: -2px; }
.combo-option[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.combo-note { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* Profile pictures */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--avatar, var(--accent)); color: #fff; font-weight: 600; vertical-align: middle; }
.avatar.sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar.md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar.lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picture-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0.5rem 0 1rem; }
.picture-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.person { display: flex; align-items: center; gap: 0.5rem; list-style: none; margin: 0.25rem 0; }
.plain .person { margin-left: -1.2rem; }

/* Form sections */
.form-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0.75rem 1rem 0.25rem; margin: 0 0 1rem; min-width: 0; }
.form-section legend { display: flex; align-items: center; gap: 0.4rem; padding: 0 0.5rem; font-weight: 700; color: var(--accent); }
.form-section legend .icon { margin: 0; }

/* QR code dialog */
.qr-picture { display: grid; place-items: center; padding: 0.75rem; margin: 0.5rem 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.qr-image { width: min(240px, 100%); height: auto; aspect-ratio: 1; object-fit: contain; }
.qr-address { overflow-wrap: anywhere; text-align: center; margin: 0.25rem 0; }
.qr-admin { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.5rem; }

/* Map zoom buttons: the vendored 22 px buttons are under the 24 px minimum target size (WCAG 2.2 AA); make them 44 px. */
.ol-zoom button { width: 44px; height: 44px; font-size: 1.4rem; }
.ol-zoom { top: 0.5rem; left: 0.5rem; }
/* The vendored OpenLayers CSS gives its buttons a 1 px grey focus outline; keep the app-wide 3 px ring so keyboard users can see where they are. */
.map .ol-control button:focus-visible, .map .ol-control button:focus { outline: 3px solid var(--focus); outline-offset: 2px; }

/* The map's attribution would sit under the floating panel, so it moves left of it. */
@media (min-width: 769px) { .regions { max-width: calc(100% - min(var(--side-w), 70vw) - 11rem); } } /* wrap before the legend button and the panel */
@media (min-width: 769px) { .map-pane .ol-attribution { right: calc(min(var(--side-w), 70vw) + 0.5em); } }

/* The QR code under the sign-in card: on a white tile so it scans in the dark theme too. */
.auth-qr { width: 100%; max-width: 34rem; display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-qr .qr-image { flex: none; width: 112px; height: 112px; padding: 6px; background: #fff; border-radius: 8px; }
.auth-qr p { margin: 0; }
