/* =====================================================================
   THEME – JEDINÝ zdroj vzhledu celého systému.
   Čte ho web (přes <link href="/assets/theme.css">), PDF dokumenty i e-maily.
   Pro PDF a e-maily se var(--…) automaticky rozvinou na hodnoty (design_css()),
   protože mPDF ani e-mailoví klienti CSS proměnné neumí.

   >>> Chceš změnit vzhled celého systému? Uprav hodnoty v :root níže. <<<
   ===================================================================== */
:root {
    /* Značka a barvy */
    --brand:        #2563eb;   /* hlavní akční barva (tlačítka, aktivní menu, hlavička e-mailu) */
    --brand-dark:   #1f2937;   /* tmavá – postranní menu, přihlašovací pozadí */
    --accent:       #1a73e8;   /* zvýraznění v dokumentech (montážní list) */
    --ink:          #1f2937;   /* základní text */
    --ink-soft:     #334155;
    --muted:        #6b7280;   /* sekundární / popisky */
    --line:         #e5e7eb;   /* rámečky, oddělovače */
    --line-strong:  #cccccc;
    --line-soft:    #eeeeee;
    --page-bg:      #f3f4f6;   /* pozadí stránky / e-mailu */
    --surface:      #ffffff;   /* karty, panely */
    --thead-bg:     #f0f0f0;   /* hlavička tabulek v dokumentech */
    --bar-bg:       #2b2b2b;   /* tmavé pruhy a součty v montážním listu */
    --bar-fg:       #ffffff;
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;
    --info:         #0891b2;
    --secondary:    #6b7280;

    /* Typografie */
    --font-sans:    system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --doc-font:     dejavusans, sans-serif;     /* font pro PDF (mPDF) */
    --doc-size:     11px;

    /* Rozměry webu */
    --sidebar-width: 15.625rem;   /* 250 px při základním písmu 16 px; zmenšuje se spolu s písmem */
    --sidebar-bg:    #1f2937;
    --sidebar-fg:    #cbd5e1;
    --sidebar-active: #2563eb;
    --radius:        .5rem;

    /* Kontextový panel (pravý sloupec) */
    --rail-width:    18.75rem;    /* 300 px při základním písmu 16 px */
    --ctx-green:     #ecfdf5;   --ctx-green-ico: #16a34a;
    --ctx-blue:      #eff6ff;   --ctx-blue-ico:  #2563eb;
    --ctx-slate:     #f8fafc;   --ctx-slate-ico: #475569;
}

/* ============================  WEB APLIKACE  ============================ */
body { background: var(--page-bg); }

/* Přizpůsobení rozlišení: základní písmo webu (a s ním vše v rem – texty, odsazení, tlačítka,
   boční menu i pravý panel) se plynule zmenšuje s šířkou displeje: 16 px od 1920 px výše,
   14 px na 1200 px a níže. Třídu app-fluid má <html> webových layoutů; PDF a e-maily ji nemají. */
@media screen {
    html.app-fluid { font-size: clamp(14px, 10.67px + .2775vw, 16px); }
}
/* Dotyková zařízení: pole s písmem pod 16 px by iOS při zaměření přibližoval. */
@media (pointer: coarse) and (max-width: 767.98px) {
    html.app-fluid .form-control, html.app-fluid .form-select { font-size: 16px; }
}
/* Tabulky se mají vejít na šířku bez vodorovného posuvníku – text v buňkách se raději zalomí.
   (Posuvník zůstává jen jako pojistka tam, kde se obsah zmenšit nedá, např. řádky s formulářovými poli.)
   :where() drží nízkou specificitu, aby buňky se záměrným nowrap (akce, částky) zůstaly beze změny. */
:where(.app-body-main .table-responsive) > .table > * > tr > :where(th, td) { overflow-wrap: anywhere; }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    position: fixed; inset: 0 auto 0 0; height: 100vh;
    overflow-y: auto; z-index: 1030;
}
.app-main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; }
@media (max-width: 991.98px) { .app-main { margin-left: 0; } }

.sidebar-brand {
    display: flex; align-items: center; gap: .5rem;
    padding: 1rem 1.25rem; font-weight: 600; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: sticky; top: 0; background: var(--sidebar-bg);
}
.sidebar-brand i { font-size: 1.25rem; }

