/* MON — «Штиль»: язык приложений iPhone. Сгруппированные списки, крупные заголовки, норма без цвета.
   Выбор пользователя 2026-10-07 из трёх направлений (Пульт / Штиль / Табло). */
:root {
  --bg: #F2F2F7; --cell: #FFFFFF; --fill: #E9E9EB; --sep: #C6C6C8; --sep2: #E5E5EA;
  --label: #000000; --label2: #3C3C43; --muted: #6C6C70; --glyph: #8E8E93; --chev: #C7C7CC;
  --tint: #007AFF; --tint-text: #0062CC; --sel: #E5F0FF; --side: #EBEBF0;
  --crit: #FF3B30; --crit-text: #D70015; --warn: #FF9500; --warn-text: #C93400;
  --ok: #34C759; --ok-text: #248A3D; --stale: #8E8E93;
  /* Палитра графиков: слоты 1-4 эталонной палитры dataviz, проверены валидатором на фоне ячейки */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --grid: #EEEEF0; --axis: #C7C7CC; --tick: #8A8A8E;
  --card: var(--cell); --line: var(--sep2); --fg: var(--label);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --cell: #1C1C1E; --fill: #2C2C2E; --sep: #38383A; --sep2: #2C2C2E;
    --label: #FFFFFF; --label2: #D1D1D6; --muted: #98989F; --glyph: #8E8E93; --chev: #5A5A5E;
    --tint: #0A84FF; --tint-text: #409CFF; --sel: #0B2A4A; --side: #1C1C1E;
    --crit: #FF453A; --crit-text: #FF6961; --warn: #FF9F0A; --warn-text: #FFB340;
    --ok: #30D158; --ok-text: #30D158; --stale: #8E8E93;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --grid: #2C2C2E; --axis: #48484A; --tick: #8E8E93;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--label); font: 17px/1.35 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--tint-text); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* --- Каркас: сайдбар (ПК), колонка списка (широкий ПК), содержимое, таббар (телефон) --- */
#app { padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 100px); max-width: 980px; margin: 0 auto; }
.side, .list { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 50px; font-size: 10px; font-weight: 500; color: var(--glyph); }
.tabbar a.on { color: var(--tint); }
.tabbar .tb-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--crit); color: #fff; font-size: 12px; font-weight: 600; line-height: 18px; text-align: center; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 2px; position: fixed; top: 0; bottom: 0; left: 0; width: 250px; overflow-y: auto;
    padding: 22px 12px; background: var(--side); border-right: .5px solid var(--sep); }
  #app { margin-left: 250px; padding: 26px 32px 48px; max-width: none; }
  #app > * { max-width: 980px; }
}
@media (min-width: 1200px) {
  body.with-list .list { display: block; position: fixed; top: 0; bottom: 0; left: 250px; width: 340px; overflow-y: auto;
    padding: 22px 12px 40px; background: var(--cell); border-right: .5px solid var(--sep); }
  body.with-list #app { margin-left: 590px; }
}
.side .brand { font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--muted); padding: 0 10px 10px; }
.side .nav { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--label); font-size: 15px; }
.side .nav svg { color: var(--tint); flex: none; }
.side .nav.on { background: var(--tint); color: #fff; }
.side .nav.on svg { color: #fff; }
.side .nav .n { margin-left: auto; color: var(--muted); font-size: 14px; }
.side .nav.on .n { color: #fff; }
.side .shead { font-size: 13px; font-weight: 600; color: var(--muted); padding: 18px 10px 6px; }
.side .grow { flex: 1; }

/* --- Типографика --- */
.navrow { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 17px; color: var(--tint-text); }
.textbtn { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--tint-text); font-size: 17px; }
h1 { font-size: 34px; line-height: 1.15; font-weight: 700; margin: 2px 0 4px; letter-spacing: .01em; }
.subtitle { font-size: 15px; color: var(--muted); margin: 0 0 4px; }
.lede { font-size: 15px; color: var(--label2); margin: 6px 0 0; line-height: 1.4; }
h2, .sect-h { font-size: 13px; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; margin: 26px 0 7px 16px; }
.foot { font-size: 13px; color: var(--muted); margin: 7px 16px 0; line-height: 1.4; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
code { font: 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
@media (min-width: 900px) { h1 { font-size: 30px; } }

/* --- Сгруппированный список --- */
.group { background: var(--cell); border-radius: 12px; overflow: hidden; }
.cell { display: flex; align-items: center; gap: 12px; padding-left: 16px; min-height: 44px; color: var(--label); width: 100%;
  background: none; border: 0; text-align: left; }
a.cell:active, button.cell:active { background: var(--fill); }
.cell .cb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px 8px 0; }
.group > .cell:not(:last-child) .cb, .group > .cellwrap:not(:last-child) { border-bottom: .5px solid var(--sep); }
.cell .tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cell .t1 { font-size: 17px; overflow-wrap: anywhere; }
.cell .t2 { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.cell .tr { font-size: 15px; color: var(--muted); white-space: nowrap; text-align: right; }
.chev { flex: none; color: var(--chev); }
.vd { font-size: 15px; color: var(--muted); text-align: right; }
.vd.crit, .t-crit { color: var(--crit-text); } .vd.warn, .t-warn { color: var(--warn-text); } .vd.ok, .t-ok { color: var(--ok-text); }
.cell.sel { background: var(--sel); }
.cellwrap .cell .cb { border-bottom: 0; }
.cellacts { display: flex; gap: 8px; padding: 0 16px 12px 58px; flex-wrap: wrap; }

/* Квадратные значки в духе «Настроек» iOS */
.sq { width: 30px; height: 30px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--glyph); }
.sq.crit { background: var(--crit); } .sq.warn { background: var(--warn); } .sq.ok { background: var(--ok); }
.sq.offline, .sq.info, .sq.pending { background: var(--stale); }
.sdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--chev); }
.sdot.crit { background: var(--crit); } .sdot.warn { background: var(--warn); }
.sdot.offline { background: none; border: 2px solid var(--stale); }

/* --- Карточки, кнопки, сегменты --- */
.card { background: var(--cell); border-radius: 12px; padding: 14px 16px; }
.card + .card, .group + .card, .card + .group { margin-top: 12px; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0; font-size: 17px; font-weight: 500; background: var(--fill); color: var(--tint-text); }
.btn.fill { background: var(--tint); color: #fff; font-weight: 600; }
.btn.danger { color: var(--crit-text); }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: 15px; border-radius: 8px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btns .btn { flex: 1 1 120px; }
button:not(.btn):not(.cell):not(.textbtn):not(.nav) { border: 0; border-radius: 8px; padding: 0 12px; min-height: 32px; background: var(--fill); color: var(--tint-text); font-size: 15px; }
button.primary { background: var(--tint); color: #fff; font-weight: 600; }
.seg { display: flex; padding: 2px; border-radius: 9px; background: var(--fill); margin: 10px 0 4px; overflow-x: auto; }
.seg button, .filters button { flex: 1 0 auto; }
.filters { display: flex; padding: 2px; border-radius: 9px; background: var(--fill); margin: 10px 0 12px; overflow-x: auto; gap: 0; flex-wrap: nowrap; }
.filters button, .seg button { min-height: 30px !important; border-radius: 7px !important; background: none !important; color: var(--label) !important; font-size: 14px !important; padding: 0 12px !important; white-space: nowrap; }
.filters button.on, .seg button.on { background: var(--cell) !important; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (prefers-color-scheme: dark) { .filters button.on, .seg button.on { background: #636366 !important; } }

.search { display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 0 8px; margin: 10px 0 2px; color: var(--glyph); }
.search input { flex: 1; border: 0; background: none; min-height: 36px; font-size: 17px; outline: none; color: var(--label); }

/* Тревога на экране сервера */
.al { background: var(--cell); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.al + .al { margin-top: 10px; }
.al .lvl { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; display: flex; align-items: center; gap: 7px; }
.al .msg { font-size: 20px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.al .meta { font-size: 13px; color: var(--muted); }
.calm { display: flex; align-items: center; gap: 12px; }
.hero { text-align: center; padding: 34px 16px 30px; }
.hero .big { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; }
.hero .h { font-size: 22px; font-weight: 700; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--fill); color: var(--muted); vertical-align: 1px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.notes { font-size: 15px; color: var(--label2); white-space: pre-wrap; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--muted); }
.b-crit { background: var(--crit); color: #fff; } .b-warn { background: var(--warn); color: #000; } .b-ok { background: var(--ok); color: #000; }
.err { color: var(--crit-text); min-height: 1.3em; font-size: 15px; margin-top: 6px; }

/* Мини-графики 24 ч */
.sparkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; }
.spark-box { display: block; padding: 10px 14px; color: var(--label); border-bottom: .5px solid var(--sep2); }
.spark-label { font-size: 13px; color: var(--muted); }
.spark-row { display: flex; align-items: center; gap: 8px; }
.spark-row svg { flex: none; }
.spark-val { font-size: 15px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- Таблицы глубоких разделов --- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: .5px solid var(--sep2); white-space: nowrap; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 260px; }
tr.bad td { color: var(--crit-text); } tr.dim td { color: var(--muted); }
.card.scroll, .card .scroll { margin: 0 -6px; }
.card table + table, .card .scroll + .scroll { margin-top: 10px; }
.ctitle { font-weight: 600; margin: 6px 0 6px; font-size: 15px; }
.kvs { display: flex; gap: 6px 18px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 15px; }
.bar { height: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; min-width: 60px; margin-top: 7px; }
.bar > i { display: block; height: 100%; background: var(--glyph); }
.bar.warn > i { background: var(--warn); } .bar.crit > i { background: var(--crit); }
.ovgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 12px; }
.ovgrid .card + .card { margin-top: 0; }
.warnbox { box-shadow: inset 0 0 0 1.5px var(--warn); margin-bottom: 12px; }
.chk { display: inline-block; min-width: 1.2em; text-align: center; font-weight: 700; }
.chk.st-ok { color: var(--ok-text); } .chk.st-warn { color: var(--warn-text); } .chk.st-crit { color: var(--crit-text); } .chk.st-info { color: var(--muted); }
.cfg { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: .5px solid var(--sep2); font-size: 15px; }
.cfg:first-child { border-top: 0; }
.cfg-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cfg.st-ok { color: var(--muted); } .cfg.st-ok b { font-weight: 500; }
.cfg .acts { flex-shrink: 0; }
@media (max-width: 600px) { .cfg { flex-wrap: wrap; } .cfg .acts { width: 100%; padding-left: 28px; } }

/* --- Графики (charts.js) --- */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 12px; transition: opacity .2s; }
.charts.loading { opacity: .55; }
.chart { background: var(--cell); border-radius: 12px; padding: 12px 14px 4px; }
.chart-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.chart-title { font-weight: 600; font-size: 15px; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--s1); vertical-align: middle; }
.key.s2 { background: var(--s2); } .key.s3 { background: var(--s3); } .key.s4 { background: var(--s4); }
.chart-box { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-empty { padding: 40px 0; text-align: center; }
.cgrid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.cgrid line.baseline { stroke: var(--axis); }
.tick, .endlbl { font-size: 11px; fill: var(--tick); font-variant-numeric: tabular-nums; }
.endlbl { fill: var(--label); font-weight: 600; }
.ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke: var(--s1); }
.ln.thin { stroke-width: 1.5; }
.ln.s2 { stroke: var(--s2); } .ln.s3 { stroke: var(--s3); } .ln.s4 { stroke: var(--s4); }
.cross { stroke: var(--tick); stroke-width: 1; }
.dot { fill: var(--s1); stroke: var(--cell); stroke-width: 2; }
.dot.s2 { fill: var(--s2); } .dot.s3 { fill: var(--s3); } .dot.s4 { fill: var(--s4); }
.chart-tip { position: absolute; top: 4px; pointer-events: none; background: var(--cell); border: .5px solid var(--sep);
  border-radius: 10px; padding: 6px 9px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.15); white-space: nowrap; z-index: 2; }
.tip-time { color: var(--muted); margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 6px; } .tip-row b { font-variant-numeric: tabular-nums; }

/* --- Сутки --- */
.gantt { display: grid; grid-template-columns: minmax(110px, 240px) 1fr; gap: 8px; }
.gnames div { height: 22px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gline { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.gbar { fill: var(--s1); } .gbar.hv { fill: var(--crit); } .gbar.cl { fill: #AF52DE; }

/* --- Листы (диалоги снизу) --- */
dialog.sheet { border: 0; padding: 0; background: transparent; color: var(--label); width: min(100%, 440px); max-width: 100%; max-height: 92vh;
  margin: auto auto 0; }
dialog.sheet::backdrop { background: rgba(0,0,0,.35); }
.sheet-in { padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); display: flex; flex-direction: column; gap: 8px; }
.sheet .group .cell { justify-content: center; font-size: 20px; color: var(--tint-text); min-height: 56px; }
.sheet .group .cell .cb { justify-content: center; padding-right: 16px; }
.sheet .cap { text-align: center; font-size: 13px; color: var(--muted); padding: 12px 16px; border-bottom: .5px solid var(--sep); }
.sheet .cancel { font-weight: 600; }
@media (min-width: 900px) { dialog.sheet { margin: auto; } }
dialog.form { border: 0; padding: 0; border-radius: 14px; background: var(--bg); color: var(--label); width: min(100% - 24px, 480px); max-height: 92vh; }
dialog.form::backdrop { background: rgba(0,0,0,.35); }
.formbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: .5px solid var(--sep); background: var(--cell); }
.formbar b { font-size: 17px; }
.formbody { padding: 0 16px 20px; }
.field { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 44px; }
.group > .field:not(:last-child) { border-bottom: .5px solid var(--sep); }
.field label { width: 96px; flex: none; font-size: 17px; }
.field input, .field textarea { flex: 1; min-width: 0; border: 0; background: none; font-size: 17px; padding: 11px 0; outline: none; color: var(--label); }
.field textarea { resize: vertical; min-height: 80px; }
input:not([type=checkbox]) { border-radius: 10px; }

/* --- Вход --- */
.login { max-width: 400px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.login .logo { width: 72px; height: 72px; border-radius: 16px; margin: 0 auto 6px; }
.login h1 { text-align: center; }
.login .btn { width: 100%; }
.login details summary { cursor: pointer; padding: 10px 0; text-align: center; color: var(--tint-text); list-style: none; font-size: 15px; }
.login details summary::-webkit-details-marker { display: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; padding: 12px 16px; }
.check input { width: 20px; height: 20px; }

/* Строка раздела: название целиком, вердикт обрезается многоточием */
.cell .t1.fix { flex: none; }
.cell .vd.fit { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Мини-график: значение над линией, чтобы не вылезало на узких ячейках */
.spark-row { flex-direction: column-reverse; align-items: flex-start; gap: 2px; }
.spark-val { font-size: 17px; }
