:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #14161a; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --chip: #eef1f5;
  --tab: rgba(255,255,255,.92);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --text: #eef0f3; --muted: #9aa3af; --line: #262a33;
    --accent: #60a5fa; --ok: #22c55e; --warn: #f59e0b; --bad: #f87171; --chip: #222631;
    --tab: rgba(20,22,27,.92);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { padding-top: env(safe-area-inset-top); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
h1 { font-size: 28px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; }
.top { max-width: 720px; margin: 0 auto; display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 6px; }
main { padding: 0 16px calc(90px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .d { font-size: 13px; font-weight: 600; } .up { color: var(--ok); } .down { color: var(--bad); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .name { flex: 1; min-width: 0; } .row .val { color: var(--muted); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.hint { font-size: 12px; color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chip { background: var(--chip); color: var(--text); border: 0; border-radius: 999px; padding: 6px 12px; font-size: 14px; white-space: nowrap; }
a.chip { text-decoration: none; }
.chip.on { background: var(--accent); color: #fff; }
.alert { padding: 12px 0; border-top: 1px solid var(--line); }
.alert:first-child { border-top: 0; }
.alert .h { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.alert .t { margin-top: 4px; font-weight: 600; } .alert.unread .t::before { content: "● "; color: var(--accent); }
.alert .b { margin-top: 4px; font-size: 14px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 600;
  background: var(--chip); color: var(--text); margin-top: 10px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; margin: 0; }
input, select { width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); margin-top: 10px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--tab);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; font-size: 11px; color: var(--muted); text-decoration: none; padding: 8px 0 6px; position: relative; }
.tabs a .ic { display: block; font-size: 22px; line-height: 1.2; filter: grayscale(1); opacity: .7; }
.tabs a.on { color: var(--accent); } .tabs a.on .ic { filter: none; opacity: 1; }
.badge { position: absolute; top: 4px; left: 50%; margin-left: 8px; background: var(--bad); color: #fff; font-size: 11px;
  border-radius: 999px; padding: 1px 6px; font-weight: 700; }
.login-box { max-width: 360px; margin: 18vh auto 0; padding: 0 24px; text-align: center; }
.logo { font-size: 48px; color: var(--accent); }
.msg { min-height: 20px; color: var(--bad); font-size: 14px; }
.bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.spark { width: 100%; height: 44px; display: block; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: 16px; padding: 16px; text-decoration: none; color: var(--text); }
.tile .ic { font-size: 28px; } .tile .n { font-weight: 600; margin-top: 6px; } .tile .s { font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
td, th { padding: 7px 4px; border-top: 1px solid var(--line); text-align: right; } th { color: var(--muted); font-weight: 500; font-size: 12px; }
td:first-child, th:first-child { text-align: left; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 9; }
.ptr { text-align: center; color: var(--muted); font-size: 13px; height: 0; overflow: hidden; transition: height .2s; }
.back { background: none; border: 0; color: var(--accent); font-size: 34px; line-height: 1; padding: 0 10px 0 0; margin-right: 2px; }
.top h1 { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.tile { display: block; }
label.btn { cursor: pointer; }
/* ---------- свои экраны показателей ---------- */
:root { --s1:#2a78d6; --s2:#eb6834; --s3:#1baf7a; --s4:#eda100; --s5:#e87ba4; --s6:#008300; --s7:#4a3aa7; --s8:#e34948; --s-other:#9ca3af; }
@media (prefers-color-scheme: dark) {
  :root { --s1:#3987e5; --s2:#d95926; --s3:#199e70; --s4:#c98500; --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767; --s-other:#6b7280; }
}
.bi-root { transition: opacity .15s; }
.bi-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bi-f { flex: 1 1 150px; font-size: 12px; color: var(--muted); }
.bi-f select { margin-top: 2px; padding: 9px 10px; font-size: 15px; }
.bi-h { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.bi-card { padding: 12px 14px; }
.bi-stat .v { font-variant-numeric: normal; }
.bi-stat .d { margin-top: 2px; }
.bi-stat .bi-wk { margin-top: 4px; }
/* 13.10.2026: метки свежести и «сейчас в работе», «главное за неделю», неделя против нормы, полосы of/stack, свёрнутая карточка */
.bi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bi-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--chip); }
.bi-chip b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.bi-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.bi-dot.ok { background: var(--ok); } .bi-dot.warn { background: var(--warn); } .bi-dot.bad { background: var(--bad); }
.bi-alerts { display: grid; gap: 9px; margin-top: 6px; }
.bi-al { display: grid; grid-template-columns: 4px 1fr; gap: 12px; }
.bi-al::before { content: ""; border-radius: 4px; background: var(--line); }
.bi-al.bad::before { background: var(--bad); } .bi-al.warn::before { background: var(--warn); } .bi-al.ok::before { background: var(--ok); }
.bi-al small { display: block; color: var(--muted); font-size: 12.5px; }
.bi-avg { margin-top: 8px; display: grid; gap: 4px; font-size: 12.5px; }
.bi-avg .up { color: var(--ok); } .bi-avg .down { color: var(--bad); }
.bi-avg-bar { position: relative; height: 8px; border-radius: 4px; background: var(--chip); }
.bi-avg-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); max-width: 100%; }
.bi-avg-bar b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 1px; }
.bi-bar .bl small { display: block; font-size: 11.5px; color: var(--muted); white-space: normal; }
.bi-stat .v.long { font-size: 20px; }
.bi-bar .bt.stk { display: flex; overflow: hidden; border-radius: 4px; background: var(--chip); }
.bi-bar .bt.stk i { border-radius: 0; flex: none; }
.bi-bar .bt.stk i.f { background: var(--s1); } .bi-bar .bt.stk i.s { background: var(--ok); } .bi-bar .bt.stk i.x { background: var(--bad); }
.bi-bar .bs.warn { color: var(--warn); font-weight: 600; }
.bi-stk-legend { margin: 4px 0 6px; } .bi-stk-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bi-stk-f { background: var(--s1); } .bi-stk-s { background: var(--ok); } .bi-stk-x { background: var(--bad); }
.bi-bar .bv small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.bi-ghost { opacity: .28; }
.bi-spark-multi { height: 34px; }
.bi-spark-legend { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.bi-spark-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.bi-fold > summary { cursor: pointer; list-style: none; } .bi-fold > summary::before { content: "▸ "; color: var(--muted); }
.bi-fold[open] > summary::before { content: "▾ "; }
.bi-sec { margin: 14px 4px 6px; } .bi-sec:first-child { margin-top: 0; } .bi-body > .bi-sec { grid-column: 1 / -1; }
.bi-spark { width: 100%; height: 24px; display: block; margin-top: 6px; }
.bi-spark-line { fill: none; stroke: var(--muted); stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .7; }
.bi-spark-dot { fill: var(--accent); }
.bi-chart { position: relative; margin-top: 8px; touch-action: pan-y; }
.bi-chart svg { display: block; width: 100%; height: auto; }
.bi-grid { stroke: var(--line); stroke-width: 1; }
.bi-ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bi-cross { stroke: var(--muted); stroke-width: 1; }
.bi-zero { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.bi-tw a { color: var(--accent); text-decoration: none; }
.bi-ring { stroke: var(--card); stroke-width: 2; }
.bi-tip { position: absolute; top: -6px; transform: translateY(-100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.18); pointer-events: none; z-index: 3; min-width: 140px; max-width: 260px; }
.bi-tip-h { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.bi-tip-r { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.bi-tip-r i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.bi-tip-r b { font-variant-numeric: tabular-nums; }
.bi-tip-r span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.bi-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; }
.bi-lg { background: none; border: 0; padding: 4px 0; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.bi-lg i { width: 10px; height: 10px; border-radius: 3px; } .bi-lg i.ln { height: 2px; width: 14px; border-radius: 1px; }
.bi-lg.off { opacity: .35; }
.bi-legend .hint { flex-basis: 100%; }
.bi-bar { display: grid; grid-template-columns: minmax(0, 42%) 1fr auto minmax(36px, auto); align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 6px 0; font: inherit; font-size: 14px; color: var(--text); text-align: left; border-top: 1px solid var(--line); }
.bi-bar:first-of-type { border-top: 0; }
.bi-bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-bar .bt { height: 12px; }
.bi-bar .bt i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; max-width: 100%; }
.bi-bar .bv { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.bi-bar .bs { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.bi-bar.sel { background: var(--chip); border-radius: 8px; }
.bi-bar.sel .bt i { background: var(--s2); }
.bi-tw { overflow-x: auto; margin-top: 6px; -webkit-overflow-scrolling: touch; }
.bi-tw table { font-size: 13px; } .bi-tw td, .bi-tw th { white-space: nowrap; padding: 6px 8px; }
.bi-tw td:first-child { white-space: normal; min-width: 120px; max-width: 220px; }
.bi-tw th { cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--card); }
tr.tap { cursor: pointer; } tr.tap:active { background: var(--chip); }
.bi-text p { margin: 4px 0; } .bi-text b { color: var(--text); font-weight: 600; } .bi-text code { font-size: 12px; }
/* 04.10.2026: таблица kind=grouped — блок заголовком над строками; нули приглушены */
.bi-tw tr.bi-grp td { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding-top: 16px; }
.bi-tw td.zero { color: var(--muted); opacity: .55; }
/* 04.10.2026: таблица шире экрана — тень у края, куда можно листать (на телефоне колонки «уезжали» молча) */
.bi-tw { background:
  linear-gradient(to right, var(--card) 30%, transparent) left center / 32px 100% no-repeat local,
  linear-gradient(to left, var(--card) 30%, transparent) right center / 32px 100% no-repeat local,
  radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.16), transparent) left center / 12px 100% no-repeat scroll,
  radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.16), transparent) right center / 12px 100% no-repeat scroll; }
