:root {
  --paper: #f3f6f5;
  --paper-alt: #eaf0ee;
  --surface: #ffffff;
  --surface-elev: #ffffff;
  --ink: #102127;
  --ink-soft: #2b3f47;
  --muted: #546770;
  --line: #d5e0de;
  --line-strong: #b8cac7;
  --accent: #0a6b66;
  --accent-hover: #07524e;
  --accent-ink: #ffffff;
  --accent-soft: #dff0ee;
  --gold: #b5852a;
  --gold-soft: #f9f2e1;
  --global: #0a6b66;
  --regional: #2f43a8;
  --intl: #8a5e12;
  --national: #4a606c;
  --ok: #1b7339;
  --ok-soft: #e3f4e8;
  --warn: #945600;
  --warn-soft: #fdf1dc;
  --shadow-sm: 0 1px 3px rgba(16, 33, 39, 0.05), 0 1px 2px rgba(16, 33, 39, 0.03);
  --shadow-md: 0 8px 24px rgba(16, 33, 39, 0.08), 0 2px 6px rgba(16, 33, 39, 0.04);
  --shadow-lg: 0 20px 44px rgba(16, 33, 39, 0.16);
  --radius: 10px;
  --radius-sm: 6px;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c1417;
    --paper-alt: #121d21;
    --surface: #152227;
    --surface-elev: #1c2c32;
    --ink: #e7f0ee;
    --ink-soft: #c8d6d9;
    --muted: #93a8ae;
    --line: #26383e;
    --line-strong: #385058;
    --accent: #4ec4ba;
    --accent-hover: #6dd3ca;
    --accent-ink: #05201e;
    --accent-soft: #153735;
    --gold: #dfb35b;
    --gold-soft: #2d2515;
    --global: #4ec4ba;
    --regional: #8c9eff;
    --intl: #dfb35b;
    --national: #93aab6;
    --ok: #6cd48d;
    --ok-soft: #143320;
    --warn: #f2b45a;
    --warn-soft: #332510;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.36);
    --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0c1417;
  --paper-alt: #121d21;
  --surface: #152227;
  --surface-elev: #1c2c32;
  --ink: #e7f0ee;
  --ink-soft: #c8d6d9;
  --muted: #93a8ae;
  --line: #26383e;
  --line-strong: #385058;
  --accent: #4ec4ba;
  --accent-hover: #6dd3ca;
  --accent-ink: #05201e;
  --accent-soft: #153735;
  --gold: #dfb35b;
  --gold-soft: #2d2515;
  --global: #4ec4ba;
  --regional: #8c9eff;
  --intl: #dfb35b;
  --national: #93aab6;
  --ok: #6cd48d;
  --ok-soft: #143320;
  --warn: #f2b45a;
  --warn-soft: #332510;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.58 var(--body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
html[lang="en"] .uk, html[lang="uk"] .en { display: none !important; }
[hidden] { display: none !important; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.18; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.85rem, 3.8vw, 2.75rem); font-weight: 600; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.7rem); font-weight: 600; }
h3 { font-size: 1.12rem; font-weight: 600; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 14px; border: 2px solid var(--accent); border-radius: 6px; z-index: 99; }

/* Header & Navigation */
header.site {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
}
header.site .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 600;
}
.brand b { color: var(--accent); font-weight: 700; }
.brand svg { flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.12)); }

nav.main {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-left: auto;
  align-items: center;
}
nav.main a {
  padding: 7px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
nav.main a:hover { background: var(--paper-alt); color: var(--accent); }
nav.main a[aria-current] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.hdr-controls { display: flex; align-items: center; gap: 8px; }
.lang, .seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}
.lang button, .seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font: 600 0.78rem var(--body);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang button:hover, .seg button:hover { color: var(--ink); background: var(--paper-alt); }
.lang button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.menu-toggle { display: none; }

