/* Atlas: the one stylesheet. Light Lilac theme from the approved redesign (2026-10-12, docs/UI_REDESIGN.md).
   Tokens first, then the shared classes every screen uses (pinned contract C4), then the shell (side menu),
   then the shared parts of screens and the file import (public/import/panel.mjs, question-card.mjs).
   Text is 14 to 16 px; the only larger sizes are the screen title (22 px) and the headline figures (.figure). */
:root {
  color-scheme: light;
  --bg: #f8f6fb;
  --side: #f0ecf7;
  --surface: #ffffff;
  --surface-2: #faf8fd;
  --surface-3: #f3eff9;
  --line: #e8e2f0;
  --line-strong: #d2c9e0;
  --text: #2a2433;
  --muted: #605870;
  --faint: #7a7288;
  /* --accent is the lilac used for text, links, focus and checked controls; --accent-fill is the pastel
     fill of primary buttons and bars, with --accent-ink on it; --accent-soft is the selected background. */
  --accent: #6a4db0;
  --accent-fill: #cdb8ee;
  --accent-ink: #3b2566;
  --accent-soft: #efe8fb;
  --accent-text: #4d3480;
  --accent-line: #dccdf3;
  --ok: #2f6e4c;
  --ok-soft: #e2f2e9;
  --ok-line: #bfdccb;
  --warn: #8c4f1c;
  --warn-soft: #fcebdd;
  --warn-line: #f1d2b5;
  --danger: #a0384a;
  --danger-soft: #fae3e6;
  --danger-line: #f0c3cb;
  --info: #2f5c93;
  --info-soft: #e3eefb;
  --info-line: #c3d7f0;
  /* Chart and asset colors, in order of the holdings. */
  --c1: #c2aeea; --c2: #f4b9a6; --c3: #a8cdea; --c4: #a9d8c3; --c5: #f2d89b; --c6: #e6b3cf; --c7: #b9c3e9; --c8: #ddd8e6;
  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --gap: 16px;
  --shadow: 0 1px 2px rgba(42, 36, 51, .05);
  --shadow-pop: 0 8px 24px rgba(42, 36, 51, .12);
  --font: Manrope, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --fs-small: 14px;
  --fs: 15px;
  --fs-large: 16px;
  --fs-title: 22px;
  --sidebar: 248px;
  --topbar: 0px; /* sticky offset for screen toolbars: the side menu leaves the top of the page free */
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.45;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: var(--fs); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, dl, dd, ul, ol, figure { margin: 0; }
h1 { font-size: var(--fs-title); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: var(--fs-large); font-weight: 700; }
h3 { font-size: var(--fs); font-weight: 700; }
h4 { font-size: var(--fs); font-weight: 600; }
small, .small { font-size: var(--fs-small); }
p { color: var(--text); }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: var(--fs-small); overflow-wrap: anywhere; }
strong { font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; font-size: var(--fs); }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: var(--fs-small); }
.numeric, .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.figure { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.figure.md { font-size: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Layout helpers ---- */
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.tight { gap: 4px; }
.stack.loose { gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: var(--gap); align-items: stretch; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.toolbar.end { justify-content: flex-end; }
.toolbar.between { justify-content: space-between; }
.toolbar .spacer { flex: 1; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-head p { color: var(--muted); font-size: var(--fs-small); }
.page-kicker { color: var(--muted); font-size: var(--fs-small); font-weight: 600; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-small); }
.breadcrumb a { font-weight: 600; }
.title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; min-width: 0; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.card-head > :first-child { min-width: 0; }
.card-head .muted { display: block; }
.card.flat { background: var(--surface-2); box-shadow: none; }
.card.accent { border-color: var(--accent-line); }
/* A card whose rows run edge to edge (lists and tables): the head and foot keep the card padding. */
.card.flush { padding: 0; gap: 0; }
.card.flush > .card-head { padding: 18px 22px 14px; }
.card.flush > .card-intro { padding: 0 22px 14px; color: var(--muted); }
.card.flush > .card-foot { padding: 12px 22px 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; font-size: var(--fs-small); color: var(--muted); }
.section { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.section-title { font-weight: 700; font-size: var(--fs); }
.kpi { gap: 6px; }
.kpi-label { color: var(--muted); font-size: var(--fs-small); font-weight: 600; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: var(--fs); font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; pointer-events: none; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: #c1a8ea; border-color: #c1a8ea; }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: var(--fs-small); border-radius: var(--radius-sm); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn.quiet:hover { background: var(--accent-soft); }
.btn.quiet.danger { color: var(--danger); }
.btn.icon { width: 36px; min-height: 36px; padding: 0; }
.btn svg { flex: none; }
.btn .spinner { width: 14px; height: 14px; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font-size: var(--fs-small); font-weight: 600; cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }
/* question-card.mjs (public/import) still writes .text-button */
.text-button { background: none; border: 0; padding: 2px 4px; color: var(--accent); font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
.text-button:disabled { opacity: .5; cursor: default; }

/* ---- Chips and badges ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); font-size: var(--fs-small); font-weight: 600; line-height: 1.2; white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: transparent; background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: transparent; background: var(--warn-soft); }
.chip.danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.chip.info { color: var(--info); border-color: transparent; background: var(--info-soft); }
.chip.accent { color: var(--accent-text); border-color: transparent; background: var(--accent-soft); }
a.chip:hover { text-decoration: none; border-color: var(--accent-line); }
.chip .chip-x { width: 24px; height: 24px; margin-right: -6px; display: inline-grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: inherit; padding: 0; }
.chip .chip-x:hover { background: rgba(42, 36, 51, .08); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); font-size: var(--fs-small); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.badge.muted { background: var(--surface-3); color: var(--muted); }
.badge.solid { background: var(--accent-ink); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); } .dot.info { background: var(--info); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 999px; flex: none; }

/* ---- Notices ---- */
.notice { border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 10px 14px; background: var(--surface-2); font-size: var(--fs-small); overflow-wrap: anywhere; }
.notice.ok { border-color: var(--ok-line); background: var(--ok-soft); }
.notice.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.notice.danger { border-color: var(--danger-line); background: var(--danger-soft); }
.notice.info { border-color: var(--info-line); background: var(--info-soft); }
.notice p { font-size: var(--fs-small); }
.form-error { color: var(--danger); font-size: var(--fs-small); min-height: 0; }
.form-error:empty { display: none; }
.status-line { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.status-line.error { color: var(--danger); }
.status-line.warn { color: var(--warn); }
.status-line.ok { color: var(--ok); }

/* ---- Tables ---- */
.table-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.table-wrap.tall { max-height: 560px; }
.table-wrap.bare { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs); }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: var(--fs-small); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child > td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover > td { background: var(--surface-2); }
.table tbody tr[aria-expanded="true"] > td { background: var(--surface-2); }
.table td.numeric, .table th.numeric { text-align: right; }
.table td small, .table td .muted { display: block; }
.row-detail > td { background: var(--surface-2); padding: 14px 18px 18px; }
.row-detail .kv { max-width: 760px; }
/* Grid lists: a head row and rows sharing --cols (set on .glist), inside a .card.flush or alone. */
.glist { display: flex; flex-direction: column; min-width: 0; }
.glist-scroll { overflow-x: auto; }
.glist-head, .glist-row { display: grid; grid-template-columns: var(--cols, 1fr); gap: 16px; align-items: center; padding: 12px 22px; min-width: var(--min, 0); }
.glist-head { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--fs-small); font-weight: 600; }
.glist-row + .glist-row { border-top: 1px solid var(--line); }
.glist .num { text-align: right; font-variant-numeric: tabular-nums; }
.glist .cell-main { display: flex; flex-direction: column; min-width: 0; }
.glist .cell-main > :first-child { font-weight: 700; }
.glist .cell-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* ---- Lists and key/value ---- */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 16px; font-size: var(--fs-small); }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); overflow-wrap: anywhere; }
.plain-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plain-list > li { min-width: 0; }
.divided > li + li { border-top: 1px solid var(--line); padding-top: 10px; }
.bullets { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }

/* ---- Empty states and progress ---- */
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); }
.empty strong { color: var(--text); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent-fill); border-radius: inherit; }
/* Proportion bars: segments with an inline flex-grow and background (var(--c1) to var(--c8)). */
.bar { display: flex; gap: 3px; height: 10px; min-width: 0; }
.bar.tall { height: 12px; }
.bar > span { border-radius: 999px; min-width: 4px; }
/* History coverage: one lane per source on a shared time axis (left/width in percent, inline). */
.timeline { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px 16px; align-items: center; }
.timeline > .lane-name { font-size: var(--fs-small); font-weight: 600; }
.lane { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lane-track { position: relative; display: block; height: 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.lane-track > span { position: absolute; top: 0; bottom: 0; min-width: 12px; border-radius: 999px; background: var(--accent-fill); }
.lane-track > span.api { background: var(--c4); }
.lane-track > span.gap { background: var(--warn-soft); border: 1px dashed var(--warn); }
.axis { position: relative; display: block; height: 20px; font-size: var(--fs-small); color: var(--muted); }
.axis > span { position: absolute; top: 0; white-space: nowrap; }

/* ---- Forms ---- */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea {
  width: 100%; min-height: 40px; padding: 7px 12px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: var(--fs); }
select { padding-right: 32px; }
textarea { min-height: 76px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; background: var(--surface-2); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="file"] { font-size: var(--fs-small); max-width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-small); font-weight: 600; color: var(--muted); min-width: 0; }
.field > .muted { font-weight: 400; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > input, .field.inline > select { width: auto; }
input.narrow { width: 140px !important; }
.toolbar > select, .toolbar > input.search { width: auto; flex: 1 1 200px; min-width: 160px; max-width: 320px; }
.toolbar > input.copy-field { width: auto; flex: 1 1 240px; min-width: 0; }
/* A text field with a leading icon (search). The input inside is borderless. */
.input-icon { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); min-width: 0; }
.input-icon:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.input-icon > input { flex: 1 1 auto; min-width: 0; border: 0 !important; padding: 0 !important; min-height: 38px !important; background: transparent !important; outline: none !important; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-small); color: var(--text); cursor: pointer; }
.check > input { margin-top: 1px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: var(--fs-small); color: var(--muted); cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.switch .track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); flex: none; transition: background-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(42, 36, 51, .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { background: var(--line); }
.switch:has(input:disabled) { cursor: default; }
.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { min-height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: var(--fs-small); font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(42, 36, 51, .12); }
/* Tabs: one strip of buttons; the open one is aria-selected (role=tab) or aria-pressed. */
.tabs { display: inline-flex; flex-wrap: wrap; align-self: flex-start; gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.tabs button { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: var(--fs); font-weight: 600; }
.tabs button:hover { background: var(--surface-3); }
.tabs button[aria-selected="true"], .tabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.popover-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 14px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); min-height: 150px; padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; margin: 0; min-width: 0; }
legend { padding: 0 4px; font-weight: 600; font-size: var(--fs-small); }
details > summary { cursor: pointer; font-weight: 600; color: var(--text); list-style-position: inside; }
details > summary::marker { color: var(--faint); }
details[open] > summary { margin-bottom: 10px; }

