/* ============================================================
   Weatmood — админ-панель. Доступ только у основного аккаунта.
   ============================================================ */

:root {
  --bg: #0d0d0e;
  --side: #121213;
  --panel: #17171a;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .17);
  --text: #f3f3f5;
  --dim: #a3a3aa;
  --faint: #6b6b73;
  --accent: #fff;
  --ink: #111;
  --ok: #6fcf97;
  --off: #ff8d98;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.is-hidden { display: none !important; }

/* --- Экран проверки доступа --- */
.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.gate__panel {
  width: min(100%, 420px);
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  text-align: center;
}
.gate__title { font-size: 20px; font-weight: 640; letter-spacing: -.02em; }
.gate__text { margin-top: 8px; color: var(--dim); font-size: 14px; }
.gate__btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; margin-top: 18px; padding: 0 18px;
  border-radius: 11px; background: var(--accent); color: var(--ink);
  text-decoration: none; font-weight: 620; font-size: 14px;
}

/* --- Каркас --- */
.shell { display: flex; min-height: 100vh; }

.side {
  display: flex;
  flex-direction: column;
  flex: 0 0 248px;
  padding: 16px 12px;
  background: var(--side);
  border-right: 1px solid var(--line);
}
.side__brand {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px 16px;
  color: var(--text); text-decoration: none; font-size: 16px; font-weight: 640;
}
.side__brand b { margin-left: 5px; color: var(--faint); font-weight: 500; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--dim);
  font: inherit; font-size: 14.5px; text-align: left; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.side__item svg {
  flex: 0 0 19px; width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.side__item:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.side__item.is-active { background: rgba(255, 255, 255, .1); color: var(--text); font-weight: 560; }

.side__foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); }
.side__who { display: block; color: var(--faint); font-size: 12.5px; word-break: break-all; }
.side__exit { display: inline-block; margin-top: 8px; color: var(--dim); text-decoration: none; font-size: 13px; }
.side__exit:hover { color: var(--text); }

.main { flex: 1 1 auto; min-width: 0; padding: 28px 30px 60px; overflow-x: hidden; }
.page { display: none; }
.page.is-active { display: block; }
.page__head { margin-bottom: 22px; }
.page__head h1 { font-size: 27px; font-weight: 640; letter-spacing: -.025em; }
.page__head p { margin-top: 6px; color: var(--dim); font-size: 14px; max-width: 680px; }

/* --- Плитки --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.stat__label { color: var(--dim); font-size: 13px; }
.stat__value { margin-top: 6px; font-size: 26px; font-weight: 640; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat__hint { margin-top: 3px; color: var(--faint); font-size: 12.5px; }

/* --- Панели --- */
.panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.panel__head h2 { font-size: 15.5px; font-weight: 620; }
.panel__head span { color: var(--faint); font-size: 13px; }

/* Столбики графика */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 18px; }
.bar { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-width: 0; text-align: center; }
.bar__fill { border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #7f95ff, #4c62d6); min-height: 3px; }
.bar__label { color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Таблицы --- */
.table-wrap { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow-x: auto; }
.panel .table-wrap { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .03); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty, .empty { padding: 28px 16px; color: var(--faint); text-align: center; font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.dim { color: var(--dim); }

/* --- Инструменты --- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.field {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 14px; outline: none;
}
.field:focus { border-color: var(--line-strong); }
.field--select { min-width: 190px; }
#userSearch, #modelSearch { flex: 1 1 260px; max-width: 360px; }
.toolbar__count { margin-left: auto; color: var(--faint); font-size: 13px; }

/* --- Статусы --- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  font-size: 12.5px; color: var(--dim);
}
.badge--on { color: var(--ok); background: rgba(111, 207, 151, .12); }
.badge--off { color: var(--off); background: rgba(255, 141, 152, .12); }

.toggle {
  position: relative; appearance: none;
  width: 40px; height: 23px; margin: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, .08); cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--faint); transition: transform .16s ease, background .16s ease;
}
.toggle:checked { background: var(--accent); border-color: var(--accent); }
.toggle:checked::after { transform: translateX(17px); background: var(--ink); }
.toggle:disabled { opacity: .5; cursor: default; }

/* --- Карточки провайдеров --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card {
  padding: 18px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
}
.card--hot { border-color: rgba(127, 149, 255, .45); }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card__name { font-size: 16px; font-weight: 620; }
.card__url { margin-top: 3px; color: var(--faint); font-size: 12.5px; word-break: break-all; }
.card__rows { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.card__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.card__row span:first-child { color: var(--dim); }
.card__row b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Постраничная навигация --- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pager button {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: transparent; color: var(--dim);
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.pager button:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.pager button.is-active { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 620; }
.pager button:disabled { opacity: .4; cursor: default; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side__nav { flex-direction: row; overflow-x: auto; }
  .side__item { white-space: nowrap; }
  .side__foot { margin-top: 12px; }
  .main { padding: 20px 16px 50px; }
}
