/* Contrakta demo
   Layout: app a due colonne — barra moduli scura a sinistra, area di lavoro a destra,
   pannello assistente che scorre da destra. Sotto 900px la barra diventa una riga in alto. */

:root {
  --bg: #F2F3F1;
  --surface: #FFFFFF;
  --surface-2: #F7F8F6;
  --line: #DFE2E0;
  --line-strong: #C6CBC8;
  --fg: #15181C;
  --fg-2: #474D55;
  --fg-3: #5E646C;
  --rail: #141A22;
  --rail-fg: #C3CBD6;
  --rail-hi: #222C3A;
  --accent: #D08A1E;          /* ambra "ciak" */
  --accent-ink: #1A1206;
  --accent-soft: #FBEFD9;
  --link: #1F4F8A;
  --focus: #2F6FD6;

  --ok-bg: #E1F2E8;  --ok-fg: #1B623E;
  --info-bg: #E2ECF8; --info-fg: #17457F;
  --warn-bg: #FCEFD6; --warn-fg: #714400;
  --bad-bg: #FAE2DE;  --bad-fg: #922A1C;
  --neutral-bg: #ECEEEC; --neutral-fg: #3E444B;

  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r-sm: 6px;
  --r: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 34, .06), 0 8px 24px rgba(20, 26, 34, .06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1318; --surface: #171C23; --surface-2: #1C222A; --line: #2A323C; --line-strong: #3A4450;
    --fg: #ECEFF2; --fg-2: #C2C9D1; --fg-3: #9AA3AE;
    --rail: #0A0D11; --rail-fg: #AEB8C4; --rail-hi: #1D2530;
    --accent: #E6A23C; --accent-ink: #1A1206; --accent-soft: #3A2C12;
    --link: #8DB7F0; --focus: #7FB0FF;
    --ok-bg: #173627; --ok-fg: #8FD9AE;
    --info-bg: #182C46; --info-fg: #A9C9F2;
    --warn-bg: #3A2A0E; --warn-fg: #F2C779;
    --bad-bg: #42201B; --bad-fg: #F4ADA2;
    --neutral-bg: #232A33; --neutral-fg: #C2C9D1;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1318; --surface: #171C23; --surface-2: #1C222A; --line: #2A323C; --line-strong: #3A4450;
  --fg: #ECEFF2; --fg-2: #C2C9D1; --fg-3: #9AA3AE;
  --rail: #0A0D11; --rail-fg: #AEB8C4; --rail-hi: #1D2530;
  --accent: #E6A23C; --accent-ink: #1A1206; --accent-soft: #3A2C12;
  --link: #8DB7F0; --focus: #7FB0FF;
  --ok-bg: #173627; --ok-fg: #8FD9AE;
  --info-bg: #182C46; --info-fg: #A9C9F2;
  --warn-bg: #3A2A0E; --warn-fg: #F2C779;
  --bad-bg: #42201B; --bad-fg: #F4ADA2;
  --neutral-bg: #232A33; --neutral-fg: #C2C9D1;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 700; font-stretch: 88%; }
h2 { font-size: 19px; font-weight: 650; font-stretch: 92%; }
h3 { font-size: 16px; font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--fg-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.rail {
  flex: 0 0 248px;
  background: var(--rail);
  color: var(--rail-fg);
  display: flex; flex-direction: column; gap: 24px;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #FFFFFF; text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 18px;
  /* il ciak: banda a strisce in alto */
  background-image: repeating-linear-gradient(-45deg, var(--accent-ink) 0 4px, transparent 4px 8px);
  background-size: 100% 8px; background-repeat: no-repeat; background-color: var(--accent);
  padding-top: 6px;
}
.brand-name { font-family: var(--font-display); font-weight: 750; font-size: 21px; font-stretch: 90%; letter-spacing: -0.01em; }
.rail-group { display: flex; flex-direction: column; gap: 2px; }
.rail-label { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #8892A0; padding: 0 12px 6px; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 42px; padding: 0 12px; border-radius: 8px;
  color: var(--rail-fg); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--rail-hi); color: #FFFFFF; }
.nav-link[aria-current="page"] { background: var(--rail-hi); color: #FFFFFF; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-link .ico { display: inline-flex; align-items: center; gap: 10px; }
.plan-tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: #2E3A4B; color: #E3E8EF; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.theme-switch { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: #1B222C; }
.theme-switch button {
  flex: 1; min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--rail-fg);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.theme-switch button[aria-pressed="true"] { background: #2E3A4B; color: #FFFFFF; }
.rail-note { font-size: 12px; line-height: 1.45; color: #8892A0; padding: 0 8px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 14px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
}
.search { flex: 1 1 280px; max-width: 520px; position: relative; }
.search input {
  width: 100%; min-height: 42px; padding: 0 14px 0 38px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
}
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-3); }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.view {
  padding-block: 28px 56px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 24px;
  max-width: 1480px; width: 100%;
}
.view-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.view-head .eyebrow { font-size: 13px; color: var(--fg-3); }
.view-head p { margin: 6px 0 0; color: var(--fg-2); max-width: 70ch; }

/* ---------- Componenti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--fg); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--fg-3); }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { opacity: .9; }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px 20px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok-fg); }
.chip-info { background: var(--info-bg); color: var(--info-fg); }
.chip-warn { background: var(--warn-bg); color: var(--warn-fg); }
.chip-bad { background: var(--bad-bg); color: var(--bad-fg); }
.chip-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.chip-strong { background: var(--fg); color: var(--bg); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 13px; color: var(--fg-3); }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; font-stretch: 85%; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value.bad { color: var(--bad-fg); }
.kpi-sub { font-size: 13px; color: var(--fg-3); }
.bar { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.grid-2 { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grid-2 > .wide { flex: 999 1 560px; min-width: 0; }
.grid-2 > .side { flex: 1 1 380px; min-width: 0; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:first-child td { border-top: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
table.data td:first-child, table.data th:first-child { padding-left: 20px; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 13px; color: var(--fg-3); }

.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { min-height: 42px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--fg-3); font-size: 14px; font-weight: 500; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); font-weight: 600; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 20px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.date-box { flex: 0 0 56px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 0; background: var(--surface-2); }
.date-box .d { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1; }
.date-box .m { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); }

.issue { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.issue .ref { font-size: 12.5px; color: var(--fg-3); }
.issue-list { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field input, .field select, .field textarea {
  min-height: 42px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--fg); font-weight: 400; font-size: 14px;
}
.field textarea { padding: 10px 12px; min-height: 120px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--fg); min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Drawer contratto ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 13, 17, .45); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 31;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 20px; }
.icon-btn { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--fg); flex: 0 0 auto; }
.rule-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.rule-row:first-child { border-top: 0; }
.rule-dot { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 1px; }
.rule-dot.ok { background: var(--ok-bg); color: var(--ok-fg); }
.rule-dot.ko { background: var(--bad-bg); color: var(--bad-fg); }
.sources { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--neutral-bg); color: var(--neutral-fg); }
.step.done .n { background: var(--ok-bg); color: var(--ok-fg); }

/* ---------- Documento ---------- */
.drawer-doc { width: min(860px, 100%); }
.doc-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.doc-body { background: var(--surface-2); }
.paper {
  --paper: #FFFFFF; --ink: #1B1B1B; --ink-2: #555555;
  background: var(--paper); color: var(--ink); max-width: 720px; width: 100%; margin: 0 auto;
  padding: 48px 56px; border: 1px solid var(--line); box-shadow: var(--shadow);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.65;
}
.paper p { margin: 0 0 10px; text-align: justify; hyphens: auto; }
.paper-title { text-align: center; font-weight: 700; font-size: 18px; letter-spacing: .04em; }
.paper-sub { text-align: center; font-size: 13px; color: var(--ink-2); margin-bottom: 26px; }
.paper .art { padding: 8px 10px; margin: 0 -10px 6px; border-radius: 6px; }
.paper .art h4 { margin: 4px 0 4px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.paper .art.linked { background: #EEF4FB; }
.paper .art.missing { background: #FBE7E3; outline: 1px dashed #C0392B; }
.paper .art.st-documentato { background: #EEF4FB; }
.paper .art.st-interpretato { background: #FCF1DA; }
.paper .art.st-mancante { background: #FBE7E3; }
.paper .art.missing p { color: #8E2418; }
.paper .art .btn { margin-top: 4px; background: #FFFFFF; color: #15181C; border-color: #C6CBC8; }
.art-tag { font-family: var(--font-body); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #FFFFFF; color: #3E444B; border: 1px solid #D6DAD8; }
.paper-sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 36px 0 20px; }
.paper-sign div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; color: var(--ink-2); }
.paper-note { font-size: 12px !important; color: var(--ink-2); font-style: italic; border-top: 1px solid #DDDDDD; padding-top: 10px; margin-top: 18px !important; }
@media (max-width: 640px) { .paper { padding: 28px 20px; } .paper-sign { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Diritti ---------- */
.doc {
  font-family: "Source Serif 4", Georgia, serif; font-size: 15.5px; line-height: 1.7; color: var(--fg);
  display: flex; flex-direction: column; gap: 14px;
}
.doc p { margin: 0; }
.doc mark { color: inherit; padding: 1px 3px; border-radius: 3px; }
.doc mark.documentato { background: var(--info-bg); }
.doc mark.interpretato { background: var(--warn-bg); }
.doc mark.mancante { background: var(--bad-bg); }
.doc mark.flash { outline: 2px solid var(--accent); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); align-items: start; font-size: 14px; }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--fg-3); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kv .v { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv .v .note { font-size: 12.5px; color: var(--fg-3); }
.src-btn { border: 0; background: none; padding: 0; cursor: pointer; }
.callout { border-radius: var(--r); padding: 14px 16px; font-size: 14px; line-height: 1.5; background: var(--warn-bg); color: var(--warn-fg); }
.callout strong { color: inherit; }

/* ---------- Catalogo ---------- */
.matrix td, .matrix th { text-align: center; padding: 8px 6px !important; }
.matrix td:first-child, .matrix th:first-child { text-align: left; padding-left: 20px !important; }
.cell-tag { display: inline-block; min-width: 78px; padding: 6px 4px; border-radius: 7px; font-size: 12px; font-weight: 600; line-height: 1.25; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.result { border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.result.libero, .result.compatibile { background: var(--ok-bg); color: var(--ok-fg); }
.result.conflitto { background: var(--bad-bg); color: var(--bad-fg); }
.result.verificare { background: var(--warn-bg); color: var(--warn-fg); }

/* ---------- Norme / Archivio ---------- */
.rule-card { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-top: 1px solid var(--line); }
.rule-card:first-child { border-top: 0; }
.audit { font-size: 13.5px; }
.audit .list-item { padding: 10px 20px; }

/* ---------- Assistente ---------- */
.assistant {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 40;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.assistant-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.assistant-mode { font-size: 12px; }
.chat { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--fg); color: var(--bg); 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; }
.msg.bot .cite { font-family: var(--font-mono); font-size: 12px; background: var(--info-bg); color: var(--info-fg); padding: 0 5px; border-radius: 4px; white-space: nowrap; }
.msg.bot .tag-doc { color: var(--info-fg); font-weight: 600; }
.msg.bot .tag-int { color: var(--warn-fg); font-weight: 600; }
.msg.bot .tag-man { color: var(--bad-fg); font-weight: 600; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 10px; }
.suggest button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; color: var(--fg-2); }
.composer { display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.fab {
  position: fixed; right: max(20px, calc(env(safe-area-inset-right, 0px) + 16px)); bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  z-index: 20; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow);
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 16px)); z-index: 60;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
}
.empty { padding: 28px 20px; text-align: center; color: var(--fg-3); }
.demo-banner { font-size: 12.5px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--fg-2); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .rail {
    position: static; height: auto; flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px;
    padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .rail-group { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .rail-label, .rail-note { display: none; }
  .rail-foot { margin-top: 0; width: 100%; }
  .nav-link { min-height: 38px; }
  .nav-link .plan-tag { display: none; }
  .topbar { position: static; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: no-preference) {
  .drawer, .assistant { animation: slide-in .18s ease-out; }
  @keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
