/* ═══════════════════════════════════════════════════════════════════════
   Precedens — spatial workspace design system (single source of truth)
   Identity: layered graphite, cool light, and the original brass seal.
   Témy: light (default) / dark cez [data-theme="dark"] na <html>.
   Papier (rozsudky, editor) ostáva svetlý v OBOCH témach — PDF/Word parita.
   Type: native sans-serif UI; Source Serif 4 brand; Times New Roman documents.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Fonty (OFL, self-hosted — žiadne CDN) ──────────────────────────────── */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/vendor/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/vendor/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/vendor/sserif-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Source Serif 4'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/vendor/sserif-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+A720-A7FF;
}

/* ── Tokeny: SVETLÁ téma (default) ──────────────────────────────────────── */
:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --surface-2: #e9edf2;
  --line: rgba(25, 40, 60, .10);
  --ink: #182330;
  --muted: #586777;
  --accent: #35617e;
  --accent-strong: #213e53;
  --accent-hover: #31576f;
  --accent-ink: #ffffff;
  --brass: #b48a3c;
  --brass-ink: #80612b;
  --focus: #477fa2;
  --quiet-hover: #e3e9ef;
  --navy: #0e1b3d; --navy-2: #14254f;
  /* topbar drží tmavú identitu v OBOCH témach — tokeny sú preto spoločné */
  --topbar-ink: #ffffff;
  --topbar-muted: #c1cad7;
  --topbar-line: #39455e;
  --topbar-hover: rgba(255,255,255,.14);

  --good: #0e7a6c;  --good-bg: #e4f5f1;
  --bad: #b42318;   --bad-bg: #fdeceb;
  --warn: #855800;  --warn-bg: #fbf3d9;
  --info: #1e4fd8;  --info-bg: #e8eefc;
  --neutral: #475569; --neutral-bg: #eceef2;

  --paper: #ffffff;            /* dokumenty a editor — VŽDY svetlé */
  --paper-ink: #111111;
  --mark-bg: #fef08a;

  --law-chg-modified: #cfc;
  --law-chg-future: #f5deb3;
  --law-chg-deleted: #fdc6c6;
  --law-diff-added: #e6ffe6;
  --law-diff-removed: #ffe6e6;

  --shadow-sm: 0 2px 4px rgba(20,35,50,.03), 0 8px 24px rgba(20,35,50,.04);
  --shadow-md: 0 12px 48px rgba(20,35,50,.08);
  --shadow-pop: 0 24px 80px rgba(20,35,50,.18);
  --radius: 16px; --radius-sm: 8px;
  --panel-bg: #edf0f4;
  --glass: rgba(255,255,255,.88);
  --chrome: rgba(243,245,247,.90);
  --edge: rgba(255,255,255,.90);
  --control-line: #8292a2;
  --ambient: rgba(97,149,180,.12);
  --focus-halo: rgba(68,129,164,.12);
  --selected-bg: #dde7ee;
  --selected-ink: #244b65;

  --font-ui: 'Avenir Next', 'Segoe UI Variable Text', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Source Serif 4', 'Iowan Old Style', Palatino, Georgia, serif;
  --font-doc: 'Times New Roman', 'Source Serif 4', Georgia, serif;
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px;
  --fs-17: 17px; --fs-20: 20px; --fs-24: 24px;
  --topbar-h: 64px; --footer-h: 54px; --footer-min-h: 54px;
  --sidebar-w: 216px; --rail-w: 272px; --workspace-gap: 28px;
  --zone-head-h: 88px;
}

/* ── Tokeny: TMAVÁ téma (teplý ink-navy, nie čierna) ────────────────────── */
[data-theme="dark"] {
  --bg: #0a0e14;
  --card: #151b24;
  --surface-2: #1a232e;
  --line: rgba(214,230,249,.075);
  --ink: #ebf0f5;
  --muted: #9ba9b8;
  --accent: #a7cadf;
  --accent-strong: #d5e6ef;
  --accent-hover: #edf5fa;
  --accent-ink: #142736;
  --brass: #cfa75f;
  --brass-ink: #d9b775;
  --focus: #88b6d2;
  --quiet-hover: #1d2835;
  --panel-bg: #10151d;
  --glass: rgba(21,28,38,.90);
  --chrome: rgba(12,17,24,.90);
  --edge: rgba(230,241,255,.09);
  --control-line: #61758a;
  --ambient: rgba(72,117,155,.14);
  --focus-halo: rgba(112,173,212,.10);
  --selected-bg: #223240;
  --selected-ink: #d5e9f6;

  --good: #4fd1b2;  --good-bg: rgba(79,209,178,.13);
  --bad: #ff9184;   --bad-bg: rgba(255,145,132,.13);
  --warn: #e7c35f;  --warn-bg: rgba(231,195,95,.13);
  --info: #8aabff;  --info-bg: rgba(138,171,255,.13);
  --neutral: #aeb6c6; --neutral-bg: rgba(174,182,198,.14);

  --paper: #fdfcf8;            /* papier ostáva svetlý */
  --paper-ink: #141414;
  --mark-bg: #55492a;

  --law-chg-modified: rgba(120, 200, 120, .35);
  --law-chg-future: rgba(220, 180, 100, .35);
  --law-chg-deleted: rgba(220, 120, 120, .35);
  --law-diff-added: rgba(100, 200, 100, .28);
  --law-diff-removed: rgba(220, 100, 100, .28);

  --shadow-sm: 0 2px 5px rgba(0,0,0,.16), 0 8px 24px rgba(0,0,0,.12);
  --shadow-md: 0 18px 60px rgba(0,0,0,.28);
  --shadow-pop: 0 24px 90px rgba(0,0,0,.48);
}