.nav-section-title {
    text-transform: uppercase; font-size: .7rem; letter-spacing: .05em;
    color: #64748b; padding: .75rem 1.25rem .25rem;
}
.app-sidebar .nav-link, .offcanvas .nav-link {
    color: var(--sidebar-fg); padding: .5rem 1.25rem;
    display: flex; align-items: center; gap: .6rem; border-radius: 0;
}
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-link-disabled { color: #64748b !important; cursor: not-allowed; opacity: .7; }
/* Rozbalovací kategorie menu (partials/nav.php) */
.nav-group-toggle {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    padding: .55rem 1.25rem; border: 0; background: none; text-align: left;
    color: var(--sidebar-fg); font-weight: 600; font-size: .95rem;
}
.nav-group-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group-toggle:focus-visible { outline: 2px solid var(--sidebar-active); outline-offset: -2px; }
.nav-group-toggle.has-active, .nav-group.is-open > .nav-group-toggle { color: #fff; }
.nav-group-chevron { font-size: .8rem; transition: transform .15s; opacity: .7; }
.nav-group.is-open > .nav-group-toggle .nav-group-chevron { transform: rotate(180deg); }
.nav-group-items { padding-bottom: .25rem; background: rgba(0,0,0,.12); }
/* lupa u hledání zákazníka (formulář zakázky) otevírá výběr ze seznamu */
.so-cust-browse { cursor: pointer; }
.input-icon > .so-cust-browse:hover, .input-icon > .so-cust-browse:focus-visible { color: var(--brand); background: #eef2ff; }
/* sdílené pole skladové karty (products/_search.php): obecný našeptávač pod polem */
.product-suggest { position: absolute; z-index: 1050; left: 0; right: 0; max-height: 260px; overflow: auto; }
.product-suggest:empty { display: none; }
/* sdílené pole zákazníka (customers/_search.php): našeptávač pod polem */
.customer-suggest { position: absolute; z-index: 1050; left: 0; right: 0; top: 100%; max-height: 260px; overflow: auto; }
.customer-suggest:empty { display: none; }
/* Podpora výrobců (menu Podpora) */
.sup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.sup-card { display: flex; flex-direction: column; }
.sup-note { color: var(--ink-soft); white-space: normal; overflow-wrap: anywhere; }
.sup-foot { display: flex; align-items: center; gap: .75rem; margin-top: .85rem; min-width: 0; }
.sup-card .so-card-head + .sup-foot { margin-top: 0; }
/* Nastavení firmy: náhled loga */
.co-logo { display: flex; align-items: center; justify-content: center; min-height: 130px; padding: .75rem; border: 1px dashed var(--line); border-radius: 12px; background: #f8fafc; text-align: center; }
.co-logo img { max-height: 120px; max-width: 100%; object-fit: contain; }
/* odznak s počtem u položky menu (Materiál k převzetí, Požadavky na díly); u kategorie jen když je sbalená */
.nav-badge, .app-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.25rem; padding: 0 .4rem;
    border-radius: 999px; background: #ef4444; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.nav-group.is-open > .nav-group-toggle .nav-badge--group { display: none; }
.app-sidebar .nav-link.nav-sub, .offcanvas .nav-link.nav-sub { padding: .4rem 1.25rem .4rem 2.4rem; font-size: .9rem; }
.sidebar-version { display: block; padding: .5rem 1.25rem; font-size: .72rem; color: #64748b; border-top: 1px solid rgba(255,255,255,.08); text-decoration: none; }
a.sidebar-version:hover, a.sidebar-version:focus-visible { color: #fff; }
.about-list { padding-left: 1.1rem; font-size: .9rem; }
.about-list li { padding: .15rem 0; }

#mobileMenu.offcanvas { background: var(--sidebar-bg); color: var(--sidebar-fg); }
#mobileMenu .offcanvas-header { border-bottom: 1px solid rgba(255,255,255,.08); }
#mobileMenu .offcanvas-title, #mobileMenu .btn-close { color: #fff; filter: invert(1); }
#mobileMenu .nav-section-title { color: #64748b; }

/* Dlaždice dashboardu: všechny stejně velké, i napříč řádky (grid-auto-rows: 1fr) */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 1rem; }
@media (min-width: 768px)  { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-card { height: 100%; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.05); border-left: 4px solid var(--line); }
.stat-card.border-start-primary { border-left-color: var(--brand); }
.stat-card.border-start-success { border-left-color: var(--success); }
.stat-card.border-start-warning { border-left-color: var(--warning); }
.stat-card.border-start-danger  { border-left-color: var(--danger); }
.stat-card.border-start-info    { border-left-color: var(--info); }
.stat-card.border-start-secondary { border-left-color: var(--secondary); }
.stat-icon { font-size: 1.75rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }

.guest-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    padding: 1rem;
}
.guest-card { background: #fff; border-radius: 1rem; padding: 2rem; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.guest-logo { font-size: 2.5rem; color: var(--brand); }

.card { border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---- Globální vyhledávání v horní liště ---- */
.app-search { flex: 1 1 auto; max-width: 620px; }
.app-search .input-group { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.app-search .input-group-text { background: transparent; border: 0; color: var(--muted); }
.app-search .form-control { border: 0; background: transparent; box-shadow: none; }
.app-search .form-control:focus { box-shadow: none; }
.app-search-kbd { font-size: .72rem; color: var(--muted); }

/* ---- Standardizovaná hlavička stránky ---- */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
/* název vlevo a akce vpravo zůstávají na jednom řádku (od tabletu výš) */
@media (min-width: 576px) {
    .page-header { flex-wrap: nowrap; }
    .page-header-main { flex: 1 1 auto; }
    .page-header-actions { flex: 0 0 auto; flex-wrap: nowrap; }
    .page-header-actions .btn { white-space: nowrap; }
}
.page-header-main { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.page-header-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--ctx-blue); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex: 0 0 auto; }
.page-header-title { font-size: 1.6rem; font-weight: 700; margin: 0; line-height: 1.15; }
.page-header-sub { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; }
.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.page-header-actions form { margin: 0; }
.min-w-0 { min-width: 0; }

/* ---- Formulářové taby (celá šířka, ikony) ---- */
/* Záložky se nikdy nesmí vylít z karty: když se nevejdou na řádek, zalomí se na další. */
.form-tabs, .nav-tabs, .nav-underline, .nav-pills { flex-wrap: wrap; max-width: 100%; }
.form-tabs { border-bottom: 1px solid var(--line); column-gap: .5rem; row-gap: 0; }
.form-tabs .nav-link { color: var(--muted); font-weight: 600; padding: .9rem .5rem; white-space: nowrap; }
.form-tabs .nav-link .bi { margin-right: .4rem; }
.form-tabs .nav-link.active { color: var(--brand); }

/* ---- Sekce formuláře + pole s ikonou ---- */
.form-section-head { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; }
.form-section-ico { width: 40px; height: 40px; border-radius: 11px; background: var(--ctx-blue); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex: 0 0 auto; }
.form-section-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
/* Pojistka: formuláře v kartě vždy na plnou šířku bloku (přebije i případný starý inline max-width). */
.card-body > form,
#custForm { max-width: none !important; width: 100% !important; }

.input-icon > .input-group-text { background: #fff; color: #9aa4b2; border-right: 0; }
.input-icon > .form-control { border-left: 0; padding-left: .25rem; }
.input-icon:focus-within > .input-group-text { border-color: #86b7fe; }

/* ---- Seznam popisek → hodnota (úzký sloupec pro ikonu / krátký popisek) ---- */
.kv-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: .75rem; row-gap: .4rem; align-items: baseline; }
.kv-list dt { font-weight: 600; white-space: nowrap; color: var(--muted); }
.kv-list dt .bi { font-size: 1rem; }
.kv-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---- Opakovatelné adresy ---- */
.addr-row { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: .85rem; }
.addr-row .addr-remove { position: absolute; top: .5rem; right: .5rem; }

/* ---- Drobečková navigace ---- */
.app-breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: .75rem; flex-wrap: wrap; }
.app-breadcrumb a { color: var(--muted); text-decoration: none; }
.app-breadcrumb a:hover { color: var(--brand); }
.app-breadcrumb-home { display: inline-flex; }
.app-breadcrumb-sep { font-size: .65rem; opacity: .55; }
.app-breadcrumb-current { color: var(--ink); font-weight: 600; }
/* Potvrzovací hláška na konci drobečkové navigace – po chvíli sama zmizí */
.app-breadcrumb-note { display: inline-flex; align-items: center; gap: .35rem; margin-left: .6rem; padding: .1rem .6rem; border-radius: 999px; background: #dcfce7; color: #15803d; font-weight: 600; animation: note-out .6s ease 8s forwards; }
.app-breadcrumb-note--info { background: #dbeafe; color: #1d4ed8; }
@keyframes note-out { to { opacity: 0; visibility: hidden; } }

/* Informační okna (výstraha, chyba, potvrzení, volba – app.js appDialog, partials/flash_dialog).
   Jednotná stavba: .glass-head (ikona + nadpis + zavřít) → .glass-body → .glass-actions (patička s tlačítky).
   Barva podle druhu: --dlg-c (ikona, horní linka), --dlg-bg (podklad ikony). */
.glass-backdrop { position: fixed; inset: 0; z-index: 1080; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: glass-fade .18s ease; }
.glass-dialog { --dlg-c: var(--warning); --dlg-bg: #fef3c7;
    position: relative; display: flex; flex-direction: column; width: min(100%, 440px); max-height: calc(100vh - 32px); overflow: hidden; text-align: left; color: var(--ink);
    background: var(--surface); border-radius: 12px; border-top: 3px solid var(--dlg-c);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .06), 0 24px 48px -12px rgba(15, 23, 42, .35), 0 4px 12px rgba(15, 23, 42, .08);
    animation: glass-pop .2s cubic-bezier(.2, .9, .3, 1); }
.glass-dialog--danger   { --dlg-c: var(--danger); --dlg-bg: #fee2e2; }
.glass-dialog--info,
.glass-dialog--question { --dlg-c: var(--brand); --dlg-bg: #dbeafe; }
.glass-dialog--wide { width: min(100%, 540px); }
.glass-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 20px; }
.glass-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--dlg-bg); color: var(--dlg-c); font-size: 18px; }
.glass-dialog h2 { flex: 1 1 auto; margin: 0; font-size: 1.05rem; font-weight: 650; line-height: 1.3; color: var(--ink); }
.glass-x { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; }
.glass-x:hover { background: #f1f5f9; color: var(--ink); }
.glass-body { padding: 0 20px 18px 68px; overflow-y: auto; font-size: .9rem; line-height: 1.5; color: var(--ink-soft); }
.glass-body p { margin: 0 0 6px; overflow-wrap: anywhere; }
.glass-body p:last-child { margin-bottom: 0; }
.glass-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 20px; background: #f8fafc; border-top: 1px solid var(--line); }
.glass-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 16px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; font-size: .875rem; font-weight: 600; line-height: 1.2; transition: background-color .12s ease, border-color .12s ease; }
.glass-btn:hover { background: #1d4ed8; border-color: #1d4ed8; }
.glass-btn:focus-visible, .glass-x:focus-visible, .glass-opt:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.glass-btn--ghost { background: var(--surface); border-color: #cbd5e1; color: var(--ink); }
.glass-btn--ghost:hover { background: #f1f5f9; border-color: #94a3b8; }
.glass-btn--warn { background: var(--warning); border-color: var(--warning); color: #fff; }
.glass-btn--warn:hover { background: #b45309; border-color: #b45309; }
/* shrnutí (dvojice popis – hodnota), např. díl / potřeba / zvolený sklad */
.glass-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; font-size: .85rem; }
.glass-facts dt { margin: 0; color: var(--muted); font-weight: 500; }
.glass-facts dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.glass-facts dd.is-bad { color: var(--danger); }
.glass-lead { margin: 0 0 10px; font-weight: 600; color: var(--ink); }
/* volby (např. sklady): řádek = název + štítky + poznámka, vpravo množství */
.glass-opts { display: flex; flex-direction: column; gap: 6px; }
.glass-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: left; font-size: .875rem; transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease; }
button.glass-opt:hover { border-color: var(--brand); background: #f5f9ff; box-shadow: 0 1px 0 rgba(37, 99, 235, .08); }
.glass-opt.is-warn { border-left: 3px solid var(--warning); }
button.glass-opt.is-warn:hover { border-color: var(--warning); background: #fffbeb; }
.glass-opt-main { flex: 1 1 auto; min-width: 0; }
.glass-opt-title { display: block; font-weight: 600; }
.glass-opt-note { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; }
.glass-opt-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.glass-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: .72rem; font-weight: 600; }
.glass-tag--brand { background: #dbeafe; color: #1d4ed8; }
.glass-tag--warn { background: #fef3c7; color: #92400e; }
.glass-tag--ok { background: #dcfce7; color: #166534; }
.glass-opt-qty { flex: none; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.glass-opt-qty small { display: block; color: var(--muted); font-size: .7rem; font-weight: 500; }
.glass-opt-go { flex: none; color: #94a3b8; }
button.glass-opt:hover .glass-opt-go { color: var(--brand); }
@media (max-width: 480px) {
    .glass-body { padding-left: 20px; }
    .glass-actions { flex-direction: column-reverse; }
    .glass-actions .glass-btn { width: 100%; }
}
@keyframes glass-fade { from { opacity: 0; } }
@keyframes glass-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .glass-backdrop, .glass-dialog { animation: none; } }

/* ============================  KONTEXTOVÝ PANEL (pravý sloupec)  ============================ */
.app-content { padding-left: 1.5rem; padding-right: 1.75rem; }
.app-body { display: flex; gap: 1.5rem; align-items: flex-start; }
.app-body-main { flex: 1 1 auto; min-width: 0; }
.context-rail { flex: 0 0 var(--rail-width); width: var(--rail-width); position: sticky; top: 72px; }
@media (max-width: 1199.98px) { .context-rail { display: none; } }

.ctx-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); margin-bottom: 1rem; overflow: hidden; }
.ctx-head { display: flex; gap: .75rem; align-items: center; padding: .9rem 1rem; }
.ctx-head--action  { background: var(--ctx-green); }
.ctx-head--tips    { background: var(--ctx-blue); }
.ctx-head--history { background: var(--ctx-slate); }
.ctx-ico { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fff; font-size: 1.05rem; flex: 0 0 auto; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.ctx-head--action  .ctx-ico { color: var(--ctx-green-ico); }
.ctx-head--tips    .ctx-ico { color: var(--ctx-blue-ico); }
.ctx-head--history .ctx-ico { color: var(--ctx-slate-ico); }
.ctx-title { font-weight: 600; font-size: .95rem; color: var(--ink); line-height: 1.25; }
.ctx-sub { font-size: .8rem; color: var(--muted); }

.ctx-actions { padding: .4rem; }
.ctx-action { display: flex; align-items: center; gap: .7rem; padding: .6rem; border-radius: 10px; text-decoration: none; color: var(--ink); }
.ctx-action:hover { background: var(--ctx-blue); }
.ctx-action-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--ctx-blue); color: var(--ctx-blue-ico); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex: 0 0 auto; }
.ctx-action-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.ctx-action-label { font-weight: 600; font-size: .88rem; line-height: 1.2; }
.ctx-action-desc { font-size: .78rem; color: var(--muted); }
.ctx-action-chev { color: #c0c6cf; font-size: .8rem; flex: 0 0 auto; }

.ctx-list { margin: 0; padding: .5rem 1rem 1rem 1.65rem; color: var(--ink-soft); font-size: .85rem; }
.ctx-list li { margin: .3rem 0; }

.ctx-hist { padding: .4rem; }
.ctx-hist-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 10px; text-decoration: none; color: var(--ink); }
a.ctx-hist-item:hover { background: var(--ctx-slate); }
.ctx-hist-ico { color: var(--muted); flex: 0 0 auto; }
.ctx-hist-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.ctx-hist-label { font-weight: 600; font-size: .86rem; line-height: 1.2; }
.ctx-hist-meta { font-size: .77rem; color: var(--muted); }
.ctx-hist-empty .ctx-sub { padding: .75rem 1rem .1rem; }
.ctx-stats { margin: 0; padding: .6rem 1rem .8rem; font-size: .88rem; }
.ctx-stat { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .3rem 0; }
.ctx-stat--sep { border-top: 1px solid var(--line-soft); margin-top: .3rem; padding-top: .6rem; }
.ctx-stat dt { font-weight: 400; color: var(--ink-soft); }
.ctx-stat dd { margin: 0; font-weight: 600; white-space: nowrap; }
.ctx-stat dd.ctx-stat-strong { font-size: 1.05rem; font-weight: 700; }
.ctx-contact { padding: .6rem 1rem .9rem; }
.ctx-contact-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; font-size: .88rem; }
.ctx-contact-row > .bi { color: var(--muted); flex: 0 0 auto; }
.ctx-contact-row > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ctx-contact-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* ============================  DETAIL ZÁKAZNÍKA  ============================ */
.page-header-ico--avatar { border-radius: 50%; font-size: 1.2rem; font-weight: 700; letter-spacing: .02em; }
/* Písmo se zmenšuje s šířkou displeje (app-fluid); rozložení se řídí šířkou samotného obsahu
   (container queries), takže se nikde neobjeví vodorovný posuvník. Velikosti uvnitř jsou v em. */
.cd-wrap { container-type: inline-size; font-size: .94rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 1em 1em; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.cd-tabs { border-bottom: 1px solid var(--line); margin-bottom: 1em; column-gap: 1.25em; row-gap: 0; flex-wrap: wrap; }
.cd-tabs .nav-link { color: var(--ink-soft); font-size: 1em; font-weight: 500; padding: .8em .15em; white-space: nowrap; }
.cd-tabs .nav-link .bi { margin-right: .3em; }
.cd-tabs .nav-link:hover, .cd-tabs .nav-link.active { color: var(--brand); }
.cd-tabs .nav-link.active { font-weight: 600; }
.cd-tab-count { background: #eef2f6; color: var(--muted); border-radius: 999px; padding: .05em .5em; font-size: .8em; font-weight: 600; margin-left: .3em; }
.cd-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1em; }
.cd-card { border: 1px solid var(--line); border-radius: 12px; padding: 1em; background: var(--surface); min-width: 0; }
.cd-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5em .7em; margin-bottom: .9em; }
.cd-ico { width: 2.3em; height: 2.3em; border-radius: .6em; background: var(--ctx-blue); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cd-title { font-size: 1.08em; font-weight: 700; margin: 0; }
.cd-wrap .btn-sm { font-size: .92em; white-space: nowrap; }
.cd-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 1.5em; row-gap: .55em; margin: 0; }
.cd-kv dt { font-weight: 400; color: var(--muted); }
.cd-kv dd { margin: 0; min-width: 0; overflow-wrap: break-word; }
.cd-kv a[href^="tel:"] { white-space: nowrap; }
.cd-pill { display: inline-block; background: #eef2f6; color: var(--ink-soft); border-radius: 999px; padding: .1em .7em; font-size: .9em; font-weight: 500; white-space: nowrap; }
.cd-pill--blue { background: var(--ctx-blue); color: var(--brand); }
/* Bloky adres se roztáhnou na celou šířku karty (auto-fit); na úzkém obsahu jsou pod sebou */
.cd-addrs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15em), 1fr)); gap: .7em; }
.cd-addr { border: 1px solid var(--line); border-radius: 10px; padding: .7em .8em; min-width: 0; }
.cd-addr-top { display: flex; align-items: center; gap: .5em; margin-bottom: .45em; }
.cd-addr-ico { font-size: 1.15em; color: var(--ink-soft); flex: 0 0 auto; }
.cd-addr-actions { display: flex; gap: .3em; margin-left: auto; flex: 0 0 auto; }
.cd-addr-actions form { margin: 0; }
.cd-addr-actions .btn { padding: .15em .5em; }
.cd-addr-body { overflow-wrap: break-word; line-height: 1.45; }
.cd-item, .cd-order { display: flex; align-items: center; gap: .3em .75em; padding: .55em .25em; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.cd-head + .cd-item, .cd-head + .cd-order { border-top: 0; }
.cd-item:hover, .cd-order:hover { background: var(--ctx-slate); }
.cd-item-thumb { width: 2.6em; height: 2.6em; border-radius: .6em; background: var(--ctx-slate); color: var(--ctx-slate-ico); display: flex; align-items: center; justify-content: center; font-size: 1.1em; flex: 0 0 auto; }
.cd-item-main, .cd-item-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 0; overflow-wrap: break-word; }
.cd-item-meta { color: var(--muted); font-size: .92em; }
.cd-item-chev { color: #c0c6cf; font-size: .85em; flex: 0 0 auto; }
.cd-order-status { flex: 0 0 7.5em; min-width: 0; }
.cd-order-status .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .82em; }
.cd-order-num { color: var(--brand); font-weight: 500; white-space: nowrap; }
.cd-order-app { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-order-date { color: var(--ink-soft); white-space: nowrap; }
.cd-more { padding: .5em .25em 0; font-size: 1em; text-decoration: none; }
.cd-note { overflow-wrap: break-word; }
/* Tabulky v záložkách: bez posuvníku – buňky se zalamují, na úzkém obsahu se skryjí vedlejší sloupce */
.app-body-main .cd-wrap .cd-table { table-layout: auto; width: 100%; margin: 0; }
.app-body-main .cd-wrap .cd-table > thead > tr > th, .app-body-main .cd-wrap .cd-table > tbody > tr > td { font-size: .95em; padding: .5em .5em; overflow-wrap: anywhere; }
.cd-wrap .cd-table .badge { white-space: normal; font-size: .85em; }
@container (min-width: 760px) {
    .cd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cd-grid > .cd-span { grid-column: 1 / -1; }
}
@container (max-width: 620px) {
    .cd-tabs { column-gap: .9em; }
    .cd-tabs .nav-link { padding: .6em .1em; }
    .cd-tabs .nav-link > .bi { display: none; }
    .cd-table .cd-col-extra { display: none; }
}
@container (max-width: 430px) {
    .cd-item, .cd-order { flex-wrap: wrap; }
    .cd-item-meta { flex: 1 1 100%; padding-left: 3.6em; }
    .cd-order-status { flex: 0 0 auto; }
    .cd-order-app { flex: 1 1 100%; white-space: normal; }
    .cd-kv { column-gap: .9em; }
}

/* ============================  VÝPISY (seznamy)  ============================
   Jednotný vzhled všech výpisů v systému (zákazníci, zakázky, faktury, sklad…).
   Stránka-výpis = jeden bílý panel přes celou šířku: [záložky] → filtry → tabulka → stránkování. */
.app-body--list .app-body-main { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.app-body--list .app-body-main > .card { box-shadow: none; border-radius: 0; }
.app-body--list .form-control, .app-body--list .form-select, .app-body--list .btn, .app-body--list .input-group-text { border-radius: 10px; }
.app-body--list .app-body-main > form[method="get"] .btn { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.app-body--list .app-body-main > form[method="get"] .btn:hover { background: var(--ctx-blue); color: var(--brand); }

/* Záložky s počty */
.list-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-bottom: .9rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
/* Hledání a tlačítko filtru na stejném řádku jako záložky (vpravo) */
.list-tabs-search { display: flex; align-items: center; gap: .5rem; flex: 1 1 320px; max-width: 560px; margin: 0 0 0 auto; }
.list-tabs-search .input-group { flex: 1 1 auto; flex-wrap: nowrap; }
.list-tabs-search .btn { white-space: nowrap; background: #fff; border: 1px solid var(--line); }
.list-tab { display: inline-flex; align-items: center; gap: .6rem; padding: .45rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); font-weight: 500; text-decoration: none; white-space: nowrap; }
.list-tab:hover { background: var(--ctx-blue); color: var(--brand); }
.list-tab-count { background: #eef2f6; color: var(--muted); border-radius: 999px; padding: .05rem .55rem; font-size: .78rem; font-weight: 600; }
.list-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.list-tab.active .list-tab-count { background: rgba(255,255,255,.25); color: #fff; }

/* Filtry nad tabulkou */
.list-filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.list-filters .list-search { flex: 1 1 280px; max-width: 440px; }
.list-filters .list-filter { flex: 0 1 185px; min-width: 140px; }
.list-filters .list-filter label { display: block; font-size: .82rem; color: var(--ink-soft); margin-bottom: .25rem; }
.list-filters .list-filters-end { margin-left: auto; }
.list-filters .btn-light { background: #fff; border: 1px solid var(--line); }

/* Tabulka výpisu */
.app-body-main .table > thead.table-light { --bs-table-bg: #f8fafc; }
.app-body-main .table > thead.table-light > tr > th { color: var(--ink); font-size: .8rem; font-weight: 600; border-bottom: 1px solid var(--line); }
.app-body-main .table-hover > thead > tr > th { padding: .55rem .6rem; }
.app-body-main .table-hover > tbody > tr > td { padding: .5rem .6rem; border-color: var(--line); font-size: .84rem; }
/* Výpis se musí vždy vejít na šířku – žádný vodorovný posuvník: text se raději zalomí. */
.app-body--list .table-responsive { overflow-x: visible; }
.app-body--list .table { width: 100%; }
.app-body--list .table th, .app-body--list .table td { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 1399.98px) {
    .app-body--list .app-body-main { padding: .75rem; }
    .app-body-main .table-hover > thead > tr > th, .app-body-main .table-hover > tbody > tr > td { padding: .45rem .45rem; }
    .app-body-main .table-hover > tbody > tr > td { font-size: .86rem; } /* základní písmo je tu už menší (app-fluid) */
}
/* Skladové karty: strom kategorií vlevo, výpis vpravo; stav zásoby jako barevný štítek */
.pc-layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.pc-tree { border-right: 1px solid var(--line); padding-right: 1rem; min-width: 0; }
/* strom kategorií zůstává při posouvání karet vidět (pod horní lištou jako pravý panel); dlouhý strom se posouvá sám */
@media (min-width: 768px) {
    .pc-tree { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; overscroll-behavior: contain; }
}
.pc-tree-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 1.05rem; margin-bottom: .6rem; }
.pc-tree-head .btn { background: var(--ctx-blue); color: var(--brand); border: 0; }
.pc-tree-item { display: flex; align-items: center; gap: .55rem; padding: .38rem .6rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.pc-tree-item:hover { background: var(--ctx-slate); }
.pc-tree-item.active { background: var(--ctx-blue); color: var(--brand); font-weight: 600; }
.pc-tree-item--off { opacity: .55; }
.pc-tree-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-tree-count { flex: 0 0 auto; background: #eef2f6; color: var(--muted); border-radius: 999px; padding: .05rem .55rem; font-size: .78rem; font-weight: 600; }
.pc-tree-item.active .pc-tree-count { background: #fff; color: var(--brand); }
.pc-main { min-width: 0; }
.pc-qty { display: inline-block; min-width: 3.6rem; text-align: center; border-radius: 8px; padding: .15rem .6rem; font-weight: 600; white-space: nowrap; }
.pc-qty--ok  { background: #dcfce7; color: #15803d; }
.pc-qty--low { background: #fef3c7; color: #b45309; }
.pc-qty--out { background: #fee2e2; color: #b91c1c; }
@media (max-width: 991.98px) {
    .pc-layout { grid-template-columns: minmax(0, 1fr); }
    .pc-tree { display: none; } /* na úzkém displeji stačí výběr kategorie ve filtrech */
}

/* Výpisy v Nastavení s úpravou přímo v řádku (stavy, číselníky, kategorie, sazby DPH):
   pole řádku patří k formuláři v poslední buňce (atribut form=""). */
.list-filters .list-filter.st-narrow { flex: 0 0 5.5rem; min-width: 0; }
.list-filters .list-filter.st-wide { flex: 1 1 16rem; max-width: 26rem; }
.st-preview { display: flex; align-items: center; gap: .5rem; }
.st-preview .form-control-color { width: 2rem; height: 1.75rem; padding: .15rem; flex: 0 0 auto; }
.st-table .st-sort { max-width: 5.5rem; }
.st-table .st-name { max-width: 24rem; }
.st-table .st-inactive .badge { opacity: .45; }
.st-table td form { margin: 0; display: inline-block; }
.st-table td .btn { white-space: nowrap; }
.st-table .st-tree { display: flex; align-items: center; gap: .5rem; }
.st-table .st-tree .bi { color: var(--warning); flex: 0 0 auto; }
/* Řádek s prokliknutím na detail (data-href, viz app.js) */
tr[data-href] { cursor: pointer; }
/* Řazení kliknutím na hlavičku sloupce */
.sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.sort-link .bi { font-size: .7rem; color: #a3acb9; }
.sort-link:hover, .sort-link.active { color: var(--brand); }
.sort-link.active .bi { color: var(--brand); }
.app-body-main .table-hover > tbody > tr:last-child > td { border-bottom: 0; }
.app-body--list .table > thead > tr > th:first-child { border-top-left-radius: 10px; }
.app-body--list .table > thead > tr > th:last-child { border-top-right-radius: 10px; }

/* Kompaktní řádky výpisu: úzké řádky, střídané podbarvení, svislé linky mezi sloupci (hlavička zůstává) */
.app-body--list .table, .app-body-main .table-hover { --bs-table-hover-bg: #e3edfd; --bs-table-hover-color: #111827; }
.app-body--list .table > tbody > tr > td,
.app-body-main .table-hover > tbody > tr > td { padding: .2rem .55rem; font-size: .84rem; line-height: 1.3; color: #111827; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.app-body--list .table > tbody > tr > td:last-child,
.app-body-main .table-hover > tbody > tr > td:last-child { border-right: 0; }
.app-body--list .table > tbody > tr:nth-child(even) > td,
.app-body-main .table-hover > tbody > tr:nth-child(even) > td { --bs-table-bg-type: #f1f4f8; }
.app-body--list .table > tbody > tr:hover > td,
.app-body-main .table-hover > tbody > tr:hover > td { --bs-table-bg-state: #e3edfd; }
/* Obsah buněk drží řádek na jedné lince: doplňkové údaje vedle sebe, menší štítky, avatary a tlačítka */
.app-body--list .table > tbody .cell-lines > div,
.app-body-main .table-hover > tbody .cell-lines > div,
.app-body--list .table > tbody > tr > td > div.small,
.app-body-main .table-hover > tbody > tr > td > div.small { display: inline; }
.app-body--list .table > tbody .cell-lines > div + div,
.app-body-main .table-hover > tbody .cell-lines > div + div,
.app-body--list .table > tbody > tr > td > div.small,
.app-body-main .table-hover > tbody > tr > td > div.small { margin-left: .5rem; }
/* Výjimka: údaje pod sebou (např. telefon a e-mail u zákazníků) */
.app-body-main .table > tbody .cell-lines.cell-lines--stack > div { display: block; margin-left: 0; }
/* Řádek, který by se zalomil (data-fit-line, viz app.js): bez ikon, případně menším písmem */
.cell-lines.fit-noicon .bi { display: none; }
.app-body--list .table > tbody .badge,
.app-body-main .table-hover > tbody .badge { font-size: .72rem; padding: .22em .6em; border-radius: 5px; }
.app-body--list .table > tbody .list-avatar,
.app-body-main .table-hover > tbody .list-avatar { width: 22px; height: 22px; font-size: .62rem; }
.app-body--list .table > tbody .row-actions-btn,
.app-body-main .table-hover > tbody .row-actions-btn { width: 24px; height: 22px; border-radius: 6px; font-size: .8rem; line-height: 1; }
.app-body--list .table > tbody .btn-sm,
.app-body-main .table-hover > tbody .btn-sm { --bs-btn-padding-y: .05rem; }

/* Buňky: avatar, dvouřádkový obsah, kontakt s ikonou */
.list-name { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.list-name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.list-name a:hover { color: var(--brand); }
.list-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ctx-blue); color: var(--brand); font-weight: 700; font-size: .76rem; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.list-avatar--company { background: #f1f5f9; color: var(--ink-soft); font-size: .95rem; }
.cell-lines { line-height: 1.35; }
.cell-lines .cell-sub { color: var(--muted); }
.cell-lines .cell-note { font-size: .74rem; }
.cell-lines .bi { color: var(--brand); margin-right: .4rem; }
.cell-lines a { color: inherit; text-decoration: none; }
.cell-lines a:hover, a.cell-link:hover { text-decoration: underline; }
a.cell-link { color: var(--brand); text-decoration: none; }

/* Štítky – jemné „pilulky" (platí pro všechny štítky v obsahu) */
.app-body-main .badge { border-radius: 999px; font-weight: 600; font-size: .74rem; padding: .38em .75em; }
.app-body-main .badge.bg-primary   { background-color: #dbeafe !important; color: #1d4ed8 !important; }
.app-body-main .badge.bg-success   { background-color: #dcfce7 !important; color: #15803d !important; }
.app-body-main .badge.bg-info      { background-color: #cffafe !important; color: #0e7490 !important; }
.app-body-main .badge.bg-warning   { background-color: #fef3c7 !important; color: #b45309 !important; }
.app-body-main .badge.bg-danger    { background-color: #fee2e2 !important; color: #b91c1c !important; }
.app-body-main .badge.bg-secondary,
.app-body-main .badge.bg-light     { background-color: #f1f5f9 !important; color: #475569 !important; border: 0 !important; }
.app-body-main .badge.bg-purple    { background-color: #f3e8ff; color: #7e22ce; }

/* Tlačítko řádkových akcí (tři tečky) */
.row-actions-btn { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); }
.row-actions-btn:hover, .row-actions-btn.show { background: var(--ctx-blue); border-color: var(--line); color: var(--brand); }

/* Patička výpisu: počet záznamů + stránkování */
.list-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.list-footer-total { color: var(--muted); font-size: .9rem; }
.list-footer .pagination { margin: 0; gap: .3rem; flex-wrap: wrap; }
.list-footer .page-link { min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 9px !important; color: var(--ink-soft); background: transparent; }
.list-footer .page-link:hover { background: var(--ctx-blue); color: var(--brand); }
.list-footer .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.list-footer .page-item.page-nav .page-link { border-color: var(--line); background: #fff; }
.list-footer .page-item.disabled .page-link { opacity: .45; }

/* ============================  KALENDÁŘ / DISPEČINK  ============================ */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.25rem; align-items: start; }
@media (max-width: 1199.98px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } }
.cal-main, .cal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.cal-card { margin-bottom: 1rem; }
.cal-layout .btn-light { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.cal-layout .btn-group > .btn-light:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-layout .btn-group > .btn-light:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* Lišta: navigace – název období – pohledy */
/* Hlavička se nikdy nezalamuje: vždy jeden řádek [navigace | období | pohledy].
   Na užším panelu se plynule zmenšuje písmo i odsazení (jednotky cqi = % šířky .cal-main). */
.cal-main { container-type: inline-size; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: clamp(.25rem, 1.2cqi, .75rem); margin-bottom: 1rem; }
.cal-agenda-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .6rem .8rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--ctx-slate); font-size: .9rem; }
.cal-agenda-bar[hidden] { display: none; }
.cal-agenda-bar .form-control { width: auto; }
.cal-nav { display: flex; flex: 0 0 auto; flex-wrap: nowrap; gap: clamp(.2rem, 1cqi, .6rem); }
.cal-nav .btn-group, .cal-views { flex-wrap: nowrap; flex: 0 0 auto; }
.cal-toolbar .btn { white-space: nowrap; font-size: clamp(.68rem, 1.9cqi, 1rem); padding: clamp(.2rem, .7cqi, .375rem) clamp(.3rem, 1.5cqi, .75rem); }
.cal-title { font-size: clamp(.78rem, 3cqi, 1.35rem); font-weight: 700; margin: 0; text-align: center; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-views .btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Štítky techniků */
/* jeden řádek; když je techniků moc, řádek se posouvá do strany místo zalomení */
.cal-techs { display: flex; flex-wrap: nowrap; gap: clamp(.3rem, 1cqi, .6rem); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.cal-techs::-webkit-scrollbar { display: none; }
.cal-chip { display: inline-flex; align-items: center; flex: 0 0 auto; white-space: nowrap; gap: .5rem; padding: .35rem clamp(.45rem, 1.3cqi, .8rem); border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 500; font-size: clamp(.76rem, 1.7cqi, .9rem); }
.cal-chip:hover { background: var(--ctx-blue); }
.cal-chip.active { background: var(--ctx-blue); border-color: var(--brand); color: var(--brand); }
.cal-chip[data-tech="0"].active { background: var(--brand); color: #fff; }
.cal-chip-avatar { width: 26px; height: 26px; font-size: .68rem; }
.cal-chip-check { display: none; }
.cal-chip.active .cal-chip-check { display: inline; }
.cal-chip--filters { margin-left: auto; color: var(--brand); font-weight: 600; text-decoration: none; }

/* Mřížka FullCalendar */
#calendar { --fc-border-color: var(--line); --fc-today-bg-color: #f8fbff; --fc-now-indicator-color: var(--danger); font-size: .86rem; }
#calendar .fc-col-header-cell { background: #f8fafc; }
#calendar .fc-col-header-cell-cushion { color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; font-size: clamp(.64rem, 1.7cqi, .9rem); padding: clamp(.3rem, 1cqi, .6rem) .1rem; }
#calendar .fc-timegrid-axis-cushion { white-space: nowrap; font-size: clamp(.6rem, 1.4cqi, .78rem); }
#calendar .fc-timegrid-slot { height: 1.9rem; }
#calendar .fc-timegrid-slot-label-cushion { color: var(--ink-soft); font-size: .8rem; }
#calendar .fc-daygrid-day-number, #calendar .fc-list-day-text, #calendar .fc-list-day-side-text { color: var(--ink); text-decoration: none; }
#calendar .fc-scrollgrid { border-radius: 10px; overflow: hidden; }

/* Karta zakázky: jemné pozadí v barvě stavu + barevný levý okraj */
#calendar .cal-ev { --ev: #2563eb; background: color-mix(in srgb, var(--ev) 14%, #fff); border: 0; border-left: 3px solid var(--ev); border-radius: 8px; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); cursor: pointer; }
#calendar .cal-ev:hover { background: color-mix(in srgb, var(--ev) 22%, #fff); }
#calendar .cal-ev .fc-event-main { color: var(--ink); padding: .3rem .45rem; overflow: hidden; }
.cal-ev-body { line-height: 1.3; position: relative; padding-right: 1.1rem; }
.cal-ev-ico { position: absolute; top: 0; right: 0; font-size: .8rem; color: var(--ev); }
.cal-ev--urgent .cal-ev-ico { color: var(--danger); }
.cal-ev-time { font-size: .76rem; color: color-mix(in srgb, var(--ev) 70%, #000); font-weight: 600; }
.cal-ev-title { font-weight: 700; font-size: .82rem; }
.cal-ev-sub, .cal-ev-num { font-size: .76rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev-num { color: var(--muted); }
.cal-ev-line { display: block; padding: .1rem .35rem; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
#calendar .fc-list-event.cal-ev { box-shadow: none; border-radius: 0; }

/* Pravý panel: mini kalendář, filtry, nezařazené zakázky */
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-mini-head .btn-link { color: var(--ink-soft); }
.cal-mini-title { font-weight: 700; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .15rem; text-align: center; }
.cal-mini-dow { font-size: .78rem; font-weight: 600; color: var(--ink-soft); padding: .25rem 0; }
.cal-mini-day { border: 0; background: transparent; border-radius: 8px; padding: .3rem 0; font-size: .82rem; color: var(--ink); }
.cal-mini-day:hover { background: var(--ctx-blue); }
.cal-mini-day.is-other { color: #b6bdc8; }
.cal-mini-day.is-today { font-weight: 700; color: var(--brand); }
.cal-mini-day.is-selected { background: var(--brand); color: #fff; font-weight: 700; }
.cal-side-label { display: block; font-size: .88rem; font-weight: 500; margin: 1rem 0 .4rem; }
.cal-side-title { font-weight: 700; margin-bottom: .6rem; }
.cal-status--planned:checked   { background-color: var(--brand); border-color: var(--brand); }
.cal-status--progress:checked  { background-color: var(--info); border-color: var(--info); }
.cal-status--done:checked      { background-color: var(--secondary); border-color: var(--secondary); }
.cal-status--cancelled:checked { background-color: var(--danger); border-color: var(--danger); }
.cal-unsched { display: flex; align-items: center; gap: .65rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.cal-unsched:first-child { border-top: 0; }
.cal-unsched--drag { cursor: grab; }
.cal-unsched-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--ctx-blue); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cal-unsched-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; font-size: .8rem; line-height: 1.3; color: var(--muted); text-decoration: none; }
.cal-unsched-body strong { color: var(--ink); font-size: .84rem; }
.cal-unsched-grip { color: #a3acb9; }

/* Nebezpečná zóna (nevratné akce, např. odstranění zakázky) */
.danger-zone { border: 1px solid #fecaca !important; background: #fef2f2; }

/* ============================  DETAIL SERVISNÍ ZAKÁZKY  ============================ */
.so-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 992px) { .so-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.so-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); min-width: 0; }
.so-card-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; }
.so-card-title { font-size: 1.05rem; font-weight: 600; margin: 0; flex: 1 1 auto; min-width: 0; }
.so-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--ctx-blue); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex: 0 0 auto; }
.so-ico--danger { background: #fee2e2; color: var(--danger); }
.so-detail .so-edit { border-radius: 10px; white-space: nowrap; background: #fff; }
.so-detail .so-edit:hover { background: var(--ctx-blue); color: var(--brand); }

/* Zákazník */
.so-cust-name { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: 1.15rem; font-weight: 700; margin-bottom: .6rem; }
.so-cust-name a { color: var(--ink); text-decoration: none; }
.so-cust-name a:hover { color: var(--brand); }
.so-chip { background: #f1f5f9; color: var(--ink-soft); border-radius: 8px; padding: .2rem .6rem; font-size: .78rem; font-weight: 500; white-space: nowrap; }
.so-contact { list-style: none; margin: 0; padding: 0; }
.so-contact li { display: flex; align-items: baseline; gap: .85rem; padding: .3rem 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.so-contact .bi { color: var(--ink-soft); flex: 0 0 auto; }
.so-contact a { text-decoration: none; }
/* telefon a e-mail vedle sebe na jednom řádku */
.so-contact li.so-contact-row { flex-wrap: wrap; gap: .3rem 1.5rem; }
.so-contact-item { display: inline-flex; align-items: baseline; gap: .85rem; min-width: 0; }
.so-addr { flex: 1 1 auto; min-width: 0; }
.so-addr-pick { display: flex; gap: .5rem; align-items: center; margin: 0; }
.so-addr-pick .form-select { border-radius: 8px; min-width: 0; }
.so-detail .so-addr-new { margin-top: .5rem; padding-top: .5rem; border-top: 0; }
.so-map { position: relative; margin-top: .75rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: 170px; background: #f8fafc; }
.so-map iframe { width: 100%; height: 100%; border: 0; display: block; }
.so-map-link { position: absolute; right: .5rem; bottom: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .15rem .55rem; font-size: .76rem; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Spotřebič */
.so-appliance { display: flex; gap: 1rem; align-items: flex-start; }
.so-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 1.25rem; margin: 0; flex: 1 1 auto; min-width: 0; font-size: .9rem; }
.so-kv dt { font-weight: 400; color: var(--ink-soft); padding: .22rem 0; white-space: nowrap; }
.so-kv dd { margin: 0; font-weight: 600; padding: .22rem 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.so-kv dd:last-of-type { border-bottom: 0; }

.so-textbox { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem; font-size: .9rem; color: var(--ink-soft); min-height: 3.2rem; overflow-wrap: anywhere; }

/* Stav zakázky */
.so-state { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 1.25rem; row-gap: .55rem; align-items: center; font-size: .9rem; }
.so-state-label { color: var(--ink-soft); white-space: nowrap; }
.so-state form { margin: 0; }
.so-select { max-width: 260px; border-radius: 8px; font-weight: 500; }
.so-select--status { background-color: #fef3c7; border-color: #fcd34d; color: #92400e; }
.so-select--type { background-color: var(--ctx-blue); border-color: #bfdbfe; color: #1d4ed8; }
.so-select--prio-high, .so-select--prio-urgent { background-color: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.so-tech { display: flex; align-items: center; gap: .6rem; }
.so-tech form { flex: 1 1 auto; min-width: 0; }
.so-avatar { background: var(--brand); color: #fff; width: 36px; height: 36px; font-size: .8rem; }
.so-state-dt { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.so-state-dt .bi { color: var(--ink-soft); margin-right: .45rem; }
.so-sched { display: flex; gap: .4rem; max-width: 300px; }
.so-sched .form-control, .so-sched .btn { border-radius: 8px; }

/* Formulář zakázky (nová / úprava) – stejné karty jako detail */
.so-form .form-control, .so-form .form-select { border-radius: 10px; }
.so-form .so-select { border-radius: 8px; max-width: 320px; }
.so-field-label { display: block; font-size: .85rem; color: var(--ink-soft); margin-bottom: .3rem; }
.so-picked { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .85rem; gap: .75rem; }
.so-picked-phone { font-size: .88rem; color: var(--ink-soft); }
/* formulář zakázky: blok přes obě kolony + přehled údajů vybraného zákazníka */
.so-card--wide { grid-column: 1 / -1; }
/* dashboard skladu: dlaždice s počty */
.stock-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.stock-tile { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: .6rem; padding: .55rem .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.stock-tile:hover { background: var(--ctx-blue); color: var(--brand); }
.stock-tile > .bi { grid-row: span 2; font-size: 1.35rem; color: var(--ink-soft); }
.stock-tile-value { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.stock-tile-label { font-size: .76rem; color: var(--muted); line-height: 1.2; }
.stock-tile--warning { border-color: #fcd34d; background: #fffbeb; }
.stock-tile--warning > .bi, .stock-tile--warning .stock-tile-value { color: #b45309; }
.stock-tile--danger { border-color: #fca5a5; background: #fef2f2; }
.stock-tile--danger > .bi, .stock-tile--danger .stock-tile-value { color: #b91c1c; }
.so-code-preview { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; padding: .5rem .75rem; background: var(--ctx-blue); border-radius: 10px; }
.so-code-preview strong { font-size: 1.15rem; letter-spacing: .5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.so-cust-info-wrap { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: .6rem .85rem; margin-top: -6px; background: #fafbfc; }
.so-cust-info { row-gap: .25rem; }
.so-textarea { font-size: .9rem; }
.so-mode .btn { white-space: nowrap; }
.so-addr-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .3rem; }
.so-addr-new { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line-soft); }
.so-addr-new .so-field-label { margin-bottom: .15rem; font-size: .8rem; }
.so-cust-new .so-field-label { margin-bottom: .15rem; font-size: .8rem; }
.so-cust-sub { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; font-weight: 600; font-size: .88rem; margin: .9rem 0 .4rem; padding-top: .75rem; border-top: 1px solid var(--line-soft); }
.so-addr-row { padding: .6rem 2.6rem .6rem .6rem; margin-bottom: .5rem; border-radius: 10px; }
.so-addr-row .addr-remove { top: .6rem; right: .5rem; }
.so-appl-new { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--line-soft); }
.so-appl-new .so-field-label { margin-bottom: .15rem; font-size: .8rem; }
/* existující spotřebič: pole jen ke čtení, ale čitelná (ne vybledlá) */
.so-appl-locked .form-control:disabled, .so-appl-locked .form-select:disabled { background-color: #f8fafc; color: var(--ink, #1f2937); opacity: 1; }
.so-form-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.so-form-actions .btn-light { background: #fff; border: 1px solid var(--line); }

/* Záložky + servisní záznamy */
.so-card--tabs { padding: 0; overflow: hidden; }
.so-tabs { padding: 0 1rem; column-gap: 1.25rem; }
.so-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; }
.so-tabs .nav-link.active { border-bottom-color: var(--brand); }
.so-pane { padding: 1rem; }

/* Detail skladové karty – obsah záložek (products/show.php) */
.pd-pane { padding: 1.25rem 1.25rem 1.4rem; }
@media (max-width: 575.98px) { .pd-pane { padding: 1rem .85rem 1.1rem; } }
.pd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem; }
.pd-head-text { color: var(--ink-soft); font-size: .9rem; }
.pd-sub { font-weight: 600; font-size: .9rem; margin: 0 0 .6rem; color: var(--ink); }
.pd-sub:not(:first-child) { margin-top: 1.4rem; }

.pd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.pd-stat { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .15rem; }
.pd-stat-label { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pd-stat-value { font-size: 1.35rem; font-weight: 700; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.pd-stat-value small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.pd-stat--ok { background: #f0fdf4; border-color: #bbf7d0; }
.pd-stat--ok .pd-stat-value { color: #15803d; }
.pd-stat--warn .pd-stat-value { color: #b45309; }
.pd-stat--alert { background: #fef2f2; border-color: #fecaca; }
.pd-stat--alert .pd-stat-value { color: var(--danger); }

.pd-table { font-size: .88rem; border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.pd-table > thead > tr > th { background: #f8fafc; color: var(--ink-soft); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em;
    padding: .6rem .85rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pd-table > tbody > tr > td { padding: .65rem .85rem; border-bottom: 1px solid var(--line-soft); }
.pd-table > tbody > tr:last-child > td { border-bottom: 0; }
.pd-table > tbody > tr:hover > td { background: #fafcff; }
.pd-table > tfoot > tr > th { background: #f8fafc; padding: .6rem .85rem; border-top: 1px solid var(--line); font-weight: 700; }
.pd-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-wh { display: inline-block; min-width: 2.1rem; text-align: center; background: #eef2ff; color: #3730a3; border-radius: 6px; padding: .05rem .4rem; font-weight: 600; font-size: .78rem; margin-right: .3rem; }

.pd-bar-col { width: 22%; min-width: 120px; }
.pd-bar { display: flex; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
.pd-bar-free { background: #22c55e; }
.pd-bar-res { background: #f59e0b; }
.pd-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .65rem; font-size: .78rem; color: var(--muted); }
.pd-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.pd-dot--free { background: #22c55e; }
.pd-dot--res { background: #f59e0b; }

.pd-empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 1px dashed var(--line); border-radius: 12px; background: #fcfdfe; font-size: .9rem; }
.pd-empty .bi { display: block; font-size: 2rem; margin-bottom: .4rem; color: #cbd5e1; }

.pd-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .85rem; }
.pd-thumb { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; transition: box-shadow .15s; }
.pd-thumb:hover { box-shadow: 0 4px 14px rgba(15,23,42,.1); }
.pd-thumb img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #f8fafc; }
.pd-thumb figcaption { font-size: .74rem; color: var(--ink-soft); padding: .35rem .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--line-soft); }
.pd-thumb-del { position: absolute; top: .35rem; right: .35rem; margin: 0; opacity: 0; transition: opacity .15s; }
.pd-thumb:hover .pd-thumb-del, .pd-thumb:focus-within .pd-thumb-del { opacity: 1; }
@media (hover: none) { .pd-thumb-del { opacity: 1; } }
.pd-thumb-del .btn { box-shadow: 0 1px 3px rgba(0,0,0,.2); padding: .1rem .4rem; }

.pd-docs { display: flex; flex-direction: column; gap: .5rem; }
.pd-doc { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pd-doc:hover { border-color: #c7d2fe; background: #fafcff; }
.pd-doc-ico { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.pd-doc--pdf { background: #fef2f2; color: #dc2626; }
.pd-doc--word { background: #eff6ff; color: #2563eb; }
.pd-doc--excel { background: #f0fdf4; color: #16a34a; }
.pd-doc--text { background: #f1f5f9; color: #475569; }
.pd-doc-body { flex: 1 1 auto; min-width: 0; }
.pd-doc-name { display: block; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-doc-name:hover { color: var(--brand); text-decoration: underline; }
.pd-doc-meta { font-size: .76rem; color: var(--muted); }

.pd-drop { margin-top: 1.4rem; border: 2px dashed #cbd5e1; border-radius: 14px; padding: 1.25rem; text-align: center; background: #fbfcfe; transition: border-color .15s, background .15s; }
.pd-drop.is-over { border-color: var(--brand); background: #eff6ff; }
.pd-drop-ico { font-size: 2rem; color: var(--brand); display: block; margin-bottom: .25rem; }
.pd-drop-text { font-size: .92rem; }
.pd-drop-pick { color: var(--brand); text-decoration: underline; cursor: pointer; }
.pd-drop-hint { font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.pd-drop-files { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: .6rem; }
.pd-drop-err { color: var(--danger); font-size: .82rem; margin-top: .35rem; }
.pd-chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; }
.pd-chip small { color: var(--muted); }
.pd-chip--bad { border-color: #fecaca; background: #fef2f2; color: var(--danger); }

.pd-type { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .12rem .55rem; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.pd-type--in { background: #f0fdf4; color: #15803d; }
.pd-type--out { background: #fef2f2; color: #b91c1c; }
.so-records { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) {
    .so-records { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .so-records-side { border-left: 1px solid var(--line); }
}
@media (max-width: 1199.98px) { .so-records-side { border-top: 1px solid var(--line); } }
.so-records-side { padding: 1rem; min-width: 0; }
.so-records-main { min-width: 0; }

.so-note-form { display: flex; gap: .85rem; padding: 1rem; border-bottom: 1px solid var(--line); margin: 0; }
.so-note-body { flex: 1 1 auto; min-width: 0; }
.so-note-label { font-weight: 600; font-size: .9rem; margin-bottom: .35rem; display: block; }
.so-note-row { display: flex; gap: .6rem; align-items: flex-start; }
.so-note-row textarea { flex: 1 1 auto; font-size: .88rem; border-radius: 10px; }
.so-note-row .btn { white-space: nowrap; border-radius: 10px; }
@media (max-width: 575.98px) { .so-note-row { flex-direction: column; align-items: stretch; } }

.so-tl { list-style: none; margin: 0; padding: 0; }
.so-tl-item { position: relative; display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem .8rem 2.3rem; border-bottom: 1px solid var(--line-soft); }
.so-tl-item:last-child { border-bottom: 0; }
.so-tl-item::before { content: ""; position: absolute; left: 1.05rem; top: 0; bottom: 0; width: 2px; background: var(--line); }
.so-tl-item:first-child::before { top: 1.6rem; }
.so-tl-item:last-child::before { bottom: calc(100% - 1.6rem); }
.so-tl-dot { position: absolute; left: calc(1.05rem - 4px); top: 1.4rem; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.so-tl-dot--brand { background: var(--brand); }
.so-tl-dot--success { background: var(--success); }
.so-tl-dot--danger { background: var(--danger); }
.so-tl .so-avatar { background: var(--ctx-blue); color: var(--brand); }
.so-tl-body { flex: 1 1 auto; min-width: 0; }
.so-tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.so-tl-user { color: var(--muted); }
.so-tl-text { font-size: .88rem; color: var(--ink-soft); margin-top: .15rem; overflow-wrap: anywhere; }

.so-sub-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.so-sub-head h3 { font-size: .95rem; font-weight: 600; margin: 0; flex: 1 1 auto; }
.so-sub-head > .bi { font-size: 1.1rem; color: var(--ink); }
.so-sub-head .btn { border-radius: 8px; white-space: nowrap; }
.so-table { border: 1px solid var(--line); font-size: .82rem; margin-bottom: 1.1rem; }
.so-table > thead > tr > th { background: #f8fafc; font-weight: 600; font-size: .78rem; border-bottom: 1px solid var(--line); padding: .4rem .6rem; }
.so-table > tbody > tr > td { padding: .4rem .6rem; border-color: var(--line); }
.so-table > tbody > tr:last-child > td { border-bottom: 0; }

.so-totals { display: flex; gap: .75rem; align-items: stretch; flex-wrap: wrap; }
.so-totals-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: .5rem .75rem; flex: 1 1 320px; background: #f8fafc; border-radius: 12px; padding: .65rem .75rem; }
.so-total { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.so-total > .bi { font-size: 1.25rem; color: var(--ink-soft); flex: 0 0 auto; }
.so-total span { display: block; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.so-total strong { font-size: .88rem; white-space: nowrap; }
.so-total--grand { flex: 0 0 auto; background: var(--ctx-blue); border-radius: 12px; padding: .65rem .9rem; }
.so-total--grand span { color: var(--brand); }
.so-total--grand strong { font-size: 1.2rem; color: var(--brand); }

/* ============================  MONTÁŽNÍ LIST – editace ve stejné podobě jako tisk  ============================ */
.ml-wrap { max-width: 980px; margin-left: auto; margin-right: auto; }
/* horní řada: tlačítka (ZAHÁJIT / DOKONČIT SERVIS, Tisk) a vedle nich informační hlášky; na úzké obrazovce hlášky pod tlačítky */
.ml-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: 1rem; }
.ml-topbar-actions { flex: 1 1 100%; }
/* hlášky jako malé bubliny vedle sebe (obnovovaná oblast [data-ml-region] se do řady zapojí přes display: contents) */
.ml-topbar-notes { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.ml-topbar-notes > [data-ml-region] { display: contents; }
.ml-topbar-notes:not(:has(.alert)) { display: none; }
.ml-topbar-notes .alert {
    flex: 0 1 auto; max-width: 100%; margin: 0; padding: .25rem .7rem !important;
    border-radius: 1rem; font-size: .78rem; line-height: 1.3;
}
.ml-topbar-notes .alert .btn { padding: .1rem .5rem; font-size: .75rem; }
@media (min-width: 768px) { .ml-topbar-actions { flex: 0 0 auto; } }
/* záložka Fotky: velké náhledy v mřížce podle šířky obrazovky */
.ml-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.ml-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .5rem; border: 1px solid #ddd; }
@media (max-width: 575.98px) { .ml-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* položky listu vložené do detailu zakázky (záložka Servisní záznamy) */
.ml-embed { font-size: .84rem; color: #1a1a1a; }
.ml-embed > .ml-bar:first-of-type { margin-top: 0; }
.ml-embed .ml-totals { width: 100%; }
.so-photo { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-strong); display: block; }
.ml-tabs { margin-bottom: .75rem; column-gap: 1rem; }
.ml-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; }
.ml-tabs .nav-link.active { border-bottom-color: var(--brand); }
.ml-sheet { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06); padding: 1.25rem 1.25rem 1rem; font-size: .84rem; color: #1a1a1a; }
.ml-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 2px solid #1a1a1a; padding-bottom: .5rem; }
.ml-title { font-size: 1.5rem; font-weight: 800; letter-spacing: .5px; line-height: 1.1; }
.ml-number { font-size: 1.15rem; font-weight: 700; color: var(--accent); }
.ml-muted { color: var(--muted); font-size: .78rem; }
.ml-company { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; padding: .6rem 0 .75rem; }
.ml-company-side { border-left: 1px solid var(--line-strong); padding-left: 1rem; font-size: .8rem; }
.ml-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.ml-bar { background: var(--bar-bg); color: var(--bar-fg); font-weight: 700; font-size: .72rem; letter-spacing: .5px; padding: .3rem .6rem; margin-top: .75rem; }
.ml-cols .ml-bar { margin-top: 0; }
.ml-bar--actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; padding-top: .25rem; padding-bottom: .25rem; }
.ml-bar-btns { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.app-main .ml-bar-btns .btn:not(.btn-lg) { --bs-btn-padding-y: .12rem; --bs-btn-padding-x: .55rem; --bs-btn-font-size: .76rem; letter-spacing: 0; font-weight: 600; }
.ml-box { width: 100%; border-collapse: collapse; }
.ml-box th, .ml-box td { border: 1px solid var(--line-strong); padding: .25rem .55rem; vertical-align: top; }
.ml-box th { background: #f2f2f2; font-weight: 700; width: 34%; white-space: nowrap; }
.ml-text { border: 1px solid var(--line-strong); padding: .3rem .55rem; min-height: 1.9rem; }
.ml-sheet .ml-textarea { border-radius: 0 !important; border-color: var(--line-strong); }
/* jednořádkový formulář pro přidání položky */
.ml-add { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .45rem .55rem; background: var(--ctx-blue); border: 1px solid var(--line-strong); border-top: 0; }
.ml-add[hidden] { display: none; }
.ml-add-kind { font-weight: 700; white-space: nowrap; }
.ml-add-grow { flex: 1 1 220px; min-width: 0; }
.ml-add .ml-add-price { flex: 0 0 140px; width: 140px; text-align: right; }
.ml-add .ml-add-qty { flex: 0 0 76px; width: 76px; text-align: right; }
.ml-add .ml-add-wh { flex: 0 1 190px; width: auto; }
.ml-add input[readonly] { background: #eef1f5; color: var(--ink-soft); }
.ml-part { position: relative; }
.ml-part-row { display: flex; flex-wrap: nowrap; }
.ml-part-row .ml-part-search { flex: 1 1 auto; min-width: 0; }
/* ============================  OKNO „VYBRAT SKLADOVOU KARTU“  ============================
   products/_picker.php + assets/js/product-picker.js. Nahoře karta Kategorie vlevo a výpis karet (seznam nebo
   dlaždice) vpravo, pod nimi detail vybrané karty přes celou šířku (hlavní část + panel Další informace).
   Počítač: široké okno; iPad na šířku: okno přes skoro celou šířku; iPad na výšku a menší: přes celou obrazovku,
   kategorie jako vodorovný pruh, detail jako samostatný pohled se „Zpět na seznam“. */
#productPicker { --mpp-soft: #f6f8fc; --mpp-line: #e6eaf2; --mpp-sel: #eaf1ff; }
#productPicker .mpp-dialog { max-width: min(1180px, calc(100vw - 2rem)); }
#productPicker .modal-content { border: 0; border-radius: 16px; box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .45); }
.mpp-header { gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--mpp-line); }
.mpp-h-ico { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 10px; background: var(--mpp-soft); color: var(--ink); font-size: 1.25rem; }
.mpp-header .modal-title { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.mpp-sub { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpp-header .btn-close { margin: 0; }
#productPicker .modal-body { padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; background: #fff; }

.mpp-layout { flex: none; display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; }
/* karta Kategorie */
.mpp-side { display: flex; flex-direction: column; min-height: 0; padding: .6rem; border-radius: 12px; background: var(--mpp-soft); }
.mpp-side-head { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem .55rem; font-weight: 700; color: var(--ink); }
.mpp-side-head .bi { color: var(--brand); }
.mpp-cats { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: 50vh; }
.mpp-cat { display: flex; align-items: center; gap: .55rem; padding: .45rem .6rem .45rem calc(.6rem + var(--depth, 0) * .9rem); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .88rem; }
.mpp-cat:hover { background: #eef2f9; color: var(--ink); }
.mpp-cat .bi { color: #94a3b8; font-size: .95rem; }
.mpp-cat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpp-cat-count { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.mpp-cat-count::before { content: "("; } .mpp-cat-count::after { content: ")"; }
.mpp-cat.active { background: #dfe9ff; color: #1d4ed8; font-weight: 700; }
.mpp-cat.active .bi, .mpp-cat.active .mpp-cat-count { color: #1d4ed8; }
.mpp-side-hint { margin-top: auto; padding: 1.5rem .5rem .75rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; color: #94a3b8; font-size: .82rem; }
.mpp-side-hint .bi { font-size: 2.2rem; color: #cbd5e1; }
.mpp-has-detail .mpp-side-hint { display: none; }

/* nástroje: hledání, filtr, seznam / dlaždice */
.mpp-main { min-width: 0; display: flex; flex-direction: column; gap: .6rem; }
.mpp-toolbar { display: flex; align-items: center; gap: .5rem; }
.mpp-search { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .6rem; height: 2.6rem; margin: 0; padding: 0 .85rem; border: 1px solid var(--mpp-line); border-radius: 10px; background: #fff; cursor: text; }
.mpp-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.mpp-search .bi { color: var(--muted); }
.mpp-q { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: .92rem; }
.mpp-tool { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 2.6rem; min-width: 2.6rem; padding: 0 .8rem; border: 1px solid var(--mpp-line); border-radius: 10px; background: #fff; color: var(--ink); font-size: .9rem; font-weight: 600; }
.mpp-tool:hover:not(:disabled) { background: var(--mpp-soft); }
.mpp-tool:disabled { opacity: .45; }
.mpp-tool.is-on { border-color: #bfd3ff; background: var(--mpp-sel); color: #1d4ed8; }
.mpp-filter .dropdown-item.active { background: var(--mpp-sel); color: #1d4ed8; font-weight: 600; }
.mpp-views { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--mpp-line); border-radius: 10px; background: var(--mpp-soft); }
.mpp-views .mpp-tool { height: 2.1rem; min-width: 2.4rem; padding: 0 .6rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 1.05rem; }
.mpp-views .mpp-tool.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }

/* výpis karet – seznam (tabulka) */
.mpp-results { border: 1px solid var(--mpp-line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.mpp-thead, .mpp-item { display: grid; grid-template-columns: 2.5rem minmax(5rem, 8rem) minmax(0, 1fr) 6.5rem 7.5rem 7.5rem; align-items: center; column-gap: .75rem; padding: 0 .85rem; }
.mpp-thead { height: 2.4rem; background: var(--mpp-soft); border-bottom: 1px solid var(--mpp-line); color: var(--muted); font-size: .8rem; font-weight: 600; }
.mpp-r { text-align: right; } .mpp-c { text-align: center; }
.mpp-list { overflow-y: auto; max-height: 52vh; }
.mpp-item { position: relative; width: 100%; min-height: 2.75rem; border: 0; border-bottom: 1px solid #eef1f6; background: #fff; color: var(--ink); text-align: left; font-size: .9rem; }
.mpp-item:last-child { border-bottom: 0; }
.mpp-item:hover { background: #f8faff; }
.mpp-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.mpp-item.active { background: var(--mpp-sel); font-weight: 600; }
.mpp-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.mpp-i-ico { position: relative; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; color: #64748b; font-size: 1.1rem; }
.mpp-i-ico img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.mpp-i-sel { display: none; position: absolute; inset: 0; place-items: center; color: var(--brand); background: var(--mpp-sel); border-radius: 50%; }
.mpp-item.active .mpp-i-sel { display: grid; }
.mpp-i-code { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpp-i-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpp-i-name small { margin-left: .4rem; color: var(--muted); font-weight: 400; }
.mpp-i-qty, .mpp-i-price { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mpp-i-status { text-align: center; }
.mpp-badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.mpp-badge--ok { background: #dcfce7; color: #15803d; }
.mpp-badge--low { background: #fef3c7; color: #b45309; }
.mpp-badge--out { background: #f1f5f9; color: #64748b; }
.mpp-msg { padding: 1rem; color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .5rem; }

/* výpis karet – dlaždice */
.mpp-results.is-grid .mpp-thead { display: none; }
.mpp-results.is-grid .mpp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .6rem; padding: .6rem; background: var(--mpp-soft); }
.mpp-results.is-grid .mpp-item { grid-template-columns: 1fr auto; grid-template-areas: "ico ico" "code code" "name name" "qty status" "price price"; row-gap: .2rem; padding: .7rem; min-height: 0; border: 1px solid var(--mpp-line); border-radius: 10px; }
.mpp-results.is-grid .mpp-item.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.mpp-results.is-grid .mpp-item.active::before { display: none; }
.mpp-results.is-grid .mpp-i-ico { grid-area: ico; width: 100%; height: 4.5rem; margin-bottom: .3rem; border-radius: 8px; background: var(--mpp-soft); font-size: 1.8rem; }
.mpp-results.is-grid .mpp-i-sel { inset: .35rem .35rem auto auto; width: 1.4rem; height: 1.4rem; font-size: 1rem; }
.mpp-results.is-grid .mpp-i-code { grid-area: code; font-size: .8rem; color: var(--brand); }
.mpp-results.is-grid .mpp-i-name { grid-area: name; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 600; }
.mpp-results.is-grid .mpp-i-name small { display: block; margin: 0; }
.mpp-results.is-grid .mpp-i-qty { grid-area: qty; text-align: left; color: var(--muted); font-size: .82rem; }
.mpp-results.is-grid .mpp-i-status { grid-area: status; text-align: right; }
.mpp-results.is-grid .mpp-i-price { grid-area: price; text-align: left; font-weight: 700; }

.mpp-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: .85rem; color: var(--muted); }
.mpp-foot strong { color: var(--ink); }
.mpp-pager { display: inline-flex; align-items: center; gap: .35rem; }
.mpp-pager .mpp-tool { height: 2rem; min-width: 2rem; padding: 0; }
.mpp-page { display: grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .5rem; border-radius: 8px; background: var(--mpp-sel); color: #1d4ed8; font-weight: 700; font-variant-numeric: tabular-nums; }

/* detail vybrané karty – přes celou šířku. Priorita = množství na jednotlivých skladech:
   hlavička v jednom řádku (ikona, kód + název, stav, Vybrat, křížek = zpět na seznam), pod ní tabulka skladů,
   vpravo úzký panel s ostatními údaji */
.mpp-detail { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 16rem; grid-template-rows: auto minmax(0, 1fr);
    border: 1px solid var(--mpp-line); border-radius: 12px; overflow: hidden; background: #fff; }
.mpp-detail[hidden] { display: none; }
.mpp-d-loading { grid-column: 1 / -1; padding: 1rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.mpp-d-head { grid-column: 1 / -1; display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem .55rem .75rem; border-bottom: 1px solid var(--mpp-line);
    background: linear-gradient(90deg, #f3f7ff, #fbfcff 60%, #fff); }
.mpp-d-img { flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 9px; background: #fff; border: 1px solid var(--mpp-line); color: #94a3b8; font-size: 1.25rem; overflow: hidden; }
.mpp-d-img img { width: 100%; height: 100%; object-fit: contain; }
.mpp-d-id { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.mpp-d-code { color: var(--brand); font-weight: 700; font-size: .78rem; line-height: 1.2; }
.mpp-d-id h3 { margin: 0; font-size: 1.05rem; font-weight: 750; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpp-pill { flex: none; display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-weight: 700; font-size: .82rem; white-space: nowrap; }
.mpp-pill--ok { background: #dcfce7; color: #15803d; }
.mpp-pill--low { background: #fef3c7; color: #b45309; }
.mpp-pill--out { background: #f1f5f9; color: #475569; }
.mpp-d-actions { flex: none; display: flex; align-items: center; gap: .4rem; }
.mpp-d-pick { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.4rem; padding: 0 1rem; border-radius: 9px; font-weight: 700; white-space: nowrap; }
.mpp-d-back { height: 2.4rem; min-width: 2.4rem; padding: 0; color: var(--muted); }
.mpp-d-back:hover { color: var(--ink); }
.mpp-d-main { min-width: 0; padding: .65rem .75rem .75rem; display: flex; flex-direction: column; gap: .6rem; }
.mpp-d-desc { margin: 0; color: var(--ink-soft); font-size: .85rem; line-height: 1.45; }
/* tabulka skladů – hlavní informace: výrazný sloupec Dostupné */
.mpp-d-tablewrap { border: 1px solid var(--mpp-line); border-radius: 10px; overflow: auto; background: #fff; }
.mpp-d-stock { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mpp-d-stock th, .mpp-d-stock td { padding: .42rem .75rem; border-bottom: 1px solid #eef1f6; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mpp-d-stock thead th { position: sticky; top: 0; z-index: 1; background: var(--mpp-soft); font-weight: 700; color: var(--muted); font-size: .76rem; }
.mpp-d-stock th:not(:first-child), .mpp-d-stock td:not(:first-child) { width: 1%; padding-left: 1.5rem; }
.mpp-d-stock td:first-child { white-space: normal; }
.mpp-d-stock td:last-child { font-size: .98rem; }
.mpp-d-stock tbody tr:last-child td { border-bottom: 0; }
.mpp-d-stock tfoot th { border-top: 1px solid var(--mpp-line); border-bottom: 0; background: var(--mpp-soft); }
.mpp-d-stock tr.mpp-d-sel td { background: #f3f7ff; }
.mpp-d-stock tr.mpp-d-sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.mpp-d-stock tr:not(.mpp-d-zero) td:last-child strong { color: #15803d; }
.mpp-d-stock tr.mpp-d-zero td { color: var(--muted); }
.mpp-tag { display: inline-block; margin-left: .25rem; padding: .02rem .45rem; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: .7rem; font-weight: 700; vertical-align: 1px; }
.mpp-tag--brand { background: var(--brand); color: #fff; }
/* panel ostatních údajů */
.mpp-d-aside { min-width: 0; padding: .65rem .85rem; border-left: 1px solid var(--mpp-line); background: var(--mpp-soft); }
.mpp-d-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem .75rem; margin: 0; font-size: .84rem; align-items: baseline; }
.mpp-d-info dt { color: var(--muted); font-weight: 400; }
.mpp-d-info dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.mpp-chip { display: inline-block; padding: .05rem .5rem; border-radius: 6px; background: #fff; border: 1px solid var(--mpp-line); color: var(--ink); font-weight: 700; font-size: .8rem; }

/* Počítač / iPad na šířku: s otevřeným detailem má okno výšku obrazovky; výpis karet má vždy aspoň ~4 řádky,
   detail zbytek (tabulka skladů a panel se posouvají uvnitř) */
@media (min-width: 992px) {
    #productPicker .mpp-has-detail .modal-body { height: calc(100vh - 8rem); height: calc(100dvh - 8rem); overflow: hidden; }
    .mpp-has-detail .mpp-layout { flex: 1 1 0; min-height: 15rem; grid-template-rows: minmax(0, 1fr); }
    .mpp-has-detail .mpp-side, .mpp-has-detail .mpp-main { min-height: 0; }
    .mpp-has-detail .mpp-cats { max-height: none; flex: 1 1 auto; min-height: 0; }
    .mpp-has-detail .mpp-results { flex: 1 1 auto; }
    .mpp-has-detail .mpp-list { flex: 1 1 auto; min-height: 0; max-height: none; }
    .mpp-has-detail .mpp-detail { flex: 0 1 auto; min-height: 9rem; max-height: 58%; }
    .mpp-has-detail .mpp-d-main, .mpp-has-detail .mpp-d-aside { overflow-y: auto; min-height: 0; }
    .mpp-has-detail .mpp-d-tablewrap { flex: 0 1 auto; min-height: 0; }
}
/* iPad na šířku (1024–1199 px) a menší notebooky */
@media (max-width: 1199.98px) {
    #productPicker .mpp-dialog { max-width: calc(100vw - 1.5rem); margin-left: auto; margin-right: auto; }
    .mpp-layout { grid-template-columns: 13rem minmax(0, 1fr); }
    .mpp-thead, .mpp-item { grid-template-columns: 2.25rem minmax(4.5rem, 6.5rem) minmax(0, 1fr) 5.5rem 6.5rem 6.75rem; column-gap: .6rem; }
    .mpp-detail { grid-template-columns: minmax(0, 1fr) 14rem; }
}
/* iPad na výšku a menší: okno přes celou obrazovku (modal-fullscreen-lg-down), kategorie jako vodorovný pruh,
   detail karty jako samostatný pohled místo výpisu – hlavička s Vybrat a křížkem zůstává nahoře */
@media (max-width: 991.98px) {
    #productPicker .mpp-dialog { max-width: none; margin: 0; }
    #productPicker .modal-content { border-radius: 0; }
    #productPicker .modal-body { padding: .75rem 1rem 1rem; gap: .75rem; }
    .mpp-layout { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
    .mpp-side { padding: .4rem; }
    .mpp-side-head, .mpp-side-hint { display: none; }
    .mpp-cats { flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: none; gap: .35rem; scrollbar-width: none; }
    .mpp-cats::-webkit-scrollbar { display: none; }
    .mpp-cat { flex: none; padding: .45rem .8rem; background: #fff; border: 1px solid var(--mpp-line); }
    .mpp-cat.active { border-color: #bfd3ff; }
    .mpp-list { max-height: none; }
    .mpp-has-detail .mpp-layout { display: none; }
    .mpp-detail { grid-template-columns: minmax(0, 1fr); overflow: visible; } /* kvůli přilepené hlavičce */
    .mpp-d-head { position: sticky; top: -.75rem; z-index: 2; border-radius: 12px 12px 0 0; }
    .mpp-d-aside { border-left: 0; border-top: 1px solid var(--mpp-line); border-radius: 0 0 12px 12px; }
    .mpp-d-info { grid-template-columns: repeat(2, max-content minmax(0, 1fr)); column-gap: 1rem; }
}
/* telefon a úzké okno */
@media (max-width: 767.98px) {
    .mpp-header { padding: .7rem 1rem; }
    .mpp-header .modal-title { font-size: 1.05rem; }
    .mpp-sub { display: none; }
    .mpp-toolbar { flex-wrap: wrap; }
    .mpp-search { flex: 1 1 100%; }
    .mpp-toolbar .dropdown { flex: 1 1 auto; }
    .mpp-toolbar .dropdown .mpp-tool { width: 100%; }
    .mpp-thead { display: none; }
    .mpp-item { grid-template-columns: 2rem minmax(0, 1fr) auto; grid-template-areas: "ico code status" "ico name price" "ico qty qty"; row-gap: .1rem; padding: .55rem .75rem; }
    .mpp-i-ico { grid-area: ico; } .mpp-i-code { grid-area: code; } .mpp-i-name { grid-area: name; } .mpp-i-qty { grid-area: qty; text-align: left; color: var(--muted); font-size: .82rem; }
    .mpp-i-price { grid-area: price; } .mpp-i-status { grid-area: status; text-align: right; }
    .mpp-results.is-grid .mpp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mpp-d-head { flex-wrap: wrap; }
    .mpp-d-id { flex-basis: calc(100% - 6rem); }
    .mpp-d-id h3 { white-space: normal; }
    .mpp-d-actions { order: 5; flex: 1 1 100%; }
    .mpp-d-actions .mpp-d-pick { flex: 1 1 auto; }
    .mpp-d-info { grid-template-columns: max-content minmax(0, 1fr); }
    .mpp-d-stock th:not(:first-child), .mpp-d-stock td:not(:first-child) { padding-left: .6rem; }
}
/* dotykové ovládání (iPad): větší cíle pro prst, bez čekání na dvojklepnutí */
@media (pointer: coarse) {
    .mpp-item { min-height: 3.25rem; touch-action: manipulation; }
    .mpp-cat { min-height: 2.6rem; touch-action: manipulation; }
    .mpp-tool { min-height: 2.75rem; min-width: 2.75rem; }
    .mpp-views .mpp-tool { height: 2.4rem; }
    .mpp-pager .mpp-tool, .mpp-page { height: 2.6rem; min-width: 2.6rem; }
    .mpp-search { height: 2.9rem; }
    .mpp-q { font-size: 1rem; } /* iPad při písmu pod 16 px stránku přibližuje */
    .mpp-d-stock th, .mpp-d-stock td { padding-top: .6rem; padding-bottom: .6rem; }
    .mpp-d-pick, .mpp-d-back { min-height: 2.75rem; min-width: 2.75rem; }
}

.ml-part-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 1000; max-height: 260px; overflow-y: auto; }
.ml-part-hint { flex: 1 1 100%; font-size: .78rem; }
.ml-part-hint:empty { display: none; }
.ml-part-hint--ok { color: #15803d; }
.ml-part-hint--warn { color: #b45309; font-weight: 600; }
.ml-items { width: 100%; border-collapse: collapse; }
.ml-items th { background: #efefef; border: 1px solid var(--line-strong); padding: .25rem .55rem; font-size: .74rem; }
.ml-items td { border: 1px solid #e2e2e2; padding: .22rem .55rem; vertical-align: middle; }
.ml-items .ml-col-x { width: 1%; white-space: nowrap; text-align: right; }
.ml-items .ml-col-x form { margin: 0; }
.app-main .ml-items .btn:not(.btn-lg) { --bs-btn-padding-y: .05rem; --bs-btn-padding-x: .35rem; }
/* řádek právě přidaný bez načtení stránky krátce zvýrazníme */
.ml-items tr.ml-row-new > td { animation: ml-row-new 1.6s ease-out; }
@keyframes ml-row-new { from { background: #dcfce7; } to { background: transparent; } }
.ml-busy { opacity: .6; pointer-events: none; }
.ml-totals { margin: .6rem 0 0 auto; width: min(100%, 420px); border-collapse: collapse; }
.ml-totals th, .ml-totals td { border: 1px solid var(--line-strong); padding: .25rem .55rem; }
.ml-totals th { background: #f2f2f2; font-weight: 700; }
.ml-totals td { text-align: right; white-space: nowrap; width: 40%; }
.ml-totals .ml-grand th, .ml-totals .ml-grand td { background: var(--bar-bg); color: var(--bar-fg); font-weight: 700; }
.ml-footer { border: 1px solid var(--line-strong); padding: .4rem .55rem; margin: .75rem 0; font-size: .72rem; color: var(--muted); }
.ml-sign { border: 1px solid #cfcfcf; padding: .45rem; min-height: 110px; }
.ml-sign form { margin: .3rem 0 0; }
.ml-sign-img { display: block; max-height: 110px; max-width: 100%; margin: .3rem auto; }
.ml-sign-pad { display: block; width: 100%; height: 140px; border: 1px dashed #b9c0cb; border-radius: 6px; background: #fff; touch-action: none; }
@media (max-width: 767.98px) {
    .ml-sheet { padding: .75rem; }
    .ml-cols, .ml-company { grid-template-columns: minmax(0, 1fr); }
    .ml-company-side { border-left: 0; padding-left: 0; }
}

/* ============================  JEDNOTNÉ VELIKOSTI (hlavičky, tlačítka, filtry)  ============================
   Jedna kompaktní velikost ovládacích prvků v celé aplikaci – bez ohledu na to, zda má prvek
   v šabloně třídu -sm, nebo žádnou. Velikost se mění jen zde (--ctl-*).
   Výjimka: .btn-lg (velká dotyková tlačítka technika a pokladny) zůstává velké. */
.app-main { --ctl-fs: .84rem; --ctl-py: .3rem; --ctl-px: .7rem; --ctl-radius: 8px; --ctl-lh: 1.4; }
.app-main .btn:not(.btn-lg) { --bs-btn-padding-y: var(--ctl-py); --bs-btn-padding-x: var(--ctl-px); --bs-btn-font-size: var(--ctl-fs); --bs-btn-border-radius: var(--ctl-radius); --bs-btn-line-height: var(--ctl-lh); }
.app-main .form-control:not(.form-control-color):not([type="file"]),
.app-main .form-select,
.app-main .input-group-text { padding-top: var(--ctl-py); padding-bottom: var(--ctl-py); font-size: var(--ctl-fs); line-height: var(--ctl-lh); border-radius: var(--ctl-radius); min-height: calc(var(--ctl-lh) * 1em + var(--ctl-py) * 2 + 2px); }
.app-main .form-control:not(.form-control-color):not([type="file"]) { padding-left: .6rem; padding-right: .6rem; }
.app-main .form-select { padding-left: .6rem; padding-right: 1.9rem; background-position: right .55rem center; }
.app-main .form-control.is-invalid:not(.form-control-color):not([type="file"]) { padding-right: 2rem; }
.app-main .input-group-text { padding-left: .6rem; padding-right: .6rem; }
.app-main .input-icon > .form-control { padding-left: .25rem; }
/* ve skupině (pole + ikona / tlačítko) zůstávají vnitřní rohy rovné */
.app-main .input-group > :not(:first-child):not(.dropdown-menu) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.app-main .input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.app-main .btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.app-main .btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.app-main .form-label { font-size: .8rem; margin-bottom: .2rem; }
/* na telefonu písmo polí 16 px, jinak iOS při psaní stránku přibližuje */
@media (max-width: 767.98px) {
    .app-main .form-control:not(.form-control-color):not([type="file"]), .app-main .form-select { font-size: 1rem; }
}

/* Hlavička stránky */
.app-main .page-header { margin-bottom: .75rem; gap: .75rem; }
.app-main .page-header-main { gap: .6rem; }
.app-main .page-header-ico { width: 36px; height: 36px; border-radius: 10px; font-size: 1.1rem; }
.app-main .page-header-title { font-size: 1.25rem; }
.app-main .page-header-title .badge { font-size: .74rem !important; }
.app-main .page-header-sub { margin-top: .05rem; font-size: .82rem; }
.app-main .page-header-actions { gap: .4rem; }
.app-main .app-breadcrumb { margin-bottom: .5rem; }
/* Hlavičky karet a sekcí formuláře */
.app-main .card-header { padding: .45rem .85rem; font-size: .9rem; }
.app-main .form-section-head { margin-bottom: .6rem; gap: .5rem; }
.app-main .form-section-ico { width: 30px; height: 30px; border-radius: 8px; font-size: .95rem; }
.app-main .form-section-title { font-size: .95rem; }
.app-main .form-tabs .nav-link { padding: .5rem .5rem; font-size: .88rem; }
/* Filtry a záložky nad výpisy */
.app-main .list-tabs { gap: .4rem; padding-bottom: .6rem; margin-bottom: .6rem; }
.app-main .list-tab { padding: var(--ctl-py) var(--ctl-px); border-radius: var(--ctl-radius); font-size: var(--ctl-fs); line-height: var(--ctl-lh); gap: .45rem; }
.app-main .list-tab-count { font-size: .72rem; padding: 0 .45rem; }
.app-main .list-filters { gap: .5rem; margin-bottom: .6rem; }
.app-main .list-filters .list-filter label { font-size: .76rem; margin-bottom: .15rem; }
.app-main .app-body-main > form[method="get"].row { margin-bottom: .6rem !important; }
.app-main .list-footer { margin-top: .6rem; padding-top: .6rem; }
.app-main .list-footer .page-link { padding: var(--ctl-py) .6rem; font-size: var(--ctl-fs); line-height: var(--ctl-lh); }

/* ============================  PDF DOKUMENTY (.doc)  ============================ */
/* Pozn. k mPDF: třídu na <body> nebere jako předka (šablony mají obsah v <div class="doc">),
   tabulky nedědí velikost písma a bloky uvnitř buněk neorámuje – rámečky a čáry proto nesou buňky. */
.doc { font-family: var(--doc-font); font-size: var(--doc-size); color: var(--ink); }
.doc table { width: 100%; border-collapse: collapse; }
.doc td, .doc th { font-size: var(--doc-size); vertical-align: top; }
.doc h1 { font-size: 20px; margin: 0; }
.doc .muted { color: var(--muted); }
.doc .right { text-align: right; }
.doc .center { text-align: center; }
.doc .total { font-size: 14px; font-weight: bold; }
.doc td.box, .doc div.box { border: 1px solid var(--line-strong); padding: 8px; line-height: 1.45; }
.doc table.items th { background: var(--thead-bg); text-align: left; border-bottom: 1px solid var(--line-strong); padding: 5px; font-weight: bold; }
.doc table.items td { border-bottom: 1px solid var(--line-soft); padding: 5px; }
.doc table.items th.right, .doc table.items td.right { text-align: right; }
.doc td.sign { border-bottom: 1px solid var(--line-strong); height: 60px; color: var(--muted); }

/* --- Montážní list (body class="doc report") --- */
/* Pozn.: mPDF nebere třídu na <body> jako předka – šablona má obsah v <div class="doc report">. */
.report { font-size: 10.5px; color: #111111; }
.report .rp-title { font-size: 23px; font-weight: bold; color: #000000; }
.report .rp-number { font-size: 18px; font-weight: bold; color: var(--accent); }
.report table.rp-head td { vertical-align: bottom; padding: 0 0 5px 0; border-bottom: 2px solid #111111; }
.report table.rp-company td { vertical-align: top; padding: 6px 0 7px 0; border-bottom: 1px solid #bdbdbd; font-size: 9.5px; line-height: 1.5; }
.report .rp-company-name { font-size: 11px; font-weight: bold; }
.report .rp-normal { font-weight: normal; }
.report .rp-gap { margin-top: 10px; }
.report td, .report th { font-size: 10.5px; }
.report table.box td, .report table.pair td.lbl, .report table.pair td.val { border: 1px solid var(--line-strong); padding: 4px 7px; vertical-align: top; }
.report table.pair td.lbl { font-weight: bold; }
.report table.pair td.gap, .report table.pair td.none, .report table.tot td.none { border: 0; }
.report table.items th { background: #efefef; border: 1px solid var(--line-strong); padding: 4px 7px; text-align: center; font-weight: bold; }
.report table.items td { border: 1px solid var(--line-strong); padding: 4px 7px; }
.report table.tot td.k { border: 1px solid var(--line-strong); padding: 4px 9px; background: #efefef; font-weight: bold; }
.report table.tot td.v { border: 1px solid var(--line-strong); padding: 4px 9px; text-align: right; }
.report table.tot td.grand { border: 1px solid var(--bar-bg); padding: 5px 9px; background: var(--bar-bg); color: var(--bar-fg); font-weight: bold; font-size: 11.5px; }
.report table.tot td.gv { text-align: right; }
/* tmavý pruh s nadpisem bloku je první řádek tabulky (až za obecnými pravidly buněk, aby je přebil) */
.report td.bar { background: var(--bar-bg); color: var(--bar-fg); border: 1px solid var(--bar-bg); font-weight: bold; font-size: 9.5px; letter-spacing: .5px; padding: 3px 7px; text-align: left; }
.report .rp-note { margin-top: 8px; border: 1px solid var(--line-strong); padding: 6px 9px; font-size: 8.5px; line-height: 1.5; color: #333333; }
.report td.sigbox { border: 1px solid var(--line-strong); border-top: 2px solid #111111; height: 105px; vertical-align: top; padding: 6px; text-align: center; }
.report .rp-siglabel { font-size: 8.5px; color: #333333; text-align: center; }
.report .blue { color: var(--accent); font-weight: bold; }

/* ============================  E-MAILY (.email)  ============================ */
.email { margin: 0; padding: 0; background: var(--page-bg); font-family: var(--font-sans); color: var(--ink); }
.email-wrap { max-width: 600px; margin: 0 auto; padding: 24px 16px; }
.email-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.email-header { background: var(--brand); color: #fff; padding: 16px 24px; font-size: 18px; font-weight: 600; }
.email-body { padding: 24px; font-size: 14px; line-height: 1.6; }
.email-body p { margin: 0 0 12px; }
.email-btn { display: inline-block; background: var(--brand); color: #ffffff !important; text-decoration: none; padding: 10px 18px; border-radius: 6px; font-weight: 600; }
.email-total { font-weight: 700; color: var(--ink); }
.email-footer { padding: 16px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.email-muted { color: var(--muted); }

/* ============================  UPRAVIT UŽIVATELE (settings/users/edit)  ============================ */
.ue-avatar { width: 84px; height: 84px; flex: 0 0 auto; border-radius: 50%; background: var(--ctx-blue); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 1.75rem; font-weight: 700; letter-spacing: .02em; }
@media (max-width: 575.98px) { .ue-avatar { width: 56px; height: 56px; font-size: 1.2rem; } }
.ue-switch { display: flex; align-items: center; gap: .5rem; min-height: 38px; margin: 0; }
.ue-switch .form-check-input { width: 2.6em; height: 1.4em; margin-top: 0; }
.ue-toggle { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.ue-toggle:last-of-type { border-bottom: 0; }
.ue-toggle .form-check-input { width: 2.6em; height: 1.4em; margin-top: .1em; }
.ue-toggle .form-check-input:disabled { opacity: .55; }
.ue-toggle label { cursor: default; }
.ue-table th { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.ue-table .ue-col-check { width: 6.5rem; text-align: center; }
.ue-quick { background: linear-gradient(180deg, var(--ctx-green) 0, var(--ctx-green) 58px, var(--surface) 58px); }
.ue-ico-green { background: #d1fae5; color: var(--ctx-green-ico); }
.ue-ico-amber { background: #fef3c7; color: #b45309; }
.ue-note { background: #fffbeb; border-color: #fde68a; }
.ue-actions { display: flex; flex-direction: column; }
.ue-actions a, .ue-actions button { display: flex; align-items: center; gap: .75rem; padding: .55rem .25rem; color: var(--ink-soft);
    text-decoration: none; background: none; border: 0; text-align: left; border-radius: 8px; width: 100%; }
.ue-actions a:hover, .ue-actions button:hover { background: var(--ctx-blue); color: var(--brand); }
.ue-actions .bi { width: 32px; height: 32px; border-radius: 8px; background: var(--ctx-blue); color: var(--brand);
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ue-collapse > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
.ue-collapse > summary::-webkit-details-marker { display: none; }
.ue-collapse[open] > summary { margin-bottom: .85rem; }
.ue-collapse-arrow { color: var(--muted); transition: transform .15s ease; }
.ue-collapse[open] .ue-collapse-arrow { transform: rotate(180deg); }

/* ============================  NÁSTĚNKA (dashboard/index)  ============================ */
.db { --db-blue: #2563eb; --db-orange: #ea580c; --db-green: #16a34a; --db-red: #dc2626; --db-violet: #7c3aed; --db-slate: #64748b; --db-amber: #d97706; }
.db-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.db-title { font-size: 1.75rem; font-weight: 700; margin: 0; }
.db-sub { color: var(--muted); margin: .2rem 0 0; }
.db-date { color: var(--muted); font-size: .9rem; white-space: nowrap; padding-top: .5rem; }
.db-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem;
    box-shadow: 0 1px 2px rgba(15,23,42,.04); color: inherit; text-decoration: none; min-width: 0; }
.db-card--flush { padding: 0; overflow: hidden; }
a.db-card { transition: box-shadow .15s, transform .15s; }
a.db-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.10); transform: translateY(-1px); color: inherit; }
.db-muted { color: var(--muted); }
.db-chev { color: #94a3b8; font-size: .85rem; }

.db-ico { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex: 0 0 auto; }
.db-ico--lg { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 12px; }
.db-ico--blue   { background: #dbeafe; color: var(--db-blue); }
.db-ico--orange { background: #ffedd5; color: var(--db-orange); }
.db-ico--green  { background: #dcfce7; color: var(--db-green); }
.db-ico--red    { background: #fee2e2; color: var(--db-red); }
.db-ico--violet { background: #ede9fe; color: var(--db-violet); }
.db-ico--slate  { background: #e2e8f0; color: var(--db-slate); }

/* ukazatele */
.db-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.db-kpi { display: flex; flex-direction: column; justify-content: space-between; gap: .75rem; }
.db-kpi-top { display: flex; align-items: flex-start; gap: .75rem; }
.db-kpi-num { flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.db-kpi-num strong { display: block; font-size: 1.6rem; font-weight: 700; }
.db-kpi-num span { color: var(--ink-soft); font-size: .88rem; }
.db-kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: .82rem; }
.db-kpi-stack { display: flex; flex-direction: column; gap: .9rem; }
.db-kpi--mini { padding: .7rem 1rem; flex: 1 1 0; justify-content: center; }
.db-kpi--mini .db-kpi-num strong { font-size: 1.3rem; }
.db-kpi--mini .db-ico { width: 34px; height: 34px; font-size: 1rem; }
.db-delta { display: inline-block; padding: .1rem .45rem; border-radius: 6px; font-weight: 600; font-size: .8rem; }
.db-delta--up   { background: #dcfce7; color: #15803d; }
.db-delta--down { background: #fee2e2; color: #b91c1c; }
.db-delta--flat { background: #f1f5f9; color: var(--ink-soft); }
.db-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; padding: 0 .4rem; border-radius: 13px;
    background: #dbeafe; color: var(--db-blue); font-weight: 700; font-size: .75rem; }
.db-chip--more { background: #f1f5f9; color: var(--ink-soft); }

/* grafy */
.db-chart-head { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: .5rem; }
.db-chart-title { font-weight: 600; }
.db-chart-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.db-chart { width: 100%; height: auto; display: block; }
.db-grid { stroke: #e5e7eb; stroke-dasharray: 3 3; }
.db-axis { fill: #64748b; font-size: 11px; }
.db-bar { fill: #bfdbfe; }
.db-bar--today { fill: var(--db-blue); }
.db-area { fill: rgba(37, 99, 235, .12); }
.db-line { fill: none; stroke: var(--db-blue); stroke-width: 2.2; stroke-linejoin: round; }
.db-dot { fill: var(--db-blue); stroke: #fff; stroke-width: 1.5; }

/* bloky se seznamy */
.db-card-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.db-card-head h2 { font-size: 1.02rem; font-weight: 600; margin: 0; flex: 1 1 auto; min-width: 0; }
.db-card-head h2 small { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); }
.db-more { font-size: .85rem; white-space: nowrap; text-decoration: none; }
.db-pill { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.db-list { display: flex; flex-direction: column; }
.db-visit { display: flex; align-items: center; gap: .9rem; padding: .55rem .25rem; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.db-visit:first-child { border-top: 0; }
.db-visit:hover { background: #f8fafc; }
.db-time { width: 3rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.db-visit-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.db-visit-main span { color: var(--muted); font-size: .85rem; }
.db-table td { padding: .6rem .5rem; border-color: var(--line); }
.db-table tr:first-child td { border-top: 0; }
.db-link { font-weight: 600; text-decoration: none; }

/* pravý sloupec */
.db-side-head { display: flex; align-items: center; gap: .85rem; padding: .9rem 1.1rem; }
.db-side-head strong { display: block; font-size: 1.02rem; }
.db-side-head span { color: var(--muted); font-size: .85rem; }
.db-side-ico { font-size: 1.5rem; }
.db-side-head--blue { background: #eff6ff; } .db-side-head--blue .db-side-ico { color: var(--db-blue); }
.db-side-head--red { background: #fef2f2; } .db-side-head--red .db-side-ico { color: var(--db-red); }
.db-actions a, .db-alerts a { display: flex; align-items: center; gap: .85rem; padding: .65rem 1.1rem; border-top: 1px solid var(--line);
    color: inherit; text-decoration: none; }
.db-actions a:hover, .db-alerts a:hover { background: #f8fafc; }
.db-actions a span.flex-grow-1 { font-weight: 600; }
.db-alerts strong { display: block; font-size: .92rem; }
.db-alerts span span { color: var(--muted); font-size: .85rem; }
.db-alert--off strong { color: var(--ink-soft); font-weight: 600; }
.db-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.db-dot--red { background: var(--db-red); } .db-dot--amber { background: #f59e0b; } .db-dot--green { background: var(--db-green); }
.db-dot--blue { background: var(--db-blue); } .db-dot--grey { background: #94a3b8; }
.db-stock { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.db-stock > div { padding: .25rem .4rem; border-left: 1px solid var(--line); }
.db-stock > div:first-child { border-left: 0; }
.db-stock strong { display: block; font-size: 1.5rem; font-weight: 700; }
.db-stock span { font-size: .78rem; color: var(--muted); }
.db-stock--red strong, .db-stock--red span { color: var(--db-red); }
.db-stock--amber strong, .db-stock--amber span { color: var(--db-amber); }
@media (max-width: 575.98px) { .db-title { font-size: 1.4rem; } .db-head { flex-direction: column; gap: .25rem; } .db-date { padding-top: 0; } }
.db-order-no { display: flex; flex-direction: column; line-height: 1.25; flex: 0 0 auto; min-width: 6.5rem; }
.db-order-no strong { color: var(--db-blue); }
.db-order-no span { color: var(--muted); font-size: .8rem; }
.db-visit-main strong, .db-visit-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-axis { font-size: 10.5px; }

/* Seznam zákazníků: úzké sloupce IČO / DIČ a Poslední zakázka (jen na šířku obsahu), menší písmo u zakázky */
.app-body-main .cl-table > thead > tr > th.cl-col-ico, .app-body-main .cl-table > tbody > tr > td.cl-col-ico,
.app-body-main .cl-table > thead > tr > th.cl-col-last, .app-body-main .cl-table > tbody > tr > td.cl-col-last { width: 1%; white-space: nowrap; overflow-wrap: normal; }
.app-body-main .cl-table > tbody > tr > td.cl-col-ico { font-size: .8rem; }
.app-body-main .cl-table > tbody > tr > td.cl-col-last { font-size: .76rem; }
.app-body-main .cl-table > tbody > tr > td.cl-col-last .cell-lines > div { line-height: 1.3; }

/* ============================  EDITOR DOKLADU (faktura – delivery_notes/show, příjemka – receipts/form)  ============================
   Karty .ie-card ve dvou sloupcích .ie-cols, tabulka položek .ie-items, panel hledání .ie-panel, součet .ie-grand.
   Faktura má vpravo živý náhled (.ie-grid + .ie-preview), příjemka náhled nemá. */
/* editor vlevo, úzký náhled dokladu vpravo (zmenší se na šířku sloupce) */
.ie-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(308px, 440px); gap: 1rem; align-items: start; }
@media (max-width: 1199.98px) { .ie-grid { grid-template-columns: minmax(0, 1fr); } } /* menší displej: náhled pod editorem přes celou šířku */
.ie-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 767.98px) { .ie-cols { grid-template-columns: minmax(0, 1fr); } }
.ie-card { background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: .6rem; padding: 1rem 1.1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.ie-card + .ie-card { margin-top: 0; }
.ie-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.ie-head h2 { font-size: 1.02rem; font-weight: 700; margin: 0; }
.ie-head .ie-ico { color: var(--brand, #2563eb); font-size: 1.35rem; line-height: 1; }
.ie-head .ie-tools { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.ie-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem .9rem; font-size: .9rem; align-items: center; }
.ie-kv > .k { color: var(--muted, #6b7280); }
.ie-ro[readonly] { background: #f3f5f8; border-color: #e3e7ee; }
.ie-buyer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: .6rem 1.2rem; font-size: .92rem; }
/* dlouhé hodnoty (e-mail, adresa) nesmí přetéct z karty: zalomit, e-mail zkrátit s „…“ (celý v title) */
.ie-buyer > *, .ie-kv > * { min-width: 0; overflow-wrap: anywhere; }
.ie-kv a[href^="mailto:"] { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 575.98px) { .ie-buyer { grid-template-columns: minmax(0, 1fr); } }
.ie-search { position: relative; }
.ie-results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; max-height: 280px; overflow: auto; }
.ie-items { width: 100%; font-size: .9rem; }
.ie-items th { font-weight: 600; font-size: .82rem; color: #334155; padding: .45rem .4rem; border-bottom: 1px solid var(--line, #e5e7eb); white-space: nowrap; }
.ie-items td { padding: .35rem .3rem; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.ie-items .form-control-sm, .ie-items .form-select-sm { min-height: 2rem; }
.ie-handle { color: #9aa3b2; cursor: grab; width: 1.4rem; text-align: center; }
.ie-row.ie-dragging { opacity: .45; }
.ie-act { width: 2.2rem; }
.ie-iconbtn { padding: .2rem .45rem; border: 1px solid var(--line, #e5e7eb); }
.ie-tag { display: inline-block; font-size: .72rem; color: #64748b; margin-top: .15rem; }
.ie-addrow td { color: #9aa3b2; cursor: pointer; }
.ie-addrow:hover td { color: var(--brand, #2563eb); }
.ie-panel { background: #f7f9fc; border: 1px dashed #cfd8e6; border-radius: .5rem; padding: .7rem; margin-bottom: .7rem; }
.ie-note-tools button { border: 0; background: none; padding: .2rem .45rem; border-radius: .3rem; color: #334155; }
.ie-note-tools button:hover { background: #eef2f7; }
.ie-note { min-height: 120px; border: 1px solid var(--line, #e5e7eb); border-top: 0; border-radius: 0 0 .4rem .4rem; padding: .6rem .75rem; outline: none; font-size: .92rem; }
.ie-note ul, .ie-note ol { margin: 0 0 .3rem 1.2rem; padding: 0; }
.ie-note p { margin: 0 0 .3rem; }
.ie-note-tools { border: 1px solid var(--line, #e5e7eb); border-radius: .4rem .4rem 0 0; padding: .25rem .35rem; display: flex; gap: .15rem; }
.ie-totals .ie-kv { font-size: .95rem; }
.ie-grand { background: #eaf3ff; border-radius: .5rem; padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; margin-top: .8rem; }
.ie-grand strong { font-size: 1rem; }
.ie-grand .ie-sum { font-size: 1.6rem; font-weight: 700; color: var(--brand, #2563eb); }
.ie-preview { position: sticky; top: 1rem; }
.ie-sheet { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: .5rem; box-shadow: 0 2px 10px rgba(15,23,42,.08); overflow: hidden; position: relative; }
.ie-sheet iframe { border: 0; width: 794px; height: 1123px; transform-origin: 0 0; display: block; background: #fff; }
.ie-sheet .ie-loading { position: absolute; top: .5rem; right: .7rem; font-size: .75rem; color: #64748b; display: none; }
.ie-sheet.is-loading .ie-loading { display: block; }
/* příjemka: krátké zvýraznění řádku, kam se karta přičetla; jednotka jen ke čtení */
.ie-row.ie-flash td { background: #fff7d6; transition: background .6s; }
.ie-items .ie-unit[readonly] { background: transparent; border-color: transparent; padding-left: .2rem; }
.ie-items .ie-total { white-space: nowrap; font-weight: 600; }
/* příjemka: nahoře údaje vlevo a Součet vpravo (místo panelu Rychlé akce), pod tím položky a poznámka přes celou šířku */
.rc-top { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-width); gap: 1rem; margin-bottom: 1rem; align-items: stretch; }
.rc-top-main > .ie-cols:last-child { margin-bottom: 0; }
.rc-sum { position: sticky; top: 72px; align-self: start; }
@media (max-width: 1199.98px) { .rc-top { grid-template-columns: minmax(0, 1fr); } .rc-sum { position: static; } }
/* Součet příjemky v úzkém sloupci: popisek nad částkou, částka zarovnaná doprava přes celou šířku */
.rc-sum .ie-grand { flex-direction: column; align-items: stretch; gap: .2rem; }
.rc-sum .ie-grand strong { font-size: .85rem; font-weight: 600; color: #475569; }
.rc-sum .ie-grand .ie-sum { text-align: right; white-space: nowrap; font-size: clamp(1.25rem, 1.6vw, 1.6rem); line-height: 1.2; font-variant-numeric: tabular-nums; }
.rc-sum .ie-kv { grid-template-columns: minmax(0, 1fr) auto; }

/* ============================  OKNO VÝBĚRU KONTAKTU („Vybrat zákazníka“ / „Vybrat dodavatele“)  ============================
   partials/contact_picker.php + assets/js/contact-picker.js, návrh pic/Výběr dodavatele v ERP systému.png.
   Počítač: vlevo skupiny a rychlé filtry, uprostřed hledání a seznam, vpravo detail. Užší okno (iPad na šířku):
   detail pod seznamem. iPad na výšku a menší: přes celou obrazovku, skupiny a filtry jako vodorovný pruh. */
.ctp { --ctp-soft: #f6f8fc; --ctp-line: #e6eaf2; --ctp-sel: #eaf1ff; --ctp-blue: #1d4ed8; }
.ctp .ctp-dialog { max-width: min(1360px, calc(100vw - 2rem)); }
.ctp .modal-content { border: 0; border-radius: 18px; box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .45); overflow: hidden; }
.ctp-header { gap: 1rem; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--ctp-line); background: #fbfcfe; }
.ctp-h-ico { flex: none; display: grid; place-items: center; width: 3.1rem; height: 3.1rem; border-radius: 12px; background: var(--brand, #2563eb); color: #fff; font-size: 1.5rem; box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .6); }
.ctp-h-text { flex: 1 1 auto; min-width: 0; }
.ctp-header .modal-title { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.ctp-h-sub { color: var(--muted, #64748b); font-size: .92rem; }
.ctp-header .btn-close { margin: 0; align-self: flex-start; }
.ctp .modal-body { padding: 1rem 1.5rem; background: #fff; }

.ctp-layout { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr) 20rem; gap: 1rem; height: min(640px, calc(100vh - 15rem)); min-height: 420px; }
.ctp-layout > * { min-height: 0; }

/* levý panel: skupiny + rychlé filtry */
.ctp-side { display: flex; flex-direction: column; padding: .75rem; border: 1px solid var(--ctp-line); border-radius: 14px; background: var(--ctp-soft); overflow-y: auto; }
.ctp-groups { display: flex; flex-direction: column; gap: 2px; padding-bottom: .75rem; margin-bottom: .75rem; border-bottom: 1px solid var(--ctp-line); }
.ctp-group { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .6rem .7rem; border: 0; border-radius: 10px; background: transparent; color: var(--ink, #0f172a); font-size: .93rem; text-align: left; }
.ctp-group:hover { background: #eef2f9; }
.ctp-group .bi { font-size: 1.05rem; color: #64748b; }
.ctp-group.active { background: #dfe9ff; color: var(--ctp-blue); font-weight: 700; }
.ctp-group.active .bi, .ctp-group.active .ctp-count { color: var(--ctp-blue); }
.ctp-g-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctp-count { color: var(--muted, #64748b); font-size: .82rem; font-variant-numeric: tabular-nums; }
.ctp-side-title { padding: 0 .4rem .4rem; font-weight: 700; font-size: .95rem; }
.ctp-flags { display: flex; flex-direction: column; gap: .15rem; }
.ctp-flag { display: flex; align-items: center; gap: .55rem; padding: .4rem .45rem; border-radius: 8px; font-size: .88rem; cursor: pointer; }
.ctp-flag:hover { background: #eef2f9; }
.ctp-flag .form-check-input { margin: 0; flex: none; }

/* hledání + seznam */
.ctp-main { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.ctp-search { flex: none; display: flex; align-items: center; gap: .65rem; height: 2.9rem; margin: 0; padding: 0 .6rem 0 .95rem; border: 1px solid var(--ctp-line); border-radius: 12px; background: #fff; cursor: text; }
.ctp-search:focus-within { border-color: var(--brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.ctp-search > .bi { color: #475569; font-size: 1.05rem; }
.ctp-q { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: .95rem; }
.ctp-kbd { flex: none; padding: .15rem .45rem; border: 1px solid var(--ctp-line); border-radius: 6px; background: var(--ctp-soft); color: #475569; font-size: .75rem; font-family: inherit; }
.ctp-table { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--ctp-line); border-radius: 12px; overflow: hidden; background: #fff; }
.ctp-thead, .ctp-row { display: grid; grid-template-columns: 2.6rem minmax(0, 1.25fr) minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; column-gap: .75rem; padding: 0 .9rem 0 .4rem; }
.ctp-thead { flex: none; min-height: 2.6rem; background: var(--ctp-soft); border-bottom: 1px solid var(--ctp-line); font-size: .85rem; font-weight: 600; color: #334155; }
.ctp-sort { display: inline-flex; align-items: center; gap: .35rem; padding: 0; border: 0; background: none; font-weight: 600; color: inherit; justify-self: start; }
.ctp-sort .bi { color: #94a3b8; }
.ctp-sort.desc .bi { color: var(--ctp-blue); }
.ctp-rows { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.ctp-row { min-height: 4rem; padding-top: .55rem; padding-bottom: .55rem; border-bottom: 1px solid #eef1f6; border-left: 3px solid transparent; cursor: pointer; font-size: .88rem; }
.ctp-row:hover { background: #f8faff; }
.ctp-row:focus { outline: 0; }
.ctp-row:focus-visible { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .35); }
.ctp-row.sel { background: var(--ctp-sel); border-left-color: var(--brand, #2563eb); box-shadow: inset 0 0 0 1px #bfd3ff; }
.ctp-c-star { display: grid; place-items: center; }
.ctp-star { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 8px; background: none; color: #94a3b8; font-size: 1.1rem; }
.ctp-star:hover { background: #eef2f9; color: #f59e0b; }
.ctp-star.on { color: #f59e0b; }
.ctp-row.sel .ctp-star.on { color: var(--ctp-blue); }
.ctp-c-name { display: flex; flex-direction: column; min-width: 0; }
.ctp-c-name strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctp-c-name small { color: var(--muted, #64748b); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctp-c-contact { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ctp-c-contact > span, .ctp-c-addr { display: flex; align-items: flex-start; gap: .45rem; min-width: 0; }
.ctp-c-contact > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ctp-c-contact .bi, .ctp-c-addr .bi { color: #64748b; margin-right: .4rem; }
.ctp-c-addr .bi { margin-right: 0; margin-top: .1rem; }
.ctp-c-addr > span { min-width: 0; line-height: 1.35; }
.ctp-msg { padding: 2rem 1rem; text-align: center; color: var(--muted, #64748b); font-size: .9rem; }
.ctp-more { flex: none; padding: .5rem; text-align: center; border-top: 1px solid var(--ctp-line); }
.ctp-no-fav .ctp-c-star { visibility: hidden; }

/* detail vpravo */
.ctp-detail { border: 1px solid var(--ctp-line); border-radius: 14px; background: #fff; overflow-y: auto; }
.ctp-empty-detail { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 1.5rem; text-align: center; color: #94a3b8; font-size: .88rem; }
.ctp-empty-detail .bi { font-size: 2.6rem; color: #cbd5e1; }
.ctp-d-card { padding: 1.1rem 1.15rem; }
.ctp-d-ico { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; margin-bottom: .75rem; border-radius: 12px; background: #e8efff; color: var(--brand, #2563eb); font-size: 1.6rem; }
.ctp-d-title { margin: 0; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.ctp-d-sub { color: var(--muted, #64748b); font-size: .9rem; margin-top: .1rem; }
.ctp-d-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin: .65rem 0 .2rem; }
.ctp-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.ctp-pill-success { background: #dcfce7; color: #15803d; }
.ctp-pill-info { background: #e0ebff; color: var(--ctp-blue); }
.ctp-pill-muted { background: #f1f5f9; color: #64748b; }
.ctp-d-contact { list-style: none; margin: .75rem 0 0; padding: 0 0 .9rem; border-bottom: 1px solid var(--ctp-line); display: flex; flex-direction: column; gap: .55rem; font-size: .92rem; }
.ctp-d-contact li { display: flex; gap: .75rem; align-items: flex-start; min-width: 0; }
.ctp-d-contact li > span { min-width: 0; overflow-wrap: anywhere; }
.ctp-d-contact .bi { color: #475569; font-size: 1.05rem; }
.ctp-d-contact a { color: inherit; text-decoration: none; }
.ctp-d-contact a:hover { color: var(--brand, #2563eb); text-decoration: underline; }
.ctp-d-rows { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem 1rem; margin: .9rem 0 1rem; font-size: .88rem; align-items: center; }
.ctp-d-rows dt { font-weight: 400; color: var(--muted, #64748b); margin: 0; }
.ctp-d-rows dd { margin: 0; overflow-wrap: anywhere; }
.ctp-edit { border-radius: 10px; font-weight: 600; }

/* patička */
.ctp-footer { justify-content: space-between; gap: .75rem; padding: .9rem 1.5rem; border-top: 1px solid var(--ctp-line); background: #fbfcfe; }
.ctp-status { display: flex; align-items: center; gap: .65rem; min-width: 0; font-size: .92rem; color: #334155; }
.ctp-status-ico { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--ctp-soft); color: #475569; }
.ctp-sep { color: #cbd5e1; }
.ctp-chosen-wrap { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctp-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-left: auto; }
.ctp-actions .btn { min-height: 2.75rem; padding-left: 1.2rem; padding-right: 1.2rem; border-radius: 10px; font-weight: 600; }

/* užší okno: detail pod seznamem */
@media (max-width: 1299.98px) {
    .ctp-layout { grid-template-columns: 14rem minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: auto; min-height: 0; }
    .ctp-side { grid-row: 1 / span 2; }
    .ctp-main { height: min(460px, calc(100vh - 22rem)); min-height: 300px; }
    .ctp-detail { max-height: none; }
    .ctp-empty-detail { padding: .9rem; flex-direction: row; }
    .ctp-empty-detail .bi { font-size: 1.5rem; }
    .ctp-d-card { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 0 1.25rem; align-items: start; }
    .ctp-d-ico { grid-row: 1 / span 4; }
    .ctp-d-contact { grid-column: 2; border-bottom: 0; }
    .ctp-d-rows { grid-column: 3; grid-row: 1 / span 4; margin-top: 0; }
    .ctp-edit { grid-column: 2; width: auto !important; justify-self: start; }
}
/* iPad na výšku a menší: přes celou obrazovku, skupiny a filtry jako vodorovný pruh */
@media (max-width: 991.98px) {
    .ctp .modal-content { border-radius: 0; }
    .ctp-header { padding: .8rem 1rem; }
    .ctp-h-ico { width: 2.6rem; height: 2.6rem; font-size: 1.25rem; }
    .ctp-h-sub { display: none; }
    .ctp .modal-body { padding: .75rem 1rem; display: flex; flex-direction: column; }
    .ctp-layout { flex: 1 1 auto; display: flex; flex-direction: column; gap: .75rem; }
    .ctp-side { flex: none; flex-direction: row; flex-wrap: nowrap; gap: .4rem; padding: .4rem; overflow-x: auto; overflow-y: hidden; border-radius: 12px; }
    .ctp-groups, .ctp-flags { flex-direction: row; gap: .4rem; padding: 0; margin: 0; border: 0; }
    .ctp-side-title { display: none; }
    .ctp-group, .ctp-flag { width: auto; flex: none; white-space: nowrap; padding: .4rem .7rem; border: 1px solid var(--ctp-line); border-radius: 999px; background: #fff; }
    .ctp-main { flex: 1 1 auto; height: auto; min-height: 280px; }
    .ctp-d-card { grid-template-columns: auto minmax(0, 1fr); }
    .ctp-d-rows { grid-column: 2; grid-row: auto; margin-top: .75rem; }
    .ctp-footer { padding: .7rem 1rem; }
    .ctp-sep, .ctp-status-ico { display: none; }
    .ctp-actions .btn { min-height: 2.5rem; padding-left: .9rem; padding-right: .9rem; }
}
@media (max-width: 767.98px) {
    .ctp-thead { display: none; }
    .ctp-row { grid-template-columns: 2.4rem minmax(0, 1fr); row-gap: .2rem; }
    .ctp-c-contact, .ctp-c-addr { grid-column: 2; font-size: .82rem; }
    .ctp-c-contact { flex-direction: row; flex-wrap: wrap; gap: .1rem .9rem; }
    .ctp-kbd { display: none; }
    .ctp-status { width: 100%; }
    .ctp-actions { width: 100%; }
    .ctp-actions .btn { flex: 1 1 auto; }
}
/* okno výběru kontaktu → formulář Nový zákazník / dodavatel (stejná pole jako stránka, customers|suppliers/_fields.php) */
.ctp .ctp-form-only { display: none; }
.ctp.ctp-mode-form .ctp-form-only { display: inline-flex; align-items: center; gap: .35rem; }
.ctp.ctp-mode-form .ctp-list-only, .ctp.ctp-mode-form .ctp-layout, .ctp.ctp-mode-form .ctp-status { display: none; }
.ctp-form { height: min(640px, calc(100vh - 15rem)); min-height: 420px; overflow-y: auto; padding: .25rem .25rem 1rem; }
.ctp-form .form-section-head { margin-bottom: .75rem; }
@media (max-width: 991.98px) { .ctp-form { height: auto; min-height: 0; flex: 1 1 auto; } }

/* ============================  VÝPIS ZÁKAZNÍKŮ / DODAVATELŮ (adresář kontaktů)  ============================
   partials/contact_directory.php + contact_panel.php + assets/js/contact-directory.js, návrh pic/bf59ea96-…png.
   Nahoře souhrnné karty, pod nimi vlevo hledání, filtry a tabulka (nebo dlaždice) se stránkováním, vpravo panel
   vybraného kontaktu. Pod 1200 px panel zmizí a klik na řádek otevře detail. Sloupce tabulky se skrývají podle
   šířky, kterou tabulka skutečně má (container queries). */
.cdir { --cd-line: #e6eaf2; --cd-soft: #f6f8fc; --cd-sel: #eaf1ff; --cd-blue: #1d4ed8; }
.cdir-tone-blue { background: #e0ebff; color: var(--cd-blue); }
.cdir-tone-green { background: #dcfce7; color: #15803d; }
.cdir-tone-amber { background: #fef3c7; color: #b45309; }
.cdir-tone-gray { background: #f1f5f9; color: #64748b; }
.cdir-tone-gold { background: #fff7db; color: #d97706; }
.cdir-tone-teal { background: #e0f2fe; color: #0369a1; }

/* souhrnné karty */
.cdir-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.cdir-kpi { display: flex; align-items: center; gap: .9rem; padding: .95rem 1.1rem; border: 1px solid var(--cd-line); border-radius: 14px; background: #fff; color: var(--ink, #0f172a); text-decoration: none; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: border-color .15s, box-shadow .15s; }
.cdir-kpi:hover { border-color: #bfd3ff; box-shadow: 0 4px 14px -6px rgba(37, 99, 235, .25); color: inherit; }
.cdir-kpi.active { border-color: var(--brand, #2563eb); box-shadow: 0 0 0 1px var(--brand, #2563eb); }
.cdir-kpi-ico { flex: none; display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 12px; font-size: 1.4rem; }
.cdir-kpi-text { display: flex; flex-direction: column; min-width: 0; }
.cdir-kpi-text strong { font-size: 1.45rem; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.cdir-kpi-text span { color: var(--muted, #64748b); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* seznam + panel */
.cdir-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 1200px) { .cdir-body { grid-template-columns: minmax(0, 1fr) minmax(360px, 30%); } }
@media (min-width: 1700px) { .cdir-body { grid-template-columns: minmax(0, 1fr) 520px; } }
.cdir-list { container-type: inline-size; min-width: 0; padding: 1rem; border: 1px solid var(--cd-line); border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }

/* hledání + filtry */
.cdir-toolbar { display: flex; flex-wrap: wrap; align-items: stretch; gap: .6rem; margin-bottom: .9rem; }
.cdir-search { flex: 1 1 260px; display: flex; align-items: center; gap: .6rem; min-height: 3rem; margin: 0; padding: 0 .6rem 0 .9rem; border: 1px solid var(--cd-line); border-radius: 12px; background: #fff; cursor: text; }
.cdir-search:focus-within { border-color: var(--brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.cdir-search .bi { color: #475569; }
.cdir-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: .93rem; }
.cdir-search kbd { flex: none; padding: .15rem .45rem; border: 1px solid var(--cd-line); border-radius: 6px; background: var(--cd-soft); color: #475569; font-size: .74rem; font-family: inherit; }
.cdir-select { flex: 0 1 170px; position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 3rem; margin: 0; padding: .25rem .75rem; border: 1px solid var(--cd-line); border-radius: 12px; background: #fff; }
.cdir-select:focus-within { border-color: var(--brand, #2563eb); }
.cdir-select span { font-size: .7rem; color: var(--muted, #64748b); line-height: 1.1; }
.cdir-select select { border: 0; outline: 0; background: transparent; padding: 0; font-size: .9rem; font-weight: 500; color: var(--ink, #0f172a); cursor: pointer; }
.cdir-views { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.cdir-view { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 1px solid var(--cd-line); border-radius: 10px; color: #475569; background: #fff; font-size: 1.1rem; text-decoration: none; }
.cdir-view:hover { background: var(--cd-soft); color: var(--ink, #0f172a); }
.cdir-view.active { background: var(--brand, #2563eb); border-color: var(--brand, #2563eb); color: #fff; }

/* tabulka */
.cdir-table-wrap { border: 1px solid var(--cd-line); border-radius: 12px; overflow: hidden; }
.cdir-table { width: 100%; border-collapse: collapse; font-size: .88rem; table-layout: auto; }
.cdir-table thead th { padding: .65rem .55rem; background: var(--cd-soft); border-bottom: 1px solid var(--cd-line); font-weight: 600; font-size: .83rem; color: #334155; white-space: nowrap; text-align: left; }
.cdir-table td { padding: .5rem .55rem; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.cdir-table tbody tr:last-child td { border-bottom: 0; }
.cdir-item { cursor: pointer; }
.cdir-table .cdir-item:hover td { background: #f8faff; }
.cdir-item:focus { outline: 0; }
.cdir-item:focus-visible td { box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, .04); }
.cdir-table .cdir-item.sel td { background: var(--cd-sel); }
.cdir-table .cdir-item.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand, #2563eb); }
.cdir-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.cdir-sort .bi { color: #94a3b8; font-size: .8rem; }
.cdir-sort.active, .cdir-sort.active .bi { color: var(--cd-blue); }
.cdir-c-star, .cdir-c-av, .cdir-c-menu { width: 1%; }
.cdir-c-star { padding-left: .7rem !important; text-align: center; }
.cdir-c-star .bi-star { color: #94a3b8; }
.cdir-star { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 8px; background: none; color: #94a3b8; font-size: 1.05rem; }
.cdir-star:hover { background: #eef2f9; color: #f59e0b; }
.cdir-star.on { color: #f59e0b; }
.cdir-star--big { width: 2.6rem; height: 2.6rem; border: 1px solid var(--cd-line); border-radius: 10px; font-size: 1.25rem; }
.cdir-av { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 9px; background: #e8efff; color: var(--brand, #2563eb); font-size: 1.05rem; }
.cdir-av--txt { font-size: .78rem; font-weight: 700; letter-spacing: .02em; }
.cdir-name { display: flex; flex-direction: column; min-width: 0; }
.cdir-name a { font-weight: 600; color: var(--ink, #0f172a); text-decoration: none; overflow-wrap: anywhere; }
.cdir-name a:hover { color: var(--brand, #2563eb); text-decoration: underline; }
.cdir-name small { color: var(--muted, #64748b); font-size: .8rem; }
.cdir-c-phone a, .cdir-c-email a { color: inherit; text-decoration: none; white-space: nowrap; }
.cdir-c-email a { display: inline-block; max-width: 17rem; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.cdir-c-phone a:hover, .cdir-c-email a:hover { color: var(--brand, #2563eb); }
.cdir-c-phone .bi, .cdir-c-email .bi { color: var(--brand, #2563eb); margin-right: .4rem; }
.cdir-c-ico, .cdir-c-city { white-space: nowrap; }
.cdir-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.cdir-kebab { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid transparent; border-radius: 8px; background: none; color: #475569; }
.cdir-kebab:hover, .cdir-kebab[aria-expanded="true"] { border-color: var(--cd-line); background: #fff; }
.cdir-kebab--big { width: 2.6rem; height: 2.6rem; border-color: var(--cd-line); border-radius: 10px; }
@container (max-width: 1050px) { .cdir-c-city { display: none; } }
@container (max-width: 900px) { .cdir-c-ico { display: none; } }
@container (max-width: 720px) { .cdir-c-email { display: none; } }
@container (max-width: 560px) { .cdir-c-phone, .cdir-c-av { display: none; } }

/* dlaždice */
.cdir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.cdir-card { display: flex; flex-direction: column; gap: .65rem; padding: .9rem; border: 1px solid var(--cd-line); border-radius: 14px; background: #fff; }
.cdir-card:hover { border-color: #bfd3ff; }
.cdir-card.sel { border-color: var(--brand, #2563eb); background: var(--cd-sel); box-shadow: 0 0 0 1px var(--brand, #2563eb); }
.cdir-card-head { display: flex; align-items: flex-start; gap: .65rem; }
.cdir-card-head .cdir-name { flex: 1 1 auto; }
.cdir-card-lines { display: flex; flex-direction: column; gap: .2rem; font-size: .84rem; color: #334155; min-width: 0; }
.cdir-card-lines span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdir-card-lines .bi { color: var(--brand, #2563eb); margin-right: .45rem; }
.cdir-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* stránkování */
.cdir-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding-top: .9rem; }
.cdir-foot-info { color: #334155; font-size: .9rem; }
.cdir-perpage { margin: 0 0 0 auto; }
.cdir-perpage select { min-height: 2.4rem; padding: 0 .7rem; border: 1px solid var(--cd-line); border-radius: 10px; background: #fff; font-size: .88rem; }
.cdir-pages { display: flex; gap: .3rem; }
.cdir-page { display: grid; place-items: center; min-width: 2.4rem; height: 2.4rem; padding: 0 .5rem; border: 1px solid var(--cd-line); border-radius: 10px; color: #334155; text-decoration: none; font-size: .88rem; background: #fff; }
.cdir-page:hover { background: var(--cd-soft); color: var(--ink, #0f172a); }
.cdir-page.active { background: var(--brand, #2563eb); border-color: var(--brand, #2563eb); color: #fff; font-weight: 600; }
.cdir-page.disabled { pointer-events: none; opacity: .45; }
.cdir-page.gap { border-color: transparent; background: none; }
.cdir-empty { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 3rem 1rem; color: var(--muted, #64748b); text-align: center; }
.cdir-empty > .bi { font-size: 2.5rem; color: #cbd5e1; }

/* panel vpravo */
.cdir-panel { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; padding: 1rem; border: 1px solid var(--cd-line); border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: opacity .15s; }
.cdir-panel.is-loading { opacity: .55; }
@media (max-width: 1199.98px) { .cdir-panel { display: none; } }
.cdir-panel-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 3rem 1rem; color: #94a3b8; text-align: center; }
.cdir-panel-empty .bi { font-size: 2.4rem; color: #cbd5e1; }
.cdir-p-head { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: 1rem; }
.cdir-p-ico { flex: none; display: grid; place-items: center; width: 4.2rem; height: 4.2rem; border-radius: 14px; background: #e8efff; color: var(--brand, #2563eb); font-size: 2rem; }
.cdir-p-title { flex: 1 1 auto; min-width: 0; }
.cdir-p-title h2 { margin: 0; font-size: 1.25rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.cdir-p-title h2 a { color: inherit; text-decoration: none; }
.cdir-p-title h2 a:hover { color: var(--brand, #2563eb); }
.cdir-p-ids { display: flex; flex-wrap: wrap; gap: .1rem .9rem; color: var(--muted, #64748b); font-size: .86rem; margin-top: .15rem; }
.cdir-p-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.cdir-p-tools { display: flex; gap: .4rem; flex: none; }
.cdir-tabs { display: flex; gap: .3rem; padding: .3rem; margin-bottom: .9rem; border-radius: 12px; background: var(--cd-soft); overflow-x: auto; }
.cdir-tab { flex: 1 0 auto; padding: .45rem .75rem; border: 0; border-radius: 9px; background: transparent; color: #334155; font-size: .86rem; font-weight: 500; white-space: nowrap; }
.cdir-tab:hover { background: #eef2f9; }
.cdir-tab.active { background: var(--brand, #2563eb); color: #fff; font-weight: 600; }
.cdir-tabpane { display: none; }
.cdir-tabpane.active { display: block; }
.cdir-p-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.cdir-box { padding: .9rem 1rem; border: 1px solid var(--cd-line); border-radius: 12px; margin-bottom: .75rem; }
.cdir-p-two .cdir-box { margin-bottom: 0; }
.cdir-box h3 { margin: 0 0 .6rem; font-size: .95rem; font-weight: 700; }
.cdir-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: .9rem; }
.cdir-lines li { display: flex; gap: .65rem; align-items: flex-start; min-width: 0; }
.cdir-lines li > .bi { color: var(--brand, #2563eb); font-size: 1.05rem; }
.cdir-lines a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.cdir-lines a:hover { color: var(--brand, #2563eb); text-decoration: underline; }
.cdir-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem 1.2rem; margin: 0; font-size: .88rem; align-items: center; }
.cdir-facts dt { font-weight: 400; color: var(--muted, #64748b); }
.cdir-facts dd { margin: 0; overflow-wrap: anywhere; }
.cdir-stats-title { display: flex; align-items: center; gap: .5rem; }
.cdir-stats-title .bi { color: var(--brand, #2563eb); }
.cdir-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; }
.cdir-stat { display: flex; gap: .55rem; align-items: flex-start; min-width: 0; }
.cdir-stat > .bi { color: var(--brand, #2563eb); font-size: 1.4rem; line-height: 1; margin-top: .1rem; }
.cdir-stat strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cdir-stat span { display: block; color: var(--muted, #64748b); font-size: .78rem; line-height: 1.25; }
.cdir-stat.up > .bi, .cdir-stat.up strong { color: #15803d; }
.cdir-stat.down > .bi, .cdir-stat.down strong { color: #b91c1c; }
.cdir-rows { list-style: none; margin: 0 0 .5rem; padding: 0; border: 1px solid var(--cd-line); border-radius: 12px; overflow: hidden; }
.cdir-rows li + li { border-top: 1px solid #eef1f6; }
.cdir-rows a, .cdir-rows li > div { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: .6rem; padding: .6rem .8rem; color: inherit; text-decoration: none; font-size: .87rem; align-items: center; }
.cdir-rows a:hover { background: #f8faff; }
.cdir-rows strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdir-rows span { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdir-rows em { font-style: normal; color: var(--muted, #64748b); font-size: .8rem; white-space: nowrap; }
.cdir-all { font-size: .87rem; text-decoration: none; }
.cdir-notes { white-space: pre-line; font-size: .9rem; }
@media (max-width: 767.98px) {
    .cdir-list { padding: .75rem; }
    .cdir-select { flex: 1 1 140px; }
    .cdir-views { margin-left: 0; }
    .cdir-kpi { padding: .75rem; }
    .cdir-kpi-ico { width: 2.4rem; height: 2.4rem; font-size: 1.15rem; }
}

/* ============================  DETAIL ZÁKAZNÍKA / DODAVATELE  ============================
   partials/contact_detail.php + assets/js/contact-detail.js, návrh pic/Přehled dodavatele v Servisním ERP (1).png.
   Hlavička (ikona, název, IČO/DIČ, štítky, hvězdička, akce) → záložky → Přehled: vlevo Základní informace
   a Obchodní podmínky, vpravo Hlavní kontakt + Sídlo, Obchodní statistiky s grafem a Poslední aktivita.
   Rozložení se řídí šířkou obsahu (container queries). Barevné štítky .cdir-tone-* sdílí s výpisem. */
.cdt { container-type: inline-size; --cdt-line: #e6eaf2; --cdt-soft: #f6f8fc; }
.cdt-header { display: flex; align-items: flex-start; gap: 1.1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.cdt-h-ico { flex: none; display: grid; place-items: center; width: 6rem; height: 6rem; border-radius: 18px; background: #e8efff; color: var(--brand, #2563eb); font-size: 2.8rem; }
.cdt-h-main { flex: 1 1 320px; min-width: 0; }
.cdt-h-main h1 { margin: .15rem 0 .2rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cdt-h-ids { display: flex; flex-wrap: wrap; gap: .2rem 2rem; color: #475569; font-size: 1rem; }
.cdt-h-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.cdt-h-badges .cdir-badge { font-size: .85rem; padding: .3rem .75rem; }
.cdt-h-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-left: auto; }
.cdt-btn { min-height: 2.9rem; padding: 0 1.2rem; display: inline-flex; align-items: center; gap: .45rem; border-radius: 10px; font-weight: 600; background: #fff; }
.cdt-star, .cdt-kebab { display: grid; place-items: center; width: 2.9rem; height: 2.9rem; padding: 0; border: 1px solid var(--cdt-line); border-radius: 10px; background: #fff; color: #475569; font-size: 1.3rem; }
.cdt-star { color: #94a3b8; }
.cdt-star.on, .cdt-star:hover { color: #f59e0b; border-color: #fde68a; background: #fffbeb; }
.cdt-kebab:hover, .cdt-kebab[aria-expanded="true"] { background: var(--cdt-soft); }

/* záložky */
.cdt-tabs { display: flex; gap: .5rem; padding: .4rem; margin-bottom: 1.1rem; border: 1px solid var(--cdt-line); border-radius: 14px; background: #fff; overflow-x: auto; scrollbar-width: thin; }
.cdt-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.1rem; border: 1px solid var(--cdt-line); border-radius: 10px; background: #fff; color: #334155; font-size: .93rem; font-weight: 500; white-space: nowrap; }
.cdt-tab:hover { background: var(--cdt-soft); }
.cdt-tab.active { background: var(--brand, #2563eb); border-color: var(--brand, #2563eb); color: #fff; font-weight: 600; }
.cdt-tab .bi { font-size: 1.05rem; }

/* karty */
.cdt-card { padding: 1.1rem 1.25rem; margin-bottom: 1rem; border: 1px solid var(--cdt-line); border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); min-width: 0; }
.cdt-card-head { display: flex; align-items: center; gap: .7rem; margin: -.1rem 0 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--cdt-line); }
.cdt-card-head > .bi { color: var(--brand, #2563eb); font-size: 1.3rem; }
.cdt-card-head h2 { margin: 0; font-size: 1.08rem; font-weight: 700; }
.cdt-card-tools { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.cdt-period { padding: .3rem .7rem; border: 1px solid var(--cdt-line); border-radius: 8px; font-size: .82rem; color: #334155; }
.cdt-overview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@container (min-width: 1000px) { .cdt-overview { grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); } }
.cdt-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@container (min-width: 640px) { .cdt-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cdt-kv { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: .65rem 1.5rem; margin: 0; font-size: .93rem; }
.cdt-kv dt { font-weight: 400; color: #475569; }
.cdt-kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.cdt-kv--lines { gap: 0 1.5rem; }
.cdt-kv--lines dt, .cdt-kv--lines dd { padding: .55rem 0; border-bottom: 1px solid #eef1f6; }
.cdt-kv--lines dt:nth-last-of-type(1), .cdt-kv--lines dd:last-child { border-bottom: 0; }
.cdt-kv a { text-decoration: none; }
.cdt-person { display: flex; align-items: center; gap: .8rem; margin-bottom: .75rem; }
.cdt-avatar { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: #e0ebff; color: var(--brand, #2563eb); font-weight: 700; }
.cdt-person-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cdt-person-main strong { font-size: 1rem; overflow-wrap: anywhere; }
.cdt-person-main span { color: #475569; font-size: .88rem; }
.cdt-person-btns { display: flex; gap: .4rem; }
.cdt-round { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 1px solid #bfd3ff; border-radius: 10px; color: var(--brand, #2563eb); font-size: 1.1rem; text-decoration: none; }
.cdt-round:hover { background: #eef4ff; }
.cdt-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; font-size: .93rem; }
.cdt-lines li { display: flex; gap: .75rem; align-items: flex-start; min-width: 0; }
.cdt-lines li > .bi { color: #475569; font-size: 1.05rem; }
.cdt-lines a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.cdt-lines a:hover { color: var(--brand, #2563eb); }
.cdt-address { font-size: .95rem; line-height: 1.5; margin-bottom: .6rem; }
.cdt-map { display: inline-flex; align-items: center; gap: .4rem; text-decoration: underline; }

/* statistiky + graf */
.cdt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.cdt-stat { display: flex; gap: .7rem; align-items: center; padding: .75rem .9rem; border: 1px solid var(--cdt-line); border-radius: 12px; min-width: 0; }
.cdt-stat > .bi { color: var(--brand, #2563eb); font-size: 1.7rem; }
.cdt-stat strong { display: block; font-size: 1.15rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cdt-stat span { display: block; color: #475569; font-size: .8rem; }
.cdt-stat.up > .bi, .cdt-stat.up strong { color: #16a34a; }
.cdt-stat.down > .bi, .cdt-stat.down strong { color: #dc2626; }
.cdt-stat--disc > .bi { color: #f59e0b; }
.cdt-chart-title { font-size: .82rem; color: #475569; margin-bottom: .3rem; }
.cdt-svg { width: 100%; height: 230px; display: block; overflow: visible; }
.cdt-grid { stroke: #e9edf3; stroke-width: 1; }
.cdt-axis { fill: #64748b; font-size: 12px; font-family: inherit; }
.cdt-area { fill: rgba(37, 99, 235, .12); }
.cdt-line { fill: none; stroke: var(--brand, #2563eb); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cdt-dot { fill: #fff; stroke: var(--brand, #2563eb); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

/* poslední aktivita */
.cdt-activity { list-style: none; margin: 0; padding: 0; }
.cdt-activity li + li { border-top: 1px solid #eef1f6; }
.cdt-activity a { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto auto 1rem; gap: .8rem; align-items: center; padding: .65rem .25rem; color: inherit; text-decoration: none; font-size: .93rem; }
.cdt-activity a:hover { background: #f8faff; }
.cdt-activity a > .bi:first-child { color: #475569; font-size: 1.15rem; }
.cdt-act-name strong { color: var(--brand, #2563eb); font-weight: 600; }
.cdt-act-date { color: #475569; white-space: nowrap; }
.cdt-act-amount .cdir-badge { font-size: .85rem; }
.cdt-act-chev { color: #94a3b8; }
@container (max-width: 560px) { .cdt-activity a { grid-template-columns: 1.6rem minmax(0, 1fr) 1rem; } .cdt-act-date, .cdt-act-amount { grid-column: 2; } }

/* kontaktní osoby, poznámky, dokumenty, historie */
.cdt-persons { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.cdt-pcard { padding: .9rem 1rem; border: 1px solid var(--cdt-line); border-radius: 12px; }
.cdt-pcard.primary { border-color: #bfd3ff; background: #f8fbff; }
.cdt-pcard-tools { display: flex; gap: .4rem; justify-content: flex-end; margin-top: .7rem; }
.cdt-pcard-tools form { margin: 0; }
.cdt-form { margin-top: 1rem; padding: 1rem; border: 1px dashed #cfd8e6; border-radius: 12px; background: var(--cdt-soft); }
.cdt-form--plain { margin-top: 0; border: 0; background: none; padding: 0; }
.cdt-form-title { font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; }
.cdt-form-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.cdt-empty { display: flex; align-items: center; gap: .75rem; padding: 1rem; border-radius: 12px; background: var(--cdt-soft); color: #64748b; font-size: .9rem; }
.cdt-empty > .bi { font-size: 1.6rem; color: #94a3b8; }
.cdt-note-form { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; }
.cdt-note-form textarea { flex: 1 1 auto; }
.cdt-note { padding: .8rem 1rem; border: 1px solid var(--cdt-line); border-radius: 12px; margin-bottom: .6rem; }
.cdt-note--pinned { background: #fffbeb; border-color: #fde68a; }
.cdt-note-meta { display: flex; align-items: center; gap: .4rem; color: #64748b; font-size: .82rem; margin-bottom: .35rem; }
.cdt-note-meta form { margin: 0; }
.cdt-note-body { overflow-wrap: anywhere; }
.cdt-docs { list-style: none; margin: 0 0 1rem; padding: 0; border: 1px solid var(--cdt-line); border-radius: 12px; overflow: hidden; }
.cdt-docs li { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; flex-wrap: wrap; }
.cdt-docs li + li { border-top: 1px solid #eef1f6; }
.cdt-docs li > .bi { color: var(--brand, #2563eb); font-size: 1.3rem; }
.cdt-docs form { margin: 0; }
.cdt-doc-name { flex: 1 1 200px; min-width: 0; font-weight: 500; overflow-wrap: anywhere; text-decoration: none; }
.cdt-doc-meta { color: #64748b; font-size: .82rem; white-space: nowrap; }
.cdt-upload { display: flex; gap: .6rem; flex-wrap: wrap; }
.cdt-upload input { flex: 1 1 260px; }
.cdt-timeline { list-style: none; margin: 0; padding: 0 0 0 .4rem; }
.cdt-timeline li { position: relative; display: flex; gap: .9rem; padding: 0 0 1rem; }
.cdt-timeline li::before { content: ""; position: absolute; left: .32rem; top: 1rem; bottom: 0; width: 2px; background: #e6eaf2; }
.cdt-timeline li:last-child::before { display: none; }
.cdt-tl-dot { flex: none; width: .75rem; height: .75rem; margin-top: .35rem; border-radius: 50%; background: var(--brand, #2563eb); box-shadow: 0 0 0 3px #e0ebff; }
.cdt-tl-meta { color: #64748b; font-size: .82rem; }
.cdt-table { margin: 0; font-size: .92rem; }
.cdt-table thead th { background: var(--cdt-soft); font-weight: 600; font-size: .84rem; color: #334155; }
@container (max-width: 640px) {
    .cdt-hide-sm { display: none; }
    .cdt-h-ico { width: 4rem; height: 4rem; font-size: 1.9rem; }
    .cdt-h-main h1 { font-size: 1.35rem; }
    .cdt-h-actions { margin-left: 0; width: 100%; }
    .cdt-note-form { flex-direction: column; align-items: stretch; }
}

/* příjemka: sken pořizovacího dokladu (formulář – výběr souborů, detail – náhledy) */
.rc-drop { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border: 2px dashed #cfd8e6; border-radius: 12px; background: #f8fafd; cursor: pointer; margin-bottom: .6rem; }
.rc-drop:hover, .rc-drop:focus-within { border-color: var(--brand, #2563eb); background: #f2f7ff; }
.rc-drop > .bi { font-size: 2rem; color: var(--brand, #2563eb); }
.rc-drop input[type="file"] { margin-left: auto; max-width: 260px; font-size: .85rem; }
.rc-files { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.rc-files:empty { display: none; }
.rc-files .bi { color: var(--brand, #2563eb); }
.rc-scans { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-bottom: .9rem; }
.rc-scan { display: flex; flex-direction: column; gap: .3rem; padding: .6rem; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; min-width: 0; }
.rc-scan-thumb { display: grid; place-items: center; height: 130px; border-radius: 8px; background: #f3f5f8; overflow: hidden; color: #dc2626; font-size: 2.6rem; text-decoration: none; }
.rc-scan-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rc-scan-name { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-scan-meta { color: var(--muted, #64748b); font-size: .78rem; }
.rc-scan-tools { display: flex; gap: .3rem; }
.rc-scan-tools form { margin: 0; }
.rc-scan-upload { display: flex; gap: .6rem; flex-wrap: wrap; }
.rc-scan-upload input { flex: 1 1 260px; }
@media (max-width: 575.98px) { .rc-drop { flex-wrap: wrap; } .rc-drop input[type="file"] { margin-left: 0; max-width: 100%; } }

/* formuláře Nový / Úprava zákazníka a dodavatele ve vzhledu detailu (customers|suppliers/_fields.php) – i v okně výběru kontaktu */
.cdt-fgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@container (min-width: 760px) { .cdt-fgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cdt-fgrid > .cdt-span { grid-column: 1 / -1; }
.cdt-fgrid .cdt-card { margin-bottom: 1rem; }
.cdt-fgrid .form-label { font-size: .86rem; font-weight: 500; color: #334155; margin-bottom: .3rem; }
.cdt-fgrid .cdt-card-tools.form-check { padding-left: 2.5em; }
.cdt-wrap { container-type: inline-size; }
.ctp-form .cdt-fgrid .cdt-card { box-shadow: none; }
/* faktura / objednávka: obchodní podmínky odběratele či dodavatele (ContactDetailService::termsForDocs) */
.ie-terms { margin-top: .8rem; padding: .65rem .8rem; border: 1px solid #dbe7ff; border-radius: .5rem; background: #f5f9ff; font-size: .88rem; }
.ie-terms-head { font-weight: 600; color: #1d4ed8; margin-bottom: .3rem; }
.ie-terms-lines { display: flex; flex-wrap: wrap; gap: .15rem 1.1rem; }
/* rozklikávací karta (<details class="ie-card ie-collapse">) – např. sken pořizovacího dokladu */
.ie-collapse > summary { list-style: none; cursor: pointer; user-select: none; }
.ie-collapse > summary::-webkit-details-marker { display: none; }
.ie-collapse:not([open]) > summary { margin-bottom: 0; }
.ie-collapse > summary:hover h2 { color: var(--brand, #2563eb); }
.ie-collapse-chev { margin-left: auto; color: #64748b; transition: transform .15s; }
.ie-collapse[open] .ie-collapse-chev { transform: rotate(180deg); }

/* Okno „Vybrat zakázku k fakturaci“ v Nové faktuře (delivery_notes/show.php, invoice-editor.js) */
#ieOrderPicker { --mpp-soft: #f6f8fc; --mpp-line: #e6eaf2; }
.iop-item { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; text-align: left; }
.iop-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.iop-cust { font-weight: 500; }
.iop-meta { color: #64748b; font-size: .8rem; }
.iop-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.iop-amount { font-weight: 700; white-space: nowrap; }
@media (max-width: 575.98px) { .iop-item { flex-direction: column; align-items: stretch; } .iop-side { align-items: flex-start; } }

/* Řádky položek (faktura, příjemka, přijatá faktura): pole v jedné linii nahoře – popisek pod názvem
   („skladová položka · 02“) buňku jen prodlouží dolů a ostatní pole neposune. Textové buňky na výšku pole (2rem). */
.ie-items tr.ie-row > td { vertical-align: top; }
.ie-items tr.ie-row > td.ie-handle, .ie-items tr.ie-row > td.ie-total { line-height: 2rem; }
.ie-items tr.ie-row .ie-name { min-height: 2rem; display: flex; align-items: center; }

/* ===== Detail spotřebiče (appliances/show.php, návrh pic/Detail spotřebiče v servisním ERP.png) – staví na .cdt-* ===== */
.apd-photo { position: relative; flex: none; display: grid; place-items: center; width: 9.5rem; height: 8.5rem; border: 1px solid var(--cdt-line); border-radius: 16px; background: #fff; color: var(--brand, #2563eb); font-size: 3.4rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.apd-photo img { display: block; max-width: calc(9.5rem - 1rem); max-height: calc(8.5rem - 1rem); object-fit: contain; border-radius: 10px; }
.apd-photo-form { position: absolute; right: .4rem; bottom: .4rem; margin: 0; }
.apd-photo-btn { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; margin: 0; border: 1px solid var(--cdt-line); border-radius: 50%; background: #fff; color: #475569; font-size: 1rem; cursor: pointer; opacity: .85; }
.apd-photo-btn:hover { opacity: 1; color: var(--brand, #2563eb); border-color: #bfd3ff; }
.apd .cdt-h-main h1 { font-size: 2rem; margin-top: .3rem; }
.apd-h-sub { color: #475569; font-size: 1.15rem; }
.apd-h-sub strong { color: #1e293b; font-weight: 600; }
.apd-dot { margin: 0 .35rem; color: #94a3b8; }
.apd .cdt-h-badges .cdir-badge { font-size: .95rem; font-weight: 600; padding: .35rem .85rem; }
.apd .cdt-h-badges .cdir-tone-green .bi { color: #16a34a; }
.apd-btn-primary { background: var(--brand, #2563eb); color: #fff; border-color: var(--brand, #2563eb); }
.apd-btn-primary:hover { color: #fff; filter: brightness(.95); }
.apd .cdt-card-head { margin: -1.1rem -1.25rem 1rem; padding: .9rem 1.25rem; background: var(--cdt-soft); border-radius: 14px 14px 0 0; }
.apd-head-text { min-width: 0; }
.apd-head-sub { color: #64748b; font-size: .85rem; margin-top: .1rem; }
.apd .cdt-two > div > .cdt-card:last-child { margin-bottom: 1rem; }
.apd-kv-ico dt { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: #1e293b; }
.apd-kv-ico dt .bi { color: var(--brand, #2563eb); font-size: 1.05rem; }
.apd .cdt-kv--lines dt { font-weight: 600; color: #1e293b; }
.apd .cdt-kv--lines dd { font-weight: 400; }
.apd-state { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.1rem; margin-bottom: 1rem; border: 1px solid #cfe0ff; border-radius: 14px; background: #eef4ff; font-size: .9rem; }
.apd-state > .bi { color: var(--brand, #2563eb); font-size: 1.3rem; line-height: 1.2; }
.apd-state strong { display: block; margin-bottom: .15rem; }
.apd-state span { color: #334155; }
.apd-state--muted { border-color: var(--cdt-line); background: var(--cdt-soft); }
.apd-state--muted > .bi { color: #64748b; }
.apd-table td { font-size: .92rem; }
.apd-cal { color: var(--brand, #2563eb); margin-right: .25rem; }
.apd-status { font-weight: 500; padding: .35rem .6rem; }
.apd-more { text-align: right; margin-top: .4rem; }
@container (max-width: 560px) {
    .apd-photo { width: 6rem; height: 5.5rem; font-size: 2.2rem; }
    .apd-photo img { max-width: 5rem; max-height: 4.5rem; }
    .apd .cdt-h-main h1 { font-size: 1.4rem; }
}

/* dlaždice v kartě Historie pravého panelu (context_panel: history_tiles) */
.ctx-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .6rem; padding: .75rem 1rem 1rem; }
.ctx-tile { display: flex; gap: .6rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.ctx-tile > .bi { color: var(--brand, #2563eb); font-size: 1.35rem; }
.ctx-tile strong { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctx-tile span { display: block; color: var(--muted); font-size: .78rem; line-height: 1.2; }

/* Nová výdejka (issues/form.php, issue-editor.js) – staví na .ie-* jako Nová příjemka */
.vy-reasons { display: flex; flex-wrap: wrap; gap: .35rem; }
.vy-reasons .btn { border-radius: 999px; font-size: .8rem; padding: .2rem .7rem; }
.ie-items .ie-avail { white-space: nowrap; font-variant-numeric: tabular-nums; color: #334155; }
.ie-row.vy-short .ie-avail, .ie-row.vy-short .ie-stock { color: #dc2626; font-weight: 600; }
.ie-row.vy-short .ie-qty { border-color: #f87171; background: #fef2f2; }

/* Nová převodka (transfers/form.php, návrh pic/Nová převodka ve Servisní ERP.png) – staví na .ie-*; položky obsluhuje issue-editor.js */
.pv-top { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
.pv-top > .ie-card { margin-bottom: 0; }
@media (max-width: 991.98px) { .pv-top { grid-template-columns: minmax(0, 1fr); } }
.pv-form { display: grid; grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr); gap: .7rem 1rem; align-items: center; }
.pv-form > label { margin: 0; color: #334155; }
.pv-field--wh { display: flex; gap: .6rem; align-items: center; }
.pv-field--wh .pv-ico-input { flex: 1 1 auto; min-width: 0; }
.pv-ico-input { position: relative; }
.pv-ico-input > .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--brand, #2563eb); pointer-events: none; z-index: 1; }
.pv-ico-input > .form-control, .pv-ico-input > .form-select { padding-left: 2.3rem; }
.pv-wh-badge { flex: none; padding: .3rem .65rem; border-radius: 8px; background: #eef4ff; color: #1e40af; font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv-same { grid-column: 2; margin-top: -.4rem; }
.pv-same[hidden] { display: none; }
.pv-note-label { grid-column: 1; align-self: start; padding-top: .45rem; }
.pv-note { grid-column: 2; }
.pv-note textarea { width: 100%; min-height: 6.5rem; resize: vertical; }
.pv-arrow { color: var(--brand, #2563eb); font-size: 1.15rem; line-height: 1; padding-left: 9rem; margin: -.3rem 0; }
@media (max-width: 575.98px) {
    .pv-form { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
    .pv-form > span:empty { display: none; }
    .pv-same, .pv-note-label, .pv-note { grid-column: 1; }
    .pv-arrow { padding-left: 50%; }
    .pv-field--wh { flex-wrap: wrap; }
}
.pv-modes { display: grid; gap: .7rem; }
.pv-mode { display: flex; gap: .8rem; align-items: flex-start; margin: 0; padding: .85rem 1rem; border: 1px solid #e2e8f0; border-radius: 12px; cursor: pointer; }
.pv-mode:hover { background: #f8faff; }
.pv-mode:has(input:checked) { border-color: var(--brand, #2563eb); background: #eef4ff; box-shadow: 0 0 0 1px var(--brand, #2563eb) inset; }
.pv-mode input { margin-top: .2rem; flex: none; width: 1.15rem; height: 1.15rem; }
.pv-mode strong { display: block; margin-bottom: .2rem; font-size: 1rem; }
.pv-mode strong .bi { color: var(--brand, #2563eb); }
.pv-mode > span > span { display: block; color: #475569; font-size: .86rem; }
.pv-search-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; }
.pv-search-row .ie-search { min-width: 240px; }
.pv-btn { white-space: nowrap; font-weight: 600; }
.pv-items th { color: #1e293b; }
.pv-items td { padding-top: .45rem; padding-bottom: .45rem; }
.pv-items tr.ie-row > td { vertical-align: middle; }
.pv-chk { width: 2rem; }
.pv-img { width: 3.2rem; text-align: center; }
.pv-img img { width: 2.6rem; height: 2.1rem; object-fit: contain; border-radius: 6px; }
.pv-img > .bi { color: #94a3b8; font-size: 1.2rem; }
.pv-code { white-space: nowrap; font-weight: 500; }
.pv-items .ie-avail, .pv-items .ie-after { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ie-dot { display: inline-block; width: .5rem; height: .5rem; margin-right: .45rem; border-radius: 50%; vertical-align: middle; background: #94a3b8; }
.ie-dot.ok { background: #22c55e; }
.ie-dot.zero { background: #f59e0b; }
.ie-dot.no { background: #ef4444; }
.ie-row.vy-short .ie-after { color: #dc2626; font-weight: 600; }
.pv-step { display: inline-flex; align-items: stretch; border: 1px solid #d6dde8; border-radius: 8px; overflow: hidden; background: #fff; }
.pv-step .ie-qty { width: 3.4rem; border: 0; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; border-radius: 0; min-height: 2rem; }
.pv-step-btn { border: 0; background: #fff; color: #334155; width: 2rem; padding: 0; }
.pv-step-btn:hover { background: #eef4ff; color: var(--brand, #2563eb); }
.ie-row.vy-short .pv-step { border-color: #f87171; }
.pv-items .ie-unit { width: 3rem; }
.pv-acts { white-space: nowrap; text-align: right; }
.pv-act { display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-left: .25rem; border: 1px solid #dbe4f3; border-radius: 8px; background: #fff; color: var(--brand, #2563eb); text-decoration: none; }
.pv-act:hover { background: #eef4ff; }
.pv-act--del { color: #dc2626; border-color: #fbd5d5; }
.pv-act--del:hover { background: #fef2f2; }
.pv-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-top: .8rem; }
.pv-foot-sp { flex: 1 1 auto; }
.pv-delsel:disabled { opacity: .55; }
.pv-total { padding: .45rem 1rem; border-radius: 10px; background: #eef4ff; color: #1e3a8a; font-weight: 600; }
.pv-total strong { margin-left: .6rem; font-size: 1.25rem; color: var(--brand, #2563eb); font-variant-numeric: tabular-nums; }
.pv-impact { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.5rem; padding: .8rem 1rem; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.pv-impact-head { display: flex; align-items: center; gap: .6rem; padding: .35rem 1rem .35rem 0; margin-right: .5rem; font-weight: 600; border-right: 1px solid #e2e8f0; }
.pv-impact-head .bi { color: var(--brand, #2563eb); font-size: 1.3rem; }
.pv-impact-wh { display: flex; align-items: center; gap: .55rem; }
.pv-impact-wh > .bi { color: var(--brand, #2563eb); font-size: 1.2rem; }
.pv-impact-wh strong { margin-left: .8rem; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-impact-arrow { color: #64748b; font-size: 1.2rem; }
@media (max-width: 575.98px) { .pv-impact-head { border-right: 0; width: 100%; } }

/* Montážní list – záložka Faktura (service_reports/edit.php): přehled a odeslání vlevo, náhled faktury vpravo */
.ml-inv { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .ml-inv { grid-template-columns: minmax(0, 1fr); } }
.ml-inv-preview { border: 1px solid #e2e8f0; border-radius: 12px; background: #f1f5f9; padding: .75rem; overflow: auto; }
.ml-inv-preview iframe { display: block; width: 100%; min-width: 600px; height: 1100px; border: 0; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }

/* Nastavení → E-mail (SMTP) (settings/mail.php, návrh pic/Nastavení SMTP v servisním ERP.png) */
.ms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1199.98px) { .ms { grid-template-columns: minmax(0, 1fr); } }
.ms-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; margin: 0; }
.ms-card { padding: 1.1rem 1.25rem 1.25rem; border: 1px solid #e6eaf2; border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); min-width: 0; }
.ms-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.ms-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.ms-ico { flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 10px; background: #eef4ff; color: var(--brand, #2563eb); font-size: 1.25rem; }
.ms-sub { color: #475569; font-size: .85rem; margin-top: .15rem; }
.ms-chip { margin-left: auto; padding: .3rem .7rem; border-radius: 8px; background: #f1f5f9; color: #475569; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.ms-chip--ok { background: #dcfce7; color: #15803d; }
.ms-chip--no { background: #fee2e2; color: #b91c1c; }
.ms-more { margin-left: auto; font-size: .88rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.ms-card .form-label { font-size: .9rem; color: #1e293b; margin-bottom: .3rem; }
.ms-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: .9rem; margin-bottom: 1rem; }
.ms-grid2--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-bottom: .35rem; }
@media (max-width: 575.98px) { .ms-grid2--even { grid-template-columns: minmax(0, 1fr); } }
.ms-ico-input { position: relative; }
.ms-ico-input > .bi { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #475569; pointer-events: none; z-index: 1; }
.ms-ico-input > .form-control, .ms-ico-input > .form-select { padding-left: 2.4rem; }
.ms-pass { position: relative; }
.ms-pass .form-control { padding-right: 2.8rem; }
.ms-eye { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: #334155; padding: .25rem .45rem; font-size: 1.1rem; }
.ms-test-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.ms-test-row .form-control { flex: 1 1 200px; }
.ms-test-row .btn { white-space: nowrap; font-weight: 600; }
.ms-result { display: flex; gap: .8rem; align-items: flex-start; margin-top: 1.1rem; padding: .9rem 1rem; border-radius: 10px; font-size: .9rem; }
.ms-result > .bi { font-size: 1.6rem; line-height: 1; }
.ms-result strong { display: block; margin-bottom: .15rem; }
.ms-result span { display: block; overflow-wrap: anywhere; }
.ms-result a { display: inline-block; margin-top: .35rem; }
.ms-result--ok { background: #ecfdf3; color: #166534; }
.ms-result--ok > .bi { color: #16a34a; }
.ms-result--err { background: #fef2f2; color: #991b1b; }
.ms-result--err > .bi { color: #dc2626; }
.ms-result--muted { background: #f6f8fc; color: #475569; }
.ms-log { list-style: none; margin: 0; padding: 0; }
.ms-log li { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) auto 1.1rem; gap: .75rem; align-items: center; padding: .7rem .1rem; border-top: 1px solid #eef1f6; }
.ms-log li:first-child { border-top: 0; }
.ms-log-ico { font-size: 1.15rem; }
.ms-tone-ok { color: #16a34a; } .ms-tone-err { color: #dc2626; } .ms-tone-muted { color: #94a3b8; }
.ms-log-main { min-width: 0; }
.ms-log-main strong, .ms-log-main span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-log-main strong { font-size: .95rem; }
.ms-log-main span { color: #475569; font-size: .8rem; }
.ms-log-main .ms-log-user { color: #94a3b8; font-size: .75rem; }
.ms-log-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.ms-log-date { font-size: .82rem; color: #1e293b; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ms-badge { padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.ms-badge--ok { background: #dcfce7; color: #15803d; } .ms-badge--err { background: #fee2e2; color: #b91c1c; } .ms-badge--muted { background: #f1f5f9; color: #64748b; }
.ms-log-info { color: var(--brand, #2563eb); cursor: help; }
@media (max-width: 575.98px) { .ms-log li { grid-template-columns: 1.4rem minmax(0, 1fr) auto; } .ms-log-info { display: none; } }
.ctx-help { list-style: disc; }
.ctx-help a { text-decoration: none; }
.ctx-help a .bi { font-size: .75em; }

/* stejná červená bublina mimo menu (zvonek v horní liště a jeho položky) – styl .nav-badge */
.app-badge--corner { position: absolute; top: -.35rem; right: -.45rem; box-shadow: 0 0 0 2px #fff; }

/* Hromadný výběr v seznamech (assets/js/list-bulk.js, tabulky [data-bulk]) – plovoucí lišta jako u faktur */
.bulk-bar { position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 1rem); z-index: 1040;
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .8rem; padding: .55rem .6rem .55rem 1.1rem;
    background: #1f2937; color: #fff; border-radius: 999px; box-shadow: 0 10px 30px rgba(15,23,42,.35);
    opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 2rem); }
.bulk-bar.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.bulk-bar .bulk-count { font-weight: 600; white-space: nowrap; }
.bulk-bar .btn { border-radius: 999px; white-space: nowrap; }
.bulk-bar .btn-link { color: #cbd5e1; text-decoration: none; }
.bulk-bar .btn-link:hover { color: #fff; }
.bulk-bar .lb-extra { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.lb-col { width: 1%; white-space: nowrap; }
tr.lb-selected > td { background: #eef4ff !important; }
@media print { .bulk-bar { display: none !important; } }

/* Upravit uživatele – položky Nastavení zpřístupněné jen uživateli (settings/users/edit.php) */
.ue-perm-head { font-weight: 700; font-size: .95rem; padding-top: .75rem; border-top: 1px solid #eef1f6; }
.ue-perm-head .bi { color: var(--brand, #2563eb); }
.ue-perm-tag { display: inline-block; margin-left: .35rem; padding: .05rem .45rem; border-radius: 999px; font-size: .7rem; font-weight: 600; vertical-align: middle; }
.ue-perm-tag--role { background: #f1f5f9; color: #64748b; }
.ue-perm-tag--extra { background: #dcfce7; color: #15803d; }

/* Upravit uživatele – blok Nastavení systému ve dvou sloupcích (vlevo podle role, vpravo položky Nastavení) */
.ue-sys-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 2rem; }
@media (max-width: 767.98px) { .ue-sys-cols { grid-template-columns: minmax(0, 1fr); } .ue-sys-cols .ue-perm-head { margin-top: 1rem; } }
.ue-sys-cols .ue-perm-head { padding-top: .55rem; border-top: 0; }
