/* Пульт Бюро — минимальная нейтральная тема, две схемы.
   Один уровень рамок: белые карточки-итоги. Шкалы и плитки служб —
   тихая заливка без рамок. Разделы разделяет воздух, а не линии.
   Шрифт Manrope подключается в этап со шрифтовым CSP (static/fonts). */

:root {
  --bg: #f9f9f7;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --line: #e4e4e0;
  --line-strong: #c9c9c3;
  --text: #1b1b18;
  --text-soft: #5f5f59;
  --text-faint: #68685f;
  --ok: #1f7a4d;
  --ok-bg: #e6f2ea;
  --warn: #8a5a00;
  --warn-bg: #faf0da;
  --bad: #a5251f;
  --bad-bg: #fbe9e7;
  --focus: #1b1b18;
  --top-bg: rgba(249, 249, 247, .86);
  --radius: 12px;
  --radius-sm: 9px;
  --gap: 12px;
  --font: "Manrope", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #151513;
  --surface: #1d1d1b;
  --surface-2: #262624;
  --line: #333331;
  --line-strong: #484843;
  --text: #f1f1ee;
  --text-soft: #b3b3a9;
  --text-faint: #8f8f85;
  --ok: #6fcf9b;
  --ok-bg: #17281f;
  --warn: #e2b25f;
  --warn-bg: #2b2416;
  --bad: #ef8b83;
  --bad-bg: #2c1a18;
  --focus: #f1f1ee;
  --top-bg: rgba(21, 21, 19, .86);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--text); color: var(--bg); }

.wrap {
  width: min(1120px, 100% - 40px);
  margin: 0 auto;
}

/* --- шапка --- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  background: var(--top-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand.large { font-size: 19px; }

.mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 650;
}

.brand.large .mark { width: 33px; height: 33px; font-size: 16px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.update {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

.update::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.update.ok::before { background: var(--ok); }
.update.stale::before { background: var(--warn); }

.inline { display: inline; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  padding: 6px 13px;
  font-weight: 500;
  transition: border-color .15s ease, background .15s ease;
}

button:hover { border-color: var(--text-soft); background: var(--surface-2); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ghost { background: transparent; }

/* --- переключатель темы: луна в светлой, солнце в тёмной --- */

.theme-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .16s ease, background .16s ease;
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.theme-toggle:active { transform: none; }
.theme-toggle:focus-visible { color: var(--text); outline: 2px solid var(--focus); outline-offset: 2px; }

.theme-icon {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.theme-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-icon-sun { opacity: 0; transform: rotate(-25deg) scale(.85); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(25deg) scale(.85); }
[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }

.gate-theme { margin: 14px auto 0; }

@media (max-width: 620px) {
  .theme-toggle { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
}
.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  width: 100%;
  padding: 10px 14px;
  font-weight: 600;
}
.primary:hover { background: var(--text); opacity: .88; }

/* --- карточки-итоги: единственный уровень с рамкой --- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: var(--gap);
  margin: 26px 0 4px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px 13px;
}

.card .label {
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 5px;
}

.card .value {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.card .sub {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 3px;
}

/* --- блоки: воздух вместо линеек --- */

.block { margin-top: 40px; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.hint { color: var(--text-faint); font-size: 12.5px; }

/* --- шкалы сервера --- */

.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--gap);
}

.gauge {
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 13px 15px 14px;
}

.gauge-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.gauge-name { color: var(--text-soft); font-size: 13px; font-weight: 500; }
.gauge-num { font-variant-numeric: tabular-nums; font-weight: 650; }

.bar {
  height: 6px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--text);
  transition: width .3s ease;
}

.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

.gauge-foot {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}

/* --- плитки служб --- */

.svc-grid { margin-top: 2px; }

.svc-group {
  margin: 16px 0 8px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.svc-group:first-child { margin-top: 10px; }

.svc-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 8px;
}

.svc {
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 9px 12px 10px;
  min-width: 0;
}

.svc-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.svc-head .title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-status {
  display: block;
  margin-top: 1px;
  padding-left: 14px;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.svc-status.ok { color: var(--ok); }
.svc-status.warn { color: var(--warn); }
.svc-status.bad { color: var(--bad); }

/* --- списки --- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list > li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.list > li:last-child { border-bottom: 0; }

.name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  color: var(--text-faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.mono { font-family: var(--mono); font-size: 12px; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
  color: var(--text-soft);
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }

.grp {
  margin-top: 18px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.grp:first-child { margin-top: 6px; }

/* --- проекты --- */

.projects > li {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 6px;
  padding: 13px 2px;
}

.projects .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.projects .row > div {
  min-width: 0;
  max-width: 100%;
}

.projects .commit {
  color: var(--text-soft);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.projects .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* --- служебное --- */

.banner {
  margin-top: 22px;
  border: 1px solid transparent;
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn);
  padding: 10px 14px;
  font-size: 13.5px;
}
.banner.bad { border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad); }

.foot {
  margin: 44px 0 32px;
  color: var(--text-faint);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.empty {
  color: var(--text-faint);
  font-size: 13.5px;
  padding: 12px 2px;
}

/* --- вход --- */

.signin { display: grid; place-items: center; min-height: 100vh; padding: 24px; }

.gate { width: min(380px, 100%); }

.gate-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 30px 28px 28px;
}

.gate-lead {
  color: var(--text-soft);
  font-size: 13.5px;
  margin: 10px 0 22px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  margin: 14px 0 6px;
}

select, input[type="password"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 11px;
}

.gate form .primary { margin-top: 20px; }

.error {
  margin: 12px 0 0;
  color: var(--bad);
  font-size: 13px;
}

@media (max-width: 620px) {
  .wrap { width: min(1120px, 100% - 28px); }
  .svc-row { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
  .svc { padding: 8px 10px 9px; }
  .svc-head .title { font-size: 13px; white-space: normal; }
  .svc-status { padding-left: 0; }
  .top-inner { min-height: 56px; padding: 6px 0; }
  .top-actions { flex: 1 1 160px; justify-content: flex-end; }
  .update { order: 3; width: 100%; margin: 2px 0 0; }
  .cards { grid-template-columns: 1fr 1fr; margin-top: 18px; }
  .card { padding: 12px 13px 11px; }
  .card .value { font-size: 18px; }
  .meta { font-size: 12px; }
  .list > li { padding: 10px 0; }
  .block { margin-top: 32px; }
  h2 { font-size: 15.5px; }
}

@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  button:active { transform: none; }
}