/* Continuous palette endpoints. Colour interpolation never touches document paper. */
html {
  /* aurora */
  --aurora-bg: #eef6f6;
  --aurora-card: #ffffff;
  --aurora-panel-bg: #e8f2f1;
  --aurora-surface-2: #e0eeec;
  --aurora-accent-strong: #166153;
  --aurora-accent-hover: #1b7161;
  --aurora-selected-bg: #d5eae5;
  --aurora-selected-ink: #185748;
  --aurora-tone-1: #10b981;
  --aurora-tone-2: #06b6d4;
  --aurora-tone-3: #6366f1;
  /* sunset */
  --sunset-bg: #fbf1ed;
  --sunset-card: #ffffff;
  --sunset-panel-bg: #f5e9e5;
  --sunset-surface-2: #efdfda;
  --sunset-accent-strong: #923623;
  --sunset-accent-hover: #a43f2c;
  --sunset-selected-bg: #f3ddd1;
  --sunset-selected-ink: #7d3425;
  --sunset-tone-1: #ff512f;
  --sunset-tone-2: #f09819;
  --sunset-tone-3: #8a2387;
  /* void */
  --void-bg: #f2f0fa;
  --void-card: #ffffff;
  --void-panel-bg: #eae7f5;
  --void-surface-2: #e3dff0;
  --void-accent-strong: #4f3d91;
  --void-accent-hover: #604cab;
  --void-selected-bg: #e2dcf4;
  --void-selected-ink: #4d3984;
  --void-tone-1: #38bdf8;
  --void-tone-2: #6366f1;
  --void-tone-3: #a855f7;
  /* chroma */
  --chroma-bg: #f2f5fd;
  --chroma-card: #ffffff;
  --chroma-panel-bg: #e9eef9;
  --chroma-surface-2: #e1e8f6;
  --chroma-accent-strong: #435290;
  --chroma-accent-hover: #5162a3;
  --chroma-selected-bg: #dce5f7;
  --chroma-selected-ink: #3b4b85;
  --chroma-tone-1: #90b9ed;
  --chroma-tone-2: #e0f2fe;
  --chroma-tone-3: #bda6ef;
}
html[data-theme="dark"] {
  /* aurora */
  --aurora-bg: #080f13;
  --aurora-card: #111c24;
  --aurora-panel-bg: #0d171e;
  --aurora-surface-2: #1b2b33;
  --aurora-accent-strong: #87dec9;
  --aurora-accent-hover: #a6eddc;
  --aurora-selected-bg: #1c3b3b;
  --aurora-selected-ink: #c1f1e5;
  --aurora-tone-1: #10b981;
  --aurora-tone-2: #06b6d4;
  --aurora-tone-3: #6366f1;
  /* sunset */
  --sunset-bg: #130d12;
  --sunset-card: #21171e;
  --sunset-panel-bg: #1b121a;
  --sunset-surface-2: #30222a;
  --sunset-accent-strong: #ffb994;
  --sunset-accent-hover: #ffd1b9;
  --sunset-selected-bg: #492c31;
  --sunset-selected-ink: #ffd9c6;
  --sunset-tone-1: #ff512f;
  --sunset-tone-2: #f09819;
  --sunset-tone-3: #8a2387;
  /* void */
  --void-bg: #0a0b17;
  --void-card: #161525;
  --void-panel-bg: #11111f;
  --void-surface-2: #242139;
  --void-accent-strong: #c7b5ff;
  --void-accent-hover: #e0d5ff;
  --void-selected-bg: #302647;
  --void-selected-ink: #e4d9ff;
  --void-tone-1: #38bdf8;
  --void-tone-2: #6366f1;
  --void-tone-3: #a855f7;
  /* chroma */
  --chroma-bg: #0c101b;
  --chroma-card: #171d2c;
  --chroma-panel-bg: #121827;
  --chroma-surface-2: #222c41;
  --chroma-accent-strong: #b8d5fc;
  --chroma-accent-hover: #d5e6ff;
  --chroma-selected-bg: #283851;
  --chroma-selected-ink: #dceaff;
  --chroma-tone-1: #90b9ed;
  --chroma-tone-2: #e0f2fe;
  --chroma-tone-3: #bda6ef;
}
/* Expanded cool-to-warm stops. The four original endpoint tokens above stay intact. */
html {
  /* Azúr */
  --azur-bg: #eef6fb;
  --azur-card: #ffffff;
  --azur-panel-bg: #e6f1f8;
  --azur-surface-2: #dcebf5;
  --azur-accent-strong: #155f86;
  --azur-accent-hover: #1b6d98;
  --azur-selected-bg: #d2e9f5;
  --azur-selected-ink: #164d6c;
  --azur-tone-1: #22d3ee;
  --azur-tone-2: #38bdf8;
  --azur-tone-3: #3b82f6;
  /* Indigo */
  --indigo-bg: #f2f2fc;
  --indigo-card: #ffffff;
  --indigo-panel-bg: #eaeafb;
  --indigo-surface-2: #e1e3f5;
  --indigo-accent-strong: #484398;
  --indigo-accent-hover: #5751ac;
  --indigo-selected-bg: #dfdff9;
  --indigo-selected-ink: #403980;
  --indigo-tone-1: #6366f1;
  --indigo-tone-2: #818cf8;
  --indigo-tone-3: #8b5cf6;
  /* Magenta */
  --magenta-bg: #faf0fa;
  --magenta-card: #ffffff;
  --magenta-panel-bg: #f4e7f5;
  --magenta-surface-2: #eedcef;
  --magenta-accent-strong: #852d86;
  --magenta-accent-hover: #943994;
  --magenta-selected-bg: #efd5ed;
  --magenta-selected-ink: #71296f;
  --magenta-tone-1: #d946ef;
  --magenta-tone-2: #e879f9;
  --magenta-tone-3: #f472b6;
  /* Ružová */
  --ruzova-bg: #fbf1f6;
  --ruzova-card: #ffffff;
  --ruzova-panel-bg: #f5e7ee;
  --ruzova-surface-2: #efdee7;
  --ruzova-accent-strong: #953b68;
  --ruzova-accent-hover: #a14372;
  --ruzova-selected-bg: #f1d9e5;
  --ruzova-selected-ink: #7c3258;
  --ruzova-tone-1: #ec4899;
  --ruzova-tone-2: #f472b6;
  --ruzova-tone-3: #c084fc;
  /* Koral */
  --koral-bg: #fbf1f1;
  --koral-card: #ffffff;
  --koral-panel-bg: #f7e7e8;
  --koral-surface-2: #efdcdc;
  --koral-accent-strong: #983e42;
  --koral-accent-hover: #a44246;
  --koral-selected-bg: #f4d8d7;
  --koral-selected-ink: #80363b;
  --koral-tone-1: #fb7185;
  --koral-tone-2: #f97373;
  --koral-tone-3: #fb923c;
  /* Marhuľa */
  --marhula-bg: #fbf4ec;
  --marhula-card: #ffffff;
  --marhula-panel-bg: #f6ecdf;
  --marhula-surface-2: #efe1d2;
  --marhula-accent-strong: #855020;
  --marhula-accent-hover: #955d29;
  --marhula-selected-bg: #f3dfc5;
  --marhula-selected-ink: #6f431d;
  --marhula-tone-1: #fb923c;
  --marhula-tone-2: #fbbf24;
  --marhula-tone-3: #fb7185;
}
html[data-theme="dark"] {
  /* Azúr */
  --azur-bg: #080f18;
  --azur-card: #101d2b;
  --azur-panel-bg: #0c1723;
  --azur-surface-2: #192e40;
  --azur-accent-strong: #85d9f5;
  --azur-accent-hover: #b0eaff;
  --azur-selected-bg: #183b4b;
  --azur-selected-ink: #c7efff;
  /* Indigo */
  --indigo-bg: #0d0d1c;
  --indigo-card: #18182e;
  --indigo-panel-bg: #121225;
  --indigo-surface-2: #252544;
  --indigo-accent-strong: #b8b6ff;
  --indigo-accent-hover: #d5d3ff;
  --indigo-selected-bg: #2e2c53;
  --indigo-selected-ink: #e1dfff;
  /* Magenta */
  --magenta-bg: #140b19;
  --magenta-card: #24182c;
  --magenta-panel-bg: #1c1124;
  --magenta-surface-2: #35223e;
  --magenta-accent-strong: #e5a8ef;
  --magenta-accent-hover: #f3c9f9;
  --magenta-selected-bg: #48274d;
  --magenta-selected-ink: #f6d8fa;
  /* Ružová */
  --ruzova-bg: #150d16;
  --ruzova-card: #251924;
  --ruzova-panel-bg: #1d121d;
  --ruzova-surface-2: #352331;
  --ruzova-accent-strong: #f4b0cf;
  --ruzova-accent-hover: #ffd0e4;
  --ruzova-selected-bg: #482c3e;
  --ruzova-selected-ink: #ffdaeb;
  /* Koral */
  --koral-bg: #160d12;
  --koral-card: #27191f;
  --koral-panel-bg: #201218;
  --koral-surface-2: #38232a;
  --koral-accent-strong: #ffaeb3;
  --koral-accent-hover: #ffcbd0;
  --koral-selected-bg: #4b2b34;
  --koral-selected-ink: #ffdade;
  /* Marhuľa */
  --marhula-bg: #140f0d;
  --marhula-card: #231d18;
  --marhula-panel-bg: #1c1712;
  --marhula-surface-2: #342a21;
  --marhula-accent-strong: #f4c38f;
  --marhula-accent-hover: #ffdcac;
  --marhula-selected-bg: #453325;
  --marhula-selected-ink: #ffe2bb;
}
html[data-palette-from="azur"] {
  --from-bg: var(--azur-bg);
  --from-card: var(--azur-card);
  --from-panel-bg: var(--azur-panel-bg);
  --from-surface-2: var(--azur-surface-2);
  --from-accent-strong: var(--azur-accent-strong);
  --from-accent-hover: var(--azur-accent-hover);
  --from-selected-bg: var(--azur-selected-bg);
  --from-selected-ink: var(--azur-selected-ink);
  --from-tone-1: var(--azur-tone-1);
  --from-tone-2: var(--azur-tone-2);
  --from-tone-3: var(--azur-tone-3);
}
html[data-palette-from="indigo"] {
  --from-bg: var(--indigo-bg);
  --from-card: var(--indigo-card);
  --from-panel-bg: var(--indigo-panel-bg);
  --from-surface-2: var(--indigo-surface-2);
  --from-accent-strong: var(--indigo-accent-strong);
  --from-accent-hover: var(--indigo-accent-hover);
  --from-selected-bg: var(--indigo-selected-bg);
  --from-selected-ink: var(--indigo-selected-ink);
  --from-tone-1: var(--indigo-tone-1);
  --from-tone-2: var(--indigo-tone-2);
  --from-tone-3: var(--indigo-tone-3);
}
html[data-palette-from="magenta"] {
  --from-bg: var(--magenta-bg);
  --from-card: var(--magenta-card);
  --from-panel-bg: var(--magenta-panel-bg);
  --from-surface-2: var(--magenta-surface-2);
  --from-accent-strong: var(--magenta-accent-strong);
  --from-accent-hover: var(--magenta-accent-hover);
  --from-selected-bg: var(--magenta-selected-bg);
  --from-selected-ink: var(--magenta-selected-ink);
  --from-tone-1: var(--magenta-tone-1);
  --from-tone-2: var(--magenta-tone-2);
  --from-tone-3: var(--magenta-tone-3);
}
html[data-palette-from="ruzova"] {
  --from-bg: var(--ruzova-bg);
  --from-card: var(--ruzova-card);
  --from-panel-bg: var(--ruzova-panel-bg);
  --from-surface-2: var(--ruzova-surface-2);
  --from-accent-strong: var(--ruzova-accent-strong);
  --from-accent-hover: var(--ruzova-accent-hover);
  --from-selected-bg: var(--ruzova-selected-bg);
  --from-selected-ink: var(--ruzova-selected-ink);
  --from-tone-1: var(--ruzova-tone-1);
  --from-tone-2: var(--ruzova-tone-2);
  --from-tone-3: var(--ruzova-tone-3);
}
html[data-palette-from="koral"] {
  --from-bg: var(--koral-bg);
  --from-card: var(--koral-card);
  --from-panel-bg: var(--koral-panel-bg);
  --from-surface-2: var(--koral-surface-2);
  --from-accent-strong: var(--koral-accent-strong);
  --from-accent-hover: var(--koral-accent-hover);
  --from-selected-bg: var(--koral-selected-bg);
  --from-selected-ink: var(--koral-selected-ink);
  --from-tone-1: var(--koral-tone-1);
  --from-tone-2: var(--koral-tone-2);
  --from-tone-3: var(--koral-tone-3);
}
html[data-palette-from="marhula"] {
  --from-bg: var(--marhula-bg);
  --from-card: var(--marhula-card);
  --from-panel-bg: var(--marhula-panel-bg);
  --from-surface-2: var(--marhula-surface-2);
  --from-accent-strong: var(--marhula-accent-strong);
  --from-accent-hover: var(--marhula-accent-hover);
  --from-selected-bg: var(--marhula-selected-bg);
  --from-selected-ink: var(--marhula-selected-ink);
  --from-tone-1: var(--marhula-tone-1);
  --from-tone-2: var(--marhula-tone-2);
  --from-tone-3: var(--marhula-tone-3);
}
html[data-palette-to="azur"] {
  --to-bg: var(--azur-bg);
  --to-card: var(--azur-card);
  --to-panel-bg: var(--azur-panel-bg);
  --to-surface-2: var(--azur-surface-2);
  --to-accent-strong: var(--azur-accent-strong);
  --to-accent-hover: var(--azur-accent-hover);
  --to-selected-bg: var(--azur-selected-bg);
  --to-selected-ink: var(--azur-selected-ink);
  --to-tone-1: var(--azur-tone-1);
  --to-tone-2: var(--azur-tone-2);
  --to-tone-3: var(--azur-tone-3);
}
html[data-palette-to="indigo"] {
  --to-bg: var(--indigo-bg);
  --to-card: var(--indigo-card);
  --to-panel-bg: var(--indigo-panel-bg);
  --to-surface-2: var(--indigo-surface-2);
  --to-accent-strong: var(--indigo-accent-strong);
  --to-accent-hover: var(--indigo-accent-hover);
  --to-selected-bg: var(--indigo-selected-bg);
  --to-selected-ink: var(--indigo-selected-ink);
  --to-tone-1: var(--indigo-tone-1);
  --to-tone-2: var(--indigo-tone-2);
  --to-tone-3: var(--indigo-tone-3);
}
html[data-palette-to="magenta"] {
  --to-bg: var(--magenta-bg);
  --to-card: var(--magenta-card);
  --to-panel-bg: var(--magenta-panel-bg);
  --to-surface-2: var(--magenta-surface-2);
  --to-accent-strong: var(--magenta-accent-strong);
  --to-accent-hover: var(--magenta-accent-hover);
  --to-selected-bg: var(--magenta-selected-bg);
  --to-selected-ink: var(--magenta-selected-ink);
  --to-tone-1: var(--magenta-tone-1);
  --to-tone-2: var(--magenta-tone-2);
  --to-tone-3: var(--magenta-tone-3);
}
html[data-palette-to="ruzova"] {
  --to-bg: var(--ruzova-bg);
  --to-card: var(--ruzova-card);
  --to-panel-bg: var(--ruzova-panel-bg);
  --to-surface-2: var(--ruzova-surface-2);
  --to-accent-strong: var(--ruzova-accent-strong);
  --to-accent-hover: var(--ruzova-accent-hover);
  --to-selected-bg: var(--ruzova-selected-bg);
  --to-selected-ink: var(--ruzova-selected-ink);
  --to-tone-1: var(--ruzova-tone-1);
  --to-tone-2: var(--ruzova-tone-2);
  --to-tone-3: var(--ruzova-tone-3);
}
html[data-palette-to="koral"] {
  --to-bg: var(--koral-bg);
  --to-card: var(--koral-card);
  --to-panel-bg: var(--koral-panel-bg);
  --to-surface-2: var(--koral-surface-2);
  --to-accent-strong: var(--koral-accent-strong);
  --to-accent-hover: var(--koral-accent-hover);
  --to-selected-bg: var(--koral-selected-bg);
  --to-selected-ink: var(--koral-selected-ink);
  --to-tone-1: var(--koral-tone-1);
  --to-tone-2: var(--koral-tone-2);
  --to-tone-3: var(--koral-tone-3);
}
html[data-palette-to="marhula"] {
  --to-bg: var(--marhula-bg);
  --to-card: var(--marhula-card);
  --to-panel-bg: var(--marhula-panel-bg);
  --to-surface-2: var(--marhula-surface-2);
  --to-accent-strong: var(--marhula-accent-strong);
  --to-accent-hover: var(--marhula-accent-hover);
  --to-selected-bg: var(--marhula-selected-bg);
  --to-selected-ink: var(--marhula-selected-ink);
  --to-tone-1: var(--marhula-tone-1);
  --to-tone-2: var(--marhula-tone-2);
  --to-tone-3: var(--marhula-tone-3);
}
html[data-palette-from="aurora"] {
  --from-bg: var(--aurora-bg);
  --from-card: var(--aurora-card);
  --from-panel-bg: var(--aurora-panel-bg);
  --from-surface-2: var(--aurora-surface-2);
  --from-accent-strong: var(--aurora-accent-strong);
  --from-accent-hover: var(--aurora-accent-hover);
  --from-selected-bg: var(--aurora-selected-bg);
  --from-selected-ink: var(--aurora-selected-ink);
  --from-tone-1: var(--aurora-tone-1);
  --from-tone-2: var(--aurora-tone-2);
  --from-tone-3: var(--aurora-tone-3);
}
html[data-palette-from="sunset"] {
  --from-bg: var(--sunset-bg);
  --from-card: var(--sunset-card);
  --from-panel-bg: var(--sunset-panel-bg);
  --from-surface-2: var(--sunset-surface-2);
  --from-accent-strong: var(--sunset-accent-strong);
  --from-accent-hover: var(--sunset-accent-hover);
  --from-selected-bg: var(--sunset-selected-bg);
  --from-selected-ink: var(--sunset-selected-ink);
  --from-tone-1: var(--sunset-tone-1);
  --from-tone-2: var(--sunset-tone-2);
  --from-tone-3: var(--sunset-tone-3);
}
html[data-palette-from="void"] {
  --from-bg: var(--void-bg);
  --from-card: var(--void-card);
  --from-panel-bg: var(--void-panel-bg);
  --from-surface-2: var(--void-surface-2);
  --from-accent-strong: var(--void-accent-strong);
  --from-accent-hover: var(--void-accent-hover);
  --from-selected-bg: var(--void-selected-bg);
  --from-selected-ink: var(--void-selected-ink);
  --from-tone-1: var(--void-tone-1);
  --from-tone-2: var(--void-tone-2);
  --from-tone-3: var(--void-tone-3);
}
html[data-palette-from="chroma"] {
  --from-bg: var(--chroma-bg);
  --from-card: var(--chroma-card);
  --from-panel-bg: var(--chroma-panel-bg);
  --from-surface-2: var(--chroma-surface-2);
  --from-accent-strong: var(--chroma-accent-strong);
  --from-accent-hover: var(--chroma-accent-hover);
  --from-selected-bg: var(--chroma-selected-bg);
  --from-selected-ink: var(--chroma-selected-ink);
  --from-tone-1: var(--chroma-tone-1);
  --from-tone-2: var(--chroma-tone-2);
  --from-tone-3: var(--chroma-tone-3);
}
html[data-palette-to="aurora"] {
  --to-bg: var(--aurora-bg);
  --to-card: var(--aurora-card);
  --to-panel-bg: var(--aurora-panel-bg);
  --to-surface-2: var(--aurora-surface-2);
  --to-accent-strong: var(--aurora-accent-strong);
  --to-accent-hover: var(--aurora-accent-hover);
  --to-selected-bg: var(--aurora-selected-bg);
  --to-selected-ink: var(--aurora-selected-ink);
  --to-tone-1: var(--aurora-tone-1);
  --to-tone-2: var(--aurora-tone-2);
  --to-tone-3: var(--aurora-tone-3);
}
html[data-palette-to="sunset"] {
  --to-bg: var(--sunset-bg);
  --to-card: var(--sunset-card);
  --to-panel-bg: var(--sunset-panel-bg);
  --to-surface-2: var(--sunset-surface-2);
  --to-accent-strong: var(--sunset-accent-strong);
  --to-accent-hover: var(--sunset-accent-hover);
  --to-selected-bg: var(--sunset-selected-bg);
  --to-selected-ink: var(--sunset-selected-ink);
  --to-tone-1: var(--sunset-tone-1);
  --to-tone-2: var(--sunset-tone-2);
  --to-tone-3: var(--sunset-tone-3);
}
html[data-palette-to="void"] {
  --to-bg: var(--void-bg);
  --to-card: var(--void-card);
  --to-panel-bg: var(--void-panel-bg);
  --to-surface-2: var(--void-surface-2);
  --to-accent-strong: var(--void-accent-strong);
  --to-accent-hover: var(--void-accent-hover);
  --to-selected-bg: var(--void-selected-bg);
  --to-selected-ink: var(--void-selected-ink);
  --to-tone-1: var(--void-tone-1);
  --to-tone-2: var(--void-tone-2);
  --to-tone-3: var(--void-tone-3);
}
html[data-palette-to="chroma"] {
  --to-bg: var(--chroma-bg);
  --to-card: var(--chroma-card);
  --to-panel-bg: var(--chroma-panel-bg);
  --to-surface-2: var(--chroma-surface-2);
  --to-accent-strong: var(--chroma-accent-strong);
  --to-accent-hover: var(--chroma-accent-hover);
  --to-selected-bg: var(--chroma-selected-bg);
  --to-selected-ink: var(--chroma-selected-ink);
  --to-tone-1: var(--chroma-tone-1);
  --to-tone-2: var(--chroma-tone-2);
  --to-tone-3: var(--chroma-tone-3);
}
:root {
  --palette-mix: 0%;
  --bg: color-mix(in srgb, var(--from-bg, var(--aurora-bg)) calc(100% - var(--palette-mix)), var(--to-bg, var(--sunset-bg)) var(--palette-mix));
  --card: color-mix(in srgb, var(--from-card, var(--aurora-card)) calc(100% - var(--palette-mix)), var(--to-card, var(--sunset-card)) var(--palette-mix));
  --panel-bg: color-mix(in srgb, var(--from-panel-bg, var(--aurora-panel-bg)) calc(100% - var(--palette-mix)), var(--to-panel-bg, var(--sunset-panel-bg)) var(--palette-mix));
  --surface-2: color-mix(in srgb, var(--from-surface-2, var(--aurora-surface-2)) calc(100% - var(--palette-mix)), var(--to-surface-2, var(--sunset-surface-2)) var(--palette-mix));
  --accent-strong: color-mix(in srgb, var(--from-accent-strong, var(--aurora-accent-strong)) calc(100% - var(--palette-mix)), var(--to-accent-strong, var(--sunset-accent-strong)) var(--palette-mix));
  --accent-hover: color-mix(in srgb, var(--from-accent-hover, var(--aurora-accent-hover)) calc(100% - var(--palette-mix)), var(--to-accent-hover, var(--sunset-accent-hover)) var(--palette-mix));
  --selected-bg: color-mix(in srgb, var(--from-selected-bg, var(--aurora-selected-bg)) calc(100% - var(--palette-mix)), var(--to-selected-bg, var(--sunset-selected-bg)) var(--palette-mix));
  --selected-ink: color-mix(in srgb, var(--from-selected-ink, var(--aurora-selected-ink)) calc(100% - var(--palette-mix)), var(--to-selected-ink, var(--sunset-selected-ink)) var(--palette-mix));
  /* Open dropdown options use a softer wash of the active action colour. */
  --select-hover-bg: color-mix(in srgb, var(--accent-strong) 85%, var(--card));
  --select-hover-ink: var(--accent-ink);
  --tone-1: color-mix(in srgb, var(--from-tone-1, var(--aurora-tone-1)) calc(100% - var(--palette-mix)), var(--to-tone-1, var(--sunset-tone-1)) var(--palette-mix));
  --tone-2: color-mix(in srgb, var(--from-tone-2, var(--aurora-tone-2)) calc(100% - var(--palette-mix)), var(--to-tone-2, var(--sunset-tone-2)) var(--palette-mix));
  --tone-3: color-mix(in srgb, var(--from-tone-3, var(--aurora-tone-3)) calc(100% - var(--palette-mix)), var(--to-tone-3, var(--sunset-tone-3)) var(--palette-mix));
  --ink: #192331; --muted: #465366; --accent: var(--accent-strong); --accent-ink: #ffffff;
  --focus: var(--accent-strong); --control-line: #7b8799;
  --quiet-hover: var(--surface-2);
  --glass: color-mix(in srgb, var(--card) 96%, transparent);
  --chrome: color-mix(in srgb, var(--bg) 94%, transparent);
  --ambient: color-mix(in srgb, var(--tone-1) 17%, transparent);
  --ambient-secondary: color-mix(in srgb, var(--tone-3) 15%, transparent);
  --focus-halo: color-mix(in srgb, var(--accent-strong) 14%, transparent);
  --input-gradient: radial-gradient(ellipse at 12% 0%, var(--ambient), transparent 68%), radial-gradient(ellipse at 100% 15%, var(--ambient-secondary), transparent 72%);
  /* Each swatch corresponds to one stop in PALETTE_IDS, at equal distances. */
  /* The same ten named palette stops as PALETTE_IDS, blended in a perceptual space. */
  --palette-spectrum: linear-gradient(180deg in oklab, #34d399 0%, #22d3ee 11.111%, #60a5fa 22.222%, #818cf8 33.333%, #a78bfa 44.444%, #e879f9 55.556%, #f472b6 66.667%, #fb7185 77.778%, #fca58d 88.889%, #fdba74 100%);
  --thumb-rim: #ffffff; --thumb-edge: #152034;
}
html[data-theme="dark"] {
  --ink: #edf1fa; --muted: #bdc7d8; --accent-ink: #111725; --control-line: #748198;
  --ambient: color-mix(in srgb, var(--tone-1) 18%, transparent);
  --ambient-secondary: color-mix(in srgb, var(--tone-3) 18%, transparent);
}

/* ── Základ ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-15)/1.55 var(--font-ui);
  font-variant-numeric: tabular-nums;   /* spisové značky, §, dátumy */
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--info-bg); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.ic { width: 1.05em; height: 1.05em; vertical-align: -.18em; flex: 0 0 auto; }

