/* ============================================================
   BATYR intra — тёмная служебная тема на токенах Treeline

   Каркас (--shell) и акцент для тёмного (--accent-on-dark) — из дизайн-системы сайта:
   на тёмном фоне обычный --accent #4C6B2F не проходит AA, поэтому только #8AB05E.
   Шрифты не грузим со сторонних сайтов (CSP): Manrope/Golos, если установлены, иначе системный.
   Поля ввода 16px — иначе iOS Safari зумит страницу при фокусе.
   ============================================================ */
:root {
  --shell: #171A18;
  --shell-2: #242A24;
  --bg: #0F1210;
  --surface: #171A18;
  --surface-2: #1D211E;
  --line: #2C332D;
  --text: #E8ECE8;
  --muted: #8E9691;
  --accent: #8AB05E;        /* accent-on-dark */
  --accent-ink: #11160D;    /* текст на зелёной кнопке */
  --accent-tint: rgba(138, 176, 94, .14);
  --bad: #E26B5A;           /* --sale, осветлённый для тёмного фона */
  --bad-tint: rgba(226, 107, 90, .14);
  --warn: #D9A844;
  --warn-tint: rgba(217, 168, 68, .14);
  --off: #5F6762;
  --r-sm: 4px; --r-md: 6px; --r-pill: 20px;
  --font-head: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-head); margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
code, pre { font-family: var(--font-mono); font-size: 13px; }
code { background: var(--shell-2); padding: 1px 6px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }

/* UI-метка Treeline: 12px, прописные, разрядка */
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------------------------------------------------------------- каркас */
.shell { background: var(--shell); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.shell__bar {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.shell__me { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; }
.me { display: flex; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; }
.me .label { color: var(--accent); }

.brand { display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--text); }
.brand__mark { font: 800 18px/1 var(--font-head); letter-spacing: .14em; }
.brand__sub { font: 600 12px/1 var(--font-head); letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); }
.brand--big .brand__mark { font-size: 26px; }
.brand--big .brand__sub { font-size: 14px; }

/* Навигация — пилюли, а не монолит со строками-разделителями */
.nav {
  max-width: 1200px; margin: 0 auto; padding: 0 16px 10px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav__item {
  flex: 0 0 auto; padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav__item:hover { border-color: var(--accent); }
.nav__item.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.nav__item.is-soon { color: var(--off); border-style: dashed; cursor: default; }
.nav__item.is-soon:hover { border-color: var(--line); }

.page { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 16px 32px; flex: 1; }
.page--center { display: flex; align-items: center; justify-content: center; }
.foot { max-width: 1200px; width: 100%; margin: 0 auto; padding: 12px 16px 24px; color: var(--off); font-size: 12px; }

/* ---------------------------------------------------------------- блоки */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px; min-width: 0;
}
.card--flush { padding: 0; overflow-x: auto; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 12px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.section { margin: 24px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.section--in { margin-top: 0; }

.headline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.headline h1 { margin: 0; font-size: 20px; }
.headline--ok { border-left: 4px solid var(--accent); }
.headline--warn { border-left: 4px solid var(--warn); }
.headline--bad { border-left: 4px solid var(--bad); }
.headline__at { margin-left: auto; font-size: 13px; }

.dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--off); }
.dot--ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.dot--warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-tint); }
.dot--bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }

.svc__head { display: flex; align-items: flex-start; gap: 12px; }
.svc__head .dot { margin-top: 7px; }
.svc__head h3 { margin: 0; }
.unit { font: 12px var(--font-mono); color: var(--muted); }
.svc__head .pill { margin-left: auto; }
.svc__since { margin: 8px 0 0 22px; font-size: 13px; }
.svc--bad { border-color: rgba(226, 107, 90, .45); }
.svc .kv { margin-top: 12px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--shell-2); color: var(--muted); }
.pill--ok, .pill--accent { background: var(--accent-tint); color: var(--accent); }
.pill--warn { background: var(--warn-tint); color: var(--warn); }
.pill--bad { background: var(--bad-tint); color: var(--bad); }

.kv { margin: 0; }
.kv__row { display: grid; grid-template-columns: minmax(120px, 45%) 1fr; gap: 12px; padding: 7px 0;
  border-top: 1px solid var(--line); font-size: 14px; }
.kv__row:first-child { border-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv__row--warn dd { color: var(--warn); }
.kv__row--bad dd { color: var(--bad); font-weight: 600; }
.kv__note { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

.note { padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); font-size: 14px; }
.note--warn { background: var(--warn-tint); border-color: transparent; color: var(--warn); }
.note--bad { background: var(--bad-tint); border-color: transparent; color: var(--bad); }

/* ---------------------------------------------------------------- таблицы */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.table tbody tr:first-child td { border-top: 0; }
.table tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table .actions { text-align: right; white-space: nowrap; }
.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- кнопки и поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--shell-2); color: var(--text); font: 600 14px/1 var(--font-body);
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, .nav__item:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; }
.btn--danger { background: transparent; color: var(--bad); }
.btn--danger:hover { border-color: var(--bad); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

.form { display: grid; gap: 12px; grid-template-columns: 1fr 1fr auto; align-items: end; }
.form__hint { grid-column: 1 / -1; margin: 0; }
.field { display: grid; gap: 6px; }
.field .label { color: var(--muted); }
input {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 16px var(--font-body);
}
input::placeholder { color: var(--off); }

/* ---------------------------------------------------------------- вход */
.login { width: 100%; max-width: 420px; display: grid; gap: 12px; padding: 32px 24px; text-align: center; justify-items: center; }
.login p { margin: 0; }
.login__widget { min-height: 48px; display: flex; align-items: center; justify-content: center; margin: 8px 0; }
.idbox { display: grid; gap: 6px; padding: 12px 20px; border: 1px dashed var(--accent); border-radius: var(--r-md); }
.idbox .label { color: var(--muted); }
.idbox__id { font-size: 22px; background: none; color: var(--accent); user-select: all; }
.code { width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md);
  text-align: left; overflow-x: auto; user-select: all; margin: 0; }

/* ---------------------------------------------------------------- телефон */
@media (max-width: 640px) {
  .page { padding: 16px 12px 24px; }
  .me { display: none; }
  h1 { font-size: 20px; }
  .headline__at { margin-left: 22px; width: 100%; }
  .grid, .grid--2 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .form .btn { width: 100%; min-height: 44px; }
  .btn--sm { min-height: 36px; }
  .kv__row { grid-template-columns: 1fr; gap: 2px; }
}
