/* Visual direction adapted from the pricing governance platform: warm stone canvas,
   white paper modules, charcoal Outfit, signal orange for the primary action,
   evidence green, softly filled analytical fields, restrained depth. */
@font-face { font-family: "Outfit Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/static/fonts/outfit-latin-ext-wght-normal.woff2) format("woff2-variations"); 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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Outfit Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/static/fonts/outfit-latin-wght-normal.woff2) format("woff2-variations"); 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 {
  --ink: #1d1c19; --canvas: #f1f1ee; --paper: #ffffff; --paper-soft: #f7f6f2;
  --rule: #e4e3de; --rule-dark: #bbb8af; --row-rule: #eceae4; --control-border: #8e8a80;
  --field-fill: #f4f3f0; --field-fill-hover: #eeede8; --surface-hover: #efeee9; --surface-selected: #fff2ec;
  --muted: #5f5d57; --quiet-ink: #6b6862;
  --signal: #cf4517; --signal-bright: #ff5a1f; --signal-dark: #a82f08; --signal-ink: #ffffff; --signal-pale: #fff0e9;
  --green: #147b60; --green-pale: #e8f5f0; --amber: #8a5208; --amber-pale: #fff3dc;
  --red: #d8453b; --red-dark: #a52927; --red-pale: #fff0f1; --slate: #52615d; --slate-pale: #e9eeec; --focus: #304b44;
  --font-sans: "Outfit Variable", "Avenir Next", "Helvetica Neue", sans-serif;
  --radius-module: 18px; --radius-card: 12px; --radius-control: 10px;
  --rail: 244px; --weight-semibold: 600;
  --ease-out: cubic-bezier(.22, 1, .36, 1); --dur-fast: 140ms; --dur: 220ms;
  --z-dropdown: 30; --z-sticky: 10; --z-backdrop: 40; --z-modal: 50; --z-toast: 60;
  --shadow-pop: 0 16px 40px rgba(29,28,25,.16), 0 1px 2px rgba(29,28,25,.08);
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font-sans); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* shell */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 14px 12px; background: var(--paper); border-right: 1px solid var(--rule); }
.brand { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 4px 4px 18px; }
.brand i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--signal); color: #fff; font-style: normal; font-weight: 700; font-size: 15px; }
.brand b { display: block; font-size: 15px; font-weight: var(--weight-semibold); line-height: 1.15; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
/* the menu scrolls between the pinned client picker and the pinned account row, so nothing is cut off on a laptop */
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px 12px; scrollbar-width: thin; scrollbar-color: var(--rule-dark) transparent; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: var(--rule-dark); border-radius: 8px; border: 2px solid var(--paper); }
.nav-group-label { display: block; padding: 14px 8px 6px; color: var(--quiet-ink); font-size: 12px; }
.nav a { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: 14px; }
.nav a i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--field-fill); color: var(--muted); font-style: normal; }
.nav a i svg { width: 19px; height: 19px; display: block; }
.nav a { transition: background var(--dur-fast); }
.nav a:hover { background: var(--surface-hover); }
.nav a:focus-visible { outline-offset: -2px; }
.nav a.active { background: var(--surface-selected); box-shadow: 0 1px 2px rgba(29,28,25,.06); }
.nav a.active i { background: var(--signal); color: #fff; }
/* signed in as: one row that opens the account page, with sign-out beside it; language and version underneath */
.rail-foot { flex: none; display: grid; gap: 8px; margin: 0 -14px; padding: 10px 14px 0; border-top: 1px solid var(--rule); }
.rail-user { display: flex; align-items: center; gap: 4px; }
.rail-me { flex: 1; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 8px; border-radius: 12px; text-decoration: none; color: var(--ink); transition: background var(--dur-fast); }
.rail-me:hover { background: var(--surface-hover); }
.rail-me.active { background: var(--surface-selected); }
.rail-me:focus-visible { outline-offset: -2px; }
.rail-me i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--signal-pale); color: var(--signal-dark); font-style: normal; font-weight: var(--weight-semibold); font-size: 12px; letter-spacing: .02em; }
.rail-me.active i { background: var(--signal); color: var(--signal-ink); }
.rail-me b { display: block; font-weight: 500; font-size: 13px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-me small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-out { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast); }
.rail-out:hover { background: var(--red-pale); color: var(--red-dark); }
.rail-meta { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.rail-meta .rail-lang { flex: 1; padding: 0; }
.rail-version { flex: none; color: var(--quiet-ink); font-size: 12px; font-variant-numeric: tabular-nums; }

main { min-width: 0; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
/* the only breadcrumb left is the way back from a review to its month */
.crumb { margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.crumb a { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; }
h1 { margin: 0; font-size: 34px; font-weight: 300; letter-spacing: -.01em; line-height: 1.1; }
.page-head p { margin: 4px 0 0; max-width: 72ch; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* modules */
.module { background: var(--paper); border-radius: var(--radius-module); box-shadow: 0 1px 0 rgba(29,28,25,.04), 0 6px 20px rgba(29,28,25,.04); }
main > section > .module + .module, main > section > .module + #result, main > section > .notice + .module { margin-top: 18px; }  /* stacked cards keep the same rhythm as the grids */
.module-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.module-head h2 { margin: 0; font-size: 15px; font-weight: var(--weight-semibold); }
.module-head small { color: var(--muted); font-size: 12px; }
.module-body { padding: 16px 20px 20px; }

/* controls */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--paper); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); }
.btn:hover { background: var(--surface-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn[aria-busy=true] { opacity: 1; color: transparent !important; cursor: progress; }
.btn[aria-busy=true]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border: 2px solid currentColor; border-color: rgba(29,28,25,.25); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; }
.btn.primary[aria-busy=true]::after, .btn.danger-primary[aria-busy=true]::after { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.btn.primary { border-color: var(--signal); background: var(--signal); color: var(--signal-ink); }
.btn.primary:hover { background: var(--signal-dark); border-color: var(--signal-dark); }
a.btn { text-decoration: none; }
.crumb a { color: inherit; text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--surface-hover); color: var(--ink); }
.btn.danger { color: var(--red-dark); }
.btn.danger:hover { background: var(--red-pale); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > input, .field > select, .field > textarea { max-width: 100%; }
.field label { color: var(--muted); font-size: 12px; }
/* every text-like control shares one recipe: soft fill, no border until focus */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select, textarea {
  width: 100%; min-height: 38px; padding: 7px 12px; border: 1px solid transparent; border-radius: var(--radius-control);
  background: var(--field-fill); color: var(--ink); transition: background .12s, border-color .12s, box-shadow .12s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, select:hover, textarea:hover { background: var(--field-fill-hover); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); background: var(--field-fill-hover); box-shadow: 0 0 0 3px var(--signal-pale); }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 1000px var(--field-fill) inset; transition: background-color 9999s ease-out; }
input::placeholder, textarea::placeholder { color: var(--muted); }  /* 5.9:1 on the field fill; --quiet-ink fell short of AA */
input:disabled, textarea:disabled { opacity: .55; cursor: default; }
input[type=number] { font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=date] { font-variant-numeric: tabular-nums; }
input[type=date]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; width: 12px; height: 12px; cursor: pointer; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f5d57' stroke-width='2.6' stroke-linecap='round'><path d='M6 6l12 12M18 6 6 18'/></svg>") center / contain no-repeat; }
textarea { min-height: 240px; resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.55; }

/* select: the native element stays for forms and scripts, a button + listbox are what people see (ui.js) */
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.sel { position: relative; display: block; min-width: 0; }
.sel-native { position: absolute !important; inset: 0 auto auto 0; width: 1px !important; min-height: 0 !important; height: 1px; padding: 0 !important; margin: 0; opacity: 0; pointer-events: none; }
.sel-btn { width: 100%; min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px 7px 12px; border: 1px solid transparent; border-radius: var(--radius-control); background: var(--field-fill); color: var(--ink); text-align: left; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast); }
.sel-btn .sel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn svg { flex: none; color: var(--muted); transition: transform var(--dur) var(--ease-out); }
.sel-btn:hover { background: var(--field-fill-hover); }
.sel-btn:focus-visible, .sel-btn.open { outline: none; border-color: var(--signal); background: var(--field-fill-hover); box-shadow: 0 0 0 3px var(--signal-pale); }
.sel-btn.open svg { transform: rotate(180deg); }
.sel-btn.placeholder { color: var(--quiet-ink); }
.sel-btn:disabled { opacity: .55; cursor: default; }
.sel.inline { display: inline-block; width: auto; }
.sel.inline .sel-btn { min-height: 30px; padding: 4px 8px 4px 10px; font-size: 12px; font-weight: 500; background: var(--paper); border-color: var(--rule); }
.sel.inline .sel-btn:hover { background: var(--surface-hover); }
.rail-client .sel, .rail-lang .sel { display: block; width: 100%; }
.sel-opt[hidden] { display: none; }
.sel-pop { position: fixed; z-index: var(--z-dropdown); overflow: auto; padding: 6px; border-radius: 12px; border: 1px solid var(--rule); background: var(--paper); box-shadow: var(--shadow-pop); transform-origin: top center; animation: pop-in var(--dur-fast) var(--ease-out) both; }
.sel-pop.up { transform-origin: bottom center; }
.sel-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.sel-opt.active { background: var(--surface-hover); }
.sel-opt[aria-selected=true] { color: var(--signal-dark); font-weight: 500; }
.sel-opt[aria-selected=true] svg { color: var(--signal); }
.sel-opt[aria-disabled=true] { opacity: .45; cursor: default; }
.sel-none { padding: 10px 12px; color: var(--muted); font-size: 12px; }
.menu-item { justify-content: space-between; }
.menu-item small { color: var(--muted); font-size: 12px; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--rule); }
.kbd-hint { color: var(--muted); font-size: 12px; white-space: nowrap; }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--rule-dark); border-bottom-width: 2px; border-radius: 5px; background: var(--paper); color: var(--muted); font: 500 11px/16px var(--font-sans); text-align: center; }
.combo-opt { justify-content: flex-start; font-variant-numeric: tabular-nums; }
.combo-opt b { min-width: 52px; font-weight: 500; }
.combo-opt span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* file inputs read as a drop zone: a button, a hint, and the chosen names (ui.js) */
.field label.drop, .drop { position: relative; display: flex; align-items: center; min-height: 38px; padding: 0; border: 1px dashed var(--rule-dark); border-radius: var(--radius-control); background: var(--paper-soft); color: var(--muted); font-size: 12px; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast); }
.drop:hover { background: var(--field-fill); border-color: var(--control-border); }
.drop.over { background: var(--signal-pale); border-color: var(--signal); border-style: solid; }
.drop:focus-within { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-pale); }
.drop.disabled { opacity: .55; cursor: default; }
.drop-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-ui { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 4px 10px 4px 8px; }
.drop-ui svg { flex: none; color: var(--quiet-ink); }
.drop-ui b { flex: none; min-height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--ink); font-weight: 500; }
.drop-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-files { display: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.drop.has-files .drop-text { display: none; }
.drop.has-files .drop-files { display: block; }
.drop.has-files svg { color: var(--green); }

/* checkbox drawn by us: same fill, same signal colour, same focus ring as every other control */
input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 17px; height: 17px; margin: 0; display: inline-grid; place-items: center; border: 1.5px solid var(--control-border); border-radius: 5px; background: var(--paper); cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast); }
input[type=checkbox]:hover { border-color: var(--ink); }
input[type=checkbox]:checked { background: var(--signal); border-color: var(--signal); }
input[type=checkbox]::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur-fast) var(--ease-out); }
input[type=checkbox]:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
input[type=checkbox]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--signal-pale); border-color: var(--signal); }
input[type=checkbox]:disabled { opacity: .5; cursor: default; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; cursor: pointer; }

