/* Timberly design systém – GENEROVÁNO z docs/design-system (build.py). Needitovat ručně:
   uprav tokens.json nebo src/components.css a spusť python3 docs/design-system/build.py.
   Náhled: https://claude.ai/artifact/UHPao2tqfwbxXBsFCgUg7X */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400..700&display=swap");

:root {
  /* barvy */
  --canvas: #f3f2ef;
  --surface: #ffffff;
  --surface-sunken: #f7f6f3;
  --surface-hover: #faf9f7;
  --selected: #eceae6;
  --selected-row: #f7f5ff;
  --line: #e4e2dd;
  --line-soft: #efede9;
  --line-input: #cfccc5;
  --control-border: #8f8c85;
  --ink: #1e1d1b;
  --ink-muted: #67655e;
  --ink-subtle: #77746d;
  --ink-faint: #a3a098;
  --nav-ink: #5f5d57;
  --nav-hover: #e8e6e2;
  --nav-active: #1e1d1b;
  --on-fill: #ffffff;
  --accent: #614bf2;
  --accent-hover: #5038d9;
  --accent-soft: #efecfe;
  --accent-ink: #4f3ad8;
  --focus-halo: rgba(97, 75, 242, 0.18);
  --link: var(--accent);
  --success: #17784a;
  --success-soft: #e7f4ec;
  --warning: #8f5506;
  --warning-soft: #fcf0dc;
  --danger: #b5352a;
  --danger-soft: #fce9e6;
  --danger-strong: #d23f31;
  --info: #2457b8;
  --info-soft: #e8f0fd;
  --neutral-ink: #5e5c56;
  --neutral-soft: #f1f0ec;
  --spark: #9d90f7;
  --chart-1: #614bf2;
  --chart-2: #912061;
  --chart-3: #4354c8;
  --chart-4: #9d5b83;
  --chart-5: #207bb4;
  --chart-6: #4241a8;
  --scrim: rgba(30, 29, 27, 0.32);
  /* mezery */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  /* rádiusy */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 999px;
  /* rozměry */
  --control-sm: 26px;
  --control-md: 32px;
  --control-lg: 36px;
  --control-touch: 40px;
  --row: 52px;
  --row-dense: 42px;
  --tag: 22px;
  --tag-sm: 18px;
  --nav-item: 36px;
  --sidebar: 248px;
  --topbar: 48px;
  --content-top: 28px;
  --content-x: 24px;
  --content-bottom: 48px;
  /* stíny */
  --shadow-sheet: 0 1px 3px rgba(30, 29, 27, 0.05);
  --shadow-control: 0 1px 1px rgba(30, 29, 27, 0.04);
  --shadow-pop: 0 12px 32px -8px rgba(30, 29, 27, 0.22), 0 0 0 1px #e4e2dd;
  --shadow-focus: 0 0 0 2px #ffffff, 0 0 0 4px #614bf2;
  /* písma */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-icons: "Phosphor";
  --font-icons-fill: "Phosphor-Fill";
}

/* Timberly design systém: komponenty. Prefix tb-. Barvy, rozměry a stíny jen přes tokeny (tokens.json).
   Zdroj pravdy. Po úpravě spusť: python3 docs/design-system/build.py */

/* ---------- základ ---------- */
.tb-app, .tb-app *, .tb-app *::before, .tb-app *::after,
[class^="tb-"], [class*=" tb-"], [class^="tb-"]::before, [class*=" tb-"]::before, [class^="tb-"]::after, [class*=" tb-"]::after { box-sizing: border-box; }
.tb-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-muted { color: var(--ink-muted); }
.tb-subtle { color: var(--ink-subtle); }
.tb-strong { font-weight: 500; color: var(--ink); }
.tb-nowrap { white-space: nowrap; }
.tb-hide { display: none !important; }
/* atribut hidden vždy skryje, i když komponenta nastavuje display (tb-form, tb-field, tb-card…) */
[hidden] { display: none !important; }
.tb-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tb-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.tb-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.tb-spacer { margin-left: auto; }
.tb-kbd { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-subtle); font: 500 11px/1 var(--font-sans); }
.tb-avatar { width: 28px; height: 28px; flex: none; display: inline-grid; place-items: center; border-radius: var(--radius-full); background: var(--selected); color: var(--ink-muted); font-size: 11px; font-weight: 600; }
a.tb-link, .tb-link { color: var(--link); text-decoration: none; font-weight: 500; }
a.tb-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- ikony: velikosti (font a názvy ikon jsou v remote/phosphor.css) ---------- */
.tb-icon-sm { font-size: 13px; }
.tb-icon-lg { font-size: 20px; }

