/* Telebon Admin v2 — единый стиль панели */
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #e4e8f0;
  --text: #1b2434;
  --muted: #6b7686;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --green: #16a34a;
  --green-bg: #e8f7ee;
  --red: #dc2626;
  --red-bg: #fdecec;
  --amber-bg: #fff7e6;
  --amber-line: #f5d48a;
  --side: #141a26;
  --side-text: #aab4c5;
  --side-active: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h3 { font-size: 15px; margin-bottom: 10px; }
p { margin: 6px 0; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex: 0 0 224px;
  background: var(--side);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  color: #fff; font-size: 15px; letter-spacing: .2px;
}
.brand b { font-weight: 700; }
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #fff; font-weight: 800; font-size: 16px;
}
.brand-logo-lg { width: 48px; height: 48px; border-radius: 12px; font-size: 26px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--side-text); font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--accent); color: var(--side-active); }
.nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 17px; }
.side-foot { padding: 12px 16px; color: #5b6678; font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; }
.userbox { display: flex; align-items: center; gap: 10px; }
.uname { font-weight: 600; }
.content { padding: 20px 24px 40px; }

/* ---------- карточки ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .stat-grid, .stat-grid-4 { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.stat-num { font-size: 20px; font-weight: 700; }
.stat-lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table-scroll { max-height: 480px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--card); position: sticky; top: 0;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #f8fafd; }
.rowlink { cursor: pointer; }
.th-sort { color: var(--muted); }
.th-sort:hover { color: var(--accent); }
.th-sort i { font-style: normal; color: var(--accent); margin-left: 2px; }
.num { text-align: right; white-space: nowrap; }
.tbl th.num { text-align: right; }
.dt { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 14px; }
.pager-inline { display: flex; align-items: center; gap: 8px; }

/* ---------- формы ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-lbl { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.inp {
  font: inherit; color: var(--text);
  background: #fff; border: 1px solid #d4dae4; border-radius: 8px;
  padding: 8px 10px; outline: none; min-width: 0;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.inp.grow { flex: 1; }
textarea.inp { width: 100%; resize: vertical; }
select.inp { padding-right: 28px; }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.fld .inp { width: 100%; }
.check-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px;
}
.check-list-tall { max-height: 460px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; }
.chk:hover { background: #f4f6fb; }

/* ---------- кнопки / бейджи / алерты ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600;
  border-radius: 8px; border: 1px solid transparent;
  padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--text); border-color: #d4dae4; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fff; color: var(--red); border-color: #f3b9b9; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: #eef1f6; color: var(--muted);
}
.badge-lg { font-size: 13.5px; padding: 4px 12px; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-role { background: #eef0ff; color: var(--accent); }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid; }
.alert-error { background: var(--red-bg); border-color: #f3b9b9; color: #991b1b; }
.alert-warn { background: var(--amber-bg); border-color: var(--amber-line); color: #7c5a10; }

.muted { color: var(--muted); }
.ok-text { color: var(--green); }
.mt { margin-top: 18px; }
.mt-sm { margin-top: 8px; }
.backlink { color: var(--muted); font-weight: 500; }
.backlink:hover { color: var(--accent); }

/* ---------- карточка салона ---------- */
.salon-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.salon-brand { font-size: 20px; margin-bottom: 4px; }
.salon-meta { margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.salon-tarif { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.danger-zone {
  margin-top: 20px; padding: 14px;
  border: 1px dashed #f3b9b9; border-radius: 10px; background: #fffafa;
}

/* ---------- логин ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% 0%, #1e2740 0%, #141a26 60%);
}
.login-card {
  width: 360px; background: var(--card);
  border-radius: 16px; padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  text-align: center;
}
.login-card h1 { font-size: 20px; margin-top: 12px; }
.login-card form { text-align: left; margin-top: 16px; }
.login-brand { display: flex; justify-content: center; }
.login-foot { margin-top: 16px; font-size: 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast-item {
  background: #1b2434; color: #fff;
  padding: 11px 16px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  font-weight: 500; max-width: 360px;
  animation: toast-in .18s ease-out;
}
.toast-item.err { background: var(--red); }
.toast-item.ok { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- статистика / пуши (2026-06-11) ---------- */
.alert-ok { background: var(--green-bg); border-color: #bfe8cd; color: #14532d; }
.badge-warn { background: var(--amber-bg); color: #92660a; }
.sec-title { margin: 18px 0 10px; font-size: 15px; }
.stat-num.good { color: var(--green); }
.stat-num.bad { color: var(--red); }
.delta { color: var(--green); font-size: 12px; font-weight: 700; }
.chart { width: 100%; height: 124px; display: block; }
.chart-bar { fill: var(--accent); opacity: .85; }
.chart-bar.pay { fill: var(--green); }
.chart-bar:hover { opacity: 1; }
.inp-num { width: 110px; }
.tbl-compact th, .tbl-compact td { padding: 5px 10px; font-size: 13px; }

/* ---------- поддержка: тред чата ---------- */
.chat-thread {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 60vh; overflow-y: auto;
  padding: 8px 4px; margin: 6px 0 14px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 72%; }
.chat-msg.from-user { align-self: flex-start; align-items: flex-start; }
.chat-msg.from-support { align-self: flex-end; align-items: flex-end; }
.chat-bubble {
  padding: 9px 13px; border-radius: 14px;
  font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-word;
}
.from-user .chat-bubble { background: #eef0f4; color: #1b2434; border-bottom-left-radius: 4px; }
.from-support .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.chat-reply { display: flex; gap: 10px; align-items: flex-end; margin-top: 6px; }
.chat-reply textarea.inp { flex: 1; }
