/* Design system "Stôl na schvaľovanie" — tokens and shared components. Source of truth: DESIGN.md.
   Screen-specific styles live in app/static/<screen>.css and only use these tokens. */

@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/onest-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; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/onest-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/onest-cyrillic-ext.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }

:root {
  --paper: #F3F5F4; --sheet: #FFFFFF; --ink: #18222C; --ink-2: #56636F; --rule: #D6DEDA;
  --control: #7F8B95;  /* borders of inputs and quiet buttons: ≥ 3:1 on sheet and paper (WCAG 1.4.11) */
  --stamp: #3A3FC2; --stamp-wash: #E9EAFB; --on-stamp: #FFFFFF;
  --ok: #1F7A4D; --ok-wash: #E3F2EA; --warn: #9A5F08; --warn-wash: #FBF0DC; --bad: #B8342A; --bad-wash: #FBE6E3;
  --sheet-shadow: 0 1px 0 rgba(24, 34, 44, .04), 0 8px 24px -12px rgba(24, 34, 44, .22);
  /* two rings: a gap in the sheet colour, then solid stamp ink — ≥ 3:1 against any surface (WCAG 1.4.11) */
  --focus: 0 0 0 2px var(--sheet), 0 0 0 4px var(--stamp);

  --f-13: 13px; --f-15: 15px; --f-17: 17px; --f-21: 21px; --f-26: 26px; --f-33: 33px; --f-41: 41px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-sheet: 3px; --r-ctl: 8px;
  --rail: 64px; --stack: 320px; --decide: 360px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #12171C; --sheet: #1A2027; --ink: #E6EAEE; --ink-2: #9AA6B1; --rule: #2A333C; --control: #66737F;
  --stamp: #8E93FF; --stamp-wash: #262A52; --on-stamp: #10132E;
  --ok: #5FCB95; --ok-wash: #16352A; --warn: #E6AE4F; --warn-wash: #3A2C12; --bad: #FF8C80; --bad-wash: #44201D;
  --sheet-shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #12171C; --sheet: #1A2027; --ink: #E6EAEE; --ink-2: #9AA6B1; --rule: #2A333C; --control: #66737F;
  --stamp: #8E93FF; --stamp-wash: #262A52; --on-stamp: #10132E;
  --ok: #5FCB95; --ok-wash: #16352A; --warn: #E6AE4F; --warn-wash: #3A2C12; --bad: #FF8C80; --bad-wash: #44201D;
  --sheet-shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
} }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(58, 63, 194, .14); }
/* no double-tap zoom delay on anything that reacts to a tap */
a, button, summary, label, select, input, textarea, [role="button"] { touch-action: manipulation; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--f-15)/24px "Onest", system-ui, sans-serif; font-feature-settings: "ss01"; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--f-26); line-height: 32px; }
h2 { font-size: var(--f-17); line-height: 24px; }
h3 { font-size: var(--f-15); line-height: 24px; }
p { margin: 0 0 var(--s-3); max-width: 72ch; }
a { color: var(--stamp); text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── shell: rail + content ───────────────────────────────────────────── */
/* the rail column is painted on the shell so it runs the full page height, not just the sticky viewport */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(to right, var(--sheet) calc(var(--rail) - 1px), var(--rule) 0 var(--rail), transparent 0); }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center;
  gap: var(--s-2); padding: var(--s-4) 0; border-right: 1px solid var(--rule); background: var(--sheet); }
.rail .mark { width: 36px; height: 36px; margin-bottom: var(--s-4); color: var(--stamp); }
.rail a { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-ctl);
  color: var(--ink-2); text-decoration: none; }
.rail a:hover { color: var(--ink); background: var(--paper); }
.rail a[aria-current="page"] { color: var(--stamp); background: var(--stamp-wash); }
.rail a .tip { position: absolute; left: 52px; padding: 2px 8px; border-radius: 6px; background: var(--ink); color: var(--paper);
  font-size: var(--f-13); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5; }