/* Hero / Lede */
.hero-band {
  background:
    radial-gradient(900px 320px at 85% -10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(650px 260px at 10% 0%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 65%),
    linear-gradient(180deg, var(--surface) 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
}
.lede { padding: 34px 0 26px; display: grid; gap: 18px; }
.lede-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 0.78rem var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.lede p { max-width: 74ch; margin: 0; color: var(--muted); font-size: 1.05rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 13px 16px;
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font: 700 1.7rem/1.15 var(--display);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat span { color: var(--muted); font-size: 0.85rem; }

.cee {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.9rem;
}
.cee a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, border-color 0.15s, color 0.15s;
}
.cee a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.cee a.ua-pill { border-color: color-mix(in srgb, #0057b7 45%, var(--line)); background: color-mix(in srgb, #0057b7 6%, var(--surface)); }
.flag-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

/* Toolbar */
.toolbar {
  position: sticky;
  top: 64px;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.toolbar .wrap {
  display: grid;
  grid-template-columns: 2.1fr repeat(5, 1fr);
  gap: 10px;
  align-items: end;
}
.toolbar.ev-t .wrap { grid-template-columns: 2fr repeat(4, 1fr); }
.toolbar.gr-t .wrap { grid-template-columns: 2fr repeat(2, 1fr); }
.toolbar label {
  display: grid;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.search-box { position: relative; display: flex; align-items: center; }
.search-box input { padding-right: 34px !important; }
.kbd-hint {
  position: absolute;
  right: 9px;
  pointer-events: none;
  font: 600 0.72rem var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--paper);
}
.toolbar input[type="search"], .toolbar select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 0.94rem var(--body);
}
.toolbar input[type="search"]:focus, .toolbar select:focus {
  border-color: var(--accent);
}

.checks {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.88rem;
  padding-top: 2px;
}
.checks label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ink);
  font-size: 0.88rem;
  cursor: pointer;
}
.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.88rem; font-weight: 500; }

/* Emblem / Coat of Arms Medallion */
.emblem-box {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 11px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 6px rgba(16, 33, 39, 0.08), inset 0 0 0 2px rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex: none;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.emblem-box.lg {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  padding: 6px;
  cursor: zoom-in;
}
.emblem-box.sm {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 3px;
}
.emblem-box img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.emblem-box.is-heraldic {
  padding: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8f7 100%);
}
.card:hover .emblem-box, .emblem-box.lg:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16, 33, 39, 0.15);
}

/* Cards Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(335px, 1fr));
  gap: 15px;
  padding: 18px 0 36px;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 14px 20px;
  display: grid;
  gap: 9px;
  align-content: start;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, var(--line));
}
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--c, var(--accent));
}
.card[data-scope="global"] { --c: var(--global); }
.card[data-scope="regional"] { --c: var(--regional); }
.card[data-scope="intl"] { --c: var(--intl); }
.card[data-scope="national"] { --c: var(--national); }

.card .top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.abbr {
  font: 700 1.28rem/1.15 var(--display);
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}
.abbr-txt { display: grid; gap: 2px; }
.abbr-sub { font: 600 0.7rem var(--mono); color: var(--muted); letter-spacing: 0.02em; }

.card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}
.rank {
  font: 600 0.78rem var(--mono);
  color: var(--muted);
  background: var(--paper);
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.act-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  transition: all 0.14s;
}
.act-btn:hover { border-color: var(--accent); color: var(--accent); }
.act-btn.saved { color: #d4940a; border-color: #d4940a; background: var(--gold-soft); }
.act-btn.compared { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.card h3 { font-family: var(--body); font-size: 1.02rem; font-weight: 650; line-height: 1.32; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); text-decoration: underline; }
.native { color: var(--muted); font-size: 0.83rem; margin-top: -4px; line-height: 1.35; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 0.84rem; }
.meta .y { font-family: var(--mono); }
.note { font-size: 0.89rem; margin: 0; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 0.73rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--paper);
  white-space: nowrap;
}
.chip.scope { border-color: var(--c); color: var(--c); background: transparent; font-weight: 600; }
.chip.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); background: var(--ok-soft); font-weight: 500; }
.chip.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); background: var(--warn-soft); }
.chip.gold { border-color: color-mix(in srgb, var(--gold) 50%, transparent); color: var(--gold); background: var(--gold-soft); font-weight: 600; }
.chip.aud { border-style: dashed; color: var(--ink-soft); background: transparent; }

.bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: center;
  font: 600 0.79rem var(--mono);
  color: var(--muted);
  margin-top: auto;
  padding-top: 2px;
}
.bar i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c, var(--accent)) var(--w), var(--line) var(--w));
}
.card .links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  font-weight: 500;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

/* Compact Table View on Catalogue */
.reg-table-wrap { padding: 16px 0 36px; overflow-x: auto; }
table.reg-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9rem;
}
table.reg-table th, table.reg-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.reg-table tr:hover td { background: var(--paper-alt); }

