/* ─────────────────────────────────────────────────────────────
   Лафки · Админка — дизайн-система в фирменном стиле приложения:
   крем/чернила/коралл, squircle-радиусы, мягкие тени.
   ───────────────────────────────────────────────────────────── */
:root {
  --cream: #fdf6ee;
  --sink: #f6ede2;
  --surface: #ffffff;
  --ink: #2f2a28;
  --ink70: rgba(47, 42, 40, .70);
  --ink55: rgba(47, 42, 40, .55);
  --ink38: rgba(47, 42, 40, .38);
  --ink12: rgba(47, 42, 40, .12);
  --ink08: rgba(47, 42, 40, .08);
  --accent: #e8654f;
  --accent-soft: rgba(232, 101, 79, .12);
  --green: #3fa07a;
  --green-soft: rgba(63, 160, 122, .14);
  --red: #c0392b;
  --red-soft: rgba(192, 57, 43, .12);
  --gold: #9a7b2d;
  --gold-soft: #f7ecd4;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(47, 42, 40, .18);
  --shadow-sm: 0 2px 10px -4px rgba(47, 42, 40, .14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 15px/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.muted { color: var(--ink55); }
.center { display: flex; min-height: 100vh; align-items: center; justify-content: center; }

/* ── Вход ── */
.login-card {
  width: 360px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 34px 30px;
}
.login-card .logo { height: 34px; display: block; margin-bottom: 10px; }
.login-card .sub { color: var(--ink55); font-size: 14px; margin-bottom: 22px; }

/* ── Каркас ── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  flex-shrink: 0;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--ink08);
  background: var(--cream);
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  height: 26px; align-self: flex-start;
  margin: 4px 12px 20px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--ink70);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; opacity: .85; }
.nav-item:hover { background: var(--ink08); color: var(--ink); }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar .spacer { flex: 1; }
.sidebar .whoami {
  padding: 10px 12px; font-size: 12.5px; color: var(--ink55);
  border-top: 1px solid var(--ink08); margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.content { flex: 1; padding: 30px 36px 60px; max-width: 1100px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 10px; }

/* ── Карточки статистики ── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat .ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-bottom: 8px;
  background: var(--accent-soft);
}
.stat .num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat .cap { color: var(--ink55); font-size: 12.5px; font-weight: 600; }

/* ── Панели/карточки ── */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card + .card, .stats + .card, .card + .stats { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* ── Таблицы ── */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 12px;
  font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink55); border-bottom: 1px solid var(--ink12);
  white-space: nowrap;
}
td { padding: 13px 12px; border-bottom: 1px solid var(--ink08); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--sink); }
td .title { font-weight: 700; }
td .sub { color: var(--ink55); font-size: 12.5px; margin-top: 2px; }

/* ── Кнопки ── */
button, .btn {
  font: inherit; font-weight: 700; font-size: 14px;
  border: none; cursor: pointer;
  border-radius: var(--r-sm);
  padding: 10px 16px;
  background: var(--accent); color: #fff;
  transition: transform .08s, filter .15s, background .15s;
}
button:hover { filter: brightness(1.05); }
button:active { transform: scale(.97); }
button.ghost { background: var(--ink08); color: var(--ink70); }
button.ghost:hover { background: var(--ink12); color: var(--ink); }
button.danger { background: var(--red-soft); color: var(--red); }
button.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: .45; cursor: default; transform: none; }

/* ── Формы ── */
label { font-size: 12.5px; font-weight: 700; color: var(--ink55); display: block; margin: 0 0 6px 2px; }
input, select, textarea {
  font: inherit; width: 100%;
  padding: 11px 14px; margin-bottom: 14px;
  border: 1.5px solid var(--ink12);
  border-radius: var(--r-sm);
  background: var(--sink);
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
}
textarea { resize: vertical; min-height: 70px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ── Бейджи ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700;
  background: var(--ink08); color: var(--ink55);
  white-space: nowrap;
}
.badge.on { background: var(--green-soft); color: var(--green); }
.badge.off { background: var(--red-soft); color: var(--red); }
.badge.premium { background: var(--gold-soft); color: var(--gold); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ── График ── */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin-top: 12px; color: var(--ink70); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 5px; margin-right: 6px; }

/* ── Модал ── */
.modal-bg {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(47, 42, 40, .45);
  display: flex; align-items: center; justify-content: center;
  animation: fade .15s ease-out;
}
.modal {
  width: 460px; max-width: 94vw; max-height: 88vh; overflow: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 26px;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal h2 { font-size: 19px; margin-bottom: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* ── Тосты ── */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--cream);
  padding: 12px 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow);
  animation: pop .2s ease-out;
}
.toast.error { background: var(--red); color: #fff; }

/* ── Скелетоны ── */
.skel { border-radius: var(--r-md); background: linear-gradient(100deg, var(--sink) 40%, #fff 50%, var(--sink) 60%); background-size: 200% 100%; animation: shine 1.2s infinite linear; }
@keyframes shine { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 48px 20px; color: var(--ink55); }
.empty .big { font-size: 34px; margin-bottom: 10px; }
.error-text { color: var(--red); font-size: 13.5px; margin: 4px 0 10px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; }
