/* =========================================================
   Moderní modrý vzhled — v2 "Cobalt Bento"
   Kompletní redesign od nuly: hero panel, bento grid,
   gradient sidebar, velká typografie, glow efekty.
   Aktivní pouze pokud body má třídu .theme-moderni
   ========================================================= */

body.theme-moderni {
    /* Paleta */
    --tm-ink:          #0b1020;
    --tm-ink-2:        #1e2a4a;
    --tm-muted:        #64748b;
    --tm-muted-2:      #94a3b8;

    --tm-surface:      #ffffff;
    --tm-surface-2:    #f8fafc;
    --tm-bg:           #eef2f9;
    --tm-border:       #e4e9f2;
    --tm-border-strong:#cbd5e1;

    --tm-blue:         #2563eb;
    --tm-blue-2:       #1d4ed8;
    --tm-blue-3:       #1e3a8a;
    --tm-blue-soft:    #dbeafe;
    --tm-cyan:         #06b6d4;
    --tm-violet:       #7c3aed;
    --tm-violet-soft:  #ede9fe;
    --tm-green:        #10b981;
    --tm-green-soft:   #d1fae5;
    --tm-red:          #ef4444;
    --tm-red-soft:     #fee2e2;
    --tm-amber:        #f59e0b;
    --tm-amber-soft:   #fef3c7;

    /* Gradienty */
    --tm-grad-primary:  linear-gradient(135deg, #3b82f6 0%, #1d4ed8 55%, #1e3a8a 100%);
    --tm-grad-sky:      linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
    --tm-grad-violet:   linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    --tm-grad-green:    linear-gradient(135deg, #34d399 0%, #059669 100%);
    --tm-grad-red:      linear-gradient(135deg, #fb7185 0%, #dc2626 100%);
    --tm-grad-amber:    linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --tm-grad-sidebar:  linear-gradient(180deg, #0b1736 0%, #131e3f 50%, #1e293b 100%);
    --tm-grad-hero:     linear-gradient(120deg, #1e3a8a 0%, #2563eb 50%, #06b6d4 100%);

    /* Shape & shadow */
    --tm-r-sm: 10px;
    --tm-r:    14px;
    --tm-r-lg: 22px;
    --tm-r-xl: 28px;

    --tm-sh-xs:  0 1px 2px rgba(15,23,42,0.04);
    --tm-sh-sm:  0 2px 8px rgba(15,23,42,0.06);
    --tm-sh-md:  0 8px 24px -8px rgba(15,23,42,0.12);
    --tm-sh-lg:  0 18px 40px -12px rgba(30,58,138,0.22);
    --tm-sh-glow:0 0 0 4px rgba(37,99,235,0.18);

    background:
        radial-gradient(900px 420px at 100% -10%, rgba(37,99,235,0.10), transparent 70%),
        radial-gradient(700px 360px at -10% 10%, rgba(6,182,212,0.08), transparent 65%),
        var(--tm-bg);
    color: var(--tm-ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.theme-moderni * { box-sizing: border-box; }

/* =========================================================
   HEADER / TOPBAR
   ========================================================= */
body.theme-moderni .app-header {
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(226,232,240,0.8);
    box-shadow: 0 1px 0 rgba(15,23,42,0.02);
    position: sticky;
    top: 0;
    z-index: 40;
}
body.theme-moderni .header-logo {
    color: transparent;
    background: var(--tm-grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.01em;
}
body.theme-moderni .app-header .header-icon {
    color: var(--tm-muted);
    transition: color .15s, transform .15s;
}
body.theme-moderni .app-header .header-icon:hover {
    color: var(--tm-blue);
    transform: translateY(-1px);
}

/* =========================================================
   SIDEBAR — tmavé námořnické pozadí s gradientem
   ========================================================= */
body.theme-moderni .sidebar {
    background: var(--tm-grad-sidebar);
    border-right: none;
    box-shadow: 4px 0 30px -8px rgba(8,15,36,0.35);
    color: #e2e8f0;
}
body.theme-moderni .sidebar::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(600px 220px at 0% 0%, rgba(59,130,246,0.25), transparent 60%),
        radial-gradient(400px 160px at 100% 100%, rgba(124,58,237,0.18), transparent 65%);
    pointer-events: none;
    mix-blend-mode: screen;
}
body.theme-moderni .sidebar > * { position: relative; z-index: 1; }

body.theme-moderni .sidebar-user {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin: 0.85rem;
    border: 1px solid rgba(255,255,255,0.08);
}
body.theme-moderni .sidebar-user strong,
body.theme-moderni .sidebar-user small { color: #f1f5f9; }
body.theme-moderni .sidebar-user small { color: #93c5fd; opacity: 0.9; }

body.theme-moderni .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #cbd5e1;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    margin: 0.15rem 0.6rem;
    border-radius: 10px;
    font-size: 0.92rem;
    transition: all .18s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}
body.theme-moderni .nav-label { flex: 1; }

/* Gradient ikonky v menu — shodná estetika jako .stat-icon v dashboardu */
body.theme-moderni .nav-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 10px -3px rgba(0,0,0,0.3);
    transition: transform .2s, box-shadow .2s;
}
body.theme-moderni .nav-link:hover .nav-icon { transform: translateY(-1px) scale(1.05); }

body.theme-moderni .nav-icon-blue   { background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%); box-shadow: 0 4px 10px -3px rgba(37,99,235,0.55); }
body.theme-moderni .nav-icon-green  { background: linear-gradient(135deg, #34d399 0%, #059669 100%); box-shadow: 0 4px 10px -3px rgba(5,150,105,0.5); }
body.theme-moderni .nav-icon-orange { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); box-shadow: 0 4px 10px -3px rgba(217,119,6,0.5); }
body.theme-moderni .nav-icon-purple { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); box-shadow: 0 4px 10px -3px rgba(124,58,237,0.5); }
body.theme-moderni .nav-icon-violet { background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%); box-shadow: 0 4px 10px -3px rgba(147,51,234,0.5); }
body.theme-moderni .nav-icon-cyan   { background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%); box-shadow: 0 4px 10px -3px rgba(8,145,178,0.5); }
body.theme-moderni .nav-icon-teal   { background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%); box-shadow: 0 4px 10px -3px rgba(13,148,136,0.5); }
body.theme-moderni .nav-icon-pink   { background: linear-gradient(135deg, #f472b6 0%, #db2777 100%); box-shadow: 0 4px 10px -3px rgba(219,39,119,0.5); }
body.theme-moderni .nav-icon-amber  { background: linear-gradient(135deg, #fcd34d 0%, #b45309 100%); box-shadow: 0 4px 10px -3px rgba(180,83,9,0.5); }
body.theme-moderni .nav-icon-red    { background: linear-gradient(135deg, #fb7185 0%, #dc2626 100%); box-shadow: 0 4px 10px -3px rgba(220,38,38,0.5); }
body.theme-moderni .nav-icon-slate  { background: linear-gradient(135deg, #94a3b8 0%, #475569 100%); box-shadow: 0 4px 10px -3px rgba(71,85,105,0.5); }

body.theme-moderni .nav-link .badge-count {
    margin-left: auto;
    background: var(--tm-red);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}
body.theme-moderni .nav-link::before {
    content: "";
    position: absolute; left: 0; top: 25%; bottom: 25%;
    width: 3px;
    background: transparent;
    border-radius: 0 3px 3px 0;
    transition: background .18s;
}
body.theme-moderni .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
body.theme-moderni .nav-link.active {
    background: linear-gradient(90deg, rgba(59,130,246,0.25) 0%, rgba(59,130,246,0.05) 100%);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(147,197,253,0.2);
}
body.theme-moderni .nav-link.active::before { background: #60a5fa; }

body.theme-moderni .nav-section {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #94a3b8;
    padding: 1rem 1.2rem 0.4rem;
    font-weight: 700;
    opacity: 0.75;
}
body.theme-moderni .nav-divider {
    border-color: rgba(148,163,184,0.15);
    margin: 0.6rem 0.85rem;
}

/* =========================================================
   PAGE HEADER + HERO uvítací panel
   ========================================================= */
body.theme-moderni .page-header {
    padding: 1.25rem 0 0.25rem;
}
body.theme-moderni .page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--tm-ink);
    background: linear-gradient(90deg, var(--tm-ink) 0%, var(--tm-blue-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Hero card (v dashboard se aplikuje jako zvláštní karta, ale .alert/page-header funguje i bez něj) */
body.theme-moderni .hero-panel {
    background: var(--tm-grad-hero);
    color: #fff;
    border-radius: var(--tm-r-xl);
    padding: 1.6rem 1.8rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--tm-sh-lg);
    position: relative;
    overflow: hidden;
}
body.theme-moderni .hero-panel::before {
    content: "";
    position: absolute;
    top: -40%; right: -10%;
    width: 380px; height: 380px;
    background: radial-gradient(closest-side, rgba(255,255,255,0.18), transparent 70%);
    pointer-events: none;
}
body.theme-moderni .hero-panel h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    letter-spacing: -0.01em;
}
body.theme-moderni .hero-panel p { margin: 0; opacity: 0.88; font-size: 0.95rem; }

/* =========================================================
   STATS GRID — bento velké karty s gradientovým sloupcem
   ========================================================= */
body.theme-moderni .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
body.theme-moderni .stat-card {
    position: relative;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-r-lg);
    padding: 1.1rem 1.25rem 1.15rem;
    box-shadow: var(--tm-sh-sm);
    transition: transform .2s cubic-bezier(.4,0,.2,1), box-shadow .2s, border-color .2s;
    text-decoration: none;
    color: var(--tm-ink);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    isolation: isolate;
}
body.theme-moderni .stat-card::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 140px; height: 140px;
    background: radial-gradient(closest-side, rgba(37,99,235,0.07), transparent 70%);
    z-index: -1;
    transition: transform .3s;
}
body.theme-moderni a.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--tm-sh-md);
    border-color: var(--tm-blue-soft);
}
body.theme-moderni a.stat-card:hover::after { transform: scale(1.2); }

body.theme-moderni .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 6px 16px -4px rgba(15,23,42,0.22);
}
body.theme-moderni .stat-icon-blue   { background: var(--tm-grad-sky);    box-shadow: 0 6px 16px -4px rgba(37,99,235,0.45); }
body.theme-moderni .stat-icon-red    { background: var(--tm-grad-red);    box-shadow: 0 6px 16px -4px rgba(220,38,38,0.4); }
body.theme-moderni .stat-icon-green  { background: var(--tm-grad-green);  box-shadow: 0 6px 16px -4px rgba(5,150,105,0.4); }
body.theme-moderni .stat-icon-purple { background: var(--tm-grad-violet); box-shadow: 0 6px 16px -4px rgba(124,58,237,0.4); }
body.theme-moderni .stat-icon-orange { background: var(--tm-grad-amber);  box-shadow: 0 6px 16px -4px rgba(217,119,6,0.4); }

body.theme-moderni .stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--tm-ink);
    margin-top: 0.15rem;
}
body.theme-moderni .stat-label {
    font-size: 0.82rem;
    color: var(--tm-muted);
    font-weight: 500;
}

/* Varianta se zvýrazněným okrajem */
body.theme-moderni .stat-card.stat-danger,
body.theme-moderni .stat-card.stat-warning,
body.theme-moderni .stat-card.stat-success {
    border: 1px solid var(--tm-border);
}
body.theme-moderni .stat-card.stat-danger::before,
body.theme-moderni .stat-card.stat-warning::before,
body.theme-moderni .stat-card.stat-success::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}
body.theme-moderni .stat-card.stat-danger::before  { background: var(--tm-grad-red); }
body.theme-moderni .stat-card.stat-warning::before { background: var(--tm-grad-amber); }
body.theme-moderni .stat-card.stat-success::before { background: var(--tm-grad-green); }

/* Kompaktní chipy */
body.theme-moderni .stats-grid-small {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}
body.theme-moderni .stat-card-small {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--tm-ink);
    transition: all .15s;
}
body.theme-moderni .stat-card-small:hover {
    border-color: var(--tm-blue);
    box-shadow: var(--tm-sh-glow);
}

/* =========================================================
   QUICK ACTIONS — segmentovaný řádek pilulek
   ========================================================= */
body.theme-moderni .quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.1rem 0 1.25rem;
}
body.theme-moderni .quick-btn,
body.theme-moderni .quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1.05rem;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    color: var(--tm-ink);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all .18s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--tm-sh-xs);
}
body.theme-moderni .quick-btn:hover,
body.theme-moderni .quick-action-btn:hover {
    border-color: var(--tm-blue);
    color: var(--tm-blue-2);
    transform: translateY(-2px);
    box-shadow: var(--tm-sh-md);
    background: #fff;
}

