/* Палитра снята с макета админки пипеткой один раз и дальше нигде
   не повторяется: в разметке не должно быть ни одного литерального цвета. */
:root {
  --paper: #F1EEE9;
  --surface: #FFFFFF;
  --ink: #1B1F1C;
  --ink-2: #6E6A62;
  --ink-3: #9A948A;
  --border: #E5E1DA;
  --border-2: #DFDAD2;
  --hairline: #EFEBE4;
  --green: #17734C;
  --green-soft: #DCE9E2;
  --green-bright: #7BEDAC;
  --amber: #C08A2E;
  --red: #C0442E;
  --nav: #111A16;
  --nav-ink: #6E8078;
  --nav-ink-2: #93A39B;
  --nav-active: #17734C;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

.layout { display: flex; min-height: 100vh; }

/* Навигация */
.nav {
  width: 216px; flex: none; background: var(--nav);
  display: flex; flex-direction: column; padding: 20px 0 16px;
  position: sticky; top: 0; height: 100vh;
}
.nav__brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 22px; }
.nav__mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--green);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 14px; font-weight: 700; color: #fff;
}
.nav__title { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.nav__sub { font-size: 10.5px; color: var(--nav-ink); }
.nav__items { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--nav-ink-2);
}
.nav__item:hover { background: rgba(255, 255, 255, 0.05); }
.nav__item--active { background: var(--nav-active); color: #fff; font-weight: 600; }
.nav__count {
  margin-left: auto; font-family: var(--mono); font-size: 11.5px;
  color: var(--nav-ink); background: rgba(255, 255, 255, 0.07);
  padding: 1px 6px; border-radius: 6px;
}
.nav__item--active .nav__count { color: #fff; background: rgba(255, 255, 255, 0.18); }
.nav__item--soon { opacity: 0.45; cursor: default; }
.nav__soon {
  margin-left: auto; font-size: 9.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--nav-ink);
}
.nav__foot { margin-top: auto; padding: 0 20px; display: grid; gap: 6px; }
.nav__status { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--nav-ink-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot--ok { background: var(--green-bright); }
.dot--warn { background: var(--amber); }
.dot--bad { background: var(--red); }
.nav__version { font-family: var(--mono); font-size: 10.5px; color: var(--nav-ink); }
.nav__logout {
  background: none; border: 0; padding: 0; text-align: left;
  font-size: 11.5px; color: var(--nav-ink); text-decoration: underline;
}

/* Каркас страницы */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; border-bottom: 1px solid var(--border-2); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar__title { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.search {
  flex: 1; max-width: 420px; height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--paper);
}
.search:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }
.content { padding: 20px 24px 40px; display: grid; gap: 16px; }

/* Кнопки */
.btn {
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { color: var(--red); border-color: var(--border); }
.btn--ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Плитки сводки */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; display: grid; gap: 4px; align-content: start;
}
.tile__label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-2);
}
.tile__value { font-family: var(--mono); font-size: 30px; font-weight: 700; line-height: 1.1; }
.tile__value small { font-family: var(--sans); font-size: 15px; font-weight: 400; color: var(--ink-2); }
.tile__hint { font-size: 12px; color: var(--ink-3); }

/* Карточки и таблица */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden;
}
.card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--hairline);
}
.card__title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.card__body { padding: 16px; display: grid; gap: 12px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 10px 16px; border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAF8F5; }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Значки состояния */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 7px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill--free { background: var(--green-soft); color: var(--green); }
.pill--busy { background: #F6E7CC; color: #8A6212; }
.pill--offline { background: #F3E2DE; color: var(--red); }
.pill--hidden { background: var(--hairline); color: var(--ink-2); }
.pill--local { background: #E4E9F5; color: #3B4E7A; }

/* Тумблер */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  position: absolute; inset: 0; border-radius: 12px; background: var(--border-2);
  transition: background 0.15s;
}
.switch__knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(31, 28, 23, 0.28); transition: transform 0.15s;
}
.switch input:checked ~ .switch__track { background: var(--green); }
.switch input:checked ~ .switch__knob { transform: translateX(18px); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled ~ .switch__track { opacity: 0.5; }

/* Формы */
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-2); }
.field input, .field select, .field textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface);
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--green-soft); border-color: var(--green);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

#map { height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }

.empty { padding: 28px; text-align: center; color: var(--ink-3); }
.error {
  background: #F9EBE8; border: 1px solid #E9C6BE; color: var(--red);
  padding: 10px 12px; border-radius: 9px; font-size: 13px;
}
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; z-index: 50; box-shadow: 0 8px 24px rgba(31, 28, 23, 0.25);
}

/* Вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__box {
  width: 340px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; display: grid; gap: 14px;
}
.login__brand { display: flex; align-items: center; gap: 10px; }
.login__mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--green);
  display: grid; place-items: center; color: #fff; font-family: var(--mono);
  font-weight: 700; font-size: 16px;
}