/* ── Topbar (navy konštanta značky v oboch témach) ──────────────────────── */
header.topbar {
  display: grid; grid-template-columns: 224px minmax(0,1fr) auto; align-items: center; gap: 18px;
  background: var(--navy); border-bottom: 2px solid var(--brass);
  padding: 0; min-height: 56px; color: #fff;
}
.topbar .brand {
  font: 600 var(--fs-20)/1 var(--font-serif); letter-spacing: 0;
  color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; padding: 7px 0 7px 14px;
}
.topbar .brand-logo { display: block; width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.cmdk-hint {
  display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16); color: #c7d2ec; border-radius: var(--radius-sm); padding: 6px 11px;
  width: 228px; justify-self: start; font-size: var(--fs-13); cursor: pointer; font-family: inherit;
}
.cmdk-hint:hover { color: #fff; }
.shortcut-keys { display: inline-flex; align-items: center; }
.shortcut-keycap { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 21px; height: 20px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); padding: 0 6px; color: var(--muted); font: 10px/1 var(--font-ui); box-shadow: 0 1px 0 var(--line); }
.cmdk-hint > kbd { margin-left: auto; border: 0; border-radius: 4px; background: rgba(255,255,255,.14); box-shadow: none; padding: 1px 7px; color: #dce4f8; font: 11px/1.4 var(--font-ui); }
.topbar .topmeta { display: flex; gap: 8px; align-items: center; padding-right: 18px; }
.top-action {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm); padding: 7px 10px; background: transparent; color: #fff;
  font: 500 var(--fs-13)/1 var(--font-ui); cursor: pointer;
}
.top-action:hover { background: rgba(255,255,255,.1); }
.theme-picker { position: relative; }
.theme-picker button { display: inline-grid; place-items: center; width: 32px; height: 30px; border: 0; background: transparent; color: #aab8dd; cursor: pointer; padding: 0; font-family: inherit; }
.theme-current { border: 1px solid rgba(255,255,255,.18) !important; border-radius: var(--radius-sm); }
.theme-picker button:hover { background: var(--topbar-hover); color: var(--topbar-ink); }
.theme-picker .ic { width: 15px; height: 15px; }
body.left-nav-collapsed header.topbar { grid-template-columns: 64px minmax(0,1fr) auto; }
body.left-nav-collapsed .topbar .brand { justify-content: center; }
body.left-nav-collapsed .topbar .brand { padding-left: 0; }
body.left-nav-collapsed .topbar .brand span { display: none; }
/* ── App shell ──────────────────────────────────────────────────────────── */
.shell {
  display: grid; grid-template-columns: 224px minmax(0,1fr); gap: 18px;
  min-height: calc(100vh - 56px); padding-left: 0;
  transition: grid-template-columns .18s ease;
}
.shell.left-collapsed { grid-template-columns: 64px minmax(0,1fr); }
.sidenav {
  background: var(--card); border: 1px solid var(--line); border-radius: 0 var(--radius) 0 0;
  padding: 12px; position: sticky; top: 0; align-self: start; margin-top: 0;
  height: calc(100vh - var(--topbar-h) - var(--footer-h)); min-height: 440px; overflow: visible;
  box-shadow: var(--shadow-sm);
}
.sidenav-top { display: flex; align-items: center; justify-content: flex-end; gap: 6px; height: 34px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.panel-collapse { display: inline-grid; place-items: center; width: 29px; height: 29px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--muted); cursor: pointer; padding: 0; line-height: 0; }
.panel-collapse::before, .panel-collapse::after { content: ""; position: absolute; top: calc(50% - .5px); width: 6px; height: 1px; background: var(--line); pointer-events: none; }
.panel-collapse::before { right: 100%; }
.panel-collapse::after { left: 100%; }
.panel-collapse:hover { border-color: var(--brass); color: var(--ink); }
.sidenav-collapse { position: absolute; top: 31px; right: -15px; z-index: 3; }
.sidenav-collapse .ic { transform: rotate(180deg); transition: transform .18s ease; }
.shell.left-collapsed .sidenav-collapse .ic { transform: none; }
.shell.left-collapsed .sidenav { padding-inline: 7px; overflow: visible; }
.shell.left-collapsed .sidenav-top { justify-content: center; padding-inline: 0; }
.shell.left-collapsed .sidenav .grp,
.shell.left-collapsed .sidenav .item span,
.shell.left-collapsed .current-matter { display: none; }
.shell.left-collapsed .sidenav .nav-section + .nav-section { margin-top: 10px; padding-top: 10px; }
/* Zmenšený stav: každá ikonka má rovnako veľké pozadie (aj tá v hornej lište) */
.shell.left-collapsed .sidenav .item {
  display: grid; place-items: center; width: 36px; height: 32px;
  padding: 0; margin: 5px auto; border-left-width: 1px;
}
.workspace-section { display: none; }
.shell.left-collapsed .workspace-section { display: block; width: 36px; }
.shell.left-collapsed .workspace-section .item { margin: 0; }
.sidenav .nav-section + .nav-section { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.sidenav .grp {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: uppercase;
  color: var(--muted); margin: 18px 8px 6px;
}
.sidenav .grp:first-child { margin-top: 2px; }
.sidenav .item {
  display: flex; gap: 9px; align-items: center; width: 100%; text-align: left;
  padding: 9px 11px; margin: 3px 0; border: 1px solid transparent; border-left: 3px solid transparent;
  border-radius: var(--radius-sm); font: 400 13.5px/1.4 var(--font-ui); cursor: pointer; color: var(--ink);
  background: transparent; transition: border-color .12s ease;
}
.sidenav .item:hover { background: var(--card); border-color: var(--line); border-left-color: var(--brass); }
.sidenav .item.on { background: var(--navy); border-color: var(--navy); border-left-color: var(--brass); color: #fff; }
.sidenav .item .ic { width: 17px; height: 17px; color: var(--muted); }
.sidenav .item.on .ic { color: var(--brass); }
.sidenav .item .assistant-mark { width: 20px; height: 20px; margin: -1.5px; object-fit: contain; }
.current-matter {
  display: flex; align-items: center; flex: 1; min-width: 0; height: 28px; margin: 0; padding: 2px 5px;
  text-align: left; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink); cursor: pointer; font-family: inherit;
}
.current-matter:hover { background: var(--surface-2); border-color: var(--line); }
.current-matter-copy { display: block; min-width: 0; }
.current-matter small { display: block; color: var(--muted); font-size: 8.5px; line-height: 1; text-transform: uppercase; }
.current-matter strong { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; line-height: 1.05; }
main.content { min-width: 0; max-width: none; margin: 0; padding: 0; }
.contentgrid {
  width: 100%; max-width: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 18px; align-items: start;
  transition: grid-template-columns .18s ease;
}
.workmain {
  min-width: 0; min-height: calc(100dvh - var(--topbar-h) - var(--footer-h)); padding-bottom: 48px;
  background: radial-gradient(ellipse 70% 420px at 50% 260px, var(--ambient), transparent 80%);
}
.mobile-nav { display: none; }
.workspace-head { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: end; min-height: 47px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; gap: 16px; }
/* AI upozornenie na linke strednej dlaždice — nesmie zvýšiť hlavičku, preto nezalamuje */
.workspace-disc {
  grid-column: 2; margin: 0; display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--warn); font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace-disc .ic { width: 14px; height: 14px; flex: 0 0 auto; }
.workspace-head > div:first-child { grid-column: 1; }
.workspace-head .eyebrow, .section-label { color: var(--muted); font-size: 10.5px; line-height: 1.2; font-weight: 650; text-transform: uppercase; }
.workspace-head h1 { margin: 0; font: 600 var(--fs-20)/1.2 var(--font-serif); }
/* justify-self: stretch — inak sa kontext roztiahne cez stĺpec a prekryje upozornenie */
.workspace-context { grid-column: 3; justify-self: stretch; display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; color: var(--muted); font-size: var(--fs-12); }
.workspace-context > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 170px; }
/* Právny stav k dátumu — kontext spisu/relácie, preto sedí v ľavom paneli
   pri výbere spisu, nie v hlavičke (tam už je centrované AI upozornenie). */
.asof-row { position: relative; margin: 10px 0 2px; }
/* bugfix-2: rozhodný dátum je kľúčový — výraznejší chip, prežije aj zbalenie */
.asof-chip {
  display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  color: var(--ink); padding: 9px 10px; cursor: pointer; font: 600 var(--fs-13)/1.2 var(--font-ui); text-align: left;
}
.asof-chip:hover { border-color: var(--brass); color: var(--ink); }
.asof-chip .ic { width: 16px; height: 16px; flex: 0 0 auto; color: var(--brass); }
.asof-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.asof-control { position: relative; width: 100%; }
.asof-control.has-custom-date .asof-chip { padding-right: 54px; }
.asof-today {
  position: absolute; top: 50%; right: 6px; z-index: 2; transform: translateY(-50%);
  min-height: 24px; padding: 4px 7px; border: 1px solid var(--edge); border-radius: 6px;
  background: var(--accent-strong); color: var(--accent-ink); font: 600 var(--fs-12)/1 var(--font-ui); cursor: pointer;
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
  opacity: 0; visibility: hidden; pointer-events: none;
}
.asof-control.has-custom-date:hover .asof-today { opacity: 1; visibility: visible; pointer-events: auto; }
.asof-today:hover { border-color: var(--edge); background: var(--accent-hover); color: var(--accent-ink); }
.asof-input, .asof-input + .legal-date { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.shell.left-collapsed .asof-row { width: 36px; margin: 10px auto 2px; }
.shell.left-collapsed .asof-chip { justify-content: center; padding: 8px 0; }
.shell.left-collapsed .asof-chip span { display: none; }
.shell.left-collapsed .asof-today { display: none; }
.mobile-asof-control { display: none; }

/* ── Príkazový riadok ───────────────────────────────────────────────────── */
/* bugfix-2: pole s otázkou odskrolovává s obsahom — sticky bránil čítaniu odpovede */
.cmdarea { background: var(--bg); padding: 2px 0 10px; }
.composer-modes { display: grid; grid-template-columns: repeat(3,1fr); align-items: center; width: 228px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 2px; margin-bottom: 8px; }
.composer-modes button { border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 6px 12px; font: 500 var(--fs-13)/1.2 var(--font-ui); cursor: pointer; }
.composer-modes button:hover { color: var(--ink); }
.composer-modes button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.cmdarea.stuck { box-shadow: 0 6px 14px -8px rgba(16,24,40,.28); border-bottom: 1px solid var(--line); }
[data-theme="dark"] .cmdarea.stuck { box-shadow: 0 6px 14px -8px rgba(0,0,0,.6); }
.searchbar { display: flex; align-items: flex-start; gap: 8px; }
.composer-field { flex: 1; min-width: 0; position: relative; }
.composer-field .composer-clear { position: absolute; top: 8px; right: 8px; background: var(--card); }
.composer-clear[hidden] { display: none; }
.composer-field textarea { padding-right: 52px; }
.composer-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; color: var(--muted); font-size: var(--fs-13); }
.composer-actions label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.composer-actions label:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.searchbar textarea {
  width: 100%; min-height: 48px; max-height: 50vh; padding: 12px 14px; font-size: 15px; line-height: 1.45; font-family: inherit; resize: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.searchbar textarea.document-mode { min-height: 48px; max-height: 50vh; }
.searchbar textarea::placeholder { color: var(--muted); }
.searchbar textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
button.go {
  padding: 12px 22px; font-size: var(--fs-15); font-weight: 500; font-family: inherit; border: 0;
  border-radius: var(--radius); background: var(--accent-strong); color: var(--accent-ink);
  cursor: pointer; letter-spacing: 0; box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .05s ease;
}
button.go:hover:not(:disabled) { background: var(--accent-hover); }
button.go:active:not(:disabled) { transform: translateY(1px); }
button.go:disabled { opacity: .5; cursor: wait; }
.askopts { display: none; flex-direction: column; gap: 8px; color: var(--muted); font-size: var(--fs-13); margin-top: 8px; }
.askopts.on { display: flex; }
.askopts-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.askopts-row.hidden { display: none; }
.askopts-search { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.askopts-search.hidden { display: none; }
.askopts label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check-copy { min-width: 0; }
.intentline { margin: 8px 2px 0; }
.intentline button {
  color: var(--accent); cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--info-bg); padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-13); display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
}
.intentline button:hover { border-color: var(--accent); }
.status { color: var(--muted); font-size: var(--fs-13); margin: 12px 2px; }
/* bugfix-2 G9: chyba poľa bez rámčeka a podfarbenia — len výkričník + červený text */
.required-message {
  display: flex; align-items: flex-start; gap: 6px; width: fit-content; max-width: 100%;
  color: var(--bad); font-size: var(--fs-13); line-height: 1.4;
}
.required-message .ic { margin-top: 2px; width: 14px; height: 14px; flex: 0 0 auto; }
.field-validation { width: 100%; margin-top: 6px; }
.field-validation .required-message { margin: 0; }
.inline-status.error, .editor-status.error { color: var(--bad); font-weight: 600; }
.inline-status.success { color: var(--good); font-weight: 600; }
.spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: r .7s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes r { to { transform: rotate(360deg); } }

/* ── Karty výsledkov a odpoveď ──────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 10px 0; box-shadow: var(--shadow-sm);
}
.card .head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.card .label { font-weight: 600; font-size: var(--fs-14); }
.card h2 { margin: 0 0 4px; font-size: var(--fs-17); font-family: var(--font-serif); font-weight: 600; }
.card .desc { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.badge { font-size: 11.5px; padding: 2px 9px; border-radius: 20px; font-weight: 500; letter-spacing: 0; display: inline-block; }
.badge.good    { background: var(--good-bg); color: var(--good); }
.badge.bad     { background: var(--bad-bg); color: var(--bad); }
.badge.unknown { background: var(--warn-bg); color: var(--warn); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge.info    { background: var(--info-bg); color: var(--info); }
.chips { color: var(--muted); font-size: 12.5px; margin: 2px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 0; align-items: center; }
.chips .dot { margin: 0 7px; color: var(--line); }
/* bugfix-2: .chips je flex — medzera medzi ikonou a textom kolabuje, drží ju margin */
.chips .ic { margin-right: 4px; }
.snippet { color: var(--ink); opacity: .92; font-size: 13.5px; white-space: pre-wrap; max-height: 150px; overflow: hidden; line-height: 1.6; }
.snippet mark { background: var(--mark-bg); color: inherit; padding: 0 1px; border-radius: 2px; }
/* bugfix-2: grid drží prepínač zvýraznenia v strede pre zákon aj rozhodnutie */
.cardfoot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 8px; }
.cardfoot .cite { grid-row: 1; grid-column: 1; min-width: 0; }
.cardfoot .hl-toggle { grid-row: 1; grid-column: 2; margin-left: 0; }
.cardfoot .idbtn:not(.hl-toggle) { grid-row: 1; grid-column: 3; justify-self: end; margin-left: 0; }
.more { color: var(--accent); font-size: 12.5px; cursor: pointer; }
.cite { color: var(--muted); font-size: var(--fs-12); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idbtn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: var(--fs-13); padding: 2px 4px; margin-left: auto; font-family: inherit; }
.idbtn:hover { color: var(--accent); }
.answer { border-left: 4px solid var(--accent); }
.answer h3 { margin: 0 0 8px; font-size: var(--fs-15); font-family: var(--font-serif); }
.answer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.answer-head > h3 { flex: 0 0 auto; }
.answer-disclosure { flex: 1 1 auto; min-width: 0; }
.answer-disclosure .disc-ai {
  display: flex; align-items: flex-start; justify-content: flex-end; gap: 6px; margin: 0;
  color: var(--muted); font-size: var(--fs-12); line-height: 1.5;
}
.answer-disclosure .disc-ai .ic { flex: 0 0 auto; width: 14px; height: 14px; margin: 2px 0 0; color: var(--brass-ink); }
.answer .body { line-height: 1.6; }
.cites { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.cites b { color: var(--good); }
.blockedbox { border-left: 4px solid var(--bad); background: var(--bad-bg); }
.progressbox { border-left: 4px solid var(--accent); }
.progressbox .elapsed { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { padding: 5px 0; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.steps li.done { color: var(--good); }
.steps li.on { color: var(--ink); font-weight: 600; }
.steps .tick { width: 18px; display: inline-block; text-align: center; }

/* ── Rozbaliteľné karty, zvýraznenie zhôd ─────────────────────────────────── */
.card.expandable .head {
  cursor: pointer; margin: -14px -16px 10px; padding: 11px 16px;
  width: calc(100% + 32px); background: var(--surface-2); color: var(--ink); border: 0; border-bottom: 1px solid var(--line);
  text-align: left; font-family: var(--font-ui);
}
.card.expandable .head:hover { background: var(--info-bg); }
.card.expanded .head { background: var(--info-bg); }
.card .srcnum { color: var(--muted); font-size: var(--fs-13); font-weight: 700; flex: 0 0 auto; }
.card .twisty { margin-left: auto; color: var(--muted); font-size: var(--fs-13); }
.card.expanded .twisty { color: var(--accent); }
.snippet.open { max-height: none; }
.snippet mark.hit-exact, .docview mark.hit-exact, .lawview mark.hit-exact { background: #fde047; color: #111; }
.snippet mark.hit-soft, .docview mark.hit-soft, .lawview mark.hit-soft { background: var(--info-bg); box-shadow: none; }
/* padding ostáva 0 1px ako pri .snippet mark — zhodná metrika = žiadny posun textu */
.card.no-highlights mark { background: transparent !important; box-shadow: none !important; padding: 0 1px; color: inherit !important; }
/* bugfix-2 F3: rozbalený zdroj-zákon — theme farby (docview je zámerne paper-light
   pre rozsudky), zvýraznenia a § prekliky ako v náhľade */
.lawview { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); max-height: 70vh; overflow-y: auto; line-height: 1.6; }
.lawview h4 { margin: 0 0 8px; font-size: 13.5px; }
.lawview .lawview-body { white-space: pre-wrap; }
.lawview mark { background: var(--mark-bg); color: inherit; padding: 0 1px; border-radius: 2px; }
/* bugfix-2 F4/F5: zdroj po skoku začína z vrchu; filter skrýva karty */
#out .card { scroll-margin-top: 10px; }
.card.filtered-out { display: none; }
/* bugfix-2 G5: preklik [n] na zdroj v texte odpovede — iné podfarbenie než § */
.srcref { background: var(--good-bg); color: var(--good); border-radius: 4px; padding: 0 4px; font-weight: 600; cursor: pointer; text-decoration: none; }
.srcref:hover { text-decoration: underline; }
/* bugfix-2 G6+H4: plávajúce „Na odpoveď" vpravo dolu, tokenové farby pre obe témy */
#backToAnswer { display: inline-flex; align-items: center; gap: 7px; position: fixed; border: 1px solid var(--accent); border-radius: 10px; background: var(--card); color: var(--ink); padding: 12px 16px; box-shadow: var(--shadow-pop); cursor: pointer; font: 500 var(--fs-12) var(--font-ui); }
#backToAnswer:hover { background: var(--quiet-hover); color: var(--accent); border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
#backToAnswer[hidden] { display: none; }
#backToAnswer .ic { width: 16px; height: 16px; }
.answer .body p { margin: 0 0 10px; }
.answer .body ul, .answer .body ol { margin: 6px 0 12px 22px; padding: 0; }
/* ── Komentáre v editore konceptu ─────────────────────────────────────────── */
.ed-comment-pop {
  position: fixed; z-index: 80; width: 310px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 10px;
}
.ed-comment-pop .sel {
  color: var(--muted); font-size: var(--fs-12); line-height: 1.4; max-height: 58px; overflow: hidden;
  border-left: 3px solid var(--brass); padding-left: 8px; margin-bottom: 8px;
}
.ed-comment-pop textarea {
  width: 100%; min-height: 72px; resize: vertical; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 9px; font: 13px/1.45 inherit; background: var(--card); color: var(--ink);
}
.ed-comment-pop .row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.ed-comment-pop button {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink); font-family: inherit;
}
.ed-comment-pop button.primary { background: var(--accent-strong); color: var(--accent-ink); border-color: var(--accent-strong); }
.ed-comments { margin-top: 14px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 12px; }
.ed-comments h3 { margin: 0 0 10px; font-size: var(--fs-14); }
.ed-comment { border-top: 1px solid var(--line); padding: 10px 0; }
.ed-comment:first-of-type { border-top: 0; padding-top: 0; }
.ed-comment .anchor {
  color: var(--ink); opacity: .85; font-size: 12.5px; line-height: 1.45;
  border-left: 3px solid var(--brass); padding-left: 8px; margin-bottom: 6px;
}
.ed-comment .body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; }
.ed-comment .mini { margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.ed-comment-result {
  margin-top: 10px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5;
}

/* ── Filtre vyhľadávania ────────────────────────────────────────────────── */
.askopts .fclear { border: 0; background: transparent; color: var(--accent); cursor: pointer; font: 500 var(--fs-12)/1 var(--font-ui); padding: 6px 2px; }
.askopts .fclear:hover { text-decoration: underline; }
.askopts .fclear.hidden { display: none; }

/* ── Spätná väzba + Nedávne ─────────────────────────────────────────────── */
.fbform { display:flex; flex-direction:column; gap:8px; margin-top:10px; padding:10px 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fbform select { padding:7px 10px; font-size: var(--fs-13); border:1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font-family: inherit; }
.fbform textarea { min-height:64px; padding:8px 10px; font-size: var(--fs-13); border:1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font-family: inherit; resize: vertical; }
.fbform .go { padding:8px 14px; font-size: var(--fs-13); }
.fbform .sub { font-size: var(--fs-12); color: var(--muted); }
.fbwrap { margin: 8px 0 14px; }
.exq .exmeta { margin-left:auto; color: var(--muted); font-size:11px; white-space:nowrap; padding-left:12px; }

/* ── Dokument (papier — vždy svetlý, PDF parita) ────────────────────────── */
.docview {
  background: var(--paper); color: var(--paper-ink); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: var(--shadow-md); margin-top: 10px; padding: 6% 12%;
  font: 13.3px/1.5 Arial, Helvetica, sans-serif; text-align: justify; max-height: 70vh; overflow-y: auto;
}
.docview .dochead { text-align: left; font-size: 12.6px; border-bottom: 1px solid #d9d6cc; padding-bottom: 12px; margin-bottom: 18px; }
.docview .dochead .dochead-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; column-gap: 14px; margin: 4px 0; }
.docview .dochead b { display: block; min-width: 0; font-weight: 400; }
.docview .dochead .dochead-value { min-width: 0; overflow-wrap: anywhere; }
.docview h1 { font: bold 26px Arial, Helvetica, sans-serif; text-align: center; margin: 22px 0 16px; letter-spacing: 0; }
.docview h2 { font: bold 13.3px Arial, Helvetica, sans-serif; text-align: center; margin: 20px 0 10px; letter-spacing: 0; }
.docview p { margin: 0 0 12px; }
.docview mark { background: #fef08a; color: #111; padding: 0 1px; border-radius: 2px; }
.lawref {
  color: var(--accent); text-decoration: none; cursor: pointer;
  background: var(--info-bg); border: 1px solid var(--control-line); border-radius: 5px;
  padding: 0 4px; white-space: nowrap; font-weight: 500;
}
.lawref:hover { background: var(--quiet-hover); border-color: var(--accent); color: var(--accent); }
/* bugfix-2 G8: rozbalené rozhodnutie nasleduje dark mode (explicitný pokyn
   používateľa pre OBRAZOVKU; --paper tokeny a Word export ostávajú svetlé) */
[data-theme="dark"] .docview { background: var(--card); color: var(--ink); }
[data-theme="dark"] .docview .dochead { border-bottom-color: var(--line); }
[data-theme="dark"] .docview mark { background: var(--mark-bg); color: inherit; }
#lawpop {
  position: fixed; z-index: 95; width: min(600px, calc(100vw - 32px));
  max-height: min(72dvh, calc(100dvh - 24px)); overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--glass); color: var(--ink); border: 1px solid var(--control-line); border-radius: 18px;
  box-shadow: 0 0 0 1px var(--edge), var(--shadow-pop); padding: 0; font-size: var(--fs-13); line-height: 1.6;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
#lawpop h4 { margin: 0; font-size: var(--fs-15); line-height: 1.4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
#lawpop .body { white-space: pre-wrap; color: var(--ink); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; flex: 1 1 auto; min-height: 0; padding: 16px 20px 20px; background: var(--panel-bg); border-top: 1px solid var(--line); }
#lawpop .lawpop-section { margin: 0 0 12px; }
#lawpop .lawpop-section:last-child { margin-bottom: 0; }
#lawpop .lawpop-section h5 { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
#lawpop .lawpop-section + .lawpop-section { padding-top: 10px; border-top: 1px solid var(--line); }
#lawpop .law-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; padding: 16px 18px 12px 20px; cursor: grab; touch-action: none; user-select: none; }
#lawpop .law-pop-head:active { cursor: grabbing; }
#lawpop .law-pop-head .dialog-close { cursor: pointer; touch-action: auto; }
#lawpop .law-pop-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; padding: 0 20px 14px; flex-shrink: 0; }
/* bugfix-2: dátum v Kontrolách je duplicitou bočného panela — skrytý, ale wired */
.cc-asof-row { display: none; }
/* Novelizácie / Porovnať — otvára ten istý modál ako Law Explorer */
#lawpop .law-compare {
  cursor: pointer; font: inherit; font-size: 12.5px; color: var(--accent);
  background: none; border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px;
}
#lawpop .law-compare:hover { background: var(--info-bg); border-color: var(--accent); }
#lawpop .law-compare:disabled { opacity: .5; cursor: wait; }
/* pvbox žije vnútri papiera → svetlé konštanty v oboch témach */
.pvbox { background: #f0fdf4; border: 1px solid #86efac; border-left: 4px solid #0e7a6c; border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; }
.pvbox h4 { margin: 0 0 8px; font-size: var(--fs-14); color: #0e7a6c; }
.pvbox .pvtext { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: #14532d; }
.pvbox .pvmeta { color: #4d7c5f; font-size: var(--fs-12); margin-top: 6px; }
.pvbox.missing { background: #fff7ed; border-color: #fdba74; border-left-color: #9a6700; }
.pvbox.missing h4 { color: #9a3412; }
.pvbox.missing .pvtext { color: #7c2d12; }
/* bugfix-2 H2: po dark docview (G8) už pvbox nežije v papieri — tokenové overridy */
[data-theme="dark"] .pvbox { background: var(--good-bg); border-color: var(--good); border-left-color: var(--good); }
[data-theme="dark"] .pvbox h4 { color: var(--good); }
[data-theme="dark"] .pvbox .pvtext { color: var(--ink); }
[data-theme="dark"] .pvbox .pvmeta { color: var(--muted); }
[data-theme="dark"] .pvbox.missing { background: var(--warn-bg); border-color: var(--warn); border-left-color: var(--warn); }
[data-theme="dark"] .pvbox.missing h4 { color: var(--warn); }
[data-theme="dark"] .pvbox.missing .pvtext { color: var(--ink); }

/* ── Prázdny stav ───────────────────────────────────────────────────────── */
.emptybox { margin-top: 22px; }
.emptybox .elbl { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: uppercase; color: var(--muted); margin: 0 2px 9px; }
.exq {
  display: flex; align-items: center; gap: 9px; width: 100%; max-width: 640px; text-align: left;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--radius);
  padding: 11px 15px; font: 400 13.5px/1.45 var(--font-ui); cursor: pointer; margin: 0 0 8px;
  transition: border-color .12s ease;
}
.exq:hover { border-color: var(--brass); }
.exq .ic { color: var(--muted); }

/* ── Formuláre nástrojov ────────────────────────────────────────────────── */
section.panel { min-width: 0; }
.frm { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.frm input, .frm textarea, .frm select {
  padding: 10px 12px; font-size: 14.5px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font-family: inherit;
}
.frm input::placeholder, .frm textarea::placeholder { color: var(--muted); }
.frm input:focus, .frm textarea:focus, .frm select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.frm textarea { width: 100%; min-height: 130px; resize: vertical; }
.date-field { display: flex; flex: 0 0 auto; flex-direction: column; align-items: stretch; width: 108px; }
.law-number-field { display: flex; flex: 1; flex-direction: column; min-width: 180px; }
.law-number-field input { width: 100%; }
.frm .legal-date, .flatpickr-input + .legal-date { width: 108px; min-width: 108px; font-variant-numeric: tabular-nums; text-align: center; }
.legal-date[aria-invalid="true"] { border-color: var(--bad); }
.result { margin-top: 12px; }
.partext {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; max-height: 340px; overflow-y: auto; margin-top: 8px;
}
.kv { font-size: 13.5px; color: var(--ink); margin: 3px 0; }
.kv b { display: inline-block; min-width: 190px; font-weight: 600; }
.soonbox { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--muted); font-size: 13.5px; background: var(--surface-2); }
.err { color: var(--bad); font-size: 13.5px; margin-top: 8px; }

/* Slovenský kalendár, self-hosted flatpickr. */
.flatpickr-calendar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); color: var(--ink); font-family: var(--font-ui); }
.flatpickr-months .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-weekdays, span.flatpickr-weekday { background: var(--card); color: var(--ink); fill: var(--ink); }
.flatpickr-current-month input.cur-year, .numInputWrapper span { color: var(--ink); }
.flatpickr-day { color: var(--ink); border-radius: var(--radius-sm); }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--muted); }
.flatpickr-day:hover, .flatpickr-day:focus { background: var(--surface-2); border-color: var(--line); }
.flatpickr-day.today { border-color: var(--brass); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { color: var(--ink); fill: var(--ink); }
/* Mesiac + rok ako vlastný dropdown (rovnaký zavretý aj otvorený stav) */
/* transform: none ruší stacking context flatpickru, inak dni prekryjú dropdown */
.flatpickr-current-month { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0; transform: none; }
.flatpickr-current-month .numInputWrapper { display: none; }
.flatpickr-months { position: relative; z-index: 6; overflow: visible; }
.flatpickr-months .flatpickr-month { overflow: visible; }

/* ── Vlastný dropdown ───────────────────────────────────────────────────── */
.csel { position: relative; display: inline-block; vertical-align: middle; }
select option { background: var(--card); color: var(--ink); }
select option:checked { background: var(--selected-bg); color: var(--selected-ink); }
select option:hover:not(:checked),
select option:focus:not(:checked),
select option:active:not(:checked) { background: var(--select-hover-bg); color: var(--select-hover-ink); }
.csel select.csel-native { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; border: 0; opacity: 0; pointer-events: none; }
.csel-btn {
  position: relative; display: flex; align-items: center; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  color: var(--ink); font: var(--fs-13) var(--font-ui); padding: 6px 22px 6px 10px; cursor: pointer;
}
.csel-btn:hover { border-color: var(--brass); }
.csel-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.csel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
/* Šípka vždy rovnako ďaleko od pravého okraja (mesiac aj rok) */
.csel-arrow { position: absolute; right: 6px; top: 50%; margin-top: -5.5px; width: 11px; height: 11px; color: var(--muted); }
.csel.open .csel-arrow { transform: rotate(180deg); }
.csel-pop {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 70; display: none;
  min-width: 100%; max-height: 216px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  box-shadow: var(--shadow-pop); text-align: left; line-height: 1.4;
}
.csel.open .csel-pop { display: block; }
.csel-opt {
  display: block; width: 100%; border: 0; border-radius: 4px; background: transparent; color: var(--ink);
  font: var(--fs-13) var(--font-ui); padding: 6px 10px; text-align: left; white-space: nowrap; cursor: pointer;
}
.csel-opt:hover { background: var(--select-hover-bg); color: var(--select-hover-ink); }
.csel-opt.on { background: var(--selected-bg); color: var(--selected-ink); font-weight: 600; }
.csel-opt:hover, .csel-opt:focus-visible { background: var(--select-hover-bg); color: var(--select-hover-ink); }
.csel-fluid { display: block; width: 100%; min-width: 0; }
/* Centrovaný variant — hodnota aj položky v strede, šípka v pravom paddingu */
/* Hodnota v strede textovej zóny — zóna šípky (28-6=22px) sa do nej nepočíta */
.csel-center .csel-btn { padding-left: 6px; padding-right: 28px; }
.csel-center .csel-label { text-align: center; }
.csel-center .csel-opt { text-align: center; padding-inline: 4px; }
.csel-center .csel-pop { right: 0; min-width: 0; }
/* Bez rámčeka — hlavička kalendára */
.csel-bare .csel-btn { border-color: transparent; background: transparent; font-size: var(--fs-14); font-weight: 500; padding-block: 3px; }
.csel-bare .csel-btn:hover { border-color: transparent; background: var(--surface-2); }
.csel-year-cal { width: 76px; }
.askopts .csel-year { width: 74px; }
.askopts .csel-court { max-width: 260px; }

/* ── Pracovné plochy ────────────────────────────────────────────────────── */
.document-choice { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 8px; }
.choice-grid button { display: flex; align-items: center; gap: 9px; min-height: 44px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); padding: 9px 11px; font: 500 var(--fs-13)/1.35 var(--font-ui); cursor: pointer; }
.choice-grid button:hover { border-color: var(--accent); background: var(--info-bg); }
.choice-grid .ic { color: var(--muted); }

.catalog-head, .matter-toolbar, .check-toolbar, .check-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.catalog-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--fs-12); }
.catalog-search { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); padding: 0 10px; }
.catalog-search input { width: 100%; height: 38px; border: 0; outline: 0; background: transparent; color: var(--ink); font: var(--fs-13) var(--font-ui); }
/* Dlaždica nesie ikonu, názov, stav aj šípku — auto-fill jej necháva dosť šírky,
   aby sa názov nelámal, a zároveň zhustne pri širokej ploche. */
.workflow-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(400px,1fr)); gap: 10px; margin-top: 14px; }
.workflow-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto auto; align-items: center; gap: 9px; width: 100%; min-height: 66px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 9px 11px; text-align: left; cursor: pointer; font-family: inherit; box-shadow: var(--shadow-sm); }
.workflow-row:hover { border-color: var(--brass); background: var(--surface-2); }
.workflow-planned { cursor: default; box-shadow: none; }
.workflow-planned:hover { border-color: var(--line); background: var(--card); }
.workflow-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); }
.workflow-row:hover .workflow-icon { border-color: var(--brass); color: var(--ink); }
.workflow-copy strong { display: block; }
.workflow-copy strong { font-size: var(--fs-14); line-height: 1.35; }
.workflow-arrow { color: var(--muted); }
/* Stav postupu — jeden signál na dlaždicu, nahrádza pôvodný TBD odznak */
.wf-state {
  flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
  font: 600 10px/1.5 var(--font-ui); white-space: nowrap; color: var(--muted); background: var(--surface-2);
}
.wf-state.wf-beta { border-color: color-mix(in srgb, var(--accent) 26%, var(--line)); color: var(--accent); background: var(--info-bg); }
.wf-state.wf-validated { border-color: color-mix(in srgb, var(--good) 30%, var(--line)); color: var(--good); background: var(--good-bg); }
.workflow-phase + .workflow-phase { margin-top: 18px; }
.workflow-phase .section-label { margin: 0 0 8px; }
.workflow-phase .workflow-list { margin-top: 0; }
.workflow-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.workflow-planned-group { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.workflow-planned-group > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  color: var(--muted); font: 600 10.5px/1.2 var(--font-ui); text-transform: uppercase;
}
.workflow-planned-group > summary::-webkit-details-marker { display: none; }
.workflow-planned-group > summary::before { content: "▸"; font-size: 11px; }
.workflow-planned-group[open] > summary::before { content: "▾"; }
.workflow-planned-group > summary span { border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 7px; }
.workflow-planned-note { margin: 9px 0 12px; color: var(--muted); font-size: var(--fs-12); }
/* Skratka nahradí šípku iba keď sú zmenšené obe bočné dlaždice naraz */
.workflow-shortcut { display: none; }
@media (min-width: 1121px) {
  .shell.left-collapsed .contentgrid.rail-collapsed .workflow-row.has-shortcut .workflow-arrow { display: none; }
  .shell.left-collapsed .contentgrid.rail-collapsed .workflow-row.has-shortcut .workflow-shortcut { display: inline-flex; }
}