.rail a:hover .tip, .rail a:focus-visible .tip { opacity: 1; }
.rail .spacer { flex: 1; }
.rail svg { width: 22px; height: 22px; }
.content { min-width: 0; }
.page { max-width: 1120px; padding: var(--s-6) var(--s-6) var(--s-8); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head p { margin: var(--s-1) 0 0; color: var(--ink-2); }
.foot { padding: var(--s-5) var(--s-6); color: var(--ink-2); font-size: var(--f-13); border-top: 1px solid var(--rule); }
.foot-links { display: inline-flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); margin-left: var(--s-2); }
.foot-links a { color: var(--ink-2); }

@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 64px; background: none; }
  .rail { position: fixed; inset: auto 0 0 0; top: auto; height: 64px; flex-direction: row; justify-content: space-around;
    padding: 0 var(--s-2); border-right: 0; border-top: 1px solid var(--rule); z-index: 20; }
  .rail .mark, .rail .spacer, .rail .tip { display: none; }
  .page { padding: var(--s-5) var(--s-4) var(--s-7); }
  .foot { padding: var(--s-4); }
}

/* ── sheet: the document, the only element with a shadow ─────────────── */
.sheet { background: var(--sheet); border-radius: var(--r-sheet); box-shadow: var(--sheet-shadow); padding: var(--s-6); position: relative; }
@media (max-width: 767px) { .sheet { padding: var(--s-4); } }

/* ── panels: separated by rules, no shadow ───────────────────────────── */
.panel { border-top: 1px solid var(--rule); padding: var(--s-4) 0; }
.panel:first-child { border-top: 0; }
.panel > h2 { margin-bottom: var(--s-2); }

/* ── controls ────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-ctl); border: 1px solid transparent; font: 600 var(--f-15)/1 "Onest", system-ui, sans-serif;
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--stamp); color: var(--on-stamp); }
.btn-primary:hover { background: color-mix(in srgb, var(--stamp) 88%, var(--ink)); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--control); }
.btn-quiet:hover { background: var(--paper); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--rule)); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 0 var(--s-3); font-size: var(--f-13); }
.btn kbd { font: 500 11px/1 "Onest", sans-serif; padding: 3px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .6; }

label.field { display: block; }
label.field > span { display: block; font-size: var(--f-13); line-height: 18px; font-weight: 500; color: var(--ink-2); margin-bottom: var(--s-1); }
.input, input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 40px; padding: var(--s-2) var(--s-3); border: 1px solid var(--control); border-radius: var(--r-ctl);
  background: var(--sheet); color: var(--ink); font: 400 var(--f-15)/22px "Onest", system-ui, sans-serif; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--stamp); box-shadow: var(--focus); }
input[aria-invalid="true"] { border-color: var(--bad); }
.hint { font-size: var(--f-13); color: var(--ink-2); margin-top: var(--s-1); }
.error-text { font-size: var(--f-13); color: var(--bad); margin-top: var(--s-1); }

/* ── status: always icon + word + colour ─────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
  font-size: var(--f-13); line-height: 20px; font-weight: 550; white-space: nowrap; }
.tag svg { width: 14px; height: 14px; flex: none; }
.tag-ok { color: var(--ok); background: var(--ok-wash); }
.tag-warn { color: var(--warn); background: var(--warn-wash); }
.tag-bad { color: var(--bad); background: var(--bad-wash); }
.tag-stamp { color: var(--stamp); background: var(--stamp-wash); }
.tag-quiet { color: var(--ink-2); background: color-mix(in srgb, var(--rule) 55%, transparent); }

/* ── checks list ─────────────────────────────────────────────────────── */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 20px 1fr; gap: var(--s-2); padding: 6px 0; font-size: var(--f-15); line-height: 22px; }
.checks li svg { width: 18px; height: 18px; margin-top: 2px; }
.checks .ok { color: var(--ok); } .checks .warn { color: var(--warn); } .checks .bad { color: var(--bad); }
.checks li span { color: var(--ink); }
details.passed > summary { cursor: pointer; color: var(--ok); font-weight: 550; list-style: none; padding: 6px 0; }
details.passed > summary::-webkit-details-marker { display: none; }
details.passed > summary svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }

kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: 5px; background: var(--sheet); color: var(--ink-2); font: 500 12px/18px "Onest", system-ui, sans-serif; text-align: center; }