/* ---------- rozvržení aplikace ---------- */
.tb-body { margin: 0; background: var(--canvas); }
.tb-app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; background: var(--canvas); }
.tb-nav, .tb-topbar { font-family: var(--font-sans); font-size: 13px; line-height: 20px; color: var(--ink); }
.tb-app__side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.tb-sheet { margin: var(--space-2) var(--space-2) var(--space-2) 0; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-sheet); }
.tb-content { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--content-top) var(--content-x) var(--content-bottom); min-width: 0; }
/* Výchozí okraje prvků uvnitř systému (přebíjí základní pravidla p, h1–h3, form ze style.css) */
.tb-page :where(h1, h2, h3, h4, p, ul, ol, form, figure, dl, dd) { margin: 0; }
.tb-page :where(p) { line-height: inherit; }
.tb-page { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; font-family: var(--font-sans); font-size: 13px; line-height: 20px; color: var(--ink); -webkit-font-smoothing: antialiased; }
.tb-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-4); align-items: start; }
.tb-split--half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* vložený dokument (PDF faktury) a technický výpis */
.tb-frame { display: block; width: 100%; height: 78vh; min-height: 480px; border: 0; background: var(--surface-sunken); }
.tb-code { margin: 0; padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink); font: 12px/18px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- sidebar ---------- */
.tb-nav { display: flex; flex-direction: column; gap: 1px; padding: var(--space-3) var(--space-2) var(--space-4); background: var(--canvas); color: var(--nav-ink); }
.tb-nav__brand { display: flex; align-items: baseline; gap: 4px; padding: 6px 10px 14px; color: var(--ink); font-size: 15px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tb-nav__brand small { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; color: var(--nav-ink); }
.tb-nav a { color: inherit; text-decoration: none; }
.tb-nav summary { list-style: none; cursor: pointer; }
.tb-nav summary::-webkit-details-marker { display: none; }
.tb-nav__item, .tb-nav__section > summary { display: flex; align-items: center; gap: 10px; height: var(--nav-item); padding: 0 8px 0 10px; border-radius: var(--radius-md); font-weight: 500; white-space: nowrap; }
.tb-nav__item > span, .tb-nav__section > summary > span, .tb-nav__group > summary > span, .tb-nav__link > span { overflow: hidden; text-overflow: ellipsis; }
.tb-nav__item .ph, .tb-nav__section > summary .ph { font-size: 16px; }
.tb-nav__chev { margin-left: auto; font-size: 12px !important; color: var(--nav-ink); transition: transform 0.15s ease; }
.tb-nav details[open] > summary .tb-nav__chev { transform: rotate(90deg); }
.tb-nav__section[open] > summary, .tb-nav__section.has-active > summary { color: var(--ink); }
.tb-nav__list { display: flex; flex-direction: column; gap: 1px; padding: 1px 0 6px; }
.tb-nav__link, .tb-nav__group > summary { display: flex; align-items: center; gap: 8px; height: var(--nav-item); padding: 0 8px 0 36px; border-radius: var(--radius-md); white-space: nowrap; }
.tb-nav__sub { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 1px 0 4px; }
.tb-nav__sub::before { content: ""; position: absolute; left: 40px; top: 2px; bottom: 6px; width: 1px; background: var(--line-input); }
.tb-nav__sub .tb-nav__link { padding-left: 50px; }
.tb-nav__item:hover, .tb-nav__section > summary:hover, .tb-nav__link:hover, .tb-nav__group > summary:hover { background: var(--nav-hover); color: var(--ink); }
.tb-nav .is-active, .tb-nav [aria-current="page"] { background: var(--nav-active); color: var(--on-fill); font-weight: 500; }
.tb-nav .is-active:hover, .tb-nav [aria-current="page"]:hover { background: var(--nav-active); color: var(--on-fill); }
.tb-nav .tb-count { margin-left: auto; background: var(--accent-soft); color: var(--accent-ink); }
.tb-nav summary .tb-count + .tb-nav__chev { margin-left: 6px; }
.tb-nav .is-active .tb-count, .tb-nav [aria-current="page"] .tb-count { background: rgba(255, 255, 255, 0.18); color: var(--on-fill); }
.tb-nav summary:focus-visible, .tb-nav a:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.tb-nav__foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 10px 0; font-size: 12px; line-height: 16px; color: var(--nav-ink); }

/* ---------- horní lišta, drobečky, hledání ---------- */
.tb-topbar { display: flex; align-items: center; gap: var(--space-4); height: var(--topbar); padding: 0 var(--space-6); border-bottom: 1px solid var(--line); flex: none; }
.tb-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; color: var(--ink-muted); white-space: nowrap; }
.tb-crumbs > span, .tb-crumbs > a { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tb-crumbs > .ph { flex: none; }
.tb-crumbs a { color: inherit; text-decoration: none; }
.tb-crumbs a:hover { color: var(--ink); }
.tb-crumbs .ph { font-size: 12px; color: var(--ink-faint); }
.tb-crumbs [aria-current="page"] { color: var(--ink); font-weight: 500; }
.tb-search { position: relative; display: flex; align-items: center; width: 280px; margin-left: auto; }
.tb-search > .ph { position: absolute; left: 9px; color: var(--ink-subtle); pointer-events: none; }
.tb-search__input { width: 100%; height: 30px; padding: 0 44px 0 32px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink); font: inherit; }
.tb-search__input::placeholder { color: var(--ink-faint); }
.tb-search__input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-halo); }
.tb-search .tb-kbd { position: absolute; right: 6px; }
.tb-topbar__actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.tb-search + .tb-topbar__actions { margin-left: 0; }
.tb-topbar .tb-nav-toggle { display: none; }

