/* =============================================================================
   eSync platforma – design layer (docs/design/DESIGN.md, "Graphite & Lime, sharp corners + soft shadow").
   Loaded LAST (after style.css / app.css / erp.css). Colors, fonts and shadows come from tokens.css only.
   1. extension tokens + legacy variables mapped onto the tokens (every older rule picks the new look up)
   2. base   3. shell (sidebar, top bar, brand line, status bar)   4. components   5. page patterns
   ============================================================================= */

/* ---------- 1. tokens ---------- */
:root {
    /* extensions of tokens.css (same naming): error status pair, destructive button, primary hover */
    --err-bg: #FDE4E1; --err-fg: #8F1D12; --err-dot: #D93A26;
    --danger: #B42318; --on-danger: #FFFFFF;
    --btn-hover: #2C302C;
    --row-hover: rgba(127, 140, 137, .07);
    --accent-soft: color-mix(in srgb, var(--accent) 26%, var(--surface));
    --on-hero: #FFFFFF;
    --overlay: rgba(10, 15, 14, .48);
}
[data-theme="dark"] {
    --err-bg: rgba(217, 58, 38, .2); --err-fg: #FFB4A8; --err-dot: #F0624D;
    --danger: #B42318;
    --btn-hover: color-mix(in srgb, var(--accent) 82%, #FFFFFF);
    --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
    --overlay: rgba(0, 0, 0, .62);
}

/* the old variable set of style.css / erp.css, now driven by the tokens (declared for both themes so the
   [data-theme="dark"] blocks of the older files cannot win) */
:root, [data-theme="dark"] {
    --color-primary: var(--btn);
    --color-primary-hover: var(--btn-hover);
    --color-primary-light: var(--input);
    --color-secondary: var(--brand-1);
    --color-secondary-hover: var(--brand-1);
    --color-success: var(--ok-fg);
    --color-warning: var(--warn-dot);
    --color-danger: var(--err-fg);
    --color-info: var(--info-fg);
    --color-bg: var(--bg);
    --color-bg-surface: var(--surface);
    --color-bg-surface-secondary: var(--surface-2);
    --color-bg-surface-hover: var(--input);
    --color-text: var(--text);
    --color-text-secondary: var(--muted);
    --color-text-disabled: var(--muted);
    --color-text-inverse: var(--on-btn);
    --color-border: var(--border);
    --color-border-strong: var(--dash);
    --color-border-focus: var(--link);
    --color-accent: var(--link);
    --color-accent-hover: var(--text);
    --color-accent-light: var(--accent-soft);
    --color-accent-2: var(--hi);
    --font-family: var(--font-body);
    --font-size-xs: 0.75rem;     /* 12px */
    --font-size-sm: 0.8125rem;   /* 13px */
    --font-size-base: 0.875rem;  /* 14px */
    --font-size-md: 0.9375rem;   /* 15px */
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.75rem;
    --radius-sm: 0; --radius-md: 0; --radius-lg: 0; --radius-xl: 0; --radius-full: 0;
    --shadow-sm: var(--shadow); --shadow-md: var(--shadow); --shadow-lg: var(--shadow); --shadow-xl: var(--shadow);
    --brand-gradient: linear-gradient(90deg, var(--brand-1), var(--brand-2));
    --sidebar-width: 236px;
    --sidebar-collapsed-width: 68px;
    --header-height: 70px;
    --row-h: 44px;
    --page-pad: 32px;
}
@media (max-width: 768px) { :root, [data-theme="dark"] { --header-height: 58px; --page-pad: 16px; --row-h: 44px; } }

/* ---------- 2. base ---------- */
html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
body.app-page, body.auth-page { font-family: var(--font-body); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--link); }
a:hover { color: var(--link); opacity: .85; }
h1, h2, h3 { color: var(--text); }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
.text-secondary, .muted { color: var(--muted) !important; }
.text-success { color: var(--ok-fg) !important; }
.text-danger { color: var(--err-fg) !important; }
.text-warning { color: var(--warn-fg) !important; }
.loading-spinner { border-color: var(--border); border-top-color: var(--text); }
.data-table, .kpi-value, .doc-total, .mini-table { font-feature-settings: normal; }

/* sharp corners everywhere (DESIGN.md "Corners: border-radius: 0 everywhere"), also over the page-level <style>
   blocks and inline styles of older pages; spinners and typing dots stay round */
:is(body.app-page, body.auth-page) *:not(.loading-spinner):not(.ai-typing i):not(input[type="radio"]),
:is(body.app-page, body.auth-page) *:not(.loading-spinner)::before,
:is(body.app-page, body.auth-page) *:not(.loading-spinner)::after { border-radius: 0 !important; }

/* auth pages (login, registrace, heslo): card with the brand line, display title */
body.auth-page .auth-card { position: relative; border: 0; box-shadow: var(--shadow); background: var(--surface); }
body.auth-page .auth-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand-gradient); }
body.auth-page .auth-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; }
body.auth-page .auth-tab.active { background: var(--btn); color: var(--on-btn); }
/* phones: auth.css strips the card (full-bleed), the design keeps a real card with its own padding */
@media (max-width: 480px) {
    body.auth-page { background: var(--bg); padding: 16px 0; }
    body.auth-page .auth-container, body.auth-page .auth-container.wide { padding: 0 16px; }
    body.auth-page .auth-card { padding: 26px 18px 22px; }
    body.auth-page .auth-tab { font-size: 13px; padding: 8px 6px; }
}

/* ---------- 3. shell ---------- */
body.app-page .app-container { display: flex; flex-direction: row; height: 100vh; min-height: 0; background: var(--bg); }
body.app-page .app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; height: 100vh; position: relative; }
body.app-page .content { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--page-pad); background: var(--bg); }

/* sidebar */
body.app-page .sidebar { position: relative; top: 0; flex: 0 0 var(--sidebar-width); width: var(--sidebar-width); min-width: var(--sidebar-width); height: 100vh;
    background: var(--side); color: var(--side-text); border-right: 1px solid var(--side-edge); display: flex; flex-direction: column; overflow: hidden; z-index: 20; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 20px 22px 6px; color: var(--side-text); text-decoration: none; flex: 0 0 auto; }
.side-logo:hover { opacity: 1; color: var(--side-text); }
.side-logo svg { flex: none; }
.side-logo-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.side-logo-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--on-hero); letter-spacing: -0.02em; }
.side-logo-sub { font-size: 11px; color: var(--side-muted); letter-spacing: 0.04em; }
.sidebar .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 12px 16px; display: flex; flex-direction: column; gap: 18px;
    scrollbar-color: transparent transparent; }
.sidebar .sidebar-nav:hover { scrollbar-color: var(--side-2) transparent; }
.sidebar .sidebar-nav:hover::-webkit-scrollbar-thumb { background: var(--side-2); }
.sidebar .nav-section { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-section-title { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0; padding: 0 10px 6px; border: 0; background: none; font-family: var(--font-mono);
    font-size: 11px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-label); text-align: left; }
button.nav-section-title { cursor: pointer; font-family: var(--font-mono); }
button.nav-section-title:hover { color: var(--side-text); }
.nav-chevron { margin-left: auto; width: 14px; height: 14px; flex: none; transition: transform .15s; }
.nav-group:not(.open) .nav-chevron { transform: rotate(-90deg); }
.nav-group:not(.open) > .nav-group-items { display: none; }
.nav-group-items { display: flex; flex-direction: column; gap: 1px; }

.sidebar .nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; min-height: 0; border: 0; border-radius: 0; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.2;
    color: var(--side-text); background: transparent !important; box-shadow: none !important; text-decoration: none; cursor: pointer; text-align: left; transition: background .15s; }
.sidebar .nav-item:hover { background: rgba(255, 255, 255, .08) !important; color: var(--on-hero); opacity: 1; }
.sidebar .nav-item.active, .sidebar .nav-item.active:hover { background: var(--accent) !important; color: var(--on-accent); font-weight: 600; }
.sidebar .nav-item svg { width: 18px; height: 18px; color: currentColor; opacity: 1; flex: none; }
.sidebar .nav-item.active svg { color: currentColor; }
.sidebar .nav-item .nav-item-text { position: static; top: auto; padding: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .nav-item .nav-item-text::after { content: none; }
.sidebar .nav-sub .nav-item { padding: 7px 10px; }
.sidebar .nav-sub .nav-item > svg { display: none; }
.nav-count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--side-muted); flex: none; }
.nav-item.active .nav-count { color: var(--on-accent); }
.nav-ai { margin-left: auto; font-size: 10px; font-weight: 600; padding: 2px 6px; background: var(--hi); color: var(--on-hi); flex: none; }
.sidebar .nav-item-badges { display: flex; gap: 4px; margin-left: auto; }
.sidebar .nav-item-badge { min-width: 20px; padding: 1px 5px; border-radius: 0; font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-align: center; background: var(--side-2); color: var(--side-text); }
.sidebar .nav-item-badge.badge-warning { background: var(--warn-dot); color: var(--on-accent); }
.sidebar .nav-item-badge.badge-error { background: var(--err-dot); color: var(--on-danger); }
.sidebar .nav-item-cta { color: var(--accent) !important; }
.sidebar .nav-item-cta.active { color: var(--on-accent) !important; }
.sidebar .nav-note { padding: 2px 10px 6px 38px; font-size: 12px; color: var(--side-muted); line-height: 1.4; }
.sidebar .hdr-integration-dot { width: 8px; height: 8px; border-radius: 0; margin: 0 5px; }

