/* =====================================================================
   MojeMyti.cz — živé demo (náhled zařízení + statistiky)
   Samostatná, embedovatelná ukázka. Tokeny a komponenty převzaty 1:1
   z produkční app (assets/css/style.css, statistiky.css, modbus view),
   aby demo vypadalo identicky. Žádná závislost na backendu.
   ===================================================================== */

/* ---------- Design tokeny (světlý režim) — z style.css ---------- */
:root {
    --brand-50:#eff6ff; --brand-100:#dbeafe; --brand-200:#bfdbfe; --brand-300:#93c5fd;
    --brand-400:#60a5fa; --brand-500:#3b82f6; --brand-600:#2563eb; --brand-700:#1d4ed8;
    --brand-800:#1e40af; --brand-900:#1e3a8a;

    --c-violet:#8b5cf6; --c-pink:#ec4899; --c-teal:#14b8a6; --c-amber:#f59e0b; --c-amber-d:#b45309;
    --c-emerald:#10b981; --c-rose:#ef4444; --c-orange:#f97316; --c-indigo:#6366f1; --c-cyan:#06b6d4;

    --gray-50:#f1f5fa; --gray-100:#e7eef8; --gray-200:#cfd8e8; --gray-300:#a0adc4;
    --gray-400:#6f7e9a; --gray-500:#4d5b75; --gray-600:#364056; --gray-700:#1c2538;
    --gray-800:#0f172a; --gray-900:#060c1a;

    --primary-50:#eff6ff; --primary-500:#2563eb; --primary-600:#1d4ed8; --primary-700:#1e40af;

    --success-50:#ecfdf5; --success-100:#d1fae5; --success-600:#059669; --success-700:#047857;
    --warning-50:#fffbeb; --warning-100:#fef3c7; --warning-600:#d97706; --warning-700:#b45309;
    --danger-50:#fef2f2; --danger-100:#fee2e2; --danger-600:#dc2626; --danger-700:#b91c1c;
    --info-50:#eff6ff; --info-600:#2563eb; --info-700:#1d4ed8; --danger-500:#ef4444;

    --bg:#e8eef9;
    --bg-gradient:
        radial-gradient(1100px 520px at 105% -10%, rgba(37,99,235,.10), transparent 60%),
        radial-gradient(900px 480px at -10% 110%, rgba(139,92,246,.08), transparent 55%),
        linear-gradient(180deg,#eef2fb 0%,#e3eaf6 100%);
    --surface:#ffffff; --surface-2:#f6f8fc; --surface-3:#eef2fa;
    --border:#dde4f0; --border-strong:#c2cce0;
    --text:#1c2538; --text-strong:#0a1224; --text-muted:#5a6781;
    --soft-success-bg:#ecfdf5; --soft-warning-bg:#fffbeb; --soft-danger-bg:#fef2f2; --soft-info-bg:#eff6ff;

    --radius-sm:10px; --radius-md:14px; --radius-lg:18px; --radius-xl:24px;
    --transition:220ms cubic-bezier(.4,0,.2,1);
    --header-height:56px;

    /* statistiky tokeny */
    --stat-ink:#0f172a; --stat-primary:#2563eb; --stat-success:#22c55e; --stat-warning:#f59e0b;
    --stat-danger:#ef4444; --stat-gold:#d97706; --stat-teal:#14b8a6;
    --stat-bg-success:#f0fdf4; --stat-bg-warning:#fffbeb; --stat-bg-danger:#fef2f2; --stat-bg-muted:#f8fafc;
    --stat-radius:12px; --stat-radius-sm:8px;
    --stat-shadow-card:0 2px 8px rgba(15,23,42,.04); --stat-shadow-hover:0 8px 24px rgba(15,23,42,.10);
}

/* ---------- Tmavý režim ---------- */
:root[data-theme="dark"] {
    --gray-50:#1a253f; --gray-100:#1f2a44; --gray-200:#2a3658; --gray-300:#3d4b73;
    --gray-400:#64748b; --gray-500:#94a3b8; --gray-600:#cbd5e1; --gray-700:#e2e8f0;
    --gray-800:#f1f5f9; --gray-900:#ffffff;
    --primary-500:#3b82f6; --primary-600:#60a5fa; --primary-700:#93c5fd;
    --success-600:#34d399; --success-700:#6ee7b7;
    --warning-600:#fbbf24; --warning-700:#fcd34d;
    --danger-600:#f87171; --danger-700:#fca5a5;
    --bg:#0a1020;
    --bg-gradient:
        radial-gradient(1300px 640px at 105% -10%, rgba(37,99,235,.18), transparent 60%),
        radial-gradient(1000px 540px at -10% 110%, rgba(139,92,246,.12), transparent 55%),
        linear-gradient(180deg,#0c1426 0%,#080d1c 100%);
    --surface:#131d36; --surface-2:#1a2542; --surface-3:#233052;
    --border:#2a3a5e; --border-strong:#3b4f7a;
    --text:#dde5f4; --text-strong:#f6f9ff; --text-muted:#98a6c6;
    --soft-success-bg:#06301f; --soft-warning-bg:#2e1d02; --soft-danger-bg:#341013; --soft-info-bg:#16234a;

    --stat-ink:#f6f9ff; --stat-primary:#60a5fa; --stat-success:#34d399; --stat-warning:#fbbf24;
    --stat-danger:#f87171; --stat-gold:#fbbf24; --stat-teal:#2dd4bf;
    --stat-bg-success:#06301f; --stat-bg-warning:#2e1d02; --stat-bg-danger:#341013; --stat-bg-muted:#1a2542;
    color-scheme:dark;
}

/* ---------- Základ ---------- */
* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
    color:var(--text);
    background:var(--bg);
    background-image:var(--bg-gradient);
    background-attachment:fixed;
    min-height:100vh;
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
}
.tabular { font-variant-numeric:tabular-nums; }
svg { display:inline-block; vertical-align:middle; }

/* ---------- Stage (vystředění telefonu) ---------- */
.stage {
    min-height:100vh;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:1.1rem; padding:2rem 1rem;
}
.stage-head { text-align:center; max-width:560px; }
.stage-brand {
    display:inline-flex; align-items:center; gap:.5rem;
    font-size:1.05rem; font-weight:700; color:var(--text-strong); letter-spacing:-.01em;
}
.stage-brand svg { color:var(--brand-600); }
.stage-sub { margin:.35rem 0 0; font-size:.92rem; color:var(--text-muted); }

/* ---------- Rámeček telefonu ---------- */
.phone {
    position:relative;
    width:392px; height:812px;
    background:#0b0f1a;
    border-radius:46px;
    padding:13px;
    box-shadow:
        0 0 0 2px rgba(255,255,255,.04),
        0 1px 0 2px #1d2536,
        0 40px 80px -20px rgba(8,12,28,.55),
        0 20px 40px -24px rgba(8,12,28,.45);
    flex-shrink:0;
}
.phone::after { /* boční tlačítka */
    content:""; position:absolute; right:-2px; top:170px; width:3px; height:64px;
    background:#1d2536; border-radius:0 3px 3px 0;
}
.phone-screen {
    position:relative;
    width:100%; height:100%;
    background:var(--bg);
    background-image:var(--bg-gradient);
    border-radius:34px;
    overflow:hidden;
}
/* Dynamický ostrůvek */
.phone-island {
    position:absolute; top:11px; left:50%; transform:translateX(-50%);
    width:108px; height:30px; background:#05070d; border-radius:16px; z-index:60;
}
/* Stavový řádek */
.phone-statusbar {
    position:absolute; top:0; left:0; right:0; height:46px; z-index:55;
    display:flex; align-items:center; justify-content:space-between;
    padding:0 26px; font-size:13px; font-weight:600; color:var(--text);
    pointer-events:none;
}
.phone-statusbar .sb-right { display:inline-flex; align-items:center; gap:6px; }
.sb-bars { display:inline-flex; align-items:flex-end; gap:2px; height:11px; }
.sb-bars i { width:3px; background:currentColor; border-radius:1px; opacity:.9; }
.sb-bars i:nth-child(1){height:4px} .sb-bars i:nth-child(2){height:6px}
.sb-bars i:nth-child(3){height:8px} .sb-bars i:nth-child(4){height:11px}
.sb-batt { width:22px; height:11px; border:1.5px solid currentColor; border-radius:3px; position:relative; opacity:.9; }
.sb-batt::after { content:""; position:absolute; right:-3px; top:3px; width:2px; height:5px; background:currentColor; border-radius:0 1px 1px 0; }
.sb-batt::before { content:""; position:absolute; inset:1.5px; right:5px; background:currentColor; border-radius:1px; }

/* ---------- App shell uvnitř telefonu ---------- */
.app {
    position:absolute; inset:0;
    padding-top:46px;
    display:flex; flex-direction:column;
}
.app-topbar {
    flex:0 0 auto;
    height:var(--header-height);
    display:flex; align-items:center; justify-content:space-between;
    padding:0 16px;
    background:color-mix(in srgb,var(--surface) 80%, transparent);
    backdrop-filter:blur(10px);
    border-bottom:1px solid var(--border);
    z-index:40;
}
.app-brand { display:inline-flex; align-items:center; gap:.5rem; font-weight:700; font-size:.98rem; color:var(--text-strong); }
.app-brand svg { color:var(--brand-600); }
.app-topbar-actions { display:inline-flex; align-items:center; gap:.35rem; color:var(--text-muted); }
.app-topbar-actions .tb-btn {
    width:32px; height:32px; border-radius:10px; border:0; background:transparent;
    color:var(--text-muted); display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
}
.app-avatar {
    width:30px; height:30px; border-radius:50%;
    background:linear-gradient(135deg,var(--brand-500),var(--c-violet));
    color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:.72rem; font-weight:700;
}

/* Skrolovací oblast (jediný scroll uvnitř telefonu, řízený demem) */
.app-scroll {
    position:relative; flex:1 1 auto; overflow:hidden;
}
.screen {
    position:absolute; inset:0;
    padding:14px 14px 84px;
    will-change:transform,opacity;
}
.screen-inner { will-change:transform; }
.screen[hidden] { display:none; }

.page-title { font-size:1.15rem; font-weight:700; color:var(--text-strong); margin:0 0 .85rem; display:flex; align-items:center; gap:.45rem; }
.page-title small { font-weight:500; font-size:.78rem; color:var(--text-muted); }

/* Spodní navigace (5 slotů) */
.bottom-nav {
    position:absolute; left:10px; right:10px; bottom:10px; z-index:45;
    height:62px; display:flex; align-items:stretch; justify-content:space-around;
    background:color-mix(in srgb,var(--surface) 88%, transparent);
    backdrop-filter:blur(12px);
    border:1px solid var(--border); border-radius:20px;
    box-shadow:0 10px 30px -12px rgba(8,12,28,.4);
}
.bn-item {
    flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
    color:var(--text-muted); font-size:.62rem; font-weight:600; text-decoration:none; border:0; background:transparent; cursor:pointer;
}
.bn-item.is-active { color:var(--brand-600); }

/* =====================================================================
   KOMPONENTY NÁHLEDU ZAŘÍZENÍ — převzato 1:1 z device_user_view.php
   ===================================================================== */
.modbus-period-switch { display:flex; align-items:center; gap:.35rem; flex-wrap:wrap; margin-bottom:1rem; }
.modbus-period-switch-lbl { font-size:.8rem; color:var(--text-muted); display:inline-flex; align-items:center; gap:.3rem; margin-right:.25rem; }
.modbus-period-opt {
    padding:.3rem .7rem; border:1px solid var(--border); border-radius:999px;
    font-size:.8rem; font-weight:500; color:var(--text-muted); text-decoration:none; cursor:pointer;
    background:var(--surface); transition:background .12s,color .12s,border-color .12s;
}
.modbus-period-opt.is-active { background:var(--brand-600); color:#fff; border-color:var(--brand-600); }

.modbus-hero { border-radius:12px; padding:1.25rem; margin-bottom:1rem; }
.modbus-hero[data-tone="success"] { background:var(--soft-success-bg); }
.modbus-hero[data-tone="success"] .tone-dot { color:var(--success-600); }
.modbus-hero[data-tone="success"] .tone-text { color:var(--success-700); }
.modbus-hero-status { display:flex; gap:.85rem; align-items:flex-start; }
.modbus-hero-dot {
    width:14px; height:14px; border-radius:50%; margin-top:.35rem; flex-shrink:0;
    background:currentColor;
    box-shadow:0 0 0 4px color-mix(in srgb,var(--surface) 70%, transparent);
}
.modbus-hero-label { font-size:1.3rem; font-weight:700; line-height:1.2; margin-bottom:.2rem; }
.modbus-hero-detail { color:var(--text-muted); font-size:.9rem; }
.modbus-hero-live { display:flex; gap:1rem; flex-wrap:wrap; margin-top:.7rem; font-size:.82rem; }
.modbus-hero-live span { display:inline-flex; align-items:center; gap:.35rem; color:var(--text); font-weight:600; font-variant-numeric:tabular-nums; }
.modbus-hero-live span svg { color:var(--text-muted); }
@keyframes modbus-pulse {
    0%,100% { box-shadow:0 0 0 4px color-mix(in srgb,var(--surface) 70%, transparent), 0 0 0 0 currentColor; }
    50% { box-shadow:0 0 0 4px color-mix(in srgb,var(--surface) 70%, transparent), 0 0 0 8px rgba(16,185,129,.15); }
}
.is-pulsing { animation:modbus-pulse 2s infinite; }

.modbus-hero-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem; margin-bottom:1rem; }

.modbus-metric-card {
    position:relative;
    background:var(--surface); border:1px solid var(--border);
    border-radius:12px; padding:1rem;
    box-shadow:0 1px 2px rgba(15,23,42,.04),0 4px 12px rgba(15,23,42,.04);
    display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
    min-height:128px;
}
.modbus-widget-cash_split_donut,.modbus-widget-program_breakdown,.modbus-widget-program_list,
.modbus-widget-usage_heatmap,.modbus-widget-service_health,.modbus-widget-error_panel {
    align-items:stretch; justify-content:flex-start; text-align:left; grid-column:span 2;
}
.modbus-metric-icon { margin-bottom:.4rem; color:var(--text-muted); }
.modbus-metric-value { font-size:1.7rem; font-weight:700; line-height:1.1; letter-spacing:-.02em; color:var(--text); font-variant-numeric:tabular-nums; }
.modbus-metric-unit { font-size:.9rem; font-weight:400; color:var(--text-muted); margin-left:.2rem; }
.modbus-metric-label { font-size:.74rem; color:var(--text-muted); margin-top:.3rem; text-transform:uppercase; letter-spacing:.05em; }
.modbus-metric-sub { margin-top:.55rem; padding-top:.45rem; border-top:1px dashed var(--border); font-size:.76rem; color:var(--text-muted); width:100%; }
.modbus-metric-spark { width:100%; max-width:180px; height:30px; margin-top:.45rem; }
.modbus-period-badge {
    position:absolute; top:.55rem; right:.6rem;
    font-size:.62rem; font-weight:600; text-transform:uppercase; letter-spacing:.03em;
    color:var(--text-muted); background:var(--bg); padding:.08rem .4rem; border-radius:999px; border:1px solid var(--border);
}

/* donut */
.modbus-donut-row { display:flex; gap:1.1rem; align-items:center; }
.modbus-donut {
    width:118px; height:118px; min-width:118px; border-radius:50%; position:relative; flex-shrink:0;
    background:var(--donut-bg,var(--gray-200));
    box-shadow:inset 0 0 0 1px rgba(15,23,42,.08);
}
.modbus-donut-hole {
    position:absolute; inset:18%; background:var(--surface); border-radius:50%;
    display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
}
.modbus-donut-value { font-size:1.2rem; font-weight:700; color:var(--text); line-height:1.1; }
.modbus-donut-cap { font-size:.62rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; margin-top:.1rem; }
.modbus-donut-legend { list-style:none; padding:0; margin:0; flex:1; font-size:.78rem; }
.modbus-donut-legend li { display:grid; grid-template-columns:12px 1fr auto auto; gap:.4rem; align-items:center; padding:.12rem 0; }
.modbus-donut-swatch { width:11px; height:11px; border-radius:3px; background:var(--swatch-bg,var(--gray-300)); }
.modbus-donut-lbl { color:var(--text); font-weight:500; }
.modbus-donut-cnt,.modbus-donut-val,.modbus-donut-pct { color:var(--text-muted); font-variant-numeric:tabular-nums; font-size:.72rem; }
.modbus-donut-pct { min-width:30px; text-align:right; }

/* program list */
.modbus-card-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.6rem; }
.modbus-card-title { font-size:.8rem; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; display:inline-flex; align-items:center; gap:.35rem; }
.modbus-proglist { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:.2rem; }
.modbus-proglist li { display:flex; align-items:center; gap:.55rem; padding:.4rem .5rem; border-radius:8px; border:1px solid transparent; font-size:.85rem; }
.modbus-proglist li.is-active { background:rgba(16,185,129,.1); border-color:rgba(16,185,129,.4); }
.modbus-proglist-num {
    width:1.4rem; height:1.4rem; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center;
    border-radius:6px; background:var(--surface); border:1px solid var(--border);
    font-size:.72rem; font-weight:600; color:var(--text-muted);
}
.modbus-proglist li.is-active .modbus-proglist-num { background:#10b981; color:#fff; border-color:#10b981; }
.modbus-proglist-lbl { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.modbus-proglist li.is-active .modbus-proglist-lbl { font-weight:600; }
.modbus-proglist-time { color:var(--text-muted); font-variant-numeric:tabular-nums; font-size:.8rem; flex-shrink:0; }

/* error panel */
.modbus-errpanel-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.55rem; flex-wrap:wrap; }
.modbus-errpanel-tabs { display:inline-flex; gap:2px; background:var(--bg); border:1px solid var(--border); border-radius:999px; padding:2px; }
.modbus-errtab { border:0; background:transparent; cursor:pointer; font:inherit; font-size:.74rem; font-weight:600; color:var(--text-muted); padding:.22rem .65rem; border-radius:999px; display:inline-flex; align-items:center; gap:.3rem; }
.modbus-errtab.is-active { background:var(--surface); color:var(--text); box-shadow:0 1px 2px rgba(15,23,42,.08); }
.modbus-errpanel { display:grid; grid-template-columns:repeat(auto-fill,minmax(86px,1fr)); gap:.45rem; }
.modbus-errpanel-pane[hidden] { display:none; }
.modbus-errpanel-item { display:flex; flex-direction:column; align-items:center; gap:.3rem; padding:.55rem .35rem; border:2px solid var(--border); border-radius:10px; background:var(--surface); text-align:center; }
.modbus-errpanel-item.is-ok { border-color:rgba(16,185,129,.4); }
.modbus-errpanel-item.is-fault { border-color:#ef4444; background:rgba(239,68,68,.08); }
.modbus-errpanel-icon { color:var(--text-muted); }
.modbus-errpanel-item.is-ok .modbus-errpanel-icon { color:#10b981; }
.modbus-errpanel-item.is-fault .modbus-errpanel-icon { color:#ef4444; }
.modbus-errpanel-lbl { font-size:.7rem; font-weight:500; color:var(--text); line-height:1.2; }
.modbus-errpanel-dot { width:8px; height:8px; border-radius:999px; background:#10b981; }
.modbus-errpanel-item.is-fault .modbus-errpanel-dot { background:#ef4444; animation:errpanel-pulse 1.4s infinite; }
@keyframes errpanel-pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.modbus-errlog { display:flex; flex-direction:column; gap:.1rem; }
.modbus-errlog-row { display:flex; align-items:center; gap:.5rem; font-size:.78rem; padding:.25rem 0; border-bottom:1px solid var(--gray-100); }
.modbus-errlog-row:last-child { border-bottom:0; }
.modbus-errlog-dot { width:7px; height:7px; border-radius:999px; background:var(--text-muted); flex-shrink:0; }
.modbus-errlog-row.is-active .modbus-errlog-dot { background:#ef4444; }
.modbus-errlog-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.modbus-errlog-prog { color:var(--text-muted); font-size:.7rem; margin-left:.35rem; }
.modbus-errlog-when { color:var(--text-muted); font-variant-numeric:tabular-nums; flex-shrink:0; font-size:.74rem; }

/* service health */
.modbus-service-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:.5rem; }
.modbus-service-head { display:flex; justify-content:space-between; align-items:baseline; font-size:.82rem; margin-bottom:.2rem; }
.modbus-service-lbl { color:var(--text); font-weight:500; }
.modbus-service-pct { color:var(--text-muted); font-size:.78rem; font-variant-numeric:tabular-nums; }
.modbus-service-bar { height:8px; background:rgba(15,23,42,.06); border-radius:999px; overflow:hidden; }
:root[data-theme="dark"] .modbus-service-bar { background:rgba(255,255,255,.06); }
.modbus-service-fill { height:100%; border-radius:999px; width:var(--bar-w,0%); background:var(--bar-bg,var(--success-600)); transition:width .4s ease-out; }

/* heatmap */
.modbus-heatmap { display:flex; flex-direction:column; gap:2px; font-size:.62rem; user-select:none; overflow-x:auto; max-width:100%; }
.modbus-heatmap-row { display:grid; grid-template-columns:30px repeat(24,minmax(0,1fr)); gap:2px; align-items:stretch; min-width:380px; }
.modbus-heatmap-dow { text-align:right; padding-right:.3rem; color:var(--text-muted); font-weight:600; align-self:center; }
.modbus-heatmap-cell { aspect-ratio:1/1; min-height:12px; border-radius:2px; background:rgba(15,23,42,.04); }
.modbus-heatmap-cell.is-hot { background:rgba(59,130,246,var(--cell-a,0)); }
:root[data-theme="dark"] .modbus-heatmap-cell { background:rgba(255,255,255,.05); }
.modbus-heatmap-hdr { background:transparent; color:var(--text-muted); font-size:.56rem; display:flex; align-items:center; justify-content:center; aspect-ratio:1/1; min-height:12px; line-height:1; overflow:hidden; }

/* =====================================================================
   KOMPONENTY STATISTIK — převzato 1:1 z statistiky.css
   ===================================================================== */
.stats-nav { display:flex; gap:.15rem; overflow-x:auto; border-bottom:1px solid var(--gray-200); margin-bottom:.9rem; padding-bottom:0; }
.stats-nav-item {
    display:inline-flex; align-items:center; gap:.3rem; flex:0 0 auto;
    padding:.5rem .6rem; font-size:.8rem; font-weight:600; color:var(--gray-500);
    text-decoration:none; border-bottom:2px solid transparent; white-space:nowrap;
}
.stats-nav-item.is-active { color:var(--stat-primary); border-bottom-color:var(--stat-primary); }

.stats-filter-v2 { background:var(--surface); border:1px solid var(--gray-200); border-radius:var(--stat-radius); padding:.6rem .7rem; margin-bottom:1rem; }
.stats-filter-top { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }
.stats-pills { display:inline-flex; gap:.2rem; flex-wrap:wrap; background:var(--stat-bg-muted); padding:.2rem; border-radius:999px; }
.stats-pill { padding:.32rem .7rem; border:0; background:transparent; color:var(--gray-600); border-radius:999px; font-size:.78rem; font-weight:600; cursor:pointer; }
.stats-pill.active { background:var(--surface); color:var(--stat-primary); box-shadow:0 1px 3px rgba(15,23,42,.1); }
.stats-range-label { font-size:.78rem; color:var(--gray-600); display:inline-flex; align-items:center; gap:.35rem; font-variant-numeric:tabular-nums; margin-left:auto; }

.kpi-strip { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1px; background:var(--gray-200); border:1px solid var(--gray-200); border-radius:var(--stat-radius); overflow:hidden; margin-bottom:1rem; }
.kpi-cell { background:var(--surface); padding:.95rem .9rem; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; gap:.22rem; min-height:96px; }
.kpi-label { font-size:.66rem; font-weight:600; color:var(--gray-500); text-transform:uppercase; letter-spacing:.05em; }
.kpi-value { font-size:1.5rem; font-weight:800; color:var(--stat-ink); line-height:1.15; font-variant-numeric:tabular-nums; }
.kpi-value-lg { font-size:1.6rem; }
.kpi-delta { font-size:.76rem; font-weight:600; display:inline-flex; align-items:center; gap:.25rem; }
.kpi-delta-up { color:var(--stat-success); }
.kpi-delta-down { color:var(--stat-danger); }
.kpi-delta-muted { color:var(--gray-500); font-weight:500; }
.kpi-sub { font-size:.7rem; color:var(--gray-500); }
.kpi-fleet-pills { display:flex; gap:.3rem; flex-wrap:wrap; justify-content:center; }
.fh-pill { display:inline-flex; align-items:center; gap:.25rem; padding:.12rem .45rem; border-radius:999px; font-size:.7rem; font-weight:700; font-variant-numeric:tabular-nums; }
.fh-pill-ok { background:var(--stat-bg-success); color:var(--success-700); }
.fh-pill-warn { background:var(--stat-bg-warning); color:var(--warning-700); }
.fh-pill-danger { background:var(--stat-bg-danger); color:var(--danger-700); }
.fh-dot { width:6px; height:6px; border-radius:50%; }
.fh-dot-ok { background:var(--stat-success); } .fh-dot-warn { background:var(--stat-warning); } .fh-dot-danger { background:var(--stat-danger); }

/* insight cards */
.insight-strip { display:grid; grid-template-columns:1fr; gap:.55rem; margin-bottom:1rem; }
.insight-card { display:flex; gap:.65rem; align-items:flex-start; background:var(--surface); border:1px solid var(--gray-200); border-left-width:4px; border-radius:var(--stat-radius-sm); padding:.7rem .85rem; }
.insight-success { border-left-color:var(--stat-success); }
.insight-info { border-left-color:var(--stat-primary); }
.insight-warning { border-left-color:var(--stat-warning); }
.insight-icon { width:30px; height:30px; border-radius:50%; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; }
.insight-success .insight-icon { background:var(--stat-bg-success); color:var(--success-700); }
.insight-info .insight-icon { background:var(--soft-info-bg); color:var(--stat-primary); }
.insight-warning .insight-icon { background:var(--stat-bg-warning); color:var(--warning-700); }
.insight-title { font-size:.85rem; font-weight:700; color:var(--gray-900); }
.insight-text { font-size:.78rem; color:var(--gray-600); margin-top:.1rem; }

/* hero row / card */
.hero-row { display:flex; flex-direction:column; gap:.85rem; margin-bottom:1rem; }
.hero-card { background:var(--surface); border:1px solid var(--gray-200); border-radius:var(--stat-radius); padding:1rem; min-width:0; }
.hero-card-title { font-size:.82rem; font-weight:600; color:var(--gray-700); margin-bottom:.7rem; display:flex; align-items:center; gap:.4rem; justify-content:space-between; }
.hero-card-title .t-left { display:inline-flex; align-items:center; gap:.4rem; }
.donut-wrap { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,max-content); gap:1rem; align-items:center; }
.donut-canvas-wrap { position:relative; height:150px; min-width:0; }
.donut-legend { display:flex; flex-direction:column; gap:.45rem; min-width:0; }
.donut-legend-item { display:grid; grid-template-columns:12px minmax(0,1fr) minmax(0,max-content); gap:.45rem; align-items:center; font-size:.78rem; }
.donut-swatch { width:11px; height:11px; border-radius:3px; background:var(--swatch-bg,var(--gray-400)); }
.donut-legend-name { color:var(--gray-700); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.donut-legend-amount { font-weight:700; color:var(--gray-900); font-variant-numeric:tabular-nums; font-size:.82rem; white-space:nowrap; }

/* provozovny bars */
.provozovna-row { display:grid; grid-template-columns:minmax(80px,1fr) auto; gap:.6rem; align-items:center; padding:.3rem 0; border-bottom:1px solid var(--gray-100); }
.provozovna-row:last-of-type { border-bottom:0; }
.provozovna-name { font-size:.8rem; font-weight:500; color:var(--gray-800); }
.provozovna-bar-bg { background:var(--gray-100); height:9px; border-radius:5px; overflow:hidden; margin-top:.28rem; }
.provozovna-bar-fill { height:100%; width:var(--bar-w,0%); background:linear-gradient(90deg,var(--stat-primary),#60a5fa); border-radius:5px; transition:width .5s ease; }
.provozovna-amount { font-size:.82rem; font-weight:700; color:var(--gray-900); font-variant-numeric:tabular-nums; text-align:right; white-space:nowrap; }

/* chart toolbar */
.chart-toolbar { display:inline-flex; gap:2px; background:var(--bg); border:1px solid var(--border); border-radius:999px; padding:2px; }
.chart-btn { border:0; background:transparent; cursor:pointer; font:inherit; font-size:.7rem; font-weight:600; color:var(--text-muted); padding:.2rem .55rem; border-radius:999px; }
.chart-btn.active { background:var(--surface); color:var(--text); box-shadow:0 1px 2px rgba(15,23,42,.08); }
.chart-box { position:relative; height:180px; }

/* top zákazníci */
.top-zak-row { display:grid; grid-template-columns:22px 1fr auto; gap:.6rem; align-items:center; padding:.38rem 0; border-bottom:1px solid var(--gray-100); font-size:.82rem; }
.top-zak-row:last-of-type { border-bottom:0; }
.zak-rank { text-align:center; font-weight:700; color:var(--gray-500); font-variant-numeric:tabular-nums; }
.zak-award-gold { color:var(--c-amber); } .zak-award-silver { color:var(--gray-400); } .zak-award-bronze { color:var(--c-amber-d); }
.zak-name { font-weight:500; color:var(--gray-800); }
.zak-amount { font-weight:700; color:var(--gray-900); font-variant-numeric:tabular-nums; text-align:right; }
.zak-tx-count { font-size:.7rem; color:var(--gray-500); }

/* =====================================================================
   ZPĚTNÁ VAZBA — veřejný QR formulář (zákazník)
   ===================================================================== */
.screen-public { display:flex; flex-direction:column; justify-content:flex-start; }
.fb-head { text-align:center; margin:.4rem 0 1rem; }
.fb-brand { display:inline-flex; align-items:center; gap:.4rem; font-weight:700; color:var(--text-strong); font-size:.95rem; }
.fb-brand svg { color:var(--brand-600); }
.fb-q { font-size:1.2rem; font-weight:700; margin:.55rem 0 0; color:var(--text-strong); }
.fb-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:1.1rem; box-shadow:0 6px 20px -8px rgba(15,23,42,.12); }
.fb-label { font-size:.78rem; font-weight:600; color:var(--text-muted); margin:.95rem 0 .45rem; }
.fb-stars { display:flex; gap:.45rem; justify-content:center; padding:.3rem 0 .2rem; }
.fb-star { color:#cbd5e1; line-height:0; transition:transform .12s; }
.fb-star.on { color:#f59e0b; transform:scale(1.06); }
.fb-types { display:grid; grid-template-columns:repeat(3,1fr); gap:.45rem; }
.fb-type { display:flex; flex-direction:column; align-items:center; gap:.3rem; padding:.65rem .3rem; border:1px solid var(--border); border-radius:11px; background:var(--surface); color:var(--text-muted); font-size:.76rem; font-weight:600; cursor:pointer; }
.fb-type.is-active { border-color:var(--brand-500); background:var(--brand-50); color:var(--brand-700); }
:root[data-theme="dark"] .fb-type.is-active { background:var(--soft-info-bg); }
.fb-textarea { min-height:60px; border:1px solid var(--border); border-radius:11px; padding:.6rem .7rem; font-size:.85rem; color:var(--text); background:var(--surface-2); line-height:1.4; }
.fb-caret { display:inline-block; width:2px; height:1em; background:var(--brand-500); vertical-align:-.15em; margin-left:1px; animation:fb-blink 1.05s steps(1) infinite; }
@keyframes fb-blink { 0%,50%{opacity:1} 50.01%,100%{opacity:0} }
.fb-foto-btn { margin-top:.75rem; width:100%; display:inline-flex; align-items:center; justify-content:center; gap:.4rem; padding:.62rem; border:1px dashed var(--border-strong); border-radius:11px; background:transparent; color:var(--text-muted); font-weight:600; font-size:.82rem; cursor:pointer; }
.fb-input { margin-top:.7rem; border:1px solid var(--border); border-radius:11px; padding:.62rem .7rem; font-size:.85rem; color:var(--text-muted); background:var(--surface-2); }
.fb-send { margin-top:.95rem; width:100%; display:inline-flex; align-items:center; justify-content:center; gap:.45rem; padding:.72rem; border:0; border-radius:13px; background:var(--brand-600); color:#fff; font-weight:700; font-size:.92rem; cursor:pointer; }
/* poděkování */
.fb-ok { text-align:center; }
.fb-ok-icon { display:inline-flex; width:62px; height:62px; align-items:center; justify-content:center; border-radius:50%; background:var(--soft-success-bg); color:var(--success-600); margin-bottom:.7rem; }
.fb-ok h2 { margin:.2rem 0; font-size:1.35rem; color:var(--text-strong); }
.fb-ok p { margin:0 0 1.1rem; font-size:.86rem; color:var(--text-muted); line-height:1.45; }
.fb-google-btn, .fb-seznam-btn { display:flex; align-items:center; justify-content:center; gap:.4rem; padding:.62rem; border-radius:11px; font-weight:700; font-size:.85rem; text-decoration:none; margin-top:.55rem; cursor:pointer; }
.fb-google-btn { background:#fff; color:#1a1a1a; border:1px solid var(--border-strong); }
.fb-seznam-btn { background:#cc0000; color:#fff; }
:root[data-theme="dark"] .fb-google-btn { background:var(--surface-2); color:var(--text); }

/* ===== ZPĚTNÁ VAZBA — schránka majitele ===== */
.fbx-kpis { display:grid; grid-template-columns:1fr 1fr; gap:.6rem; margin-bottom:.9rem; }
.fbx-kpi { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:.75rem .95rem; }
.fbx-kpi b { display:block; font-size:1.45rem; font-weight:800; color:var(--stat-ink); line-height:1.1; }
.fbx-kpi small { font-size:.72rem; color:var(--text-muted); }
.fbx-list { display:flex; flex-direction:column; gap:.6rem; }
.fbx-item { background:var(--surface); border:1px solid var(--border); border-left-width:5px; border-radius:12px; padding:.8rem .9rem; }
.fbx-item.is-nova { border-left-color:var(--warning-600); }
.fbx-item.is-done { border-left-color:var(--success-600); }
.fbx-item.is-problem { border-left-color:var(--danger-500); }
.fbx-top { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; margin-bottom:.4rem; }
.fbx-stars { color:#f59e0b; font-size:.95rem; letter-spacing:1px; }
.fbx-stars .off { color:#cbd5e1; }
.fbx-badge { display:inline-flex; align-items:center; gap:.25rem; padding:.14rem .5rem; border-radius:999px; font-size:.7rem; font-weight:700; }
.fb-badge-info { background:var(--soft-info-bg); color:var(--brand-700); }
.fb-badge-danger { background:var(--soft-danger-bg); color:var(--danger-700); }
.fb-badge-muted { background:var(--surface-3); color:var(--text-muted); }
.fbx-meta { margin-left:auto; font-size:.72rem; color:var(--text-muted); white-space:nowrap; }
.fbx-text { font-size:.85rem; color:var(--text); line-height:1.4; }
.fbx-sub { font-size:.74rem; color:var(--text-muted); margin-top:.4rem; display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.fbx-thumb { width:38px; height:38px; border-radius:8px; background:var(--surface-3); display:inline-flex; align-items:center; justify-content:center; color:var(--text-muted); }
.fbx-reply { display:inline-flex; align-items:center; gap:.3rem; font-size:.74rem; font-weight:600; color:var(--brand-700); }

/* =====================================================================
   ZÁKAZNICKÁ SEKCE (zákaznický portál)
   ===================================================================== */
.zp-hero h1 { font-size:1.25rem; margin:0; color:var(--text-strong); }
.zp-hero p { margin:.18rem 0 1rem; font-size:.8rem; color:var(--text-muted); }
.zp-credit { background:linear-gradient(135deg,var(--brand-600),var(--c-indigo)); color:#fff; border-radius:16px; padding:1.15rem 1.2rem; margin-bottom:1rem; box-shadow:0 14px 28px -12px rgba(37,99,235,.65); }
.zp-credit-label { display:inline-flex; align-items:center; gap:.4rem; font-size:.78rem; opacity:.92; }
.zp-credit-val { font-size:2.15rem; font-weight:800; margin:.3rem 0; font-variant-numeric:tabular-nums; line-height:1; }
.zp-credit-val span { font-size:1rem; font-weight:600; opacity:.85; }
.zp-credit-sub { font-size:.76rem; opacity:.95; display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.zp-online { display:inline-flex; align-items:center; gap:.3rem; }
.zp-online i { width:7px; height:7px; border-radius:50%; background:#34d399; animation:errpanel-pulse 1.6s infinite; }
.zp-dash-actions { display:grid; grid-template-columns:1fr 1fr 1fr; gap:.5rem; margin-bottom:.4rem; }
.zp-dash-action { display:flex; flex-direction:column; align-items:center; gap:.35rem; padding:.75rem .3rem; border:1px solid var(--border); border-radius:13px; background:var(--surface); color:var(--text); font-size:.72rem; font-weight:600; cursor:pointer; text-align:center; }
.zp-dash-action-primary { background:var(--brand-600); border-color:var(--brand-600); color:#fff; }
.zp-section-title { font-size:.74rem; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; margin:1.1rem 0 .55rem; display:flex; align-items:center; gap:.4rem; }
.zp-amounts { display:grid; grid-template-columns:repeat(3,1fr); gap:.5rem; }
.zp-amount { padding:.7rem; border:1px solid var(--border); border-radius:11px; background:var(--surface); text-align:center; font-weight:700; font-size:.9rem; color:var(--text); cursor:pointer; font-variant-numeric:tabular-nums; }
.zp-amount.active { background:var(--brand-600); border-color:var(--brand-600); color:#fff; }
.zp-cards { display:flex; flex-direction:column; gap:.6rem; }
.zp-card-tile { display:flex; align-items:center; gap:.7rem; background:var(--surface); border:1px solid var(--border); border-radius:13px; padding:.8rem .9rem; }
.zp-card-tile-icon { width:40px; height:40px; border-radius:11px; background:var(--primary-soft,#e6efff); color:var(--brand-700); display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; }
:root[data-theme="dark"] .zp-card-tile-icon { background:var(--soft-info-bg); color:var(--brand-300); }
.zp-card-meta { flex:1; min-width:0; }
.zp-card-name { font-weight:700; font-size:.88rem; color:var(--text); }
.zp-card-code { font-size:.72rem; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.zp-badge-ok { display:inline-block; margin-top:.25rem; font-size:.64rem; font-weight:700; color:var(--success-700); background:var(--soft-success-bg); padding:.06rem .45rem; border-radius:999px; }
.zp-card-bal { text-align:right; flex:0 0 auto; }
.zp-card-bal b { font-size:1.05rem; color:var(--brand-700); font-variant-numeric:tabular-nums; }
:root[data-theme="dark"] .zp-card-bal b { color:var(--brand-300); }
.zp-card-bal small { display:block; font-size:.66rem; color:var(--text-muted); }
.zp-tx { background:var(--surface); border:1px solid var(--border); border-radius:13px; overflow:hidden; }
.zp-tx-row { display:grid; grid-template-columns:auto 1fr auto; gap:.65rem; align-items:center; padding:.6rem .8rem; border-bottom:1px solid var(--gray-100); }
.zp-tx-row:last-child { border-bottom:0; }
.zp-tx-ico { width:30px; height:30px; border-radius:9px; background:var(--surface-3); color:var(--text-muted); display:inline-flex; align-items:center; justify-content:center; }
.zp-tx-main { min-width:0; }
.zp-tx-machine { font-weight:600; font-size:.82rem; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.zp-tx-date { font-size:.7rem; color:var(--text-muted); }
.zp-tx-amount { font-weight:700; font-size:.86rem; color:var(--text); font-variant-numeric:tabular-nums; white-space:nowrap; }

/* Bare režim — veřejná stránka bez owner chrome (topbar + bottom-nav skryté) */
.app--bare .app-topbar { display:none; }
.app--bare .bottom-nav { display:none; }
.app--bare .screen { padding-bottom:24px; }

/* =====================================================================
   Vrstva tour (titulky + ovládání)
   ===================================================================== */
.tour-caption {
    position:absolute; left:14px; right:14px; bottom:84px; z-index:50;
    background:color-mix(in srgb,var(--surface) 92%, transparent);
    backdrop-filter:blur(8px);
    border:1px solid var(--border); border-radius:14px;
    padding:.7rem .85rem;
    box-shadow:0 12px 30px -14px rgba(8,12,28,.5);
    display:flex; gap:.6rem; align-items:flex-start;
    transition:opacity .35s ease, transform .35s ease;
}
.tour-caption .tc-icon { width:30px; height:30px; border-radius:9px; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; background:var(--brand-50); color:var(--brand-600); }
:root[data-theme="dark"] .tour-caption .tc-icon { background:var(--soft-info-bg); }
.tour-caption .tc-title { font-size:.84rem; font-weight:700; color:var(--text-strong); }
.tour-caption .tc-text { font-size:.76rem; color:var(--text-muted); margin-top:.1rem; line-height:1.35; }
.tour-caption.is-hidden { opacity:0; transform:translateY(8px); }

/* progress proužek nahoře pod statusbarem */
.tour-progress { position:absolute; top:46px; left:0; right:0; height:2px; z-index:56; background:transparent; }
.tour-progress > i { display:block; height:100%; width:0%; background:var(--brand-500); }

/* Ovládací panel pod telefonem */
.controls { display:flex; flex-direction:column; align-items:center; gap:.7rem; }
.control-row { display:inline-flex; align-items:center; gap:.4rem; flex-wrap:wrap; justify-content:center; }
.ctrl-btn {
    display:inline-flex; align-items:center; gap:.4rem;
    padding:.5rem .85rem; border-radius:999px; cursor:pointer;
    border:1px solid var(--border-strong); background:var(--surface); color:var(--text);
    font-size:.82rem; font-weight:600;
}
.ctrl-btn:hover { border-color:var(--brand-400); }
.ctrl-btn.primary { background:var(--brand-600); border-color:var(--brand-600); color:#fff; }
.seg { display:inline-flex; background:var(--surface); border:1px solid var(--border-strong); border-radius:999px; padding:2px; }
.seg button { border:0; background:transparent; cursor:pointer; font:inherit; font-size:.8rem; font-weight:600; color:var(--text-muted); padding:.35rem .8rem; border-radius:999px; display:inline-flex; align-items:center; gap:.35rem; }
.seg button.is-active { background:var(--brand-600); color:#fff; }
.scene-dots { display:inline-flex; gap:.4rem; }
.scene-dot { width:8px; height:8px; border-radius:50%; background:var(--border-strong); border:0; cursor:pointer; padding:0; }
.scene-dot.is-active { background:var(--brand-600); transform:scale(1.25); }
.controls-hint { font-size:.74rem; color:var(--text-muted); }

/* Render mód — schová titulek a ovládání, telefon zůstane vystředěný na gradientu.
   Boční tlačítko vypneme, ať nevytváří horizontální přetečení (a tím ořez snímku). */
:root[data-render="1"] .stage { padding:0; gap:0; }
:root[data-render="1"] .stage-head,
:root[data-render="1"] .controls { display:none !important; }
:root[data-render="1"] .phone::after { display:none; }
