/* Vzhled inspirovaný teplým, oranžově akcentovaným dashboardem: světlý režim
   jako výchozí, rozšířený postranní panel s popisky, zaoblené karty s jemným
   stínem místo plochých rámečků. Tmavý režim je dostupný jako přepínač. */
:root {
    --bg: #f7f5f1;
    --surface: #ffffff;
    --surface-2: #f1eee7;
    --rail: #ffffff;
    --border: #e8e3d9;
    --text: #201e1a;
    --text-2: #8b8477;
    --off: #cec8ba;

    --accent: #f2611d;   /* oranžová – hlavní akcent */
    --accent-2: #6d75e0; /* indigová – sekundární akcent */
    --dl: #f2611d;        /* stahování */
    --ul: #6d75e0;        /* odesílání */
    --ok: #1caa82;
    --warn: #dfa100;
    --crit: #e0483f;

    /* kategorická paleta pro koláčové grafy (pořadí je pevné) */
    --s1: #f2611d;
    --s2: #6d75e0;
    --s3: #1caa82;
    --s4: #dfa100;
    --s5: #b15be0;
    --s-other: #c9c3b6;

    /* tónované podklady odvozené z barev výše (počítány ručně kvůli podpoře rgba) */
    --wash-accent: rgba(242, 97, 29, .14);
    --wash-accent-soft: rgba(242, 97, 29, .07);
    --wash-accent-strong: rgba(242, 97, 29, .18);
    --wash-crit: rgba(224, 72, 63, .14);
    --wash-crit-soft: rgba(224, 72, 63, .1);
    --wash-crit-strong: rgba(224, 72, 63, .18);
    --wash-warn: rgba(223, 161, 0, .14);
    --border-crit: rgba(224, 72, 63, .4);
    --border-warn: rgba(223, 161, 0, .5);

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(30, 24, 10, .04), 0 10px 24px -10px rgba(30, 24, 10, .12);
}

/* tmavý režim (přepínač v horním pruhu, ukládá se do prohlížeče) */
:root[data-theme="dark"] {
    --bg: #171614;
    --surface: #201e1a;
    --surface-2: #292620;
    --rail: #1b1917;
    --border: #363228;
    --text: #f3efe6;
    --text-2: #a49a89;
    --off: #4c473c;

    --accent: #ff7a3d;
    --accent-2: #8990f5;
    --dl: #ff7a3d;
    --ul: #8990f5;
    --ok: #2fd39d;
    --warn: #f2b93d;
    --crit: #ff6259;

    --s1: #ff7a3d;
    --s2: #8990f5;
    --s3: #2fd39d;
    --s4: #f2b93d;
    --s5: #c583f2;
    --s-other: #5c554a;

    --wash-accent: rgba(255, 122, 61, .16);
    --wash-accent-soft: rgba(255, 122, 61, .09);
    --wash-accent-strong: rgba(255, 122, 61, .22);
    --wash-crit: rgba(255, 98, 89, .16);
    --wash-crit-soft: rgba(255, 98, 89, .1);
    --wash-crit-strong: rgba(255, 98, 89, .22);
    --wash-warn: rgba(242, 185, 61, .16);
    --border-crit: rgba(255, 98, 89, .4);
    --border-warn: rgba(242, 185, 61, .5);

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 24px -10px rgba(0, 0, 0, .45);
}
:root[data-theme="light"] .only-dark { display: none; }
:root:not([data-theme="light"]) .only-light { display: none; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 13.5px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
h2 { font-size: 14.5px; margin: 0; font-weight: 700; }
code.mac { font-size: 12px; color: var(--text-2); }
.muted { color: var(--text-2); font-size: 12px; }
.ok { color: var(--ok); }
.nowrap { white-space: nowrap; }

/* ------- rozvržení: postranní panel s popisky + obsah ------- */
.app { display: flex; min-height: 100vh; }
.rail {
    width: 236px; flex-shrink: 0;
    background: var(--rail);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 18px 14px;
    position: sticky; top: 0; height: 100vh; z-index: 20;
    overflow-y: auto;
}
.rail-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 6px 18px; text-decoration: none !important;
}
.rail-logo-mark {
    font-size: 19px; width: 36px; height: 36px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.rail-logo-text { min-width: 0; }
.rail-logo-name { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-logo-sub { display: block; font-size: 11px; color: var(--text-2); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-section-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-2); padding: 12px 10px 6px;
}
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-item {
    position: relative;
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.rail-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.rail-item .item-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item:hover { background: var(--surface-2); color: var(--text); }
.rail-item.active { background: var(--surface-2); color: var(--text); font-weight: 700; }
.rail-item.active svg { color: var(--accent); }
.rail-item::after { content: none; }
.rail-badge {
    flex-shrink: 0;
    background: var(--crit); color: #fff;
    font-size: 10.5px; font-weight: 700; line-height: 1;
    border-radius: 999px; padding: 3px 7px;
}
.rail-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 22px 28px 6px;
    background: var(--bg);
    position: sticky; top: 0; z-index: 10;
}
.tb-brand { line-height: 1.25; }
.tb-name { font-size: 13.5px; font-weight: 700; }
.tb-sub { font-size: 11px; color: var(--text-2); }
.tb-divider { width: 1px; height: 26px; background: var(--border); }
.topbar-status { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--text-2);
}
.pill-ok { color: var(--ok); }
.pill-bad { color: var(--crit); border-color: var(--border-crit); }
.content { padding: 10px 28px 40px; max-width: 1560px; width: 100%; }