.history-table { border-top: 1px solid var(--line); }
.history-row { display: grid; grid-template-columns: 90px minmax(0,1fr) 110px; gap: 12px; align-items: center; min-height: 48px; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: var(--fs-13); }
.history-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row time { color: var(--muted); }
.history-row.history-item { cursor: pointer; border-radius: var(--radius-sm); }
.history-row.history-item:hover, .history-row.history-item:focus-visible { background: var(--surface-2); }
.history-head { min-height: 34px; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; }
.empty-state { padding: 44px 12px; text-align: center; color: var(--muted); }
.empty-state h2 { margin: 0 0 6px; color: var(--ink); font: 600 var(--fs-17)/1.3 var(--font-serif); }
.empty-state p { margin: 0; font-size: var(--fs-13); }

.matter-toolbar { min-height: 40px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--fs-12); }
.primary-command { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: var(--radius-sm); padding: 8px 11px; background: var(--accent-strong); color: var(--accent-ink); cursor: pointer; font: 500 var(--fs-13)/1 var(--font-ui); }
.matter-workspace { display: grid; grid-template-columns: minmax(190px,32%) minmax(0,1fr); min-height: 420px; }
.matter-list { border-right: 1px solid var(--line); padding: 10px 10px 10px 0; }
.matter-row { width: 100%; text-align: left; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink); padding: 9px 10px; margin-bottom: 3px; cursor: pointer; font-family: inherit; }
.matter-row:hover { background: var(--surface-2); }
.matter-row.on { border-color: var(--line); background: var(--card); border-left: 3px solid var(--accent); }
.matter-row strong, .matter-row span { display: block; }
.matter-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-13); }
.matter-row span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.matter-detail { min-width: 0; padding: 18px; }
.matter-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.matter-detail h2 { margin: 4px 0 0; font: 600 var(--fs-17)/1.3 var(--font-serif); }
.matter-actions { display: inline-flex; align-items: center; gap: 6px; }
.matter-actions button { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--muted); padding: 0; cursor: pointer; }
.matter-actions button:hover { border-color: var(--accent); color: var(--accent); }
.matter-actions button.danger, .matter-actions button.danger .ic { color: var(--bad); }
.matter-actions button.danger:hover, .matter-actions button.danger:hover .ic { border-color: var(--bad); background: var(--bad); color: #fff; }
.matter-tabs { display: flex; border-bottom: 1px solid var(--line); margin-top: 18px; }
.matter-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 8px 10px; cursor: pointer; font: 500 var(--fs-12) var(--font-ui); }
.matter-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--ink); }
.matter-summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--line); }
.matter-summary-grid > div { background: var(--card); padding: 13px; }
.matter-summary-grid span, .matter-summary-grid strong { display: block; }
.matter-summary-grid span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.matter-summary-grid strong { margin-top: 6px; font-size: var(--fs-17); }

/* ── Cite-check tabuľka ─────────────────────────────────────────────────── */
.check-summary { margin: 14px 0 8px; flex-wrap: wrap; }
.check-counts { display: flex; gap: 12px; color: var(--muted); font-size: var(--fs-12); }
.check-toolbar { justify-content: flex-start; border-top: 1px solid var(--line); padding: 10px 0; font-size: var(--fs-12); }
.check-toolbar select { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); padding: 6px 8px; font: var(--fs-12) var(--font-ui); }
.check-toolbar #cc-visible-count { margin-left: auto; color: var(--muted); }
.check-table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check-table { width: 100%; min-width: 980px; border-collapse: collapse; background: var(--card); font-size: 11.5px; line-height: 1.4; }
.check-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.check-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); text-align: left; font-size: 9.5px; text-transform: uppercase; }
.check-table th, .check-table td { max-width: 190px; padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.check-table tr:last-child td { border-bottom: 0; }
.citation-cell { font-weight: 650; font-variant-numeric: tabular-nums; }
.severity { display: inline-block; border-radius: 4px; padding: 2px 5px; font-size: 10px; font-weight: 650; white-space: nowrap; }
.severity.high { color: var(--bad); background: var(--bad-bg); }
.severity.medium, .severity.review { color: var(--warn); background: var(--warn-bg); }
.severity.ok { color: var(--good); background: var(--good-bg); }
.evidence-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--accent); padding: 1px 0; cursor: pointer; font: 500 11px var(--font-ui); }
.status-text { color: var(--muted); font-size: 10.5px; }
.check-empty { padding: 22px 12px; color: var(--muted); text-align: center; font-size: var(--fs-13); }