/* Automatizace: expandable parent + indented sub-items with a guide line */
.nav-tree { display: flex; flex-direction: column; gap: 1px; }
.sidebar .nav-tree > .nav-parent { background: var(--side-2) !important; }
.sidebar .nav-tree > .nav-parent:hover { background: var(--side-2) !important; color: var(--on-hero); }
.sidebar .nav-tree > .nav-parent.active { background: var(--accent) !important; }
.nav-tree:not(.open) > .nav-parent .nav-chevron { transform: rotate(-90deg); }
.nav-tree-items { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 19px; padding-left: 8px; border-left: 1px solid var(--side-2); }
.nav-tree:not(.open) > .nav-tree-items { display: none; }
.sidebar .nav-tree-items .nav-item { padding: 7px 10px; font-size: 13.5px; }
.sidebar .nav-tree-items .nav-item > svg { display: none; }

/* BI folders keep their <details> */
.sidebar .nav-folder > summary .nav-item-text::after { content: none; }
.sidebar .nav-folder > summary::after { content: ''; width: 6px; height: 6px; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); opacity: .7; }
.sidebar .nav-folder[open] > summary::after { transform: rotate(45deg); }

/* desktop collapse to icons (remembered in localStorage, app.js) */
.sidebar-foot { flex: 0 0 auto; padding: 10px 12px 14px; border-top: 1px solid var(--side-edge); display: flex; }
body.app-page .sidebar-collapse-toggle { position: static; transform: none; width: 34px; height: 34px; border-radius: 0; border: 1px solid var(--side-2); background: transparent; color: var(--side-muted); box-shadow: none; margin-left: auto; }
body.app-page .sidebar-collapse-toggle:hover { background: var(--side-2); color: var(--side-text); box-shadow: none; }
.sidebar.collapsed .sidebar-collapse-toggle .collapse-icon-open, .sidebar:not(.collapsed) .sidebar-collapse-toggle .collapse-icon-closed { display: none; }
.sidebar.collapsed .sidebar-collapse-toggle .collapse-icon-closed { display: block; }
body.app-page .sidebar.collapsed { flex-basis: var(--sidebar-collapsed-width); width: var(--sidebar-collapsed-width); min-width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .side-logo { padding: 20px 16px 6px; }
.sidebar.collapsed .side-logo-text, .sidebar.collapsed .nav-section-title, .sidebar.collapsed .nav-item-text, .sidebar.collapsed .nav-count,
.sidebar.collapsed .nav-ai, .sidebar.collapsed .nav-item-badges, .sidebar.collapsed .nav-note, .sidebar.collapsed .nav-chevron, .sidebar.collapsed .nav-tree-items,
.sidebar.collapsed .hdr-integration-dot { display: none !important; }
.sidebar.collapsed .nav-group > .nav-group-items { display: flex; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .nav-sub .nav-item > svg { display: block; }
.sidebar.collapsed .sidebar-foot { justify-content: center; }
.sidebar.collapsed .sidebar-collapse-toggle { margin: 0; }

/* top bar */
body.app-page .header { position: relative; top: auto; z-index: 15; flex: 0 0 auto; display: flex; align-items: center; flex-wrap: nowrap; gap: 12px; height: var(--header-height); min-height: var(--header-height);
    padding: 0 var(--page-pad); background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: none; }
body.app-page .header::after { content: none; }
.brand-line { flex: 0 0 3px; height: 3px; background: var(--brand-gradient); }
.top-logo { display: none; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex: none; }
.top-logo span { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.top-search { flex: 1 1 280px; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; background: var(--input); color: var(--muted); min-width: 0; cursor: text; margin: 0; }
.top-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; padding: 0; height: 100%; }
.top-search input::placeholder { color: var(--muted); opacity: 1; }
.top-search:focus-within { box-shadow: inset 0 0 0 1px var(--text); }
.top-search kbd { font-family: var(--font-mono); font-size: 11px; padding: 3px 6px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.erp-pill { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; font-weight: 500; text-decoration: none; white-space: nowrap; flex: none; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.erp-pill:hover { opacity: .9; }
.erp-pill .dot { width: 8px; height: 8px; flex: none; }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); } .pill-ok .dot { background: var(--ok-dot); }
.pill-info { background: var(--info-bg); color: var(--info-fg); } .pill-info .dot { background: var(--info-dot); }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); } .pill-warn .dot { background: var(--warn-dot); }
.pill-neu { background: var(--neu-bg); color: var(--neu-fg); } .pill-neu .dot { background: var(--neu-dot); }
.pill-err { background: var(--err-bg); color: var(--err-fg); } .pill-err .dot { background: var(--err-dot); }
.erp-pill.pill-ok, .erp-pill.pill-ok:hover { color: var(--ok-fg); } .erp-pill.pill-info, .erp-pill.pill-info:hover { color: var(--info-fg); } .erp-pill.pill-neu, .erp-pill.pill-neu:hover { color: var(--neu-fg); }
body.app-page .header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-right .hdr-integration { display: none; }
body.app-page .theme-toggle { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--text); flex: none; }
body.app-page .theme-toggle:hover { background: var(--input); color: var(--text); }
body.app-page .header-user { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 10px 0 4px; border-radius: 0; color: var(--text); }
body.app-page .header-user:hover { background: var(--input); }
body.app-page .user-avatar { width: 34px; height: 34px; border-radius: 0; background: var(--hi); color: var(--on-hi); font-weight: 700; font-size: 13px; }
body.app-page .user-info { line-height: 1.2; }
body.app-page .user-name { font-weight: 600; font-size: 14px; color: var(--text); }
body.app-page .user-account { font-size: 12px; color: var(--muted); }
body.app-page .menu-toggle { width: 42px; height: 42px; border-radius: 0; color: var(--text); flex: none; }

/* notice bars under the brand line */
.impersonate-bar, .finish-bar { flex: 0 0 auto; padding: 8px var(--page-pad); font-size: 13px; border: 0; }
.impersonate-bar { background: var(--err-bg); color: var(--err-fg); }
.finish-bar, [data-theme="dark"] .finish-bar { background: var(--info-bg); color: var(--info-fg); }


/* tablet / phone: sidebar becomes an off-canvas drawer opened by the hamburger */
@media (max-width: 1024px) {
    body.app-page .menu-toggle { display: inline-flex; }
    body.app-page .sidebar, body.app-page .sidebar.collapsed { position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(300px, 86vw); min-width: 0; flex: none; transform: translateX(-100%);
        transition: transform .2s ease; z-index: 95; box-shadow: none; }
    body.app-page .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-hero); }
    body.app-page .sidebar-backdrop { inset: 0; top: 0; background: var(--overlay); z-index: 94; }
    .sidebar.collapsed .side-logo-text, .sidebar.collapsed .nav-section-title, .sidebar.collapsed .nav-item-text, .sidebar.collapsed .nav-count, .sidebar.collapsed .nav-ai,
    .sidebar.collapsed .nav-item-badges, .sidebar.collapsed .nav-note, .sidebar.collapsed .nav-chevron { display: revert !important; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 9px 10px; }
    .sidebar-foot { display: none; }
    .top-logo { display: flex; }
    .top-search { max-width: none; }
    .top-search kbd { display: none; }
    body.app-page .user-info { display: none; }
}
@media (max-width: 768px) {
    html, body.app-page { height: auto; overflow: auto; }
    body.app-page .app-container, body.app-page .app-main { height: auto; min-height: 100vh; min-height: 100dvh; }
    body.app-page .content { overflow: visible; padding: var(--page-pad) var(--page-pad) calc(24px + env(safe-area-inset-bottom)); }
    body.app-page .header { position: sticky; top: 0; gap: 8px; padding: env(safe-area-inset-top) 12px 0; height: calc(var(--header-height) + env(safe-area-inset-top)); }
    .top-search, .erp-pill .erp-pill-state, .top-logo span { display: none; }
    .erp-pill { height: 38px; padding: 0 10px; max-width: 120px; min-width: 0; flex: 0 1 auto; }
    .erp-pill > span:last-child { overflow: hidden; text-overflow: ellipsis; }
    body.app-page .header-right { gap: 6px; }
    body.app-page .header-right .btn-sm { min-height: 38px; padding: 0 10px; }
    body.app-page .theme-toggle, body.app-page .menu-toggle { width: 38px; height: 38px; }
    body.app-page .header-user { padding: 0 2px; height: 38px; }
    .sidebar .nav-item, .sidebar.collapsed .nav-item { min-height: 44px; padding: 10px 12px; font-size: 15px; }
    .sidebar .nav-sub .nav-item { min-height: 40px; padding: 9px 12px; }
}

/* ---------- 4. components ---------- */
/* buttons: primary (dark / lime), secondary (outlined), text (link), danger */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 0; font-family: var(--font-body);
    font-size: 14px; font-weight: 600; letter-spacing: 0; line-height: 1.2; box-shadow: none; transform: none; text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; box-shadow: none; }