/* ------- karty ------- */
.card {
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.more { font-size: 12px; font-weight: 600; }
.empty { color: var(--text-2); text-align: center; padding: 24px 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 18px; }
/* širší sloupce jen tam, kde jsou dlouhé popisky (formuláře v Nastavení) –
   na Přehledu s krátkými popisky (Zařízení online, Internet…) by to zbytečně
   zúžilo počet dlaždic na řádek */
.stat-grid.wide { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { margin-bottom: 0; display: flex; flex-direction: column; gap: 10px; }
.stat-icon {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 17px; height: 17px; }
.stat-icon.stat-icon-accent { background: var(--wash-accent); color: var(--accent); }
.stat-icon.stat-icon-ul { background: rgba(109, 117, 224, .14); color: var(--ul); }
.stat-label { color: var(--text-2); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.stat-value.stat-small { font-size: 17px; }
.stat-sub { font-size: 13px; color: var(--text-2); font-weight: 500; margin-left: 6px; }
.stat-dl { color: var(--dl); }
.stat-ul { color: var(--ul); }

.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.grid-2-1 > .card { display: flex; flex-direction: column; max-height: 420px; }
.grid-2-1 > .card canvas.line-chart { flex: 1 1 auto; height: auto !important; min-height: 160px; max-height: 340px; }
.alert-list { overflow-y: auto; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.grid-2 .card, .grid-3 .card { margin-bottom: 0; }
@media (max-width: 1000px) { .grid-2-1 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
    .app { flex-direction: column; }
    .rail {
        width: 100%; height: auto; position: static;
        flex-direction: row; align-items: center; padding: 6px 10px;
    }
    .rail-logo-text, .rail-section-label { display: none; }
    .rail-nav { flex-direction: row; }
    .rail-item { width: 44px; height: 44px; padding: 0; justify-content: center; }
    .rail-item .item-label { display: none; }
    .rail-item::after {
        content: attr(data-label);
        position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
        background: #000; color: #fff; font-size: 12px; white-space: nowrap;
        padding: 5px 10px; border-radius: 6px; pointer-events: none;
        opacity: 0; transition: opacity .12s; z-index: 30;
    }
    .rail-item:hover::after { opacity: 1; }
    .rail-badge { position: absolute; top: 4px; right: 4px; padding: 2px 5px; font-size: 9px; }
    .rail-foot { margin: 0 0 0 auto; padding-top: 0; border-top: 0; }
    .tb-brand, .tb-divider { display: none; }
    .content { padding: 12px; }
}

/* ------- tabulky, horizontální scroll jako záchranná síť ------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------- mobil (iPhone atd., portrait) ------- */
@media (max-width: 480px) {
    /* spodní tab bar místo boční lišty */
    .app { flex-direction: column; }
    .rail {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; height: auto;
        flex-direction: row; border-right: 0; border-top: 1px solid var(--border);
        padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
        z-index: 30;
    }
    .rail-logo { display: none; }
    .rail-nav { flex: 1; flex-direction: row; justify-content: space-around; gap: 0; }
    .rail-item { width: 42px; height: 42px; }
    .rail-item::after { display: none; }
    .rail-item.active { background: var(--wash-accent); }
    .rail-foot { margin: 0; }
    .content { padding: 10px 10px calc(70px + env(safe-area-inset-bottom)); }

    /* horní pruh a bezpečná zóna (Dynamic Island) */
    .topbar {
        min-height: 56px; flex-wrap: wrap; row-gap: 6px;
        padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    }
    .tb-divider { display: none; }
    .topbar-status { flex-basis: 100%; order: 3; }
    .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* gridy */
    .stat-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .card { padding: 14px; border-radius: 14px; }

    /* donuty pod sebe */
    .donut-wrap { flex-direction: column; align-items: stretch; }
    .donut-wrap canvas.donut { width: 160px !important; height: 160px !important; margin: 0 auto; }
    .donut-legend { width: 100%; }

    /* tabulky – skrýt méně důležité sloupce, ať se vejde zbytek bez scrollu */
    .tbl { font-size: 12px; }
    .tbl th, .tbl td { padding: 8px 6px; }
    .tbl .w40 { display: none; }
    /* Zařízení / IP / MAC / Připojení / Provoz / Důvěra / Naposledy */
    .tbl-devices th:nth-child(3), .tbl-devices td:nth-child(3),
    .tbl-devices th:nth-child(4), .tbl-devices td:nth-child(4),
    .tbl-devices th:nth-child(7), .tbl-devices td:nth-child(7) { display: none; }
    /* Zařízení / Cíl / Port / Staženo / Odesláno / Naposledy */
    .tbl-connections th:nth-child(6), .tbl-connections td:nth-child(6) { display: none; }
    /* Cíl(Zdroj) / Port / Protokol / Staženo / Odesláno / Spojení / Naposledy */
    .tbl-devconns th:nth-child(3), .tbl-devconns td:nth-child(3),
    .tbl-devconns th:nth-child(6), .tbl-devconns td:nth-child(6),
    .tbl-devconns th:nth-child(7), .tbl-devconns td:nth-child(7) { display: none; }

    /* touch targets a formuláře – 16px zamezí iOS zoomu při focusu */
    input, select, button { padding: 9px 12px; font-size: 16px; }
    .btn-small { padding: 7px 12px; font-size: 13px; }
    .icon-btn { width: 40px; height: 40px; }
    .icon-btn svg { width: 19px; height: 19px; }
    .alert-dismiss button { width: 34px; height: 34px; }
    .check-label { min-height: 40px; }
    .search { min-width: 0; }
    .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .filters input.search, .filters button { grid-column: 1 / -1; }
    .chart-range { overflow-x: auto; max-width: 100%; }
    .alias-form { flex-wrap: wrap; }
}

/* ------- krátká výška na šířku (mobil naležato) – vrátit boční lištu ------- */
@media (max-height: 500px) and (orientation: landscape) {
    .app { flex-direction: row; }
    .rail {
        position: sticky; top: 0; bottom: auto; left: auto; right: auto;
        width: 64px; height: 100vh; flex-direction: column;
        border-right: 1px solid var(--border); border-top: 0;
        padding: 8px 0 8px max(0px, env(safe-area-inset-left));
        align-items: center;
    }
    .rail-logo-text, .rail-section-label { display: none; }
    .rail-logo { padding: 4px 0 12px; }
    .rail-nav { flex-direction: column; justify-content: flex-start; gap: 4px; }
    .rail-item { width: 44px; height: 44px; padding: 0; justify-content: center; }
    .rail-item .item-label { display: none; }
    .rail-item::after {
        content: attr(data-label);
        position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
        background: #000; color: #fff; font-size: 12px; white-space: nowrap;
        padding: 5px 10px; border-radius: 6px; pointer-events: none;
        opacity: 0; transition: opacity .12s; z-index: 30;
    }
    .rail-item:hover::after { opacity: 1; }
    .rail-badge { position: absolute; top: 4px; right: 4px; padding: 2px 5px; font-size: 9px; }
    .rail-foot { margin-top: auto; padding-top: 8px; }
    .content { padding-bottom: 20px; padding-right: max(10px, env(safe-area-inset-right)); }
}

/* ------- tabulky ------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
    text-align: left; color: var(--text-2); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.tbl th a { color: var(--text-2); white-space: nowrap; }
.tbl th a:hover { color: var(--text); text-decoration: none; }
.tbl th a.active { color: var(--accent); }
.tbl th a.active::after { content: " ↓"; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: var(--surface-2); }
.tbl .w40 { width: 40%; }
.row-bad td { background: var(--wash-crit-soft); }
.topics { font-size: 11px; color: var(--text-2); background: var(--surface-2); border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.svc { font-size: 11px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }

.meter { background: var(--surface-2); border-radius: 999px; height: 7px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ------- stavové tečky, signál ------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--text-2); }
.dot-on { background: var(--ok); box-shadow: 0 0 5px rgba(28, 170, 130, .5); }
.dot-off { background: var(--off); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; margin-right: 4px; }
.bars i { width: 3px; background: var(--border); border-radius: 1px; }
.bars i.on { background: var(--ok); }

/* ------- upozornění ------- */
.alert-row { display: flex; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.alert-row:last-child { border-bottom: 0; }
.alert-row.unseen { background: var(--wash-accent-soft); border-radius: var(--radius-sm); }
.alert-body { min-width: 0; }
.sev {
    flex-shrink: 0; font-size: 11px; font-weight: 700; border-radius: 999px;
    padding: 2px 9px; margin-top: 2px; white-space: nowrap;
}
.sev-crit { background: var(--wash-crit); color: var(--crit); }
.sev-warn { background: var(--wash-warn); color: var(--warn); }
.sev-info { background: var(--wash-accent); color: var(--accent); }

/* ------- důvěra zařízení, AI hodnocení ------- */
.badge-trusted { color: var(--ok); font-size: 12px; white-space: nowrap; }
.badge-untrusted {
    background: var(--wash-warn); color: var(--warn);
    font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.btn-small { padding: 3px 10px; font-size: 12px; border-radius: 999px; }
.btn-plain { background: none; border: none; color: var(--text-2); text-decoration: underline; padding: 0 4px; }
.btn-muted { color: var(--warn); border-color: var(--border-warn); }
.btn-danger { color: var(--crit); border-color: var(--border-crit); }
.btn-danger:hover { background: var(--wash-crit-soft); border-color: var(--crit); }
.check-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; }
.check-label input { margin: 0; }
.alert-dismiss { flex-shrink: 0; }
.alert-dismiss button { width: 26px; height: 26px; padding: 0; border-radius: 50%; }
.ai-note { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.ai-chip {
    display: inline-block; font-size: 11px; font-weight: 700;
    border-radius: 999px; padding: 1px 8px; margin-right: 7px; white-space: nowrap;
}
.ai-low { background: var(--wash-accent); color: var(--accent); }
.ai-mid { background: var(--wash-warn); color: var(--warn); }
.ai-high { background: var(--wash-crit-strong); color: var(--crit); }

/* ------- dlaždice zařízení ------- */
.dev-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dev-cell strong { display: block; line-height: 1.3; }
.dev-sub { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.dev-tile {
    position: relative; width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
    background: var(--surface-2); color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center;
}
.dev-tile svg { width: 20px; height: 20px; }
.dev-tile.on { background: var(--wash-accent); color: var(--accent); }
.dev-tile-sm { width: 30px; height: 30px; border-radius: 8px; }
.dev-tile-sm svg { width: 16px; height: 16px; }
.dev-dot {
    position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px;
    border-radius: 50%; border: 2px solid var(--surface);
}
.dd-on { background: var(--ok); }
.dd-off { background: var(--off); }
.alias-form { display: flex; gap: 6px; margin-top: 8px; }
.alias-form input { padding: 4px 8px; font-size: 12px; flex: 1; min-width: 0; }

/* ------- ikony služeb, země ------- */
.svc-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
    font-size: 9px; font-weight: 800; color: #fff; letter-spacing: -.3px;
    margin-right: 7px; vertical-align: -5px;
}
.svc-ico-generic { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.geo { font-size: 11px; color: var(--text-2); margin-left: 6px; white-space: nowrap; }
.dst-org { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.dst-org > span[title] { cursor: help; }

/* ------- kategorie služeb (přehled) ------- */
.cat-block { padding: 16px 4px; border-bottom: 1px solid var(--border); }
.cat-block:first-child { padding-top: 4px; }
.cat-block:last-child { border-bottom: 0; padding-bottom: 4px; }
.cat-head { display: flex; align-items: center; gap: 10px; }
.cat-emoji { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.cat-head strong { flex-shrink: 0; }
.cat-head .meter { flex: 1; margin: 0 4px; }
.cat-top { margin: 10px 0 0 32px; display: flex; flex-direction: column; gap: 7px; }
.cat-top-row { display: flex; align-items: baseline; gap: 10px; font-size: 12px; }
.cat-top-row > span:first-child { color: var(--text); flex: 0 0 auto; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-note { color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-top-row > span:last-child { margin-left: auto; flex-shrink: 0; color: var(--text-2); padding-left: 10px; }
.cat-chip { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.icon-btn {
    width: 34px; height: 34px; padding: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-2); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ------- log ------- */
.log-row { display: flex; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 12px; }
.log-row:last-child { border-bottom: 0; }
.log-time { color: var(--text-2); white-space: nowrap; }
.log-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------- formuláře ------- */
input, select, button {
    font: inherit; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 12px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button[type="submit"]:not(.btn-plain):not(.btn-muted):not(.btn-small):hover { color: var(--accent); }
.search { min-width: 200px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }

/* ------- graf ------- */
canvas { width: 100%; display: block; }
canvas.donut { width: auto; }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; font-size: 12px; }
.donut-legend .row { display: flex; align-items: center; gap: 8px; }
.donut-legend .chip { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .val { color: var(--text-2); white-space: nowrap; font-size: 11px; flex-shrink: 0; }
.diag-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.diag-form input[type="text"] { flex: 1; min-width: 180px; }
.stacked-bar { display: flex; flex-direction: column; gap: 14px; }
.stacked-bar-track { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.stacked-bar-track .seg { height: 100%; transition: opacity .15s; }
.stacked-bar-track .seg:hover { opacity: .8; }
.dst-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.dst-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.dst-row .meter { width: 90px; flex-shrink: 0; }
.dst-val { width: 64px; text-align: right; flex-shrink: 0; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-dl { background: var(--dl); }
.lg-ul { background: var(--ul); }
.chart-range { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.chart-range button, .chart-range a {
    padding: 4px 12px; font-size: 12px; border: none; border-radius: 0;
    color: var(--text-2); background: transparent; text-decoration: none;
}
.chart-range button + button, .chart-range a + a { border-left: 1px solid var(--border); }
.chart-range button.active, .chart-range a.active { background: var(--wash-accent); color: var(--accent); }
.chart-tip {
    position: fixed; z-index: 50; pointer-events: none;
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm); padding: 7px 11px; font-size: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18); display: none;
}
.chart-tip b { display: block; margin-bottom: 2px; }

/* ------- přihlášení ------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 36px 40px; width: 320px; text-align: center;
    display: flex; flex-direction: column; gap: 12px;
}
.login-logo {
    font-size: 26px; width: 52px; height: 52px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.login-box h1 { font-size: 19px; }
.login-box p { margin: 0; }
.login-box button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.login-box button:hover { background: var(--accent); filter: brightness(1.08); }
.login-error { background: var(--wash-crit); color: var(--crit); border-radius: var(--radius-sm); padding: 8px; font-size: 13px; }