/* ── Dialóg veci ────────────────────────────────────────────────────────── */
.matter-dialog { width: min(460px,calc(100vw - 28px)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop); padding: 0; }
.matter-dialog::backdrop { background: rgba(10,16,33,.46); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.matter-dialog form { padding: 16px; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head h2 { margin: 0; font: 600 var(--fs-17)/1.3 var(--font-serif); }
button.dialog-close { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
button.dialog-close:hover { border-color: var(--muted); color: var(--ink); }
.matter-dialog label { display: block; margin-top: 18px; color: var(--muted); font-size: var(--fs-12); }
.matter-dialog input { width: 100%; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); padding: 10px 11px; font: var(--fs-14) var(--font-ui); }
.matter-dialog input[aria-invalid="true"] { border-color: var(--bad); }
.matter-dialog .required-message { margin-top: 8px; }
.dialog-actions { justify-content: flex-end; margin-top: 18px; }
.dialog-actions > button:not(.go) { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); padding: 9px 12px; cursor: pointer; font-family: inherit; }
.dialog-actions > button:not(.go):hover { border-color: var(--muted); background: var(--surface-2); }
.confirm-dialog p { margin: 18px 0 0; color: var(--muted); font-size: var(--fs-13); }
.dialog-actions > button.danger-command { border-color: #b42318; background: #b42318; color: #fff; }
.dialog-actions > button.danger-command:hover { border-color: #921f16; background: #921f16; color: #fff; }

/* ── R1 prihlásenie: dialóg a identita ──────────────────────────────────────
   Prídavné, viazané na sémantické tokeny; dedí .matter-dialog, takže dialóg
   vyzerá ako ostatné. Bez vlastných farieb — obe témy fungujú automaticky. */
.login-dialog label { margin-top: 14px; }
.login-dialog input { margin-top: 6px; }
.login-dialog .dialog-head { justify-content: flex-start; }
.login-note { margin: 10px 0 0; color: var(--muted); font-size: var(--fs-13); line-height: 1.45; }
.login-dialog .inline-status { margin-top: 10px; min-height: 1em; }

.identity-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius-sm);
  padding: 6px 9px; color: var(--topbar-ink);
  font: 500 var(--fs-13)/1 var(--font-ui); max-width: 420px;
}
.identity-chip .ic { width: 15px; height: 15px; flex-shrink: 0; }
.identity-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-role { color: #aab8dd; font-size: var(--fs-12); white-space: nowrap; }
.identity-logout {
  border: 0; background: transparent; color: #aab8dd; cursor: pointer;
  padding: 2px 4px; font: 500 var(--fs-12)/1 var(--font-ui); border-radius: var(--radius-sm);
}
.identity-logout:hover { background: var(--topbar-hover); color: var(--topbar-ink); }
@media (max-width: 520px) {
  .identity-role { display: none; }
  .identity-chip { max-width: 190px; }
}

/* ── Kontrola zákona / Law Explorer ─────────────────────────────────────── */
.law-query .legal-date { min-width: 108px; width: 108px; }
.law-head {
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2);
}
.law-head h3 { margin: 8px 0 5px; font-size: 18px; }
.law-meta { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.law-meta a, .law-node footer a { color: var(--accent); }
.law-warning {
  margin-top: 9px; padding: 8px 10px; border-radius: 7px;
  color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent);
  font-size: 12px;
}
.law-timeline {
  display: flex; align-items: stretch; gap: 8px; overflow-x: auto;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
  scrollbar-width: thin;
}
.law-timeline h4 {
  flex: 0 0 auto; align-self: center; margin: 0 4px 0 0;
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0;
}
.law-timeline button {
  flex: 0 0 190px; display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
  background: var(--card); color: var(--ink); cursor: pointer; font-family: inherit;
}
.law-timeline button:hover { border-color: var(--accent); }
.law-timeline button.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.law-timeline button span, .law-timeline button small { color: var(--muted); font-size: 11.5px; }
.law-tree { min-width: 0; margin-top: 12px; }
.law-treebar { display: flex; align-items: center; gap: 7px; min-height: 32px; margin-bottom: 6px; }
.law-node {
  scroll-margin-top: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); margin-bottom: 9px; overflow: hidden;
}
.law-node.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }
.law-node header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.law-node header > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.law-node-actions { display: flex; gap: 5px; flex-shrink: 0; }
.law-node-actions button, .law-diff-controls button {
  border: 1px solid var(--line); border-radius: 7px; background: var(--card);
  color: var(--ink); padding: 5px 8px; cursor: pointer; font: inherit; font-size: 11.5px;
}
.law-node-actions button:hover { border-color: var(--accent); color: var(--accent); }
.law-node-text { white-space: pre-wrap; line-height: 1.65; font-size: 13.5px; padding: 12px 14px; }
.law-node-text .law-chg-modified { background: var(--law-chg-modified); border-radius: 2px; }
.law-node-text .law-chg-future { background: var(--law-chg-future); border-radius: 2px; }
.law-node-text .law-chg-deleted { background: var(--law-chg-deleted); border-radius: 2px; text-decoration: line-through; }
.law-node footer { padding: 7px 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.law-modal {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 24px; background: rgba(8, 15, 24, .62);
}
.law-modal-card {
  position: relative; width: min(1120px, 96vw); max-height: 92vh; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop);
}
.law-modal-card h3 { margin: 0 38px 12px 0; }
.law-modal-close { position: absolute; top: 12px; right: 12px; }
/* bugfix-2 F1: selecty verzií sedia nad svojím stĺpcom, so Slov-Lex linkom */
.law-diff-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.law-diff-control { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.law-diff-controls label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11.5px; }
.law-diff-controls select { width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
.law-diff-links { margin-bottom: 10px; }
.law-diff-links section { border-radius: 7px; }
.law-diff-links a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.law-diff-links a:hover { background: var(--info-bg); }
.law-diff-links .ic { width: 14px; height: 14px; flex-shrink: 0; }
.law-diff-status { margin: 5px 0 9px; color: var(--muted); font-size: 12px; }
/* bugfix-2 K2: legenda žije inline v status riadku — šetrí riadok */
.law-diff-legend { display: inline-flex; gap: 10px; flex-wrap: wrap; margin: 0 0 0 6px; font-size: 12px; vertical-align: middle; }
.law-diff-legend span, .law-diff-legend mark { padding: 2px 8px; border-radius: 4px; border: 0; }
.law-diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.law-diff-grid section { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.law-diff-grid h4 { margin: 0; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.law-diff-grid section > div { min-height: 170px; max-height: 55vh; overflow: auto; white-space: pre-wrap; padding: 12px; line-height: 1.65; font-size: 13.5px; }
.law-diff-grid section > div > br + strong { display: inline-block; margin-top: .6em; }
.law-diff-added { background: var(--law-diff-added); color: inherit; border-radius: 2px; }
.law-diff-removed { background: var(--law-diff-removed); color: inherit; border-radius: 2px; text-decoration: line-through; }
.law-diff-grid del { background: var(--law-diff-removed); color: inherit; text-decoration: line-through; }
.law-diff-grid ins { background: var(--law-diff-added); color: inherit; text-decoration: none; }
@media (max-width: 820px) {
  .law-timeline { flex-wrap: nowrap; }
  .law-timeline button { flex: 0 0 160px; }
  .law-node header { align-items: flex-start; flex-direction: column; }
  .law-diff-grid { grid-template-columns: 1fr; }
}

.res-toolbar { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.res-toolbar button, .edactions button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; font-size: var(--fs-13);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  color: var(--ink); cursor: pointer; font-family: inherit; transition: all .12s ease;
}
.res-toolbar button:hover, .edactions button:hover { border-color: var(--accent); color: var(--accent); }

/* ── Editor konceptu ────────────────────────────────────────────────────── */
.edactions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.edactions button.primary { background: var(--accent-strong); color: var(--accent-ink); border-color: var(--accent-strong); }
.edactions button.primary:hover { color: var(--accent-ink); background: var(--accent-hover); }
.editor-status { color: var(--muted); font-size: var(--fs-12); margin-left: auto; min-height: 1em; }
.sun-editor { border: 1px solid var(--line) !important; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); background: var(--card) !important; }
.sun-editor .se-toolbar { background: var(--card) !important; outline: none !important; border-bottom: 1px solid var(--line) !important; }
.sun-editor .se-btn-module-border { border-color: var(--line) !important; }
.sun-editor .se-btn { color: var(--ink) !important; }
.sun-editor .se-btn:enabled:hover { background: var(--surface-2) !important; border-color: var(--line) !important; color: var(--ink) !important; }
.sun-editor .se-btn:enabled.active { color: var(--accent) !important; }
.sun-editor .se-btn-select .txt { color: var(--ink) !important; }
.sun-editor .se-list-layer, .sun-editor .se-dialog .se-dialog-inner .se-dialog-content {
  background: var(--card) !important; color: var(--ink) !important; border-color: var(--line) !important;
}
.sun-editor .se-list-layer button, .sun-editor .se-dialog-form label, .sun-editor .se-dialog-header .se-modal-title { color: var(--ink) !important; }
.sun-editor .se-dialog-form input { background: var(--card) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.sun-editor .se-resizing-bar { background: var(--surface-2) !important; border-color: var(--line) !important; color: var(--muted) !important; }
/* stránka editora = papier, vždy svetlá */
.sun-editor-editable { background: var(--paper) !important; color: var(--paper-ink) !important; padding: 36px 48px !important; }

/* ── Pravý panel dôvery ─────────────────────────────────────────────────── */
.rail { position: sticky; top: 0; display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - var(--footer-h)); min-height: 440px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius) 0 0 0; padding: 12px; overflow: visible; box-shadow: var(--shadow-sm); }
.rail-controls { display: flex; align-items: center; justify-content: flex-start; gap: 9px; height: 34px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.rail-heading { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; font-size: var(--fs-12); font-weight: 650; }
.rail-heading .ic { color: var(--brass); }
.rail-collapse .ic { transition: transform .18s ease; }
.rail-collapse { position: absolute; top: 31px; left: -15px; z-index: 3; }
.rail-collapsed-summary { display: none; }
#railBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.rail-top { display: none; position: relative; align-items: center; justify-content: flex-start; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 9px; margin-bottom: 12px; font-size: var(--fs-13); }
.rail-top button { display: inline-flex; border: 0; background: transparent; color: var(--muted); padding: 4px; cursor: pointer; }
.rail-top .rail-top-close { position: absolute; left: -13px; top: 8px; display: inline-grid; order: -1; width: 24px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--muted); place-items: center; }
.rail-top .rail-top-close:hover { background: var(--quiet-hover); border-color: var(--control-line); color: var(--ink); }
.rail-top .rail-close-icon { width: 14px; height: 14px; }
.rail h4 { margin: 0 0 9px; font-size: 11px; letter-spacing: 0; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.rail h4:not(:first-child) { margin-top: 16px; }
.rail .sub { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.rail .ritem { display: block; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm); padding: 8px 10px; font: 12.5px/1.4 var(--font-ui); text-align: left; margin-bottom: 7px; cursor: pointer; color: var(--ink); }
.rail .ritem:hover { border-color: var(--brass); }
.rail .rgate { display: flex; align-items: center; gap: 7px; border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; margin-bottom: 10px; }
.rail .rgate.ok { background: var(--good-bg); color: var(--good); }
.rail .rgate.warn { background: var(--warn-bg); color: var(--warn); }
.rail .rgate.bad { background: var(--bad-bg); color: var(--bad); }
/* bugfix-2 F5+G7: skupiny zdrojov (Zákony / Rozhodnutia) + klientsky filter */
.rail-groupwrap { position: relative; min-width: 0; margin: 0 0 10px; }
.rail-group { margin: 0; }
.rail-group > summary { display: flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.rail-group > summary::-webkit-details-marker { display: none; }
.rail-group > summary::before { content: "▾"; font-size: 10px; }
.rail-group:not([open]) > summary::before { content: "▸"; }
.rail-group .rail-count { font-weight: 500; }
.rail-pills { margin-left: auto; display: inline-flex; gap: 6px; }
.rail-pill { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 10px; padding: 1px 8px; font: 600 10.5px var(--font-ui); cursor: pointer; letter-spacing: .02em; }
.rail-pill:hover { border-color: var(--accent); color: var(--accent); }
.rail-filter-btn.on { color: var(--accent); border-color: var(--accent); background: var(--info-bg); }
.rail-filter-clear { color: var(--bad); border-color: var(--bad); }
.rail-filter-clear:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.rail-sub h5 { margin: 6px 0 5px; font-size: 11px; color: var(--muted); font-weight: 600; }
.rail-filter-pop { position: absolute; right: 0; top: 24px; z-index: 6; box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: 8px; }
.rail-filter-pop[hidden] { display: none; }
.rfrow { display: flex; align-items: flex-start; gap: 8px; padding: 4px 2px; font-size: 12.5px; }
.rfrow label { display: flex; align-items: flex-start; gap: 6px; flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.rail-only { border: 1px solid var(--line); background: none; color: var(--accent); border-radius: 10px; padding: 1px 8px; font: 11px var(--font-ui); cursor: pointer; visibility: hidden; }
.rfrow:hover .rail-only { visibility: visible; }
.rail-filter-apply { margin-top: 6px; padding: 3px 12px; color: var(--accent); border-color: var(--accent); }
.rail .rdiv { border-top: 1px solid var(--line); margin: 12px 0; }
.rail .legend { display: flex; gap: 6px; margin: 4px 0 8px; }
.authority-name { font: 600 var(--fs-14)/1.4 var(--font-serif); overflow-wrap: anywhere; }
.authority-meta { margin-top: 4px; color: var(--muted); font-size: var(--fs-12); }
.evidence-quote { margin: 0; border-left: 3px solid var(--brass); background: var(--card); padding: 10px 11px; font: 13px/1.55 var(--font-serif); white-space: pre-wrap; }
.rail-back { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--accent); padding: 0 0 12px; cursor: pointer; font: 500 var(--fs-12) var(--font-ui); }
.workspace-floating-actions, .evidence-toggle, .rail-scrim { display: none; }
@media (min-width: 1121px) {
  .contentgrid.rail-collapsed { grid-template-columns: minmax(0,1fr) 64px; }
  .contentgrid.rail-collapsed .rail { padding-inline: 9px; overflow: visible; }
  .contentgrid.rail-collapsed .rail-controls { justify-content: center; }
  .contentgrid.rail-collapsed .rail-heading,
  .contentgrid.rail-collapsed #railBody { display: none; }
  .contentgrid.rail-collapsed .rail-collapse .ic { transform: rotate(180deg); }
  .contentgrid.rail-collapsed .rail-collapsed-summary {
    display: flex; flex-direction: column; align-items: center; gap: 7px; width: 100%;
    border: 0; background: transparent; color: var(--accent); padding: 13px 0; cursor: pointer;
  }
  .rail-collapsed-summary .ic { width: 20px; height: 20px; }
  .rail-collapsed-summary strong { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--info-bg); font: 600 11px/1 var(--font-ui); }
}

/* ── Príkazová paleta ───────────────────────────────────────────────────── */
.palette-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette-scrim { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(10,16,33,.4); cursor: default; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.palette { position: relative; z-index: 1; width: 560px; max-width: 92vw; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 15px 16px; font-size: var(--fs-15); outline: none; background: var(--card); color: var(--ink); font-family: inherit; }
.palette .pl { max-height: 340px; overflow-y: auto; }
.palette .pl .row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; padding: 10px 16px; cursor: pointer; font: var(--fs-14) var(--font-ui); color: var(--ink); background: transparent; text-align: left; }
.palette .pl .row .ic { color: var(--muted); }
.palette .pl .row .assistant-mark { width: 20px; height: 20px; object-fit: contain; }
.palette .pl .row.sel, .palette .pl .row:hover { background: var(--info-bg); }
.palette-shortcut { margin-left: auto; }
/* Skratka je terciárna informácia — tichý keycap, nie tmavá výplň */
.palette-shortcut .shortcut-keycap,
.workflow-shortcut .shortcut-keycap { padding: 1px 7px; font: 11px/1.4 var(--font-ui); }
/* Na zvýraznenom riadku oddelí skratku vlásočnica vo farbe nezvýrazneného okolia */
.palette .pl .row.sel .shortcut-keycap,
.palette .pl .row:hover .shortcut-keycap { box-shadow: 0 1px 0 var(--line), 0 0 0 2px var(--card); }
.palette-shortcut .wf-state { font-size: 9.5px; padding: 1px 7px; }
.palette-empty { padding: 18px 16px; color: var(--muted); font-size: var(--fs-13); }

/* ── Pätička / disclaimer (jediná) ──────────────────────────────────────── */
/* Pätička v štýle hlavičky (navy + brass lem). */
footer.disc {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--navy); border-top: 2px solid var(--brass); color: #c7d2ec;
  min-height: 34px; padding: 0 18px;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
footer.disc .disc-ai { display: none; }
.disc-legal {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px 9px; min-width: 0;
}
.disc-legal button {
  border: 0; background: transparent; color: #c7d2ec; padding: 0; cursor: pointer;
  font: inherit; text-decoration: none; white-space: nowrap;
}
.disc-legal button:hover { color: #fff; text-decoration: underline; }
.disc-sep { color: rgba(255,255,255,.28); }
.disc-copy { color: rgba(255,255,255,.62); white-space: nowrap; }

/* Dialóg s právnymi informáciami */
.legal-dialog { width: min(660px,calc(100vw - 28px)); }
.legal-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.legal-body { max-height: min(70vh,560px); overflow-y: auto; padding: 4px 16px 16px; }
.legal-body section { padding-top: 18px; }
.legal-body h3 { margin: 0; font: 600 var(--fs-15)/1.3 var(--font-serif); }
.legal-body .legal-basis { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.legal-body p { margin: 9px 0 0; font-size: var(--fs-13); line-height: 1.6; }
.legal-dl { display: grid; grid-template-columns: minmax(120px,auto) minmax(0,1fr); gap: 6px 16px; margin: 11px 0 0; font-size: var(--fs-13); }
.legal-dl dt { color: var(--muted); }
.legal-dl dd { margin: 0; justify-self: start; }
.todo { border-radius: 4px; background: var(--warn-bg); color: var(--warn); padding: 1px 6px; font-size: 11.5px; font-style: normal; }

/* ── Responsivita ───────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  /* Úzka hlavička neunesie vetu — presunie sa do pätičky, aby bola vždy viditeľná */
  :root { --footer-h: 64px; }
  .workspace-head { grid-template-columns: minmax(0,1fr) auto; }
  .workspace-disc { display: none; }
  footer.disc { flex-direction: column; justify-content: center; gap: 4px; padding-block: 7px; }
  footer.disc .disc-ai { display: none; }
  .contentgrid { grid-template-columns: 1fr; }
  .rail { position: fixed; top: 56px; right: 0; bottom: var(--footer-h); width: min(390px,calc(100vw - 32px)); height: auto; min-height: 0; max-height: none; z-index: 70; border-radius: 0; transform: translateX(102%); transition: transform .18s ease; box-shadow: var(--shadow-pop); }
  .rail.open { transform: translateX(0); }
  .rail-controls, .rail-collapsed-summary { display: none; }
  .rail-top { display: flex; }
  .rail-scrim { position: fixed; inset: 56px 0 32px; border: 0; background: rgba(10,16,33,.34); z-index: 60; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
  .rail-scrim.open { display: block; }
  .evidence-toggle { display: inline-flex; align-items: center; gap: 6px; position: fixed; right: 16px; bottom: 48px; z-index: 50; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--navy); color: #fff; padding: 9px 11px; box-shadow: var(--shadow-md); cursor: pointer; font: 500 var(--fs-12) var(--font-ui); }
}
@media (max-width: 880px) {
  header.topbar, body.left-nav-collapsed header.topbar { display: flex; }
  body.left-nav-collapsed .topbar .brand span { display: inline; }
  .cmdk-hint { width: auto; margin-left: auto; }
  .shell { display: block; padding-left: 0; }
  .sidenav { display: none; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: var(--footer-h); z-index: 55; display: grid; grid-template-columns: repeat(5,1fr); height: 58px; border-top: 1px solid var(--line); background: var(--card); }
  .mobile-nav button { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-top: 2px solid transparent; background: transparent; color: var(--muted); padding: 4px 1px; cursor: pointer; font: 9.5px/1.1 var(--font-ui); }
  .mobile-nav button.on { border-color: var(--accent); color: var(--accent); }
  .mobile-nav .ic { width: 17px; height: 17px; }
  .mobile-nav .assistant-mark { width: 20px; height: 20px; object-fit: contain; }
  .contentgrid { padding: 14px 14px calc(58px + var(--footer-h) + 24px); }
  .workmain { padding-bottom: 0; }
  .sun-editor-editable { padding: 20px 16px !important; }
  header.topbar { padding: 0 14px; gap: 10px; }
  .matter-workspace { grid-template-columns: 1fr; }
  .matter-list { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .history-row { grid-template-columns: 68px minmax(0,1fr) 72px; }
  .history-head > :last-child { display: none; }
  .evidence-toggle { bottom: 102px; }
  .rail { bottom: 90px; }
  .rail-scrim { bottom: 90px; }
}
@media (max-width: 1250px) {
  .workflow-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .workflow-list { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar .brand { font-size: var(--fs-17); }
  .cmdk-hint { font-size: 0; padding: 7px; margin-left: auto; }
  .cmdk-hint kbd { display: none; }
  .cmdk-hint .ic { width: 17px; height: 17px; }
  .topbar .topmeta { margin-left: 0; }
  .top-action { font-size: 0; padding: 7px; }
  .top-action .ic { width: 17px; height: 17px; }
  .theme-picker button { width: 30px; height: 30px; }
  .workspace-head { align-items: flex-start; }
  .workspace-context { max-width: 44%; }
  .searchbar { flex-direction: column; }
  .searchbar button.go { width: 100%; min-height: 42px; }
  .composer-actions { flex-wrap: wrap; }
  .composer-actions button.go { width: 100%; min-height: 42px; }
  .choice-grid { grid-template-columns: 1fr; }
  .matter-summary-grid { grid-template-columns: 1fr; }
  .matter-detail { padding: 14px 4px; }
  .check-counts { width: 100%; justify-content: space-between; gap: 6px; }
  .disc-legal { font-size: 10.5px; gap: 3px 7px; }
}

/* ── Tlač: vždy svetlá, len obsah ───────────────────────────────────────── */
@media print {
  :root, [data-theme="dark"] {
    --bg: #fff; --card: #fff; --surface-2: #fff; --line: #ddd; --ink: #000; --muted: #444;
    --paper: #fff; --paper-ink: #000;
  }
  header.topbar, .sidenav, .cmdarea, .rail, footer, .res-toolbar, .desc, .frm, button.go,
  .emptybox, .intentline, .palette-overlay, .edactions,
  .sun-editor .se-toolbar, .sun-editor .se-resizing-bar { display: none !important; }
  .shell, .contentgrid { display: block; padding: 0; max-width: none; }
  .card, .sun-editor { border: 0 !important; box-shadow: none !important; padding: 0; }
  .sun-editor-editable { padding: 0 !important; }
  .partext { max-height: none !important; overflow: visible !important; }
  body { background: #fff; font-size: 12.5px; }
}

/* ── Spatial workspace: screen composition ────────────────────────────── */
@media screen {
  body { font-size: 14px; letter-spacing: -.012em; }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
  button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
  button { transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
  input[type="checkbox"] { accent-color: var(--accent-strong); width: 15px; height: 15px; }
  ::selection { background: var(--selected-bg); color: var(--selected-ink); }

  /* Quiet chrome, with the original seal kept as the identity anchor. */
  header.topbar {
    position: sticky; top: 0; z-index: 80;
    grid-template-columns: var(--sidebar-w) minmax(0,1fr) auto;
    min-height: var(--topbar-h); gap: var(--workspace-gap); padding: 0;
    background: var(--chrome); color: var(--ink); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  }
  .topbar .brand { color: var(--ink); padding: 12px 22px; font-size: 22px; gap: 10px; letter-spacing: -.035em; }
  .topbar .brand-logo { width: 34px; height: 34px; }
  .cmdk-hint {
    width: min(280px,100%); min-height: 34px; padding: 6px 10px;
    gap: 10px; border: 1px solid var(--line); border-radius: 9px;
    background: var(--panel-bg); color: var(--muted); font-size: 12px;
    box-shadow: inset 0 1px 0 var(--edge);
  }
  .cmdk-hint:hover { color: var(--ink); border-color: var(--control-line); }
  .cmdk-hint > kbd { margin-left: auto; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; }
  .topbar .topmeta { padding-right: 20px; gap: 12px; min-width: 0; }
  .top-action { min-height: 34px; padding: 9px 12px; color: var(--ink); border-color: var(--line); background: var(--card); font-size: 12px; border-radius: 8px; box-shadow: var(--shadow-sm); }
  .top-action:hover { background: var(--quiet-hover); }
  .theme-picker { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
  .theme-picker > button { width: 34px; height: 34px; color: var(--muted); border-radius: 9px; }
  .theme-picker .theme-current { border: 1px solid var(--line); background: var(--panel-bg); }
  .theme-picker > .palette-trigger { width: 22px; background: transparent; }
  .palette-trigger .ic { width: 12px; transform: rotate(90deg); }
  .theme-picker button:hover { background: var(--quiet-hover); color: var(--ink); }
  .palette-trigger[aria-expanded="true"] .ic { transform: rotate(-90deg); }
  /* A compact glass capsule separates the spectrum from the working page. */
  .theme-popover {
    position: absolute; z-index: 100; top: calc(100% + 10px); right: -15px;
    width: 52px; padding: 16px 3px; border: 1px solid var(--edge); border-radius: 26px;
    background: linear-gradient(160deg, var(--ambient-secondary), transparent 65%), var(--glass);
    box-shadow: inset 0 1px 0 var(--edge), 0 0 0 1px var(--line), var(--shadow-pop);
    backdrop-filter: blur(24px) saturate(135%); -webkit-backdrop-filter: blur(24px) saturate(135%);
    animation: palette-reveal .16s ease both;
  }
  .theme-popover[hidden] { display: none; }
  @keyframes palette-reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  .palette-track { position: relative; width: 44px; height: min(220px, 50dvh); }
  .palette-track::before { content: ""; position: absolute; inset: 0 17px; border-radius: 99px; background: var(--palette-spectrum); opacity: .16; filter: blur(6px); pointer-events: none; }
  .palette-range { position: relative; display: block; writing-mode: vertical-lr; direction: ltr; width: 44px; height: 100%; padding: 0; margin: 0; border: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; touch-action: none; }
  .palette-range::-webkit-slider-runnable-track { width: 10px; height: 100%; border-radius: 99px; background: var(--palette-spectrum); box-shadow: inset 0 0 0 1px var(--line), 0 0 0 4px var(--surface-2), inset 0 2px 4px var(--focus-halo); }
  .palette-range::-moz-range-track { width: 10px; height: 100%; border-radius: 99px; background: var(--palette-spectrum); box-shadow: inset 0 0 0 1px var(--line), 0 0 0 4px var(--surface-2), inset 0 2px 4px var(--focus-halo); }
  .palette-range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 26px; height: 18px; margin-left: -8px; border: 3px solid var(--thumb-rim); border-radius: 7px; background: var(--accent-strong); box-shadow: 0 0 0 1px var(--thumb-edge), 0 3px 9px var(--focus-halo); cursor: grab; }
  .palette-range::-moz-range-thumb { width: 20px; height: 12px; border: 3px solid var(--thumb-rim); border-radius: 7px; background: var(--accent-strong); box-shadow: 0 0 0 1px var(--thumb-edge), 0 3px 9px var(--focus-halo); cursor: grab; }
  .palette-range:active::-webkit-slider-thumb { cursor: grabbing; }
  .palette-range:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 12px; }
  .palette-trigger:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
  @media (prefers-reduced-motion: reduce) { .theme-popover { animation: none; } }
  .identity-chip {
    min-width: 0; min-height: 34px; max-width: 360px; padding: 0 10px;
    border: 1px solid var(--control-line); border-radius: 9px; background: var(--panel-bg); color: var(--ink); gap: 8px;
    box-shadow: inset 0 1px 0 var(--edge);
  }
  .identity-chip[hidden] { display: none; }
  .identity-role { display: inline-flex; align-items: center; min-height: 22px; padding: 0 6px; border-radius: 5px; background: var(--selected-bg); color: var(--selected-ink); font-size: 11px; font-weight: 600; }
  .identity-logout { color: var(--accent); flex-shrink: 0; min-height: 28px; padding-inline: 5px; }
  .identity-logout:hover { background: var(--quiet-hover); color: var(--ink); }

  /* Three material planes; borders are decorative, never the only boundary. */
  .shell { grid-template-columns: var(--sidebar-w) minmax(0,1fr); gap: 0; min-height: calc(100dvh - var(--topbar-h)); }
  .sidenav {
    position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start;
    height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 32px); min-height: 380px;
    margin: 16px 0; width: auto;
    background: var(--panel-bg); border: 1px solid var(--line); border-radius: 16px; padding: 0 18px 20px;
    box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
  }
  .sidenav-top { height: calc(var(--zone-head-h) - 17px); align-items: center; margin: 0 0 18px; padding: 0; border-bottom-color: var(--line); }
  .sidenav .current-matter { min-height: 43px; height: auto; padding: 11px 12px; margin: 5px 0; border: 1px solid transparent; border-radius: 10px; }
  .sidenav .current-matter:hover { background: var(--quiet-hover); border-color: transparent; color: var(--ink); }
  .sidenav .current-matter small { color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: .13em; line-height: 1.5; }
  .sidenav .current-matter strong { font-size: 12px; font-weight: 600; line-height: 1.4; margin-top: 6px; }
  .panel-collapse { width: 24px; height: 26px; background: var(--card); color: var(--muted); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow-sm); }
  .panel-collapse::before, .panel-collapse::after { display: none; }
  .panel-collapse:hover { background: var(--quiet-hover); border-color: var(--control-line); color: var(--ink); }
  .sidenav-collapse, .rail-collapse { top: 31px; }
  .sidenav-collapse { top: 15px; right: -12px; }
  .rail-collapse { left: -12px; }
  .asof-row { margin: 17px 0 7px; }
  .asof-label {
    display: block; margin: 0 0 5px; color: var(--muted);
    font-size: 9px; font-weight: 500; letter-spacing: .13em; line-height: 1.5; text-transform: uppercase;
  }
  .asof-chip { padding: 10px; background: var(--bg); border-color: var(--line); border-radius: 9px; font-size: 11px; font-weight: 500; }
  .asof-chip .ic { color: var(--muted); }
  .asof-chip:hover { background: var(--quiet-hover); border-color: var(--control-line); }
  .sidenav .item { min-height: 43px; padding: 11px 12px; gap: 10px; margin: 5px 0; border: 1px solid transparent; border-radius: 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
  .sidenav .item .ic { width: 16px; height: 16px; color: inherit; }
  .sidenav .item .assistant-mark { width: 19px; height: 19px; }
  .sidenav .item:hover { background: var(--quiet-hover); border-color: transparent; color: var(--ink); }
  .sidenav .item.on { background: var(--selected-bg); border-color: var(--line); color: var(--selected-ink); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm); }
  .sidenav .item.on .ic { color: var(--selected-ink); }
  .shell.left-collapsed .sidenav { padding: 0 7px 24px; }
  .shell.left-collapsed .sidenav-top { height: var(--zone-head-h); }
  .shell.left-collapsed .asof-label { display: none; }
  .shell.left-collapsed .sidenav .item { min-height: 38px; }

  .contentgrid {
    grid-template-columns: minmax(0,1fr) var(--rail-w); gap: var(--workspace-gap);
    padding: 0 16px 0 var(--workspace-gap); align-items: start;
  }
  .workmain {
    min-height: calc(100dvh - var(--topbar-h) - var(--footer-h));
    padding-bottom: calc(var(--footer-h) + 44px);
    background: radial-gradient(ellipse 70% 280px at 50% 260px, var(--ambient), transparent 80%);
  }
  .workspace-head {
    grid-template-columns: minmax(0,1fr) auto; align-items: center;
    min-height: var(--zone-head-h); padding: 18px 0; margin: 0 0 24px;
    gap: 16px; border-bottom: 1px solid var(--line);
  }
  .workspace-head h1 { font-family: var(--font-ui); font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -.035em; overflow-wrap: anywhere; }
  .workspace-head .eyebrow, .workspace-disc { display: none; }
  .workspace-context { grid-column: 2; justify-self: end; min-height: 40px; max-width: min(380px,45vw); padding: 9px 14px; font-size: 12px; line-height: 1.4; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-bg); }
  .workspace-context > span { max-width: none; }
  .section-label, .rail h4 { font-size: 10px; font-weight: 600; letter-spacing: .11em; color: var(--muted); }

  /* The working surface: depth, generous input, and a single restrained halo. */
  .cmdarea {
    --composer-inset: 24px;
    position: relative; isolation: isolate; display: flex; flex-direction: column;
    padding: 0; border: 1px solid var(--edge); border-radius: 22px;
    background: var(--glass); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-md);
    transition: border-color .2s ease, box-shadow .2s ease;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .cmdarea::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
    background: var(--input-gradient);
    pointer-events: none;
  }
  .cmdarea:focus-within { border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-halo), inset 0 1px 0 var(--edge), var(--shadow-md); }
  .cmdarea.stuck { box-shadow: var(--shadow-md); border-bottom-color: var(--edge); }
  .composer-modes {
    order: 1; display: flex; width: fit-content; max-width: calc(100% - 32px);
    gap: 4px; padding: 4px; margin: 16px 16px 0;
    border: 1px solid var(--line); border-radius: 11px; background: var(--bg);
  }
  .composer-modes button { min-height: 34px; padding: 9px 16px; margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0; border: 1px solid transparent; border-radius: 7px; }
  .composer-modes button.on { background: var(--selected-bg); color: var(--selected-ink); border-color: var(--edge); box-shadow: var(--shadow-sm); }
  .composer-modes button:hover { background: var(--quiet-hover); color: var(--ink); }
  .searchbar { order: 2; }
  .searchbar .composer-field { width: 100%; }
  .searchbar textarea, .searchbar textarea.document-mode {
    min-height: 176px; max-height: 50vh; width: 100%; padding: 30px 56px 24px var(--composer-inset);
    font: 400 clamp(19px,1.6vw,24px)/1.55 var(--font-ui); letter-spacing: -.035em;
    border: 0; border-radius: 0; background: transparent; box-shadow: none;
    resize: vertical; overflow-y: auto;
  }
  .searchbar textarea::placeholder { color: var(--muted); opacity: 1; }
  .searchbar textarea:focus, .searchbar textarea:focus-visible { outline: none; box-shadow: none; }
  .searchbar textarea[aria-invalid="true"] { box-shadow: inset 3px 0 0 var(--bad); }
  .composer-field .composer-clear { top: 28px; right: 20px; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); color: var(--muted); }
  .composer-actions { order: 4; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin: 0; padding: 16px var(--composer-inset) 24px; }
  .composer-actions #askAskOpts { order: 1; flex: initial; min-width: 0; width: 100%; padding: 0; }
  .composer-actions label { display: block; font-size: 12px; line-height: 1.7; color: var(--muted); }
  .composer-actions label input { vertical-align: -3px; margin: 0 8px 0 0; }
  .composer-actions label span { font-size: 11px; }
  .composer-actions #goBtn { order: 2; align-self: flex-start; min-width: 134px; }
  button.go, .primary-command {
    min-height: 42px; padding: 12px 22px; border: 1px solid var(--edge); border-radius: 10px;
    background: var(--accent-strong); color: var(--accent-ink); font-size: 12px; font-weight: 600;
    letter-spacing: .005em; box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
  }
  button.go:hover:not(:disabled), .primary-command:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
  button.go:active:not(:disabled) { transform: translateY(0); }
  .cmdarea > .askopts { order: 3; margin: 0 0 4px; padding: 12px var(--composer-inset); border: 0; background: transparent; }
  .askopts-row { gap: 10px 14px; }
  .askopts label { line-height: 1.7; font-size: 12px; }
  .cmdarea .field-validation { padding: 12px var(--composer-inset); margin: 0; }
  .required-message > .ic { display: none; }
  .required-message { gap: 0; line-height: 1.65; }
  .intentline { margin-top: 16px; }
  .status { font-size: 12px; }
  .status:empty { margin: 0; }

  /* Suggested work stays readable and light, with generous horizontal rhythm. */
  .emptybox { margin-top: 36px; counter-reset: example; }
  .emptybox .elbl { margin: 0 0 14px 4px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .15em; }
  .exq {
    position: relative; width: 100%; max-width: none; min-height: 58px; margin: 0; padding: 16px 34px 16px 4px;
    display: flex; align-items: center; gap: 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    background: transparent; color: var(--muted); font: 400 13px/1.6 var(--font-ui); text-align: left;
  }
  .exq::before { counter-increment: example; content: counter(example,decimal-leading-zero); color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .04em; min-width: 19px; }
  .exq::after { content: ""; position: absolute; right: 8px; width: 5px; height: 5px; border-top: 1px solid var(--muted); border-right: 1px solid var(--muted); transform: rotate(45deg); }
  .exq:hover { background: var(--panel-bg); color: var(--ink); }

  /* Evidence reads as its own floating material plane. */
  .rail {
    position: sticky; top: calc(var(--topbar-h) + 16px); margin-top: 16px;
    height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 32px); min-height: 380px;
    padding: 0 18px 20px; border: 1px solid var(--line); border-radius: 16px;
    background: var(--panel-bg); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
  }
  .rail-controls { height: calc(var(--zone-head-h) - 17px); flex-shrink: 0; padding: 0; margin-bottom: 22px; border-bottom-color: var(--line); }
  .rail-collapse { top: 15px; }
  .rail-heading { min-height: 32px; gap: 10px; font-size: 12px; font-weight: 600; }
  .rail-heading .ic { width: 16px; height: 16px; color: var(--accent); }
  .rail-close-icon { transform: none; }
  .rail h4 { margin-bottom: 14px; font-size: 9px; }
  .rail .sub { font-size: 12px; line-height: 1.9; }
  .rail .ritem { padding: 14px 2px; margin-bottom: 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 12px; line-height: 1.6; }
  .rail .ritem:hover { color: var(--accent); background: var(--quiet-hover); }
  .rail .rgate { padding: 12px; border-radius: 9px; }
  .rail .rdiv { margin: 20px 0; }
  .rail-group > summary { flex-wrap: wrap; gap: 6px; font-size: 10px; letter-spacing: .04em; }
  .authority-name { font: 600 14px/1.55 var(--font-ui); }
  .evidence-quote { font: 400 14px/1.85 var(--font-serif); padding: 14px; border-left: 2px solid var(--accent); border-radius: 0 8px 8px 0; }

  /* Shared surfaces carry the same depth through results, tools and dialogs. */
  .card { padding: 24px; margin: 16px 0; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
  .card h2 { font-family: var(--font-ui); font-size: 18px; line-height: 1.4; font-weight: 600; letter-spacing: -.025em; margin-bottom: 12px; }
  .card .desc { margin-bottom: 20px; font-size: 13px; line-height: 1.75; }
  .card .head { gap: 10px; margin-bottom: 14px; }
  .card.expandable .head { width: calc(100% + 48px); margin: -24px -24px 18px; padding: 18px 24px; background: transparent; border-radius: 16px 16px 0 0; }
  .card.expandable .head:hover, .card.expanded .head { background: var(--surface-2); }
  .answer { border-left: 1px solid var(--line); }
  .answer .body { font-size: 15px; line-height: 1.85; overflow-wrap: anywhere; }
  .answer h3 { font-family: var(--font-ui); font-size: 17px; letter-spacing: -.025em; }
  .answer .body p { margin-bottom: 16px; }
  .answer .body h2 { font-size: 21px; margin-top: 24px; }
  .snippet { font-size: 13px; line-height: 1.8; }
  .cardfoot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
  .badge { border-radius: 6px; padding: 4px 8px; font-size: 10px; }
  .res-toolbar { gap: 8px; padding-block: 8px; }
  .res-toolbar button, .edactions button { min-height: 36px; font-size: 12px; border-radius: 8px; }
  .frm { gap: 14px; margin-block: 18px; }
  .frm textarea, .ed-comment-pop textarea, .fbform textarea {
    min-height: 185px; padding: 22px 24px; font: 400 15px/1.7 var(--font-ui);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); border-radius: 18px;
    background: var(--input-gradient), var(--glass);
    color: var(--ink); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
    resize: vertical; transition: border-color .2s ease, box-shadow .2s ease;
  }
  .ed-comment-pop textarea { min-height: 72px; padding: 12px 14px; font-size: 13px; line-height: 1.5; border-radius: 12px; }
  .fbform textarea { min-height: 64px; padding: 12px 14px; font-size: 13px; line-height: 1.55; border-radius: 12px; }
  .frm textarea:focus, .ed-comment-pop textarea:focus, .fbform textarea:focus {
    outline: none; border-color: var(--focus);
    box-shadow: 0 0 0 4px var(--focus-halo), inset 0 1px 0 var(--edge), var(--shadow-sm);
  }
  .frm input, .frm select, .matter-dialog input, .fbform select {
    min-height: 42px; border-color: color-mix(in srgb, var(--accent) 18%, var(--line)); background: var(--glass); box-shadow: inset 0 1px 0 var(--edge); transition: border-color .18s ease, box-shadow .18s ease;
  }
  .frm input:hover, .frm select:hover, .matter-dialog input:hover, .fbform select:hover,
  .frm textarea:hover, .ed-comment-pop textarea:hover, .fbform textarea:hover {
    border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  }
  .frm input:focus, .frm select:focus, .matter-dialog input:focus, .fbform select:focus {
    outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-halo), inset 0 1px 0 var(--edge);
  }
  .review-options {
    display: grid; grid-template-columns: minmax(150px,1.2fr) minmax(130px,1fr) minmax(138px,1.05fr) minmax(110px,.8fr) minmax(124px,.8fr);
    gap: 8px; width: 100%;
  }
  .review-options > * { min-width: 0; width: 100%; }
  .review-options input, .review-options select { min-height: 38px; padding: 9px 11px; font-size: 12px; border-radius: 9px; }
  .review-options .legal-date, .review-options .flatpickr-input + .legal-date { width: 100%; min-width: 0; }
  #panel > .card > .go { min-height: 38px; padding: 10px 16px; font-size: 11px; border-radius: 9px; }
  .csel-btn { min-height: 36px; border-color: var(--control-line); }
  .csel-pop { border-radius: 10px; padding: 5px; }
  .csel-opt { padding: 9px 10px; border-radius: 6px; }

  @media (max-width: 1280px) {
    .review-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }

  /* Calendar: the same floating glass surface as the command composer. */
  .flatpickr-calendar {
    width: 344px; max-width: calc(100vw - 24px); padding: 16px;
    border: 1px solid var(--edge); border-radius: 20px;
    background: var(--input-gradient), var(--glass);
    color: var(--ink); font: 400 13px/1.5 var(--font-ui); letter-spacing: -.01em;
    box-shadow: inset 0 1px 0 var(--edge), var(--shadow-pop);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  }
  .flatpickr-calendar::before, .flatpickr-calendar::after { display: none; }
  .flatpickr-calendar.animate.open { animation: spatial-calendar-enter .16s ease-out; }
  .flatpickr-months { margin-bottom: 12px; }
  .flatpickr-months .flatpickr-month {
    display: flex; align-items: center; height: 40px;
    background: transparent; color: var(--ink); overflow: visible;
  }
  .flatpickr-calendar .flatpickr-current-month {
    position: static; width: auto; height: 40px; flex: 1; min-width: 0;
    margin-inline: 36px; gap: 6px; padding: 0; font-size: 13px; font-weight: 600;
  }
  .flatpickr-current-month .csel:first-child { width: 122px; min-width: 0; }
  .flatpickr-current-month .csel-year-cal { width: 78px; flex-shrink: 0; }
  .flatpickr-current-month .csel-btn {
    min-height: 36px; padding: 9px 22px 9px 10px; border-radius: 8px;
    background: transparent; color: var(--ink); font: 600 13px/1.3 var(--font-ui);
  }
  .flatpickr-current-month .csel-year-cal .csel-btn { color: var(--muted); font-size: 12px; font-weight: 500; }
  .flatpickr-current-month .csel-btn:hover, .flatpickr-current-month .csel.open .csel-btn { background: var(--quiet-hover); }
  .flatpickr-current-month .csel-pop {
    max-height: 228px; padding: 6px; border: 1px solid var(--edge); border-radius: 12px;
    background: radial-gradient(ellipse at top left, var(--ambient), transparent 80%), var(--card);
    box-shadow: var(--shadow-pop);
  }
  .flatpickr-current-month .csel-opt { padding: 10px 12px; font-size: 12px; line-height: 1.5; }
  .flatpickr-current-month .csel-opt.on { background: var(--selected-bg); color: var(--selected-ink); }
  .flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month {
    display: grid; place-items: center; top: 2px; width: 34px; height: 36px; padding: 10px;
    border: 1px solid var(--line); border-radius: 9px; background: transparent;
    color: var(--muted); fill: currentColor;
    transition: background .16s ease, color .16s ease;
  }
  .flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: var(--quiet-hover); color: var(--ink); }
  .flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: currentColor; }
  .flatpickr-calendar .flatpickr-weekdays { height: 32px; margin-bottom: 6px; background: transparent; }
  .flatpickr-calendar .flatpickr-weekday { background: transparent; color: var(--muted); font: 500 10px/1.5 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
  .flatpickr-calendar .flatpickr-innerContainer, .flatpickr-calendar .flatpickr-rContainer { width: 100%; overflow: visible; }
  .flatpickr-calendar .flatpickr-days { width: 100%; overflow: visible; }
  .flatpickr-calendar .dayContainer {
    display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px;
    width: 100%; min-width: 0; max-width: none; padding: 0; transform: none;
  }
  .flatpickr-calendar .flatpickr-day {
    display: grid; place-items: center; width: 100%; max-width: none; height: 38px;
    margin: 0; border: 1px solid transparent; border-radius: 10px;
    color: var(--ink); background: transparent; font: 500 12px/1 var(--font-ui);
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
  }
  .flatpickr-calendar .flatpickr-day.prevMonthDay, .flatpickr-calendar .flatpickr-day.nextMonthDay { color: var(--muted); }
  .flatpickr-calendar .flatpickr-day.today { border-color: var(--focus); color: var(--accent); background: var(--focus-halo); }
  .flatpickr-calendar .flatpickr-day:hover, .flatpickr-calendar .flatpickr-day:focus { background: var(--quiet-hover); border-color: var(--line); color: var(--ink); }
  .flatpickr-calendar .flatpickr-day:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
  .flatpickr-calendar .flatpickr-day.selected,
  .flatpickr-calendar .flatpickr-day.selected:hover,
  .flatpickr-calendar .flatpickr-day.selected:focus {
    background: var(--accent-strong); border-color: var(--edge); color: var(--accent-ink);
    box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
  }
  .flatpickr-calendar .flatpickr-day.flatpickr-disabled,
  .flatpickr-calendar .flatpickr-day.flatpickr-disabled:hover,
  .flatpickr-calendar .flatpickr-day.notAllowed {
    background: transparent; border-color: transparent; color: var(--muted); opacity: .4; box-shadow: none;
  }
  @keyframes spatial-calendar-enter {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
  }
  .document-choice { margin-top: 28px; padding-top: 20px; }
  .choice-grid { gap: 10px; margin-top: 16px; }
  .choice-grid button { min-height: 52px; padding: 14px; border-radius: 10px; font-size: 12px; background: var(--panel-bg); }
  .catalog-head { border: 0; padding-bottom: 24px; }
  .catalog-search { border-radius: 10px; padding-inline: 12px; }
  .catalog-search input { height: 42px; }
  .catalog-search:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
  .workflow-phase + .workflow-phase { margin-top: 28px; }
  .workflow-phase .section-label { margin-bottom: 12px; }
  .workflow-list { display: block; }
  .workflow-row { grid-template-columns: 34px minmax(0,1fr) auto auto; min-height: 74px; padding: 16px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; gap: 12px; }
  .workflow-row:hover { background: var(--panel-bg); }
  .workflow-copy strong { font-size: 13px; font-weight: 500; line-height: 1.5; }
  .workflow-copy small { font-size: 11px; line-height: 1.6; margin-top: 4px; }
  .workflow-icon { border: 0; border-radius: 9px; background: var(--surface-2); color: var(--accent); }
  .workflow-planned:hover { background: transparent; }
  .history-row { min-height: 62px; padding: 14px 8px; }
  .history-row strong { font-size: 12px; font-weight: 500; }
  .history-head { font-size: 9px; min-height: 38px; letter-spacing: .10em; }
  .empty-state { padding: 50px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-bg); }
  .empty-state h2 { font-family: var(--font-ui); font-size: 22px; letter-spacing: -.03em; margin-bottom: 12px; }
  .empty-state p { line-height: 1.8; }
  .matter-toolbar { padding-bottom: 20px; }
  .matter-list { padding-top: 20px; }
  .matter-row { border-radius: 9px; padding: 12px; }
  .matter-row.on { background: var(--selected-bg); border-color: var(--line); }
  .matter-row strong { font-size: 12px; line-height: 1.5; }
  .matter-row span { font-size: 10px; line-height: 1.6; }
  .matter-detail { padding: 24px; }
  .matter-detail h2 { font-family: var(--font-ui); font-size: 18px; line-height: 1.4; letter-spacing: -.025em; overflow-wrap: anywhere; }
  .matter-tabs { margin-top: 24px; }
  .matter-tabs button { padding: 12px; font-size: 12px; }
  .matter-summary-grid { border: 0; background: var(--panel-bg); padding: 16px; border-radius: 12px; }
  .matter-summary-grid > div { background: transparent; padding: 6px; }
  .matter-summary-grid strong { font-size: 25px; font-family: var(--font-ui); font-weight: 500; }
  .matter-summary-grid span { line-height: 1.7; font-size: 9px; letter-spacing: .04em; }
  .check-summary { margin: 22px 0 16px; }
  .check-toolbar { padding-block: 14px; flex-wrap: wrap; }
  .check-table td { padding-block: 16px; line-height: 1.75; }
  .check-table th { font-size: 10px; padding-block: 12px; letter-spacing: .05em; }
  .evidence-link { min-height: 32px; line-height: 1.6; }
  .edactions { gap: 8px; padding-bottom: 12px; }
  .sun-editor { border-radius: 12px; box-shadow: var(--shadow-md); }
  .sun-editor-editable { padding: 40px 48px !important; }
  .matter-dialog { border: 1px solid var(--edge); border-radius: 20px; background: var(--glass); box-shadow: var(--shadow-pop); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
  .matter-dialog form { padding: 28px; }
  .dialog-head h2 { font-family: var(--font-ui); font-size: 23px; letter-spacing: -.035em; }
  .login-note { font-size: 13px; line-height: 1.8; }
  .login-dialog label { margin-top: 20px; }
  .login-dialog .dialog-actions { margin-top: 24px; }
  .login-dialog .dialog-actions .go { width: 100%; }
  .legal-head { padding: 24px; }
  .legal-body { padding: 0 24px 24px; }
  .legal-body p { font-size: 13px; line-height: 1.85; }
  .palette { border-color: var(--edge); border-radius: 16px; background: var(--glass); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
  .palette input { background: transparent; padding: 20px; }
  .palette .pl { padding: 6px; }
  .palette .pl .row { padding: 13px; border-radius: 8px; font-size: 13px; }
  .palette-shortcut .shortcut-keycap, .workflow-shortcut .shortcut-keycap { font: 10px/1.4 var(--font-ui); }

  footer.disc {
    /* --footer-h is measured by syncFooterHeight; never feed it back into sizing. */
    min-height: var(--footer-min-h); padding: 10px 22px; display: flex; align-items: center; gap: 18px;
    background: var(--chrome); color: var(--muted); border-top: 1px solid var(--line);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  }
  footer.disc .disc-ai { display: none; }
  .disc-ai .ic { color: var(--brass-ink); margin-right: 4px; }
  .disc-legal { justify-content: center; font-size: 9px; gap: 4px 7px; line-height: 1.7; }
  .disc-legal button, .disc-copy, .disc-sep { color: var(--muted); }
  .disc-legal button:hover { color: var(--ink); }

  @media (max-width: 1250px) {
    :root { --sidebar-w: 200px; --rail-w: 238px; --workspace-gap: 24px; }
    .topbar .brand { padding-left: 18px; font-size: 20px; }
    .identity-chip { max-width: 270px; }
    .workspace-context { max-width: 230px; font-size: 10px; }
  }
  @media (min-width: 1121px) {
    .contentgrid.rail-collapsed { grid-template-columns: minmax(0,1fr) 54px; }
    .disc-ai { white-space: nowrap; }
    .disc-legal { flex-wrap: nowrap; white-space: nowrap; }
  }
  @media (max-width: 1120px) {
    :root { --footer-h: 74px; --footer-min-h: 74px; }
    .contentgrid { grid-template-columns: minmax(0,1fr); padding-right: var(--workspace-gap); }
    .rail {
      position: fixed; top: calc(var(--topbar-h) + 12px); bottom: calc(var(--footer-h) + 12px); right: 12px;
      width: min(370px,calc(100vw - 24px)); height: auto; min-height: 0; margin: 0; padding: 18px;
      background: var(--glass); border: 1px solid var(--line); border-radius: 16px;
      box-shadow: inset 0 1px 0 var(--edge), var(--shadow-pop); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
      transform: translateX(calc(100% + 24px));
    }
    .rail.open { transform: translateX(0); }
    .rail-top { min-height: 44px; font-size: 14px; margin-bottom: 22px; padding-bottom: 14px; }
    .rail-top { position: static; padding-left: 0; }
    .rail-top .rail-top-close { left: -12px; top: 15px; width: 24px; height: 26px; min-width: 0; min-height: 0; justify-content: center; align-items: center; }
    .rail-scrim { top: var(--topbar-h); bottom: var(--footer-h); }
    .workspace-floating-actions {
      position: fixed; right: 20px; bottom: calc(var(--footer-h) + 16px); z-index: 50;
      display: flex; align-items: center; gap: 8px;
    }
    .workspace-floating-actions .evidence-toggle,
    .workspace-floating-actions #backToAnswer {
      position: static; display: inline-flex; align-items: center; gap: 6px; height: 44px; box-sizing: border-box; padding: 12px 16px;
      background: var(--card); color: var(--ink); border: 1px solid var(--control-line);
      border-radius: 10px; box-shadow: var(--shadow-pop); cursor: pointer;
      font: 500 var(--fs-12) var(--font-ui);
      transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
    }
    .workspace-floating-actions .evidence-toggle:hover,
    .workspace-floating-actions #backToAnswer:hover { background: var(--quiet-hover); color: var(--accent); border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
    .workspace-floating-actions .evidence-toggle:active,
    .workspace-floating-actions #backToAnswer:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
    .workspace-floating-actions .evidence-toggle:focus-visible,
    .workspace-floating-actions #backToAnswer:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
    footer.disc { flex-direction: column; gap: 4px; padding: 10px 20px; }
    footer.disc .disc-ai { display: none; }
    .disc-legal { justify-content: center; }
  }
  @media (max-width: 880px) {
    :root { --workspace-gap: 24px; --zone-head-h: 90px; }
    header.topbar, body.left-nav-collapsed header.topbar { display: grid; grid-template-columns: minmax(0,1fr) 34px auto; padding: 12px 20px; gap: 10px; }
    .topbar .brand, body.left-nav-collapsed .topbar .brand { padding: 0; justify-content: flex-start; }
    .cmdk-hint { width: 34px; height: 34px; font-size: 0; padding: 8px; margin: 0; }
    .cmdk-hint kbd { display: none; }
    .cmdk-hint .ic { width: 16px; height: 16px; }
    .topbar .topmeta { padding: 0; gap: 8px; }
    .top-action { font-size: 0; width: 34px; padding: 8px; justify-content: center; }
    .top-action .ic { width: 16px; height: 16px; }
    .shell, .shell.left-collapsed { display: block; }
    .sidenav { display: none; }
    .contentgrid { padding: 0 var(--workspace-gap); }
    .workmain { padding-bottom: calc(84px + var(--footer-h)); }
    .workspace-context { max-width: min(280px,40vw); }
    .mobile-nav { height: 64px; bottom: var(--footer-h); background: var(--chrome); border-top-color: var(--line); padding: 4px 6px env(safe-area-inset-bottom,0px); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
    .mobile-nav button { margin: 2px; border: 0; border-radius: 9px; font-size: 10px; gap: 5px; }
    .mobile-nav button.on { background: var(--selected-bg); color: var(--selected-ink); }
    .workspace-floating-actions { bottom: calc(80px + var(--footer-h)); }
    .rail { bottom: calc(76px + var(--footer-h)); }
    .rail-scrim { bottom: calc(64px + var(--footer-h)); }
    :root:has(.identity-chip:not([hidden])) { --topbar-h: 64px; }
    header.topbar:has(.identity-chip:not([hidden])) { row-gap: 0; }
    header.topbar:has(.identity-chip:not([hidden])) .cmdk-hint { grid-column: auto; justify-self: auto; }
    header.topbar:has(.identity-chip:not([hidden])) .topmeta { display: flex; grid-column: auto; grid-template-columns: none; border-top: 0; padding-top: 0; }
    .identity-chip { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; justify-content: center; }
    .identity-chip .ic { width: 17px; height: 17px; }
    .identity-name, .identity-role, .identity-logout { display: none; }
    .sun-editor-editable { padding: 28px 24px !important; }
    .matter-detail { padding: 24px 0; }
  }
  @media (max-width: 620px) {
    :root { --workspace-gap: 16px; }
    .workspace-head { gap: 10px; margin-bottom: 18px; }
    .workspace-head h1 { font-size: 21px; }
    .workspace-context { max-width: 42vw; padding: 6px 8px; font-size: 10px; }
    .review-options { grid-template-columns: 1fr 1fr; }
    .review-options > :first-child { grid-column: 1 / -1; }
    /* Search filters use a compact two-column rhythm on narrow screens. */
    .askopts-search { width: 100%; gap: 14px; }
    .askopts-search > .askopts-row {
      display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
      align-items: stretch; gap: 10px 12px; width: 100%;
    }
    .askopts-search > .askopts-row > label {
      display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
      min-width: 0; gap: 7px; white-space: nowrap; line-height: 1.35;
    }
    .askopts-search > .askopts-row > label:nth-of-type(3) { grid-column: 1; }
    .askopts .csel-court, .askopts .csel-year { width: 100%; max-width: none; min-width: 0; }
    .askopts-search > .askopts-row .csel-btn { min-width: 0; padding-inline: 8px 24px; }
    .askopts-search > .askopts-row .csel-label { overflow: hidden; text-overflow: ellipsis; }
    .askopts-search .askopts-pv {
      display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center;
      width: 100%; min-height: 24px; padding-left: 0; gap: 10px;
      line-height: 1.55; font-size: 11px; white-space: normal;
    }
    .askopts-search .askopts-pv input { position: static; margin: 0; }
    .askopts-search .askopts-pv .check-copy { display: block; font-size: inherit; line-height: inherit; }
    .askopts-search .askopts-pv .check-copy > span { display: inline; font-size: inherit; line-height: inherit; }
    .cmdarea { --composer-inset: 20px; border-radius: 18px; }
    .cmdarea::before { inset-inline: 0; }
    .composer-modes { margin: 12px 12px 0; gap: 2px; padding: 3px; }
    .composer-modes button { padding: 9px 12px; font-size: 11px; }
    .searchbar textarea, .searchbar textarea.document-mode { min-height: 184px; padding: 26px 48px 22px var(--composer-inset); font-size: 20px; }
    .composer-field .composer-clear { right: 16px; top: 24px; }
    .composer-actions { padding-bottom: 20px; }
    .composer-actions #askAskOpts label {
      display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center;
      gap: 10px; line-height: 1.55;
    }
    .composer-actions #askAskOpts label input { margin: 0; }
    .composer-actions #goBtn { width: 100%; min-height: 44px; }
    .composer-actions label { font-size: 11px; }
    .composer-actions label span { font-size: 10px; }
    .emptybox { margin-top: 30px; }
    .exq { font-size: 12px; padding-block: 15px; gap: 12px; }
    .card { padding: 18px; }
    .card h2 { font-size: 19px; }
    .card.expandable .head { margin: -18px -18px 14px; padding: 14px 18px; width: calc(100% + 36px); }
    .answer-head { flex-direction: column; gap: 8px; }
    .answer-disclosure .disc-ai { justify-content: flex-start; font-size: 11px; }
    .answer .body { font-size: 14px; }
    .workflow-row { padding: 14px 4px; gap: 8px; grid-template-columns: 30px minmax(0,1fr) auto auto; }
    .workflow-copy strong { font-size: 12px; }
    .workflow-icon { width: 28px; }
    .wf-state { font-size: 9px; padding: 2px 6px; }
    .history-row { grid-template-columns: 62px minmax(0,1fr) 62px; gap: 8px; font-size: 11px; }
    .matter-dialog form { padding: 24px 20px; }
    .dialog-head h2 { font-size: 21px; }
    .check-counts { flex-wrap: wrap; }
    .legal-head { padding: 20px; }
    .legal-body { padding: 0 20px 20px; }
    .legal-dl { grid-template-columns: 1fr; }
    .empty-state { padding: 36px 20px; }
    .workspace-floating-actions .evidence-toggle, .workspace-floating-actions #backToAnswer {
      width: 44px; height: 44px; padding: 0; justify-content: center; gap: 0; font-size: 0;
      border-radius: 12px;
    }
    .workspace-floating-actions .evidence-toggle .ic, .workspace-floating-actions #backToAnswer .ic { width: 18px; height: 18px; }
  }
  @media (max-width: 520px) {
    .topbar .brand { font-size: 20px; }
    .topbar .brand-logo { width: 30px; height: 30px; }
    footer.disc { padding: 8px 14px; }
    footer.disc .disc-ai { display: none; }
    .disc-legal { font-size: 9px; gap: 2px 5px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
  }
  @media (forced-colors: active) {
    .cmdarea, .rail, .sidenav .item.on, .composer-modes button.on, button.go { border: 1px solid CanvasText; }
  }

  /* Latest workspace refinements: the response notice, actions, and account stay compact. */
  .workspace-floating-actions[hidden] { display: none !important; }
  .answer-head { align-items: center; }
  .answer-head > h3 { font-weight: 700; }
  .answer-disclosure .disc-ai {
    display: block; margin: 0; padding: 5px 8px; border-radius: 6px;
    background: var(--warn-bg); color: var(--warn); font-size: 11px; line-height: 1.38;
  }
  .sidenav .current-matter { display: flex; align-items: center; }
  .sidenav .current-matter .ic { width: 16px; height: 16px; color: inherit; }
  .sidenav .current-matter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .identity-chip { position: relative; display: inline-flex; padding: 0; }
  .identity-trigger {
    display: inline-flex; align-items: center; min-height: 34px; min-width: 0; gap: 8px;
    border: 0; border-radius: inherit; background: transparent; color: inherit; cursor: pointer;
    padding: 0 10px; font: inherit; text-align: left;
  }
  .identity-trigger:hover { background: var(--quiet-hover); }
  .identity-trigger .identity-chevron { width: 12px; height: 12px; color: var(--muted); transform: rotate(90deg); }
  .identity-trigger[aria-expanded="true"] .identity-chevron { transform: rotate(-90deg); }
  .identity-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 90; min-width: 132px;
    padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
    box-shadow: var(--shadow-pop);
  }
  .identity-menu[hidden] { display: none; }
  .identity-menu .identity-logout {
    display: flex; align-items: center; width: 100%; min-height: 34px; padding: 7px 9px;
    border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: 500 var(--fs-12)/1 var(--font-ui); text-align: left;
  }
  .identity-menu .identity-logout:hover { background: var(--quiet-hover); color: var(--accent); }

  :root { --footer-h: 42px; --footer-min-h: 42px; --zone-head-h: 74px; }
  .workspace-head { min-height: var(--zone-head-h); padding: 12px 0; margin: 0 0 16px; }
  .workspace-context {
    min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
    color: var(--ink); font-size: 12px; font-weight: 600; box-shadow: none;
  }
  .workspace-context > .workspace-matter-name {
    min-width: 0; max-width: min(360px, 44vw); overflow: hidden; text-align: right;
    color: var(--ink); font: 500 14px/1.4 var(--font-ui); letter-spacing: -.015em;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .workspace-context.is-empty {
    min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
    color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; box-shadow: none;
  }
  .workspace-context.is-empty > span { display: inline-flex; align-items: center; gap: 7px; max-width: none; }
  .workspace-context.is-empty > span::before {
    content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); opacity: .65;
  }
  footer.disc { min-height: var(--footer-min-h); padding: 0 16px; }
  .disc-legal { flex-wrap: nowrap; white-space: nowrap; line-height: 1.3; }

  @media (max-width: 1250px) {
    .workspace-context { max-width: min(330px, 46vw); font-size: 12px; }
  }
  @media (max-width: 1120px) {
    :root { --footer-h: 42px; --footer-min-h: 42px; }
    footer.disc { flex-direction: row; padding: 0 16px; }
    .disc-legal { flex-wrap: nowrap; white-space: nowrap; }
  }
  @media (max-width: 880px) {
    :root { --zone-head-h: 76px; }
    .identity-chip { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
    .identity-trigger { width: 34px; height: 34px; min-height: 34px; justify-content: center; padding: 0; }
    .identity-trigger .identity-chevron, .identity-trigger .identity-name { display: none; }
    #identityChip .identity-menu .identity-logout { display: flex; }
    .mobile-nav { overflow: visible; }
    .mobile-asof-control {
      position: absolute; top: 0; left: 50%; z-index: 3; display: flex; align-items: center; gap: 4px;
      padding: 0 4px; transform: translate(-50%, -50%); border-radius: 10px; background: var(--chrome);
      box-shadow: 0 0 0 5px var(--chrome);
    }
    .mobile-nav .mobile-asof-chip {
      width: auto; min-width: 0; min-height: 28px; margin: 0; padding: 5px 8px; flex-direction: row; gap: 5px;
      border: 1px solid var(--control-line); border-radius: 8px; font: 600 10px/1 var(--font-ui); white-space: nowrap;
      box-shadow: inset 0 1px 0 var(--edge), var(--shadow-sm);
    }
    .mobile-nav .mobile-asof-chip { background: var(--card); color: var(--ink); }
    .mobile-nav .mobile-asof-chip .ic { width: 13px; height: 13px; color: var(--accent); }
  }
  @media (max-width: 620px) {
    :root { --footer-h: 52px; --footer-min-h: 52px; }
    footer.disc { padding: 5px 12px; }
    .disc-legal { flex-wrap: wrap; white-space: normal; line-height: 1.25; }
    .workspace-head { margin-bottom: 14px; }
    .workspace-context { min-height: 0; padding: 0; font-size: 10px; }
    .workspace-context > .workspace-matter-name { max-width: 42vw; font-size: 12px; }
  }

  /* Final alignment pass: one shared header baseline and balanced panel insets. */
  .shell.left-collapsed .sidenav .current-matter { display: none; }
  .sidenav {
    top: calc(var(--topbar-h) + 4px);
    height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 8px);
    margin: 4px 0;
  }
  .sidenav-top,
  .shell.left-collapsed .sidenav-top { height: calc(var(--zone-head-h) - 5px); }
  @media (min-width: 1121px) {
    .rail {
      top: calc(var(--topbar-h) + 4px);
      height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 8px);
      margin-top: 4px;
    }
    .rail-controls { height: calc(var(--zone-head-h) - 5px); }
  }

  /* Compact notice: centred above the answer label, quiet but always legible. */
  .answer-head { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 8px; }
  .answer-head > h3 { grid-row: 2; justify-self: start; margin: 0; }
  .answer-disclosure { grid-row: 1; justify-self: center; min-width: 0; max-width: 100%; }
  .answer-disclosure .disc-ai {
    display: inline-block; width: fit-content; max-width: 100%; margin: 0; padding: 6px 9px;
    border-radius: 8px; background: var(--warn-bg); color: var(--warn);
    box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-12); font-weight: 500; line-height: 1.35;
  }

  /* Search filters stay compact and share one control width whenever space allows. */
  .askopts-search { width: min(100%, 528px); gap: 10px; }
  .askopts-search > .askopts-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 168px));
    align-items: end; gap: 8px 12px; width: fit-content; max-width: 100%;
  }
  .askopts-search > .askopts-row > .search-filter-field {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px;
    min-width: 0; line-height: 1.35; white-space: normal;
  }
  .askopts-search .search-year-from { grid-column: 1; grid-row: 1; }
  .askopts-search .search-year-to { grid-column: 2; grid-row: 1; }
  .askopts-search .search-court-field { grid-column: 3; grid-row: 1; }
  .askopts-search .csel-court,
  .askopts-search .csel-year { width: 100%; max-width: none; min-width: 0; }
  .askopts-search .search-court-field .csel-pop {
    width: max-content; min-width: 100%; max-width: min(320px, calc(100vw - 32px));
  }
  .askopts-search .search-court-field .csel-opt { overflow: hidden; text-overflow: ellipsis; }
  .askopts-search .fclear { grid-column: 3; grid-row: 2; align-self: center; justify-self: start; }
  .search-filter-field:has(select[aria-invalid="true"]) .csel-btn { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-bg); }
  .search-filter-error {
    grid-column: 1 / 3; grid-row: 2; width: 100%; margin: 0; padding: 0;
  }
  .search-filter-error .required-message { align-items: center; margin: 0; }
  .search-filter-error .required-message .ic { display: none; }
  .search-filter-error[hidden] { display: none; }

  /* A hidden return action must stay hidden even inside the shared action group. */
  .workspace-floating-actions #backToAnswer[hidden] { display: none !important; }
  @media (max-width: 1120px) {
    .rail {
      top: calc(var(--topbar-h) + 8px); bottom: calc(var(--footer-h) + 8px);
      height: auto; margin: 0;
    }
  }
  @media (max-width: 620px) {
    .askopts-search { width: 100%; }
    .askopts-search > .askopts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
    .askopts-search .search-court-field { grid-column: 1; grid-row: 2; }
    .askopts-search .fclear { grid-column: 2; grid-row: 2; align-self: center; }
    .askopts-search > .askopts-row:has(.search-filter-error:not([hidden])) .search-court-field { grid-row: 3; }
    .askopts-search > .askopts-row:has(.search-filter-error:not([hidden])) .fclear { grid-row: 3; }
  }

  /* Annotated follow-up: keep the active composer frame and streamed answer
     start within the visible reading area. */
  .cmdarea { scroll-margin: calc(var(--topbar-h) + 12px) 0 calc(var(--footer-h) + 16px); }
  .matter-source-add {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 38px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
    background: var(--surface-2); color: var(--ink); cursor: pointer; font: 500 12px/1 var(--font-ui);
  }
  .matter-source-add:hover { border-color: var(--accent); background: var(--quiet-hover); color: var(--accent); }
  .matter-source-add .ic { width: 16px; height: 16px; }
  .answer-pending,
  .answer-disclosure { scroll-margin-top: calc(var(--topbar-h) + 12px); }
  .answer-pending .answer-head { margin-bottom: 12px; }
  .answer-pending .answer-head > h3 { grid-row: 1; }
  .answer-pending .progressbox { border-left: 0; padding: 0; }

  /* One deliberate visual gap per legal paragraph in both legal surfaces. */
  #lawpop .body > br + strong,
  .law-diff-grid section > div > br + strong { display: inline-block; margin-top: .8em; }

  /* Source entry is browser-local, visibly adjacent to the current matter. */
  .matter-sources { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 14px; }
  .matter-sources p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

  /* Law Explorer reads as a four-column query strip on desktop: every field
     shares the same measure, and native input truncation keeps long values
     inside the control. */
  .law-query {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
  }
  .law-query .law-number-field,
  .law-query .date-field { width: auto; min-width: 0; }
  .law-query #cz-zakon,
  .law-query #cz-par,
  .law-query #cz-date,
  .law-query #cz-fulltext {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .law-query .flatpickr-input + .legal-date { width: 100%; min-width: 0; }
  .law-query > .go { grid-column: 1 / -1; justify-self: start; }

  /* Filter rows use their own inset so labels, counts, and the action do not
     sit against the floating surface edge. */
  .rail-filter-pop { min-width: 250px; padding: 10px; }
  .rfrow { gap: 10px; padding: 7px 4px; }
  .rfrow label { line-height: 1.45; }
  .rail-filter-apply { min-height: 30px; margin: 8px 4px 2px; padding-inline: 12px; }
  @media (max-width: 620px) {
    .matter-sources { align-items: stretch; }
    .matter-source-add { width: 100%; }
    .law-query { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 390px) {
    .law-query { grid-template-columns: minmax(0, 1fr); }
  }
}