/* ── tables ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--f-15); }
table.data th { text-align: left; font-size: var(--f-13); font-weight: 500; color: var(--ink-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--rule); }
table.data td { padding: var(--s-3); border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data th.num, table.data td.num { text-align: right; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--stamp-wash) 40%, transparent); }

/* ── empty state ─────────────────────────────────────────────────────── */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-8) var(--s-4); color: var(--ink-2); }
.empty h1, .empty h2 { color: var(--ink); font-size: var(--f-21); }

/* ── toast ───────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: var(--s-5); left: 50%; transform: translateX(-50%); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-ctl); background: var(--ink); color: var(--paper); font-weight: 550; z-index: 50; }
@media (max-width: 767px) { .toast { bottom: 80px; } }

/* ── the stamp: the one bold thing (DESIGN.md → Idea) ────────────────── */
.stamp { position: absolute; right: var(--s-6); bottom: var(--s-6); display: grid; justify-items: center; gap: 2px;
  padding: 10px 18px 8px; border: 3px solid var(--stamp); border-radius: 10px; color: var(--stamp);
  transform: rotate(-6deg); mix-blend-mode: multiply; filter: url(#ink); pointer-events: none; }
:root[data-theme="dark"] .stamp { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stamp { mix-blend-mode: screen; } }
.stamp.rejected { border-color: var(--bad); color: var(--bad); }
.stamp b { font-size: var(--f-21); letter-spacing: .14em; font-weight: 800; line-height: 1.1; }
.stamp small { font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.stamp.press { animation: press .42s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes press {
  0% { opacity: 0; transform: rotate(-6deg) scale(1.9); }
  60% { opacity: 1; transform: rotate(-6deg) scale(.96); }
  100% { opacity: .92; transform: rotate(-6deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .stamp.press { animation: none; opacity: .92; } * { transition: none !important; } }
@media (max-width: 767px) { .stamp { right: var(--s-4); bottom: var(--s-4); } }

/* ── payment note: invoice paid from a bank statement (desk and bank) ── */
.paid-note { display: flex; gap: var(--s-2); align-items: flex-start; margin: 0; font-size: var(--f-15); }
.paid-note svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.paid-note.ok svg { color: var(--ok); } .paid-note.warn svg { color: var(--warn); }

/* ── touch screens (tablets, phones): fingers instead of a mouse ───────────
   Every control at least 44 × 44 px, inputs at 16 px (iOS zooms into anything smaller), keyboard hints hidden,
   and the rail says in words what each icon is, since there is no hover to show the tooltip. */
@media (pointer: coarse) {
  .btn, .btn-sm { min-height: 44px; }
  .input, input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { min-height: 44px; font-size: 16px; }
  .btn kbd { display: none; }
  /* taller tap area, the disclosure triangle stays (no display change) */
  details:is([open], :not([open])) > summary { min-height: 44px; padding-block: 10px; }
  details.passed > summary { display: flex; align-items: center; gap: 6px; }
  .foot-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .foot-links { gap: 0 var(--s-4); }
  .btn:active, .rail a:active { transform: translateY(1px); }
}
@media (pointer: coarse) and (min-width: 768px) {
  :root { --rail: 80px; }
  .rail { gap: var(--s-1); padding: var(--s-3) 0; overflow-y: auto; }
  .rail .mark { margin-bottom: var(--s-2); }
  .rail a { width: 72px; height: auto; min-height: 52px; gap: 2px; padding: 6px 2px; align-content: center; }
  .rail a.home { min-height: 48px; }
  .rail a .tip { position: static; opacity: 1; padding: 0; background: none; color: inherit; font-size: 11px; line-height: 13px;
    font-weight: 550; white-space: normal; text-align: center; max-width: 68px; }
  .rail a:hover { background: none; }
  .rail a[aria-current="page"] { background: var(--stamp-wash); }
}
@media (min-width: 768px) and (max-width: 1199px) { .page { padding: var(--s-5) var(--s-5) var(--s-7); } }
/* landscape tablets are short: tighter rail so nothing scrolls inside it */
@media (pointer: coarse) and (min-width: 768px) and (max-height: 860px) {
  .rail a { min-height: 48px; padding: 4px 2px; }
  .rail .mark { width: 32px; height: 32px; }
}