/* ---------- hlavička stránky ---------- */
.tb-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-6); }
.tb-pagehead__title { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.tb-pagehead__sub { margin: 2px 0 0; color: var(--ink-muted); }

/* ---------- tlačítka ---------- */
.tb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-md); padding: 0 12px; border: 1px solid var(--line-input); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-control); font: 500 13px/1 var(--font-sans); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color 0.12s, border-color 0.12s; }
.tb-btn:hover { background: var(--surface-sunken); }
.tb-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.tb-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-fill); box-shadow: none; }
.tb-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.tb-btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-muted); }
.tb-btn--ghost:hover { background: var(--nav-hover); color: var(--ink); }
.tb-btn--danger { color: var(--danger); }
.tb-btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.tb-btn--link { height: auto; padding: 0; border: 0; background: none; box-shadow: none; color: var(--link); }
.tb-btn--link:hover { background: none; text-decoration: underline; text-underline-offset: 2px; }
.tb-btn--sm { height: var(--control-sm); padding: 0 9px; gap: 5px; font-size: 12px; }
.tb-btn--lg { height: var(--control-lg); padding: 0 16px; }
.tb-btn--block { width: 100%; }
.tb-btn--icon { width: var(--control-md); padding: 0; }
.tb-btn--icon.tb-btn--sm { width: var(--control-sm); }
.tb-btn:disabled, .tb-btn.is-disabled { opacity: 0.45; pointer-events: none; }
.tb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* ---------- karta ---------- */
.tb-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.tb-card--danger { border-color: var(--danger); }
.tb-card--danger > .tb-card__head { background: var(--danger-soft); border-bottom-color: var(--danger); }
.tb-card--flow.tb-card--danger > .tb-card__head:first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.tb-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.tb-card__title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); }
.tb-card__body { padding: var(--space-4); }
.tb-card__body > * + * { margin-top: var(--space-3); }
.tb-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 8px 10px 8px 14px; border-top: 1px solid var(--line); color: var(--ink-subtle); font-size: 12px; line-height: 16px; }