/* inline validation: the field turns, the message sits under it, the browser bubble never shows */
.field.invalid > input, .field.invalid > textarea, .field.invalid .sel-btn, .field.invalid .drop { border-color: var(--red); background: var(--red-pale); }
.field.invalid > input:focus, .field.invalid .sel-btn:focus-visible, .field.invalid .drop:focus-within { box-shadow: 0 0 0 3px rgba(216,69,59,.18); }
.field-error { color: var(--red-dark); font-size: 12px; line-height: 1.35; animation: fade-in var(--dur-fast) var(--ease-out) both; }
@keyframes fade-in { from { opacity: 0; } }
.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.choices { display: grid; gap: 6px; }
.choices label { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 12px; border: 1px solid transparent; border-radius: var(--radius-control); background: var(--field-fill); font-size: 13px; cursor: pointer; }
.choices label:has(input:checked) { background: var(--surface-selected); border-color: var(--signal-pale); }
.choices label:hover { background: var(--field-fill-hover); }

/* segmented filter */
.segment { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--paper); border: 1px solid var(--rule); }
.segment .count { margin-left: 6px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.segment button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; }
.segment button { transition: background var(--dur-fast), color var(--dur-fast); }
.segment button.active { background: var(--ink); color: #fff; }
.segment button.active .count { color: rgba(255,255,255,.78); }  /* 9:1 on the ink fill; the muted grey was unreadable there */
.segment button:not(.active):hover { background: var(--surface-hover); color: var(--ink); }

/* metric strip */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 16px 0; }
.metric { padding: 12px 14px; border-radius: var(--radius-card); background: var(--paper); box-shadow: 0 1px 0 rgba(29,28,25,.04); }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric b { display: block; margin-top: 2px; font-size: 24px; font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric small { color: var(--muted); font-size: 12px; }
.metric.good b { color: var(--green); } .metric.bad b { color: var(--red-dark); }
.metric.open b { color: var(--amber); } .metric.proposed b { color: var(--signal-dark); } .metric.auto b { color: var(--slate); } .metric.confirmed b { color: var(--green); }

/* statements strip */
.statements { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.statements:empty { margin: 0; }
.statement-chip { display: grid; grid-template-columns: auto auto auto; gap: 10px; align-items: center; padding: 8px 8px 8px 12px; border-radius: var(--radius-card); background: var(--paper); border: 1px solid var(--rule); }
.statement-chip b { display: block; font-weight: 500; font-size: 13px; }
.statement-chip small { display: block; color: var(--muted); font-size: 12px; }
.statement-chip .x { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: transparent; color: var(--quiet-ink); cursor: pointer; padding: 0; border-radius: 6px; }
.statement-chip .x:hover { background: var(--red-pale); color: var(--red-dark); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.open { color: var(--amber); background: var(--amber-pale); }
.pill.proposed { color: var(--signal-dark); background: var(--signal-pale); }
.pill.auto { color: var(--slate); background: var(--slate-pale); }
.pill.confirmed { color: var(--green); background: var(--green-pale); }
.pill.ok { color: var(--green); background: var(--green-pale); }
.pill.bad { color: var(--red-dark); background: var(--red-pale); }
.pill.na { color: var(--muted); background: var(--field-fill); }

/* composition */
.composition { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 16px; align-items: start; }
.composition > .module { min-width: 0; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--row-rule); }
.toolbar .spacer { flex: 1; }
.tablewrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; z-index: var(--z-sticky); padding: 10px 12px; background: var(--paper); border-bottom: 1px solid var(--row-rule); color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; text-align: left; }
td { padding: 10px 12px; border-bottom: 1px solid var(--row-rule); vertical-align: top; }
tr.row { cursor: pointer; }
tr.row td { transition: background var(--dur-fast); }
tr.row:hover td { background: var(--surface-hover); }
tr.row:focus-visible { outline-offset: -2px; }
tr.row.selected td { background: var(--surface-selected); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.neg { color: var(--red-dark); } td.pos { color: var(--green); }
.line-kind { color: var(--muted); font-size: 12px; }  /* --quiet-ink drops to 4.3:1 on the selected row's tint */
.line-payee { font-weight: 500; }
/* the statement line takes what is left and truncates inside its cell, so Gegenkonto, text and status are always on screen */
#result table { table-layout: fixed; }
.col-pick { width: 40px; } td.pick, th.col-pick { padding-right: 0; vertical-align: middle; }
.col-date { width: 96px; } .col-amt { width: 100px; } .col-src { width: 170px; } .col-partner { width: 150px; } .col-acct { width: 96px; } .col-text { width: 22%; } .col-state { width: 140px; }
td.line > div, td.text, td.src, td.acct .score { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.state { white-space: normal; }
#result table.inv .col-acct { width: 150px; } #result table.inv .col-state { width: 128px; } #result table.inv .col-date { width: 92px; }
td.state .pill { margin-bottom: 2px; }
td.state > .score { display: block; padding-left: 10px; }
.line-desc { color: var(--muted); font-size: 12px; }
.src { color: var(--muted); font-size: 12px; white-space: nowrap; }
.acct { font-variant-numeric: tabular-nums; font-weight: 500; }
.score { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.table-empty { padding: 48px; text-align: center; color: var(--muted); }
.table-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; padding: 10px 20px; color: var(--muted); font-size: 12px; }

/* record panel */
.record { position: sticky; top: 22px; }
.record-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 20px 0; }
.record-head h2 { margin: 0; font-size: 15px; font-weight: var(--weight-semibold); }
.record-head small { color: var(--muted); font-size: 12px; }
.record-amount { display: flex; align-items: baseline; gap: 10px; padding: 12px 20px 0; }
.record-amount b { font-size: 28px; font-weight: 300; font-variant-numeric: tabular-nums; }
.record-amount b.neg { color: var(--red-dark); } .record-amount b.pos { color: var(--green); }
.record-meta { padding: 6px 20px 0; color: var(--muted); font-size: 12px; }
.record-meta strong { display: block; color: var(--ink); font-size: 14px; font-weight: 500; }
.evidence { margin: 12px 20px 0; padding: 10px 12px; border-radius: var(--radius-card); background: var(--field-fill); color: var(--muted); font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.section-label { display: block; padding: 16px 20px 6px; color: var(--quiet-ink); font-size: 12px; }
.why { margin: 0 20px; padding: 10px 12px; border-radius: var(--radius-card); background: var(--amber-pale); color: var(--amber); font-size: 12px; line-height: 1.45; }
.why.rule { background: var(--slate-pale); color: var(--slate); }
.why.match { background: var(--green-pale); color: var(--green); }
.bars { display: grid; gap: 5px; margin: 8px 20px 0; }
.bar { display: grid; grid-template-columns: 78px 1fr 36px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.bar i { height: 6px; border-radius: 3px; background: var(--field-fill); overflow: hidden; display: block; }
.bar i b { display: block; height: 100%; background: var(--green); }
.record-form { display: grid; gap: 10px; padding: 0 20px; min-width: 0; }
.record-form input { width: 100%; }
.record-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.record-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px 20px; }
.record-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.record-done { padding: 32px 20px; text-align: center; }
.record-done i { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-pale); color: var(--green); font-style: normal; font-weight: 700; font-size: 20px; }
.record-done b { display: block; font-size: 16px; font-weight: var(--weight-semibold); }
.record-done p { margin: 6px 0 16px; color: var(--muted); font-size: 13px; }

/* messages: a corner stack that never pushes the page (ui.js), plus the inline .msg used inside dialogs and panels */
#notices { position: fixed; top: 16px; right: 20px; z-index: var(--z-toast); display: grid; gap: 8px; width: min(460px, calc(100vw - 40px)); pointer-events: none; }
.notice-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 10px 12px 14px; border-radius: var(--radius-card); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-size: 13px; line-height: 1.45; box-shadow: var(--shadow-pop); pointer-events: auto; animation: toast-in var(--dur) var(--ease-out) both; }
.notice-item i { display: grid; place-items: center; width: 22px; height: 22px; margin-top: -1px; border-radius: 50%; font-style: normal; font-weight: 700; font-size: 12px; }
.notice-item.ok i { background: var(--green-pale); color: var(--green); } .notice-item.err i { background: var(--red-pale); color: var(--red-dark); } .notice-item.info i { background: var(--field-fill); color: var(--muted); }
.notice-item.err { border-color: #f1c9c6; }
.notice-body { min-width: 0; max-height: 40vh; overflow: auto; overflow-wrap: anywhere; }
.notice-x { display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--quiet-ink); font-size: 18px; line-height: 1; padding: 0 6px; margin: -4px -2px 0 0; border-radius: 6px; cursor: pointer; }
.notice-x:hover { background: var(--surface-hover); color: var(--ink); }
.notice-item.leaving { animation: toast-out var(--dur-fast) ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }
.msg { margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius-card); font-size: 13px; animation: fade-in var(--dur-fast) both; }
.msg.ok { background: var(--green-pale); color: var(--green); } .msg.err { background: var(--red-pale); color: var(--red-dark); } .msg.info { background: var(--field-fill); color: var(--muted); }
.eval-out { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--field-fill); font-size: 13px; line-height: 1.5; animation: fade-in var(--dur) both; }
.eval-out.bad { background: var(--amber-pale); }