/* Sections, Panels, Tables */
.empty { padding: 48px 20px; color: var(--muted); text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); margin: 18px 0; }
section.band { padding: 40px 0; border-top: 1px solid var(--line); }
section.band > .wrap { display: grid; gap: 20px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 20px; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.panel h3 { margin-bottom: 12px; }

.hbar {
  display: grid;
  grid-template-columns: minmax(6.5em, 8.5em) 1fr 4.6em;
  gap: 9px;
  align-items: center;
  font-size: 0.87rem;
  margin: 7px 0;
}
.hbar .t { height: 12px; background: var(--paper-alt); border-radius: 999px; overflow: hidden; }
.hbar .t i { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--accent)); }
.hbar .v { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.small { font-size: 0.82rem; color: var(--muted); }
.muted { color: var(--muted); }
ol.plain, ul.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: 0.77rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--paper-alt); }
td.n, th.n { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.tablewrap table th:first-child, .tablewrap table td:first-child { padding-left: 14px; }
.tablewrap table tr:last-child td, .tablewrap table tr:last-child th { border-bottom: 0; }

/* Profile & Doc Pages */
article.doc { max-width: 860px; padding: 30px 0 52px; display: grid; gap: 18px; }
article.doc.wide { max-width: 1080px; }
article.doc p, article.doc li { max-width: 72ch; }
.crumbs { font-size: 0.86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}
.profile-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.desc { display: grid; gap: 12px; }
.desc .lbl { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 2px; }

dl.facts {
  display: grid;
  grid-template-columns: minmax(175px, max-content) 1fr;
  gap: 9px 20px;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
}
dl.facts dt { color: var(--muted); font-size: 0.87rem; font-weight: 500; }
dl.facts dd { margin: 0; font-weight: 450; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.rel-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, transform 0.12s;
}
.rel-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.rel-card b { display: block; font-size: 0.9rem; color: var(--accent); }
.rel-card span { display: block; font-size: 0.8rem; color: var(--muted); line-height: 1.25; }

/* Buttons & Forms */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  border: 1px solid var(--accent);
  cursor: pointer;
  font: 600 0.9rem var(--body);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line-strong); }
.btn.ghost:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn.sm { padding: 5px 10px; font-size: 0.82rem; }

form.claim { display: grid; gap: 13px; }
form.claim label { display: grid; gap: 4px; font-size: 0.9rem; font-weight: 600; }
form.claim input, form.claim select, form.claim textarea {
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 0.95rem var(--body);
}
pre.out { white-space: pre-wrap; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px; font: 13px/1.5 var(--mono); }

/* Events / Grants / Education timeline rows */
.groups { display: grid; gap: 10px; padding-bottom: 28px; }
.month {
  margin: 24px 0 6px;
  font-size: 1.28rem;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
}
.ev {
  display: grid;
  grid-template-columns: 9.5em 1fr auto;
  gap: 6px 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}
.ev:hover { border-color: var(--line-strong); }
.ev .d { font: 600 0.88rem/1.35 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.ev .d small { display: block; font-weight: 500; color: var(--accent); margin-top: 3px; font-size: 0.75rem; }
.ev-body { display: grid; gap: 6px; grid-column: 2; }
.ev h3 { font-family: var(--body); font-size: 1.02rem; font-weight: 650; }
.ev p { margin: 0; font-size: 0.9rem; }
.ev-side { grid-column: 3; display: flex; align-items: flex-start; gap: 6px; }

/* Comparison Floating Dock & Modals */
.cmp-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: var(--surface-elev);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 8px 14px 8px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
}
.cmp-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-pill {
  font: 600 0.78rem var(--mono);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cmp-pill button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; font-weight: 700; }

dialog.modal {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  max-width: min(1040px, 94vw);
  width: 100%;
  box-shadow: var(--shadow-lg);
}
dialog.modal.narrow { max-width: min(460px, 92vw); }
dialog.modal::backdrop { background: rgba(8, 18, 22, 0.62); backdrop-filter: blur(3px); }
.modal-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-bd { padding: 20px; overflow-x: auto; max-height: 80vh; }

/* Interactive Calculators */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  align-items: end;
}
.calc-grid label { display: grid; gap: 4px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.calc-grid select, .calc-grid input {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 0.92rem var(--body);
}
.calc-result {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.calc-result b { font: 700 1.5rem var(--display); color: var(--accent); }

/* Footer */
footer.site {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 28px 0 34px;
  font-size: 0.86rem;
  color: var(--muted);
}
footer.site .wrap { display: grid; gap: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* Responsive */
@media (max-width: 960px) {
  .toolbar .wrap, .toolbar.ev-t .wrap { grid-template-columns: 1fr 1fr; }
  .toolbar .wrap > label:first-child { grid-column: 1 / -1; }
  .toolbar { position: static; }
}
@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; margin-left: auto; }
  nav.main {
    display: none;
    width: 100%;
    order: 4;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0 12px;
    border-top: 1px solid var(--line);
  }
  nav.main.open { display: flex; }
  .hdr-controls { margin-left: 0; }
  .ev { grid-template-columns: 1fr; }
  .ev-body, .ev-side { grid-column: 1; }
  .profile-hero { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .toolbar .wrap, .toolbar.ev-t .wrap, .toolbar.gr-t .wrap { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 1fr; gap: 4px; }
  dl.facts dt { margin-top: 6px; }
  .hbar { grid-template-columns: 5.8em 1fr 4em; }
}
@media print {
  header.site, .toolbar, .cmp-dock, .card-actions, footer.site { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .panel, .ev { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