.btn:active { transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary, [data-theme="dark"] .btn-primary { background: var(--btn); border-color: var(--btn); color: var(--on-btn); box-shadow: none; }
.btn-primary:hover, [data-theme="dark"] .btn-primary:hover, .btn-primary:active { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--on-btn); box-shadow: none; opacity: 1; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: none; }
.btn-secondary:hover, .btn-secondary:active { background: var(--surface); border-color: var(--text); color: var(--text); box-shadow: none; opacity: 1; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn-ghost:hover, .btn-ghost:active { background: var(--input); color: var(--link); box-shadow: none; opacity: 1; }
.btn-danger, .btn-danger:hover, .btn-danger:active { background: var(--danger); border-color: var(--danger); color: var(--on-danger); box-shadow: none; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent); color: var(--on-accent); filter: brightness(.95); opacity: 1; }
.btn-text { background: none; border: 0; padding: 0 4px; color: var(--link); }
.btn-sm, .table-toolbar .btn, .table-toolbar .btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-icon, .table-toolbar .btn-icon { width: 42px; min-width: 42px; padding: 0; }
.btn-icon.btn-sm, .table-toolbar .btn-icon.btn-sm { width: 36px; min-width: 36px; }
.btn:disabled, .btn[aria-disabled="true"], .btn.disabled { opacity: .45; }

/* forms */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--text); font-size: 14px; font-family: var(--font-body); box-shadow: none; }
.form-textarea { min-height: 96px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); outline: none; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); opacity: .9; }
.form-select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 12px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237F8C89' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); }
.form-select[multiple] { background-image: none; padding-right: 12px; }
.form-select-sm, .table-toolbar .form-select, .table-toolbar .form-select-sm, .table-toolbar .form-input { min-height: 36px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.form-help, .form-hint, .field-hint { color: var(--muted); font-size: 12.5px; }
.form-input.is-invalid, .form-select.is-invalid, .form-textarea.is-invalid { border-color: var(--err-dot); box-shadow: 0 0 0 1px var(--err-dot); }
.field-error, .form-error { color: var(--err-fg); }
.field-error::before { border-radius: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--text); }
[data-theme="dark"] input[type="checkbox"], [data-theme="dark"] input[type="radio"] { accent-color: var(--accent); }
.form-input code, code { font-family: var(--font-mono); font-size: .92em; }

/* cards: no border, soft shadow, sharp */
.card, .stat-card, .quick-action { background: var(--surface); border: 0; border-radius: 0; box-shadow: var(--shadow); }
.card-header { min-height: 0; padding: 16px 24px; gap: 12px; border-bottom: 1px solid var(--line); background: transparent; }
.card-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.card-header .btn-ghost { min-height: 32px; padding: 0 10px; font-size: 13px; color: var(--link); }
.card-header .muted, .card-header .text-secondary { font-size: 13px; }
.card-body { padding: 22px 24px; }
.card-footer, .settings-footer { padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0; }
.content > .card + .card, .tab-content > .card + .card, .profile-tab-content > .card + .card, form > .card + .card, .settings-form > .card + .card { margin-top: 20px; }
/* card with a dark header strip (settings / builder pattern) */
.card-dark > .card-header, .card-dark > form > .card-header, .card-head-dark { background: var(--hero); color: var(--on-hero); border-bottom: 0; }
.card-dark > .card-header .card-title, .card-dark > form > .card-header .card-title, .card-head-dark .card-title { color: var(--on-hero); }
.card-dark > .card-header .text-secondary, .card-dark > .card-header .muted, .card-head-dark .muted { color: var(--side-muted) !important; }
.card-dark > .card-header .btn-ghost { color: var(--accent); }
.card-dark > .card-header .btn-secondary { background: transparent; color: var(--on-hero); border-color: var(--side-muted); }
.card-dark > .card-header .badge-neutral { background: var(--side-2); color: var(--side-text); }

/* page head */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 24px; padding: 0; }
.page-header-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex: 1 1 320px; min-width: 0; }
.page-header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-header-right .btn { min-height: 44px; }
.page-title, .page-header .page-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.03em; color: var(--text); display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.page-description { margin: 0; font-size: 14px; color: var(--muted); }
.count-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; background: var(--surface); box-shadow: var(--shadow); font-family: var(--font-mono); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--text); }
@media (max-width: 768px) {
    .page-header { margin-bottom: 16px; flex-direction: column; align-items: stretch; }
    .page-header-left { flex: 0 0 auto; }
    .page-header-right { justify-content: flex-start; }
    .page-title, .page-header .page-title { font-size: 32px; }
    .page-header-right .btn { min-height: 42px; }
}

/* KPI tiles */
.kpi-grid { gap: 20px; margin-bottom: 20px; }
.kpi, .kpi-widget { background: var(--surface); border: 0; border-radius: 0; box-shadow: var(--shadow); padding: 22px; gap: 10px; min-height: 0; color: var(--text); text-decoration: none; }
.kpi:hover { color: var(--text); opacity: 1; box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.kpi::before, .kpi:hover::before { content: none; }
.kpi-label { font-family: var(--font-body); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.kpi-value { font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--text); }
.kpi-value.ok { color: var(--text); } .kpi-value.warn { color: var(--warn-fg); } .kpi-value.err { color: var(--err-fg); }
.kpi-sub { font-size: 13px; color: var(--muted); }
.kpi-sub .up { color: var(--ok-fg); } .kpi-sub .down { color: var(--err-fg); }
.kpi-spark { opacity: 1; }

/* badges + status pills (square dot + label) */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 0; border-radius: 0; font-family: var(--font-body); font-size: 12px; font-weight: 600; line-height: 1.35; letter-spacing: 0; white-space: nowrap; }
.badge-success { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warning { background: var(--warn-bg); color: var(--warn-fg); }
.badge-danger { background: var(--err-bg); color: var(--err-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-neutral, .badge:not([class*="badge-"]) { background: var(--neu-bg); color: var(--neu-fg); border: 0; }
.badge-hi { background: var(--hi); color: var(--on-hi); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.status-pill::before { content: ''; width: 6px; height: 6px; flex: none; background: currentColor; }
.status-pill.ok { background: var(--ok-bg); color: var(--ok-fg); } .status-pill.ok::before { background: var(--ok-dot); }
.status-pill.warn { background: var(--warn-bg); color: var(--warn-fg); } .status-pill.warn::before { background: var(--warn-dot); }
.status-pill.info { background: var(--info-bg); color: var(--info-fg); } .status-pill.info::before { background: var(--info-dot); }
.status-pill.neu { background: var(--neu-bg); color: var(--neu-fg); } .status-pill.neu::before { background: var(--neu-dot); }
.status-pill.err { background: var(--err-bg); color: var(--err-fg); } .status-pill.err::before { background: var(--err-dot); }
.cur-tag { display: inline-block; margin-left: 4px; padding: 1px 4px; font-family: var(--font-body); font-size: 11px; font-weight: 600; vertical-align: 1px; background: var(--neu-bg); color: var(--neu-fg); }
.cur-tag.cur-foreign { background: var(--info-bg); color: var(--info-fg); }
.sdot { width: 7px; height: 7px; border-radius: 0; background: var(--neu-dot); }
.sdot.ok { background: var(--ok-dot); } .sdot.warn { background: var(--warn-dot); } .sdot.err { background: var(--err-dot); } .sdot.info { background: var(--info-dot); }
.src-badge { border-radius: 0; border: 0; background: var(--neu-bg); color: var(--neu-fg); font-size: 11px; font-weight: 600; padding: 2px 6px; }
.src-badge.src-erp, [data-theme="dark"] .src-badge.src-erp { background: var(--info-bg); color: var(--info-fg); border: 0; }
.pill { border-radius: 0; }
.pill-neutral { background: var(--neu-bg); color: var(--neu-fg); } .pill-success { background: var(--ok-bg); color: var(--ok-fg); } .pill-warning { background: var(--warn-bg); color: var(--warn-fg); }
.count-pill, .doc-count { border-radius: 0; background: var(--neu-bg); color: var(--neu-fg); font-family: var(--font-mono); }
.direction-badge { border-radius: 0; }

/* alerts = banners */
.alert { display: block; padding: 12px 16px; border: 0; border-left: 3px solid var(--neu-dot); border-radius: 0; font-size: 14px; background: var(--neu-bg); color: var(--neu-fg); margin-bottom: 20px; }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); border-left-color: var(--ok-dot); }
.alert-danger, .alert-error { background: var(--err-bg); color: var(--err-fg); border-left-color: var(--err-dot); }
.alert-warning { background: var(--warn-bg); color: var(--warn-fg); border-left-color: var(--warn-dot); }
.alert-info { background: var(--info-bg); color: var(--info-fg); border-left-color: var(--info-dot); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.connect-cta { border-left: 0; box-shadow: none; border: 2px dashed var(--dash); background: transparent; }

/* tabs = segmented control (in-page tabs only) */
.tabs, .profile-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0 0 20px; padding: 4px; border: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); max-width: 100%; overflow: visible; }
.card > .profile-tabs { display: flex; margin: 0; border: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; background: transparent; }
.tab, .profile-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 0; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.tab:hover, .profile-tab:hover { background: var(--input); color: var(--text); opacity: 1; }
.tab.active, .profile-tab.active, .tab.active:hover, .profile-tab.active:hover { background: var(--btn); color: var(--on-btn); }
.tab.active::after, .profile-tab.active::after { content: none; }
.tab .badge, .profile-tab .badge { margin-left: 2px; padding: 1px 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; background: var(--input); color: inherit; }
.tab.active .badge { background: rgba(255, 255, 255, .16); color: inherit; }
[data-theme="dark"] .tab.active .badge { background: rgba(0, 0, 0, .14); }
.range-tabs, .seg-ctl { display: inline-flex; gap: 2px; padding: 4px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); overflow: visible; }
.range-tabs a, .seg-ctl > * { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border: 0; border-radius: 0; font-size: 14px; font-weight: 500; color: var(--text); background: transparent; text-decoration: none; cursor: pointer; font-family: inherit; }
.range-tabs a:hover, .seg-ctl > *:hover { background: var(--input); color: var(--text); opacity: 1; }
.range-tabs a.active, [data-theme="dark"] .range-tabs a.active, .seg-ctl > .active, .seg-ctl > [aria-pressed="true"] { background: var(--btn); color: var(--on-btn); }
@media (max-width: 768px) { .tabs, .profile-tabs { display: flex; } .tab, .profile-tab { min-height: 40px; flex: 1 1 auto; justify-content: center; } }

