/* BUKA — design handoff "BUKA visual restyle" (7 Oct 2026).
   Warm paper, charcoal ink, one orange-red accent, one grotesk. Square corners, 1–2 px rules instead of cards
   and shadows. Layout: a 280 px sidebar beside the page; sections are a 240 px head column beside the content.
   Status is never colour only: text, plus a square marker for failures and the verdict. */

@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("../fonts/hanken-grotesk-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Hanken Grotesk";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("../fonts/hanken-grotesk-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --paper: #EEE5D2;
    --ink: #2A2925;
    --ink-2: #4F4A42;
    --muted: #5E594F;
    --placeholder: #8A8374;
    --rule-light: #CFC4AC;
    --accent: #C8391A;
    /* Only for the verdict of a project that passes (user request; the handoff has no green). */
    --pass: #3B7A3C;
    --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    /* Vertical rhythm: metadata row → hero gap → H1 → content gap → content; sections are apart by the section gap. */
    --gap-hero: 96px;
    --gap-content: 72px;
    --gap-section: 96px;
    --gap-footer: 160px;
    color-scheme: light;
}

.page.hero {
    --gap-hero: 180px;
    --gap-content: 120px;
    --gap-section: 140px;
    --gap-footer: 200px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; transition: color 120ms; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { text-wrap: balance; }
h2 { margin: 0 0 20px; font-size: 30px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.1; }
h3 { margin: 40px 0 16px; font-size: 18px; font-weight: 500; line-height: 1.3; }
h4 { margin: 24px 0 8px; font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
p { margin: 8px 0; }
ol, ul { padding-left: 1.2em; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.5; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
.fail-text { color: var(--accent); }
.text-danger { color: var(--accent); }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Text fields show focus with their accent underline (below), not with a box. */
input:not([type="checkbox"]):not([type="radio"]):focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }

.sidebar { border-right: 1px solid var(--ink); padding: 40px 32px; display: flex; flex-direction: column; gap: 64px; min-width: 0; }
.brand-block { display: flex; flex-direction: column; gap: 8px; }
.brand { font-size: 22px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink); }
.brand:hover { color: var(--accent); }
.brand-sub { font-size: 12px; line-height: 1.5; color: var(--muted); }

.nav { display: flex; flex-direction: column; border-bottom: 1px solid var(--rule-light); }
.nav .tab { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--rule-light); color: var(--ink); font-size: 16px; }
.nav .tab.group { border-top-color: var(--ink); }
.nav .tab .index { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .tab .count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .tab:hover .label { color: var(--accent); }
.nav .tab.active { font-weight: 600; }
.nav .tab.active .index { color: var(--accent); font-weight: 600; }
.nav .tab.active:hover .label { color: var(--ink); }
.nav .marker { width: 8px; height: 8px; background: var(--accent); align-self: center; }

/* The items of the active tab (rooms, elements …), under the tab in the sidebar. */
.side-list { padding: 0 0 16px 30px; }
.list { display: flex; flex-direction: column; }
.list a { display: grid; grid-template-columns: minmax(0, 1fr) 8px; column-gap: 12px; padding: 9px 0; border-top: 1px solid var(--rule-light); color: var(--ink); font-size: 14px; line-height: 1.35; }
.list a:first-child { border-top: 0; }
.list a:hover { color: var(--accent); }
.list a .sub { grid-column: 1; display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.list a.active { font-weight: 600; }
.list a.active::after { content: ""; grid-column: 2; grid-row: 1; width: 8px; height: 8px; background: var(--accent); align-self: center; }
.list a.active .sub { font-weight: 400; }
.list a.add { color: var(--accent); font-weight: 400; }
.list a.add:hover { color: var(--ink); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.sidebar-foot a { color: var(--ink); }
.sidebar-foot a:hover { color: var(--accent); }

/* ---------- Page ---------- */

.page { padding: 40px 64px 120px; display: flex; flex-direction: column; min-width: 0; }
.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.meta-right { display: flex; gap: 24px; flex-wrap: wrap; }
.meta a { color: var(--ink); }
.meta a:hover { color: var(--accent); }
.page-title { margin: var(--gap-hero) 0 0; font-size: clamp(56px, 7.2vw, 104px); font-weight: 500; letter-spacing: -0.04em; line-height: 0.92; max-width: 16ch; }
.page.hero .page-title { max-width: none; }
.lead { margin: 28px 0 0; max-width: 640px; font-size: 18px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.page-body { margin-top: var(--gap-content); min-width: 0; }
.app-footer { margin-top: auto; padding-top: var(--gap-footer); }
.app-footer > div { max-width: 820px; border-top: 1px solid var(--rule-light); padding-top: 12px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* Lettered sections: a head column (letter, title, sub-label) beside the content, under a 1 px ink rule. */
.section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; border-top: 1px solid var(--ink); padding-top: 16px; margin-top: var(--gap-section); }
.page-body > .section:first-child { margin-top: 0; }
.section-head { display: flex; flex-direction: column; gap: 10px; }
.section-head h2 { margin: 0; }
.section-letter { font-size: 12px; font-weight: 600; color: var(--accent); }
.section-sub { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.section-body { min-width: 0; }

/* Blocks of the working tabs: a 1 px ink rule on top instead of a card. */
.card { border-top: 1px solid var(--ink); padding-top: 16px; min-width: 0; }
.card + .card, .card + .actions + .card { margin-top: 64px; }
.page-body > .card:first-child { margin-top: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
details.card > summary { cursor: pointer; list-style: none; font-size: 18px; font-weight: 500; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: " ↓"; }
details.card[open] > summary::after { content: " ↑"; }
details.card[open] > summary { margin-bottom: 16px; }

/* Columns that each start under a 2 px ink rule (new project, LLM steps). */
.columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; }
.column { display: flex; flex-direction: column; gap: 20px; border-top: 2px solid var(--ink); padding-top: 16px; min-width: 0; }
.column-title { font-size: 18px; font-weight: 500; }
.column > form { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.column .push { margin-top: auto; padding-top: 8px; }
.column-text { margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.section.after-stats { margin-top: calc(var(--gap-hero) - var(--gap-content)); }

/* Plain rows under a 1 px ink rule (lists of text). */
ul.rows { list-style: none; margin: 0; padding: 0; max-width: 820px; }
ul.rows li { padding: 14px 0; border-bottom: 1px solid var(--rule-light); font-size: 16px; line-height: 1.5; }
ul.rows li:first-child { padding-top: 0; }

/* Two signer tables side by side (Dio 9). */
.signers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.signers .column-title { padding-bottom: 16px; }
.signers > p { grid-column: 1 / -1; margin: 8px 0 0; }

/* ---------- Forms ---------- */

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 32px; row-gap: 32px; }
.fields .wide { grid-column: 1 / -1; }
.fields.six { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 44px; }
.fields.six > .span-2 { grid-column: span 2; }
.fields.six > .span-3 { grid-column: span 3; }
.fields.six > .span-6, .fields.six > .wide { grid-column: span 6; }

/* Field labels keep their case: many hold units and symbols (m³, dB, δ, L′n,w) that uppercase would change.
   Labels of plain words get "caps", as in the design. */
/* space-between: when one label of a row wraps, the inputs of the row still share one line. */
label.field { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; font-size: 13px; font-weight: 500; letter-spacing: 0.02em; line-height: 1.3; color: var(--ink-2); min-width: 0; }
.caps label.field, label.field.caps, .caps th, th.caps { text-transform: uppercase; letter-spacing: 0.06em; }
.help { margin: 8px 0 0; max-width: 680px; font-size: 14px; line-height: 1.5; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; font-size: 16px; line-height: 1.35; color: var(--ink); cursor: pointer; }
label.check input { flex: none; }

input, select, textarea { font: inherit; font-size: 18px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; padding: 6px 0 10px; min-width: 0; outline: none; width: 100%; transition: border-color 120ms, box-shadow 120ms; }
input:focus, select:focus, textarea:focus { border-bottom-color: var(--accent); box-shadow: inset 0 -1px 0 var(--accent); }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[readonly] { color: var(--ink-2); }
select { appearance: none; -webkit-appearance: none; padding-right: 24px; cursor: pointer; }
label.field:has(> select)::after, td:has(> select)::after { content: "↓"; position: absolute; right: 0; pointer-events: none; font-size: 16px; font-weight: 400; color: var(--ink); text-transform: none; }
label.field:has(> select)::after { bottom: 11px; }
textarea { border-top: 1px solid var(--rule-light); padding: 10px 0; resize: vertical; line-height: 1.5; }

input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; padding: 0; margin: 0; border: 1px solid var(--ink); background: transparent; flex: none; cursor: pointer; vertical-align: -2px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--ink); box-shadow: inset 0 0 0 3px var(--paper); }
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }
input[type="checkbox"]:checked:focus { box-shadow: inset 0 0 0 3px var(--paper); }

/* File picker: the native control is hidden; the label shows the file name like an underlined field. */
.field-label { font-size: 13px; font-weight: 500; letter-spacing: 0.06em; line-height: 1.3; text-transform: uppercase; color: var(--ink-2); }
.file-pick { position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.file-pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-pick .file-field { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ink); padding: 6px 0 10px; font-size: 18px; }
.file-pick .file-name { color: var(--placeholder); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick .file-name.chosen { color: var(--ink); }
.file-pick .file-action { font-size: 15px; white-space: nowrap; }
.file-pick:focus-within .file-field { border-bottom-color: var(--accent); box-shadow: inset 0 -1px 0 var(--accent); }

/* ---------- Buttons ---------- */

button, .button { font: inherit; font-size: 16px; line-height: 1.25; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border: 1px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; transition: background-color 120ms, border-color 120ms, color 120ms; }
button:hover, .button:hover { background: var(--ink); color: var(--paper); }
button.primary, .button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover, .button.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
button.danger { border-color: var(--accent); color: var(--accent); }
button.danger:hover { background: var(--accent); color: var(--paper); }
/* Add links: "+ Dodaj …", a row under a table. */
button.link { display: flex; justify-content: flex-start; width: 100%; padding: 16px 0; border: 0; border-bottom: 1px solid var(--rule-light); background: none; color: var(--accent); }
button.link:hover { background: none; color: var(--ink); }
button.remove { padding: 4px 6px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
button.remove:hover { background: none; color: var(--accent); }
/* A small text action in a table row (Opozovi, Dopusti …). */
button.inline { padding: 0; margin-left: 12px; border: 0; background: none; color: var(--accent); font-size: 15px; }
button.inline:hover { background: none; color: var(--ink); }
td > form > button.inline:first-child { margin-left: 0; }
details.inline-confirm { display: block; }
details.inline-confirm summary { padding: 2px 0 0; font-size: 15px; }
details.inline-confirm form { margin-top: 8px; }
details.inline-confirm button { padding: 7px 14px; font-size: 15px; }
/* Narrow forms: sign-in, invitation, password. */
.narrow { max-width: 480px; }
.fields.single { grid-template-columns: minmax(0, 1fr); }
.new-link { display: flex; flex-direction: column; gap: 6px; max-width: 820px; margin-bottom: var(--gap-section); padding-top: 16px; border-top: 2px solid var(--ink); }
.new-link input { font-family: var(--mono); font-size: 15px; }
.new-link .actions { margin-top: 16px; }
/* The first submit button of an editor form, so Enter in a field saves and does not remove or add a row.
   Not display:none: some browsers skip such a button for implicit submission. */
button.default-submit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.actions { display: flex; gap: 16px 24px; flex-wrap: wrap; align-items: center; margin-top: 40px; }
details.confirm { display: inline-block; }
details.confirm summary { cursor: pointer; list-style: none; display: inline-block; padding: 13px 0; color: var(--accent); font-size: 15px; }
details.confirm summary::-webkit-details-marker { display: none; }
details.confirm summary:hover { color: var(--ink); }
details.confirm[open] summary { color: var(--muted); margin-right: 16px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule-light); text-align: left; vertical-align: top; }
th:last-child, td:last-child { padding-right: 0; }
th { padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0.02em; line-height: 1.3; color: var(--ink-2); white-space: nowrap; vertical-align: bottom; }
th.num { text-align: right; }
.strong-head th { border-bottom-width: 2px; }
tr.unchecked td { color: var(--muted); }
td a { color: var(--accent); }
td a:hover { color: var(--ink); }

/* Inputs in a table are rows of an editor: smaller type and a lighter rule. */
td { position: relative; }
table input, table select { font-size: 15px; padding: 4px 0 6px; }
table select { min-width: 9rem; padding-right: 20px; }
td:has(> select)::after { bottom: 15px; font-size: 14px; right: 16px; }
td:last-child:has(> select)::after { right: 0; }
table input.band { width: 4.2rem; text-align: right; }
table td:first-child > input:not([type="hidden"]):not([type="checkbox"]) { min-width: 9rem; }
table td:has(> input), table td:has(> select) { padding-top: 8px; padding-bottom: 8px; }
table td:has(> button.remove) { vertical-align: middle; width: 1%; }

/* Project list: one row per project; with groups, one table per space. */
.space-title { margin: 56px 0 12px; font-size: 18px; font-weight: 500; }
.page-body > .space-title:first-child { margin-top: 0; }
.project-list td { padding: 20px 32px 20px 0; vertical-align: baseline; }
.project-list .project-name { display: block; font-size: 24px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; color: var(--ink); }
.project-list .project-name:hover { color: var(--accent); }
.project-list .file { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.project-list .date { width: 220px; font-size: 16px; }
.project-list .row-actions { width: 220px; padding-right: 0; text-align: right; white-space: nowrap; font-size: 15px; }
.project-list .row-actions > * { margin-left: 24px; }
.project-list .row-actions a.json { color: var(--ink); }
.project-list .row-actions a.json:hover { color: var(--accent); }
.project-list .row-actions details.confirm summary { padding: 0; }
.project-list .row-actions details.confirm[open] { display: block; margin-top: 8px; }
.project-list .row-actions details.confirm form { display: flex !important; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 8px; }
.project-list .row-actions details.confirm button { padding: 9px 16px; font-size: 15px; }

/* ---------- Status ---------- */

/* Pass: text. Small margin: an open square. Fail: the accent square. Not calculated: muted text. */
.pill { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 0; font-size: 15px; font-weight: 500; line-height: 1.3; color: var(--ink); white-space: nowrap; }
.pill::before { content: ""; flex: none; width: 10px; height: 10px; }
.pill.pass::before { display: none; }
.pill.low::before { border: 1px solid var(--ink); }
.pill.fail::before { background: var(--accent); }
.pill.none { color: var(--muted); }
.pill.none::before { display: none; }

/* Stats row: label on top, the figure at the bottom; the verdict cell has the accent square. */
.summary { display: flex; border-top: 2px solid var(--ink); margin: 0 0 var(--gap-content); }
.summary + .summary { margin-top: calc(-1 * var(--gap-content) + 48px); }
.summary .tile { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column-reverse; justify-content: space-between; gap: 12px; padding: 14px 20px 0; border-left: 1px solid var(--rule-light); }
.summary .tile:first-child { border-left: 0; padding-left: 0; }
.summary .tile .value { font-size: 72px; font-weight: 400; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.summary .tile .muted { font-size: 13px; font-weight: 500; letter-spacing: 0.06em; line-height: 1.3; text-transform: uppercase; color: var(--ink-2); }
.summary .tile .unit { text-transform: none; }
.summary .tile:has(> .value.small) { flex: 1.4 1 0; flex-direction: column; justify-content: flex-start; padding: 14px 0 0 20px; border-left-color: var(--ink); }
.summary .tile:has(> .value.small):first-child { padding-left: 0; border-left: 0; }
.summary .tile:has(> .value.small)::before { content: "Ocjena"; font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.summary .tile .value.small { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.summary .tile .value.small::before { content: ""; flex: none; width: 12px; height: 12px; background: var(--accent); }
.summary .tile.pass .value.small::before { background: var(--pass); }
.summary .tile:has(> .value.small) .muted { font-size: 14px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.summary .tile .more { font-size: 15px; }

.saved { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 24px; font-size: 15px; font-weight: 500; }
.saved::before { content: ""; width: 8px; height: 8px; background: var(--ink); }

/* Warnings and errors: rows with an open square; errors with the accent square. */
ul.warnings { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--ink); }
ul.warnings li { position: relative; margin: 0; padding: 12px 0 12px 26px; border-bottom: 1px solid var(--rule-light); font-size: 15px; line-height: 1.5; }
ul.warnings li::before { content: ""; position: absolute; left: 0; top: 19px; width: 10px; height: 10px; border: 1px solid var(--ink); }
ul.warnings.errors li::before { border-color: var(--accent); background: var(--accent); }
ul.warnings code { font-size: 13px; color: var(--ink-2); }
ul.warnings.conflict { margin: 0 0 40px; }

/* ---------- Results in the editors ---------- */

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 48px; align-items: start; }
.preview { position: sticky; top: 24px; }
.preview > h2:first-child { font-size: 24px; }
.result-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px 32px; margin: 0 0 24px; }
.result-row .label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-2); }
.big { font-size: 36px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.key-values { display: grid; grid-template-columns: auto minmax(0, 1fr); margin: 0; border-top: 1px solid var(--ink); }
.key-values dt, .key-values dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--rule-light); }
.key-values dt { padding-right: 24px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.key-values dd { font-variant-numeric: tabular-nums; }
.preview table { font-size: 14px; }
.preview th, .preview td { padding-right: 10px; }

details.trace { margin-top: 24px; }
details.trace > summary { cursor: pointer; list-style: none; padding: 10px 0; border-top: 1px solid var(--rule-light); font-size: 14px; color: var(--muted); }
details.trace > summary::-webkit-details-marker { display: none; }
details.trace > summary::before { content: "→ "; }
details.trace[open] > summary::before { content: "↓ "; }
details.trace > summary:hover { color: var(--ink); }
.trace table { font-size: 14px; }
.trace td { padding-top: 8px; padding-bottom: 8px; }
.trace td.formula { font-size: 13px; color: var(--muted); }
.trace tr.note td { color: var(--muted); }
.trace-title { margin: 48px 0 4px; font-size: 18px; font-weight: 500; }
.trace-ref { margin-bottom: 8px; font-size: 13px; color: var(--muted); }

/* ---------- LLM pages ---------- */

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 32px; row-gap: 48px; align-items: start; }
.steps .card { border-top-width: 2px; }
.steps .card + .card { margin-top: 0; }
.steps .card > h2:first-child { font-size: 18px; font-weight: 500; }
.steps .actions { margin-top: 16px; }
textarea.prompt { width: 100%; margin-top: 16px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
pre.code, pre.notes { margin: 16px 0 0; padding: 12px 0; border-top: 1px solid var(--rule-light); border-bottom: 1px solid var(--rule-light); overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
pre.notes { font-family: var(--font); font-size: 16px; }
.copy-status { font-size: 14px; color: var(--muted); }

/* ---------- Documents: report and Iskaznica ---------- */

.doc { max-width: 210mm; border-top: 2px solid var(--ink); padding-top: 32px; }
.doc h1 { margin: 0 0 16px; font-size: 32px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.1; }
.doc h2 { margin: 48px 0 12px; font-size: 24px; }
.doc h3 { margin: 32px 0 8px; }
.doc table { font-size: 14px; table-layout: auto; }
.doc th { white-space: normal; }
.doc td.num { white-space: nowrap; }
.doc .box th, .doc .box td { padding: 6px 8px; border: 1px solid var(--ink-2); }
.doc .box th { border-bottom-color: var(--ink); }
.doc .section-head { font-weight: 600; border-top: 2px solid var(--ink); }
.doc .sign { height: 2.2rem; }
.doc-actions { max-width: 210mm; margin: 0 0 32px; display: flex; gap: 16px 24px; align-items: center; flex-wrap: wrap; }

/* ---------- Narrow screens ---------- */

@media (max-width: 1400px) {
    .editor-layout { grid-template-columns: minmax(0, 1fr); }
    .preview { position: static; }
}

@media (max-width: 1100px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { flex-direction: column; gap: 16px; padding: 20px 24px 0; border-right: 0; border-bottom: 1px solid var(--ink); }
    .brand-block { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; }
    .nav { flex-direction: row; flex-wrap: wrap; column-gap: 24px; border-bottom: 0; }
    .nav .tab { display: flex; gap: 6px; padding: 10px 0; border-top: 0; white-space: nowrap; }
    .nav .tab .index { display: none; }
    .nav .tab.active { box-shadow: inset 0 -2px 0 var(--accent); }
    .nav .marker { display: none; }
    .side-list { order: 99; flex-basis: 100%; padding: 0 0 12px; overflow-x: auto; }
    .side-list .list { flex-direction: row; gap: 24px; }
    .side-list .list a { display: flex; flex-direction: column; flex: none; padding: 6px 0 8px; border-top: 0; white-space: nowrap; }
    .side-list .list a.active { box-shadow: inset 0 -2px 0 var(--accent); }
    .side-list .list a.active::after { display: none; }
    .sidebar-foot { display: none; }
    .page { padding: 32px 24px 80px; }
    .page.hero { --gap-hero: 96px; --gap-content: 72px; --gap-section: 96px; }
    .section { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .columns { grid-template-columns: minmax(0, 1fr); row-gap: 48px; }
    .signers { grid-template-columns: minmax(0, 1fr); }
    .fields.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fields.six > .span-2, .fields.six > .span-3, .fields.six > .span-6, .fields.six > .wide { grid-column: span 2; }
    .summary { flex-wrap: wrap; }
    .summary .tile { flex: 1 1 30%; padding: 14px 20px 20px 0; border-left: 0; border-top: 1px solid var(--rule-light); }
    .summary .tile:has(> .value.small) { flex-basis: 100%; padding-left: 0; border-left: 0; border-top: 1px solid var(--ink); }
    .summary .tile .value { font-size: 56px; }
    .project-list .date, .project-list .row-actions { width: auto; }
}

@media (max-width: 640px) {
    .fields, .fields.six { grid-template-columns: minmax(0, 1fr); }
    .fields.six > * { grid-column: auto !important; }
    .summary .tile { flex-basis: 45%; }
    .project-list thead { display: none; }
    .project-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .project-list td { border-bottom: 0; }
    .project-list td:first-child { grid-column: 1 / -1; padding-bottom: 4px; }
    .project-list tr { border-bottom: 1px solid var(--rule-light); }
    .project-list .row-actions { text-align: right; }
}

/* ---------- Print: the report and the Iskaznica on white A4 ---------- */

@media print {
    @page { size: A4; margin: 15mm 14mm; }
    :root { --paper: #fff; --ink: #000; --ink-2: #222; --muted: #333; --rule-light: #999; }
    body { background: #fff; font-size: 10pt; }
    .no-print, .sidebar, .meta, .page-title, .lead, .app-footer, .doc-actions { display: none !important; }
    .shell { display: block; }
    .page { padding: 0; }
    .page-body { margin-top: 0; }
    .doc { border: 0; padding: 0; max-width: none; }
    .doc section, .doc table { break-inside: auto; }
    .doc tr, .doc h2, .doc h3 { break-inside: avoid; break-after: avoid-page; }
    .pill.fail::before { background: #000; }
}