/* ---------- KPI ---------- */
.tb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.tb-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-2); padding: 11px 14px; margin: -1px 0 0 -1px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.tb-stat__label { grid-column: 1 / -1; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.tb-stat__value { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tb-stat__meta { grid-column: 1; font-size: 12px; line-height: 16px; color: var(--ink-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-stat__spark { grid-column: 2; grid-row: 2 / 4; align-self: end; width: 64px; height: 26px; color: var(--spark); }
.tb-stat__spark polyline { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.tb-stat__spark polygon { fill: currentColor; opacity: 0.12; stroke: none; }
.tb-stat--danger .tb-stat__value, .tb-stat--danger .tb-stat__spark { color: var(--danger-strong); }
a.tb-stat { color: inherit; text-decoration: none; }
a.tb-stat:hover { background: var(--surface-hover); }
a.tb-stat[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--nav-active); }

/* ---------- záložky ---------- */
.tb-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tb-tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink-muted); font: 500 13px/1 var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer; }
.tb-tab:hover { background: var(--surface-sunken); color: var(--ink); }
.tb-tab.is-active, .tb-tab[aria-selected="true"] { background: var(--selected); color: var(--ink); }
.tb-tab.is-active .tb-count, .tb-tab[aria-selected="true"] .tb-count { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.tb-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ---------- počet ---------- */
.tb-count { display: inline-grid; place-items: center; min-width: 20px; height: var(--tag-sm); padding: 0 6px; border-radius: var(--radius-full); background: var(--neutral-soft); color: var(--neutral-ink); font: 600 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.tb-count--soft { background: var(--accent-soft); color: var(--accent-ink); }
.tb-count--accent { background: var(--accent); color: var(--on-fill); }
.tb-count--danger { background: var(--danger-strong); color: var(--on-fill); }

/* ---------- stav ---------- */
.tb-status { display: inline-flex; align-items: center; gap: 6px; height: var(--tag); padding: 0 8px 0 7px; border-radius: var(--radius-md); background: var(--neutral-soft); color: var(--neutral-ink); font: 500 12px/1 var(--font-sans); white-space: nowrap; }
.tb-status::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.tb-status--icon { padding-left: 6px; }
.tb-status--icon::before { display: none; }
.tb-status .ph, .tb-status .ph-fill { font-size: 13px; }
.tb-status--sm { height: var(--tag-sm); padding: 0 6px 0 5px; gap: 5px; font-size: 11px; }
.tb-status--success { background: var(--success-soft); color: var(--success); }
.tb-status--warning { background: var(--warning-soft); color: var(--warning); }
.tb-status--danger { background: var(--danger-soft); color: var(--danger); }
.tb-status--info { background: var(--info-soft); color: var(--info); }
.tb-status--accent { background: var(--accent-soft); color: var(--accent-ink); }
.tb-status--muted { background: transparent; color: var(--ink-subtle); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- tag ---------- */
.tb-tag { display: inline-flex; align-items: center; gap: 6px; height: var(--tag); padding: 0 8px; border: 0; border-radius: var(--radius-md); background: var(--neutral-soft); color: var(--neutral-ink); font: 500 12px/1 var(--font-sans); white-space: nowrap; text-decoration: none; }
.tb-tag .ph { font-size: 13px; }
.tb-tag--outline { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.tb-tag--fill { background: var(--tag-color, var(--neutral-soft)); color: var(--tag-ink, var(--ink)); border-color: transparent; }
.tb-tag--color::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--tag-color, var(--control-border)); }
.tb-tag--add { background: transparent; border: 1px dashed var(--line-input); color: var(--ink-muted); padding: 0 8px 0 6px; cursor: pointer; }
.tb-tag--add:hover { border-color: var(--control-border); color: var(--ink); }
.tb-remove { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-subtle); cursor: pointer; }
.tb-remove .ph { font-size: 12px; }
.tb-remove:hover { background: var(--line); color: var(--ink); }
.tb-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- filtr ---------- */
.tb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tb-filter { display: inline-flex; align-items: center; gap: 6px; height: var(--control-sm); padding: 0 5px 0 9px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-muted); font: 400 12px/1 var(--font-sans); white-space: nowrap; }
.tb-filter b { font-weight: 500; color: var(--ink); }
.tb-filter--add { padding: 0 9px 0 7px; border-style: dashed; border-color: var(--line-input); cursor: pointer; }
.tb-filter--add:hover { border-color: var(--control-border); color: var(--ink); }

/* ---------- tabulka ---------- */
.tb-table-wrap { overflow-x: auto; }
.tb-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tb-table th, .tb-table td { padding: 0 12px; text-align: left; vertical-align: middle; white-space: nowrap; }
/* Víceřádkové buňky (dvouřádková buňka, zalomený text, štítky pod sebou) mají vzduch nahoře i dole. */
.tb-table td { padding-block: 10px; line-height: 20px; }
.tb-table th { height: 40px; background: var(--surface-sunken); border-bottom: 1px solid var(--line); color: var(--ink-muted); font-size: 12px; line-height: 16px; font-weight: 500; }
.tb-table th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tb-table th a:hover, .tb-table th[aria-sort] a { color: var(--ink); }
.tb-table td { height: var(--row); border-bottom: 1px solid var(--line-soft); }
.tb-table tbody tr:last-child td { border-bottom: 0; }
.tb-table tbody tr:hover td { background: var(--surface-hover); }
.tb-table tr.is-selected td, .tb-table tr.is-selected:hover td { background: var(--selected-row); }
.tb-table .tb-num { text-align: right; }
.tb-table .tb-col-check { width: 36px; padding-right: 0; }
.tb-table .tb-col-sep { border-left: 1px solid var(--line); }
.tb-table .tb-col-actions { width: 1%; text-align: right; }
.tb-table--dense td { height: var(--row-dense); padding-block: 7px; }
.tb-table--sticky th { position: sticky; top: 0; z-index: 1; }
/* Pevné sloupce: šířky jen z hlavičky (tb-w-* na každém th), takže tabulky se stejnou hlavičkou v kartách pod sebou mají sloupce
   zarovnané i když přetečou do šířky; dlouhé záhlaví se zalomí, buňky zůstávají na jednom řádku. */
.tb-table--fixed { table-layout: fixed; }
.tb-table--fixed th { white-space: normal; }
.tb-table td.tb-wrap { white-space: normal; min-width: 12em; }
.tb-table tfoot th, .tb-table tfoot td { height: var(--row); border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }
/* součty dokladu: úzká tabulka zarovnaná vpravo */
.tb-table--totals { width: auto; min-width: min(100%, 420px); margin-left: auto; }
.tb-table--totals tfoot th, .tb-table--totals tfoot td { font-size: 15px; }
/* editor řádků (položky faktury): pole v buňkách, na úzkém okně řádek jako mřížka */
.tb-table--edit th:first-child, .tb-table--edit td:first-child { padding-left: 10px; }
.tb-table--edit td { height: auto; padding: 4px 6px; vertical-align: top; }
.tb-table--edit tbody tr:hover td { background: none; }
.tb-table--edit td:has(> .tb-textarea) { width: 100%; }
.tb-table--edit .tb-textarea { min-height: var(--control-md); }
.tb-id { color: var(--ink-muted); }
.tb-entity { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.tb-entity__mark { width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center; border-radius: var(--radius-full); background: var(--neutral-soft); color: var(--neutral-ink); font: 600 9.5px/1 var(--font-sans); }

/* ---------- graf (inline SVG s viewBox; čáry stroke="currentColor") ---------- */
.tb-chart { display: block; width: 100%; max-width: 720px; height: auto; color: var(--ink-subtle); font-family: var(--font-sans); }
.tb-chart__series { color: var(--accent); }
.tb-chart__series--2 { color: var(--ink-subtle); }
.tb-chart__series--3 { color: var(--spark); }
.tb-chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---------- pruh podílů s legendou a volbami (PriceBar); šířka úseku z dat přes --share ---------- */
.tb-pricebar { max-width: 720px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.tb-pricebar__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); min-height: var(--tag); }
.tb-pricebar__title { margin: 0; font: 600 13px/20px var(--font-sans); letter-spacing: 0; color: var(--ink); }
.tb-pricebar__bar { display: flex; gap: 2px; height: 28px; margin: 10px 0 var(--space-2); border-radius: var(--radius-md); overflow: hidden; }
.tb-pricebar__bar:empty { background: var(--surface-sunken); }
.tb-pricebar__seg { flex: 0 1 var(--share, 0%); min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; background: var(--seg); color: var(--on-fill); font: 600 11px/14px var(--font-sans); font-variant-numeric: tabular-nums; }
.tb-pricebar__swatch { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--seg); }
.tb-pricebar__key { display: inline-flex; align-items: center; gap: 6px; }
.tb-pricebar__seg--1 { --seg: var(--chart-1); }
.tb-pricebar__seg--2 { --seg: var(--chart-2); }
.tb-pricebar__seg--3 { --seg: var(--chart-3); }
.tb-pricebar__seg--4 { --seg: var(--chart-4); }
.tb-pricebar__seg--5 { --seg: var(--chart-5); }
.tb-pricebar__seg--6 { --seg: var(--chart-6); }
.tb-pricebar__seg--profit { --seg: var(--success); }
.tb-pricebar__seg--vat { --seg: var(--neutral-soft); }
.tb-pricebar__seg.tb-pricebar__seg--vat { color: var(--ink-muted); }
.tb-pricebar__swatch.tb-pricebar__seg--vat { box-shadow: inset 0 0 0 1px var(--line); }
.tb-pricebar__note { margin: var(--space-2) 0 0; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.tb-pricebar__note strong { font-weight: 600; color: var(--ink); }
.tb-pricebar > .tb-msg { margin-top: var(--space-2); }
.tb-pricebar__options { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.tb-pricebar__option { display: grid; justify-items: center; gap: 2px; padding: 8px 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); text-align: center; cursor: pointer; transition: border-color 0.12s, background-color 0.12s; }
.tb-pricebar__option:hover { border-color: var(--accent); }
.tb-pricebar__option:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.tb-pricebar__option.is-current { border-color: var(--accent); background: var(--accent-soft); }
.tb-pricebar__pct { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.tb-pricebar__price { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.tb-pricebar__sub { font-size: 12px; line-height: 16px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.tb-pricebar__option:hover .tb-pricebar__sub, .tb-pricebar__option.is-current .tb-pricebar__sub { color: var(--ink-muted); }

/* ---------- stránkování ---------- */
.tb-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.tb-pager a, .tb-pager span { min-width: 28px; height: 28px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: var(--radius-md); color: var(--ink-muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.tb-pager a:hover { background: var(--surface-sunken); color: var(--ink); }
.tb-pager .is-current, .tb-pager [aria-current="page"] { background: var(--nav-active); color: var(--on-fill); font-weight: 600; }
.tb-pager .is-gap { min-width: 16px; padding: 0; color: var(--ink-faint); }

/* ---------- prázdný stav ---------- */
.tb-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 24px; text-align: center; color: var(--ink-muted); }
.tb-empty > .ph { font-size: 32px; color: var(--ink-faint); margin-bottom: 4px; }
.tb-empty__title { margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); }
.tb-empty p { margin: 0; max-width: 46ch; }
.tb-empty .tb-actions { margin-top: 8px; justify-content: center; }

/* ---------- formuláře ---------- */
.tb-form { display: flex; flex-direction: column; gap: var(--space-3); }
.tb-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3) var(--space-4); }
.tb-field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.tb-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.tb-req { color: var(--danger); }
.tb-input, .tb-select, .tb-textarea { width: 100%; height: var(--control-md); padding: 0 10px; border: 1px solid var(--line-input); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-control); font: 400 13px/20px var(--font-sans); font-variant-numeric: tabular-nums; }
.tb-textarea { height: auto; min-height: 84px; padding: 6px 10px; resize: vertical; }
.tb-select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2367655e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; }
.tb-input::placeholder, .tb-textarea::placeholder { color: var(--ink-faint); }
.tb-input:focus, .tb-select:focus, .tb-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-halo); }
.tb-input:disabled, .tb-select:disabled, .tb-textarea:disabled { background: var(--surface-sunken); color: var(--ink-faint); box-shadow: none; }
.tb-input--sm, .tb-select.tb-input--sm { height: var(--control-sm); font-size: 12px; }
.tb-input--lg { height: var(--control-lg); }
.tb-w-xs { width: 80px; } .tb-w-sm { width: 120px; } .tb-w-md { width: 200px; } .tb-w-lg { width: 300px; } .tb-w-full { width: 100%; }
.tb-affix { position: relative; display: flex; align-items: center; }
.tb-affix .tb-input { padding-right: 38px; }
.tb-affix__suffix { position: absolute; right: 10px; color: var(--ink-subtle); pointer-events: none; }
.tb-affix__prefix { position: absolute; left: 10px; color: var(--ink-subtle); pointer-events: none; }
.tb-affix__prefix ~ .tb-input { padding-left: 32px; }
.tb-help { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.tb-field--wide { grid-column: 1 / -1; }
/* krokovač množství (− pole +) v objednávkách; vyplněné množství zvýrazněné, ať je vidět, co se uloží */
.tb-stepper { display: inline-flex; align-items: center; gap: 2px; }
.tb-stepper .tb-input { width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.tb-stepper .tb-input:not(:placeholder-shown) { border-color: var(--accent); background: var(--accent-soft); }
.tb-thumb { display: block; max-width: 200px; max-height: 60px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.tb-error { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--danger); }
.tb-error .ph { font-size: 13px; }
.tb-field.is-invalid .tb-input, .tb-field.is-invalid .tb-select, .tb-field.is-invalid .tb-textarea { border-color: var(--danger); }
.tb-field.is-invalid .tb-input:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- zaškrtávátko, radio, přepínač ---------- */
.tb-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.tb-check input, input.tb-checkbox, .tb-picker__item input { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; flex: none; display: inline-grid; place-items: center; vertical-align: middle; border: 1.5px solid var(--control-border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.tb-check input:checked, input.tb-checkbox:checked, .tb-picker__item input:checked { background: var(--accent); border-color: var(--accent); }
.tb-check input:checked::after, input.tb-checkbox:checked::after, .tb-picker__item input:checked::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid var(--on-fill); border-width: 0 2px 2px 0; transform: rotate(45deg); }
/* částečný výběr (vybrat vše při části vybraných): pomlčka */
.tb-check input:indeterminate, input.tb-checkbox:indeterminate { background: var(--accent); border-color: var(--accent); }
.tb-check input:indeterminate::after, input.tb-checkbox:indeterminate::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: var(--on-fill); }
.tb-check input[type="radio"] { border-radius: var(--radius-full); }
.tb-check input[type="radio"]:checked { background: var(--surface); border: 5px solid var(--accent); }
.tb-check input[type="radio"]:checked::after { display: none; }
.tb-check input:focus-visible, input.tb-checkbox:focus-visible, .tb-picker__item input:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.tb-check input:disabled, .tb-picker__item input:disabled { background: var(--surface-sunken); border-color: var(--line-input); cursor: default; }
.tb-check:has(input:disabled) { color: var(--ink-faint); cursor: default; }
.tb-switch { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); cursor: pointer; }
.tb-switch input { appearance: none; -webkit-appearance: none; position: relative; width: 32px; height: 18px; margin: 0; flex: none; border-radius: var(--radius-full); background: var(--control-border); cursor: pointer; transition: background-color 0.15s; }
.tb-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: left 0.15s; }
.tb-switch input:checked { background: var(--accent); }
.tb-switch input:checked::after { left: 16px; }
.tb-switch input:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ---------- výběr zaškrtávátky (picker): skupiny tečou do sloupců, hledání, počítadlo ---------- */
.tb-picker__filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.tb-picker__filter .tb-input { width: 320px; max-width: 100%; }
.tb-picker__filter + .tb-picker { margin-top: var(--space-2); }
.tb-picker__count { font-size: 12px; line-height: 16px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-picker__group { columns: 220px; column-gap: var(--space-6); }
.tb-picker__group + .tb-picker__group { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.tb-picker__item { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 1px; padding: 4px 6px; break-inside: avoid; border-radius: var(--radius-md); color: var(--ink); line-height: 20px; cursor: pointer; }
.tb-picker__item input { margin-top: 2px; }
.tb-picker__item > span { min-width: 0; }
.tb-picker__item:hover { background: var(--surface-hover); }
.tb-picker__item:has(input:checked) { background: var(--accent-soft); font-weight: 500; }
.tb-picker__item:has(input:disabled) { background: none; color: var(--ink-faint); cursor: default; }
.tb-picker__note { color: var(--ink-subtle); font-weight: 400; }
.tb-picker__item:hover .tb-picker__note, .tb-picker__item:has(input:checked) .tb-picker__note { color: var(--ink-muted); }
.tb-picker__item:has(input:disabled) .tb-picker__note { color: var(--ink-faint); }
/* v tabulce (matice střih × barva): buňka s pickerem bere zbylou šířku, řádek zarovnaný nahoru */
.tb-table tr:has(> td > .tb-picker) > td { vertical-align: top; padding-top: var(--space-3); padding-bottom: var(--space-3); }
.tb-table tr:has(> td > .tb-picker) > td:has(> .tb-picker) { width: 100%; padding: var(--space-2) var(--space-2) var(--space-2) 6px; }
.tb-table tr:has(> td > .tb-picker):hover > td { background: none; }

/* ---------- hláška ---------- */
.tb-msg { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--neutral-soft); color: var(--ink); }
.tb-msg > .ph, .tb-msg > .ph-fill { font-size: 18px; margin-top: 1px; color: var(--neutral-ink); }
.tb-msg__title { font-weight: 600; }
.tb-msg p { margin: 0; }
.tb-msg ul, .tb-msg ol { margin: 4px 0 0; padding-left: 18px; }
.tb-msg--success { background: var(--success-soft); }
.tb-msg--success > .ph, .tb-msg--success > .ph-fill, .tb-msg--success .tb-msg__title { color: var(--success); }
.tb-msg--warning { background: var(--warning-soft); }
.tb-msg--warning > .ph, .tb-msg--warning > .ph-fill, .tb-msg--warning .tb-msg__title { color: var(--warning); }
.tb-msg--danger { background: var(--danger-soft); }
.tb-msg--danger > .ph, .tb-msg--danger > .ph-fill, .tb-msg--danger .tb-msg__title { color: var(--danger); }
.tb-msg--info { background: var(--info-soft); }
.tb-msg--info > .ph, .tb-msg--info > .ph-fill, .tb-msg--info .tb-msg__title { color: var(--info); }

/* ---------- tooltip ---------- */
.tb-tip { position: relative; display: inline-flex; }
.tb-tip__bubble { position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 20; transform: translateX(-50%); width: max-content; max-width: 260px; padding: 6px 8px; border-radius: var(--radius-md); background: var(--nav-active); color: var(--on-fill); font-size: 12px; line-height: 16px; font-weight: 400; opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.tb-tip:hover .tb-tip__bubble, .tb-tip:focus-within .tb-tip__bubble, .tb-tip.is-open .tb-tip__bubble { opacity: 1; }
.tb-tip--below .tb-tip__bubble { bottom: auto; top: calc(100% + 6px); }
.tb-help-dot { display: inline-grid; place-items: center; color: var(--ink-subtle); cursor: help; }

/* ---------- rozbalovací nabídka ---------- */
.tb-dropdown { position: relative; display: inline-block; }
.tb-dropdown > summary { list-style: none; cursor: pointer; }
.tb-dropdown > summary::-webkit-details-marker { display: none; }
.tb-dropdown__trigger { display: inline-flex; align-items: center; gap: 8px; height: var(--control-md); padding: 0 8px 0 2px; border-radius: var(--radius-md); color: var(--ink); font-weight: 500; white-space: nowrap; }
.tb-dropdown__trigger:hover, .tb-dropdown[open] > .tb-dropdown__trigger { background: var(--nav-hover); }
.tb-dropdown__trigger:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.tb-dropdown__trigger .ph-caret-down { font-size: 12px; color: var(--ink-subtle); }
.tb-dropdown__menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 220px; display: flex; flex-direction: column; gap: 1px; padding: 6px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.tb-dropdown--start .tb-dropdown__menu { right: auto; left: 0; }
.tb-dropdown__head { display: grid; gap: 2px; padding: 6px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.tb-dropdown__head b { font-weight: 600; color: var(--ink); }
.tb-dropdown__head small { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.tb-dropdown__item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink); font: 400 13px/1 var(--font-sans); text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.tb-dropdown__item .ph { color: var(--ink-subtle); }
.tb-dropdown__item:hover { background: var(--surface-sunken); color: var(--ink); }
.tb-dropdown__item[aria-current] { background: var(--selected); font-weight: 500; }
.tb-dropdown__item:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.tb-dropdown__item--danger, .tb-dropdown__item--danger .ph { color: var(--danger); }
.tb-dropdown__sep { height: 1px; margin: 4px 0; background: var(--line-soft); }

/* ---------- úzké okno: menu jako vysouvací panel ---------- */
.tb-app__scrim { display: none; }
@media (max-width: 900px) {
  .tb-app { grid-template-columns: minmax(0, 1fr); }
  .tb-app__side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(300px, 86vw); height: auto; background: var(--canvas); box-shadow: var(--shadow-pop); transform: translateX(-105%); transition: transform 0.2s ease; }
  .tb-app--nav-open .tb-app__side { transform: none; }
  .tb-app--nav-open .tb-app__scrim { display: block; position: fixed; inset: 0; z-index: 45; background: var(--scrim); }
  .tb-sheet { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .tb-topbar .tb-nav-toggle { display: inline-flex; }
  .tb-topbar { gap: var(--space-2); padding: 0 var(--space-3); }
  .tb-dropdown__label { display: none; }
  .tb-crumbs > :not([aria-current]) { display: none; }
  .tb-split { grid-template-columns: minmax(0, 1fr); }
  .tb-table--edit thead { display: none; }
  .tb-table--edit tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px 4px; border-bottom: 1px solid var(--line-soft); }
  .tb-table--edit td { border: 0; padding: 0; }
}

/* ---------- tisk: jen obsah stránky; části, které se tisknout nemají, mají tb-no-print ---------- */
@media print {
  .tb-body, .tb-app, .tb-sheet { background: var(--surface); }
  .tb-app { display: block; }
  .tb-app__side, .tb-app__scrim, .tb-topbar, .tb-no-print { display: none !important; }
  .tb-sheet { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .tb-content { padding: 0; }
  .tb-split { display: block; }
  .tb-card { break-inside: avoid; }
  .tb-tag--color::before, .tb-tag--fill, .tb-status::before, .tb-stepper .tb-input, .tb-pricebar__seg, .tb-pricebar__swatch { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) {
  .tb-app__side,
  .tb-nav__chev, .tb-switch input, .tb-switch input::after, .tb-tip__bubble, .tb-btn, .tb-pricebar__option { transition: none; }
}

/* ===== Rozšíření z UX auditu 2026-11-11 (schváleno uživatelem) ===== */

/* Lepivá hlavička tabulky, která se opravdu přilepí k oknu:
   karta ani obal tabulky nesmí mít overflow (jinak se sticky lepí k nim). Varianta pro dlouhé seznamy. */
.tb-card--flow { overflow: visible; }
.tb-card--flow .tb-table-wrap { overflow: visible; }
.tb-card--flow .tb-table--sticky th { top: 0; box-shadow: 0 1px 0 var(--line); }
.tb-card--flow > :first-child thead th:first-child, .tb-card--flow > form > :first-child thead th:first-child { border-top-left-radius: var(--radius-lg); }
.tb-card--flow > :first-child thead th:last-child, .tb-card--flow > form > :first-child thead th:last-child { border-top-right-radius: var(--radius-lg); }
.tb-card--flow .tb-card__head:first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }

/* Záhlaví skupiny řádků se součty (produkt → varianty, měsíc → objednávky, dodavatel → položky). */
.tb-table__group td, .tb-table__group th { background: var(--surface-sunken); font-weight: 600; color: var(--ink); border-top: 1px solid var(--line); }
.tb-table__group .tb-subtle { font-weight: 400; }
.tb-table__group:hover td { background: var(--surface-sunken); }
/* Svislý popisek nadskupiny (látka → produkty → varianty): první buňka s rowspan přes celou skupinu, text zdola nahoru.
   Text je vyjmutý z toku (absolutně v buňce), takže výšku řádků neurčuje; v krátké skupině se zalomí, celý název je v title. */
.tb-table td.tb-table__band, .tb-table tbody tr:hover td.tb-table__band { position: relative; width: calc(var(--space-8) + var(--space-2)); min-width: calc(var(--space-8) + var(--space-2)); padding: 0; background: var(--surface-sunken); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tb-table__band > span { position: absolute; inset: var(--space-3) 0; display: flex; align-items: safe center; justify-content: flex-end; overflow: hidden; writing-mode: vertical-rl; transform: rotate(180deg); white-space: normal; text-align: right; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink); }

/* Akční lišta (FormFooter / BulkBar): přilepená k dolnímu okraji okna, dokud je karta vidět. */
.tb-actionbar { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: 10px var(--space-4); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(20, 18, 14, 0.06); }
.tb-actionbar__info { color: var(--ink-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tb-actionbar__info strong { color: var(--ink); }
.tb-actionbar .tb-spacer { flex: 1; }
.tb-actionbar--bulk { background: var(--accent-soft); border-top-color: var(--accent); }
.tb-actionbar--idle { background: var(--surface-sunken); }
.tb-actionbar__dirty { display: inline-flex; align-items: center; gap: 6px; color: var(--warning); font-weight: 500; }
.tb-actionbar__dirty::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--warning); }

/* Sbalitelná sekce (<details>) se souhrnem a počtem – barvy setu, matice designu, cron monitor, nápověda „Jak se počítá“. */
.tb-disclosure { border-top: 1px solid var(--line-soft); }
.tb-disclosure > summary { display: flex; align-items: center; gap: var(--space-2); padding: 10px var(--space-4); cursor: pointer; list-style: none; color: var(--ink); font-weight: 500; }
.tb-disclosure > summary::-webkit-details-marker { display: none; }
.tb-disclosure > summary::before { content: "\e13a"; font-family: var(--font-icons); color: var(--ink-subtle); transition: transform .15s; }
.tb-disclosure[open] > summary::before { transform: rotate(90deg); }
.tb-disclosure > summary .tb-subtle { font-weight: 400; }
.tb-disclosure > summary:hover { background: var(--surface-hover); }
.tb-disclosure__body { padding: 0 var(--space-4) var(--space-4) calc(var(--space-4) + 22px); }
.tb-disclosure--plain > summary { padding-left: 0; }
.tb-disclosure--plain .tb-disclosure__body { padding-left: 22px; }

/* Rejstřík sekcí dlouhé stránky (nastavení, detail analytiky). */
.tb-anchors { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: var(--space-4); }
.tb-anchors a { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--radius-md); color: var(--ink-muted); font-weight: 500; text-decoration: none; }
.tb-anchors a:hover { background: var(--surface-sunken); color: var(--ink); }
.tb-anchors a[aria-current] { background: var(--selected); color: var(--ink); }
.tb-page > .tb-anchors { margin-bottom: 0; } /* v tb-page odsazuje gap */

/* Dvouřádková buňka: hlavní hodnota + druhý řádek (cesta kategorie, popis, relativní datum). */
.tb-cell2 { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tb-cell2 > :first-child { color: var(--ink); }
.tb-cell2 > .tb-subtle { white-space: normal; }
.tb-table td > .tb-cell2 { padding-block: 3px; }
.tb-path { color: var(--ink-subtle); font-size: 12px; line-height: 16px; white-space: normal; }

/* Mini pruh rozpisu ceny do buňky tabulky (bez legendy; čísla v title). */
.tb-pricebar--mini { display: flex; height: 8px; min-width: 96px; border-radius: var(--radius-full); overflow: hidden; background: var(--surface-sunken); }
.tb-pricebar--mini > span { height: 100%; }

/* Časová osa zpráv (vratky, deník změn). */
.tb-timeline { display: flex; flex-direction: column; }
.tb-timeline__item { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line-soft); }
.tb-timeline__item:first-child { border-top: 0; }
.tb-timeline__icon { width: 28px; height: 28px; border-radius: var(--radius-full); display: grid; place-items: center; background: var(--surface-sunken); color: var(--ink-muted); }
.tb-timeline__meta { color: var(--ink-subtle); font-size: 12px; }
.tb-timeline__item--system .tb-timeline__icon { background: var(--neutral-soft); }

/* Pole množství: prázdné s placeholderem, vyplněné zvýrazněné (jako Stepper) – příjem, přesun, inventura, štítky. */
.tb-input--qty { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.tb-input--qty:not(:placeholder-shown) { border-color: var(--accent); background: var(--accent-soft); }
.tb-stepper--compact .tb-input { width: 40px; }
.tb-stepper--compact .tb-btn { width: 24px; min-width: 24px; padding: 0; }

/* Návrh hodnoty (placeholder + štítek „Doobjednat ~5“), přijetí tlačítkem „Vyplnit návrhy“. */
.tb-suggest { color: var(--warning); font-size: 12px; white-space: nowrap; }

/* Lepivý první sloupec široké tabulky (měsíc, produkt). */
.tb-table--stickycol th:first-child, .tb-table--stickycol td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line-soft); }
.tb-table--stickycol th:first-child { background: var(--surface-sunken); z-index: 2; }

/* Hodnota s intervalem / podrobnostmi v tooltipu – jen podtečkování, aby bylo vidět, že je co najet. */
.tb-hint { text-decoration: underline dotted var(--ink-faint); text-underline-offset: 3px; cursor: help; }

/* Nabídka v buňce akcí (zarovnané vpravo) má text zarovnaný vlevo. */
.tb-col-actions .tb-dropdown__menu { text-align: left; }
/* Viditelná akce + menu „…“ v buňce akcí zůstanou na jednom řádku vpravo (buňka má šířku 1 %). */
.tb-col-actions > .tb-row { flex-wrap: nowrap; justify-content: flex-end; }

/* ActionBar jako poslední prvek karty kopíruje její dolní rohy. */
.tb-card > .tb-actionbar:last-child, .tb-card > form:last-child > .tb-actionbar:last-child { border-bottom-left-radius: calc(var(--radius-lg) - 1px); border-bottom-right-radius: calc(var(--radius-lg) - 1px); }

/* Disclosure --plain bez čáry nahoře (uvnitř jiného bloku nebo položky Timeline). */
.tb-disclosure--plain { border-top: 0; }
.tb-timeline .tb-disclosure > summary { padding-block: 4px; }

/* Barevný počet na vybrané záložce si nechá svou barvu (dřív bílé na bílém). */
.tb-tab.is-active .tb-count--danger, .tb-tab[aria-selected="true"] .tb-count--danger { background: var(--danger-strong); box-shadow: none; }
.tb-tab.is-active .tb-count--accent, .tb-tab[aria-selected="true"] .tb-count--accent { background: var(--accent); box-shadow: none; }

/* Pole, selecty a krokovače v tabulkách: vyšší pro pohodlné kliknutí na PC i na mobilu (uživatel 14. 11. 2026). Šířka beze změny. */
.tb-table .tb-input, .tb-table .tb-select, .tb-table .tb-input--sm, .tb-table .tb-select.tb-input--sm { height: var(--control-lg); font-size: 13px; }
.tb-table .tb-stepper .tb-btn { height: var(--control-lg); }
.tb-table .tb-stepper:not(.tb-stepper--compact) .tb-btn { width: var(--control-lg); min-width: var(--control-lg); }
@media (pointer: coarse) {
  .tb-table .tb-input, .tb-table .tb-select, .tb-table .tb-input--sm, .tb-table .tb-select.tb-input--sm, .tb-table .tb-stepper .tb-btn { height: var(--control-touch); }
  .tb-table .tb-stepper:not(.tb-stepper--compact) .tb-btn { width: var(--control-touch); min-width: var(--control-touch); }
}