/* Malé gradient ikonky v quick-actions — stejný styl jako .nav-icon, ale o trochu menší */
body.theme-moderni .qa-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    flex: 0 0 auto;
    margin-right: 0.15rem;
}
body.theme-moderni .qa-icon svg {
    width: 14px;
    height: 14px;
}
body.theme-moderni .quick-btn:hover .qa-icon,
body.theme-moderni .quick-action-btn:hover .qa-icon {
    transform: translateY(-1px) scale(1.06);
}
body.theme-moderni .quick-btn-primary .qa-icon {
    background: rgba(255,255,255,0.22) !important;
    box-shadow: none !important;
    color: #fff;
}

/* Malé gradient-square ikonky uvnitř tlačítek — stejný styl jako .nav-icon, jen drobnější */
body.theme-moderni .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    margin-right: 0.4rem;
    vertical-align: -5px;
    line-height: 0;
    color: #fff;
    transition: transform .15s ease;
}
body.theme-moderni .btn-icon svg { width: 12px; height: 12px; }
body.theme-moderni .btn:hover .btn-icon { transform: translateY(-1px) scale(1.05); }

body.theme-moderni .btn-sm .btn-icon { width: 18px; height: 18px; border-radius: 5px; margin-right: 0.35rem; vertical-align: -4px; }
body.theme-moderni .btn-sm .btn-icon svg { width: 11px; height: 11px; }
body.theme-moderni .btn-xs .btn-icon { width: 16px; height: 16px; border-radius: 4px; margin-right: 0.25rem; vertical-align: -3px; }
body.theme-moderni .btn-xs .btn-icon svg { width: 10px; height: 10px; }

