/* Шрифты: свои файлы из @fontsource (SIL OFL), без внешних CDN. */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/onest-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/onest-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/golos-text-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/golos-text-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Переменные дизайн-системы (docs/design.md). Тема по системе. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #e3e6eb;
  --text: #14181f;
  --muted: #5b6572;
  --accent: #5b6cff;
  --accent-strong: #4a59e6; /* тот же индиго, темнее: текст ссылок и кнопка держат контраст 4,5:1 */
  --on-accent: #ffffff;
  --ok: #1e8f5f;
  --bad: #d6373d;
  --warn: #b7791f;
  --off: #7a8594;

  --font-head: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-text: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-card: 10px;
  --radius-btn: 8px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --page-max: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #151a21;
    --surface-2: #1b222b;
    --border: #262e39;
    --text: #e6eaf0;
    --muted: #8a94a3;
    --accent: #8591ff;
    --accent-strong: #8591ff;
    --on-accent: #0e1116;
    --ok: #2fb67c;
    --bad: #f0666b;
    --warn: #e0a526;
    --off: #6b7685;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 16px;
}

p {
  margin: 0;
}

a {
  color: var(--accent-strong);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Шапка */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--s2);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--s4);
}

.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 20px;
  color: var(--text);
  text-decoration: none;
}

.nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--s3);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 120ms, background-color 120ms;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.topbar .btn {
  flex: none;
}

.topbar__msg {
  flex: 1 0 100%;
  order: 10;
  padding: var(--s2) 0;
  font-size: 14px;
  color: var(--bad);
}

/* Телефон: бренд и «Выйти» в первой строке, разделы второй строкой на всю ширину */
@media (max-width: 479px) {
  .topbar__inner {
    flex-wrap: wrap;
    padding: 0 var(--s3);
  }

  .brand {
    flex: 1 1 auto;
  }

  .topbar .btn {
    min-height: 40px;
    padding: 0 var(--s3);
  }

  .nav {
    order: 5;
    flex: 1 0 100%;
    margin: 0 calc(-1 * var(--s2));
  }

  .nav a {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 var(--s2);
  }
}

/* Страница */
.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.page__title {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

/* Карточка */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--s4);
}

.card > * + * {
  margin-top: var(--s2);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font: 500 14px/1 var(--font-text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms;
}

.btn:hover {
  background: var(--surface-2);
}

.btn--primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--accent-strong);
  filter: brightness(1.08);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--block {
  width: 100%;
}

/* Поля */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.field label {
  font-size: 14px;
  font-weight: 500;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-text);
}

.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.input:disabled {
  opacity: 0.7;
}

/* Плашка сообщения */
.alert {
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 14px;
}

.alert--error {
  color: var(--bad);
  border-color: var(--bad);
}

/* Значок статуса: точка и слово */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 14px;
  font-weight: 500;
}

.status .dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--off);
}

.status.run .dot {
  background: var(--ok);
  animation: breathe 2.4s ease-in-out infinite;
}

.status.down .dot {
  background: var(--bad);
}

.status.restart .dot {
  background: var(--warn);
}

.status.unknown .dot {
  background: transparent;
  border: 2px dashed var(--off);
}

@keyframes breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* Строка-вердикт главной */
.verdict {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.verdict .status {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
}

.verdict .status.unknown {
  color: var(--muted);
}

/* Пустое состояние */
.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s3);
}

.empty p {
  max-width: 60ch;
}

/* Экран входа */
.auth {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s5);
  padding: var(--s4);
}

.auth__head {
  text-align: center;
}

.auth__head h1 {
  font-size: 28px;
}

.auth__card {
  width: 100%;
  max-width: 360px;
}

.auth__card form {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.auth__card .btn {
  min-height: 48px;
}

.auth__card .card > * + *,
.auth__card form > * + * {
  margin-top: 0;
}

/* Телефон: вход на всю ширину, главное действие под рукой */
@media (max-width: 479px) {
  .auth {
    justify-content: flex-start;
    padding-top: var(--s5);
  }

  .auth__card {
    max-width: none;
  }
}

@media (min-width: 768px) {
  h1 {
    font-size: 28px;
  }

  body {
    font-size: 14px;
  }

  .input {
    font-size: 14px;
  }

  .page {
    padding: var(--s5) var(--s4);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
