/* ====================================================================
 *  LiliWeb — Fluent / Windows 11 design system
 * ====================================================================
 *  Globální styly, které doplňují Tailwind utility:
 *    - Mica-like pozadí (jemný gradient, teplejší šedá)
 *    - Subtle scrollbars
 *    - FluentEase animace
 *    - Reveal highlight na hover
 *    - Focus-ring ve Windows stylu
 * ==================================================================== */

/* ════════════════════════════════════════════════════════════════════
 *  Global SVG safety net
 * ════════════════════════════════════════════════════════════════════
 *  SVG bez explicitní šířky/výšky může se v některých kontextech
 *  natáhnout na 100 % rodiče. Default bbox z viewBox (24×24) zaručíme
 *  CSS fallbackem — pro všechny SVG, které nemají Tailwind w-*/h-*
 *  utility třídu. Je to bezpečný ceiling.
 * ════════════════════════════════════════════════════════════════════ */
svg:not([class*=" w-"]):not([class^="w-"]):not([class*=" h-"]):not([class^="h-"]) {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

:root {
    --fluent-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --fluent-duration: 200ms;

    /* ── Světlý režim (default) ── */
    --fluent-accent:       #0078D4;
    --fluent-accent-hover: #106EBE;
    --fluent-accent-soft:  rgba(0, 120, 212, 0.10);

    --bg-app:       #F3F3F3;       /* aplikační pozadí (pod sidebarem/content) */
    --bg-sidebar:   #F3F3F3;       /* sidebar bg */
    --bg-content:   #F6F7F9;       /* main content area pod admin layout (Shopify-like) */
    --bg-card:      #FFFFFF;       /* karty, content area */
    --bg-hover:     rgba(0,0,0,0.04);
    --bg-active:    rgba(0,0,0,0.06);
    --bg-input:     #FFFFFF;
    --bg-topbar:    rgba(255,255,255,0.80);

    --border-subtle:  #EBEBEB;     /* jemné oddělovače */
    --border-default: #E0E0E0;     /* běžné bordery */
    --border-strong:  #D1D1D1;     /* hover/focus bordery */

    --text-primary:   #1F1F1F;
    --text-secondary: #5C5C5C;
    --text-tertiary:  #8A8A8A;
    --text-muted:     #9E9E9E;

    --shadow-fluent-sm:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-fluent:     0 2px 4px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-fluent-md:  0 4px 8px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.08);
    --shadow-fluent-lg:  0 8px 16px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.08);
}

html.dark {
    /* ── Tmavý režim ── */
    --fluent-accent:       #4B9CD3;   /* sytější modrá — čitelnější na tmavém */
    --fluent-accent-hover: #60B0E0;
    --fluent-accent-soft:  rgba(75, 156, 211, 0.15);

    --bg-app:       #1A1A1A;
    --bg-sidebar:   #1F1F1F;
    --bg-content:   #181818;
    --bg-card:      #252525;
    --bg-hover:     rgba(255,255,255,0.06);
    --bg-active:    rgba(255,255,255,0.09);
    --bg-input:     #2B2B2B;
    --bg-topbar:    rgba(31,31,31,0.80);

    --border-subtle:  #2E2E2E;
    --border-default: #3A3A3A;
    --border-strong:  #4A4A4A;

    --text-primary:   #F4F4F4;
    --text-secondary: #BDBDBD;
    --text-tertiary:  #8E8E8E;
    --text-muted:     #6E6E6E;

    --shadow-fluent-sm:  0 1px 2px rgba(0,0,0,0.4);
    --shadow-fluent:     0 2px 4px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
    --shadow-fluent-md:  0 4px 8px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.55);
    --shadow-fluent-lg:  0 8px 16px rgba(0,0,0,0.50), 0 2px 4px rgba(0,0,0,0.60);
    color-scheme: dark;
}

/* ─── Mica background pro aplikační layouty ─────────────────────────── */
.mica-bg {
    background-color: var(--bg-app);
    background-image:
        radial-gradient(ellipse 1200px 600px at 85% 0%, var(--fluent-accent-soft), transparent 55%),
        radial-gradient(ellipse 900px 500px at 10% 100%, var(--fluent-accent-soft), transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
}

/* ─── Sidebar - sytě tmavě modrá (Stripe deep navy) ─────────────── */
.mica-sidebar {
    background-color: #0A2540;
    background-image: linear-gradient(180deg, #0E2C4D 0%, #081D33 100%);
    border-right: 1px solid #1A3458;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
    --sb-text:        #F1F5FB;
    --sb-text-muted:  #B4C4DC;
    --sb-text-dim:    #8AA0BF;
    --sb-hover:       rgba(255, 255, 255, 0.08);
    --sb-active-bg:   rgba(96, 165, 250, 0.22);
    --sb-active-fg:   #93C5FD;
    --sb-border:      rgba(255, 255, 255, 0.08);
    --sb-input-bg:    rgba(255, 255, 255, 0.07);
    --sb-input-border: rgba(255, 255, 255, 0.12);
}

/* Workspace switcher (Lili System logo) */
.mica-sidebar > div:first-child > a {
    color: var(--sb-text);
}
.mica-sidebar > div:first-child > a:hover {
    background: var(--sb-hover) !important;
}
.mica-sidebar > div:first-child > a > span:nth-child(2) {
    color: var(--sb-text);
}

/* Sidebar search input - tmavé pozadí, světlý text */
#sidebar-search {
    background-color: var(--sb-input-bg) !important;
    border-color: var(--sb-input-border) !important;
    color: var(--sb-text) !important;
}
#sidebar-search::placeholder { color: var(--sb-text-dim) !important; }
#sidebar-search:focus {
    background-color: rgba(255, 255, 255, 0.10) !important;
    border-color: var(--sb-active-fg) !important;
    box-shadow: 0 0 0 1px var(--sb-active-fg) !important;
}
.mica-sidebar kbd {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: var(--sb-text-muted) !important;
}
.mica-sidebar svg.text-ink-400 { color: var(--sb-text-dim) !important; }

/* Bottom user profile card */
.mica-sidebar > div:last-child {
    border-top-color: var(--sb-border) !important;
}
.mica-sidebar > div:last-child summary:hover {
    background: var(--sb-hover) !important;
}
.mica-sidebar > div:last-child summary > span:nth-child(2) span {
    color: var(--sb-text);
}
.mica-sidebar > div:last-child summary > span:nth-child(2) span:last-child {
    color: var(--sb-text-dim) !important;
}
.mica-sidebar > div:last-child summary svg {
    color: var(--sb-text-dim) !important;
}

/* User dropdown popup zůstává světlý (lépe čitelný) - kotvený nad tmavým */
.mica-sidebar > div:last-child details[open] > div {
    background: #FFFFFF !important;
    border-color: #E5E5E5 !important;
}

