:root {
  --bg: #f4f6f9;
  --sidebar-bg: #1e2532;
  --sidebar-text: #aab4c4;
  --card: #ffffff;
  --border: #e3e8ef;
  --text: #24292f;
  --muted: #6a7382;
  --accent: #2563eb;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;

  /* --- семантические поверхности (тема + тёмная тема) --- */
  --thead-bg: #f0f2f5;
  --hover-row: #f8fafc;
  --row-alt: rgba(37,99,235,.035);
  --input-bg: #ffffff;
  --input-border: #d7dbe0;
  --input-disabled-bg: #f4f5f7;
  --text-strong: #111827;
  --label-text: #333a45;
  --sub-val: #454e5c;
  --chip-bg: #f1f3f7;
  --line-soft: #f0f2f5;
  --surface: #f4f5f7;
  --placeholder: #8a93a3;
  /* светлая тема: прежнее сине-стеклянное оформление панелей и лампочек */
  --glass: linear-gradient(135deg, rgba(37,99,235,.04) 0%, rgba(255,255,255,.7) 40%, rgba(37,99,235,.06) 100%);
  --lamp-dim: rgba(37,99,235,.45);
  --lamp-lit: rgba(37,99,235,1);
  --glow-hover: 0 12px 26px rgba(37,99,235,.20), 0 0 20px rgba(37,99,235,.13);
  --track: rgba(0,0,0,.04);
  --track-border: rgba(0,0,0,.06);
  --amber-group-bg: #fbf7ec;
  --amber-group-border: #eadfc2;
  --amber-label: #7a6210;
  --soon-bg: #fbfcfe;
  --soon-border: #c9d3e4;
  --msg-client-bg: #eef2ff;
  --msg-ai-bg: #f0fdf4;
  --msg-manager-bg: #fef9c3;
}

/* ================= ТЁМНАЯ ТЕМА ================= */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12151c;
  --card: #191e28;
  --border: #2a3140;
  --text: #e6e9ef;
  --muted: #97a1b2;
  --accent: #5b8cff;
  --ok: #2ecc71;
  --bad: #ff7070;
  --warn: #e6a23c;

  --thead-bg: #202634;
  --hover-row: #202634;
  --row-alt: rgba(91,140,255,.06);
  --input-bg: #141924;
  --input-border: #333d4f;
  --input-disabled-bg: #1b2130;
  --text-strong: #ffffff;
  --label-text: #dbe1ea;
  --sub-val: #b9c2cf;
  --chip-bg: #232a38;
  --line-soft: #252c3a;
  --surface: #202634;
  --placeholder: #7b8595;
  /* тёмная тема: графитово-жёлтое стекло + янтарные лампочки */
  --glass: linear-gradient(135deg, rgba(214,178,90,.08) 0%, rgba(19,23,31,.62) 44%, rgba(214,178,90,.09) 100%);
  --lamp-dim: rgba(206,164,52,.30);
  --lamp-lit: rgba(232,190,84,.85);
  --glow-hover: 0 12px 26px rgba(212,168,48,.22), 0 0 22px rgba(212,168,48,.16);
  --track: rgba(255,255,255,.05);
  --track-border: rgba(255,255,255,.08);
  --amber-group-bg: rgba(212,160,23,.09);
  --amber-group-border: rgba(212,160,23,.35);
  --amber-label: #d9a441;
  --soon-bg: #171c26;
  --soon-border: #33405a;
  --msg-client-bg: rgba(91,140,255,.16);
  --msg-ai-bg: rgba(46,204,113,.13);
  --msg-manager-bg: rgba(230,162,60,.15);
}

