:root {
  --bg: #0e1116;
  --panel: #161b23;
  --border: #242c38;
  --text: #e6edf3;
  --muted: #8b97a8;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --accent: #4c8dff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

h1 { margin: 0; font-size: 20px; font-weight: 600; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); transition: background .3s;
}
.dot.ok { background: var(--green); }
.dot.fail { background: var(--red); }

main { padding: 20px 24px 40px; max-width: 1400px; margin: 0 auto; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.tile .value { font-size: 30px; font-weight: 600; line-height: 1.1; }
.tile .label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.tile.warn .value { color: var(--amber); }
.tile.alert .value { color: var(--red); }

.columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
}
@media (max-width: 980px) {
  .columns { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  min-width: 0;
}
.panel h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--muted); }

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 500; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

.health {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 8px; vertical-align: middle;
}
.health.green { background: var(--green); }
.health.amber { background: var(--amber); }
.health.red   { background: var(--red); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; background: #1f2836; color: var(--muted); white-space: nowrap;
}

.bar { background: #1f2836; border-radius: 4px; height: 6px; width: 110px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.progress-cell { display: flex; align-items: center; gap: 8px; }
.progress-cell span { color: var(--muted); font-size: 12px; min-width: 34px; }

.incidents { list-style: none; margin: 0; padding: 0; }
.incidents li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start;
}
.incidents li:last-child { border-bottom: none; }
.sev {
  flex: none; width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: #1f2836; color: var(--muted);
}
.sev.s1 { background: rgba(248, 81, 73, .16); color: var(--red); }
.sev.s2 { background: rgba(210, 153, 34, .16); color: var(--amber); }
.incidents .title { font-size: 14px; }
.incidents .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ---------- Шапка: пользователь и выход ---------- */

.who { color: var(--text); font-size: 13px; }

.logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.logout:hover { border-color: var(--muted); color: var(--text); }
.logout:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Вход и оферта ---------- */

:root {
  --gold: #c9a227;
  --gold-soft: #d8b45e;
  --parchment: #efe7d5;
}

body.gate { min-height: 100vh; }

.gate-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 44px 20px;
  max-width: none;
  margin: 0;
}
.gate-page--doc { align-items: start; padding: 56px 20px 64px; }

/* Фон — два слоя, оба чисто декоративные.
   Картинка приглушена фильтром, а затемняется только середина: там текст,
   а по краям узор должен оставаться виден. Значения подобраны на глаз
   по реальным картинкам — менять без визуальной проверки не стоит. */
.gate-bg {
  position: absolute;
  inset: 0;
  background: #0b0e13 url("/assets/bg-login.webp") center / cover no-repeat;
  filter: brightness(0.80) saturate(0.95);
}
.gate-vig {
  position: absolute;
  inset: 0;
  background: radial-gradient(44% 40% at 50% 44%,
    rgba(8, 10, 15, 0.80) 0%, rgba(8, 10, 15, 0.45) 62%, rgba(8, 10, 15, 0) 100%);
}
.gate-vig--doc {
  background: radial-gradient(60% 55% at 50% 40%,
    rgba(8, 10, 15, 0.86) 0%, rgba(8, 10, 15, 0.55) 70%, rgba(8, 10, 15, 0.1) 100%);
}

.gate-inner {
  position: relative;
  width: 100%;
  max-width: 336px;
  text-align: center;
}

.medal {
  display: block;
  height: 132px;
  margin: 0 auto 24px;
  filter: drop-shadow(0 0 26px rgba(201, 162, 39, 0.16));
}
.medal--sm { height: 96px; margin-bottom: 18px; }

.gate-inner h1,
.offer h1 {
  margin: 0 0 5px;
  font: 400 22px/1.3 Georgia, "Times New Roman", serif;
  color: var(--parchment);
  letter-spacing: 0.2px;
}

.gate-sub {
  margin: 0;
  font: italic 400 15px/1.4 Georgia, serif;
  color: var(--gold-soft);
}

.gate-rule { display: block; margin: 18px auto 28px; opacity: 0.5; }

/* Видимой подписи у полей нет — её роль играет placeholder.
   Сам <label> остаётся в разметке и скрыт только визуально. */
.vh {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.field { position: relative; margin-bottom: 18px; }

.field input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #333c4c;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 10px 34px 10px 2px;
  outline: none;
  transition: border-color 0.18s;
}
.field input::placeholder { color: #5b6577; }
.field input:focus { border-bottom-color: var(--gold); }
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s;
}

.peek {
  position: absolute;
  right: 0;
  bottom: 7px;
  background: none;
  border: 0;
  color: #5d6879;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}
.peek:hover { color: var(--gold-soft); }

.caps {
  margin: -10px 0 12px;
  text-align: left;
  font-size: 12px;
  color: var(--gold-soft);
}

.agree {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  margin: 22px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.agree input {
  margin: 1px 0 0;
  width: 15px; height: 15px;
  flex: none;
  accent-color: var(--gold);
}
.agree a {
  color: var(--gold-soft);
  text-decoration: none;
  border-bottom: 1px dotted rgba(216, 180, 94, 0.45);
}
.agree a:hover { color: #fff; }

.gate-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 2px;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.gate-btn:hover:not(:disabled) {
  background: rgba(201, 162, 39, 0.09);
  border-color: var(--gold);
  color: #f5e9c2;
}
.gate-btn:disabled { opacity: 0.5; cursor: progress; }

.gate-error {
  margin: 12px 0 0;
  min-height: 18px;
  font-size: 13px;
  color: #f0836f;
  text-align: left;
}

.sign {
  margin: 32px 0 0;
  font: italic 400 13px/1.4 Georgia, serif;
  color: #6d7684;
  letter-spacing: 0.3px;
}

.gate :focus-visible,
.offer :focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Оферта ---------- */

.offer {
  position: relative;
  width: 100%;
  max-width: 620px;
  text-align: center;
}

.offer-meta {
  margin: 0 0 26px;
  color: #6d7684;
  font-size: 12.5px;
}

.offer ol {
  margin: 0;
  padding-left: 22px;
  text-align: left;
  color: #c2ccd9;
  font-size: 14.5px;
  line-height: 1.75;
}
.offer ol li { margin-bottom: 11px; }
.offer ol li b { color: var(--text); font-weight: 600; }
.offer ol li::marker { color: var(--gold); }

.offer-back {
  display: inline-block;
  margin-top: 24px;
  color: var(--gold-soft);
  font-size: 13.5px;
  text-decoration: none;
  border-bottom: 1px dotted rgba(216, 180, 94, 0.45);
}
.offer-back:hover { color: #fff; }

@media (max-width: 640px) {
  .gate-bg { background-image: url("/assets/bg-login-mobile.webp"); }
}

@media (max-width: 400px) {
  .gate-inner { max-width: 100%; }
  .gate-inner h1 { font-size: 20px; }
  .medal { height: 112px; margin-bottom: 20px; }
  .offer ol { font-size: 14px; padding-left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .field input, .gate-btn { transition: none; }
}