/* ---- Confirm and toast ---- */
dialog.confirm { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
dialog.confirm::backdrop { background: rgba(42, 36, 51, .35); }
.confirm-body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.confirm-body p { white-space: pre-line; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font-size: var(--fs); box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; overflow-wrap: anywhere; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; cursor: pointer; }
.toast.success { border-color: var(--ok-line); background: var(--ok-soft); }
.toast.error { border-color: var(--danger-line); background: var(--danger-soft); }

/* ---- Shell: side menu and screen ---- */
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: var(--fs-large); font-weight: 700; text-decoration: none; }
.wordmark:hover { text-decoration: none; }
.wordmark img, .wordmark svg { width: 30px; height: 30px; flex: none; }
.app { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; flex: 0 0 var(--sidebar); width: var(--sidebar); height: 100vh; overflow-y: auto; background: var(--side); border-right: 1px solid var(--line);
  padding: 20px 14px 16px; display: flex; flex-direction: column; gap: 16px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 4px; color: var(--text); text-decoration: none; }
.side-brand:hover { text-decoration: none; }
.side-brand svg { width: 30px; height: 30px; flex: none; }
.side-brand .name { display: flex; flex-direction: column; line-height: 1.15; }
.side-brand .name b { font-size: var(--fs-large); font-weight: 700; }
.side-brand .name small { color: var(--muted); font-weight: 500; }
.menu-button { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-row { display: flex; align-items: center; gap: 2px; }
.side-link { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-md); color: var(--text); font-size: var(--fs); font-weight: 600; text-decoration: none; }
.side-link svg { flex: none; }
.side-link:hover { background: var(--surface-3); text-decoration: none; }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.side-toggle { flex: none; width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.side-toggle:hover { background: var(--surface-3); }
.side-toggle svg { transition: transform .15s; }
.side-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.side-sub-list { display: flex; flex-direction: column; gap: 2px; }
.side-label { padding: 6px 12px 2px 46px; color: var(--muted); font-size: var(--fs-small); font-weight: 600; }
.side-sub { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 12px 0 46px; border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-small); font-weight: 500; text-decoration: none; }
.side-sub > .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-sub:hover { background: var(--surface-3); text-decoration: none; }
.side-sub[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.side-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.side-badge { margin-left: auto; }
.side-empty { padding: 4px 12px 4px 46px; color: var(--muted); font-size: var(--fs-small); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 4px 0 10px; border-top: 1px solid var(--line); }
.side-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-grid; place-items: center; font-size: var(--fs-small); font-weight: 700; }
.side-user .who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-user .who > span { font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who > .email { font-weight: 600; }
.side-user .who > .save-state { color: var(--muted); }
.side-user .who > .save-state:empty { display: none; }
.icon-button { flex: none; width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--surface-3); color: var(--text); }
.main { flex: 1 1 auto; min-width: 0; }
.screen { max-width: 1160px; margin: 0 auto; padding: 28px 36px 64px; }
.screen.narrow { max-width: 860px; }
.screen-root { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(520px, 100%); padding: 28px; gap: 16px; }
.gate-card .wordmark { margin-bottom: 8px; }

