/* css/components.css
   Created :: 2026-11-01

   Komponenty — stavební prvky všech stránek (aplikace i login).
   HTML pro ně generují funkce v _templates/ui.php (ui_card, ui_table, ui_field, ui_badge …).
   Hodnoty jen z css/tokens.css. Přehled se vzorky: Settings → Templates.

   Obsah:  1 Nadpis stránky · 2 Taby · 3 Karta · 4 Pole: hodnota (kv) · 5 Tabulka · 6 Formulář
           7 Tlačítka · 8 Štítky · 9 Hlášky · 10 Filtry · 11 Prázdný stav · 12 Registry (ARES/VIES)
           13 Obsahové karty (kontakt, produkt, výběr) · 21 Výrobní kalendář
*/


/* ============ 1. Nadpis stránky ============ */
.page-header { margin-bottom: var(--sp-5); }
.page-header__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.page-header__actions { display: flex; gap: var(--sp-2); }
.page-header__row + .page-desc { margin-top: var(--sp-1); }
.page-desc { color: var(--c-text-2); max-width: 760px; }
.page-header .tabs { margin-top: var(--sp-4); }
.back-link { display: inline-block; margin-bottom: var(--sp-3); color: var(--c-text-2); }
.back-link:hover { color: var(--c-text); }

/* Drobečková navigace nad nadpisem (ui_breadcrumbs) — skupina menu je text, stránky odkazy, poslední = aktuální */
.breadcrumbs { margin-bottom: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-3); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
.breadcrumbs li { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.breadcrumbs li + li::before { content: "›"; color: var(--c-text-3); }
.breadcrumbs a { color: var(--c-text-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--c-text); text-decoration: underline; }
.breadcrumbs [aria-current] span { color: var(--c-text); font-weight: var(--fw-medium); }


/* ============ 2. Taby ============ */
/* Šedá linka jako inset stín (uvnitř boxu) — border by kvůli overflow-x ořízl podtržení aktivního tabu → dvojitá čára */
.tabs { display: flex; gap: var(--sp-5); box-shadow: inset 0 -1px 0 var(--c-border); overflow-x: auto; }
.tab {
  padding: var(--sp-2) 0;
  border-bottom: 2px solid transparent;
  color: var(--c-text-2); font-weight: var(--fw-medium); white-space: nowrap;
  transition: color .12s ease, border-color .12s ease;
}
.tab:hover     { color: var(--c-text); }
.tab.is-active { color: var(--c-accent); border-bottom-color: var(--c-accent); }


/* ============ 3. Karta ============ */
.card {
  background: var(--c-surface-glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(16,24,40,.06);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.card + .card, .card + .table-wrap, .table-wrap + .card { margin-top: var(--sp-4); }
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.card__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.card__desc  { color: var(--c-text-2); margin-top: 2px; }
.card__body  { padding: var(--sp-5); }
.card__body--flush { padding: 0; }
.card__footer { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--c-border); background: rgba(249,250,251,.8); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: var(--sp-4); align-items: start; }
.cards-grid > .card + .card { margin-top: 0; }


/* ============ 4. Pole: hodnota (kv) ============ */
.kv { margin: 0; }
.kv__row {
  display: grid; grid-template-columns: minmax(170px, 40%) minmax(0, 1fr); gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}
.kv__row:last-child { border-bottom: 0; }
.kv dt { color: var(--c-text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .kv__row { grid-template-columns: 1fr; gap: 2px; } }


/* ============ 5. Tabulka ============ */
.table-wrap {
  background: var(--c-surface-glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(16,24,40,.06);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
}
.card__body--flush > .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: var(--sp-2) var(--sp-4);
  background: rgba(249,250,251,.85);
  border-bottom: 1px solid var(--c-border);
  text-align: left; vertical-align: bottom; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-2);
}
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(37,99,235,.035); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table a:not([class]) { text-decoration: none; font-weight: var(--fw-medium); }
.table a:not([class]):hover { text-decoration: underline; }
.table--compact td { padding: var(--sp-2) var(--sp-4); }
.table td.cell-main { min-width: 220px; }   /* hlavní sloupec (název) se na úzké obrazovce nemačká */
.table details summary { cursor: pointer; color: var(--c-text-2); }


/* ============ 6. Formulář ============ */
.form { max-width: var(--form-max); }
.form-section + .form-section { margin-top: var(--sp-4); }
.form-section .card__body { display: flex; flex-direction: column; gap: var(--sp-4); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-weight: var(--fw-medium); color: var(--c-text); }
.field__label .field__opt { font-weight: var(--fw); color: var(--c-text-3); }
.field__req { color: var(--c-danger); font-weight: var(--fw-medium); }
.field__hint  { font-size: var(--fs-sm); color: var(--c-text-3); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }

/* Výběr souborů (ui_file_input) — tlačítko aplikace + název souboru */
.file-input { position: relative; display: inline-flex; align-items: center; gap: var(--sp-3); max-width: 100%; cursor: pointer; }
.file-input .btn { flex-shrink: 0; }
.file-input input:focus-visible + .btn { border-color: var(--c-accent); box-shadow: var(--focus); }
.file-input__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text-2); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* Ovládací prvky — globálně, aby vypadaly stejně i ve starším HTML */
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=search], input[type=date], input[type=url],
select, textarea {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r);
  color: var(--c-text);
  font-size: var(--fs);
  box-shadow: var(--shadow-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { height: auto; min-height: 96px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: var(--lh); }
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%2398a2b3' d='M2 4l4 4 4-4z'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 10px;
}
input::placeholder, textarea::placeholder { color: var(--c-text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--focus); }
input:disabled, select:disabled, textarea:disabled, .is-readonly {
  background-color: var(--c-surface-2); color: var(--c-text-2); box-shadow: none; cursor: not-allowed;
}
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--c-accent); flex-shrink: 0; }