/* ─── Admin main content area ───────────────────────────────────────── */
.admin-main {
    background-color: var(--bg-content);
    /* Velmi jemný gradient na pozadí — víceúrovňová hloubka */
    background-image: radial-gradient(
        ellipse 1400px 700px at 100% 0%,
        rgba(0, 120, 212, 0.025),
        transparent 60%
    );
}
html.dark .admin-main {
    background-image: radial-gradient(
        ellipse 1400px 700px at 100% 0%,
        rgba(75, 156, 211, 0.06),
        transparent 60%
    );
}
.admin-main-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 20px 64px;
}
@media (min-width: 1024px) {
    .admin-main-inner {
        padding: 28px 32px 80px;
    }
}

/* ─── Subtle scrollbar ─────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: #C1C1C1 transparent;
}
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: #C1C1C1;
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
    background-color: #A0A0A0;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* ─── Body a typografie ────────────────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-variation-settings: normal;
}

/* ─── Reveal highlight — subtle glow na hover u klikatelných prvků ── */
.reveal {
    position: relative;
    overflow: hidden;
}
.reveal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle 80px at var(--mx, 50%) var(--my, 50%),
                                rgba(0, 120, 212, 0.08),
                                transparent 70%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--fluent-duration) var(--fluent-ease);
}
.reveal:hover::before {
    opacity: 1;
}

/* ─── Cards — jemný stín, čistý border, měkký radius ─────────────── */
.fluent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    transition: box-shadow var(--fluent-duration) var(--fluent-ease),
                border-color var(--fluent-duration) var(--fluent-ease);
}
.fluent-card-hover:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-fluent-md);
}

/* ─── Buttons — Fluent style ──────────────────────────────────────── */
.btn-fluent-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1rem;           /* 9px 16px */
    background-color: var(--fluent-accent);
    color: #FFFFFF;
    border-radius: 4px;                 /* Win11 tlačítka mají 4px, ne 8 */
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25;
    border: 1px solid var(--fluent-accent);
    transition: all 100ms var(--fluent-ease);
    cursor: pointer;
}
.btn-fluent-primary:hover {
    background-color: var(--fluent-accent-hover);
    border-color: var(--fluent-accent-hover);
    box-shadow: 0 1px 2px rgba(0,120,212,0.3);
}
.btn-fluent-primary:active {
    background-color: #005A9E;
    transform: translateY(1px);
}

.btn-fluent-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1rem;
    background-color: #FFFFFF;
    color: #1F1F1F;
    border: 1px solid #D1D1D1;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 100ms var(--fluent-ease);
    cursor: pointer;
}
.btn-fluent-secondary:hover {
    background-color: #F5F5F5;
    border-color: #B5B5B5;
}

/* ─── Focus-ring — Windows 11 styl (outline offset) ────────────────── */
*:focus-visible {
    outline: 2px solid #1F1F1F;
    outline-offset: 2px;
    border-radius: 4px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
}
input:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 1px var(--fluent-accent);
    border-color: var(--fluent-accent);
}

/* ─── Sidebar group labels — Stripe style: small, quiet, title case ── */
.nav-group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-tertiary);
    padding: 10px 8px 2px 8px;
    user-select: none;
    line-height: 1;
}
.nav-group-label:first-child { padding-top: 4px; }

/* ─── Sidebar collapsible groups — kategorie jako rozevírací sekce ── */
.nav-group {
    margin-top: 6px;
}
.nav-group:first-child { margin-top: 4px; }

.nav-group-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    user-select: none;
    line-height: 1;
    transition: background-color 80ms var(--fluent-ease);
}
.nav-group-summary::-webkit-details-marker { display: none; }
.nav-group-summary:hover {
    background-color: var(--bg-hover);
}
.nav-group-label-text {
    /* Sjednoceno s .nav-item — kategorie i odkazy mají stejnou velikost */
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-tertiary);
    text-transform: none;
    flex: 1 1 auto;
    line-height: 1;
}
.nav-group-summary:hover .nav-group-label-text {
    color: var(--text-secondary);
}
.nav-group-chevron {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    color: var(--text-muted);
    transition: transform 160ms var(--fluent-ease);
}
.nav-group[open] > .nav-group-summary .nav-group-chevron {
    transform: rotate(0deg);
}
.nav-group:not([open]) > .nav-group-summary .nav-group-chevron {
    transform: rotate(-90deg);
}

/* Vlastní items uvnitř rozbalené skupiny - jemný odstup od summary */
.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 2px;
}

/* Aktivní položka uvnitř sbalené skupiny - dot indicator vedle title */
.nav-group:not([open]) > .nav-group-summary::before {
    content: '';
    display: none;
}
.nav-group.has-active:not([open]) > .nav-group-summary {
    background-color: var(--bg-hover);
}
.nav-group.has-active:not([open]) > .nav-group-summary .nav-group-label-text {
    color: var(--fluent-accent);
    font-weight: 700;
}

/* Když je hledání aktivní, force-otevři všechny skupiny */
#sidebar-nav.is-searching .nav-group {
    /* Nech browser ignorovat closed state - rozbalíme přes JS atribut. */
}

/* ─── Sidebar nav-group v tmavém sidebaru ────────────────────────── */
.mica-sidebar .nav-group-summary:hover {
    background-color: var(--sb-hover);
}
.mica-sidebar .nav-group-label-text {
    color: var(--sb-text-dim);
}
.mica-sidebar .nav-group-summary:hover .nav-group-label-text {
    color: var(--sb-text);
}
.mica-sidebar .nav-group-chevron {
    color: var(--sb-text-dim);
}
.mica-sidebar .nav-group.has-active:not([open]) > .nav-group-summary {
    background-color: var(--sb-hover);
}
.mica-sidebar .nav-group.has-active:not([open]) > .nav-group-summary .nav-group-label-text {
    color: var(--sb-active-fg);
    font-weight: 700;
}

/* ─── Sidebar nav položky — Stripe / Linear density ──────────────── */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary);
    transition: background-color 80ms var(--fluent-ease), color 80ms var(--fluent-ease);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-item:hover {
    background-color: var(--bg-hover);
}
.nav-item.active {
    background-color: var(--fluent-accent-soft);
    color: var(--fluent-accent);
    font-weight: 500;
}
.nav-item.active:hover {
    background-color: var(--fluent-accent-soft);
    filter: brightness(0.95);
}
.nav-item svg {
    width: 14px !important;
    height: 14px !important;
    flex: 0 0 auto;
    color: var(--text-tertiary);
    transition: color 80ms var(--fluent-ease);
}
.nav-item:hover svg { color: var(--text-secondary); }
.nav-item.active svg { color: var(--fluent-accent); }

/* ─── Sidebar varianta - tmavě modrá (přepíše barvy v .mica-sidebar) ─ */
.mica-sidebar .nav-item {
    color: var(--sb-text);
}
.mica-sidebar .nav-item:hover {
    background-color: var(--sb-hover);
    color: #FFFFFF;
}
.mica-sidebar .nav-item.active {
    background-color: var(--sb-active-bg);
    color: var(--sb-active-fg);
    font-weight: 500;
}
.mica-sidebar .nav-item.active:hover {
    background-color: var(--sb-active-bg);
    filter: brightness(1.1);
}
.mica-sidebar .nav-item svg {
    color: var(--sb-text-dim);
}
.mica-sidebar .nav-item:hover svg {
    color: var(--sb-text);
}
.mica-sidebar .nav-item.active svg {
    color: var(--sb-active-fg);
}