/* ---- Shared screen parts ---- */
.asset { display: flex; align-items: center; gap: 12px; min-width: 0; }
.coin { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--c8); color: var(--text); font-size: var(--fs-small); font-weight: 700; letter-spacing: -.02em; flex: none; }
.alerts > li { display: flex; align-items: center; gap: 10px; }
.alerts > li > div { min-width: 0; flex: 1; }
.areas { display: grid; grid-template-columns: minmax(150px, max-content) minmax(0, 1fr); gap: 8px 16px; font-size: var(--fs-small); }
.areas dt { color: var(--text); font-weight: 600; }
.areas dd { color: var(--muted); overflow-wrap: anywhere; }
.areas dd.error { color: var(--danger); }
.address-row { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.network-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; }
.network-grid.disabled { opacity: .5; }
.provider-options { display: flex; flex-wrap: wrap; gap: 8px; }
.provider-options label { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); font-size: var(--fs-small); cursor: pointer; background: var(--surface); }
.provider-options label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.form-card { border-color: var(--accent-line); }

/* ---- File import and ChatGPT connection (public/import/panel.mjs, question-card.mjs) ---- */
.csv-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.csv-file { overflow-wrap: anywhere; }
.csv-spec { color: var(--accent); font-weight: 600; }
.csv-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.csv-summary > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.csv-summary dt { color: var(--muted); font-size: var(--fs-small); }
.csv-summary dd { font-variant-numeric: tabular-nums; }
.csv-warnings { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-small); overflow-wrap: anywhere; }
.csv-warning { color: var(--warn); font-size: var(--fs-small); }
.csv-note { color: var(--ok); font-size: var(--fs-small); }
.csv-question { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; }
.csv-question legend { font-size: var(--fs); color: var(--text); }
.csv-option { display: flex; align-items: center; gap: 10px; font-size: var(--fs-small); color: var(--text); cursor: pointer; }
.csv-custom .csv-custom-text { flex: 1; min-width: 0; }
.csv-suggestion-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.csv-files { list-style: none; padding: 0; display: flex; flex-direction: column; }
.csv-files > li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; overflow-wrap: anywhere; }
.csv-files > li:first-child { border-top: 0; }
.csv-preview td small { display: block; max-width: 420px; overflow-wrap: anywhere; color: var(--muted); }
.csv-connect ol { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-small); }
.amount { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Narrow screens: the side menu folds into a bar with a Menu button ---- */
@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { position: static; flex: none; width: auto; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; gap: 10px; }
  .menu-button { display: inline-flex; }
  .sidebar:not(.open) .side-nav, .sidebar:not(.open) .side-user { display: none; }
  .screen { padding: 20px 16px 48px; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .card.flush > .card-head, .card.flush > .card-intro, .glist-head, .glist-row { padding-left: 16px; padding-right: 16px; }
  .kv, .areas, .timeline { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd, .areas dd { margin-bottom: 6px; }
  .table th, .table td { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