/* Zaškrtávátko s popiskem */
.check { display: flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; }
.check input { margin-top: 2px; }
.check__text small { display: block; color: var(--c-text-3); }

.form-actions { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5); }


/* ============ 7. Tlačítka ============ */
.btn, button[type=submit]:not([class]) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 var(--sp-4);
  border-radius: var(--r); border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text);
  font-weight: var(--fw-medium); white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--c-surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn[hidden] { display: none; }

.btn--primary, button[type=submit]:not([class]) {
  background: linear-gradient(180deg, #3b82f6, var(--c-accent));
  border-color: var(--c-accent); color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn--primary:hover, button[type=submit]:not([class]):hover { background: linear-gradient(180deg, var(--c-accent), var(--c-accent-hover)); border-color: var(--c-accent-hover); }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--c-text-2); }
.btn--ghost:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn--danger { color: var(--c-danger); }
.btn--sm { height: var(--control-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn--block { width: 100%; }


/* ============ 8. Štítky ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px var(--sp-2);
  border-radius: var(--r-full); border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 18px; white-space: nowrap;
}
.badge--ok     { background: var(--c-ok-soft);     color: var(--c-ok);     border-color: var(--c-ok-line); }
.badge--warn   { background: var(--c-warn-soft);   color: var(--c-warn);   border-color: var(--c-warn-line); }
.badge--danger { background: var(--c-danger-soft); color: var(--c-danger); border-color: var(--c-danger-line); }
.badge--info   { background: var(--c-info-soft);   color: var(--c-info);   border-color: var(--c-info-line); }
.badge--muted  { background: var(--c-muted-soft);  color: var(--c-text-2); border-color: var(--c-border); }


/* ============ 9. Hlášky (flash) ============ */
.alert {
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  border: 1px solid; border-radius: var(--r);
}
.alert ul { margin: 0; padding-left: var(--sp-4); }
.alert li + li { margin-top: var(--sp-1); }
.alert__title { display: block; font-weight: var(--fw-medium); }
.alert__body  { display: block; margin-top: 2px; opacity: .9; }
.alert--error   { background: var(--c-danger-soft); color: var(--c-danger); border-color: var(--c-danger-line); }
.alert--success { background: var(--c-ok-soft);     color: var(--c-ok);     border-color: var(--c-ok-line); }
.alert--info    { background: var(--c-info-soft);   color: var(--c-info);   border-color: var(--c-info-line); }
.alert--warning { background: var(--c-warn-soft);   color: var(--c-warn);   border-color: var(--c-warn-line); }


/* ============ 10. Filtry nad tabulkou ============ */
.filters { margin-bottom: var(--sp-4); }
.filters form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--c-text-2); }
.filters input, .filters select { height: var(--control-h-sm); font-size: var(--fs); width: auto; min-width: 140px; }
.filters button { height: var(--control-h-sm); }
.summary { margin-bottom: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-3); }