/* Gradient varianty — stejná paleta jako .nav-icon */
body.theme-moderni .btn-icon-blue   { background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%); box-shadow: 0 2px 6px -2px rgba(37,99,235,0.55); }
body.theme-moderni .btn-icon-green  { background: linear-gradient(135deg, #34d399 0%, #059669 100%); box-shadow: 0 2px 6px -2px rgba(5,150,105,0.5); }
body.theme-moderni .btn-icon-orange { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); box-shadow: 0 2px 6px -2px rgba(217,119,6,0.5); }
body.theme-moderni .btn-icon-purple { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); box-shadow: 0 2px 6px -2px rgba(124,58,237,0.5); }
body.theme-moderni .btn-icon-violet { background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%); box-shadow: 0 2px 6px -2px rgba(147,51,234,0.5); }
body.theme-moderni .btn-icon-cyan   { background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%); box-shadow: 0 2px 6px -2px rgba(8,145,178,0.5); }
body.theme-moderni .btn-icon-teal   { background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%); box-shadow: 0 2px 6px -2px rgba(13,148,136,0.5); }
body.theme-moderni .btn-icon-pink   { background: linear-gradient(135deg, #f472b6 0%, #db2777 100%); box-shadow: 0 2px 6px -2px rgba(219,39,119,0.5); }
body.theme-moderni .btn-icon-amber  { background: linear-gradient(135deg, #fcd34d 0%, #b45309 100%); box-shadow: 0 2px 6px -2px rgba(180,83,9,0.5); }
body.theme-moderni .btn-icon-red    { background: linear-gradient(135deg, #fb7185 0%, #dc2626 100%); box-shadow: 0 2px 6px -2px rgba(220,38,38,0.5); }
body.theme-moderni .btn-icon-slate  { background: linear-gradient(135deg, #94a3b8 0%, #475569 100%); box-shadow: 0 2px 6px -2px rgba(71,85,105,0.5); }

/* Icon-only tlačítka: gradient dlaždička vyplní celou plochu tlačítka.
   Použij třídu .btn-icon-only na <button>/<a class="btn ...">. */
body.theme-moderni .btn.btn-icon-only {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    line-height: 0;
    overflow: hidden;
}
body.theme-moderni .btn.btn-icon-only .btn-icon {
    width: 100%;
    height: 100%;
    min-width: 34px;
    min-height: 34px;
    margin: 0;
    border-radius: 8px;
    vertical-align: middle;
}
body.theme-moderni .btn.btn-icon-only .btn-icon svg { width: 16px; height: 16px; }
body.theme-moderni .btn-sm.btn-icon-only .btn-icon {
    min-width: 30px; min-height: 30px; border-radius: 7px;
}
body.theme-moderni .btn-sm.btn-icon-only .btn-icon svg { width: 14px; height: 14px; }
body.theme-moderni .btn-xs.btn-icon-only .btn-icon {
    min-width: 26px; min-height: 26px; border-radius: 6px;
}
body.theme-moderni .btn-xs.btn-icon-only .btn-icon svg { width: 13px; height: 13px; }
body.theme-moderni .btn.btn-icon-only:hover .btn-icon {
    transform: translateY(-1px) scale(1.04);
    filter: brightness(1.08);
}

/* Uvnitř barevných tlačítek (primary/danger/warning) použijeme poloprůhledný bílý podklad,
   aby se gradient ikonky vizuálně nebil s gradientem tlačítka */
body.theme-moderni .btn-primary .btn-icon,
body.theme-moderni .btn-danger .btn-icon,
body.theme-moderni .btn-warning .btn-icon,
body.theme-moderni .quick-btn-primary .btn-icon {
    background: rgba(255,255,255,0.22) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28) !important;
    color: #fff;
}
body.theme-moderni .quick-btn-primary {
    background: var(--tm-grad-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 20px -6px rgba(37,99,235,0.55);
}
body.theme-moderni .quick-btn-primary:hover {
    background: var(--tm-grad-primary);
    color: #fff;
    filter: brightness(1.05);
    box-shadow: 0 12px 28px -8px rgba(37,99,235,0.65);
}

/* =========================================================
   CARDS + BENTO GRID
   ========================================================= */
body.theme-moderni .card {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-r-lg);
    box-shadow: var(--tm-sh-sm);
    overflow: hidden;
    transition: box-shadow .2s;
}
body.theme-moderni .card:hover { box-shadow: var(--tm-sh-md); }

body.theme-moderni .card-header {
    background: transparent;
    border-bottom: 1px solid var(--tm-border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
body.theme-moderni .card-header h2,
body.theme-moderni .card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--tm-ink);
    letter-spacing: -0.005em;
}
body.theme-moderni .card-header .link-small,
body.theme-moderni .card-link {
    color: var(--tm-blue);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    transition: background .15s;
}
body.theme-moderni .card-header .link-small:hover,
body.theme-moderni .card-link:hover { background: var(--tm-blue-soft); }

body.theme-moderni .card-body { padding: 1.1rem 1.25rem; }

/* Bento: první karta se roztáhne přes 2 sloupce (když je jich 3+) */
body.theme-moderni .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.1rem;
    margin-top: 1.1rem;
}
@media (min-width: 1100px) {
    body.theme-moderni .dashboard-grid {
        grid-template-columns: 1.4fr 1fr;
    }
    body.theme-moderni .dashboard-grid > .card:first-child {
        grid-row: span 2;
    }
}

/* =========================================================
   CARD LIST
   ========================================================= */
body.theme-moderni .card-list > * {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--tm-border);
    text-decoration: none;
    color: var(--tm-ink);
    transition: background .15s, padding-left .15s;
    position: relative;
}
body.theme-moderni .card-list > *:last-child { border-bottom: none; }
body.theme-moderni .card-list > a::before {
    content: "";
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: transparent;
    border-radius: 0 3px 3px 0;
    transition: background .15s;
}
body.theme-moderni .card-list > a:hover {
    background: linear-gradient(90deg, var(--tm-blue-soft) 0%, transparent 80%);
    padding-left: 1.55rem;
}
body.theme-moderni .card-list > a:hover::before { background: var(--tm-blue); }

body.theme-moderni .card-list-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}
body.theme-moderni .card-list-main strong { font-weight: 700; color: var(--tm-ink); }
body.theme-moderni .card-list-meta {
    font-size: 0.78rem;
    color: var(--tm-muted);
}

/* =========================================================
   BUTTONS
   ========================================================= */
body.theme-moderni .btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: -0.005em;
    transition: all .18s cubic-bezier(.4,0,.2,1);
    padding: 0.55rem 1.05rem;
}
body.theme-moderni .btn-primary {
    background: var(--tm-grad-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px -6px rgba(37,99,235,0.5);
}
body.theme-moderni .btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -8px rgba(37,99,235,0.6);
}
body.theme-moderni .btn-outline {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    color: var(--tm-ink);
    box-shadow: var(--tm-sh-xs);
}
body.theme-moderni .btn-outline:hover {
    background: var(--tm-blue-soft);
    border-color: var(--tm-blue);
    color: var(--tm-blue-2);
}
body.theme-moderni .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

/* =========================================================
   FORMS
   ========================================================= */
body.theme-moderni .form-input,
body.theme-moderni select.form-input,
body.theme-moderni textarea.form-input {
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    background: var(--tm-surface);
    font-size: 0.92rem;
    transition: all .15s;
    color: var(--tm-ink);
}
body.theme-moderni .form-input:hover { border-color: var(--tm-border-strong); }
body.theme-moderni .form-input:focus {
    border-color: var(--tm-blue);
    box-shadow: var(--tm-sh-glow);
    outline: none;
}
body.theme-moderni label { color: var(--tm-ink-2); font-weight: 600; font-size: 0.88rem; }

/* =========================================================
   TABLES
   ========================================================= */
body.theme-moderni .table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
body.theme-moderni .table thead th {
    background: var(--tm-surface-2);
    color: var(--tm-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--tm-border);
    text-align: left;
}
body.theme-moderni .table tbody td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--tm-border);
    font-size: 0.9rem;
}
body.theme-moderni .table tbody tr {
    transition: background .15s;
}
body.theme-moderni .table tbody tr:hover {
    background: linear-gradient(90deg, var(--tm-blue-soft) 0%, rgba(219,234,254,0.15) 100%);
}

/* =========================================================
   BADGES — jemné pilulky s barevnými tóny
   ========================================================= */
body.theme-moderni .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}
body.theme-moderni .badge-success,
body.theme-moderni .badge-green   { background: var(--tm-green-soft);  color: #047857; border-color: rgba(16,185,129,0.2); }
body.theme-moderni .badge-danger,
body.theme-moderni .badge-red     { background: var(--tm-red-soft);    color: #b91c1c; border-color: rgba(239,68,68,0.2); }
body.theme-moderni .badge-warning { background: var(--tm-amber-soft);  color: #b45309; border-color: rgba(245,158,11,0.2); }
body.theme-moderni .badge-info    { background: var(--tm-blue-soft);   color: var(--tm-blue-2); border-color: rgba(37,99,235,0.18); }
body.theme-moderni .badge-gray    { background: #eef2f7; color: #475569; border-color: rgba(100,116,139,0.15); }

/* =========================================================
   ALERTS
   ========================================================= */
body.theme-moderni .alert {
    border-radius: var(--tm-r);
    border: 1px solid transparent;
    padding: 0.9rem 1.1rem;
    font-size: 0.92rem;
    box-shadow: var(--tm-sh-xs);
}
body.theme-moderni .alert-danger {
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    border-color: rgba(239,68,68,0.25);
    color: #991b1b;
}
body.theme-moderni .alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: rgba(245,158,11,0.25);
    color: #92400e;
}
body.theme-moderni .alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
    border-color: rgba(16,185,129,0.25);
    color: #065f46;
}
body.theme-moderni .alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, var(--tm-blue-soft) 100%);
    border-color: rgba(37,99,235,0.25);
    color: var(--tm-blue-3);
}

