/* lesnikov-server.ru — монитор. Тёмная тема, без обводок: разделение фоном и воздухом. */
:root {
  color-scheme: dark;
  --page: #0e1013;
  --surface-1: #16191e;
  --surface-2: #1d2127;
  --surface-3: #262b32;
  --text-1: #e9ebee;
  --text-2: #9aa1aa;
  --text-3: #6d7580;
  --grid: #252a31;
  --axis: #3a4049;
  --accent: #338ced;
  --accent-soft: rgba(51, 140, 237, 0.16);
  --series-1: #338ced;
  --series-2: #e76624;
  --series-3: #00a888;
  --good: #0aac23;
  --warning: #fbb315;
  --serious: #f18a59;
  --critical: #dc3c3d;
  --info: #338ced;
  --radius: 14px;
  --radius-s: 8px;
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-1);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 16, 19, 0.88);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.top-inner {
  max-width: 1440px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand .muted { font-weight: 400; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 12px; border-radius: 999px; color: var(--text-2); white-space: nowrap; font-size: 13.5px;
}
.nav a:hover { background: var(--surface-1); color: var(--text-1); }
.nav a.active { background: var(--surface-2); color: var(--text-1); }
.top-right { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.live.stale .pulse { background: var(--warning); }
.live.down .pulse { background: var(--critical); }
.btn-ghost {
  background: transparent; border: 0; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-1); color: var(--text-1); }

/* ---------- раскладка ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 8px 24px 48px; }
section { margin-top: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 2px 12px; flex-wrap: wrap; }
h2 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text-2); }
.section-sub { color: var(--text-3); font-size: 13px; }
.card { background: var(--surface-1); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }

/* ---------- состояние ---------- */
.status { display: flex; flex-direction: column; gap: 2px; }
.status-ok { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.status-ok .icon { width: 22px; height: 22px; }
.alert-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 9px 10px; margin: 0 -10px; border-radius: var(--radius-s);
  cursor: pointer;
}
.alert-row:hover { background: var(--surface-2); }
.alert-row .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-row .area { color: var(--text-3); font-size: 12px; margin-left: auto; white-space: nowrap; padding-left: 12px; }
.status-summary { display: flex; gap: 18px; color: var(--text-2); font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.status-summary b { color: var(--text-1); font-weight: 600; }

/* ---------- плитки ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.tile { background: var(--surface-1); border-radius: var(--radius); padding: 16px 18px 16px; min-width: 0; }
.tile-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.tile-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 2px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value small { font-size: 15px; font-weight: 500; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.tile-sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meter { margin-top: 12px; }

/* ---------- полоски-измерители ---------- */
.meter { height: 6px; border-radius: 3px; background: var(--meter-track, rgba(51, 140, 237, 0.18)); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--meter-fill, var(--accent)); }
.meter.lvl-warning { --meter-fill: var(--warning); --meter-track: rgba(251, 179, 21, 0.18); }
.meter.lvl-critical { --meter-fill: var(--critical); --meter-track: rgba(220, 60, 61, 0.2); }
.meter.thin { height: 4px; }

/* ---------- статусы ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot.good { background: var(--good); }
.dot.warning { background: var(--warning); }
.dot.serious { background: var(--serious); }
.dot.critical { background: var(--critical); }
.dot.info { background: var(--info); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.chip.warn { background: rgba(251, 179, 21, 0.14); color: #f5d27a; }
.chip.crit { background: rgba(220, 60, 61, 0.16); color: #f19a9a; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- диапазон ---------- */
.seg { display: inline-flex; background: var(--surface-1); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2); padding: 5px 12px; border-radius: 999px; cursor: pointer;
  font-size: 13px; white-space: nowrap;
}
.seg button:hover { color: var(--text-1); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text-1); }