/* ============ 11. Prázdný stav ============ */
.empty {
  padding: var(--sp-7) var(--sp-5);
  text-align: center; color: var(--c-text-3);
  background: rgba(255,255,255,.55); border: 1px dashed var(--c-border-strong); border-radius: var(--r-lg);
}


/* V kartě je rámeček navíc — karta už ohraničení má */
.card .empty { padding: var(--sp-6) var(--sp-5); background: transparent; border: 0; border-radius: 0; }


/* ============ 12. Registry (ARES / VIES) ============ */
.registry-status          { display: block; font-size: var(--fs-sm); }
.registry-status:empty    { display: none; }
.registry-status.is-ok    { color: var(--c-ok); }
.registry-status.is-error { color: var(--c-danger); }
.field__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }


/* ============ 13. Obsahové karty ============ */
/* Kontakt */
.contact-card { padding: var(--sp-5); }
.contact-card h2 { margin-bottom: var(--sp-3); }
.contact-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.contact-lines li { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.contact-label { font-size: var(--fs-sm); color: var(--c-text-3); }

/* Produkt */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); }
.product-card { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .15s ease, transform .15s ease; }
.product-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.product-card__img { aspect-ratio: 4 / 3; background: var(--c-muted-soft) center / cover no-repeat; border-bottom: 1px solid var(--c-border); }
.product-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }
.product-card__body p { color: var(--c-text-2); }
.price { font-weight: var(--fw-bold); color: var(--c-accent); }

.product-detail { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: var(--sp-5); }
.product-detail__img { aspect-ratio: 1; border-radius: var(--r-lg); border: 1px solid var(--c-border); background: var(--c-muted-soft) center / cover no-repeat; }
.product-detail__info { display: flex; flex-direction: column; gap: var(--sp-3); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--sp-2); }
.gallery__img { aspect-ratio: 1; border-radius: var(--r); border: 1px solid var(--c-border); background: var(--c-muted-soft) center / cover no-repeat; }
@media (max-width: 720px) { .product-detail { grid-template-columns: minmax(0, 1fr); } }

/* Výběr kartou (checkbox) — onboarding Interests */
.choice-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.choice-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
}
.choice-card:hover { border-color: var(--c-border-strong); }
.choice-card:has(input:checked) { border-color: var(--c-accent); box-shadow: var(--focus); }
.choice-card__img { width: 64px; height: 64px; flex-shrink: 0; border-radius: var(--r); background: var(--c-muted-soft) center / cover no-repeat; }
.choice-card__body { flex: 1; min-width: 0; }
.choice-card__body p { color: var(--c-text-2); font-size: var(--fs-sm); }

/* Sekce stránky — mezera mezi bloky */
/* Sekce za jakýmkoli blokem (karta, tabulka, mřížka, prázdný stav) má odstup */
.section + .section, .card + .section, .table-wrap + .section, .cards-grid + .section, .empty + .section,
.form + .section, .product-detail + .section { margin-top: var(--sp-6); }
.section > h2 { margin-bottom: var(--sp-3); }


/* ============ 14. Design system (interní stránka Settings → Templates) ============ */
.ds .card + .card { margin-top: var(--sp-4); }
.ds-demo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.ds-demo > .page-header, .ds-demo > .alert, .ds-demo > .form, .ds-demo > .cards-grid,
.ds-demo > .table-wrap, .ds-demo > .empty { flex-basis: 100%; margin-bottom: 0; }
.ds .card__footer pre { margin: 0; background: transparent; border: 0; padding: 0; }
.ds-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.ds-swatch { display: flex; align-items: center; gap: var(--sp-3); }
.ds-swatch > span { width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--r); border: 1px solid var(--c-border); }
.ds-type + .ds-type { margin-top: var(--sp-2); }
.ds-form { display: flex; flex-direction: column; gap: var(--sp-4); max-width: none; }


