/* Nation Game — "command console" theme (design handoff: Nation Overview).
   Tokens first. Dark is the default; a light variant is opt-in via [data-theme="light"]. */

/* ---------- Self-hosted fonts (OFL, @fontsource) ---------- */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/instrument-serif/instrument-serif-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/instrument-serif/instrument-serif-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/geist/geist-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/geist/geist-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/geist/geist-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/geist-mono/geist-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/geist-mono/geist-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  /* surfaces */
  --bg: #11151c;
  --topbar: #0e1218;
  --nav: #0f1319;
  --surface: #151a22;
  --inset: #11151c;
  --hover: #171c25;
  --hover-2: #1a2029;
  --active: #1b212b;
  /* borders */
  --line: #232a35;        /* hairline */
  --line-panel: #262e3a;  /* panel */
  --line-control: #2c3441;
  --line-tile: #222934;
  --line-button: #2f3846;
  --line-button-hover: #4a5566;
  /* text */
  --text: #e8e4da;
  --text-2: #b9bfca;
  --muted: #8b93a1;
  --subtle: #6f7888;
  --faint: #5f6877;
  --nav-text: #9aa2af;
  --nav-icon: #7d8593;
  --warm: #a9a397;
  /* accent */
  --accent: #d9a84e;
  --accent-hover: #e6b862;
  --link-hover: #ecc57a;
  --on-accent: #1a1406;
  --good: #5fbf8a;
  --good-2: #7fd3a3;
  --bad: #e06c5a;
  --info: #7aa7d9;
  --warn: #d9a84e;
  --issue-bg: #19170f;
  --issue-line: #3a3222;
  /* type */
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* shape */
  --r-panel: 14px;
  --r-btn: 9px;
  --r-input: 8px;
  --r-nav: 7px;
  --flag-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --topbar-h: 56px;
  --nav-w: 232px;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #f3f0e8;
  --topbar: #fbf9f4;
  --nav: #f7f4ed;
  --surface: #fffdf8;
  --inset: #f6f2e9;
  --hover: #efeadf;
  --hover-2: #ebe5d8;
  --active: #e7e0d0;
  --line: #e3dccd;
  --line-panel: #ddd5c4;
  --line-control: #d4cbb8;
  --line-tile: #e3dccd;
  --line-button: #cfc5b0;
  --line-button-hover: #a99c80;
  --text: #1f232b;
  --text-2: #3d434e;
  --muted: #6a6f7c;
  --subtle: #7d8290;
  --faint: #a2a6b0;
  --nav-text: #4f5562;
  --nav-icon: #7a7f8b;
  --warm: #7b6f58;
  --accent: #a87414;
  --accent-hover: #bf8620;
  --link-hover: #8a5e0d;
  --on-accent: #fffaf0;
  --good: #2f8f5b;
  --good-2: #2f8f5b;
  --bad: #c2462f;
  --info: #3b6fa8;
  --issue-bg: #fbf3e0;
  --issue-line: #e8d6a8;
  --flag-shadow: 0 8px 22px rgba(60, 45, 20, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow: 0 10px 28px rgba(60, 45, 20, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; margin: 0 0 0.45em; line-height: 1.1; letter-spacing: -0.005em; }
h1 { font-size: 40px; }
h2 { font-size: 26px; }
h3 { font-size: 21px; }
p { margin: 0 0 0.8em; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code { font-family: var(--mono); font-size: 0.9em; }
.mono, .num-font { font-family: var(--mono); }
.icon { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =========================================================
   App shell
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; color: var(--text); }
.logo:hover { color: var(--text); }
.logo-mark { width: 22px; height: 22px; transform: rotate(45deg); border: 1.5px solid var(--accent); display: flex; align-items: center; justify-content: center; }
.logo-mark::after { content: ''; width: 8px; height: 8px; background: var(--accent); }
.logo-text { font-family: var(--serif); font-size: 24px; letter-spacing: 0.01em; white-space: nowrap; }

.search { position: relative; flex: 1 1 0; min-width: 0; max-width: 420px; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-panel); border-radius: var(--r-input); background: var(--surface); color: var(--subtle);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; height: 100%; color: var(--text); font: inherit; font-size: 13px; outline: none; text-overflow: ellipsis; }
.search-box input::placeholder { color: var(--subtle); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-control); border-radius: 4px; color: var(--subtle); line-height: 1.2; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--line-panel); border-radius: 10px; box-shadow: var(--shadow);
  padding: 6px; max-height: 70vh; overflow: auto;
}
.search-results .sr-group { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 4px; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--text); font-size: 13px; }
.search-results a:hover, .search-results a.sel { background: var(--hover-2); color: var(--text); }
.search-results .empty { padding: 12px; }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.tick-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tick-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(95, 191, 138, 0.18); }
.tick-dot.paused { background: var(--accent); box-shadow: 0 0 0 3px rgba(217, 168, 78, 0.18); }
.tick-status .mono { color: var(--text); }
.tb-divider { width: 1px; height: 22px; background: var(--line-panel); }
.tb-treasury { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.tb-treasury .cash { font-family: var(--mono); font-size: 13px; color: var(--good); }
.tb-treasury .cash.neg { color: var(--bad); }
.tb-treasury .rate { font-size: 11px; color: var(--muted); }
.profile-pill { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border: 1px solid var(--line-panel); border-radius: 999px; color: var(--text); }
.profile-pill:hover { border-color: var(--line-button-hover); color: var(--text); }
.profile-pill .avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex: none; background: var(--active); display: flex; align-items: center; justify-content: center; }
.profile-pill .avatar svg.flag { width: 42px; height: 28px; border: 0; border-radius: 0; }
.profile-pill .who { display: flex; flex-direction: column; line-height: 1.15; padding-right: 6px; min-width: 0; }
.profile-pill .who b { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.profile-pill .who span { font-size: 11px; color: var(--muted); }
.btn-logout { height: 32px; padding: 0 12px; border-radius: var(--r-input); border: 1px solid var(--line-control); background: transparent; color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-logout:hover { background: var(--hover-2); color: var(--text); }
.menu-btn { display: none; width: 34px; height: 34px; border-radius: var(--r-input); border: 1px solid var(--line-control); background: transparent; color: var(--text-2); cursor: pointer; align-items: center; justify-content: center; flex: none; }

.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidenav {
  width: var(--nav-w); flex-shrink: 0;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  background: var(--nav); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 22px;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 0 10px 8px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-nav);
  font-size: 13.5px; color: var(--nav-text);
}
.nav-item .icon { color: var(--nav-icon); }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:hover .icon { color: var(--text); }
.nav-item[aria-current='page'] { background: var(--active); color: var(--text); }
.nav-item[aria-current='page'] .icon { color: var(--accent); }
.nav-item[aria-current='page']::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.nav-badge.bad { background: var(--bad); color: #fff; }
.nav-foot { margin-top: auto; }
.nav-toggle { width: 100%; justify-content: flex-start; text-align: left; background: none; border: 0; font: inherit; font-size: 13.5px; cursor: pointer; }

body.nav-collapsed { --nav-w: 68px; }
body.nav-collapsed .nav-title, body.nav-collapsed .nav-item .label { display: none; }
body.nav-collapsed .nav-item { justify-content: center; padding: 0; }
body.nav-collapsed .nav-item .nav-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }

.main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.main-inner { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.main-inner > * { margin-top: 0; margin-bottom: 0; }

.announcement { padding: 9px 16px; text-align: center; font-size: 13px; border-bottom: 1px solid var(--line); color: var(--text); }
.announcement.info { background: color-mix(in srgb, var(--info) 18%, var(--topbar)); }
.announcement.warning { background: color-mix(in srgb, var(--accent) 20%, var(--topbar)); }
.announcement.danger { background: color-mix(in srgb, var(--bad) 24%, var(--topbar)); }

/* The console surfaces use the browser's normal line-height, as in the design. */
.topbar, .sidenav, .hero, .kpis, .ov-body { line-height: normal; }
.issue-card .body, .server-card .panel-meta { line-height: 1.5; }

/* =========================================================
   Primitives
   ========================================================= */
.panel, .card {
  background: var(--surface); border: 1px solid var(--line-panel); border-radius: var(--r-panel);
  padding: 22px;
}
.card { display: block; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.panel { display: flex; flex-direction: column; gap: 18px; }
.panel-head, .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head { margin-bottom: 12px; }
.panel-head h2, .card-head h2, .card-head h3 { margin: 0; }
.panel-head h2 { font-size: 26px; }
.panel-meta { font-size: 12px; color: var(--subtle); }
.divider { height: 1px; background: var(--line); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.section-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grid > .card, .grid > .panel { margin: 0; }

/* stat cells (generic) */
.stat { background: var(--inset); border: 1px solid var(--line-tile); border-radius: var(--r-btn); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 11.5px; color: var(--muted); }
.stat .value { font-family: var(--mono); font-size: 20px; letter-spacing: -0.02em; line-height: 1.2; }
.stat .sub { font-size: 12px; color: var(--subtle); }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.kpi { background: var(--surface); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-family: var(--mono); font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; white-space: nowrap; }
.kpi .sub { font-size: 12px; color: var(--subtle); }
.kpi .value-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi .spark { flex: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--r-btn);
  border: 1px solid var(--line-button); background: var(--hover-2); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--line-button-hover); color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.lg { height: 40px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 70%, transparent); color: var(--bad); }
.btn.danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.good { background: transparent; border-color: color-mix(in srgb, var(--good) 70%, transparent); color: var(--good); }
.btn.good:hover { background: color-mix(in srgb, var(--good) 14%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover-2); color: var(--text); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn .tag { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(26, 20, 6, 0.15); font-weight: 500; }
.btn.split { justify-content: space-between; }
.btn.left { justify-content: flex-start; }

/* forms */
input, select, textarea {
  width: 100%; background: var(--inset); color: var(--text);
  border: 1px solid var(--line-control); border-radius: var(--r-input);
  padding: 8px 10px; font: inherit; font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
input[type='color'] { padding: 2px; height: 36px; width: 56px; }
input[type='range'] { padding: 0; accent-color: var(--accent); border: 0; background: none; box-shadow: none; }
input[type='checkbox'] { width: auto; accent-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1; min-width: 120px; }
details > summary { cursor: pointer; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-family: var(--mono); font-size: 12.5px; }
tbody tr:hover td { background: color-mix(in srgb, var(--hover) 60%, transparent); }
.table-wrap { overflow-x: auto; }

/* badges, pills, chips */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; }
.badge.bad { background: var(--bad); color: #fff; }
.badge.muted { background: var(--line-control); color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-control); color: var(--muted); white-space: nowrap; }
a.pill:hover { border-color: var(--line-button-hover); color: var(--text); }
.pill.good { background: rgba(95, 191, 138, 0.12); color: var(--good-2); border-color: rgba(95, 191, 138, 0.28); }
.pill.bad { background: rgba(224, 108, 90, 0.12); color: var(--bad); border-color: rgba(224, 108, 90, 0.3); }
.pill.warn { background: rgba(217, 168, 78, 0.12); color: var(--accent); border-color: rgba(217, 168, 78, 0.3); }
.pill.accent { color: var(--accent); border-color: rgba(217, 168, 78, 0.35); }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-control); font-size: 13px; color: var(--text); white-space: nowrap; }
.chip .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chip.bonus { border-color: rgba(217, 168, 78, 0.45); }

/* bars & meters */
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.bar.good > span { background: var(--good); }
.bar.bad > span { background: var(--bad); }
.meter { display: grid; grid-template-columns: 110px 1fr 54px; gap: 12px; align-items: center; font-size: 13.5px; margin-bottom: 10px; }
.meter .v { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.pips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.pips span { height: 6px; border-radius: 2px; background: var(--line-panel); }
.freedom { display: flex; flex-direction: column; gap: 7px; }
.freedom-head { display: flex; justify-content: space-between; font-size: 13.5px; }
.freedoms { display: flex; flex-direction: column; gap: 14px; }
.census { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 12px 14px; font-size: 13.5px; }
.census .v { font-family: var(--mono); font-size: 12.5px; text-align: right; }

.c-good { color: var(--good); }
.c-gold { color: var(--accent); }
.c-bad { color: var(--bad); }
.bg-good { background: var(--good) !important; }
.bg-gold { background: var(--accent) !important; }
.bg-bad { background: var(--bad) !important; }

/* flags */
.flag { display: inline-block; border: 1px solid rgba(0, 0, 0, 0.35); border-radius: 3px; vertical-align: middle; flex: none; }
.nation-link { display: inline-flex; align-items: center; gap: 7px; }
.hero-flag { width: 168px; height: 112px; flex-shrink: 0; border-radius: 4px; overflow: hidden; box-shadow: var(--flag-shadow); }
.hero-flag svg.flag { width: 100%; height: 100%; border: 0; border-radius: 0; display: block; }

/* =========================================================
   Hero
   ========================================================= */
.hero { position: relative; overflow: hidden; border: 1px solid var(--line-panel); border-radius: var(--r-panel); background: var(--surface); }
.hero::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(217, 168, 78, 0.035) 0 1px, transparent 1px 14px); pointer-events: none; }
.hero-body { position: relative; display: flex; flex-wrap: wrap; gap: 28px; padding: 28px; align-items: center; }
.hero-id { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 6px; }
.hero-id .meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-id h1 { margin: 0; font-size: 54px; line-height: 1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.hero-id .motto { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--warm); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 10px; }
.fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact .k { font-size: 11px; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.08em; }
.fact .v { font-size: 13.5px; color: var(--text); }
a.fact .v { color: var(--accent); }
.hero-actions { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.hero-strip { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 28px; border-top: 1px solid var(--line); font-size: 13px; }
.hero-strip.protect { background: rgba(95, 191, 138, 0.05); }
.hero-strip.alert { background: rgba(224, 108, 90, 0.06); }
.hero-strip.caution { background: rgba(217, 168, 78, 0.06); }
.strip-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.protect .strip-label { color: var(--good-2); }
.alert .strip-label { color: var(--bad); }
.caution .strip-label { color: var(--accent); }
.strip-body { color: var(--text-2); }
.strip-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.strip-end .when { color: var(--subtle); font-size: 12px; }
.countdown-chip { font-family: var(--mono); color: var(--text); padding: 3px 8px; border-radius: 6px; background: var(--inset); border: 1px solid var(--line-panel); white-space: nowrap; }

/* simple hero for non-overview pages (profile etc.) */
.hero .title { flex: 1; min-width: 240px; }
.hero .category { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.hero > .hero-body > svg.flag { box-shadow: var(--flag-shadow); border: 0; }

/* =========================================================
   Overview body
   ========================================================= */
.ov-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ov-main { flex: 1 1 640px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.ov-rail { flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { padding: 12px; border-radius: var(--r-btn); background: var(--inset); border: 1px solid var(--line-tile); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .k { font-size: 11.5px; color: var(--muted); }
.tile .v { font-family: var(--mono); font-size: 17px; overflow-wrap: anywhere; }
.tile .u { font-size: 11px; color: var(--subtle); }

.mil-table { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-tile); border-radius: var(--r-btn); overflow: hidden; }
.mil-table > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mil-table > div + div { border-left: 1px solid var(--line-tile); }
.mil-table .n { font-family: var(--mono); font-size: 16px; }
.mil-table .n.zero { color: var(--faint); }
.mil-table .k { font-size: 11.5px; color: var(--muted); }
.mil-extra { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.mil-extra .mono { color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.panel-foot a { font-size: 12px; }

.issue-card { border: 1px solid var(--issue-line); border-radius: var(--r-panel); background: var(--issue-bg); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.issue-card .headline { font-family: var(--serif); font-size: 24px; line-height: 1.15; }
.issue-card .body { font-size: 13px; color: var(--warm); line-height: 1.5; }

.inbox { padding: 6px; display: block; }
.inbox-head { padding: 12px 14px 8px; }
.inbox-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-btn); color: var(--text); }
.inbox-row:hover { background: var(--hover-2); color: var(--text); }
.inbox-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-control); flex: none; }
.inbox-row .dot.on { background: var(--accent); }
.inbox-row .dot.alert { background: var(--bad); }
.inbox-row .t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inbox-row .t b { font-size: 13.5px; font-weight: 400; }
.inbox-row .t b.dim { color: var(--text-2); }
.inbox-row .t span { font-size: 12px; color: var(--subtle); }
.inbox-row .arrow { color: var(--subtle); }

.server-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.server-card .big { font-family: var(--mono); font-size: 30px; letter-spacing: -0.02em; }
.server-card .bar > span { background: var(--good); }

/* =========================================================
   Misc page components
   ========================================================= */
.notice { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line-panel); background: var(--surface); font-size: 13.5px; }
.notice.warn { border-color: rgba(217, 168, 78, 0.45); background: rgba(217, 168, 78, 0.06); }
.notice.bad { border-color: rgba(224, 108, 90, 0.45); background: rgba(224, 108, 90, 0.06); }
.notice.good { border-color: rgba(95, 191, 138, 0.4); background: rgba(95, 191, 138, 0.05); }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--line-panel); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: slidein 0.18s ease-out; }
.toast.error { border-left-color: var(--bad); }
.toast.success { border-left-color: var(--good); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.news-item { display: flex; gap: 10px; }
.news-item .icon-e { flex: none; width: 22px; text-align: center; }
.news-item .when { color: var(--subtle); font-size: 12px; white-space: nowrap; font-family: var(--mono); }

.issue { border-left: 3px solid var(--accent); }
.issue .option { display: block; width: 100%; text-align: left; padding: 12px 14px; margin-top: 10px; background: var(--inset); border: 1px solid var(--line-tile); border-radius: var(--r-btn); color: var(--text); font: inherit; cursor: pointer; line-height: 1.5; }
.issue .option:hover { border-color: var(--accent); }
.issue .option .n { color: var(--accent); font-family: var(--mono); margin-right: 8px; }

.post { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.post .body { white-space: pre-wrap; word-break: break-word; }
.post.hidden { opacity: 0.45; }
.post .meta { font-size: 12px; color: var(--subtle); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card .tabs, .modal .tabs { margin-bottom: 16px; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tabs a:hover { color: var(--text); }

.flag-designer { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
@media (max-width: 600px) { .flag-designer { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.lead { color: var(--muted); max-width: 70ch; }

.auth-wrap { max-width: 1040px; margin: 10px auto; width: 100%; display: flex; flex-direction: column; gap: 20px; }
.auth-hero { text-align: center; padding: 20px 0 6px; }
.auth-hero h1 { font-size: 64px; margin-bottom: 10px; }
.auth-hero .lead { margin: 0 auto; font-size: 15px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.feature { background: var(--surface); border: 1px solid var(--line-panel); border-radius: var(--r-panel); padding: 18px; }
.feature .ico { color: var(--accent); margin-bottom: 8px; }
.feature h3 { font-size: 22px; margin-bottom: 4px; }
.feature p { color: var(--muted); margin: 0; }

.modal-back { position: fixed; inset: 0; background: rgba(5, 7, 10, 0.6); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--line-panel); border-radius: var(--r-panel); padding: 22px; width: min(520px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }

.empty { color: var(--subtle); text-align: center; padding: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.good-t { color: var(--good); }
.bad-t { color: var(--bad); }
.warn-t { color: var(--accent); }
.mt { margin-top: 14px; }
.loading { color: var(--subtle); padding: 40px; text-align: center; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px) {
  .ov-rail { max-width: none; }
}
@media (max-width: 900px) {
  .profile-pill .who span { display: none; }
  .tb-treasury .rate { display: none; }
}
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .menu-btn { display: inline-flex; }
  .logo-text { font-size: 20px; }
  .tick-status .lbl, .tb-divider, .profile-pill .who, .btn-logout .label { display: none; }
  .search { max-width: none; }
  .search-box .kbd { display: none; }
  .tb-right { gap: 10px; }
  .sidenav {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; z-index: 30; width: 248px;
    transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow);
  }
  body.nav-open .sidenav { transform: none; }
  body.nav-collapsed { --nav-w: 248px; }
  body.nav-collapsed .nav-title, body.nav-collapsed .nav-item .label { display: revert; }
  body.nav-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  .nav-foot { display: none; }
  .main { padding: 18px 16px 48px; }
  .hero-body { padding: 20px; gap: 20px; }
  .hero-strip { padding: 12px 20px; }
  .hero-id h1 { font-size: 40px; }
  .hero-actions { width: 100%; }
  .hero-flag { width: 120px; height: 80px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mil-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mil-table > div:nth-child(3) { border-left: 0; }
  .mil-table > div:nth-child(n + 3) { border-top: 1px solid var(--line-tile); }
  .kpi .value { font-size: 24px; }
  .auth-hero h1 { font-size: 44px; }
  .strip-end { margin-left: 0; }
}
@media (max-width: 420px) {
  .tick-status { display: none; }
  .tb-treasury { display: none; }
}

/* Stacked cards inside columns (outside the main flex column, which already has a gap). */
:not(.main-inner):not(.grid):not(.ov-main):not(.ov-rail) > :is(.card, .panel) + :is(.card, .panel) { margin-top: 20px; }
.panel-meta-link { font-size: 12px; }
.btn-logout .lo-icon { display: none; }
@media (max-width: 720px) { .btn-logout { padding: 0 9px; } .btn-logout .lo-icon { display: block; } }