/* ---------- графики ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.chart-card { padding: 16px 18px 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.chart-title { font-size: 14px; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend b { color: var(--text-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.key { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.chart-plot { position: relative; height: 200px; transition: opacity 0.2s; }
.chart-plot.loading { opacity: 0.55; }
.chart-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-plot svg:focus { outline: none; }
.chart-plot svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 13px; pointer-events: none; }
.axis-text { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--font); }
.ref-text { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.tooltip {
  position: absolute; top: 4px; pointer-events: none; z-index: 5;
  background: var(--surface-3); border-radius: 10px; padding: 8px 11px; min-width: 150px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); font-size: 12.5px;
}
.tooltip .tt-time { color: var(--text-2); margin-bottom: 4px; white-space: nowrap; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; line-height: 1.6; }
.tooltip .tt-row b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-1); }
.tooltip .tt-row span { color: var(--text-2); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 0 8px 8px; white-space: nowrap;
}
td { padding: 10px 8px; vertical-align: top; }
tbody tr td:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); }
tbody tr td:last-child { border-radius: 0 var(--radius-s) var(--radius-s) 0; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
tbody tr:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
.cell-main { font-weight: 500; }
.cell-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.empty { color: var(--text-2); padding: 8px 0; }
.empty code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--text-1); }

/* ---------- списки ключ-значение ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.disk { margin-bottom: 16px; }
.disk:last-child { margin-bottom: 0; }
.disk-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 16px; }
.core-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.svc { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.svc .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc .since { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.stack > * + * { margin-top: var(--gap); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-bottom: 16px; }
.mini-stats .v { font-size: 18px; font-weight: 600; margin-top: 2px; }
.mini-stats .l { color: var(--text-2); font-size: 12.5px; }

footer { max-width: 1440px; margin: 0 auto; padding: 0 24px 32px; color: var(--text-3); font-size: 12.5px; }

/* ---------- иконки ---------- */
.icon { display: inline-block; vertical-align: middle; }

/* ---------- вход ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface-1); border-radius: 18px; padding: 32px 28px 28px; }
.login-card .brand { margin-bottom: 6px; font-size: 17px; }
.login-card .brand-mark { width: 30px; height: 30px; }
.login-sub { color: var(--text-2); margin: 0 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.field input {
  width: 100%; border: 0; outline: 0; background: var(--surface-2); color: var(--text-1);
  padding: 11px 13px; border-radius: 10px; font: inherit; font-size: 15px;
}
.field input:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.btn-primary {
  width: 100%; border: 0; background: var(--accent); color: #fff; padding: 11px 14px; border-radius: 10px;
  font-weight: 600; cursor: pointer; margin-top: 6px;
}
.btn-primary:hover { background: #4697f0; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.form-error { color: #f19a9a; font-size: 13.5px; min-height: 20px; margin-top: 12px; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .charts, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .top-inner { flex-wrap: wrap; padding: 10px 16px; gap: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .top-right { margin-left: auto; }
  html { scroll-padding-top: 110px; }
  main { padding: 4px 16px 40px; }
  footer { padding: 0 16px 28px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile-value { font-size: 22px; }
  .chart-plot { height: 170px; }
  .live .txt { display: none; }
  /* таблицы превращаются в карточки */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  table.cards tbody tr td, table.cards tbody tr:nth-child(even) td, table.cards tbody tr:hover td { background: none; border-radius: 0; }
  table.cards td { padding: 5px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex: none; }
  table.cards td.first { display: block; text-align: left; padding-bottom: 8px; }
  table.cards td.first::before { content: none; }
  table.cards td > * { min-width: 0; }
  .table-wrap { margin: 0; overflow: visible; }
  .alert-row .area { display: none; }
  table.cards td .meter { display: none; }
  table.cards .chip:not(.warn):not(.crit) { background: var(--surface-3); }
}
@media (max-width: 420px) {
  .tile { padding: 12px; }
  .tile-value { font-size: 19px; }
  .tile-label { font-size: 12.5px; }
  .tile-sub { white-space: normal; font-size: 12px; }
}
.mt { margin-top: var(--gap); }
section.first-section { margin-top: 12px; }
.mt-s { margin-top: 6px; }
