/* Spore Signal — palette and type carried over from the SPORE Signal Register. */
:root {
  --ground: #F2F4F1; --surface: #FCFDFB; --surface-2: #EAEEE8; --surface-3: #E1E7DE;
  --ink: #141A16; --ink-2: #3A443E; --muted: #5D6862; --faint: #8B948D;
  --line: #DCE2DA; --line-2: #C6CFC3;
  --accent: #1F6B54; --accent-hover: #185744; --link: #12483A; --accent-soft: #DCEAE2; --accent-ink: #12483A; --on-accent: #FFFFFF;
  --poleA: #2C5C86; --poleA-soft: #DEE7F0;
  --poleB: #9A5426; --poleB-soft: #F1E3D6;
  --warn: #8A6A12; --warn-soft: #F2EAD0;
  --danger: #A33A2C; --danger-soft: #F6E0DC;
  --map-land: #D6DDD3; --map-none: #E6EAE4;
  --shadow: 0 1px 2px rgba(20,26,22,.05), 0 8px 24px -18px rgba(20,26,22,.35);
  --shadow-lg: 0 2px 6px rgba(20,26,22,.06), 0 24px 60px -24px rgba(20,26,22,.45);
  --f-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-prose: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 6px;
  --header-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #101310; --surface: #181C18; --surface-2: #1F241F; --surface-3: #262C26;
    --ink: #E7ECE5; --ink-2: #C4CCC2; --muted: #98A29A; --faint: #77817A;
    --line: #2A312B; --line-2: #3A433B;
    --accent: #63C0A0; --accent-hover: #7DD0B2; --link: #63C0A0; --accent-soft: #1B2E27; --accent-ink: #8FD8BC; --on-accent: #0D1A15;
    --poleA: #89AFD4; --poleA-soft: #1B2530;
    --poleB: #D4996A; --poleB-soft: #2E241B;
    --warn: #D4B45C; --warn-soft: #2C2716;
    --danger: #E58B7D; --danger-soft: #3A1F1B;
    --map-land: #2B332C; --map-none: #1E231E;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -20px rgba(0,0,0,.9);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px -24px rgba(0,0,0,.95);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #101310; --surface: #181C18; --surface-2: #1F241F; --surface-3: #262C26;
  --ink: #E7ECE5; --ink-2: #C4CCC2; --muted: #98A29A; --faint: #77817A;
  --line: #2A312B; --line-2: #3A433B;
  --accent: #63C0A0; --accent-hover: #7DD0B2; --link: #63C0A0; --accent-soft: #1B2E27; --accent-ink: #8FD8BC; --on-accent: #0D1A15;
  --poleA: #89AFD4; --poleA-soft: #1B2530;
  --poleB: #D4996A; --poleB-soft: #2E241B;
  --warn: #D4B45C; --warn-soft: #2C2716;
  --danger: #E58B7D; --danger-soft: #3A1F1B;
  --map-land: #2B332C; --map-none: #1E231E;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -20px rgba(0,0,0,.9);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px -24px rgba(0,0,0,.95);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-display); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: -.015em; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.skip:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }

/* ---- boot / spinner ---- */
.boot { min-height: 60vh; display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- buttons & form controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line-2)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235D6862' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-wrap .pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent-ink); font-size: 12.5px; font-weight: 600; padding: 6px 10px; cursor: pointer; border-radius: 4px; }
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-ink); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }

/* ---- chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 4px 4px 0;
  font-family: var(--f-mono); font-size: 11px; font-weight: 500; line-height: 1.2; letter-spacing: .02em;
  padding: 3px 7px; border-radius: 3px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.chip.cl { background: var(--accent-soft); color: var(--accent-ink); }
.chip.ax { background: var(--poleA-soft); color: var(--poleA); }
.chip.rev { background: var(--accent-soft); color: var(--accent-ink); }
.chip.cost { background: var(--poleB-soft); color: var(--poleB); }
.chip.loss { background: var(--warn-soft); color: var(--warn); }
.chip.deep { background: var(--poleB-soft); color: var(--poleB); }
.chip.role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.chip.role.Admin { background: var(--poleB-soft); color: var(--poleB); }
.chip.role.Contributor { background: var(--poleA-soft); color: var(--poleA); }
.chip.role.Viewer { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- header ---- */
.header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-in { max-width: 1440px; margin: 0 auto; padding: 0 24px; height: var(--header-h); display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 18px; letter-spacing: -.02em; flex: none; }
.brand img { width: 28px; height: 28px; }
.brand small { font-family: var(--f-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: block; line-height: 1; margin-top: 2px; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { position: relative; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: var(--radius); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }
.user-menu { position: relative; margin-left: auto; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; }
.user-btn:hover { border-color: var(--line-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.user-btn .who { text-align: left; line-height: 1.15; }
.user-btn .who b { display: block; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who span { font-size: 11px; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.menu .menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .menu-head b { display: block; font-size: 14px; }
.menu .menu-head span { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 5px; color: var(--ink); font-size: 14px; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--surface-2); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .header-in { padding: 0 16px; gap: 12px; }
  .nav-toggle { display: inline-grid; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: var(--header-h); flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .user-btn .who { display: none; }
  .user-btn { padding: 3px; }
}

/* ---- page layout ---- */
main { display: block; }
main:focus { outline: none; }
.page { max-width: 1440px; margin: 0 auto; padding: 32px 24px 64px; }
.page.narrow { max-width: 820px; }
@media (max-width: 640px) { .page { padding: 22px 16px 48px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.page-head h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -.022em; }
.page-head .lede { font-family: var(--f-prose); font-size: 16.5px; color: var(--ink-2); max-width: 64ch; margin: 10px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.card-pad { padding: 22px 24px; }

/* segmented control / tabs */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 6px; border: 0; background: none; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg [aria-current="page"], .seg [aria-selected="true"], .seg [aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg svg { width: 16px; height: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { position: relative; border: 0; background: none; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent-ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tabs .count { font-family: var(--f-mono); font-size: 11px; background: var(--surface-2); padding: 1px 6px; border-radius: 10px; color: var(--muted); }

/* ---- login ---- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth-hero { position: relative; overflow: hidden; background: var(--accent-ink); color: #EAF4EF; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero .brand { color: #fff; }
.auth-hero .brand small { color: #A9CFC0; }
.auth-hero h1 { font-size: clamp(34px, 4.4vw, 54px); font-weight: 800; letter-spacing: -.025em; line-height: 1.02; max-width: 13ch; margin: 0 0 18px; color: #fff; }
.auth-hero p { font-family: var(--f-prose); font-size: 18px; color: #CFE5DB; max-width: 46ch; }
.auth-hero .facts { display: flex; gap: 36px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 12px; color: #A9CFC0; }
.auth-hero .facts b { display: block; font-size: 26px; color: #fff; font-weight: 600; }
.auth-hero svg.dots { position: absolute; right: -80px; bottom: -60px; width: 520px; opacity: .22; pointer-events: none; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-form .sub { color: var(--muted); margin-bottom: 26px; }
.auth-form .foot { margin-top: 24px; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px; min-height: auto; }
  .auth-hero h1 { font-size: 30px; margin-top: 24px; }
  .auth-hero p, .auth-hero .facts, .auth-hero svg.dots { display: none; }
}

/* ---- signals toolbar & stats ---- */
.signals-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { position: relative; min-width: 260px; flex: 1 1 280px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 34px; }
.tally { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }
.tally b { color: var(--ink); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 14px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; border: 0; cursor: pointer; }
.filter-pill:hover { background: color-mix(in srgb, var(--accent) 22%, var(--accent-soft)); }
.filter-pill svg { width: 14px; height: 14px; }
.linkish { border: 0; background: none; color: var(--accent-ink); font-weight: 600; cursor: pointer; padding: 4px 6px; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.legend-deep { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }

/* ---- table ---- */
.table-card { overflow: hidden; }
.scroller { overflow: auto; max-height: calc(100vh - var(--header-h) - 210px); min-height: 420px; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
table.data th, table.data td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 10px 12px; }
table.data thead th { position: sticky; z-index: 3; background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
table.data thead tr.labels th { top: 0; border-bottom: 0; padding-bottom: 6px; }
table.data thead tr.filters th { top: 37px; padding-top: 0; padding-bottom: 10px; box-shadow: inset 0 -1px 0 var(--line-2); }
table.data .sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-2); }
table.data .sort:hover { color: var(--ink); }
table.data .sort svg { width: 12px; height: 12px; opacity: .35; }
table.data .sort[aria-sort] svg, table.data th[aria-sort] .sort svg { opacity: 1; color: var(--accent); }
table.data .col-filter { width: 100%; min-height: 32px; font-size: 12.5px; padding: 5px 9px; font-weight: 400; }
table.data .col-filter.select { padding-right: 26px; background-position: right 7px center; }
table.data .col-filter.on { border-color: var(--accent); background-color: var(--accent-soft); }
table.data tbody tr { cursor: pointer; background: var(--surface); }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
table.data tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.data td.id { font-family: var(--f-mono); font-size: 12px; font-weight: 600; color: var(--accent-ink); white-space: nowrap; }
table.data td.title { font-weight: 600; color: var(--ink); min-width: 220px; }
table.data th.stick, table.data td.stick { position: sticky; left: 0; z-index: 2; }
table.data thead th.stick { z-index: 4; }
table.data td.stick { background: inherit; }
table.data tbody tr td.stick { background: var(--surface); box-shadow: inset -1px 0 0 var(--line); }
table.data tbody tr:hover td.stick { background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
table.data td.prose { font-family: var(--f-prose); font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
table.data .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.expanded table.data .clamp { -webkit-line-clamp: unset; display: block; }
table.data .vl div { margin-bottom: 3px; font-size: 12.5px; }
table.data .vl b { font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); }
table.data .vl .nm { display: block; color: var(--muted); font-size: 12px; }
table.data .empty { color: var(--faint); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.dot.no { background: var(--line-2); }
.noresult { padding: 56px 20px; text-align: center; color: var(--muted); }
.noresult b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 6px; }

/* ---- map ---- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1060px) { .map-layout { grid-template-columns: 1fr; } }
.map-card { position: relative; padding: 8px; }
.map-card svg.world { display: block; width: 100%; height: auto; }
.map-card .country { stroke: var(--surface); stroke-width: .5; vector-effect: non-scaling-stroke; transition: fill .15s, opacity .15s; }
.map-card .region { cursor: pointer; outline: none; }
.map-card .region .country { fill: var(--rc); opacity: .82; }
.map-card .region:hover .country, .map-card .region:focus-visible .country { opacity: 1; filter: brightness(1.06); }
.map-card .region.selected .country { opacity: 1; stroke: var(--ink); stroke-width: .6; }
.map-card .world.has-selection .region:not(.selected) .country { opacity: .38; }
.map-card .region:focus-visible .country { stroke: var(--ink); stroke-width: 1.2; }
.map-card .inert .country { fill: var(--map-none); }
.map-card .sphere { fill: none; }
.map-card .graticule { fill: none; stroke: var(--line); stroke-width: .5; vector-effect: non-scaling-stroke; }
.map-card .bubble { pointer-events: none; }
.map-card .bubble circle { fill: var(--surface); stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.map-card .bubble text { font-family: var(--f-mono); font-weight: 600; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.map-card .bubble .lbl { font-family: var(--f-display); font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.map-hint { position: absolute; left: 18px; bottom: 14px; font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--surface) 88%, transparent); padding: 6px 10px; border-radius: 6px; pointer-events: none; }
.map-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--ground); padding: 6px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); box-shadow: var(--shadow); }
.map-tip span { font-family: var(--f-mono); font-weight: 400; opacity: .8; margin-left: 6px; font-size: 12px; }
.region-list { padding: 8px; }
.region-list h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 10px 8px; font-weight: 600; }
.region-btn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px; border-radius: 6px; cursor: pointer; text-align: left; font-weight: 600; font-size: 14px; color: var(--ink); }
.region-btn:hover { background: var(--surface-2); }
.region-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.region-btn .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--rc); flex: none; }
.region-btn .n { margin-left: auto; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.region-btn .deepn { font-family: var(--f-mono); font-size: 10.5px; color: var(--poleB); background: var(--poleB-soft); padding: 1px 6px; border-radius: 3px; }
.region-panel { margin-top: 22px; scroll-margin-top: calc(var(--header-h) + 16px); }
.region-panel-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.region-panel-head h2 { font-size: 24px; font-weight: 700; }
.region-panel-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.chipbar { display: flex; gap: 6px; flex-wrap: wrap; }
.chipbar button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chipbar button:hover { border-color: var(--faint); }
.chipbar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.sig-card { text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.sig-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.sig-card .top { display: flex; align-items: center; gap: 8px; }
.sig-card .sid { font-family: var(--f-mono); font-size: 12px; font-weight: 600; color: var(--accent-ink); }
.sig-card .top .chip { margin: 0; }
.sig-card h3 { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.sig-card p { font-family: var(--f-prose); font-size: 14px; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sig-card .cta { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.empty-state b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---- drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 11, .42); z-index: 50; animation: fade .18s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--surface); z-index: 51; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .22s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
.drawer-head { padding: 20px 24px 0; border-bottom: 1px solid var(--line); }
.drawer-head .row { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 8px; }
.drawer-head .meta .sid { font-family: var(--f-mono); font-weight: 600; font-size: 13px; color: var(--accent-ink); margin-right: 8px; }
.drawer-head h2 { font-size: 23px; font-weight: 700; line-height: 1.2; flex: 1; }
.drawer-head .tabs { margin: 16px -6px 0; border-bottom: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.drawer-nav { display: flex; align-items: center; gap: 6px; flex: none; margin-top: -4px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 26px; }
@media (max-width: 560px) { .options { grid-template-columns: 1fr; } }
.option { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 16px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.option:hover { border-color: var(--accent); background: var(--accent-soft); }
.option .ic { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.option.deeper .ic { background: var(--poleB-soft); color: var(--poleB); }
.option .ic svg { width: 20px; height: 20px; }
.option b { display: block; font-size: 15px; margin-bottom: 2px; }
.option span { font-size: 13px; color: var(--muted); line-height: 1.4; display: block; }
.dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); }
.dl > dt, .dl > dd { padding: 14px 0; border-bottom: 1px solid var(--line); margin: 0; }
.dl > dt { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-right: 16px; }
.dl > dd.prose { font-family: var(--f-prose); font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } .dl > dt { border-bottom: 0; padding-bottom: 2px; } .dl > dd { padding-top: 0; } }
.axis-line { margin-bottom: 10px; }
.axis-line .poles { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: 12.5px; margin-top: 6px; }
.axis-line .poles .a { color: var(--poleA); }
.axis-line .poles .b { color: var(--poleB); text-align: right; }
.axis-line .poles .rule { width: 28px; height: 1px; background: var(--line-2); }
.crop-item { margin-bottom: 10px; font-size: 14px; }
.crop-item b { display: block; }
.crop-item span { color: var(--muted); font-size: 13px; }

/* deeper view */
.deeper-intro { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.deeper-intro p { margin: 0; color: var(--muted); font-size: 14px; max-width: 46ch; }
.dsec { margin-bottom: 26px; }
.dsec h3 { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.dsec h3 .horizon { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: none; color: var(--muted); background: var(--surface-2); padding: 2px 7px; border-radius: 3px; font-weight: 500; }
.dsec p, .dsec li { font-family: var(--f-prose); font-size: 15.5px; line-height: 1.62; color: var(--ink-2); }
.dsec ul { margin: 0; padding-left: 0; list-style: none; }
.dsec li { position: relative; padding-left: 20px; margin-bottom: 10px; }
.dsec li::before { content: ""; position: absolute; left: 3px; top: .68em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.dsec.bets li::before { background: var(--poleB); }
.dsec li strong { font-family: var(--f-display); font-weight: 700; color: var(--ink); }
.moves-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 700px) { .moves-grid { grid-template-columns: 1fr; } }
details.memo { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
details.memo summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
details.memo summary::-webkit-details-marker { display: none; }
details.memo summary svg { width: 16px; height: 16px; transition: transform .15s; }
details.memo[open] summary svg { transform: rotate(90deg); }
details.memo .memo-body { padding: 4px 22px 20px; font-family: var(--f-prose); font-size: 15px; line-height: 1.65; color: var(--ink-2); }
details.memo .memo-body h4 { font-family: var(--f-display); font-size: 15px; margin: 18px 0 6px; color: var(--ink); }
details.memo .memo-body .memo-title { font-family: var(--f-display); font-size: 17px; font-weight: 700; color: var(--ink); margin: 6px 0 12px; }

/* comments */
.comment-form { margin-bottom: 22px; }
.comment-form .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.counter { font-family: var(--f-mono); font-size: 11.5px; color: var(--faint); }
.counter.over { color: var(--danger); }
.privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.privacy svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.comment { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--surface); }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.comment-head b { color: var(--ink); font-size: 13.5px; }
.comment-body { white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.55; }
.comment-actions { display: flex; gap: 4px; margin-top: 8px; }

/* ---- dialog ---- */
dialog.modal { border: 0; padding: 0; border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); width: min(460px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 14, 11, .45); }
dialog.modal .m-body { padding: 22px 24px 8px; }
dialog.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
dialog.modal p { color: var(--ink-2); font-size: 14.5px; }
dialog.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; flex-wrap: wrap; }
.secret { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 10px 12px; margin: 10px 0 14px; }
.secret code { font-family: var(--f-mono); font-size: 16px; font-weight: 600; letter-spacing: .04em; flex: 1; word-break: break-all; }

/* ---- toasts ---- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: fade .2s; pointer-events: auto; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); color: #fff; }

/* ---- prose pages ---- */
.prose-page h2 { font-size: 22px; font-weight: 700; margin: 36px 0 10px; }
.prose-page h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.prose-page p, .prose-page li { font-family: var(--f-prose); font-size: 16.5px; line-height: 1.65; color: var(--ink-2); }
.prose-page ul { padding-left: 20px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.feature-grid .card { padding: 18px; }
.feature-grid .card p { font-size: 14.5px; margin: 0; }
.feature-grid .ic { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 10px; }
.feature-grid .ic svg { width: 18px; height: 18px; }
.role-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.role-table th, .role-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.role-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.role-table td.c { text-align: center; }
.role-table .yes { color: var(--accent); font-weight: 700; }
.role-table .no { color: var(--faint); }
.cluster-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; margin: 10px 0; }
.cluster-list div { font-size: 14.5px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cluster-list b { display: inline-block; min-width: 86px; }

/* ---- admin ---- */
.admin-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-grid h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.admin-grid .sub { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
table.list tr:last-child td { border-bottom: 0; }
table.list td .email { color: var(--muted); font-size: 13px; word-break: break-all; }
table.list td.actions { white-space: nowrap; text-align: right; }
table.list td.actions .btn { margin-left: 4px; }
table.list td.when { white-space: nowrap; font-size: 13px; color: var(--muted); }
table.list td.cbody { min-width: 280px; max-width: 520px; white-space: pre-wrap; word-wrap: break-word; }
table.list .sig-link { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-align: left; font-size: 13.5px; }
table.list .sig-link:hover { text-decoration: underline; }
table.list .sig-link .mono { font-size: 12px; margin-right: 6px; }
.list-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.list-head h2 { font-size: 17px; font-weight: 700; margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 18px; }
.stat .n { font-family: var(--f-mono); font-size: 24px; font-weight: 600; display: block; letter-spacing: -.02em; }
.stat .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---- placeholder ---- */
.placeholder { border: 2px dashed var(--line-2); border-radius: 10px; padding: 64px 24px; text-align: center; color: var(--muted); background: var(--surface); }
.placeholder svg { width: 44px; height: 44px; color: var(--faint); margin-bottom: 12px; }
.placeholder b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

@media print {
  .header, .drawer-head .tabs, .drawer-nav, .scrim, .toasts, .no-print { display: none !important; }
  .drawer { position: static; width: auto; box-shadow: none; animation: none; }
  .drawer-body { overflow: visible; }
  body > #app > :not(.drawer) { display: none; }
  details.memo .memo-body { display: block; }
}