/* ============ 15. Adresa (doručovací adresy firmy) ============ */
.address { line-height: var(--lh); }
.address__meta { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-2); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.card-actions form { margin: 0; }


/* ============ 16. Rozbalovací položka (FAQ) ============ */
.disclosure { border-bottom: 1px solid var(--c-border); }
.disclosure:last-child { border-bottom: 0; }
.disclosure > summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  font-weight: var(--fw-medium);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: "+"; color: var(--c-text-3); font-size: var(--fs-md); line-height: 1; transition: transform .15s ease; }
.disclosure[open] > summary::after { transform: rotate(45deg); }
.disclosure > summary:hover { background: rgba(37,99,235,.03); }
.disclosure__body { padding: 0 var(--sp-5) var(--sp-4); color: var(--c-text-2); }
.disclosure__body p + p { margin-top: var(--sp-2); }


/* ============ 17. Katalog (tyčinky, gramáže, nutriční hodnoty, fotky) ============ */
/* Karta produktu — kategorie nad názvem, gramáže a minimum dole */
.product-card__body { flex: 1; }
.product-card__kicker { font-size: var(--fs-sm); color: var(--c-text-3); text-transform: uppercase; letter-spacing: .04em; }
.product-card__meta { margin-top: auto; padding-top: var(--sp-2); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); color: var(--c-text-2); }
.catalogue-group + .catalogue-group { margin-top: var(--sp-6); }
.catalogue-group__title { margin-bottom: var(--sp-3); color: var(--c-text-2); }

/* Výběr gramáže — „chips" (odkazy, bez JS) */
.weight-picker__label { font-size: var(--fs-sm); color: var(--c-text-2); font-weight: var(--fw-medium); margin-bottom: var(--sp-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex; align-items: center; height: var(--control-h-sm); padding: 0 var(--sp-3);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-full); background: var(--c-surface);
  color: var(--c-text); text-decoration: none; font-weight: var(--fw-medium);
  transition: border-color .12s ease, background .12s ease;
}
.chip:hover { border-color: var(--c-text-3); }
.chip.is-active { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-accent); }

/* Nutriční tabulka (zákazník) a formulář hodnot (admin) */
/* Řádkové hlavičky = běžný text (ne styl hlavičky tabulky), zarovnané na střed řádku */
.nutrition th[scope="row"], .nutrition-form th[scope="row"] {
  background: transparent; vertical-align: middle; white-space: normal;
  font-size: var(--fs); font-weight: var(--fw); color: var(--c-text);
}
.nutrition th[scope="row"] { padding: var(--sp-2) var(--sp-4); }
.nutrition td, .nutrition-form td { vertical-align: middle; white-space: nowrap; }
.nutrition-form td { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
@media (max-width: 720px) { .nutrition td, .nutrition th[scope="row"] { white-space: normal; padding-left: var(--sp-3); padding-right: var(--sp-3); } }
.nutrition__sub { padding-left: var(--sp-5) !important; color: var(--c-text-2) !important; }
.nutrition-form td { width: 32%; }
.input-unit { display: flex; align-items: center; gap: var(--sp-2); }
.input-unit input { height: var(--control-h-sm); min-width: 0; text-align: right; }
.input-unit span { width: 32px; flex-shrink: 0; font-size: var(--fs-sm); color: var(--c-text-3); }

/* Náhled v tabulce (admin seznam) */
.thumb-cell { width: 56px; }
.thumb { display: block; width: 48px; height: 48px; border-radius: var(--r); border: 1px solid var(--c-border); background: var(--c-muted-soft) center / cover no-repeat; }

/* Fotky (admin) — dlaždice s akcemi */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-3); }
.media-tile { display: flex; flex-direction: column; gap: var(--sp-2); }
.media-tile__img { aspect-ratio: 1; border-radius: var(--r); border: 1px solid var(--c-border); background: var(--c-muted-soft) center / cover no-repeat; }
.media-tile__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); min-height: var(--control-h-sm); }
.media-tile__actions form { margin: 0; }