/* =========================================================
   BOTTOM NAV (mobil)
   ========================================================= */
body.theme-moderni .bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--tm-border);
    box-shadow: 0 -8px 24px -12px rgba(15,23,42,0.1);
    padding: 0.35rem 0.25rem max(0.35rem, env(safe-area-inset-bottom));
    z-index: 30;
    justify-content: space-around;
    align-items: center;
}
body.theme-moderni .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem 0.25rem;
    text-decoration: none;
    color: var(--tm-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 10px;
    transition: color .15s;
}
body.theme-moderni .bottom-nav-item .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    opacity: 0.55;
    transition: opacity .2s, transform .2s;
}
body.theme-moderni .bottom-nav-item.active { color: var(--tm-blue); }
body.theme-moderni .bottom-nav-item.active .nav-icon {
    opacity: 1;
    transform: translateY(-2px) scale(1.05);
}
/* Rychlé přidání zařízení — prominentní akční tlačítko v bottom-nav */
body.theme-moderni .bottom-nav-quick { color: var(--tm-green, #16a34a); }
body.theme-moderni .bottom-nav-quick .quick-plus {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
    transition: transform .15s;
}
body.theme-moderni .bottom-nav-quick:hover .quick-plus,
body.theme-moderni .bottom-nav-quick.active .quick-plus {
    transform: translateY(-2px) scale(1.05);
}

/* Topbar ikonky — gradient čtverečky místo emoji */
body.theme-moderni .app-header .header-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
body.theme-moderni .app-header .header-icon .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}
body.theme-moderni .app-header .header-icon:hover .nav-icon {
    transform: translateY(-1px) scale(1.06);
}
body.theme-moderni .app-header .header-icon .badge-count {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--tm-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

@media (max-width: 768px) {
    body.theme-moderni .bottom-nav { display: flex; }
    body.theme-moderni .main-content {
        padding-top: calc(var(--header-height) + 0.1rem);
        padding-bottom: 76px;
    }
    body.theme-moderni .page-header {
        padding-top: 0;
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
    }
    body.theme-moderni .stat-value { font-size: 1.75rem; }
    body.theme-moderni .page-header h1 { font-size: 1.4rem; }
}

/* =========================================================
   SCROLLBAR (jemnější)
   ========================================================= */
body.theme-moderni ::-webkit-scrollbar { width: 10px; height: 10px; }
body.theme-moderni ::-webkit-scrollbar-track { background: transparent; }
body.theme-moderni ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid var(--tm-bg);
}
body.theme-moderni ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   THEME PICKER — náhled dlaždic (profil → Vzhled)
   ========================================================= */
.theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.theme-option {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.7rem;
    border: 2px solid #e4e9f2;
    border-radius: 14px;
    cursor: pointer;
    transition: all .18s;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.theme-option:hover {
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -10px rgba(15,23,42,0.15);
}
.theme-option.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.18), 0 10px 24px -10px rgba(37,99,235,0.3);
}
.theme-option input[type=radio] { display: none; }