/* loading placeholders shaped like the content, and the way views and panels arrive */
.skel { display: block; background: linear-gradient(90deg, var(--field-fill) 25%, var(--field-fill-hover) 40%, var(--field-fill) 55%); background-size: 400% 100%; border-radius: 6px; animation: shimmer 1.6s ease-in-out infinite; }
.skel-line { height: 11px; }
.skel-line.w40 { width: 40%; } .skel-line.w70 { width: 72%; }
.skel-row { display: grid; gap: 8px; padding: 13px 14px; border-radius: var(--radius-card); background: var(--paper-soft); }
.skel-tr td { padding: 13px 12px; }
.kv .skel-line { margin: 4px 0; } .kv .skel-line.w40 { width: 70px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
main > section { animation: none; }
.view-enter { animation: view-in var(--dur) var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
dialog { border: 0; padding: 0; border-radius: var(--radius-module); box-shadow: 0 24px 60px rgba(29,28,25,.25); }
dialog[open] { animation: dialog-in var(--dur) var(--ease-out) backwards; }  /* not "both": a retained transform would turn the dialog into the containing block for fixed popovers */
dialog::backdrop { background: rgba(29,28,25,.35); backdrop-filter: blur(2px); animation: fade-in var(--dur) both; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* library + sessions */
.list { display: grid; gap: 8px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--radius-card); background: var(--field-fill); }
.list-row b { display: block; font-weight: 500; }
.list-row small { color: var(--muted); font-size: 12px; }
.list-row .actions { display: flex; gap: 6px; }
/* destructive row actions stay reachable but quiet: they gain weight only when the row is under the pointer or keyboard */
.list-row .actions .btn.danger, #ruleRows .btn.danger, #sessionList .btn.danger { border-color: transparent; background: transparent; color: var(--quiet-ink); }
.list-row:hover .actions .btn.danger, .list-row:focus-within .actions .btn.danger, tr:hover .btn.danger, tr:focus-within .btn.danger { color: var(--red-dark); }
.list-row .actions .btn.danger:hover, #ruleRows .btn.danger:hover { background: var(--red-pale); color: var(--red-dark); }
.readonly-note { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.35; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius-card); background: var(--field-fill); }
.steps li::before { content: ""; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); color: var(--muted); font-size: 12px; font-weight: 600; }
.steps li.done::before { content: ""; background: var(--green-pale) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23147b60' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 13px no-repeat; }
.steps li.done { color: var(--muted); }
.steps li b { display: block; font-weight: 500; color: var(--ink); }
.steps li.done b { text-decoration: line-through; text-decoration-color: var(--rule-dark); }
.steps li small { color: var(--muted); font-size: 12px; }
.record-close { display: none; }
/* an empty list keeps the shape of the rows it waits for: a dashed slot, never bare text against a card edge */
.empty { padding: 14px 16px; border: 1px dashed var(--rule-dark); border-radius: var(--radius-card); color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (min-width: 761px) and (max-height: 860px) {
  .brand { padding-bottom: 12px; }
  .nav a { padding: 4px 8px; }
  .nav a i { width: 32px; height: 32px; }
  .nav-group-label { padding: 10px 8px 4px; }
}
@media (max-width: 1100px) { .composition { grid-template-columns: 1fr; } .record { position: static; } .grid.cols-6 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
/* phone: the rail becomes a sticky header with a scrolling nav strip; tables scroll sideways instead of crushing */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; z-index: var(--z-sticky); height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand client" "nav nav" "foot foot"; gap: 8px 12px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .brand { grid-area: brand; padding: 0; }
  .brand b { white-space: normal; }
  .brand small { display: none; }
  .rail-client { grid-area: client; padding: 0; align-self: center; min-width: 140px; max-width: 46vw; }
  .rail-client label { display: none; }
  .nav { grid-area: nav; display: flex; gap: 4px; margin: 0 -12px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group-label { display: none; }
  .nav a { flex: none; grid-template-columns: auto; gap: 0; padding: 7px 11px; font-size: 13px; }
  .nav a i { display: none; }
  .nav { flex: none; min-height: auto; overflow-y: visible; margin: 0 -12px; }
  .rail-foot { grid-area: foot; grid-template-columns: minmax(0, 1fr) auto; align-items: center; margin: 0 -12px; padding: 8px 12px 0; }
  .rail-me { padding: 4px 6px; }
  .rail-me small { display: none; }
  .rail-meta { padding: 0; }
  .rail-meta .rail-lang { min-width: 120px; }
  .rail-version { display: none; }
  /* the header scrolls away with the page: sticky, it cost a quarter of a phone screen; the fade says the menu scrolls sideways */
  .rail { position: static !important; }
  .nav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); padding-right: 32px !important; }
  main { padding: 16px 16px 40px; }
  h1 { font-size: 26px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head > div:first-child { flex: none; }   /* its 420px basis is a width; stacked, it would become a 420px gap */
  .head-actions { justify-content: flex-start; }
  .segment { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .grid.cols-3, .grid.cols-6, .grid.cols-4 { grid-template-columns: 1fr !important; }
  .record-form .two { grid-template-columns: 1fr; }
  .tablewrap table { min-width: 720px; }
  #notices { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; }
  dialog { max-width: calc(100vw - 24px); }
  /* the booking record becomes a bottom sheet once a line is picked: the phone never has to scroll past the table to find it */
  .record.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: var(--z-modal); max-height: 78vh; overflow: auto; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(29,28,25,.22); animation: sheet-in var(--dur) var(--ease-out) both; }
  .record.sheet .record-close { display: inline-grid; }
  .list-row .actions .btn.danger { color: var(--red-dark); }
  /* fingers, not cursors: every control is at least 40px tall on a phone */
  .btn, .btn.sm, .sel-btn, .nav a, .quick, input:not([type=checkbox]):not([type=radio]), .segment button, summary { min-height: 40px !important; }
  .btn.icon { width: 40px; }
  .statement-chip .x, .notice-x { min-width: 40px; min-height: 40px; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.record-close { place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--field-fill); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }

/* in-page confirmation (native confirm() is suppressed in embedded browsers); dialog chrome is shared above */
.btn.danger-primary { background: var(--red-dark); border-color: var(--red-dark); color: #fff; box-shadow: none; }
.btn.danger-primary:hover { background: #b83229; border-color: #b83229; }  /* darker, not lighter: white text keeps 5:1 on hover */
.section-title { margin: 10px 0 0; font-size: 13px; font-weight: var(--weight-semibold); color: var(--ink); }
.quick { width: 260px; min-height: 32px !important; padding: 5px 12px !important; font-size: 13px; }
.rule-when, .rule-then { font-size: 12px; color: var(--muted); }
.rule-when b, .rule-then b { color: var(--ink); font-weight: 500; }

.rail-lang select { width: 100%; }

.spin { display:inline-block; width:12px; height:12px; margin-right:8px; border:2px solid var(--rule-dark); border-top-color: var(--signal); border-radius:50%; vertical-align:-2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-inline { display:inline-flex; align-items:center; gap:8px; color: var(--muted); font-size: 13px; }
.progress-inline .bar { width: 160px; height: 6px; border-radius: 3px; background: var(--field-fill); overflow: hidden; }
.progress-inline .bar b { display:block; width: 100%; height:100%; background: var(--signal); transform-origin: left center; transform: scaleX(0); transition: transform .4s var(--ease-out); }

/* client selector in the rail, and the clients page */
.rail-client { display: grid; gap: 4px; padding: 0 6px 14px; }
.rail-client label { color: var(--muted); font-size: 12px; }
.rail-client select { width: 100%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv span { color: var(--muted); }
.kv.wide { gap: 10px 24px; font-size: 14px; } .kv.wide b { font-weight: 500; }
form .section-title:first-child { margin-top: 0; }
.accounts-list { max-height: 320px; overflow: auto; margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.accounts-list div { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--row-rule); }
.accounts-list .empty { display: block; padding: 14px 16px; border: 1px dashed var(--rule-dark); }
.hint { margin: 0 0 10px; max-width: 75ch; color: var(--muted); font-size: 12px; line-height: 1.5; }
.why.model { background: var(--green-pale); color: var(--green); }
.why.llm { background: var(--slate-pale); color: var(--slate); }
.candidates { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 20px 0; }
.candidates button { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.candidates button:hover { border-color: var(--signal); background: var(--signal-pale); }
.acct-name { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; min-height: 15px; }
.why.overlaps { margin: 0; padding: 12px 14px; font-size: 13px; }
.why.overlaps > b { display: block; font-weight: var(--weight-semibold); }
.why.overlaps > p { margin: 2px 0 8px; opacity: .85; }
.overlap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: start; padding: 8px 0; border-top: 1px solid rgba(138,82,8,.15); }
.overlap b { font-weight: var(--weight-semibold); }
.overlap .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.overlap-example { margin-top: 3px; font-size: 12px; opacity: .8; }
.rule-stat { white-space: nowrap; }
.rule-stat .pill { margin-left: 4px; }
.suggest b { display: block; }
.suggest small { display: block; color: var(--muted); }

/* the month workspace: the year as a strip of months, and one month in focus as a guided 1 → 2 → 3 */
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field label { color: var(--muted); font-size: 12px; }
.year-strip { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; margin: 0 0 16px; }
.year-pick { display: flex; align-items: center; gap: 2px; }
.year-pick b { min-width: 44px; text-align: center; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.btn.icon { width: 32px; min-height: 32px; padding: 0; }
.month-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.month-tab { display: grid; gap: 1px; min-width: 0; min-height: 52px; padding: 7px 10px; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast); }
.month-tab b { font-size: 13px; font-weight: 500; }
.month-tab small { display: flex; align-items: center; gap: 5px; min-height: 16px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.month-tab.progress small::before, .month-tab.done small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.month-tab:hover:not(:disabled) { background: var(--surface-hover); }
.month-tab.progress small { color: var(--amber); }
.month-tab.done small { color: var(--green); }
.month-tab.current { background: var(--paper); border-color: var(--rule-dark); }
.month-tab.current b { font-weight: var(--weight-semibold); }
.month-tab.working:not(.current) { border-color: var(--rule); border-style: dashed; }
.month-tab:disabled { color: var(--quiet-ink); cursor: default; opacity: .55; }
.month-focus { overflow: hidden; }
.focus-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--row-rule); }
.focus-head h2 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -.01em; }
.focus-head p { margin: 4px 0 0; max-width: 70ch; color: var(--muted); font-size: 14px; }
.focus-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.guide { margin: 0; padding: 0; list-style: none; }
.guide-step { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 18px 24px; border-bottom: 1px solid var(--row-rule); transition: background var(--dur-fast); }
.guide-step:last-child { border-bottom: 0; }
.guide-step.next { background: var(--surface-selected); }
.guide-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--field-fill); color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.guide-step.next .guide-mark { background: var(--signal); color: var(--signal-ink); }
.guide-step.done .guide-mark { background: var(--green-pale); color: var(--green); }
.guide-body { min-width: 0; }
.guide-body h3 { margin: 5px 0 0; font-size: 15px; font-weight: 500; }
.guide-body p { margin: 4px 0 0; max-width: 64ch; color: var(--muted); font-size: 13px; line-height: 1.5; }
.guide-step.locked h3, .guide-step.locked p { color: var(--quiet-ink); }
.guide-step.locked p { color: var(--muted); }
.guide-items { display: grid; gap: 6px; max-width: 520px; margin-top: 12px; }
.guide-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.step-open { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 1 1 180px; min-width: 0; min-height: 40px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--paper); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
.step-open:hover { background: var(--surface-hover); border-color: var(--rule-dark); }
.step-open b { font-weight: 500; font-size: 13px; white-space: nowrap; }
.step-open span { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.empty-state { display: grid; justify-items: center; padding: 56px 24px 60px; text-align: center; }
.empty-state svg { margin-bottom: 14px; color: var(--rule-dark); }
.empty-state b { display: block; font-size: 17px; font-weight: var(--weight-semibold); letter-spacing: -.01em; }
.empty-state p { margin: 6px auto 20px; max-width: 48ch; color: var(--muted); text-wrap: pretty; }
.why.split { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; padding: 12px 16px; font-size: 13px; }
.why.split b { display: block; font-weight: var(--weight-semibold); }
.why.split p { margin: 2px 0 0; opacity: .9; }

/* the document next to its posting */
.doc-preview { margin: 12px 20px 0; height: 340px; border-radius: var(--radius-card); border: 1px solid var(--rule); background: var(--field-fill); overflow: hidden; }
.doc-actions { display: flex; align-items: center; gap: 8px; margin: 6px 20px 0; }
.evidence-more { margin: 8px 0 0; }
.evidence-more summary { margin: 0 20px; color: var(--muted); font-size: 12px; cursor: pointer; }
.evidence-more .evidence { margin-top: 6px; }
details:not(.evidence-more) > summary { cursor: pointer; }

@media (max-width: 1100px) { .year-strip { grid-template-columns: 1fr; } .month-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 760px) { .month-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } .focus-head { flex-direction: column; padding: 18px 16px 14px; } .focus-side { justify-content: flex-start; } .guide-step { grid-template-columns: 32px minmax(0, 1fr); padding: 16px; } .guide-act { grid-column: 2; justify-content: flex-start; } }
@media (max-width: 760px) { .doc-preview { height: 260px; } .why.split { flex-direction: column; align-items: stretch; } }


/* critique pass: the record never hides its own actions, the ledger keeps its labels, provisional numbers stay quiet */
#record { max-height: calc(100vh - 44px); overflow: auto; overscroll-behavior: contain; }
#record .record-actions { position: sticky; bottom: 0; z-index: 1; margin-top: 12px; padding-top: 12px; background: linear-gradient(to bottom, rgba(255,255,255,0), var(--paper) 14px); }
.composition.wide-record { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); }
.doc-preview { height: 320px; }
@media (min-height: 1000px) { .doc-preview { height: 440px; } }
.step-open.muted b { color: var(--muted); font-weight: 400; }
.row-actions { white-space: nowrap; text-align: right; }
@media (max-width: 1100px) { .composition.wide-record { grid-template-columns: 1fr; } #record { max-height: none; overflow: visible; } #record .record-actions { position: static; } }
@media (max-width: 760px) { #record.sheet { overflow: auto; max-height: 78vh; } }  /* phones do not render PDFs inline: the "Open document" button stays */

/* export pre-flight: what is written, under which header, and what stays behind */
.export-check { display: grid; gap: 16px; width: min(560px, calc(100vw - 48px)); }
.export-check h2 { margin: 0; font-size: 18px; font-weight: 500; }
.export-check dl { display: grid; gap: 0; margin: 0; }
.export-check dl > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--row-rule); font-size: 13px; }
.export-check dl > div:last-child { border-bottom: 0; }
.export-check dt { color: var(--muted); }
.export-check dd { margin: 0; line-height: 1.5; }
.export-check .why { margin: 0; }
.export-check .check { align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--muted); }
.export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.export-actions .spacer { flex: 1; }
@media (max-width: 760px) { .export-check dl > div { grid-template-columns: 1fr; gap: 2px; } }

/* help: process, states, keys and DATEV terms */
.help-sheet { display: grid; gap: 20px; width: min(640px, calc(100vw - 48px)); max-height: min(80vh, 760px); overflow: auto; }
.help-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-sheet h2 { margin: 0; font-size: 20px; font-weight: 500; }
.help-sheet h3 { margin: 0 0 8px; font-size: 14px; font-weight: var(--weight-semibold); }
.help-sheet ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.help-sheet li, .help-sheet p, .help-sheet dd { color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 70ch; }
.help-sheet p { margin: 0 0 6px; }
.help-sheet dl { display: grid; margin: 0; }
.help-sheet dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--row-rule); }
.help-sheet dl > div:last-child { border-bottom: 0; }
.help-sheet dt { font-size: 13px; font-weight: 500; }
.help-sheet dd { margin: 0; }
@media (max-width: 760px) { .help-sheet dl > div { grid-template-columns: 1fr; gap: 2px; } }