/* Malý formulář v řádku (přidat gramáž, nahrát fotky) a lišta pod obsahem karty */
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; }
.inline-form input[type="text"] { width: 80px; height: var(--control-h-sm); }
.card__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); }

/* Delší text (popis, složení) */
.prose { max-width: 760px; color: var(--c-text-2); }
.prose p + p { margin-top: var(--sp-2); }


/* ============ 18. Objednávky ============ */
/* Formulář přes celou šířku (položky objednávky) a mezery mezi kartami ve formuláři */
.form--wide { max-width: none; }
.form > .card + .card, .form > .card + .alert { margin-top: var(--sp-4); }

/* Množství / cena v řádku tabulky */
.qty-cell { width: 170px; }
.qty-cell input { height: var(--control-h-sm); text-align: right; }
input.is-invalid { border-color: var(--c-danger); }
.row-total td { font-weight: var(--fw-bold); background: rgba(249,250,251,.85); }

/* Seznam v hlášce (co chybí k odeslání) */
.alert__list { margin: var(--sp-1) 0 0; padding-left: var(--sp-5); }

/* Průběh objednávky — svislá osa, poslední krok zvýrazněný */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.timeline__item { position: relative; padding-left: var(--sp-5); }
.timeline__item::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--c-border-strong); }
.timeline__item:not(:last-child)::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: calc(-1 * var(--sp-4) + 4px); width: 1px; background: var(--c-border); }
.timeline__item:last-child::before { background: var(--c-accent); box-shadow: var(--focus); }
.timeline__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.timeline__body { margin-top: var(--sp-1); color: var(--c-text-2); }

/* Přidat do objednávky (detail tyčinky) */
.order-add { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--c-border); }
.order-add .field { flex: 0 1 240px; }
.order-add .btn { margin-top: 26px; }


/* ============ 19. Zákaznická agenda (zpětná vazba, reklamace, změny) ============ */
/* Termín po splatnosti */
.due-late { color: var(--c-danger); font-weight: var(--fw-medium); }

/* Přílohy */
.file-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.file-list__meta { color: var(--c-text-3); font-size: var(--fs-sm); }

/* Text zákazníka a odstavce uvnitř karty detailu */
.case-text { margin-top: var(--sp-4); color: var(--c-text-2); }
.case-text p + p { margin-top: var(--sp-2); }
.case-block + .case-block { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--c-border); }
.case-block h3 { margin-bottom: var(--sp-1); font-size: var(--fs); font-weight: var(--fw-bold); }


/* Doručovací adresa v objednávce: pole nové adresy jen při volbě „New address" */
.address-picker__new { display: none; margin-top: var(--sp-4); }
.address-picker:has(input[value="new"]:checked) .address-picker__new { display: block; }


/* ============ 20. Modální okno (ui_modal) ============ */
.modal { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: rgba(16,24,40,.45); }
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-shrink: 0; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--c-border); }
.modal__close { width: 32px; height: 32px; border: 0; border-radius: var(--r); background: transparent; color: var(--c-text-2); font-size: var(--fs-lg); line-height: 1; cursor: pointer; }
.modal__close:hover { background: var(--c-muted-soft); color: var(--c-text); }
.modal form { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; }
.modal__body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-5); }
.modal__body--flush { padding: 0; }
.modal__footer { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-shrink: 0; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--c-border); }

/* Výběr produktů do objednávky: příchuť, gramáž, množství */
.pick-note { padding: var(--sp-3) var(--sp-5); color: var(--c-text-2); border-bottom: 1px solid var(--c-border); }
.modal__body .alert { margin: var(--sp-3) var(--sp-5); }
.modal__body .disclosure__body { padding: 0; }
.pick-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) 110px 150px auto; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--c-border); color: var(--c-text); }
.pick-row:has(input[type="checkbox"]:checked) { background: var(--c-accent-soft); }
.pick-row__name { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; cursor: pointer; }
.pick-row__name small { display: block; color: var(--c-text-3); }
.pick-row__qty small { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--c-text-3); }
.pick-row__qty input { height: var(--control-h-sm); text-align: right; }
.pick-row select { height: var(--control-h-sm); }
@media (max-width: 640px) {
  .pick-row { grid-template-columns: 16px minmax(0, 1fr) minmax(0, 1fr); }
  .pick-row__name { grid-column: 2 / -1; }
  .pick-row__weight { grid-column: 2; }
  .pick-row__link { display: none; }
}


