/* Tessera prototype styles. Tokens first; every color has a dark-mode value. */
:root {
  --ink: #16293f;
  --ink-soft: #3d5a7a;
  --body: #34414f;
  --muted: #667281;
  --accent: #1f5f9e;
  --accent-dk: #17497a;
  --accent-bg: #e8f0f9;
  --line: #e1e6ed;
  --line-strong: #cbd3dd;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --header: #16293f;
  --good: #0f7b5f;
  --good-bg: #e6f5ef;
  --bad: #b3261e;
  --bad-bg: #fbeaea;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --focus: #1f5f9e;
  --on-accent: #ffffff;
  --r: 10px;
  --r-sm: 6px;
  --shadow-1: 0 1px 2px rgba(22, 41, 63, .06), 0 1px 3px rgba(22, 41, 63, .05);
  --shadow-2: 0 10px 30px rgba(22, 41, 63, .14);
  --maxw: 1200px;
  /* Tile status colors (always paired with a text label). */
  --st-draft: #9aa6b5;
  --st-locked: #b8c2cf;
  --st-open: #4aa3df;
  --st-offered: #e0a100;
  --st-claimed: #5b5fd6;
  --st-submitted: #9b59d0;
  --st-review: #9b59d0;
  --st-revision: #e2711d;
  --st-accepted: #13a07a;
  --st-cancelled: #d3d8df;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8eef6; --ink-soft: #a9bdd4; --body: #c9d3de; --muted: #93a0af; --accent: #7fb3ea; --accent-dk: #a8cbf0;
    --accent-bg: #1b2d44; --line: #2a3644; --line-strong: #3a4859; --bg: #0f1620; --surface: #161f2b; --surface-2: #1b2532;
    --header: #0b121b; --good: #4fd1a5; --good-bg: #123328; --bad: #f28b82; --bad-bg: #3a1a1a; --warn: #f4c267; --warn-bg: #3a2c10;
    --focus: #7fb3ea; --on-accent: #0b121b; --st-locked: #5b6878; --st-draft: #6c7a8b; --st-cancelled: #3b4654; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e8eef6; --ink-soft: #a9bdd4; --body: #c9d3de; --muted: #93a0af; --accent: #7fb3ea; --accent-dk: #a8cbf0;
  --accent-bg: #1b2d44; --line: #2a3644; --line-strong: #3a4859; --bg: #0f1620; --surface: #161f2b; --surface-2: #1b2532;
  --header: #0b121b; --good: #4fd1a5; --good-bg: #123328; --bad: #f28b82; --bad-bg: #3a1a1a; --warn: #f4c267; --warn-bg: #3a2c10;
  --focus: #7fb3ea; --on-accent: #0b121b; --st-locked: #5b6878; --st-draft: #6c7a8b; --st-cancelled: #3b4654; color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.55; color: var(--body); background: var(--bg); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; letter-spacing: -0.012em; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p + p { margin-top: .6rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-dk); }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .7rem .8rem; overflow: auto; max-height: 420px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 300; background: var(--surface); color: var(--accent); padding: .6rem 1rem; font-weight: 600; }
.skip-link:focus { left: 0; }

/* ---------- header ---------- */
.topbar { background: var(--header); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 12px rgba(0, 0, 0, .18); }
.topbar-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; }
.brand:hover { color: #fff; }
.brand small { font-weight: 500; opacity: .6; font-size: .75rem; }
.topbar .spacer { flex: 1; }
.chip-btn { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255, 255, 255, .09); color: #fff; border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: .28rem .7rem; font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.chip-btn:hover { background: rgba(255, 255, 255, .16); }
.chip-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: #4fd1a5; }
.chip-btn .dot.off { background: #8795a6; }
.persona-btn { padding: .2rem .7rem .2rem .25rem; }
.nav { max-width: var(--maxw); margin: 0 auto; display: flex; gap: .15rem; padding: 0 .75rem .45rem; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: rgba(255, 255, 255, .74); text-decoration: none; padding: .35rem .7rem; border-radius: var(--r-sm); font-size: .88rem; font-weight: 500; white-space: nowrap; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.nav .count { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; margin-left: .3rem; border-radius: 999px; background: #e0a100; color: #16293f; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.2rem; }
.back-link { color: rgba(255, 255, 255, .6); font-size: .78rem; text-decoration: none; white-space: nowrap; }
.back-link:hover { color: #fff; }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.1rem; }
.page-head h1 { outline: none; }
.page-head .sub { color: var(--muted); margin-top: .2rem; font-size: .92rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: .5rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 1rem 1.1rem; min-width: 0; }
.card h2, .card h3 { margin-bottom: .55rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flat { box-shadow: none; }
.card.accent { border-color: var(--accent); background: var(--accent-bg); }
.card.warn { border-color: var(--warn); background: var(--warn-bg); }
.card.good { border-color: var(--good); background: var(--good-bg); }
.card.bad { border-color: var(--bad); background: var(--bad-bg); }
.card-link { text-decoration: none; color: inherit; display: block; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { border-color: var(--accent); box-shadow: var(--shadow-2); color: inherit; }
.stat { display: flex; flex-direction: column; }
.stat .v { font-size: 1.45rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .l { font-size: .8rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-size: .9rem; font-weight: 600; padding: .5rem .95rem; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 38px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { font-size: .8rem; padding: .3rem .6rem; min-height: 30px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn .spin, .spinner { animation-duration: 2.5s; } .pulse { animation: none !important; } }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label, .label { font-weight: 600; color: var(--ink); font-size: .88rem; }
.field .hint { color: var(--muted); font-size: .8rem; }
input[type=text], input[type=number], input[type=password], input[type=datetime-local], input[type=url], input[type=search], select, textarea {
  font: inherit; font-size: .92rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: .48rem .6rem; width: 100%; min-height: 38px;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.choice { display: flex; gap: .5rem; align-items: flex-start; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.choice input { margin-top: .25rem; }
.choice b { color: var(--ink); display: block; font-size: .9rem; }
.choice span { color: var(--muted); font-size: .82rem; }
.choices { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; padding: .12rem .45rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-soft); background: var(--surface-2); white-space: nowrap; }
.badge .sw { width: 8px; height: 8px; border-radius: 2px; }
.badge.good { color: var(--good); border-color: currentColor; background: var(--good-bg); }
.badge.bad { color: var(--bad); border-color: currentColor; background: var(--bad-bg); }
.badge.warn { color: var(--warn); border-color: currentColor; background: var(--warn-bg); }
.badge.info { color: var(--accent); border-color: currentColor; background: var(--accent-bg); }
.tag { display: inline-block; white-space: nowrap; font-size: .76rem; padding: .05rem .45rem; border-radius: var(--r-sm); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-bg); }
td.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: thin; }
.tabs button { font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: .5rem .75rem; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--ink); }

/* ---------- mosaic ---------- */
.mosaic { display: grid; grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); gap: 3px; }
.mosaic.big { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.mosaic .tess { aspect-ratio: 1; border-radius: 3px; background: var(--st-locked); position: relative; }
.mosaic.big .tess { border-radius: 5px; }
.tess.s-DRAFT { background: repeating-linear-gradient(45deg, var(--st-draft), var(--st-draft) 3px, transparent 3px, transparent 6px); border: 1px dashed var(--st-draft); }
.tess.s-LOCKED { background: var(--st-locked); }
.tess.s-OPEN { background: var(--st-open); }
.tess.s-OFFERED { background: var(--st-offered); }
.tess.s-CLAIMED { background: var(--st-claimed); }
.tess.s-SUBMITTED, .tess.s-IN_REVIEW { background: var(--st-review); }
.tess.s-REVISION { background: var(--st-revision); }
.tess.s-ACCEPTED { background: var(--st-accepted); }
.tess.s-CANCELLED { background: repeating-linear-gradient(45deg, var(--st-cancelled), var(--st-cancelled) 3px, transparent 3px, transparent 6px); }
.tess.kind-REVIEW::after { content: ''; position: absolute; inset: 30%; border-radius: 50%; background: rgba(255, 255, 255, .7); }
.tess.kind-INTEGRATION::after { content: ''; position: absolute; inset: 28%; background: rgba(255, 255, 255, .7); transform: rotate(45deg); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .76rem; color: var(--muted); margin-top: .5rem; }
.legend span { display: inline-flex; align-items: center; gap: .3rem; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- graph ---------- */
.graph-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); max-height: 560px; }
.graph-wrap svg { display: block; }
.gnode rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; }
.gnode .bar { stroke: none; }
.gnode.selected rect.box { stroke: var(--accent); stroke-width: 2.5; }
.gnode:focus { outline: none; }
.gnode:focus rect.box { stroke: var(--focus); stroke-width: 2.5; }
.gnode text { fill: var(--ink); font-size: 12px; font-family: inherit; }
.gnode text.meta { fill: var(--muted); font-size: 10.5px; }
.gnode { cursor: pointer; }
.gedge { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.gedge.hl { stroke: var(--accent); stroke-width: 2.2; }

/* ---------- misc components ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.persona { display: flex; gap: .7rem; align-items: flex-start; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem; cursor: pointer; width: 100%; }
.persona:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.persona.current { border-color: var(--accent); background: var(--accent-bg); }
.persona b { color: var(--ink); display: block; }
.persona .meta { font-size: .8rem; color: var(--muted); }
.pipeline { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; font-size: .75rem; }
.pipeline span { padding: .15rem .5rem; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.pipeline span.done { color: var(--good); border-color: var(--good); }
.pipeline span.now { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.pipeline .arrow { border: 0; padding: 0; background: none; }
.bars { display: grid; gap: .25rem; }
.bars .b { display: grid; grid-template-columns: 1.4rem 1fr 3rem; align-items: center; gap: .4rem; font-size: .78rem; }
.bars .track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bars .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.meter { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.meter > div { height: 100%; background: var(--good); }
.meter.over > div { background: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.crit { display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.crit:last-child { border-bottom: 0; }
.crit .rule { font-size: .76rem; color: var(--muted); }
.crit > .badge { align-self: start; }
.verdict { display: grid; grid-template-columns: auto 1fr; gap: .3rem .6rem; padding: .5rem .6rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.verdict.pass { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.verdict.fail { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); background: var(--bad-bg); }
.verdict .src { font-size: .7rem; }
.feed { list-style: none; }
.feed li { display: grid; grid-template-columns: 5.2rem 1fr; gap: .6rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .85rem; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty svg { opacity: .6; margin-bottom: .5rem; }
.callout { border-left: 3px solid var(--accent); background: var(--accent-bg); padding: .65rem .85rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: .88rem; }
.callout.warn { border-color: var(--warn); background: var(--warn-bg); }
.callout.bad { border-color: var(--bad); background: var(--bad-bg); }
.callout.good { border-color: var(--good); background: var(--good-bg); }
.prose { color: var(--body); }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5 { margin: 1rem 0 .4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: .4rem 0; }
.prose p { margin: .45rem 0; }
.prose table { margin: .6rem 0; }
.prose blockquote { border-left: 3px solid var(--line-strong); padding-left: .7rem; color: var(--muted); }
.steps { counter-reset: s; list-style: none; }
.steps li { counter-increment: s; position: relative; padding: .35rem 0 .35rem 2.1rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: .35rem; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-weight: 700; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
.checklist { list-style: none; }
.checklist li { display: flex; gap: .55rem; padding: .35rem 0; align-items: flex-start; }
.checklist input { margin-top: .3rem; width: 1rem; height: 1rem; flex: none; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r); padding: 1rem; text-align: center; color: var(--muted); background: var(--surface-2); }
.dropzone.over { border-color: var(--accent); background: var(--accent-bg); }
.filelist { list-style: none; }
.filelist li { display: flex; align-items: center; gap: .5rem; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: .35rem; background: var(--surface); font-size: .86rem; }
.filelist li .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; color: var(--ink); }
.chat { display: flex; flex-direction: column; gap: .5rem; max-height: 340px; overflow-y: auto; padding: .25rem; }
.msg { padding: .5rem .7rem; border-radius: 12px; max-width: 88%; font-size: .88rem; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.countdown { font-variant-numeric: tabular-nums; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; display: inline-block; vertical-align: middle; }

/* ---------- toasts, modal, menu ---------- */
.toasts { position: fixed; bottom: 1rem; left: 1rem; z-index: 400; display: flex; flex-direction: column; gap: .4rem; width: min(400px, calc(100% - 2rem)); }
@media (max-width: 640px) { .toasts { bottom: 4.2rem; } }
.toast { background: var(--ink); color: var(--bg); padding: .65rem .9rem; border-radius: var(--r-sm); box-shadow: var(--shadow-2); font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok { background: var(--good); color: #fff; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.modal-back { position: fixed; inset: 0; background: rgba(8, 14, 22, .55); z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 1rem; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-2); width: min(680px, 100%); padding: 1.2rem 1.25rem; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.modal-head button.x { background: none; border: 0; font-size: 1.5rem; color: var(--muted); cursor: pointer; line-height: 1; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--body); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: .4rem; min-width: 260px; z-index: 120; }
.menu button, .menu a { display: flex; width: 100%; gap: .5rem; align-items: center; text-align: left; font: inherit; font-size: .88rem; padding: .45rem .55rem; border: 0; background: none; color: var(--ink); border-radius: var(--r-sm); cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--accent-bg); }
.menu .sep { border-top: 1px solid var(--line); margin: .3rem 0; }
.rel { position: relative; }

/* ---------- guide ---------- */
.guide { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; width: min(360px, calc(100% - 2rem)); background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); box-shadow: var(--shadow-2); }
.guide-head { display: flex; justify-content: space-between; align-items: center; padding: .55rem .8rem; background: var(--accent-bg); border-radius: var(--r) var(--r) 0 0; }
.guide-head b { color: var(--ink); font-size: .9rem; }
.guide-head button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; }
.guide ol { list-style: none; padding: .45rem .8rem .7rem; max-height: 50vh; overflow-y: auto; }
.guide .now { padding: .6rem .8rem .75rem; }
.guide .now b { color: var(--ink); display: block; font-size: .92rem; }
.guide .now p { font-size: .82rem; color: var(--muted); margin: .25rem 0 .5rem; }
.guide .prog { height: 4px; background: var(--line); }
.guide .prog > div { height: 100%; background: var(--good); }
.guide .more { background: none; border: 0; color: var(--accent); font: inherit; font-size: .78rem; cursor: pointer; padding: 0 .8rem .6rem; }
.guide li { display: grid; grid-template-columns: 1.3rem 1fr; gap: .45rem; padding: .3rem 0; font-size: .84rem; align-items: start; }
.guide li .ck { width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; margin-top: .1rem; }
.guide li.done { color: var(--muted); }
.guide li.done .ck { background: var(--good); border-color: var(--good); color: #fff; }
.guide li.current { font-weight: 600; color: var(--ink); }
.guide li.current .ck { border-color: var(--accent); }
.guide .go { display: inline-block; margin-top: .2rem; font-size: .8rem; }
.guide-mini { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; }

/* ---------- hero / welcome ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2rem; align-items: center; padding: 1rem 0 1.5rem; }
.hero h1 { font-size: 2.1rem; letter-spacing: -.025em; }
.hero p.lead { font-size: 1.06rem; margin-top: .7rem; color: var(--body); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 1.7rem; } }
.hero-art { width: 100%; max-width: 380px; justify-self: center; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 1.4rem 0 .6rem; }
.flow { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.flow .step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .35rem .6rem; font-size: .82rem; font-weight: 600; color: var(--ink); }
.flow .arr { color: var(--muted); }
.banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); padding: .45rem 1rem; text-align: center; font-size: .85rem; }
.footer { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1rem 3rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }
@media (max-width: 480px) {
  .hide-xs { display: none; }
  .chip-btn { padding: .28rem .55rem; }
  .brand > span { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar-inner { gap: .45rem; padding: .5rem .75rem; }
  .brand small, .back-link { display: none; }
  .hide-sm { display: none !important; }
  main { padding: 1rem .75rem 5rem; }
  .card { padding: .85rem .85rem; }
  h1 { font-size: 1.35rem; }
}
