/* ============================================================
   Тема: Dark — современный сдержанный.
   «Поздний вечер в кабинете главврача». Глубокий сине-чёрный,
   приглушённая латунь, тёплый белый. БЕЗ неона и glow.
   Полный override-слой поверх style.css.
   ============================================================ */

:root[data-theme="dark"] {
  --bg-page: #0e1419;
  --bg-card: #181f26;
  --bg-card-soft: #131920;
  --bg-topbar: #11171d;
  --bg-input: #1c232b;

  --text-primary: #e8e6e1;
  --text-dim: #9aa1ab;
  --text-on-accent: #14181d;

  --accent-primary: #c89b5c;
  --accent-primary-hover: #d5ac72;
  --accent-secondary: #6b9a8a;

  --border-default: rgba(232,230,225,0.09);
  --border-strong: rgba(232,230,225,0.18);

  --status-danger: #ef4444;
  --status-ok: #22c55e;
  --status-warn: #f59e0b;

  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* ── Базовый каркас ────────────────────────────────────────── */
:root[data-theme="dark"] body { background: #0e1419; color: #e8e6e1; }
:root[data-theme="dark"] .container { color: #e8e6e1; }
:root[data-theme="dark"] .page-title { color: #e8e6e1; }
:root[data-theme="dark"] .page-subtitle,
:root[data-theme="dark"] .toolbar-count,
:root[data-theme="dark"] .stat-card .label,
:root[data-theme="dark"] .stat-card .sub,
:root[data-theme="dark"] .empty { color: #9aa1ab; }

/* Navbar */
:root[data-theme="dark"] .navbar { background: #11171d; border-bottom-color: rgba(232,230,225,0.09); }
:root[data-theme="dark"] .navbar-brand { color: #c89b5c; }
:root[data-theme="dark"] .navbar-nav a { color: #9aa1ab; background: transparent; }
:root[data-theme="dark"] .navbar-nav a:hover {
  background: rgba(232,230,225,0.06); color: #e8e6e1;
}
:root[data-theme="dark"] .navbar-nav a.active {
  background: rgba(200,155,92,0.16); color: #d5ac72;
}

/* Cards / stat-cards */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .stat-card {
  background: #181f26;
  border-color: rgba(232,230,225,0.09);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  color: #e8e6e1;
}
:root[data-theme="dark"] .card-header { color: #e8e6e1; border-bottom-color: rgba(232,230,225,0.09); }
:root[data-theme="dark"] .stat-card .value { color: #e8e6e1; }
:root[data-theme="dark"] .stat-card.accent {
  background: linear-gradient(135deg, #2a323b, #1c232b);
  border-color: rgba(200,155,92,0.3);
}
:root[data-theme="dark"] .stat-card.accent .value,
:root[data-theme="dark"] .stat-card.accent .label { color: #e8e6e1; }

/* Tables */
:root[data-theme="dark"] table { color: #e8e6e1; }
:root[data-theme="dark"] th {
  background: #131920; color: #9aa1ab; border-bottom-color: rgba(232,230,225,0.12);
}
:root[data-theme="dark"] td { border-bottom-color: rgba(232,230,225,0.07); }
:root[data-theme="dark"] tr.clickable:hover { background: rgba(255,255,255,0.03); }

/* Buttons */
:root[data-theme="dark"] .btn-primary { background: #c89b5c; color: #14181d; }
:root[data-theme="dark"] .btn-primary:hover { background: #d5ac72; }
:root[data-theme="dark"] .btn-secondary {
  background: #1c232b; color: #e8e6e1; border-color: rgba(232,230,225,0.18);
}
:root[data-theme="dark"] .btn-gray { background: #2a323b; color: #cbd2da; }
:root[data-theme="dark"] .btn-success { background: #1d6b3f; color: #e8f5ec; }
:root[data-theme="dark"] .btn-warning { background: #8a5a13; color: #fbe8cf; }
:root[data-theme="dark"] .btn-danger  { background: #8a2727; color: #fbdcdc; }

/* Inputs */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .search-input {
  background: #1c232b; color: #e8e6e1; border-color: rgba(232,230,225,0.18);
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] .search-input::placeholder { color: #6b7280; }
:root[data-theme="dark"] .search-input:focus {
  border-color: #c89b5c; box-shadow: 0 0 0 3px rgba(200,155,92,0.15);
}

/* Conversation status badges */
:root[data-theme="dark"] .badge-active   { background: rgba(34,197,94,0.18);  color: #86efac; }
:root[data-theme="dark"] .badge-operator { background: rgba(245,158,11,0.18); color: #fbbf24; }
:root[data-theme="dark"] .badge-closed   { background: rgba(156,163,175,0.18); color: #d1d5db; }

/* Lead status badges */
:root[data-theme="dark"] .badge-new       { background: rgba(99,102,241,0.20);  color: #a5b4fc; }
:root[data-theme="dark"] .badge-processed { background: rgba(245,158,11,0.18);  color: #fbbf24; }
:root[data-theme="dark"] .badge-confirmed { background: rgba(34,197,94,0.18);   color: #86efac; }
:root[data-theme="dark"] .badge-arrived   { background: rgba(34,197,94,0.26);   color: #bbf7d0; }
:root[data-theme="dark"] .badge-no_show   { background: rgba(239,68,68,0.20);   color: #fca5a5; }
:root[data-theme="dark"] .badge-cancelled { background: rgba(156,163,175,0.18); color: #d1d5db; }
:root[data-theme="dark"] .badge-positive  { background: rgba(34,197,94,0.18);   color: #86efac; }
:root[data-theme="dark"] .badge-negative  { background: rgba(239,68,68,0.20);   color: #fca5a5; }
:root[data-theme="dark"] .badge-neutral   { background: rgba(156,163,175,0.16); color: #cbd5e1; }

/* Chat timeline */
:root[data-theme="dark"] .message-user      { background: #2a4a6b; color: #e8f0fa; }
:root[data-theme="dark"] .message-assistant { background: #1c2730; border-color: rgba(99,160,255,0.2); color: #d8dee6; }
:root[data-theme="dark"] .message-operator  { background: #2c2418; border-color: rgba(245,158,11,0.3); color: #ede4d3; }
:root[data-theme="dark"] .message-assistant .message-role { color: #7aa7e6; }
:root[data-theme="dark"] .message-operator .message-role  { color: #e0a458; }
:root[data-theme="dark"] .chat-meta-item { background: #1c232b; color: #9aa1ab; }
:root[data-theme="dark"] .chat-container { background: #181f26; border-color: rgba(232,230,225,0.09); }
:root[data-theme="dark"] .chat-messages { background: #131920; }
:root[data-theme="dark"] .chat-input { background: #181f26; border-top-color: rgba(232,230,225,0.09); }

/* Inbox */
:root[data-theme="dark"] .inbox-tab { background: #181f26; color: #9aa1ab; border-color: rgba(232,230,225,0.12); }
:root[data-theme="dark"] .inbox-tab:hover { background: #1c232b; }
:root[data-theme="dark"] .inbox-tab.active { background: #c89b5c; color: #14181d; border-color: #c89b5c; }
:root[data-theme="dark"] .inbox-tab-count { background: rgba(255,255,255,0.10); }
:root[data-theme="dark"] .inbox-tab-danger { color: #fca5a5; border-color: rgba(239,68,68,0.4); }
:root[data-theme="dark"] .inbox-tab-danger .inbox-tab-count { background: rgba(239,68,68,0.2); color: #fca5a5; }
:root[data-theme="dark"] .inbox-tab-danger.active { background: #8a2727; color: #fff; border-color: #8a2727; }
:root[data-theme="dark"] .chip { background: #181f26; color: #9aa1ab; border-color: rgba(232,230,225,0.12); }
:root[data-theme="dark"] .chip.chip-on { background: #e8e6e1; color: #14181d; border-color: #e8e6e1; }
:root[data-theme="dark"] .inbox-item { background: #181f26; border-color: rgba(232,230,225,0.09); }
:root[data-theme="dark"] .inbox-item > summary:hover,
:root[data-theme="dark"] .inbox-item[open] > summary { background: #1c232b; }
:root[data-theme="dark"] .inbox-contact { color: #e8e6e1; }
:root[data-theme="dark"] .inbox-preview { color: #9aa1ab; }
:root[data-theme="dark"] .inbox-meta { color: #9aa1ab; }
:root[data-theme="dark"] .inbox-meta b { color: #e8e6e1; }
:root[data-theme="dark"] .inbox-detail { background: #131920; }
:root[data-theme="dark"] .inbox-st-missed { border-left-color: #ef4444; }

/* Channel badges (dark muted) */
:root[data-theme="dark"] .ch-calls         { background: rgba(245,158,11,0.18); color: #fbbf24; }
:root[data-theme="dark"] .ch-telegram      { background: rgba(59,130,246,0.18); color: #93c5fd; }
:root[data-theme="dark"] .ch-website       { background: rgba(168,85,247,0.18); color: #d8b4fe; }
:root[data-theme="dark"] .ch-phone_widget  { background: rgba(217,70,239,0.18); color: #f0abfc; }
:root[data-theme="dark"] .ch-prodoctorov   { background: rgba(34,197,94,0.18);  color: #86efac; }
:root[data-theme="dark"] .ch-sberzdorovie  { background: rgba(20,184,166,0.18); color: #5eead4; }
:root[data-theme="dark"] .ch-yandex_uslugi { background: rgba(234,179,8,0.18);  color: #fde047; }
:root[data-theme="dark"] .ch-manual        { background: rgba(156,163,175,0.18); color: #cbd5e1; }

/* Status pills (dark) */
:root[data-theme="dark"] .st-new         { background: rgba(99,102,241,0.20);  color: #a5b4fc; }
:root[data-theme="dark"] .st-in_progress { background: rgba(245,158,11,0.18);  color: #fbbf24; }
:root[data-theme="dark"] .st-answered    { background: rgba(34,197,94,0.18);   color: #86efac; }
:root[data-theme="dark"] .st-missed      { background: rgba(239,68,68,0.20);   color: #fca5a5; }
:root[data-theme="dark"] .st-escalated   { background: rgba(236,72,153,0.18);  color: #f9a8d4; }
:root[data-theme="dark"] .st-archived    { background: rgba(156,163,175,0.16); color: #cbd5e1; }

/* Inbox widget */
:root[data-theme="dark"] .inbox-widget { background: #181f26; border-color: rgba(232,230,225,0.09); border-left-color: #c89b5c; }
:root[data-theme="dark"] .inbox-widget-label { color: #9aa1ab; }
:root[data-theme="dark"] .inbox-widget-count { color: #e8e6e1; }
:root[data-theme="dark"] .inbox-widget-cta { color: #c89b5c; }
:root[data-theme="dark"] .inbox-widget-missed { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.35); color: #fca5a5; }
:root[data-theme="dark"] .pulse-dot { background: #ef4444; }

/* Sources */
:root[data-theme="dark"] .src-bigblock { background: #181f26; border-color: rgba(232,230,225,0.09); border-left-color: #c89b5c; }
:root[data-theme="dark"] .src-bigblock-head h2,
:root[data-theme="dark"] .src-card h3 { color: #e8e6e1; }
:root[data-theme="dark"] .src-bigblock-sub,
:root[data-theme="dark"] .src-card > p { color: #9aa1ab; }
:root[data-theme="dark"] .src-point { background: #131920; border-color: rgba(232,230,225,0.07); }
:root[data-theme="dark"] .src-point h4 { color: #e8e6e1; }
:root[data-theme="dark"] .src-point p { color: #9aa1ab; }
:root[data-theme="dark"] .src-point code { background: rgba(99,102,241,0.2); color: #a5b4fc; }
:root[data-theme="dark"] .src-card { background: #181f26; border-color: rgba(232,230,225,0.09); }
:root[data-theme="dark"] .src-card-stat { background: #131920; color: #9aa1ab; }
:root[data-theme="dark"] .src-how summary { color: #c89b5c; }
:root[data-theme="dark"] .src-how p { background: #131920; color: #9aa1ab; }
:root[data-theme="dark"] .src-how b { color: #e0a458; }
:root[data-theme="dark"] .src-group-title { color: #9aa1ab; }

/* Rules */
:root[data-theme="dark"] .rule-card { background: #181f26; border-color: rgba(232,230,225,0.09); }
:root[data-theme="dark"] .rule-card.rule-off { background: #131920; }
:root[data-theme="dark"] .rule-title { color: #e8e6e1; }
:root[data-theme="dark"] .rule-row-text { color: #cbd2da; }
:root[data-theme="dark"] .rule-row-label,
:root[data-theme="dark"] .rule-stat,
:root[data-theme="dark"] .rules-group-title { color: #9aa1ab; }
:root[data-theme="dark"] .rule-stat strong { color: #e8e6e1; }
:root[data-theme="dark"] .rule-stat-good strong { color: #86efac; }
:root[data-theme="dark"] .rule-edit { background: #1c232b; color: #cbd2da; border-color: rgba(232,230,225,0.18); }
:root[data-theme="dark"] .rule-toggle input:checked + .rule-toggle-slider { background-color: #22c55e; }
:root[data-theme="dark"] .rule-toggle-slider { background-color: #3a424c; }

/* Misc */
:root[data-theme="dark"] .lead-number { background: #1c232b; color: #9aa1ab; }
:root[data-theme="dark"] .back-link { color: #c89b5c; }
:root[data-theme="dark"] .top-services li { border-bottom-color: rgba(232,230,225,0.07); }
:root[data-theme="dark"] .top-services .count { background: rgba(200,155,92,0.18); color: #d5ac72; }
:root[data-theme="dark"] .filter-toggle { color: #9aa1ab; }
:root[data-theme="dark"] .btn-takeover { background: #8a5a13; color: #fbe8cf; }
:root[data-theme="dark"] .btn-return { background: #1d6b3f; color: #e8f5ec; }
