/* Тема в стиле кабинета Podium: почти чёрный фон, тёмные карточки, телеграм-синий акцент, розовый — только логотип. */
:root {
  --bg: #0a0a0c;
  --panel: #131316;
  --panel-2: #1a1a1e;
  --input: #0a0a0c;
  --border: #232327;
  --border-soft: #1c1c20;
  --text: #f5f5f5;
  --muted: #a8a8ad;
  --muted-2: #6c6c72;
  --accent: #2aabee;
  --accent-2: #5cc1f3;
  --accent-dim: #1d7fb3;
  --accent-soft: rgba(42, 171, 238, 0.08);
  --accent-glow: rgba(42, 171, 238, 0.2);
  --brand: #ff2d7a;
  --ok: #3fc97a;
  --warn: #ebb14a;
  --danger: #e0533b;
  --operator: #7c4dff;
  --radius: 16px;
  --ff-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-head: "Bricolage Grotesque", "Hanken Grotesk", sans-serif;
  --ff-num: "Poppins", "Hanken Grotesk", sans-serif;
  font-family: var(--ff-body);
  font-size: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { -webkit-font-smoothing: antialiased; }
[x-cloak] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* заголовок страницы — мелкая капитель, как в кабинете Podium */
h1 { font-family: var(--ff-body); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); margin: 0 0 16px; }
h2 { font-family: var(--ff-head); font-size: 16px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 11px; margin: 0 0 8px; color: var(--muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
::selection { background: var(--accent-glow); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a2a2f; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Логотип ---------- */
.logo {
  font-family: "Unbounded", "Russo One", system-ui, sans-serif;
  font-weight: 800; letter-spacing: .06em; font-size: 19px; white-space: nowrap; user-select: none;
  background: linear-gradient(90deg, #ff1f6b, #ff4d8d 55%, #ff1f6b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 45, 122, .55));
}

/* ---------- Каркас: верхняя панель ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px;
  height: 60px; padding: 0 24px; background: rgba(10, 10, 12, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.topnav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav-item {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 12px; border: 1px solid transparent; background: none; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none;
}
.nav-item svg { width: 16px; height: 16px; opacity: .85; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-item.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-glow) inset; }
.nav-badge { font-size: 10px; font-weight: 700; color: #06314a; background: var(--accent); border-radius: 20px; padding: 2px 7px; font-family: var(--ff-num); }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); color: #aab2c0;
  border-radius: 10px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { color: #fff; border-color: rgba(255, 255, 255, .18); }
.icon-btn svg { width: 16px; height: 16px; }
.user-chip {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #04121b;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; cursor: pointer; border: 0;
}
.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); min-width: 190px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); z-index: 50;
}
.menu.right { right: 0; }
.menu button, .menu .menu-item {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 13px; border-radius: 9px; cursor: pointer; text-align: left;
}
.menu button:hover { background: var(--panel-2); color: var(--text); }
.menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 28px; }

/* ---------- Карточки ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat .value { font-family: var(--ff-num); font-size: 26px; font-weight: 600; margin-top: 8px; letter-spacing: -.01em; }
.stat .label { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.alert { border-radius: 12px; padding: 12px 14px; border: 1px solid; }
.alert.warn { background: rgba(235, 177, 74, .07); border-color: rgba(235, 177, 74, .3); color: #f0c878; }
.alert.err { background: rgba(224, 83, 59, .08); border-color: rgba(224, 83, 59, .35); color: #f08a76; }

/* ---------- Формы ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
input, select, textarea {
  background: var(--input); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
input[type="range"] { accent-color: var(--accent); padding: 0; border: 0; background: none; box-shadow: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hint { color: var(--muted-2); font-size: 12px; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 10px; height: 38px; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { border-color: #34343a; background: #202025; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121b; font-weight: 700; box-shadow: 0 6px 22px var(--accent-glow); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .04); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 36px; height: 20px; border-radius: 10px; background: #2b2b31; position: relative; transition: .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 19px; }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted-2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 255, 255, .015); }
td select { min-width: 140px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.badge.ok { background: rgba(63, 201, 122, .1); color: var(--ok); }
.badge.warn { background: rgba(235, 177, 74, .1); color: var(--warn); }
.badge.err { background: rgba(224, 83, 59, .1); color: var(--danger); }
.badge.pink { background: var(--accent-soft); color: var(--accent); }

/* ---------- Табы ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- График ---------- */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.chart .bar { flex: 1; background: linear-gradient(180deg, var(--accent), var(--accent-dim)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart .bar.zero { background: var(--panel-2); }
.chart-labels { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 11px; margin-top: 6px; font-family: var(--ff-num); }

/* ---------- Списки ---------- */
.split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.split > *, .pg > *, .dialogs > * { min-width: 0; }
.list-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.list-item:hover { background: var(--panel-2); }
.list-item.active { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Диалоги ---------- */
.dialogs { display: grid; grid-template-columns: 300px 1fr 300px; gap: 12px; height: calc(100vh - 150px); }
.dialogs > .card { padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.fan-list { overflow: auto; flex: 1; }
.fan-item { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.fan-item:hover { background: var(--panel-2); }
.fan-item.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.fan-item .name { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.fan-item .last { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #0d0d10; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; word-break: break-word; line-height: 1.4; }
.msg span { white-space: pre-wrap; }
.msg .meta { font-size: 10px; color: rgba(255, 255, 255, .55); margin-top: 3px; text-align: right; }
.msg.in { align-self: flex-start; background: #1f1f24; border-bottom-left-radius: 4px; }
.msg.bot { align-self: flex-end; background: linear-gradient(135deg, var(--accent-dim), var(--accent)); color: #fff; border-bottom-right-radius: 4px; }
.msg.operator { align-self: flex-end; background: var(--operator); border-bottom-right-radius: 4px; }
.msg.system { align-self: center; background: none; color: var(--muted-2); font-size: 12px; text-align: center; padding: 4px; }
.msg img, .msg video { max-width: 220px; border-radius: 10px; display: block; margin-bottom: 4px; }
.chat-input { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; }
.chat-input textarea { min-height: 42px; height: 42px; }
.chat-input .btn { height: 42px; }
.side { overflow: auto; padding: 14px; }
.side section + section { margin-top: 18px; }
.offer-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 12px; }

/* ---------- Тест-чат ---------- */
.pg { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; }
.pg-chat { display: flex; flex-direction: column; height: 560px; overflow: hidden; }

/* ---------- Модалки и тосты ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; width: 100%; max-width: 440px; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 11px 14px; border-radius: 12px; max-width: 380px; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- Вход ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 45, 122, .16), transparent 55%),
    radial-gradient(ellipse at 50% 110%, rgba(42, 171, 238, .08), transparent 50%),
    var(--bg);
}
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card .logo { font-size: 32px; text-align: center; margin-bottom: 4px; }

@media (max-width: 1100px) {
  .pg { grid-template-columns: 1fr; }
  .dialogs { grid-template-columns: 260px 1fr; }
  .dialogs > .card:last-child { display: none; }
  .nav-item .label { display: none; }
}
.only-mobile { display: none !important; }
@media (max-width: 760px) {
  .only-mobile { display: inline-flex !important; }
  /* backdrop-filter у шапки сделал бы её контейнером для fixed-меню — на телефоне без него */
  .topbar { padding: 0 12px; gap: 10px; backdrop-filter: none; background: rgb(10, 10, 12); }
  /* на телефоне вкладки — нижней панелью, как в мобильном Podium */
  .topnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; justify-content: space-around; gap: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0px)); padding: 6px 4px env(safe-area-inset-bottom, 0px);
    background: rgba(10, 10, 12, .95); backdrop-filter: blur(12px); border-top: 1px solid var(--border-soft);
  }
  .topnav .nav-item { flex-direction: column; height: auto; gap: 3px; padding: 6px 10px; font-size: 10.5px; border: 0; box-shadow: none; }
  .topnav .nav-item .label { display: inline; }
  .topnav .nav-item.active { background: none; color: var(--accent); }
  .topnav .nav-badge { position: absolute; top: 0; right: 4px; padding: 1px 5px; }
  .topnav .menu { bottom: calc(100% + 8px); top: auto; right: 0; }
  .main { padding: 16px 16px 84px; }
  .split, .grid2, .grid3, .dialogs, .pg { grid-template-columns: 1fr; }
}
