/* Statistika (#/stat), ported 2026-11-16 from Haris's mock "Statistika · tabele po platformama".
   Everything is scoped under #stat-view so it cannot restyle the rest of the cockpit. */
:root { --st-row-alt: #151b29; --st-row-hover: #1f2738; --st-grp-bg: #1c2435; --st-tot-bg: #263048; --st-line: #3a4660; --st-srt-bg: rgba(166, 226, 46, .06); --st-guide: #3a4660; }
:root[data-theme="light"] { --st-row-alt: #f6f8fb; --st-row-hover: #eef4e1; --st-grp-bg: #e6ebf3; --st-tot-bg: #d8e0eb; --st-line: #a9b5c6; --st-srt-bg: rgba(85, 129, 13, .07); --st-guide: #b8c3d2; }

#stat-view { padding-bottom: 40px; }
#stat-view .page-h { margin: 6px 0 6px; font-size: 1.25rem; }
#stat-view .tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 4px 0 14px; overflow-x: auto; }
#stat-view .tabs button { background: none; border: none; border-bottom: 2px solid transparent; color: var(--ink-2); padding: 9px 14px; font-size: .9rem; white-space: nowrap; cursor: pointer; }
#stat-view .tabs button:hover { color: var(--ink); }
#stat-view .tabs button.active { color: var(--ink); border-bottom-color: var(--lime); font-weight: 600; }
#stat-view .toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 10px; }
#stat-view .toolbar select { max-width: 260px; }
#stat-view label.chk { display: inline-flex; gap: 6px; align-items: center; font-size: .84rem; color: var(--ink-2); }
#stat-view #st-range { font-size: .8rem; margin: 0 0 10px; }

#stat-view .note { color: var(--muted); font-size: .8rem; margin: 6px 0 10px; max-width: 980px; }
#stat-view .note b { color: var(--ink-2); }
#stat-view .tw { overflow-x: auto; border: 1px solid var(--st-line); border-radius: 10px; background: var(--surface); margin-bottom: 18px; }
#stat-view table.t { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
#stat-view table.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; text-align: right; padding: 8px 10px; white-space: nowrap; border-bottom: 2px solid var(--st-line); cursor: pointer; }
#stat-view table.t th.l, #stat-view table.t td.l { text-align: left; }
#stat-view table.t th.sorted { color: var(--lime-text); }
#stat-view table.t td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
#stat-view table.t tr:last-child td { border-bottom: none; }
#stat-view table.t td.name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
#stat-view :where(table.t tbody tr) > td { background: var(--surface); }
#stat-view :where(table.t tbody tr:nth-child(even):not(.grp):not(.cli.open):not(.tot)) > td { background: var(--st-row-alt); }
#stat-view :where(table.t tbody tr:hover) > td { background: var(--st-row-hover); }
#stat-view table.t th:first-child, #stat-view table.t td:first-child { position: sticky; left: 0; border-right: 1px solid var(--border); }
#stat-view table.t th:first-child { z-index: 2; }
#stat-view table.t tr.grp > td, #stat-view table.t tr.cli.open > td { background: var(--st-grp-bg); color: var(--ink); font-weight: 700; border-top: 2px solid var(--st-line); }
#stat-view table.t tr.grp > td:first-child, #stat-view table.t tr.cli.open > td:first-child { box-shadow: inset 4px 0 0 var(--lime-text); }
#stat-view table.t tr.grp > td .muted, #stat-view table.t tr.cli > td .muted { font-weight: 500; }
#stat-view table.t tr.cli { cursor: pointer; }
#stat-view table.t tr.cli > td:first-child { font-weight: 600; color: var(--ink); }
#stat-view table.t tr.plat + tr.cli > td { border-top: 2px solid var(--st-line); }
#stat-view table.t tbody tr:first-child.grp > td, #stat-view table.t tbody tr:first-child.cli > td { border-top: none; }
#stat-view table.t tr.sub > td, #stat-view table.t tr.plat > td { color: var(--ink-2); }
#stat-view table.t tr.sub > td.l:first-child, #stat-view table.t tr.plat > td.l:first-child { padding-left: 30px; background-image: linear-gradient(var(--st-guide), var(--st-guide)); background-size: 2px 100%; background-position: 16px 0; background-repeat: no-repeat; }
#stat-view table.t tr.tot > td { background: var(--st-tot-bg); color: var(--ink); font-weight: 800; border-top: 2px solid var(--ink-2); }
#stat-view table.t tr.tot > td:first-child { letter-spacing: .06em; }
#stat-view table.t tr.off > td { color: var(--muted); }
#stat-view table.t td.srt { box-shadow: inset 0 0 0 100vmax var(--st-srt-bg); }
#stat-view table.t td.hl { box-shadow: inset 0 0 0 2px var(--lime-text); font-weight: 700; }
#stat-view table.t.has-cmp td { vertical-align: top; }
#stat-view table.t tbody tr > td.c-good, #stat-view table.t tbody tr > td .c-good, #stat-view .c-good { color: var(--good); font-weight: 600; }
#stat-view table.t tbody tr > td.c-warn, #stat-view table.t tbody tr > td .c-warn, #stat-view .c-warn { color: var(--warning); font-weight: 600; }
#stat-view table.t tbody tr > td.c-crit, #stat-view table.t tbody tr > td .c-crit, #stat-view .c-crit { color: var(--critical); font-weight: 600; }
#stat-view .bg-good { background: var(--good-soft); }
#stat-view .bg-warn { background: var(--warning-soft); }
#stat-view .bg-crit { background: var(--critical-soft); }

#stat-view .st { font-size: .7rem; border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; color: var(--muted); }
#stat-view .st.on { color: var(--good); border-color: var(--good); }
#stat-view select.mini { background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 2px 4px; font: inherit; font-size: .78rem; }
#stat-view select.mini:focus { outline: none; border-color: var(--lime-text); }
#stat-view h3.sec { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 6px; }
#stat-view details.cl { margin-bottom: 10px; }
#stat-view details.cl > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
#stat-view details.cl > summary .muted { font-weight: 400; font-size: .82rem; }
#stat-view .heat td.h { min-width: 46px; text-align: center; }
#stat-view .empty { color: var(--muted); padding: 14px; }
#stat-view .legend { display: inline-flex; gap: 10px; align-items: center; font-size: .76rem; color: var(--muted); }
#stat-view .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 3px; }
#stat-view .cmp { font-size: .68rem; color: var(--muted); font-weight: 400; line-height: 1.1; margin-top: 1px; }
#stat-view img.th, #stat-view span.th { display: inline-block; width: 30px; height: 30px; border-radius: 5px; object-fit: cover; vertical-align: middle; margin-right: 8px; background: var(--surface-2); }
#stat-view .ctl { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 4px 0 10px; font-size: .84rem; color: var(--ink-2); }
#stat-view .ctl label { display: inline-flex; gap: 6px; align-items: center; }
#stat-view .caret { display: inline-block; width: 14px; color: var(--muted); }
#stat-view #st-paceB-t th, #stat-view #st-paceB-t td { padding-left: 8px; padding-right: 8px; }
#stat-view .linkbtn { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--ink-2); padding: 2px 10px; font-size: .78rem; cursor: pointer; }
#stat-view .cmpbox { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .84rem; color: var(--ink-2); }
#stat-view .cmpbox input[type=date] { background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: .8rem; color-scheme: dark; }
:root[data-theme="light"] #stat-view .cmpbox input[type=date] { color-scheme: light; }
#stat-view table.t th[data-tip] { text-decoration: underline dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; }
#stat-view [data-tip] { cursor: help; }
#stat-view table.t th[data-tip], #stat-view .tabs button[data-tip], #stat-view tr[data-open] [data-tip] { cursor: pointer; }
@media (max-width: 700px) { #stat-view .toolbar select, #stat-view .cmpbox select { max-width: 100%; width: 100%; } }

#st-tip { position: fixed; z-index: 1000; max-width: 300px; padding: 7px 10px; border-radius: 8px; font-size: .78rem; line-height: 1.4; font-weight: 500;
  background: var(--ink); color: var(--bg); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); pointer-events: none; opacity: 0; transition: opacity .08s; white-space: normal; text-align: left; }
#st-tip.on { opacity: 1; }

/* Snapshot-only tables state their own reporting window. */
body[data-stat-fixed] :is(#range-chips, #range-dates, #custom-dates, [data-shell-toggle="dates"]) { display: none !important; }