/* radio cards (opt-card) */
.opt-grid, .erp-mode-grid { gap: 12px; }
.opt-card, .erp-mode-card { padding: 16px; gap: 12px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); box-shadow: none; }
.opt-card:hover, .erp-mode-card:hover { border-color: var(--text); }
.opt-card:has(input:checked), .erp-mode-card:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--surface); }
.opt-card input, .erp-mode-card input { accent-color: var(--text); width: 18px; height: 18px; margin-top: 1px; }
[data-theme="dark"] .opt-card input, [data-theme="dark"] .erp-mode-card input { accent-color: var(--accent); }
.opt-body, .erp-mode-body { font-size: 14px; gap: 4px; }
.opt-body strong, .erp-mode-body strong, .opt-body b { font-weight: 600; }
.opt-body span, .erp-mode-body span { color: var(--muted); font-size: 13px; }

/* switches: square track 40x22, lime when on */
.toggle { width: 40px; height: 22px; }
.toggle-slider, .toggle .toggle-slider { border-radius: 0; background: var(--dash); border: 0; }
.toggle-slider::before, .toggle .toggle-slider::before { left: 3px; top: 3px; bottom: auto; width: 16px; height: 16px; border-radius: 0; background: var(--surface); box-shadow: none; }
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--on-accent); }
.toggle input:focus-visible + .toggle-slider { outline: 2px solid var(--link); outline-offset: 2px; }

/* settings rows */
.settings-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.settings-label-title { font-size: 14px; font-weight: 600; }
.settings-label-description { font-size: 13px; color: var(--muted); }
.check-item input { accent-color: var(--text); }
.chip-toggle { border-radius: 0; border-color: var(--border); }
.chip-toggle:has(input:checked) { border-color: var(--text); background: var(--accent-soft); color: var(--text); }
.chips { border-radius: 0; }
.chip { border-radius: 0; background: var(--accent-soft); color: var(--text); font-family: var(--font-mono); }
.seg-btn { border-radius: 0; }
.seg-btn.active, .seg-btn:hover { border-color: var(--text); color: var(--text); }
.seg-btn.active { background: var(--accent-soft); }
.swatch { border-radius: 0; }

/* empty state: icon square + one sentence + one action */
.empty-state { padding: 48px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state-icon { width: 56px; height: 56px; padding: 15px; opacity: 1; background: var(--input); color: var(--muted); stroke-width: 1.8; box-sizing: border-box; margin: 0 0 6px; }
.empty-state-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 0; }
.empty-state-description { font-size: 14px; color: var(--muted); max-width: 52ch; margin: 0 auto; }
.empty-state-actions { margin-top: 10px; }
.empty-ok { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px 0; height: 100%; }
.empty-ok-icon { width: 64px; height: 64px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.empty-ok-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--text); }
.empty-ok-sub { color: var(--muted); font-size: 13px; }

/* dropdowns */
.dropdown-menu { border: 0; border-radius: 0; box-shadow: var(--shadow), 0 0 0 1px var(--border); background: var(--surface); padding: 6px; }
.dropdown-item { border-radius: 0; color: var(--text); padding: 9px 12px; font-size: 14px; }
.dropdown-item:hover { background: var(--input); color: var(--text); opacity: 1; }
.dropdown-divider { background: var(--line); }
.column-menu-item { border-radius: 0; }