/* --- тёмная тема: точечные переопределения компонентов --- */
html[data-theme="dark"] .badge.ok { background: rgba(46,204,113,.15); }
html[data-theme="dark"] .badge.bad { background: rgba(231,76,60,.18); }
html[data-theme="dark"] .badge.warn { background: rgba(230,162,60,.16); }
html[data-theme="dark"] .badge.info { background: rgba(91,140,255,.16); }
html[data-theme="dark"] .badge.muted { background: #232a38; }
html[data-theme="dark"] .rp-badge.blue { background: rgba(91,140,255,.18); }
html[data-theme="dark"] .rp-badge.green { background: rgba(46,204,113,.16); }
html[data-theme="dark"] .rp-badge.red { background: rgba(231,76,60,.18); }
html[data-theme="dark"] .rp-badge.orange { background: rgba(230,126,34,.18); }
html[data-theme="dark"] .rp-badge.violet { background: rgba(155,120,255,.18); }
html[data-theme="dark"] .rp-badge.purple { background: rgba(170,60,255,.16); }
html[data-theme="dark"] .rp-badge.teal { background: rgba(38,166,154,.18); }
html[data-theme="dark"] .rp-badge.gray { background: #2a3140; }
html[data-theme="dark"] .rp-badge.amber { background: rgba(212,160,23,.22); color: #e6b95c; }
html[data-theme="dark"] .conv-step.blue { color: #9dbdff; }
html[data-theme="dark"] .conv-step.green { color: #7ee2a8; }
html[data-theme="dark"] .conv-step.orange { color: #f0b269; }
html[data-theme="dark"] .conv-step.purple { color: #cbaaff; }
html[data-theme="dark"] .report-block h2 {
  background: linear-gradient(90deg, rgba(91,140,255,.08) 0%, rgba(91,140,255,.22) 50%, rgba(91,140,255,.08) 100%); }
html[data-theme="dark"] .filters select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aab4c4' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* --- тёмная тема: активный пункт меню в стиле «BH» + неоновый шов сайдбара --- */
html[data-theme="dark"] .sidebar nav a.active {
  background: rgba(255,179,71,.15);
  color: #ffb347;
  box-shadow: inset 0 0 0 1px rgba(255,179,71,.5), 0 0 14px rgba(255,179,71,.26);
  text-shadow: 0 0 9px rgba(255,179,71,.35); }
html[data-theme="dark"] .sidebar nav a.active:hover { background: rgba(255,179,71,.22); color: #ffc46b; }
html[data-theme="dark"] .sidebar::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: -2px; width: 3px;
  background: linear-gradient(180deg, transparent 0%, rgba(255,179,71,.85) 28%, rgba(255,179,71,.6) 62%, transparent 100%);
  box-shadow: 5px 0 20px rgba(255,179,71,.38), 16px 0 34px rgba(255,179,71,.16);
  animation: seamBreathe 4.5s ease-in-out infinite;
  pointer-events: none; border-radius: 999px; }
@keyframes seamBreathe {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

/* --- тёмная тема: заголовки блоков — неон в стиле «BH» --- */
@keyframes headFlicker {
  0%, 54%, 61%, 69%, 76%, 84%, 100% { opacity: 1;
    text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.22); }
  57% { opacity: .5; text-shadow: none; }
  72% { opacity: .65; text-shadow: 0 0 4px rgba(255,179,71,.25); }
  86% { opacity: .78; }
}
html[data-theme="dark"] .content .panel h2,
html[data-theme="dark"] .content .report-block h2 {
  color: #ffb347;
  animation: headerShimmer 4s ease-in-out infinite, headFlicker 8.2s ease-in-out infinite;
}
html[data-theme="dark"] .content h1 {
  color: #ffb347;
  text-shadow: 0 0 10px rgba(255,179,71,.55), 0 0 26px rgba(255,179,71,.25);
  animation: headFlicker 8.2s ease-in-out infinite;
}

/* --- переключатель темы: луна / солнце --- */
.theme-switch { display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; padding: 6px 4px; margin-bottom: 10px; user-select: none;
  width: 100%; }
.theme-switch .t-icon { font-size: 14px; opacity: .55; transition: opacity .2s, transform .3s; }
html:not([data-theme="dark"]) .theme-switch .t-sun,
html[data-theme="dark"] .theme-switch .t-moon { opacity: 1; transform: scale(1.15); }
.t-track { width: 40px; height: 20px; border-radius: 999px; position: relative;
  background: linear-gradient(90deg, #ffd76a 0%, #ffd76a 50%, #2b3550 50%, #2b3550 100%);
  border: 1px solid rgba(127,142,168,.45); flex-shrink: 0; }
.t-knob { position: absolute; top: 1px; left: 1px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: left .25s ease; }
html[data-theme="dark"] .t-knob { left: 21px; background: #cfd8ea; }
.theme-switch .t-label { font-size: 12px; color: var(--sidebar-text); }

/* --- ДЕМО-режим --- */
.demo-btn { background: #ffb347; color: #241a05; width: 100%; font-weight: 700; }
.demo-btn:hover { background: #ffc46b; opacity: 1; }
.demo-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px;
  color: var(--muted); font-size: 12px; }
.demo-divider::before, .demo-divider::after { content: ""; flex: 1;
  border-top: 1px solid var(--border); }
.demo-bar { border-left: 4px solid #f59e0b; background: rgba(245,158,11,.08);
  margin-bottom: 16px; }
.demo-exit { display: block; text-align: center; padding: 7px 8px; margin-bottom: 10px;
  border-radius: 8px; background: rgba(255,179,71,.14); color: #ffb347;
  border: 1px solid rgba(255,179,71,.45); text-decoration: none; font-size: 13px;
  font-weight: 600; }
.demo-exit:hover { background: rgba(255,179,71,.24); }

/* попап виртуального чата */
.demo-overlay { position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,12,18,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; }
.demo-overlay[hidden] { display: none; }
.demo-modal { width: min(520px, 94vw); height: min(640px, 88vh);
  background: var(--card); border: 1px solid var(--border);
  border-top: 3px solid var(--lamp-lit); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.demo-head { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 12px 14px; font-weight: 700;
  border-bottom: 1px solid var(--border); }
.demo-msgs { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; }
.demo-line { display: flex; }
.demo-line.from-client { justify-content: flex-start; }
.demo-line.from-ai { justify-content: flex-end; }
.demo-line .msg-ai, .demo-line .msg-client, .demo-line .msg-manager {
  max-width: 86% !important; }
.demo-inputrow { display: flex; gap: 8px; padding: 0 10px 4px; }
.demo-inputrow input { flex: 1; }
.demo-hint-warn { margin: 6px auto 2px; padding: 9px 14px; max-width: 92%;
  background: rgba(245,158,11,.12); border: 1px dashed rgba(245,158,11,.55);
  border-radius: 10px; color: inherit; font-size: 13.5px; }

/* тех-документация: блоки кода */
.codeblock { background: #0f1115; color: #c9d1dc; border-radius: 10px;
  padding: 12px 14px; font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.55; white-space: pre-wrap;
  word-break: break-word; overflow-x: auto; margin: 8px 0 4px;
  border: 1px solid rgba(255,255,255,.06); }
.rp-code { background: #0f1115; color: #c9d1dc; border-radius: 8px;
  padding: 6px 10px; font-family: Consolas, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-word; margin: 4px 0; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
.layout { display: flex; min-height: 100vh; }

.sidebar { width: 230px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; }
.logo { font-size: 19px; font-weight: 700; color: #fff; padding: 20px 18px 14px;
  white-space: nowrap; }

/* --- логотип-неон: AI пульсирует, BH — перегорающие лампы (как в Кворк Монитор) --- */
.logo .kw { color: #ff5252; animation: brandLamp 2.6s ease-in-out infinite; }
.logo .mon { color: #ffb347; margin-left: 9px; letter-spacing: 1px; }
.logo .ml { display: inline-block; animation: dyingNeon 7s infinite; }
@keyframes brandLamp {
  0%, 100% { opacity: .5; text-shadow: 0 0 5px rgba(255,82,82,.35); }
  50% { opacity: 1; text-shadow: 0 0 12px rgba(255,82,82,.95), 0 0 30px rgba(255,82,82,.45); }
}
@keyframes dyingNeon {
  0% { opacity: 1; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
  56% { opacity: 1; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
  59% { opacity: .3; text-shadow: none; }
  62% { opacity: 1; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
  71% { opacity: .92; text-shadow: 0 0 6px rgba(255,179,71,.4), 0 0 16px rgba(255,179,71,.18); }
  74% { opacity: .45; text-shadow: none; }
  77% { opacity: 1; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
  86% { opacity: .97; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
  89% { opacity: .55; text-shadow: 0 0 4px rgba(255,179,71,.3); }
  92% { opacity: 1; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
  100% { opacity: 1; text-shadow: 0 0 8px rgba(255,179,71,.55), 0 0 22px rgba(255,179,71,.25); }
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; }
.sidebar nav a { color: var(--sidebar-text); text-decoration: none; padding: 10px 12px;
  border-radius: 8px; font-size: 14px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }

/* категории меню: заголовок + визуальный разделитель */
.nav-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #66707f; padding: 12px 12px 4px; user-select: none; }
.nav-sep { border: none; border-top: 1px solid rgba(255,255,255,.09);
  margin: 12px 12px 0; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.user-info { margin-bottom: 8px; }
.logout { color: #f87171; text-decoration: none; }

.content { flex: 1; margin-left: 230px; padding: 26px 30px; max-width: 1200px; }
h1 { font-size: 22px; margin-bottom: 18px; }
h2 { font-size: 16px; margin: 22px 0 10px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }

/* --- карточки Обзора: полоска СВЕРХУ (пульс) + свечение при наведении --- */
@keyframes cardLamp {
  0%, 100% { border-top-color: var(--lamp-dim); }
  50% { border-top-color: var(--lamp-lit); }
}
.card { position: relative; text-align: left;
  background: var(--glass);
  border: 1px solid var(--border); border-top: 3px solid var(--lamp-dim);
  border-radius: 12px; padding: 16px;
  animation: cardLamp 3s ease-in-out infinite;
  transition: transform .18s ease, box-shadow .28s ease; }
.card:nth-child(2n) { animation-delay: -.9s; }
.card:nth-child(3n) { animation-delay: -1.8s; }
.card:hover { transform: translateY(-3px);
  box-shadow: var(--glow-hover); }
.card .num { font-size: 26px; font-weight: 700; letter-spacing: -.2px; }
.card .label { font-size: 13.5px; font-weight: 500; color: var(--label-text); margin-top: 6px; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin-bottom: 18px; }
.panel h2 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; }
tr:hover td { background: var(--hover-row); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.bad { background: #fee2e2; color: var(--bad); }
.badge.warn { background: #fef3c7; color: var(--warn); }
.badge.info { background: #dbeafe; color: var(--accent); }
.badge.muted { background: #e5e7eb; color: var(--muted); }

.btn { display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: 8px 14px; border-radius: 8px; font-size: 13.5px; cursor: pointer; text-decoration: none; }
.btn:hover { opacity: .92; }
.btn.secondary { background: var(--chip-bg); color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local],
input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: var(--input-bg); color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
textarea.code { font-family: Consolas, monospace; font-size: 13px; min-height: 220px; }
form .row { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
form label.field { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.msg-client { background: var(--msg-client-bg); border-radius: 10px; padding: 8px 12px; margin: 6px 0; max-width: 75%; white-space: pre-wrap; }
.msg-ai { background: var(--msg-ai-bg); border-radius: 10px; padding: 8px 12px; margin: 6px 0 6px auto; max-width: 75%; white-space: pre-wrap; }
.msg-manager { background: var(--msg-manager-bg); border-radius: 10px; padding: 8px 12px; margin: 6px 0 6px auto; max-width: 75%; white-space: pre-wrap; }
.msg-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
pre.report { white-space: pre-wrap; font-family: inherit; font-size: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; line-height: 1.7; color: var(--text); }

/* --- Reports page (Kwork-inspired accents + glass effect) --- */
.report-top-control {
  display: flex; align-items: center; justify-content: center;
  padding: 14px 18px; margin-bottom: 18px; }
.control-label { font-size: 14px; font-weight: 600; color: var(--text); margin-right: 8px; }
.funnel-selects select {
  width: auto; max-width: 180px; height: 36px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 14px; cursor: pointer;
  font-weight: 500; }

.report-kpi-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.report-kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 14px; text-align: center; position: relative; overflow: hidden;
  transition: transform .12s, box-shadow .2s; }
.report-kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,99,235,.1); }
.report-kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent); border-radius: 10px 10px 0 0; }
.report-kpi-num { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.report-kpi-label { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase;
  letter-spacing: .4px; }
.report-kpi-sub { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 2px; }

/* Sale card: green accent */
.report-kpi-sale::before { background: var(--ok); }
.report-kpi-sale .report-kpi-num { color: var(--ok); }
.report-kpi-sale:hover { box-shadow: 0 6px 20px rgba(22,163,74,.1); }

/* Contact card: orange accent */
.report-kpi-contact::before { background: var(--warn); }
.report-kpi-contact .report-kpi-num { color: var(--warn); }
.report-kpi-contact:hover { box-shadow: 0 6px 20px rgba(217,119,6,.1); }

/* Meeting card: purple accent */
.report-kpi-meeting::before { background: #7c3aed; }
.report-kpi-meeting .report-kpi-num { color: #7c3aed; }
.report-kpi-meeting:hover { box-shadow: 0 6px 20px rgba(124,58,237,.1); }

/* --- Funnel: glass bars with shine animation --- */
.report-funnel { margin-bottom: 20px; }
.funnel-stages { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.funnel-stage {
  display: grid; grid-template-columns: 140px 1fr 50px 55px;
  align-items: center; gap: 12px; padding: 4px 0; }
.funnel-stage-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.funnel-bar-wrap {
  height: 28px; background: var(--track); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--track-border); }
.funnel-bar {
  height: 100%; border-radius: 8px; position: relative; overflow: hidden;
  transition: width .5s ease; }
/* Glass shine effect - блик проходит слева направо */
.funnel-glass-shine {
  position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: glassShine 2.5s ease-in-out infinite; }
@keyframes glassShine {
  0% { left: -60%; }
  100% { left: 160%; }
}
/* Semantic colors per funnel stage */
.funnel-bar.lead    { background: linear-gradient(135deg, rgba(91,140,255,.7), rgba(91,140,255,.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 8px rgba(91,140,255,.2); }
.funnel-bar.qual    { background: linear-gradient(135deg, rgba(37,99,235,.7), rgba(37,99,235,.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 8px rgba(37,99,235,.2); }
.funnel-bar.contact { background: linear-gradient(135deg, rgba(230,126,34,.7), rgba(230,126,34,.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 8px rgba(230,126,34,.2); }
.funnel-bar.meeting { background: linear-gradient(135deg, rgba(124,58,237,.7), rgba(124,58,237,.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 8px rgba(124,58,237,.2); }
.funnel-bar.sale    { background: linear-gradient(135deg, rgba(22,163,74,.7), rgba(22,163,74,.5));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 8px rgba(22,163,74,.2); }
.funnel-stage-num { font-size: 14px; font-weight: 700; color: var(--text); text-align: right; }
.funnel-stage-pct { font-size: 12px; color: var(--muted); text-align: right; }

/* --- Conversion badges (Kwork niche-chip pattern) --- */
.report-conv { margin-bottom: 20px; }
.conv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.conv-step {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1px solid; }
.conv-step.blue  { background: rgba(91,140,255,.1); border-color: rgba(91,140,255,.4); color: #2563eb; }
.conv-step.green { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.4); color: #16a34a; }
.conv-step.orange { background: rgba(230,126,34,.1); border-color: rgba(230,126,34,.4); color: #d97706; }
.conv-step.purple { background: rgba(124,58,237,.1); border-color: rgba(124,58,237,.4); color: #7c3aed; }
.conv-arrow { font-size: 13px; color: var(--muted); font-weight: 500; }

/* Accordion blocks (details/summary) on settings pages */

/* Accordion blocks (details/summary) on settings pages */
details { margin: 6px 0; }
details > summary.acc-head {
  cursor: pointer; font-weight: 600; padding: 8px 10px;
  border-radius: 8px; background: var(--surface, #f4f5f7); user-select: none;
}
details > summary.acc-head:hover { filter: brightness(0.97); }
details[open] > summary.acc-head { margin-bottom: 8px; }

/* Default (builtin) prompts shown in fields: muted until edited */
textarea.code.prompt-default { color: var(--placeholder); background: var(--input-disabled-bg); }

/* Prompt editor: textarea left, docs right */
.prompt-row { display: flex; gap: 20px; align-items: flex-start; }
.prompt-main { flex: 1 1 auto; min-width: 0; }
.prompt-main textarea.code { width: 100%; }
.prompt-docs {
  flex: 0 0 360px; max-width: 360px; font-size: 12.5px; line-height: 1.5;
  color: var(--muted, #6b7280); border-left: 2px solid var(--border); padding-left: 14px;
}
.prompt-docs b { color: var(--text, #1f2937); }
.doc-list { margin: 10px 0; padding-left: 16px; }
.doc-list li { margin-bottom: 7px; }
@media (max-width: 900px) {
  .prompt-row { flex-direction: column; }
  .prompt-docs { flex: none; max-width: none; border-left: none; padding-left: 0;
                 border-top: 2px solid var(--border); padding-top: 10px; }
}

/* Dropdowns on settings page look like inputs */
select {
  width: 100%; max-width: 420px; padding: 7px 10px; font: inherit;
  border: 1px solid var(--input-border); border-radius: 8px;
  background: var(--input-bg); color: var(--text);
}
select:disabled { background: var(--input-disabled-bg); color: var(--muted); }

/* Placeholder = gray default hint (like prompt-default on AI page) */
.content input::placeholder, .content textarea::placeholder {
  color: var(--placeholder); font-style: italic; opacity: 1;
}

/* Постраничная навигация (страница чатов) */
.pager { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pager a, .pager .cur, .pager .dots {
  display: inline-block; padding: 4px 9px; border-radius: 6px;
  font-size: 13px; line-height: 1.2;
}
.pager a { background: var(--card); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .cur { background: var(--accent); color: #fff; font-weight: 600; }
.pager .dots { color: var(--muted); }

/* Панель фильтров страницы чатов: одна горизонтальная линия */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 12px 0 16px; }
.filters select, .filters input[type="date"] {
  width: auto; max-width: 230px; height: 36px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background-color: var(--card); color: var(--text);
  font-size: 14px; flex: 0 0 auto; }
.filters { flex-wrap: nowrap; }
@media (max-width: 900px) { .filters { flex-wrap: wrap; } }
.filters select:focus, .filters input[type="date"]:focus {
  outline: none; border-color: var(--accent); }
.filters a.btn { display: inline-flex; align-items: center; height: 36px; }

.filters select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 32px; cursor: pointer; font-weight: 500;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a7382' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  background-size: 12px 8px;
}
.filters input[type="date"] { cursor: pointer; }


/* --- страница входа: размытый интерфейс под карточкой логина (24.08) --- */
.login-body { margin: 0; overflow: hidden; }

.login-backdrop {
  position: fixed; inset: -20px; z-index: 0;
  display: flex; gap: 0;
  filter: blur(16px) saturate(0.85) brightness(0.92);
  pointer-events: none; user-select: none;
}

.lb-sidebar {
  width: 240px; flex: 0 0 auto; padding: 20px 18px;
  background: var(--card, #fff); border-right: 1px solid #e5e7eb;
}
.lb-logo { height: 26px; width: 60%; background: #d1d5db; border-radius: 6px; margin-bottom: 22px; }
.lb-line { height: 13px; background: #e2e6ec; border-radius: 999px; margin-bottom: 12px; }
.w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; }
.w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; }

.lb-main { flex: 1; padding: 28px 32px; background: var(--bg, #f3f4f6); }
.lb-title { height: 22px; width: 34%; background: #d1d5db; border-radius: 6px; margin-bottom: 18px; }
.lb-card { height: 180px; background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; margin-bottom: 20px; }
.lb-row { display: flex; gap: 14px; margin-bottom: 12px; }
.lb-row span { flex: 1; height: 44px; background: #fff; border-radius: 10px; border: 1px solid #e5e7eb; }

.login-card {
  position: relative; z-index: 2;
  max-width: 380px; margin: 12vh auto 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
}

/* баннер режима контроля качества */
.impersonation-bar {
  border-left: 4px solid var(--warn);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}

/* --- reports: Kwork-inspired styling --- */
.report { font-family: inherit; font-size: 14px; line-height: 1.65; }
.report h2 { color: var(--text); border-left: 4px solid var(--accent); padding: 8px 14px;
  background: rgba(116,142,255,.06); border-radius: 0 8px 8px 0; margin-bottom: 14px; }
.report h3 { font-size: 16px; margin: 20px 0 8px; color: #1a56db; border-left: 4px solid #5b8cff;
  padding: 7px 12px; background: rgba(91,140,255,.08); border-radius: 0 8px 8px 0; font-weight: 700; }
.report h4 { font-size: 15px; margin: 14px 0 6px; color: #1a56db; font-weight: 600; }
.report h5 { font-size: 14px; margin: 12px 0 6px; color: #b45309; font-weight: 700; }
.report p { margin: 5px 0; }
.report ul, .report ol { margin: 6px 0 6px 22px; }
.report li { margin: 2px 0; font-size: 13.5px; }
.report ul li::marker { color: var(--accent); }
.report ol li::marker { color: var(--accent); font-weight: 600; }
.report hr { border: none; border-top: 1px solid #e2e5ea; margin: 14px 0; }
.report b { color: #111827; }
.report table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.report th { background: #f0f2f5; color: var(--muted); font-weight: 600; text-transform: uppercase;
  font-size: 12px; letter-spacing: .3px; padding: 7px 10px; text-align: left; border-bottom: 1px solid #e2e5ea; }
.report td { padding: 6px 10px; border-bottom: 1px solid #f0f2f5; }
.report tr:hover td { background: #f7f8fa; }
.report blockquote { border-left: 3px solid #f59e0b; margin: 8px 0; padding: 6px 12px;
  color: var(--muted); background: rgba(245,158,11,.06); border-radius: 0 6px 6px 0; }
.report code { background: #f0f2f5; border: 1px solid #e2e5ea; border-radius: 4px;
  padding: 1px 5px; font-size: 12px; }

/* --- structured report blocks (.rp): stat-list design --- */
.rp { font-size: 14px; }
.rp-date { font-weight: 600; color: var(--muted); font-size: 12.5px; margin-bottom: 8px;
  padding-bottom: 7px; border-bottom: 1px solid var(--border); letter-spacing: .2px; }

/* строка: [бейдж] лейбл ......... значение */
.rp-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 6px 8px; border-radius: 8px; font-size: 13.5px; color: var(--text); }
.rp-row:nth-child(odd of .rp-row) { background: var(--row-alt); }

/* тех-документация: «термин — описание» без перекрытий */
.det-item { padding: 8px 12px; font-size: 13.5px; color: var(--text);
  line-height: 1.55; border-radius: 6px; }
.det-item:nth-child(odd) { background: var(--row-alt); }
.det-item b { color: var(--label-text); }
.rp-badge { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-style: normal; font-weight: 700; }
.rp-badge.blue   { background: #e8effd; }
.rp-badge.green  { background: #e4f6ec; }
.rp-badge.red    { background: #fde9e9; }
.rp-badge.orange { background: #fdf0e1; }
.rp-badge.violet { background: #efeafd; }
.rp-badge.purple { background: #f3e8fd; }
.rp-badge.teal   { background: #e2f5f3; }
.rp-badge.gray   { background: #eef0f4; }
.rp-badge.amber  { background: #fdf3dc; color: #b45309; font-size: 13px; }
.rp-badge.ghost  { background: var(--chip-bg); }

.rp-lbl { flex: 1 1 auto; min-width: 0; font-weight: 500; color: var(--label-text); }
.rp-val { flex: 0 0 auto; margin-left: auto; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text); }
.rp-val .rp-pct { font-weight: 500; color: var(--muted); font-size: 12px; }

/* подстрока (разбивка по источникам/категориям) */
.rp-row.rp-sub { padding-left: 16px; }
.rp-row.rp-sub .rp-lbl { color: var(--muted); font-weight: 400; }
.rp-row.rp-sub .rp-val { font-weight: 600; color: var(--sub-val); }

/* буллет ("- текст" / "• текст") */
.rp-row.rp-bullet { padding-left: 8px; }
.rp-row.rp-bullet .rp-lbl { font-weight: 400; color: #3d4552; }

/* заголовок раздела внутри отчёта */
.rp-row.rp-head { margin-top: 10px; padding-bottom: 2px; border-bottom: 1px dashed var(--border);
  border-radius: 0; background: none !important; }
.rp-row.rp-head .rp-lbl { font-weight: 700; color: var(--text); font-size: 13.5px; }
.rp-row.rp-head .rp-badge.ghost { color: var(--accent); }

/* примечание-продолжение в скобках */
.rp-note { margin: -2px 0 4px 44px; font-size: 12px; color: var(--muted); font-style: italic; }

/* заголовочная строка отчёта ("📊 Еженедельный отчёт...") */
.rp-title-row { padding-bottom: 4px; margin-bottom: 2px; }
.rp-title-row .rp-lbl { font-weight: 700; font-size: 14.5px; color: var(--text); }

/* конверсии — отдельная категория в мягкой плашке */
.rp-conv-group { margin-top: 10px; padding: 6px 6px; background: var(--amber-group-bg);
  border-radius: 10px; border: 1px dashed var(--amber-group-border); }
.rp-row.rp-conv .rp-lbl { color: var(--amber-label); font-weight: 500; }
.rp-row.rp-conv:nth-child(odd of .rp-row) { background: rgba(212,160,23,.07); }
.rp-line { padding: 4px 8px; color: var(--text); font-size: 13.5px; }
.rp-line.rp-strong { font-weight: 700; color: var(--text); padding-top: 6px; }

/* --- Обзор: график лидов по дням --- */
.spark { display: flex; align-items: stretch; gap: 6px; height: 150px; padding: 6px 4px 0; }
.spark .bar-wrap { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 5px; }
.spark .bar { width: 100%; max-width: 26px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #7da2ff, #2563eb); min-height: 3px;
  transition: height .3s ease; }
.spark .bar.today { background: linear-gradient(180deg, #58d68d, #16a34a); }
.spark .v { font-size: 11px; font-weight: 700; color: var(--text); line-height: 1; }
.spark .d { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* дельта на карточке */
.delta { font-size: 12px; font-weight: 600; margin-top: 5px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); font-weight: 500; }

/* источники: стековая полоса + точки легенды */
.src-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden;
  margin: 6px 0 12px; background: #eef0f4; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 10px; flex-shrink: 0; }

/* интеграции/каналы: карточки «по запросу» */
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.soon-card { border: 1px dashed var(--soon-border); border-radius: 10px; padding: 12px 14px;
  background: var(--soon-bg); display: flex; flex-direction: column; gap: 7px; }
.soon-head { display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; }
.soon-desc { font-size: 13px; color: #3d4552; line-height: 1.5; }
.soon-need { font-size: 12px; color: var(--muted); font-style: italic; }
.badge.soon { background: #eef2f7; color: #66707f; border: 1px solid #dbe1ea;
  font-size: 11px; padding: 2px 8px; border-radius: 999px; }

/* статус-точки подключений (интеграции и каналы) */
.dot-status { width: 11px; height: 11px; border-radius: 50%;
  background: #c3cad3; flex-shrink: 0; display: inline-block;
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.08); }
.dot-status.ok { background: #2ecc71; animation: dotPulse 2.4s ease-in-out infinite; }
.dot-status.err { background: #e74c3c; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46,204,113,.45); }
  50% { box-shadow: 0 0 0 6px rgba(46,204,113,0); }
}

/* --- report-block: glass panel + glowing lamp border --- */
@keyframes lampGlow {
  0%, 100% { border-left-color: var(--lamp-dim); }
  50% { border-left-color: var(--lamp-lit); }
}
@keyframes headerShimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.report-block { border-left: 3px solid var(--lamp-dim);
  background: var(--glass);
  animation: lampGlow 3s ease-in-out infinite; }
.report-block h2 { color: var(--text); font-size: 16px; font-weight: 700;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(37,99,235,.06) 0%, rgba(37,99,235,.15) 50%, rgba(37,99,235,.06) 100%);
  background-size: 200% 100%;
  animation: headerShimmer 4s ease-in-out infinite; }

/* --- Плашка «Сохранено» на странице настроек (24.08) --- */
.flash-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac;
  border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; font-weight: 600; }

/* ссылки из блока «Требует внимания» */
.att-link { text-decoration: none; color: inherit; display: block; }
.att-link:hover { text-decoration: none; }
.att-link:hover .rp-lbl { text-decoration: underline; text-underline-offset: 3px; }
.att-link:hover .rp-row { background: rgba(212,160,23,.10); }

/* проблемные чаты в списке: свечение под статусом */
.st-glow { display: block; height: 3px; border-radius: 999px; margin-top: 4px;
  animation: stGlowPulse 2.2s ease-in-out infinite; }
.st-glow.red { background: linear-gradient(90deg, transparent, var(--bad), transparent); }
.st-glow.amber { background: linear-gradient(90deg, transparent, #f59e0b, transparent); }
@keyframes stGlowPulse {
  0%, 100% { opacity: .45; filter: blur(.5px); }
  50% { opacity: 1; filter: blur(1.2px); }
}
.badge.st-esc { background: rgba(220,38,38,.12); color: var(--bad); }
.badge.st-stale { background: rgba(245,158,11,.14); color: #b45309; }
.att-link:hover { text-decoration: none; }
.att-link:hover .rp-lbl { text-decoration: underline; text-underline-offset: 3px; }
.att-link:hover .rp-row { background: rgba(212,160,23,.10); }

/* инструкции по ролям на странице Помощи */
.acc-block { border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 10px; background: var(--card); }
.acc-block > summary { cursor: pointer; font-weight: 700; font-size: 14.5px;
  padding: 6px 4px; list-style: none; user-select: none; }
.acc-block > summary::-webkit-details-marker { display: none; }
.acc-block > summary::before { content: '▸ '; color: var(--muted); }
.acc-block[open] > summary::before { content: '▾ '; }
.acc-block[open] { border-left: 3px solid #d4a017; }