table.is-empty thead { display: none; }
.page-head p b { color: var(--ink); font-weight: 500; }

/* document viewer: toolbar on top, the page on a quiet desk underneath */
.dv { display: grid; grid-template-rows: auto minmax(0, 1fr); outline: none; }
.dv:focus-visible { box-shadow: 0 0 0 2px var(--focus); }
.dv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 6px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.dv-group { display: inline-flex; align-items: center; gap: 2px; }
.dv-spacer { flex: 1; }
.dv-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; transition: background var(--dur-fast), color var(--dur-fast); }
.dv-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.dv-btn:disabled { opacity: .4; cursor: default; }
.dv-zoom { min-width: 52px; height: 30px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.dv-zoom:hover { background: var(--surface-hover); }
.dv-page { min-width: 44px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dv-stage { position: relative; overflow: auto; overscroll-behavior: contain; background: var(--field-fill); touch-action: pan-x pan-y; }
.dv-stage.pannable { cursor: grab; }
.dv-stage.dragging { cursor: grabbing; user-select: none; }
.dv-canvas { position: relative; margin: 8px auto; }
.dv-canvas img { position: absolute; display: block; max-width: none; background: #fff; box-shadow: 0 1px 3px rgba(29,28,25,.18); transform-origin: center; user-select: none; -webkit-user-drag: none; }
.dv-note { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }
.dv-note[hidden] { display: none; }
.doc-dialog { width: min(1200px, calc(100vw - 32px)); max-width: none; }
.doc-dialog-inner { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; height: min(92vh, 1100px); padding: 14px 16px 16px; box-sizing: border-box; }
.doc-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 0 4px; font-size: 14px; }
.doc-dialog-head b { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.doc-full { min-height: 0; border: 1px solid var(--rule); border-radius: var(--radius-card); overflow: hidden; }
@media (max-width: 760px) { .dv-btn, .dv-zoom { width: 40px; height: 40px; } .dv-zoom { width: auto; min-width: 44px; } .dv-bar { gap: 2px; flex-wrap: nowrap; } .dv [data-act=fitp], .dv [data-act=rotl] { display: none; } .doc-preview { height: 380px; } }