@media (max-width: 420px) {
  .docview .dochead .dochead-row { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
}

/* The source filter is a floating surface. Keep its complete form inside the
   visible viewport even when the evidence rail itself is narrow. */
.rail-filter-pop { width: 100%; min-width: 0; max-width: 100%; }
.rail-filter-pop .rfrow { align-items: flex-start; }
.rail-filter-pop .rfrow label { align-items: flex-start; overflow-wrap: anywhere; }

/* The notice is moved into the answer for every completed run. Its direct
   scroll target must clear the fixed top bar, not just its parent container. */
#discAi { scroll-margin-top: calc(var(--topbar-h) + 12px); }

/* Follow-up: the composer remains a complete framed surface while its content
   scrolls behind the fixed app chrome. */
.cmdarea { position: relative; isolation: isolate; overflow: clip; border-bottom: 1px solid var(--line); }
.cmdarea::after { content:""; position:absolute; z-index:2; left:0; right:0; bottom:0; height:1px; background:var(--line); pointer-events:none; }
#discAi { text-align:center; }
.edactions .primary.saved { background:var(--good-bg); border-color:var(--good); color:var(--good); }
@media (max-width:620px) { .cmdarea { overflow: clip; } }
/* While streaming, progress is the stable answer header; draft text grows below it. */
#askProg.answer-pending { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 3; }
/* Paint the complete composer frame above adjacent cards even during scroll. */
.cmdarea::after { inset:0; width:auto; height:auto; border:1px solid var(--edge); border-radius:inherit; background:transparent; }
#askProg.answer-pending { position:sticky; top:calc(var(--topbar-h) + 8px); }
