:root {
  --ink: #0E2938;
  --paper: #F4F7F9;
  --surface: #FFFFFF;
  --line: #E3E9EE;
  --muted: #5B6B78;
  --accent: #0D40BF;
  --live: #1E8E5A;
  --down: #C4432B;
  --radius: 6px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; margin: 0; line-height: 1.2; }

a { color: inherit; }

button, input { font: inherit; color: inherit; }

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

.hidden { display: none !important; }

/* ---------- поля и кнопки ---------- */

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }

.input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease;
}
.btn:hover { background: var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }

.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #0B36A3; }

.btn-block { width: 100%; }

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  height: 36px;
  padding: 0 14px;
}
.btn-quiet:hover { background: var(--surface); color: var(--accent); border-color: var(--accent); }

.error { color: var(--down); font-size: 14px; margin-top: 12px; min-height: 20px; }

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

.login-page { display: grid; grid-template-columns: 42% 1fr; min-height: 100vh; }

.brand {
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
}
.wordmark {
  font-weight: 600;
  font-size: clamp(40px, calc(6.3vw - 15px), 96px); /* влезает в полосу 42% при любой ширине */
  line-height: .95;
  letter-spacing: -.02em;
  margin: 0;
}
.brand-sub {
  margin: 20px 0 0;
  font-size: 15px;
  color: rgba(255, 255, 255, .65);
}

.login-side {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 72px;
}
.login-form { width: 360px; max-width: 100%; }
.login-form h1 { font-size: 28px; margin-bottom: 24px; }
.login-note {
  position: absolute;
  left: 0; right: 0; bottom: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand { min-height: 38vh; padding: 24px; justify-content: flex-end; }
  .brand-sub { margin-top: 14px; max-width: 30ch; }
  .login-side { flex-direction: column; align-items: stretch; padding: 32px 24px 24px; }
  .login-form { width: auto; }
  .login-note { position: static; margin-top: 40px; }
}

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

.top {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 16px;
}
.top-logo { font-weight: 600; font-size: 18px; text-decoration: none; }
.top-nav { display: flex; align-items: center; gap: 20px; font-size: 15px; min-width: 0; }
.top-nav .who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-nav a { text-decoration: none; }
.top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--accent); }
.top-nav .linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink);
}
.top-nav .linkbtn:hover { color: var(--accent); }

@media (max-width: 720px) {
  .top { padding: 0 24px; }
  .top-nav { gap: 14px; }
}

/* ---------- главная ---------- */

.home { display: flex; flex-direction: column; min-height: 100vh; }

.panels {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 40px 32px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
  animation: appear .3s ease both;
}
.panel + .panel { border-left: 1px solid var(--line); }
.panel:nth-child(2) { animation-delay: 60ms; }
.panel:nth-child(3) { animation-delay: 120ms; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.status[data-state="ok"] .dot { background: var(--live); }
.status[data-state="down"] .dot { background: var(--down); }

.panel-body { margin-top: auto; padding-top: 40px; }
.panel-title { font-size: clamp(28px, 3vw, 40px); font-weight: 600; line-height: 1.1; }
.panel-desc { margin: 10px 0 24px; color: var(--muted); font-size: 16px; max-width: 40ch; }
.panel .btn { align-self: flex-start; }
.panel:hover .btn { background: var(--accent); }

@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 900px) {
  .panels { grid-template-columns: 1fr; }
  .panel { padding: 24px; min-height: 200px; }
  .panel + .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-body { padding-top: 24px; }
}

/* ---------- пользователи ---------- */

.users-page { max-width: 720px; padding: 32px; }
.users-page h1 { font-size: 28px; margin-bottom: 24px; }

.add-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.add-form .field { margin: 0; flex: 1 1 160px; }
.add-form .check {
  display: flex; align-items: center; gap: 8px; height: 44px; font-size: 15px; white-space: nowrap;
}
.add-form .check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.notice .pwd { font-weight: 500; user-select: all; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { font-weight: 500; color: var(--muted); font-size: 14px; }
.table td:last-child { text-align: right; padding-right: 0; width: 1%; }
.table th:first-child, .table td:first-child { padding-left: 0; }

@media (max-width: 720px) {
  .users-page { padding: 24px; }
  .add-form .field { flex-basis: 100%; }
}

/* ---------- движение ---------- */

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