/* ============ 20. Rich text (texty z editoru) ============ */
/* Zobrazení .legal-text, .prose, .disclosure__body a tělo editoru .richtext-content mají stejná pravidla.
   :where + :not([class]) = specificita jedné třídy a jen holé značky z editoru: komponenty uvnitř disclosure
   (.case-block h3, .file-list a, .btn) mají přednost. */
:where(.legal-text, .prose, .disclosure__body, .richtext-content) { overflow-wrap: break-word; }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(h2, h3, h4):not([class]) { margin: var(--sp-4) 0 var(--sp-2); }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(h2, h3, h4):not([class]):first-child { margin-top: 0; }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(h4):not([class]) { color: var(--c-text-2); }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(li):not([class]) + :where(li):not([class]) { margin-top: var(--sp-1); }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(li) > :where(ul, ol):not([class]) { margin: var(--sp-1) 0 0; }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(blockquote):not([class]) { margin: 0 0 var(--sp-3); padding-left: var(--sp-3); border-left: 2px solid var(--c-border-strong); color: var(--c-text-2); }
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(ul, ol, blockquote):not([class]):last-child { margin-bottom: 0; }

/* Odkaz v delším textu: barva textu, jemná čára i v klidu (jinak by v odstavci nešel najít), po najetí plná */
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(a):not([class]) {
  color: var(--c-link);
  text-decoration: underline;
  text-decoration-color: var(--c-link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
:where(.legal-text, .prose, .disclosure__body, .richtext-content) :where(a):not([class]):hover { text-decoration-color: currentColor; }

/* Editor: rámeček jako pole formuláře */
.tox.tox-tinymce { border: 1px solid var(--c-border-strong); border-radius: var(--r); }
.tox.tox-tinymce:focus-within { border-color: var(--c-accent); box-shadow: var(--focus); }

/* Tělo editoru v iframe (body_class v js/richtext.js). Plugin autoresize zapisuje inline padding-left/right, proto !important. */
.richtext-content { min-height: 0; padding: var(--sp-3); padding-left: var(--sp-3) !important; padding-right: var(--sp-3) !important; }
.richtext-content:focus { outline: none; }

/* Širší okno s náhledem stránky (View as customer) */
.modal--wide { width: min(1240px, calc(100vw - 32px)); }
.modal__frame { display: block; width: 100%; height: min(78vh, 860px); border: 0; }
.preview-page { padding: var(--sp-5); }


/* ============ 21. Výrobní kalendář ============ */
/* Mřížka (ui_cal_grid): pozici bloků dává colspan tabulky, sloupce jsou stejně široké díky table-layout: fixed */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); margin-bottom: var(--sp-3); }
.cal-toolbar__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.cal-legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: 0 0 0 auto; padding: 0; font-size: var(--fs-sm); color: var(--c-text-2); }
.cal-legend li { display: inline-flex; align-items: center; gap: var(--sp-1); }
.cal-legend__mark { width: 18px; height: 12px; border: 1px solid var(--c-border-strong); border-radius: var(--r-sm); }