.theme-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e4e9f2;
    display: flex;
}
.theme-preview .tp-sidebar { width: 28%; height: 100%; }
.theme-preview .tp-content {
    flex: 1; padding: 7px;
    display: flex; flex-direction: column; gap: 4px;
}
.theme-preview .tp-bar { height: 10px; background: #e2e8f0; border-radius: 3px; }
.theme-preview .tp-card { height: 20px; background: #e2e8f0; border-radius: 5px; }
.theme-preview .tp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.theme-preview .tp-stats span { height: 16px; border-radius: 4px; }
.theme-preview .tp-bottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 10px; background: #fff; border-top: 1px solid #e4e9f2;
}
.theme-preview-klasicky .tp-sidebar { background: #1e1b4b; }
.theme-preview-klasicky .tp-card:nth-child(even) { background: #ede9fe; }
.theme-preview-klasicky .tp-bar { background: linear-gradient(90deg, #4f46e5, #7c3aed); width: 40%; }

.theme-preview-moderni .tp-sidebar {
    background: linear-gradient(180deg, #0b1736 0%, #1e293b 100%);
}
.theme-preview-moderni .tp-stats span:nth-child(1) { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.theme-preview-moderni .tp-stats span:nth-child(2) { background: linear-gradient(135deg, #fb7185, #dc2626); }
.theme-preview-moderni .tp-stats span:nth-child(3) { background: linear-gradient(135deg, #34d399, #059669); }
.theme-preview-moderni .tp-stats span:nth-child(4) { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.theme-preview-moderni .tp-bar {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    width: 35%;
    height: 14px;
    border-radius: 6px;
}
.theme-preview-moderni .tp-card { background: #eef2f7; }

.theme-label { font-size: 0.88rem; line-height: 1.25; font-weight: 600; }
.theme-label small { color: #64748b; font-weight: 400; display: block; margin-top: 2px; }

/* Hover efekt pro položky výpisů (Zákazníci, Zařízení, Revize, Přístroje…) */
body.theme-moderni .list-item {
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    border-left: 3px solid transparent;
}
body.theme-moderni .list-item:hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.02) 100%);
    border-left-color: #2563eb;
    box-shadow: 0 4px 12px -6px rgba(37,99,235,0.35);
    transform: translateX(2px);
}
body.theme-moderni .list-item:hover .list-item-content strong {
    color: #1d4ed8;
}