/* tables */
.table-container { background: var(--surface); border: 0; border-radius: 0; box-shadow: var(--shadow); margin: 0; overflow: hidden; }
body.app-page .content > .table-container:first-child { margin-top: 0; }
body.app-page .content > .table-container:last-child { margin-bottom: 0; }
.table-toolbar { min-height: 0; padding: 14px 20px; gap: 10px; border-bottom: 1px solid var(--line); background: transparent; }
.table-toolbar-left, .table-toolbar-right { gap: 8px; }
.table-search input, .table-search input.form-input { width: 240px; min-height: 36px; padding-left: 36px !important; background: var(--input); border-color: transparent; }
.table-search input:focus { background: var(--surface); }
.table-search svg { left: 12px !important; color: var(--muted); }
.table-toolbar .filter-select { min-height: 36px; font-size: 13px; color: var(--text); }
.table-toolbar-right .text-secondary { font-family: var(--font-mono); font-size: 11px !important; letter-spacing: .06em; text-transform: uppercase; }
.data-table th, .data-table thead th { height: 40px; padding: 0 12px; background: var(--surface-2); border-top: 0; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 11px; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table th.sortable:hover { background: var(--input); }
.data-table th .sort-link { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.data-table th.sorted .sort-link { color: var(--text); }
.data-table th .resize-handle:hover { background: var(--dash); }
.data-table td { height: var(--row-h); padding: 0 12px; border-bottom: 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--text); }
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr:nth-child(even) { background: transparent; }
.data-table tbody tr:hover, .data-table tbody tr.row-clickable:hover td { background: var(--row-hover); }
:root { --dt-scale: 1.22; }
/* admin lists: dense rows (40px) */
:is(body.page-admin-accounts, body.page-admin-installs, body.page-admin-events, body.page-admin-mails) .data-table td { height: 40px; }
/* inline controls inside tables (admin lists): dense */
.data-table .form-input, .data-table .form-select, .mini-table .form-input, .mini-table .form-select { min-height: 32px; height: 32px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
.data-table .btn, .mini-table .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }
/* fixed table layout: a column without its own width would get 0 px once the others fill the row */
.resizable-table th.resizable-th:not([style*="width"]) { width: 200px; }
.data-table td.col-mono, .data-table td[data-format="money"], .data-table td[data-format="decimal"], .data-table td[data-format="number"], .data-table td[data-format="qty"],
.data-table td[data-format="currency"], .data-table td[data-format="percent"], .data-table td[data-format="date"], .data-table td[data-format="datetime"], .data-table td.col-right { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: -0.02em; }
.data-table td[data-format="money"], .data-table td[data-format="decimal"], .data-table td[data-format="currency"], .data-table th[data-column="total"] { text-align: right; }
.data-table td.col-muted { color: var(--muted); }
.data-table td.col-strong { font-weight: 600; }
.data-table tbody td:first-child.col-strong, .data-table td[data-column="number"] { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: -0.02em; font-weight: 500; color: var(--link); }
.data-table td a.row-link { color: var(--link); }
.table-actions a, .table-actions a.btn, .table-actions a.btn-secondary { color: var(--muted); border-radius: 0; padding: 6px; }
.table-actions a:hover, .table-actions a.btn:hover { color: var(--text); background: var(--input); }
.bulk-toolbar { background: var(--hero); color: var(--on-hero); border: 0; border-radius: 0; padding: 10px 20px; }
.bulk-toolbar a { color: var(--accent); }
.bulk-toolbar .btn-secondary { background: transparent; color: var(--on-hero); border-color: var(--side-muted); }
.mini-table { font-size: 14px; }
.mini-table th { padding: 10px 12px; height: 38px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.mini-table td { padding: 11px 12px; border-bottom: 0; border-top: 1px solid var(--line); }
.mini-table tbody tr:first-child td { border-top: 0; }
.mini-table th:first-child, .mini-table td:first-child { padding-left: 24px; }
.mini-table th:last-child, .mini-table td:last-child { padding-right: 24px; }
.mini-table td.r { font-family: var(--font-mono); font-size: 13px; }
.mini-table tbody tr:hover { background: var(--row-hover); }
.mini-table a { color: var(--link); font-weight: 600; }
.detail-table td { border-color: var(--line); }

/* pagination (same links, new look) */
.table-pagination { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.pagination-info { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.pagination-controls { gap: 4px; }
.pagination-btn { width: auto; min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--text); font-family: var(--font-mono); font-size: 13px; text-decoration: none; }
.pagination-btn:hover:not(:disabled):not(.disabled) { border-color: var(--text); background: var(--surface); color: var(--text); opacity: 1; }
.pagination-btn.active, .pagination-btn.active:hover { background: var(--btn); border-color: var(--btn); color: var(--on-btn); }
.pagination-btn.disabled { opacity: .4; pointer-events: none; }
.pagination-ellipsis { font-family: var(--font-mono); color: var(--muted); padding: 0 4px; }

/* modal kit */
.modal-overlay { background: var(--overlay); backdrop-filter: none; }
.modal { border-radius: 0; background: var(--surface); box-shadow: var(--shadow-hero); }
.modal-header { padding: 18px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close { border-radius: 0; width: 36px; height: 36px; }
.modal-close:hover { background: var(--input); }
.modal-body, .modal-lg .modal-body { padding: 22px 24px; background: var(--surface); }
.modal-footer { padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--line); }
.modal-footer .btn, .modal-footer .btn-sm { min-height: 42px; padding: 0 16px; font-size: 14px; border-radius: 0; }
.m-title, .m-head, .doc-section-title, .doc-addr h4, .doc .modal-detail-section-title, .m-collapse > summary { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); }
.modal-resize-se::after { border-color: var(--dash); }

/* toasts */
.toast { border-radius: 0; background: var(--hero); color: var(--on-hero); box-shadow: var(--shadow-hero); border: 0; }
.toast-title { color: var(--on-hero); }
.toast-message { color: var(--side-text); }
.toast-close { color: var(--side-muted); border-radius: 0; }
.toast-icon { border-radius: 0; }

/* misc older blocks */
.filters-panel { background: var(--surface); border: 0; box-shadow: var(--shadow); border-radius: 0; padding: 16px 20px; margin-bottom: 20px; }
.ig-card { background: var(--surface); border: 0; border-radius: 0; box-shadow: var(--shadow); padding: 20px; gap: 12px; }
.ig-card::before { width: 3px; border-radius: 0; }
.ig-card-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.ig-card-sub { font-size: 13px; color: var(--muted); }
.ig-card-stats strong { font-family: var(--font-mono); font-weight: 500; font-size: 18px; }
.ig-card.ig-add { border: 2px dashed var(--dash); box-shadow: none; background: transparent; color: var(--text); }
.ig-card.ig-add:hover { border-color: var(--text); opacity: 1; }
.run-log, .log-viewer { background: var(--hero); color: var(--side-text); border-radius: 0; font-family: var(--font-mono); }
.queue-id-cell { border-radius: 0; font-family: var(--font-mono); }
.json-viewer, .json-key, .json-value { font-family: var(--font-mono); }
.code-big { font-family: var(--font-mono); }
.mon-step { border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 0; padding: 18px; }
.mon-step .n { border-radius: 0; background: var(--accent); color: var(--on-accent); width: 28px; height: 28px; font-family: var(--font-mono); }
.user-avatar { border-radius: 0; }
.skeleton { border-radius: 0; }

/* ---------- 5. page patterns ---------- */
/* Settings pattern (Nastavení, Nastavení ERP, Nastavení integrace, Připojení ERP): cards with a dark header strip */
:is(body.page-settings, body.page-erp-settings, body.page-integration-settings, body.page-connect-erp, body.page-finish-registration, body.page-hosted, body.page-admin-account-new) .content .card > .card-header {
    background: var(--hero); color: var(--on-hero); border-bottom: 0; }
:is(body.page-settings, body.page-erp-settings, body.page-integration-settings, body.page-connect-erp, body.page-finish-registration, body.page-hosted, body.page-admin-account-new) .content .card > .card-header .card-title { color: var(--on-hero); }
:is(body.page-settings, body.page-erp-settings, body.page-integration-settings, body.page-connect-erp, body.page-finish-registration, body.page-hosted, body.page-admin-account-new) .content .card > .card-header :is(.text-secondary, .muted) { color: var(--side-muted) !important; }
:is(body.page-settings, body.page-erp-settings, body.page-integration-settings, body.page-connect-erp, body.page-finish-registration, body.page-hosted, body.page-admin-account-new) .content .card > .card-header .btn-secondary { background: transparent; color: var(--on-hero); border-color: var(--side-muted); }
:is(body.page-settings, body.page-erp-settings, body.page-integration-settings, body.page-connect-erp, body.page-finish-registration, body.page-hosted, body.page-admin-account-new) .content .card > .card-header .btn-ghost { color: var(--accent); }
/* danger zone: last card of a settings tab, 2px warn top border, light header */
.content .card.danger-zone { border-top: 2px solid var(--warn-fg); }
.content .card.danger-zone > .card-header { background: transparent !important; color: var(--text) !important; border-bottom: 1px solid var(--line) !important; }
.content .card.danger-zone > .card-header .card-title { color: var(--text) !important; }
.content .card.danger-zone .btn-danger:disabled { opacity: .45; }

/* Wizard (Nová integrace, Připojení ERP): left-aligned head, square numbered steps, tile grid, max 880px card */
body.app-page .profile-add-wrap { justify-content: flex-start; padding: 0; min-height: 0; }
body.app-page .profile-add-header { text-align: left; }
body.app-page .profile-add-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
body.app-page .profile-add-subtitle { color: var(--muted); margin: 0 0 24px; }
body.app-page .wizard-steps { justify-content: flex-start; gap: 10px; }
body.app-page .wizard-step { flex-direction: row; gap: 10px; color: var(--muted); }
body.app-page .wizard-step.active, body.app-page .wizard-step.done { color: var(--text); }
body.app-page .wizard-step-circle { width: 32px; height: 32px; border-radius: 0; border: 1px solid var(--border); background: var(--surface); font-family: var(--font-mono); font-weight: 500; color: var(--muted); }
body.app-page .wizard-step.active .wizard-step-circle { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
body.app-page .wizard-step.done .wizard-step-circle { background: var(--btn); border-color: var(--btn); color: transparent; position: relative; }
body.app-page .wizard-step.done .wizard-step-circle::after { content: ''; position: absolute; left: 11px; top: 7px; width: 7px; height: 13px; border-right: 2.5px solid var(--on-btn); border-bottom: 2.5px solid var(--on-btn); transform: rotate(45deg); }
body.app-page .wizard-step-label { font-size: 14px; font-weight: 600; }
body.app-page .wizard-step-line { flex: 0 0 40px; max-width: 40px; height: 1px; margin: 0; background: var(--border); }
body.app-page .wizard-step-line.done { background: var(--text); }
body.app-page .wizard-step-counter { text-align: left; margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
body.app-page .profile-add-card-wrap { max-width: 880px; margin: 0; }
body.app-page .profile-add-card { padding: 28px; }
body.app-page .app-pick-group { font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: .08em; }
body.app-page .app-pick { gap: 12px; }
body.app-page .app-pick-card { border: 1px solid var(--border); border-radius: 0; background: var(--surface); }
body.app-page .app-pick-item:hover .app-pick-card { border-color: var(--text); transform: none; }
body.app-page .app-pick-item input:checked + .app-pick-card { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
body.app-page .app-pick-item input:focus-visible + .app-pick-card { outline: 2px solid var(--link); outline-offset: 2px; box-shadow: none; }
body.app-page .app-pick-logo { border-radius: 0; width: auto; max-width: 112px; height: 40px; padding: 2px 5px; } /* the white plate hugs the logo (dark theme) */
body.app-page .app-pick-letter { border-radius: 0; background: var(--accent); color: var(--on-accent); }
body.app-page .app-pick-check { border-radius: 0; background: var(--text); color: var(--surface); }
body.app-page .form-section-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
@media (max-width: 768px) { body.app-page .profile-add-title { font-size: 32px; } body.app-page .wizard-step-label { display: none; } body.app-page .wizard-step-line { flex-basis: 24px; } }

/* KPI strip (queue pattern) */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 20px; margin-bottom: 20px; }
.kpi-strip-cell { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; border-top: 3px solid transparent; }
a.kpi-strip-cell:hover { color: var(--text); opacity: 1; box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.kpi-strip-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-strip-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.kpi-strip-cell.warn { border-top-color: var(--warn-dot); } .kpi-strip-cell.warn .kpi-strip-value { color: var(--warn-fg); }
.kpi-strip-cell.err { border-top-color: var(--err-dot); } .kpi-strip-cell.err .kpi-strip-value { color: var(--err-fg); }
.kpi-strip-cell.ok { border-top-color: var(--ok-dot); }
@media (max-width: 768px) { .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .kpi-strip-value { font-size: 26px; } }

/* List page: head (H1 + count chip + actions) → dark ask-bar → table card */
.list-head { margin-bottom: 20px; }
/* collapsible (DESIGN.md, Objednávky): collapsed = one 44px row (toggle), expanded = input + Zeptat se + chips */
.dt-assist, .dt-assist.ask-bar { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 14px; margin: 0 0 20px; background: var(--hero); color: var(--on-hero); box-shadow: var(--shadow-hero); }
.dt-assist.expanded, .dt-assist.open { padding: 8px 14px 14px; }
.table-container > .dt-assist { margin: 0; box-shadow: none; }
.dt-assist-toggle { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 4px; border: 0; background: transparent; color: var(--on-hero); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.dt-assist-toggle > svg:first-child { color: var(--hi); flex: none; }
.dt-assist-hint { font-weight: 400; font-size: 13px; color: var(--side-muted); }
.dt-assist.expanded .dt-assist-hint { display: none; }
.dt-assist-chevron { margin-left: auto; flex: none; transition: transform .15s; }
.dt-assist-toggle[aria-expanded="true"] .dt-assist-chevron { transform: rotate(180deg); }
.dt-assist-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dt-assist-body { display: flex; flex-direction: column; gap: 12px; }
.dt-assist-body[hidden] { display: none; }
.dt-assist-form { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; gap: 10px; color: var(--hi); }
.dt-assist-form svg { width: 18px; height: 18px; flex: none; }
.dt-assist-form .form-input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; font-size: 15px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); color: var(--on-hero); }
.dt-assist-form .form-input::placeholder { color: var(--side-muted); }
.dt-assist-form .form-input:focus { border-color: var(--accent); box-shadow: none; }
.dt-assist-form .btn, .dt-assist-form .btn-primary { min-height: 46px; padding: 0 18px; font-size: 14px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dt-assist-chips, .dt-assist.open .dt-assist-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.dt-assist-form, .dt-assist-panel { flex: none; }
.dt-assist-chip { min-height: 34px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 0; background: transparent; color: var(--side-text); font-size: 13px; }
.dt-assist-chip:hover { border-color: var(--accent); color: var(--accent); }
.dt-assist-panel { border: 0; border-left: 3px solid var(--accent); border-radius: 0; background: var(--surface); color: var(--text); padding: 14px 18px; }
.dt-assist-q { color: var(--muted); font-size: 13px; }
.dt-assist-answer { font-size: 14px; }
.dt-assist-answer th, .dt-assist-answer td { border-color: var(--line); }

/* list pages fill the pane; the table card scrolls inside, pagination stays at the bottom (desktop) */
@media (min-width: 1025px) {
    body.app-page .content > .table-container { flex: 1 0 auto; }
}
@media (max-width: 768px) {
    /* not a scroll box on phones, otherwise the sticky toolbar is offset inside it */
    .table-container { margin-left: 0; margin-right: 0; overflow: visible; }
    body.app-page .content > .table-container:first-child { margin-top: 0; }
    .table-toolbar { padding: 10px 12px; top: calc(var(--header-height) + env(safe-area-inset-top)); }
    .table-container .data-table tbody tr { border-bottom: 1px solid var(--line); }
    .table-container .data-table tbody tr::before { border-radius: 0 !important; background: var(--input) !important; }
    .table-container .data-table tbody tr::after, .table-container .data-table tbody tr.row-clickable::after { background: var(--text) !important; }
    .table-container .data-table tbody td[data-column="number"] { color: var(--text); }
    .table-container .data-table tbody td::before { font-family: var(--font-mono); font-weight: 500; letter-spacing: .06em; }
    .dt-assist { padding: 4px 10px; }
    .dt-assist.expanded, .dt-assist.open { padding: 8px 10px 12px; }
    .dt-assist-hint { display: none; }
    .dt-assist-chip { white-space: normal; text-align: left; }
    .data-table th:first-child, .data-table td:first-child { padding-left: 12px; }
}

/* Dashboard: widgets are cards; KPI widgets carry the hero / highlight variants */
.dash-head { margin-bottom: 20px; }
.dash-grid { gap: 20px; grid-auto-rows: 124px; }
@media (max-width: 768px) { .dash-grid { grid-auto-rows: auto; } }
/* KPI numbers scale with the tile width (narrow tiles of saved layouts / BI dashboards) */
.dw .kpi-widget { container-type: inline-size; }
.dw .kpi-widget .kpi-value { font-size: min(44px, 15cqi); white-space: nowrap; }
.dw.dw-hero .kpi-widget .kpi-value { font-size: min(72px, 14cqi); }
.dw.dw-highlight .kpi-widget .kpi-value { font-size: min(52px, 15cqi); }
.bi-grid .dw-meta { font-size: 13px; color: var(--muted); }
.bi-grid .bi-table th { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bi-grid .bi-table td.r { font-family: var(--font-mono); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.kpi-top .kpi-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-top .badge { flex: none; }
.kpi-note { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.kpi-value small { font-size: .5em; letter-spacing: -0.02em; }
.kpi-link { margin-top: auto; font-weight: 600; }
.kpi-widget { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
.hero-bars { margin-top: auto; display: flex; align-items: flex-end; gap: 3px; height: 64px; position: relative; z-index: 1; }
.hero-bars i { flex: 1; min-width: 0; background: var(--side-2); }
.hero-bars i.on { background: var(--hi); }
[data-theme="dark"] .hero-bars i { background: rgba(255, 255, 255, .14); }
[data-theme="dark"] .hero-bars i.on { background: var(--hi); }
.hero-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--side-muted); position: relative; z-index: 1; }
.dw-chart-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dw-chart-total { font-family: var(--font-display); font-weight: 700; font-size: 32px; letter-spacing: -0.03em; line-height: 1; color: var(--text); white-space: nowrap; }
.dw-chart-total small { font-size: 18px; }
/* Integrace without any integration: dashed CTA card */
.dw.dw-cta { background: transparent; box-shadow: none; border: 2px dashed var(--dash); }
.dw-cta .dw-head { display: none; }
.dw-cta .dw-body { padding: 22px 24px; }
.ig-cta { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.ig-cta-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ig-cta-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.ig-cta-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ig-cta-chips span { font-size: 12px; padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); }
.ig-cta .btn { margin-top: auto; align-self: flex-start; }
/* one-row tiles (saved layouts with h = 1): compact, no hero bars */
.dw[data-h="1"] .kpi-widget { padding: 16px 20px; gap: 6px; }
.dw[data-h="1"] .kpi-widget .kpi-value { font-size: min(34px, 15cqi); }
.dw[data-h="1"] .kpi-widget .kpi-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw[data-h="1"] .hero-bars, .dw[data-h="1"] .hero-axis, .dw[data-h="1"] .kpi-link, .dw[data-h="1"] .kpi-spark { display: none; }
.dw[data-w="2"] .kpi-top .badge, .dw[data-w="2"] .kpi-note { display: none; }
.dw { background: var(--surface); border: 0; border-radius: 0; box-shadow: var(--shadow); }
.dw-head { min-height: 0; padding: 16px 24px 4px; border-bottom: 0; gap: 8px; }
.dw-title { font-family: var(--font-body); font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); }
.dw-tools .dw-opt { min-height: 30px; padding: 0 26px 0 8px; border-radius: 0; border-color: var(--border); font-size: 12px; font-family: var(--font-mono); background-color: var(--surface); }
.dw-btn { width: 30px; height: 30px; border-radius: 0; color: var(--muted); }
.dw-btn:hover { background: var(--input); color: var(--text); }
.dw-body { padding: 10px 24px 18px; }
.dw-body > .mini-table { margin: 0 -24px; width: calc(100% + 48px); }
.dw-chart-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.dw-foot { padding: 10px 0 0; font-size: 13px; }
.dw-foot a { font-weight: 600; }
.dw-empty { font-size: 14px; color: var(--muted); }
.dw-bare .kpi-widget { box-shadow: none; padding: 20px 22px; }
.dw .dw-card { padding: 4px 0 0; box-shadow: none; background: transparent; }
/* integration cards inside the widget: one compact card per row (stats in one line, three text actions) */
.dw .dw-ig-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 10px; }
.dw .dw-ig-grid .ig-card { box-shadow: none; border: 1px solid var(--line); padding: 12px 14px 12px 18px; gap: 8px; }
.dw .dw-ig-grid .ig-card-head { align-items: center; }
.dw .dw-ig-grid .ig-card-title { font-size: 16px; }
.dw .dw-ig-grid .ig-card-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw .dw-ig-grid .ig-card-stats { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.dw .dw-ig-grid .ig-card-stats div { white-space: nowrap; }
.dw .dw-ig-grid .ig-card-stats strong { display: inline; font-size: 14px; margin-right: 4px; }
.dw .dw-ig-grid .ig-card-actions { gap: 2px 14px; margin-top: 2px; }
.dw .dw-ig-grid .ig-card-actions .btn { min-height: 0; padding: 0; border: 0; background: none; font-size: 13px; color: var(--link); }
.dw .dw-ig-grid .ig-card-actions .btn:hover { opacity: .8; }
.dw .dw-ig-grid .ig-card.ig-add { border: 2px dashed var(--dash); min-height: 0; padding: 10px; flex-direction: row; gap: 10px; justify-content: center; }
.dw .dw-ig-grid .ig-card.ig-add > div { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: center; }
.dw .dw-ig-grid .ig-card.ig-add > div > div:first-child { font-size: 1rem !important; }
/* hero tile (Tržby) */
.dw.dw-hero { background: var(--hero); box-shadow: var(--shadow-hero); color: var(--on-hero); }
.dw-hero .kpi-widget { background: transparent; position: relative; overflow: hidden; color: var(--on-hero); }
.dw-hero .kpi-widget::after { content: ''; position: absolute; right: -120px; top: -140px; width: 420px; height: 420px; opacity: .6; pointer-events: none;
    background: radial-gradient(circle, transparent 79px, var(--hero-ring) 80px, var(--hero-ring) 82px, transparent 83px, transparent 119px, var(--hero-ring) 120px, var(--hero-ring) 122px, transparent 123px,
        transparent 159px, var(--hero-ring) 160px, var(--hero-ring) 162px, transparent 163px, transparent 199px, var(--hero-ring) 200px, var(--hero-ring) 202px, transparent 203px); }
.dw-hero .kpi-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--side-muted); position: relative; z-index: 1; }
.dw-hero .kpi-value { color: var(--accent); font-weight: 800; letter-spacing: -0.04em; position: relative; z-index: 1; }
.dw-hero .kpi-sub { color: var(--side-text); position: relative; z-index: 1; }
.dw-hero .kpi-sub .up { color: var(--hi); } .dw-hero .kpi-sub .down { color: var(--warn-fg); }
.dw-hero .kpi-spark { z-index: 1; }
.dw-hero .dw-btn { color: var(--side-muted); }
.dw-hero .dw-btn:hover { background: var(--side-2); color: var(--on-hero); }

/* highlight card (Fakturace) */
.dw.dw-highlight { background: var(--hi); color: var(--on-hi); }
.dw-highlight .kpi-widget { background: transparent; color: var(--on-hi); }
.dw-highlight .kpi-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-hi); }
.dw-highlight .kpi-value { color: var(--on-hi); font-weight: 800; letter-spacing: -0.04em; }
.dw-highlight .kpi-sub { color: var(--on-hi); }
.dw-highlight .dw-btn { color: var(--on-hi); }
/* ERP card: stats strip */
.erp-card { display: flex; flex-direction: column; gap: 18px; height: 100%; }
.erp-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.erp-card-mark { width: 48px; height: 48px; background: var(--input); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; flex: none; }
.erp-card-name { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.erp-card-sub { color: var(--muted); font-size: 13px; }
.erp-card-head .status-pill { margin-left: auto; font-size: 13px; padding: 6px 12px; }
.stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100px, 100%), 1fr)); gap: 1px; background: var(--border); }
.stats-strip > div { background: var(--surface-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dw[data-id="erp"] .dw-head { position: absolute; top: 0; right: 0; z-index: 2; padding: 12px 12px 0 0; }
.dw[data-id="erp"] .dw-title { display: none; }
.dw[data-id="erp"] .dw-body { padding: 24px; }
.dw[data-id="erp"] .erp-card-head .status-pill { margin-right: 34px; }
.dash-grid.editing .dw[data-id="erp"] .dw-head { padding: 8px; }
[data-theme="dark"] .stats-strip > div { background: var(--surface); }
.stats-strip strong { font-family: var(--font-mono); font-size: 20px; font-weight: 500; line-height: 1.2; }
.stats-strip span { font-size: 12px; color: var(--muted); }
.erp-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.erp-card-note { font-size: 13px; color: var(--muted); }
/* dashboard edit mode ("Upravit rozložení") */
.dash-grid.editing .dw { outline: 1px dashed var(--dash); outline-offset: 0; box-shadow: none; }
.dash-grid.editing .dw-head { border-bottom: 0; }
@media (max-width: 768px) { .dash-grid { gap: 12px; } .dw-hero .kpi-widget { min-height: 270px; } .dw-highlight .kpi-widget, .dw-cta .ig-cta { min-height: 200px; } }

/* Record detail drawer (docs/design/DETAIL-MODAL.md, reference/detail-drawer.html) */
.dd-root[hidden] { display: none; }
.dd-scrim { position: fixed; inset: 0; background: rgba(10, 15, 14, .55); opacity: 0; transition: opacity .18s; z-index: 990; }
.dd { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 100%); display: flex; flex-direction: column; background: var(--surface); color: var(--text);
    box-shadow: -24px 0 48px -12px rgba(0, 0, 0, .35); transform: translateX(100%); transition: transform .18s ease-out; z-index: 1000; outline: none; }
.dd-root.dd-open .dd-scrim { opacity: 1; }
.dd-root.dd-open .dd { transform: none; }
.dd-lbl { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.dd-head { flex: 0 0 auto; background: var(--hero); color: var(--on-hero); padding: 18px 24px 22px; display: flex; flex-direction: column; gap: 16px; }
[data-theme="dark"] .dd-head { background: var(--side-2); }
.dd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dd-row:empty { display: none; }
.dd-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; padding: 4px 8px; background: var(--accent); color: var(--on-accent); }
.dd-pos { font-family: var(--font-mono); font-size: 12px; color: var(--side-muted); }
.dd-icons { margin-left: auto; display: flex; gap: 4px; }
.dd-icon { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: var(--on-hero); cursor: pointer; }
.dd-icon:hover:not(:disabled) { background: rgba(255, 255, 255, .1); }
.dd-icon:disabled { opacity: .35; cursor: default; }
.dd-icon.close { border: 0; background: rgba(255, 255, 255, .1); }
.dd-icon.close:hover { background: rgba(255, 255, 255, .18); }
.dd-title-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.dd-title { min-width: 0; flex: 1 1 280px; }
.dd-no { margin: 0; font-family: var(--font-mono); font-size: 30px; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; color: var(--on-hero); overflow-wrap: anywhere; }
.dd-no.dd-no-text { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; }
.dd-sub { color: var(--side-text); margin-top: 4px; }
.dd-sub a, .dd-sub .doc-link { color: var(--on-hero); border-bottom: 1px dotted var(--side-muted); text-decoration: none; }
.dd-total { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dd-total:empty { display: none; }
.dd-total b { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -.03em; color: var(--accent); white-space: nowrap; }
.dd-total b small { font-size: 20px; }
.dd-total span { font-family: var(--font-mono); font-size: 12px; color: var(--side-muted); }
.dd-pill { font-size: 12px; font-weight: 600; padding: 4px 10px; background: rgba(255, 255, 255, .1); color: var(--on-hero); }
.dd-pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.dd-pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
[data-theme="dark"] .dd-pill.ok, [data-theme="dark"] .dd-pill.warn { background: var(--surface); }
.dd-tabs { flex: 0 0 auto; display: flex; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dd-tab { height: 46px; padding: 0 16px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.dd-tab:hover { color: var(--text); }
.dd-tab[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -3px 0 var(--text); }
.dd-tab[hidden] { display: none; }
.dd-tab small { font-family: var(--font-mono); font-size: 11px; font-weight: 400; color: var(--muted); }
.dd-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 24px; background: var(--bg); }
.dd-panel { display: flex; flex-direction: column; gap: 22px; }
.dd-panel[hidden] { display: none; }
.dd-card { background: var(--surface); box-shadow: var(--shadow); }
.dd-pad { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.dd-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 1px; background: var(--border); box-shadow: var(--shadow); }
.dd-strip > div { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dd-strip .dd-wide { grid-column: 1 / -1; }
.dd-v { font-family: var(--font-mono); font-size: 15px; overflow-wrap: anywhere; }
.dd-v .dd-text, .dd-text { font-family: var(--font-body); font-size: 14px; }
.dd-badges { display: flex; flex-wrap: wrap; gap: 4px; font-family: var(--font-body); }
.dd-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.dd-party { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.dd-party-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dd-party-top a { font-size: 13px; font-weight: 600; color: var(--link); text-decoration: none; }
.dd-party-name { font-size: 16px; }
.dd-party-addr { color: var(--text-2); line-height: 1.5; }
.dd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dd-copy { height: 30px; padding: 0 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: var(--font-mono); font-size: 12px; cursor: pointer; }
.dd-copy:hover { border-color: var(--text); }
.dd-copy.done { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bg); }
.dd-items-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dd-items-head .muted { font-size: 12px; }
.dd-tbl-wrap { overflow-x: auto; }
.dd-tbl { width: 100%; border-collapse: collapse; min-width: 520px; }
.dd-tbl th { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 10px 8px; text-align: right; white-space: nowrap; }
.dd-tbl td { padding: 14px 8px; border-top: 1px solid var(--line); text-align: right; font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.dd-tbl th.l, .dd-tbl td.l { text-align: left; }
.dd-tbl td.name { font-family: var(--font-body); font-size: 14px; white-space: normal; line-height: 1.45; min-width: 200px; }
.dd-tbl td.link { color: var(--link); }
.dd-tbl th:first-child, .dd-tbl td:first-child { padding-left: 18px; }
.dd-tbl th:last-child, .dd-tbl td:last-child { padding-right: 18px; }
.dd-tbl tr.row-clickable { cursor: pointer; }
.dd-tbl tbody tr:hover { background: var(--row-hover); }
.dd-tbl .doc-link { color: inherit; border-bottom: 1px dotted var(--dash); }
.dd-seg-wrap { padding: 12px 18px 0; overflow-x: auto; }
.dd-seg { max-width: 100%; }
.dd-seg > button { gap: 6px; }
.dd-seg > button small { font-size: 11px; opacity: .75; }
.dd-seg-panel { padding-top: 12px; }
.dd-seg-panel[hidden] { display: none; }
.dd-tbl tfoot td { border-top: 1px solid var(--border); background: var(--surface-2); }
.dd-totals { display: flex; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.dd-totals dl { margin: 0; display: grid; grid-template-columns: auto auto; column-gap: 28px; row-gap: 6px; font-family: var(--font-mono); font-size: 13px; }
.dd-totals dt { color: var(--muted); }
.dd-totals dd { margin: 0; text-align: right; }
.dd-totals .sum { font-weight: 500; padding-top: 6px; border-top: 1px solid var(--border); color: var(--text); }
.dd-totals dd.sum { font-size: 16px; }
.dd-notes { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.dd-notes p { margin: 0; line-height: 1.5; }
.dd-section-title { margin-bottom: -12px; }
.dd-json summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 18px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; color: var(--text); }
.dd-json summary::-webkit-details-marker { display: none; }
.dd-json[open] .dd-caret { transform: rotate(90deg); }
.dd-caret { transition: transform .15s; flex: none; }
.dd-json-pre { margin: 0; padding: 16px 18px; border-top: 1px solid var(--line); background: var(--surface-2); font-family: var(--font-mono); font-size: 12px; line-height: 1.6; overflow: auto; max-height: 480px; white-space: pre; color: var(--text); }
.dd-ask { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border: 0; width: 100%; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.dd-ask:hover { box-shadow: var(--shadow), inset 0 0 0 1px var(--text); }
.dd-foot { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface); }
.dd-askfield { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border: 1px solid var(--border); color: var(--muted); margin: 0; }
.dd-askfield[hidden] { display: none; }
.dd-askfield:focus-within { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.dd-askfield input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); outline: none; font: inherit; }
.dd-foot .btn { min-height: 44px; }
.dd-foot .btn-secondary { margin-left: auto; }
.dd-askfield:not([hidden]) ~ .btn-secondary { margin-left: 0; }
tr.dd-current td { background: var(--accent-soft) !important; }
@media (max-width: 720px) {
    /* phone: compact header (one title row with the total at the right, pills in one scrollable line) and a
       two-row footer, so the scrolling body keeps most of the screen */
    .dd-head, .dd-body, .dd-foot { padding-left: 14px; padding-right: 14px; }
    .dd-head { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 12px; gap: 8px; }
    .dd-icon { width: 32px; height: 32px; }
    .dd-title-row { flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
    .dd-title { flex: 1 1 auto; }
    .dd-total { flex: 0 0 auto; align-items: flex-end; gap: 2px; max-width: 45%; }
    .dd-no { font-size: 20px; }
    .dd-no.dd-no-text { font-size: 19px; }
    .dd-sub { font-size: 13px; margin-top: 2px; }
    .dd-total b { font-size: 22px; white-space: normal; text-align: right; }
    .dd-total b small { font-size: 14px; }
    .dd-total span { font-size: 11px; }
    #dd-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
    #dd-pills::-webkit-scrollbar { display: none; }
    .dd-pill { white-space: nowrap; padding: 3px 8px; font-size: 11px; }
    .dd-tabs { padding: 0 8px; overflow-x: auto; }
    .dd-tab { height: 40px; padding: 0 12px; }
    .dd-body { padding: 14px; }
    .dd-panel { gap: 14px; }
    .dd-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dd-foot { padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
    .dd-askfield { flex: 1 1 100%; height: 40px; }
    .dd-foot .btn { flex: 1 1 auto; min-height: 40px; }
}
@media print {
    body.dd-printing .app-container, body.dd-printing .dd-scrim, body.dd-printing .dd-tabs, body.dd-printing .dd-foot, body.dd-printing .dd-icons { display: none !important; }
    body.dd-printing, body.dd-printing html { height: auto !important; overflow: visible !important; }
    body.dd-printing .dd { position: static; width: auto; transform: none; box-shadow: none; }
    body.dd-printing .dd-body { overflow: visible; background: none; }
    body.dd-printing .dd-panel[hidden] { display: none; }
}

/* hidden styleguide page (?page=styleguide) */
.sg-section { margin-bottom: 36px; }
.sg-section > h2 { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.sg-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 20px; }

/* ---------------------------------------------------------------------------
   "Tok dat" panel (includes/flow.php, spec redesign/TOK-DAT-REDESIGN.md): one panel per integration, one row per
   entity, four columns ERP | fronta | platforma | stav. Column positions never change, arrows carry the direction.
   Cards are links (queue / run log). Colours only via tokens: graphite = --hero, lime on white = --link.
   --------------------------------------------------------------------------- */
.flow-grid { display: flex; flex-direction: column; gap: 20px; }
.ig-view-toggle { display: inline-flex; }
.tokdat { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); }
.tokdat__head { min-height: 64px; padding: 12px 32px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; background: var(--hero); }
.tokdat__head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--on-hero); }
.tokdat__sub { flex: 1 1 auto; font-family: var(--font-mono); font-size: 12px; color: var(--side-muted); }
.tokdat__head a { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.tokdat__head a:hover { opacity: 1; text-decoration: underline; }
.tokdat__body { padding: 20px 32px 16px; }
.tokdat__cols, .tokdat__row { display: grid; grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr) 92px minmax(0, 1fr) 92px minmax(0, 1fr); align-items: center; }
.tokdat__cols { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.tokdat__cols span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tokdat__row { margin-top: 28px; }
.tokdat__rowlabel { grid-column: 1 / -1; font-size: 15px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.tokdat__rowlabel span { font-weight: 400; color: var(--muted); }
.tokdat__empty { font-size: 13px; color: var(--muted); padding: 24px 0 8px; text-align: center; }
.tokdat__empty a { color: var(--link); font-weight: 600; }
.tk-card { height: 64px; box-sizing: border-box; min-width: 0; padding: 10px 16px; display: flex; flex-direction: column; justify-content: center; gap: 0;
    border: 1px solid var(--border); background: var(--surface); line-height: 18px; text-decoration: none; color: var(--muted); }
.tk-card b { font-size: 16px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-card span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-card.is-active { border-color: var(--hero); }
[data-theme="dark"] .tk-card.is-active { border-color: var(--text-2); }
.tk-card.is-active b { color: var(--text); }
a.tk-card:hover { background: var(--input); opacity: 1; }
.tk-card--queue { background: var(--surface-2); }
.tk-card--status { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; }
.tk-card__text { display: flex; flex-direction: column; min-width: 0; }
.tk-card--status b { font-family: var(--font-body); font-size: 14px; }
.tk-dot { display: inline-block; width: 10px; height: 10px; flex: 0 0 auto; background: var(--neu-dot); }
.tk-status--ok { border-color: var(--link); } .tk-status--ok b, .tk-status--ok .tk-dot { color: var(--link); background: var(--link); }
.tk-status--wait { border-color: var(--warn-fg); } .tk-status--wait b, .tk-status--wait .tk-dot { color: var(--warn-fg); background: var(--warn-fg); }
.tk-status--error { border-color: var(--err-dot); } .tk-status--error b, .tk-status--error .tk-dot { color: var(--err-fg); background: var(--err-dot); }
.tk-status--idle .tk-dot { background: var(--neu-dot); }
.tk-card--status b { background: transparent !important; }
.tk-arrow { width: 92px; height: 8px; display: block; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tk-arrow path:last-child { stroke: none; }
.tk-arrow--ok { stroke: var(--link); } .tk-arrow--ok path:last-child { fill: var(--link); }
.tk-arrow--idle { stroke: var(--neu-dot); } .tk-arrow--idle path:first-child { stroke-dasharray: 6 6; } .tk-arrow--idle path:last-child { fill: var(--neu-dot); }
.tk-arrow--error { stroke: var(--err-dot); } .tk-arrow--error path:last-child { fill: var(--err-dot); }
.tk-arrow--left { transform: scaleX(-1); }
.tokdat__gap { display: block; width: 92px; height: 8px; }
.tk-sep { width: 1px; height: 64px; background: var(--line); justify-self: center; }
.tokdat__foot { margin: 20px 32px 0; padding: 16px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 20px; font-size: 12px; color: var(--muted); }
.tk-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.tk-legend li { display: flex; align-items: center; gap: 6px; }
.tk-dot--ok { background: var(--link); } .tk-dot--wait { background: var(--warn-fg); } .tk-dot--error { background: var(--err-dot); } .tk-dot--idle { background: var(--neu-dot); }
.tokdat__meta { font-family: var(--font-mono); }
.tokdat__meta a { color: var(--link); font-weight: 600; text-decoration: none; }
@media (max-width: 900px) {
    .tokdat__head, .tokdat__body { padding-left: 16px; padding-right: 16px; }
    .tokdat__foot { margin-left: 16px; margin-right: 16px; }
    .tokdat__cols { display: none; }
    .tokdat__row { grid-template-columns: minmax(0, 1fr); }
    .tk-arrow, .tokdat__gap { transform: rotate(90deg); justify-self: center; margin: 42px 0; }
    .tk-arrow--left { transform: rotate(-90deg); }
    .tk-sep { width: 100%; height: 1px; margin: 12px 0; }
}

/* custom (meta) fields: drawer card (includes/custom_fields.php) and list cells */
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px 14px; }
.cf-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cf-field .form-input, .cf-field .form-select { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.cf-actions { display: flex; gap: 8px; align-items: center; }
td.col-cf { color: var(--text); }

/* Vlastní přehledy (pages/views.php, pages/view.php) */
.vw-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.vw-list { display: flex; flex-direction: column; gap: 20px; }
.vw-empty { padding: 18px 20px; font-size: 13px; color: var(--muted); }
.vw-group { padding: 10px 18px 4px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.vw-item { display: flex; align-items: stretch; border-top: 1px solid var(--line); }
.vw-item.active { background: var(--accent-soft); }
.vw-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 18px; text-decoration: none; color: var(--text); }
.vw-item-main:hover { background: var(--input); opacity: 1; }
.vw-item-name { font-weight: 600; }
.vw-item-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-item-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.vw-item-edit { display: flex; align-items: center; padding: 0 14px; color: var(--muted); }
.vw-item-edit:hover { color: var(--text); opacity: 1; }
.vw-builder .au-rail { margin: 0; }
.vw-builder .au-rail-body { background: var(--surface-2); }
.vw-ask { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.vw-ask textarea { flex: 1 1 320px; }
.vw-rule { margin-bottom: 8px; }
.vw-rule .form-select, .vw-rule .form-input { min-height: 36px; }
.vw-rule .vw-field { max-width: 260px; }
.vw-rule .vw-op { max-width: 170px; }
.vw-values { display: inline-flex; gap: 8px; align-items: center; flex: 1 1 200px; min-width: 0; }
.vw-values .form-input, .vw-values .form-select { max-width: 240px; }
.vw-summary { margin: -8px 0 14px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vw-summary a { color: var(--link); font-weight: 600; }
.hidden { display: none !important; }
@media (max-width: 960px) { .vw-layout { grid-template-columns: 1fr; } }

/* export modal (#exportModal) */
.exp-check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0 0; cursor: pointer; }
.exp-check input { width: 16px; height: 16px; margin: 0; }
.exp-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
#exportModal .seg-ctl > button { min-width: 64px; justify-content: center; }
#exportModal .m-collapse { margin-top: 8px; }

/* embed (iframe) shell: no sidebar / top bar (includes/embed.php, Template::appHeader) */
body.embed-page .app-container { min-height: 100vh; }
body.embed-page .app-main { width: 100%; }
body.embed-page .content { padding: 16px; }
body.embed-page .page-title { font-size: 28px; }

/* ERP direct connection form (includes/erp_connect.php): company field with its list button, test row */
.erp-company-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.erp-company-row .form-input, .erp-company-row .form-select { flex: 1 1 240px; }
.erp-company-note { flex: 1 1 100%; }
.erp-direct-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