/* Profile dropdown UVNITŘ sidebaru má světlé pozadí (.acrylic) — vrátit
   tmavé barvy textu, jinak by byl text neviditelný (světlý na světlém). */
.mica-sidebar .acrylic .nav-item {
    color: var(--text-primary);
}
.mica-sidebar .acrylic .nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}
.mica-sidebar .acrylic .nav-item svg {
    color: var(--text-tertiary);
}
.mica-sidebar .acrylic .nav-item:hover svg {
    color: var(--text-secondary);
}
/* Logout položka v dropdownu — červená barva má prioritu */
.mica-sidebar .acrylic .nav-item.text-red-600,
.mica-sidebar .acrylic .nav-item.text-red-600 svg {
    color: #DC2626;
}
.mica-sidebar .acrylic .nav-item.text-red-600:hover {
    background-color: #FEF2F2;
    color: #DC2626;
}

/* ─── Sidebar search — search by Cmd+K shortcut ─────────────────── */
#sidebar-search::placeholder {
    color: #9E9E9E;
}
.nav-item.hidden-by-search,
.nav-group.hidden-by-search,
.nav-group-label.hidden-by-search {
    display: none;
}

/* ─── User dropdown — překrývá se sidebarem, elevated ─────────────── */
details[open] > summary > svg:last-child {
    transform: rotate(180deg);
    transition: transform 150ms var(--fluent-ease);
}
details > summary > svg:last-child {
    transition: transform 150ms var(--fluent-ease);
}

/* ─── Theme switcher options ─────────────────────────────────────── */
.theme-option {
    border: 1px solid transparent;
    color: var(--text-secondary);
}
.theme-option.active {
    background: var(--fluent-accent-soft);
    color: var(--fluent-accent);
    border-color: var(--fluent-accent-soft);
}
.theme-option:not(.active):hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ─── Tabulky — čitelné, jemné linky ──────────────────────────────── */
.fluent-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5C5C5C;
    background: #FAFAFA;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #EBEBEB;
}
.fluent-table tbody tr {
    transition: background-color 100ms var(--fluent-ease);
}
.fluent-table tbody tr:hover {
    background-color: #F9F9F9;
}
.fluent-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #F1F1F1;
    font-size: 0.875rem;
}