.cal-wrap {
  background: var(--c-surface-glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(16,24,40,.06);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
}
.cal-wrap:focus-visible { outline: none; box-shadow: var(--focus); }
.cal-wrap + .card, .cal-wrap + .section { margin-top: var(--sp-5); }
.cal { width: 100%; min-width: 960px; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.cal--month { min-width: 900px; }
.cal__label-col { width: 92px; }
.cal thead th { padding: var(--sp-1) 2px; background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-2); text-align: center; white-space: nowrap; overflow: hidden; }
.cal__day { border-left: 1px solid var(--c-border); }
.cal__day small { display: block; font-size: var(--fs-sm); color: var(--c-text-3); }
.cal__day.is-closed { color: var(--c-text-3); }
.cal__day.is-today { color: var(--c-text); font-weight: var(--fw-bold); box-shadow: inset 0 -2px 0 var(--c-text); }
.cal thead .cal__tick { padding: 0 2px; color: var(--c-text-3); text-align: left; font-weight: var(--fw); }
.cal__tick.is-day-start { border-left: 1px solid var(--c-border); }

/* Název linky zůstává vidět při posunu do strany */
.cal__corner, .cal__line { position: sticky; left: 0; z-index: 1; background: var(--c-surface); }
.cal thead .cal__corner { background: var(--c-surface-2); text-align: left; padding-left: var(--sp-3); }
.cal__line { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--c-border); font-weight: var(--fw-medium); text-align: left; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__line small { display: block; font-size: var(--fs-sm); font-weight: var(--fw); color: var(--c-text-3); }
.cal tbody tr:last-child > * { border-bottom: 0; }

.cal__slot { height: 54px; padding: 3px 1px; border-bottom: 1px solid var(--c-border); }
.cal__slot.is-day-start { border-left: 1px solid var(--c-border); }
.cal__slot.is-closed, .cal-legend__mark.is-closed { background: repeating-linear-gradient(135deg, var(--c-muted-soft) 0 5px, var(--c-surface) 5px 10px); }

/* Blok rezervace: stav je poznat i bez barvy (předběžná čárkovaně, ve výrobě silný levý okraj) */
.cal__block {
  display: flex; flex-direction: column; justify-content: center; min-height: 46px; padding: 2px var(--sp-1);
  overflow: hidden; border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  font-size: var(--fs-sm); line-height: var(--lh-tight); color: var(--c-text); text-decoration: none;
}
.cal__block:hover { box-shadow: var(--shadow); color: var(--c-text); text-decoration: none; }
.cal__block:focus-visible { outline: none; box-shadow: var(--focus); }
.cal__block-no, .cal__block-co { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__block-no { font-weight: var(--fw-bold); }
.cal__block-co { color: var(--c-text-2); }
.cal__block--tentative     { background: var(--c-warn-soft); border-color: var(--c-warn); border-style: dashed; }
.cal__block--confirmed     { background: var(--c-info-soft); border-color: var(--c-info-line); }
.cal__block--in_production { background: var(--c-ok-soft); border-color: var(--c-ok-line); border-left: 3px solid var(--c-ok); }
.cal__block--completed     { background: var(--c-muted-soft); border-color: var(--c-border); }
.cal__block--completed .cal__block-no { font-weight: var(--fw-medium); color: var(--c-text-2); }

/* Výběr volného dne (ui_date_choices) */
.date-choices { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-4); }
.date-choices__month { min-width: 0; margin: 0; padding: 0; border: 0; }
.date-choices__month legend { margin-bottom: var(--sp-2); padding: 0; font-weight: var(--fw-medium); color: var(--c-text-2); }
.date-choices__days { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.date-chip { position: relative; cursor: pointer; }
.date-chip input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.date-chip span { display: inline-flex; align-items: center; height: var(--control-h-sm); padding: 0 var(--sp-3); border: 1px solid var(--c-border-strong); border-radius: var(--r); background: var(--c-surface); white-space: nowrap; }
.date-chip:hover span { border-color: var(--c-text-3); }
.date-chip input:focus-visible + span { border-color: var(--c-accent); box-shadow: var(--focus); }
.date-chip input:checked + span { border-color: var(--c-accent); background: var(--c-accent-soft); font-weight: var(--fw-medium); box-shadow: var(--focus); }

/* Nastavení linek a tab Production */
.form-note { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--c-text-2); }
.time-cell { width: 110px; }
.time-cell input { height: var(--control-h-sm); }
.line-form { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--c-border); }
.line-form__actions { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--c-border); }
.card-actions--end { justify-content: flex-end; }
.slot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.slot-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.ds-wide { flex-basis: 100%; min-width: 0; }
.ds-wide .cal-legend { margin: 0 0 var(--sp-2); }