/* ─── Utility: Win11 specific ─────────────────────────────────────── */
.acrylic {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.text-title-1 { font-size: 2rem;     line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.text-title-2 { font-size: 1.5rem;   line-height: 1.2;  font-weight: 700; letter-spacing: -0.01em; }
.text-title-3 { font-size: 1.25rem;  line-height: 1.25; font-weight: 600; }
.text-body    { font-size: 0.875rem; line-height: 1.5;  font-weight: 400; }
.text-caption { font-size: 0.75rem;  line-height: 1.4;  font-weight: 400; color: #5C5C5C; }

/* ─── Flash messages — informační banner ──────────────────────────── */
.flash-bar {
    border-left: 3px solid currentColor;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* ─── Legacy overrides — soft-land staré třídy do Fluent estetiky ── */
.bg-gradient-to-br.from-brand-500.to-accent-500,
.bg-gradient-to-br.from-brand-500.to-accent-400,
.bg-gradient-to-br.from-brand-600.to-accent-500 {
    background: linear-gradient(135deg, #0078D4 0%, #005A9E 100%) !important;
}
.bg-brand-600, .hover\:bg-brand-600:hover { background-color: #106EBE !important; }
.bg-brand-700, .hover\:bg-brand-700:hover { background-color: #005A9E !important; }
.shadow-xl { box-shadow: var(--shadow-fluent-lg) !important; }
.shadow-2xl { box-shadow: var(--shadow-fluent-lg) !important; }
.shadow-lg { box-shadow: var(--shadow-fluent-md) !important; }
.rounded-2xl { border-radius: 12px !important; }
.bg-ink-950 { background-color: #1F1F1F !important; }

/* ════════════════════════════════════════════════════════════════════
 *  DARK MODE — override pro existující Tailwind třídy
 *  (aby staré views "just work" bez individuálního refactoru)
 * ════════════════════════════════════════════════════════════════════ */
html.dark body { color: var(--text-primary); }

/* Backgrounds */
html.dark .bg-white              { background-color: var(--bg-card) !important; }
html.dark .bg-white\/80          { background-color: rgba(37,37,37,0.80) !important; }
html.dark .bg-white\/70          { background-color: rgba(37,37,37,0.70) !important; }
html.dark .bg-ink-50             { background-color: #1E1E1E !important; }
html.dark .bg-ink-100            { background-color: #2A2A2A !important; }
html.dark .bg-ink-200            { background-color: #333333 !important; }
html.dark .bg-\[\#FAFAFA\]       { background-color: #1E1E1E !important; }
html.dark .bg-\[\#F9F9F9\]       { background-color: #222 !important; }
html.dark .bg-\[\#F5F5F5\]       { background-color: #2A2A2A !important; }
html.dark .bg-\[\#EDEDED\]       { background-color: #2E2E2E !important; }

/* Text */
html.dark .text-ink-900          { color: var(--text-primary) !important; }
html.dark .text-ink-800          { color: #DDDDDD !important; }
html.dark .text-ink-700          { color: #C5C5C5 !important; }
html.dark .text-ink-600          { color: var(--text-secondary) !important; }
html.dark .text-ink-500          { color: var(--text-tertiary) !important; }
html.dark .text-ink-400          { color: var(--text-muted) !important; }
html.dark .text-ink-300          { color: #6E6E6E !important; }

/* Borders */
html.dark .border-ink-100        { border-color: var(--border-subtle) !important; }
html.dark .border-ink-200        { border-color: var(--border-default) !important; }
html.dark .border-ink-300        { border-color: var(--border-strong) !important; }
html.dark .border-\[\#EBEBEB\]   { border-color: var(--border-subtle) !important; }
html.dark .border-\[\#E5E5E5\]   { border-color: var(--border-subtle) !important; }
html.dark .border-\[\#E0E0E0\]   { border-color: var(--border-default) !important; }
html.dark .border-\[\#D1D1D1\]   { border-color: var(--border-strong) !important; }

/* Divides */
html.dark .divide-ink-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-\[\#EBEBEB\] > :not([hidden]) ~ :not([hidden]),
html.dark .divide-\[\#F1F1F1\] > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--border-subtle) !important;
}

/* Hover states */
html.dark .hover\:bg-ink-50:hover       { background-color: rgba(255,255,255,0.04) !important; }
html.dark .hover\:bg-ink-100:hover      { background-color: rgba(255,255,255,0.06) !important; }
html.dark .hover\:bg-\[\#EDEDED\]:hover { background-color: rgba(255,255,255,0.06) !important; }

/* Inputs & form fields */
html.dark input:not([type=checkbox]):not([type=radio]),
html.dark textarea,
html.dark select {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-default);
}
html.dark input::placeholder,
html.dark textarea::placeholder { color: var(--text-muted); }

/* Status badges — dim dark varianty */
html.dark .bg-emerald-50  { background-color: rgba(16,185,129,0.12) !important; }
html.dark .bg-emerald-100 { background-color: rgba(16,185,129,0.18) !important; }
html.dark .text-emerald-500 { color: #34D399 !important; }
html.dark .text-emerald-600 { color: #34D399 !important; }
html.dark .text-emerald-700 { color: #6EE7B7 !important; }
html.dark .text-emerald-800 { color: #A7F3D0 !important; }
html.dark .text-emerald-900 { color: #D1FAE5 !important; }
html.dark .border-emerald-200 { border-color: rgba(16,185,129,0.3) !important; }
html.dark .border-emerald-400 { border-color: #10B981 !important; }

html.dark .bg-amber-50  { background-color: rgba(245,158,11,0.12) !important; }
html.dark .bg-amber-100 { background-color: rgba(245,158,11,0.18) !important; }
html.dark .text-amber-500 { color: #FBBF24 !important; }
html.dark .text-amber-600 { color: #FBBF24 !important; }
html.dark .text-amber-700 { color: #FCD34D !important; }
html.dark .text-amber-800 { color: #FDE68A !important; }
html.dark .text-amber-900 { color: #FEF3C7 !important; }
html.dark .border-amber-200 { border-color: rgba(245,158,11,0.3) !important; }
html.dark .border-amber-400 { border-color: #F59E0B !important; }

html.dark .bg-red-50  { background-color: rgba(239,68,68,0.12) !important; }
html.dark .bg-red-100 { background-color: rgba(239,68,68,0.18) !important; }
html.dark .text-red-500 { color: #F87171 !important; }
html.dark .text-red-600 { color: #F87171 !important; }
html.dark .text-red-700 { color: #FCA5A5 !important; }
html.dark .text-red-800 { color: #FECACA !important; }
html.dark .text-red-900 { color: #FEE2E2 !important; }
html.dark .border-red-200 { border-color: rgba(239,68,68,0.3) !important; }
html.dark .border-red-400 { border-color: #EF4444 !important; }

html.dark .bg-fluent-50  { background-color: rgba(75,156,211,0.14) !important; }
html.dark .bg-fluent-100 { background-color: rgba(75,156,211,0.20) !important; }
html.dark .text-fluent-500 { color: #60B0E0 !important; }
html.dark .text-fluent-600, html.dark .text-fluent-700, html.dark .text-fluent-800 { color: #60B0E0 !important; }
html.dark .border-fluent-200 { border-color: rgba(75,156,211,0.3) !important; }
html.dark .border-fluent-400 { border-color: #4B9CD3 !important; }

/* Orange (používáme výjimečně na 31-60 dní aging) */
html.dark .bg-orange-50 { background-color: rgba(249,115,22,0.12) !important; }
html.dark .text-orange-700 { color: #FDBA74 !important; }

/* Legacy brand / accent color třídy ze staršího stylu — některé views je stále mají */
html.dark .bg-brand-50  { background-color: rgba(75,156,211,0.14) !important; }
html.dark .bg-brand-100 { background-color: rgba(75,156,211,0.20) !important; }
html.dark .bg-brand-200 { background-color: rgba(75,156,211,0.25) !important; }
html.dark .text-brand-500,
html.dark .text-brand-600,
html.dark .text-brand-700,
html.dark .text-brand-800,
html.dark .text-brand-900 { color: #60B0E0 !important; }
html.dark .border-brand-200 { border-color: rgba(75,156,211,0.3) !important; }

html.dark .bg-accent-50  { background-color: rgba(225,29,72,0.12) !important; }
html.dark .bg-accent-100 { background-color: rgba(225,29,72,0.18) !important; }
html.dark .text-accent-600,
html.dark .text-accent-700 { color: #FB7185 !important; }

html.dark .bg-slate-100 { background-color: rgba(148,163,184,0.15) !important; }
html.dark .text-slate-700 { color: #CBD5E1 !important; }

/* Peer-checked:bg-white toggle (orders/new radio switch) */
html.dark .peer:checked ~ .peer-checked\:bg-white {
    background-color: var(--bg-card) !important;
}
html.dark .peer:checked ~ .peer-checked\:text-ink-900 {
    color: var(--text-primary) !important;
}

/* Arbitrary slash-opacity varianty (bg-amber-50/30, bg-fluent-50/40, …) —
   Tailwind je generuje jako samostatné třídy, které nezachytí .bg-amber-50 */
html.dark .bg-amber-50\/20,
html.dark .bg-amber-50\/30,
html.dark .bg-amber-50\/40,
html.dark .bg-amber-50\/50 { background-color: rgba(245,158,11,0.10) !important; }

html.dark .bg-emerald-50\/20,
html.dark .bg-emerald-50\/30,
html.dark .bg-emerald-50\/40,
html.dark .bg-emerald-50\/50 { background-color: rgba(16,185,129,0.10) !important; }

html.dark .bg-red-50\/20,
html.dark .bg-red-50\/30,
html.dark .bg-red-50\/40 { background-color: rgba(239,68,68,0.10) !important; }

html.dark .bg-fluent-50\/20,
html.dark .bg-fluent-50\/30,
html.dark .bg-fluent-50\/40,
html.dark .bg-fluent-50\/50 { background-color: rgba(75,156,211,0.12) !important; }

html.dark .bg-brand-50\/30,
html.dark .bg-brand-50\/40 { background-color: rgba(75,156,211,0.12) !important; }

html.dark .bg-ink-50\/30,
html.dark .bg-ink-50\/40,
html.dark .bg-ink-50\/50 { background-color: rgba(255,255,255,0.04) !important; }

/* Placeholder thumbnail gradient (products list) */
html.dark .from-ink-50 { --tw-gradient-from: #1E1E1E var(--tw-gradient-from-position) !important; }
html.dark .to-ink-100 { --tw-gradient-to: #2A2A2A var(--tw-gradient-to-position) !important; }

/* Mica gradient headings — příliš pastelové v dark mode */
html.dark .bg-gradient-to-b.from-ink-50 { background: transparent !important; }

/* ════════════════════════════════════════════════════════════════════
 *  Unified component utilities — používejte v nových views
 * ════════════════════════════════════════════════════════════════════ */

/* Page header — h1 + subtitle + right actions (moderní Shopify-style) */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    padding-bottom: 0;
    border-bottom: 0;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--fluent-accent-soft);
    color: var(--fluent-accent);
    flex: 0 0 auto;
}
.page-title-icon svg,
.page-title > svg {
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 auto;
}
.page-title > svg { color: var(--fluent-accent); }
.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.45;
    margin-left: 48px; /* zarovnat se začátkem textu (ikona + gap) */
}
.page-header > div:first-child > .page-subtitle:only-child,
.page-header .page-title:not(:has(.page-title-icon)) + .page-subtitle {
    margin-left: 0;
}

/* Card s headerem - vystupuje z šedavého page pozadí */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.05);
}
html.dark .card {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.35), 0 1px 3px 0 rgba(0, 0, 0, 0.40);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    min-height: 48px;
    background: linear-gradient(180deg, #FAFBFC 0%, #FFFFFF 100%);
}
html.dark .card-header {
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}
.card-header h2,
.card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.card-header h2 svg,
.card-header h3 svg {
    width: 14px;
    height: 14px;
    color: var(--fluent-accent);
    background: var(--fluent-accent-soft);
    padding: 6px;
    box-sizing: content-box;
    border-radius: 7px;
    flex: 0 0 auto;
}
.card-body { padding: 18px; }
.card-body-tight { padding: 12px 18px; }

/* Buttons — Fluent primary/secondary/danger */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 100ms var(--fluent-ease);
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1;
}
.btn svg { width: 13px; height: 13px; flex: 0 0 auto; }
.btn-primary {
    background: var(--fluent-accent);
    color: #FFFFFF;
    border-color: var(--fluent-accent);
}
.btn-primary:hover {
    background: var(--fluent-accent-hover);
    border-color: var(--fluent-accent-hover);
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
    border-color: #DC2626;
}
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* Table — Stripe-style, čistá a vzdušná */
.table-fluent { width: 100%; border-collapse: collapse; }
.table-fluent thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: #FAFBFC;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    white-space: nowrap;
}
html.dark .table-fluent thead th {
    background: rgba(255, 255, 255, 0.03);
}
.table-fluent tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.45;
    vertical-align: top;
}
.table-fluent tbody tr:hover { background: var(--bg-hover); }
.table-fluent tbody tr:last-child td { border-bottom: none; }

/* Tfoot — řádky se součty (Bez DPH / DPH / Celkem)
   Pravidlo: tfoot součty jsou MENŠÍ než body items (12px), grand celkem
   je výrazný (14/15px). Tím vznikne jasná hierarchie: items → mezisoučty
   → celkem. */
.table-fluent tfoot td {
    padding: 6px 16px;
    font-size: 12px;
    border: 0;
    line-height: 1.4;
}
.table-fluent tfoot tr:first-child td { padding-top: 12px; }
.table-fluent tfoot tr td:not(:last-child) {
    color: var(--text-tertiary);
    font-weight: 500;
}
.table-fluent tfoot tr td:last-child {
    color: var(--text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.table-fluent tfoot tr.totals-grand td {
    padding-top: 12px;
    padding-bottom: 16px;
    border-top: 1px solid var(--border-default);
    font-size: 13px;
}
.table-fluent tfoot tr.totals-grand td:first-child {
    color: var(--text-primary);
    font-weight: 700;
}
.table-fluent tfoot tr.totals-grand td:last-child {
    color: var(--fluent-accent);
    font-weight: 700;
    font-size: 15px;
}

/* ─── Detail list — sjednocené <dl> bloky v sidebar kartách ─────────
   Hierarchie:
     1. card-header h3   = nadpis sekce (14px, 700)
     2. detail-list dt   = LABEL (10.5px UPPERCASE 0.05em, tlumený)
     3. detail-list dd   = hodnota (13px, primary, 500)
   Tím je jasné co je nadpis, co label a co text. */
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    font-size: 13px;
}
.detail-list > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}
.detail-list > div > dt {
    flex: 0 0 auto;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}
.detail-list > div > dd {
    flex: 1 1 auto;
    margin: 0;
    text-align: right;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
    min-width: 0;
    font-size: 13px;
}
.detail-list > div > dd.dd-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 600;
}
.detail-list > div > dd.dd-muted {
    color: var(--text-secondary);
    font-weight: 400;
}
/* Stacked variant — pro delší texty (adresa, poznámka).
   Label nahoře MALÝ uppercase, hodnota dole jasně viditelná. */
.detail-list.detail-list-stacked > div {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
}
.detail-list.detail-list-stacked > div > dt {
    /* Stejně malý label jako u inline varianty */
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.detail-list.detail-list-stacked > div > dd {
    text-align: left;
    font-weight: 500;
}
/* Separator řádek - thin line uvnitř detail-list */
.detail-list > div.detail-list-separator {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 2px;
}

/* ════════════════════════════════════════════════════════════════════
 *  Command Palette — globální vyhledávání ⌘K
 * ════════════════════════════════════════════════════════════════════ */
.cp-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 16px 16px;
    opacity: 0;
    transition: opacity 140ms ease;
}
.cp-overlay.is-open {
    display: flex;
    opacity: 1;
}
.cp-modal {
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 96px);
    background: #FFFFFF;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.30),
                0 8px 16px -4px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-8px);
    opacity: 0;
    transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 140ms ease;
}
.cp-overlay.is-open .cp-modal {
    transform: translateY(0);
    opacity: 1;
}

/* Search header */
.cp-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    flex: 0 0 auto;
}
.cp-search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex: 0 0 auto;
}
.cp-search input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 16px;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.4;
}
.cp-search input::placeholder { color: var(--text-tertiary); }
.cp-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-default);
    border-top-color: var(--fluent-accent);
    border-radius: 50%;
    animation: cp-spin 600ms linear infinite;
    flex: 0 0 auto;
    display: none;
}
.cp-spinner.is-loading { display: block; }
@keyframes cp-spin { to { transform: rotate(360deg); } }
.cp-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    min-width: 22px;
    padding: 0 6px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-bottom-width: 2px;
    border-radius: 5px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1;
}

/* Filter chips - klik filtruje na typ */
.cp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-subtle);
    flex: 0 0 auto;
}
.cp-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border: 1px solid var(--border-subtle);
    background: #FFFFFF;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 500;
    border-radius: 999px;
    cursor: pointer;
    transition: all 100ms ease;
    white-space: nowrap;
}
.cp-filter:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.cp-filter.is-active {
    background: var(--fluent-accent);
    border-color: var(--fluent-accent);
    color: #FFFFFF;
}
.cp-filter-count {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.7;
}

/* Results scroller */
.cp-results {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 0 12px;
}
.cp-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-tertiary);
}
.cp-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.cp-empty-text { font-size: 13px; }

.cp-group { margin-top: 4px; }
.cp-group:first-child { margin-top: 0; }
.cp-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 6px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}
.cp-group-header-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cp-group-header-icon svg {
    width: 12px;
    height: 12px;
    color: var(--fluent-accent);
}
.cp-group-show-all {
    font-size: 11px;
    font-weight: 500;
    color: var(--fluent-accent);
    text-transform: none;
    letter-spacing: 0;
}
.cp-group-show-all:hover { text-decoration: underline; }

.cp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background-color 60ms ease;
    color: var(--text-primary);
    text-decoration: none;
}
.cp-item:hover,
.cp-item.is-selected {
    background: var(--fluent-accent-soft);
}
.cp-item.is-selected {
    box-shadow: inset 3px 0 0 var(--fluent-accent);
}
.cp-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.cp-item-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-item-title mark {
    background: rgba(0, 120, 212, 0.18);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
.cp-item-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-item-meta {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: right;
    line-height: 1.4;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-item-arrow {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
    flex: 0 0 auto;
    opacity: 0;
    transition: opacity 80ms ease;
}
.cp-item:hover .cp-item-arrow,
.cp-item.is-selected .cp-item-arrow { opacity: 1; }

/* Footer with hints */
.cp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 18px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-tertiary);
    background: #FAFBFC;
    flex: 0 0 auto;
}
.cp-footer-hints {
    display: flex;
    align-items: center;
    gap: 14px;
}
.cp-footer-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.cp-footer-hint .cp-kbd {
    height: 18px;
    min-width: 18px;
    padding: 0 4px;
    font-size: 10px;
}
.cp-footer-stats {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* Quick actions (empty state navrhy) */
.cp-quick-actions {
    padding: 8px 0 4px;
}
.cp-quick-action-label {
    padding: 10px 18px 6px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cp-quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 60ms ease;
}
.cp-quick-action:hover,
.cp-quick-action.is-selected {
    background: var(--fluent-accent-soft);
}
.cp-quick-action svg {
    width: 14px;
    height: 14px;
    color: var(--fluent-accent);
    flex: 0 0 auto;
}
.cp-quick-action-text {
    font-size: 13px;
    font-weight: 500;
}

/* Mobile: full-screen palette */
@media (max-width: 640px) {
    .cp-overlay { padding: 0; align-items: stretch; }
    .cp-modal {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
}

/* ─── Section label — samostatný label nad volným textem
   Použití: <div class="section-label">Zpráva</div><p>...</p>
   Stejný styl jako .detail-list dt (10.5px UPPERCASE), ale jako blok. */
.section-label,
.detail-list-stacked-header {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
    margin: 0 0 8px 0;
    display: block;
}

/* ─── Finance P&L tabulka — Výkaz zisku a ztráty
   Hierarchie:
     • body row     — primary řádek (Obrat, COGS) - 13px / 600
     • sub          — pod-řádek "z toho..." - 11.5px / 400 / tertiary, odsazený
     • section      — sekce s top borderem (COGS, OpEx)
     • subtotal     — mezisoučet (Hrubá marže) - 14/15px / 700
     • grand        — finální (Čistý zisk) - 15/18px / 700, accent */
.finance-pl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.finance-pl tbody td {
    padding: 9px 0;
    line-height: 1.4;
    vertical-align: baseline;
}
.finance-pl tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}
.finance-pl tbody td:last-child {
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
/* Sub-řádky (z toho ...) - menší, vnořené, tlumené */
.finance-pl tr.finance-pl-sub td {
    padding: 3px 0 !important;
    font-size: 11.5px;
    color: var(--text-tertiary) !important;
    font-weight: 400 !important;
    line-height: 1.3;
}
.finance-pl tr.finance-pl-sub td:first-child {
    padding-left: 24px !important;
    position: relative;
}
.finance-pl tr.finance-pl-sub td:first-child::before {
    content: "↳";
    position: absolute;
    left: 6px;
    top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}
.finance-pl tr.finance-pl-sub td:last-child {
    color: var(--text-tertiary) !important;
    font-weight: 500 !important;
    font-size: 11.5px;
}
/* Sekce (COGS, OpEx) - vyznačená border-top + extra padding */
.finance-pl tr.finance-pl-section td {
    padding-top: 16px !important;
    border-top: 1px solid var(--border-subtle);
}
/* Mezisoučty (Hrubá marže) - výraznější */
.finance-pl tr.finance-pl-subtotal td {
    padding: 12px 0 !important;
    border-top: 1px solid var(--border-default);
    font-weight: 700 !important;
    font-size: 13.5px;
}
.finance-pl tr.finance-pl-subtotal td:last-child {
    font-size: 15px;
}
/* Grand row (Čistý zisk) - finální zvýraznění */
.finance-pl tr.finance-pl-grand td {
    padding: 16px 0 6px !important;
    border-top: 2px solid var(--border-strong);
    font-weight: 700 !important;
}
.finance-pl tr.finance-pl-grand td:first-child {
    font-size: 15px;
}
.finance-pl tr.finance-pl-grand td:last-child {
    font-size: 18px;
    color: var(--fluent-accent);
}

/* ─── Stat card — KPI box (Počet nákladů, Celkem, atd.)
   Použití:
     <div class="stat-card">
         <div class="stat-card-label">Počet nákladů</div>
         <div class="stat-card-value">42</div>
         <div class="stat-card-sub">+5 oproti minulému měsíci</div>  // volitelné
     </div>
   Modifikátory na celý stat-card: .stat-card-success, .stat-card-warning, .stat-card-danger */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px 18px 18px;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
html.dark .stat-card {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.35), 0 1px 3px 0 rgba(0, 0, 0, 0.40);
}
.stat-card-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}
.stat-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.stat-card-sub {
    font-size: 11.5px;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin-top: 2px;
}
.stat-card-trend-up   { color: #047857; }
.stat-card-trend-down { color: #BE123C; }

/* Akcent varianty (zvýrazní hodnotu, label zůstává tlumený) */
.stat-card.stat-card-success .stat-card-value { color: #047857; }
.stat-card.stat-card-warning .stat-card-value { color: #B45309; }
.stat-card.stat-card-danger  .stat-card-value { color: #BE123C; }
.stat-card.stat-card-accent  .stat-card-value { color: var(--fluent-accent); }
html.dark .stat-card.stat-card-success .stat-card-value { color: #34D399; }
html.dark .stat-card.stat-card-warning .stat-card-value { color: #FBBF24; }
html.dark .stat-card.stat-card-danger  .stat-card-value { color: #FB7185; }

/* Responsive table wrapper */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Badges — menší a kompaktnější */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.5;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge-success { background: rgba(16,185,129,0.12); color: #047857; }
.badge-warning { background: rgba(245,158,11,0.14); color: #92400E; }
.badge-danger  { background: rgba(239,68,68,0.12); color: #B91C1C; }
.badge-info    { background: var(--fluent-accent-soft); color: var(--fluent-accent); }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); }
html.dark .badge-success { color: #34D399; }
html.dark .badge-warning { color: #FBBF24; }
html.dark .badge-danger  { color: #F87171; }

/* Input unified — kompaktní 30px density */
.input {
    display: block;
    width: 100%;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.2;
    transition: border-color 100ms var(--fluent-ease), box-shadow 100ms var(--fluent-ease);
}
.input:focus {
    outline: none;
    border-color: var(--fluent-accent);
    box-shadow: 0 0 0 1px var(--fluent-accent);
}
.input-sm { height: 26px; font-size: 12px; padding: 0 6px; }
textarea.input { height: auto; min-height: 60px; padding: 6px 8px; }
select.input { padding-right: 24px; }

.input-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    letter-spacing: 0.01em;
}

/* ─── Form layout utility ──────────────────────────────────────────
   Profesionální účetní systémy (Fakturoid, iDoklad) používají úzké
   formuláře s max-width ~720px. Ne roztahují inputy na celou stránku. */

/* ─── Form stack — vycentrovaný sloupec (Fakturoid style) ─────── */
.form-stack {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.form-stack-wide {
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Form layout — grid 1fr + sidebar (pro edit stránky s kontextem) ───
   Použití: wrapper grid, <form class="..."> + <aside>. Sidebar drží
   kontext — metadata, souhrn, nápověda, poslední záznamy.
   Na mobile (< lg) se sidebar přesune pod formulář. */
.form-layout,
.form-layout-wide {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}
.form-layout-wide {
    max-width: 1240px;
}
@media (min-width: 1024px) {
    .form-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
        gap: 20px;
    }
    .form-layout-wide {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}
.form-layout > form,
.form-layout-wide > form,
.form-layout > div,
.form-layout-wide > div {
    min-width: 0; /* brání přetečení inside gridu */
}
.form-layout-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@media (min-width: 1024px) {
    .form-layout-sidebar {
        position: sticky;
        top: 72px;  /* pod topbarem s padding */
        align-self: flex-start;
        max-height: calc(100vh - 96px);
        overflow-y: auto;
    }
}

/* Label a input vedle sebe (jako v Fakturoidu) */
.form-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    align-items: center;
    gap: 12px;
    min-height: 30px;
}
.form-row > label:first-child,
.form-row > .label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
    line-height: 1.3;
    padding-right: 4px;
}
.form-row > .hint,
.form-row > p {
    grid-column: 2;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* 2-sloupcový grid uvnitř form section (pro krátká pole vedle sebe) */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 14px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 14px;
}

/* Sekce uvnitř formuláře — typografický heading nad polem */
.form-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    padding: 12px 0 6px 0;
    margin-top: 8px;
    border-top: 1px solid var(--border-subtle);
}
.form-section-title:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

/* ════════════════════════════════════════════════════════════════════
 *  Raynet-style form (tradiční business CRM)
 *  — jasně oddělené fieldsety, labels nahoru, multi-column layout,
 *    hustá informační plocha, bez "magic" triků.
 * ════════════════════════════════════════════════════════════════════ */

.fieldset {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 22px 26px 24px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.05);
}
html.dark .fieldset {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.35), 0 1px 3px 0 rgba(0, 0, 0, 0.40);
}
.fieldset:last-child { margin-bottom: 0; }

.fieldset-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: -0.005em;
    color: var(--text-primary);
    padding: 0 0 14px;
    margin: 0 0 18px;
    border-bottom: 1px solid var(--border-subtle);
    line-height: 1.2;
    /* Reset výchozího <legend> chování (pluje nad borderem fieldsetu).
       float: left + width: 100% donutí prohlížeč chovat legend jako
       normální block element uvnitř fieldsetu. */
    float: left;
    width: 100%;
}
/* Bezpečnostní clear pro children fieldsetu (po floatovaném legend) */
.fieldset > .fieldset-title + * {
    clear: both;
}
/* Ikona dostane barevný badge box - vizuální kotva sekce */
.fieldset-title svg {
    width: 16px;
    height: 16px;
    color: var(--fluent-accent);
    background: var(--fluent-accent-soft);
    padding: 7px;
    box-sizing: content-box;
    border-radius: 8px;
    flex: 0 0 auto;
}
/* Akcentové varianty - sémantické barvy podle typu sekce.
   Použití: <legend class="fieldset-title accent-emerald"> apod. */
.fieldset-title.accent-emerald svg { color: #047857; background: rgba(16, 185, 129, 0.12); }
.fieldset-title.accent-amber   svg { color: #B45309; background: rgba(245, 158, 11, 0.14); }
.fieldset-title.accent-rose    svg { color: #BE123C; background: rgba(244, 63, 94, 0.12); }
.fieldset-title.accent-violet  svg { color: #6D28D9; background: rgba(139, 92, 246, 0.14); }
.fieldset-title.accent-slate   svg { color: #334155; background: rgba(71, 85, 105, 0.12); }
html.dark .fieldset-title.accent-emerald svg { color: #34D399; background: rgba(52, 211, 153, 0.16); }
html.dark .fieldset-title.accent-amber   svg { color: #FBBF24; background: rgba(251, 191, 36, 0.16); }
html.dark .fieldset-title.accent-rose    svg { color: #FB7185; background: rgba(251, 113, 133, 0.16); }
html.dark .fieldset-title.accent-violet  svg { color: #A78BFA; background: rgba(167, 139, 250, 0.18); }
html.dark .fieldset-title.accent-slate   svg { color: #94A3B8; background: rgba(148, 163, 184, 0.18); }

.fieldset-title-right {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-tertiary);
}

/* Field group — label nad inputem */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.field-group > label,
.field-group > .lbl {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    line-height: 1.4;
}
.field-group > label .req {
    color: #DC2626;
    font-weight: 700;
}
.field-group > .hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    line-height: 1.4;
}
.field-group > .hint-error {
    font-size: 11px;
    color: #DC2626;
    margin-top: 2px;
}

/* Grid pro hustý layout (2 / 3 / 4 sloupce) */
.field-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}
.field-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
}
.field-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 18px;
}
/* Span přes více sloupců */
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-full { grid-column: 1 / -1; }

/* Field s inline unit (Kč, %, ks…) */
.field-with-unit {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.field-with-unit .input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
    flex: 1;
    min-width: 0;
}
.field-with-unit .unit {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    background: var(--bg-app);
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
}
.field-with-unit .unit-left {
    border-left: 1px solid var(--border-strong);
    border-right: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.field-with-unit .input.has-unit-left {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 0;
}

/* Collapsible sekce — jako expandable fieldset (Raynet advanced options) */
.fieldset-collapsible {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    margin-bottom: 14px;
    overflow: hidden;
}
.fieldset-collapsible > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    user-select: none;
    transition: background 100ms var(--fluent-ease);
}
.fieldset-collapsible > summary::-webkit-details-marker { display: none; }
.fieldset-collapsible > summary:hover { background: var(--bg-hover); }
.fieldset-collapsible > summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--text-tertiary);
    border-bottom: 1.5px solid var(--text-tertiary);
    transform: rotate(-45deg);
    margin-left: auto;
    transition: transform 200ms var(--fluent-ease);
}
.fieldset-collapsible[open] > summary::after {
    transform: rotate(45deg);
}
.fieldset-collapsible[open] > summary {
    border-bottom: 1px solid var(--border-subtle);
}
.fieldset-collapsible-body {
    padding: 18px 22px;
}

@media (max-width: 768px) {
    .field-cols-2, .field-cols-3, .field-cols-4 {
        grid-template-columns: 1fr;
    }
    .col-span-2, .col-span-3 { grid-column: auto; }
    .fieldset, .fieldset-collapsible-body { padding: 14px 16px; }
    .fieldset-collapsible > summary { padding: 12px 16px; }
}

/* ════════════════════════════════════════════════════════════════════
 *  Document-style form (legacy — ponecháno pro nabídky)
 * ════════════════════════════════════════════════════════════════════ */

.doc-form {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}
.doc-form-body {
    padding: 28px 32px;
}
@media (max-width: 640px) {
    .doc-form-body { padding: 20px; }
}

/* Title field — velký borderless input jako titulek */
.field-title {
    display: block;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0;
    margin: 0 0 4px 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.field-title::placeholder {
    color: var(--text-tertiary);
    font-weight: 500;
}
.field-title:focus {
    box-shadow: none;
}

/* Meta strip — inline malé pole vedle sebe (kategorie, datum…) */
.field-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.field-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.field-meta-item .field-ghost {
    border: 1px dashed var(--border-default);
    background: transparent;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 13px;
    height: 28px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 100ms var(--fluent-ease);
}
.field-ghost:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
    border-style: solid;
}
.field-ghost:focus {
    border-style: solid;
    border-color: var(--fluent-accent);
    outline: none;
    box-shadow: 0 0 0 1px var(--fluent-accent);
}

/* Amount block — velká částka jako hero */
.field-amount {
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    gap: 24px;
    padding: 20px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin: 20px 0;
}
.field-amount-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.field-amount-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}
.field-amount-input {
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    padding: 0;
    width: 100%;
    letter-spacing: -0.01em;
}
.field-amount-input::placeholder { color: var(--text-muted); }
.field-amount-input:focus { box-shadow: none; }
.field-amount-computed {
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--fluent-accent);
    letter-spacing: -0.01em;
}
.field-amount-unit {
    font-size: 14px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-left: 4px;
}
@media (max-width: 640px) {
    .field-amount {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Collapsible sekce — <details> s custom styling */
.field-collapsible {
    border-top: 1px solid var(--border-subtle);
    margin-top: 0;
}
.field-collapsible > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: color 100ms var(--fluent-ease);
}
.field-collapsible > summary::-webkit-details-marker { display: none; }
.field-collapsible > summary::before {
    content: '+';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 400;
    transition: all 150ms var(--fluent-ease);
}
.field-collapsible[open] > summary::before {
    content: '−';
    background: var(--fluent-accent-soft);
    color: var(--fluent-accent);
}
.field-collapsible > summary:hover { color: var(--text-primary); }
.field-collapsible-body {
    padding: 4px 0 16px 26px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Inline toggle row — boolean-like option in flow */
.field-inline-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
}
.field-inline-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.field-inline-label svg { width: 14px; height: 14px; color: var(--text-tertiary); }
.field-inline-value {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

/* Compact inline input (bez borderu, jen na focus) */
.field-plain {
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 100ms var(--fluent-ease);
    height: 28px;
}
.field-plain:hover {
    background: var(--bg-hover);
}
.field-plain:focus {
    outline: none;
    border-color: var(--border-strong);
    background: var(--bg-card);
    box-shadow: 0 0 0 1px var(--fluent-accent-soft);
}

/* Smart hint — subtle blue box */
.hint-card {
    background: var(--fluent-accent-soft);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--fluent-accent);
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.hint-card svg {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--fluent-accent);
}
html.dark .hint-card { color: #A9D3F2; }

/* Divider uvnitř doc-form */
.form-divider {
    border-top: 1px solid var(--border-subtle);
    margin: 16px 0;
}

/* Sticky action footer — Save / Cancel vždy viditelné ve spodu */
.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    border-radius: 0 0 8px 8px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Mobile: form-row přepneme na vertikální layout */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 4px;
    }
    .form-row > label:first-child,
    .form-row > .label {
        text-align: left;
        font-size: 12px;
    }
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Empty state */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border: 2px dashed var(--border-default);
    border-radius: 8px;
    background: var(--bg-app);
}

/* ════════════════════════════════════════════════════════════════════
 *  KPI karty — Raynet/CRM styl (malý label + velká hodnota + delta)
 * ════════════════════════════════════════════════════════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
/* Sdílený styl se .stat-card — KPI karta v dashboardu je clickable verze.
   Vizuálně identická, jen má hover. */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px 18px 18px;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04), 0 1px 3px 0 rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
    text-decoration: none;
    color: inherit;
}
html.dark .kpi-card {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.35), 0 1px 3px 0 rgba(0, 0, 0, 0.40);
}
.kpi-card:hover {
    border-color: var(--border-default);
    box-shadow: 0 4px 8px 0 rgba(15, 23, 42, 0.06), 0 2px 4px 0 rgba(15, 23, 42, 0.05);
    transform: translateY(-1px);
}
.kpi-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}
.kpi-label svg {
    width: 12px;
    height: 12px;
    opacity: 0.8;
}
.kpi-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.kpi-value-sm {
    font-size: 16px;
    font-weight: 600;
}
.kpi-delta {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: 2px;
    line-height: 1.4;
}
.kpi-delta.positive { color: #047857; }
.kpi-delta.negative { color: #BE123C; }
/* Akcent varianty - jen tenký levý proužek (subtle hint), barva hodnoty */
.kpi-card.accent {
    border-left: 3px solid var(--fluent-accent);
}
.kpi-card.success {
    border-left: 3px solid #10B981;
}
.kpi-card.success .kpi-value { color: #047857; }
.kpi-card.warning {
    border-left: 3px solid #F59E0B;
}
.kpi-card.warning .kpi-value { color: #B45309; }
.kpi-card.danger,
.kpi-card.kpi-card-danger {
    border-left: 3px solid #EF4444;
}
.kpi-card.danger .kpi-value,
.kpi-card.kpi-card-danger .kpi-value { color: #BE123C; }
.kpi-card.kpi-card-warning {
    border-left: 3px solid #F59E0B;
}
.kpi-card.kpi-card-warning .kpi-value { color: #B45309; }
.kpi-card.kpi-card-info {
    border-left: 3px solid #3B82F6;
}
.kpi-card.kpi-card-info .kpi-value { color: #1D4ED8; }
html.dark .kpi-card.kpi-card-info .kpi-value { color: #60A5FA; }
html.dark .kpi-card.success .kpi-value,
html.dark .kpi-card.kpi-card-success .kpi-value { color: #34D399; }
html.dark .kpi-card.warning .kpi-value,
html.dark .kpi-card.kpi-card-warning .kpi-value { color: #FBBF24; }
html.dark .kpi-card.danger .kpi-value,
html.dark .kpi-card.kpi-card-danger .kpi-value { color: #FB7185; }

/* ════════════════════════════════════════════════════════════════════
 *  Legacy typography — sjednocení starých stránek s novým scale
 * ════════════════════════════════════════════════════════════════════ */
/* Legacy typography overrides - nezasahujeme do barvy přes !important,
   aby Tailwind text-* utility (např. text-white na tmavém pozadí) vyhrály.
   Default barva je primary text. */
h1.text-3xl.font-extrabold {
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: -0.01em !important;
    color: var(--text-primary);
}
h1.text-2xl.font-extrabold,
h1.text-2xl.font-bold {
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: var(--text-primary);
}
h2.text-xl.font-bold {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--text-primary);
}
h3.text-lg.font-bold,
h2.text-lg.font-bold {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--text-primary);  /* bez !important → utility classes jako text-white vyhrají */
}

/* Legacy page subtitle patterny */
h1 + p.text-sm.text-ink-500,
h1 + p.mt-1.text-sm.text-ink-500 {
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    margin-top: 4px !important;
}

/* Starý pattern .rounded-2xl.bg-white.border — sjednotíme s .card */
.rounded-2xl.bg-white.border-ink-100,
.rounded-xl.bg-white.border-ink-100 {
    border-radius: 8px !important;
    border-color: var(--border-subtle) !important;
    background-color: var(--bg-card) !important;
}

/* Filter tab bar (starý pattern) — jen trochu ztlumit */
.bg-white.rounded-xl.border.border-ink-100.p-1 {
    padding: 3px !important;
}
