/* =====================================================================
   Protect Vision CRM — светлая и чёрная темы в стиле панели чата Meta
   ===================================================================== */
@font-face { font-family: 'Unbounded'; font-weight: 500; font-display: swap; src: url(fonts/unbounded-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Unbounded'; font-weight: 500; font-display: swap; src: url(fonts/unbounded-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Unbounded'; font-weight: 500; font-display: swap; src: url(fonts/unbounded-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-weight: 700; font-display: swap; src: url(fonts/unbounded-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Unbounded'; font-weight: 700; font-display: swap; src: url(fonts/unbounded-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Unbounded'; font-weight: 700; font-display: swap; src: url(fonts/unbounded-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url(fonts/manrope-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-weight: 500; font-display: swap; src: url(fonts/manrope-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-weight: 500; font-display: swap; src: url(fonts/manrope-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-weight: 500; font-display: swap; src: url(fonts/manrope-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url(fonts/manrope-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url(fonts/manrope-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url(fonts/manrope-cyrillic-600-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url(fonts/manrope-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

/* ---------- Темы: светлая (как панель чата Meta) и чёрная ---------- */
:root, [data-theme="dark"] {
  --bg: #05070b;
  --bg-glow: radial-gradient(900px 520px at -5% -10%, rgba(37, 99, 235, .16), transparent 60%), radial-gradient(700px 500px at 105% 110%, rgba(59, 130, 246, .08), transparent 60%);
  --surface: #0d1118;
  --surface-2: #111621;
  --surface-3: #161c28;
  --line: #1b2230;
  --line-2: #273143;
  --text: #eef2f8;
  --muted: #8f98ad;
  --faint: #5a6378;
  --primary: #2563eb;
  --primary-2: #3b82f6;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, .15);
  --accent-text: #93c5fd;
  --rail: linear-gradient(180deg, #0d2554 0%, #11336f 100%);
  --rail-text: rgba(255, 255, 255, .72);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 40px -24px rgba(0, 0, 0, .8);
  --shadow-lg: 0 40px 120px -30px rgba(0, 0, 0, .9);
  --input-bg: #090c12;
  --overlay: rgba(2, 4, 8, .62);
  --grid: rgba(255, 255, 255, .06);
  --tick: #5a6378;
  --ava-bg: rgba(59, 130, 246, .16);
  --ava-text: #93c5fd;
  --hero: linear-gradient(135deg, rgba(37, 99, 235, .20) 0%, rgba(99, 102, 241, .10) 100%);
  --kpi-hl: linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #3b82f6 100%);
  --t-amber-bg: rgba(251, 146, 60, .14); --t-amber: #fdba74;
  --t-blue-bg: rgba(59, 130, 246, .16);  --t-blue: #93c5fd;
  --t-red-bg: rgba(244, 63, 94, .15);    --t-red: #fda4af;
  --t-green-bg: rgba(52, 211, 153, .13); --t-green: #6ee7b7;
  --t-violet-bg: rgba(139, 92, 246, .16); --t-violet: #c4b5fd;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef2f8;
  --bg-glow: radial-gradient(900px 500px at 100% -10%, rgba(37, 99, 235, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --line: #e4e9f0;
  --line-2: #d5dce7;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #1e3a8a;
  --primary-2: #1e40af;
  --accent: #2563eb;
  --accent-soft: #e0ecff;
  --accent-text: #1d4ed8;
  --rail: linear-gradient(180deg, #1d5cbc 0%, #2a7dd4 100%);
  --rail-text: rgba(255, 255, 255, .82);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -16px rgba(15, 23, 42, .18);
  --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, .35);
  --input-bg: #f4f6fa;
  --overlay: rgba(15, 23, 42, .32);
  --grid: #e9eef4;
  --tick: #94a3b8;
  --ava-bg: #e3edff;
  --ava-text: #2563eb;
  --hero: linear-gradient(135deg, #eaf2ff 0%, #f3efff 100%);
  --kpi-hl: linear-gradient(135deg, #1d5cbc 0%, #2a7dd4 100%);
  --t-amber-bg: #fff1e6; --t-amber: #c2410c;
  --t-blue-bg: #e0ecff;  --t-blue: #1d4ed8;
  --t-red-bg: #fee2e2;   --t-red: #dc2626;
  --t-green-bg: #dcfce7; --t-green: #15803d;
  --t-violet-bg: #ede9fe; --t-violet: #6d28d9;
  color-scheme: light;
}
:root { --display: 'Unbounded', 'Manrope', system-ui, sans-serif; --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; --r: 18px; }
:root:not([data-theme="light"]) .only-light, [data-theme="light"] .only-dark { display: none !important; }

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); font: 500 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; background: var(--bg-glow), var(--bg); background-attachment: fixed; transition: background-color .2s; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; height: 100vh; font: 700 13px var(--display); letter-spacing: .4em; text-transform: uppercase; color: var(--faint); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Логотип ---------- */
.logo-tile { width: 52px; height: 52px; border-radius: 16px; background: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px -8px rgba(0, 0, 0, .45); flex: none; }
.logo-tile img { width: 36px; height: 36px; object-fit: contain; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo .logo-tile { width: 36px; height: 36px; border-radius: 11px; }
.logo .logo-tile img { width: 25px; height: 25px; }
.logo-word { font: 700 13px/1 var(--display); letter-spacing: .12em; }
.logo-sub { font: 700 12px/1 var(--display); color: #22b8e6; margin-top: 3px; }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.orb.a { width: 460px; height: 460px; background: #2563eb; top: -160px; left: -120px; opacity: .28; }
.orb.b { width: 420px; height: 420px; background: #22d3ee; bottom: -180px; right: -100px; opacity: .18; }
:root:not([data-theme="light"]) .orb.a { opacity: .38; }
.auth-card { position: relative; width: 100%; max-width: 420px; padding: 34px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.auth-logo { display: block; width: 176px; height: auto; margin: 0 auto 8px; }
.auth-tag { text-align: center; font: 800 10px var(--font); letter-spacing: .3em; text-transform: uppercase; color: var(--faint); margin-bottom: 26px; }
.auth h2 { margin: 0 0 8px; font: 700 21px/1.25 var(--display); }
.auth p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.qr { display: block; width: 188px; height: 188px; margin: 6px auto 12px; background: #fff; border-radius: 16px; padding: 10px; border: 1px solid var(--line); }
.secret { font: 500 12px ui-monospace, Menlo, monospace; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; color: var(--muted); }
.auth-foot { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }

/* ---------- Поля и кнопки ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; background: var(--input-bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.input:hover { border-color: var(--line-2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input::placeholder { color: var(--faint); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, #8a94a8 50%), linear-gradient(135deg, #8a94a8 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { min-height: 84px; resize: vertical; }
.input[readonly] { color: var(--muted); }
.input-icon { position: relative; }
.input-icon svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 17px; height: 17px; }
.input-icon .input { padding-left: 42px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: 12px; padding: 10px 16px; cursor: pointer; white-space: nowrap; font-weight: 700; transition: border-color .15s, background .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { border-color: transparent; color: #fff; background: var(--primary); box-shadow: 0 10px 24px -12px rgba(30, 58, 138, .8); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--t-red); border-color: transparent; background: var(--t-red-bg); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.icon { padding: 9px; }
.seg { display: inline-flex; gap: 3px; padding: 4px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 13px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 12.5px; }
.seg button.on { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.err { color: var(--t-red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

/* ---------- Каркас: синяя рейка слева ---------- */
.layout { display: grid; grid-template-columns: 96px minmax(0, 1fr); min-height: 100vh; }
.layout > div { min-width: 0; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--rail); color: #fff; display: flex; flex-direction: column; align-items: center; padding: 16px 10px; gap: 4px; }
/* логотип сверху и блок «онлайн / тема / язык / выход» снизу стоят на месте, прокручивается только меню между ними */
.rail .logo-tile { margin-bottom: 10px; flex: none; }
.rail-nav { display: flex; flex-direction: column; gap: 3px; width: 100%; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding-top: 2px; }
.rail-nav::-webkit-scrollbar { display: none; }
@media (max-height: 860px) { .rail-nav a { padding: 6px 4px 5px; gap: 3px; } .rail-sep { margin: 5px 0; } .rail .logo-tile { margin-bottom: 6px; } }
.rail-nav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 7px; border-radius: 14px; color: var(--rail-text); font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center; transition: background .15s, color .15s; }
.rail-nav a svg.i { width: 21px; height: 21px; }
.rail-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.rail-nav a.active { background: rgba(255, 255, 255, .17); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.rail-nav a.soon { opacity: .58; }
.rail-nav .badge { position: absolute; top: 4px; right: 10px; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; background: #22c55e; color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(29, 92, 188, .9); }
.rail-sep { width: 40px; height: 1px; background: rgba(255, 255, 255, .16); margin: 8px 0; flex: none; }
.rail-foot { flex: none; display: grid; grid-template-columns: 1fr 1fr; justify-items: center; gap: 6px; padding-top: 12px; width: 100%; }
.rail-btn { width: 36px; height: 36px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; cursor: pointer; font: 800 11px var(--font); letter-spacing: .04em; transition: background .15s; }
.rail-btn:hover { background: rgba(255, 255, 255, .2); }
.rail-btn svg.i { width: 18px; height: 18px; }
.rail .ava { box-shadow: 0 0 0 2px rgba(255, 255, 255, .4); }
.main { padding: 28px 28px 80px; max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.kicker { font: 800 10.5px var(--font); letter-spacing: .24em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.page-head h1 { margin: 0; font: 700 28px/1.12 var(--display); letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.mobile-top { display: none; }
.tabbar { display: none; }

/* ---------- Карточки ---------- */
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel { padding: 22px; }
.card { padding: 16px 18px; }
.panel h3 { margin: 0 0 4px; font: 700 14px var(--display); }
.panel .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 380px; min-width: 0; }

/* ---------- Аватары, источники, теги ---------- */
.ava-wrap { position: relative; flex: none; }
.ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ava-bg); color: var(--ava-text); font: 800 13px var(--font); letter-spacing: .02em; flex: none; }
.ava.lg { width: 60px; height: 60px; font-size: 19px; }
.ava.sm { width: 28px; height: 28px; font-size: 10.5px; }
.ava-badge { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.ava-badge svg.i { width: 10px; height: 10px; stroke-width: 2.4; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.src-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.src-ico svg.i { width: 15px; height: 15px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 8px; white-space: nowrap; background: var(--t-amber-bg); color: var(--t-amber); }
.tag.blue { background: var(--t-blue-bg); color: var(--t-blue); }
.tag.red { background: var(--t-red-bg); color: var(--t-red); }
.tag.green { background: var(--t-green-bg); color: var(--t-green); }
.tag.violet { background: var(--t-violet-bg); color: var(--t-violet); }
.tag svg.i { width: 12px; height: 12px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); } 70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- Полоса этапов ---------- */
.stage-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(130px, 1fr); gap: 10px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 16px; }
.stage-card { position: relative; text-align: left; padding: 14px 14px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s, transform .15s, background .15s; }
.stage-card:hover { transform: translateY(-1px); border-color: var(--line-2); }
.stage-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c, var(--accent)); }
.stage-card.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.stage-card .nm { font-size: 11.5px; font-weight: 800; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-card .ct { font: 700 23px/1.2 var(--display); margin-top: 6px; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 800 10.5px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.money { font: 700 13px var(--display); text-align: right; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
td.mono { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; color: var(--faint); display: block; margin: 0 auto 12px; }

/* ---------- Карточка заявки ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 40; display: flex; justify-content: flex-end; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer { width: min(820px, 100%); height: 100%; overflow-y: auto; padding: 24px 26px 70px; background: var(--surface-2); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: slide .22s ease; }
.hero { position: relative; display: flex; gap: 16px; align-items: center; padding: 20px; border-radius: 20px; background: var(--hero); border: 1px solid var(--line); margin-bottom: 14px; }
.hero .x { position: absolute; top: 12px; right: 12px; }
.hero h2 { margin: 2px 0 6px; font: 700 21px/1.2 var(--display); }
.meta-line { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.act { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; font-weight: 800; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.act:hover { text-decoration: none; filter: brightness(.97); }
.act.call { background: var(--t-green-bg); color: var(--t-green); border-color: transparent; }
.act.wa { background: var(--t-green-bg); color: var(--t-green); border-color: transparent; }
.act.vb { background: var(--t-violet-bg); color: var(--t-violet); border-color: transparent; }
.stepper { display: grid; grid-template-columns: repeat(8, 1fr) auto; gap: 6px; margin-bottom: 16px; }
.step { position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 10px 9px; cursor: pointer; text-align: left; color: var(--muted); font-size: 11.5px; font-weight: 800; line-height: 1.25; min-height: 54px; transition: border-color .15s, background .15s; }
.step:hover { border-color: var(--line-2); color: var(--text); }
.step .bar { display: block; height: 3px; border-radius: 3px; background: var(--surface-3); margin-bottom: 8px; }
.step.done { color: var(--text); }
.step.done .bar { background: var(--c); }
.step.cur { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.step.cur .bar { background: var(--c); }
.step.lost { min-width: 90px; }
.section-title { display: flex; align-items: center; gap: 10px; font: 800 11px var(--font); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); margin: 24px 0 12px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-item { position: relative; padding: 8px 0 8px 24px; }
.tl-item::before { content: ''; position: absolute; left: 4px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--faint); }
.tl-item::after { content: ''; position: absolute; left: 8px; top: 26px; bottom: -6px; width: 1px; background: var(--line-2); }
.tl-item:last-child::after { display: none; }
.tl-item.note::before { border-color: var(--accent); background: var(--accent-soft); }
.tl-item .when { color: var(--faint); font-size: 11.5px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.load-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--muted); }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plat .plat-head { display: flex; align-items: center; gap: 10px; }
.plat .plat-head h3 { margin: 0; }
.plat .plat-head i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.plat .kv { grid-template-columns: 1fr auto; margin-top: 10px; }
.plat .kv dd { text-align: right; font-weight: 800; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--muted); margin: 2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
td .dot, p .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
details.setup summary { cursor: pointer; list-style: none; }
details.setup summary::-webkit-details-marker { display: none; }
details.setup summary h3 { display: inline; }
details.setup summary::after { content: ' ▾'; color: var(--muted); }
pre.code { background: var(--surface-3); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 12px; line-height: 1.5; overflow: auto; max-height: 320px; white-space: pre; margin: 10px 0; }
.kv code { background: var(--surface-3); border: 1px solid var(--line); border-radius: 8px; padding: 3px 7px; font-size: 12px; word-break: break-all; }
@media (max-width: 980px) { .row3 { grid-template-columns: 1fr; } }
.conn-list { display: grid; gap: 2px; }
.conn-row { display: grid; grid-template-columns: 10px minmax(140px, 220px) 1fr; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.conn-row:last-child { border-bottom: 0; }
.conn-row .dot { width: 8px; height: 8px; }
.conn-name { font-weight: 700; }
.conn-note { color: var(--muted); }
.job-card { display: flex; flex-direction: column; gap: 8px; }
.job-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.job-card .ttl { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.job-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.modal-wrap { align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(580px, 100%); max-height: 92vh; overflow-y: auto; padding: 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: fade .18s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font: 700 17px var(--display); }
.temp-pass { font: 700 22px ui-monospace, Menlo, monospace; letter-spacing: .08em; text-align: center; padding: 18px; margin: 12px 0; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--accent); user-select: all; }

/* ---------- KPI и графики ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.kpi.hl { background: var(--kpi-hl); border-color: transparent; color: #fff; box-shadow: 0 18px 40px -18px rgba(29, 92, 188, .75); }
.kpi .label { display: flex; align-items: center; gap: 9px; font: 800 10.5px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kpi.hl .label, .kpi.hl .note { color: rgba(255, 255, 255, .8); }
.kpi .label .ki { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi.hl .label .ki { background: rgba(255, 255, 255, .18); color: #fff; }
.kpi .label .ki svg.i { width: 15px; height: 15px; }
.kpi .value { font: 700 32px/1.1 var(--display); letter-spacing: -.03em; margin: 16px 0 6px; font-variant-numeric: tabular-nums; }
.kpi .note { font-size: 12px; color: var(--muted); }
.kpi .meter { position: absolute; left: 20px; right: 20px; bottom: 12px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.kpi .meter i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #22b8e6, #2563eb); }
.hbar { display: grid; grid-template-columns: 150px 1fr 44px; gap: 12px; align-items: center; margin: 10px 0; font-size: 13px; font-weight: 700; }
.hbar .track { height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; }
.hbar .n { text-align: right; font: 700 13px var(--display); }
.chart { position: relative; }
.chart svg { width: 100%; height: 230px; display: block; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; transform: translate(-50%, -115%); box-shadow: var(--shadow-lg); }
.share { display: inline-block; height: 6px; border-radius: 4px; background: linear-gradient(90deg, #22b8e6, #2563eb); vertical-align: middle; }
.soon-panel { max-width: 760px; position: relative; overflow: hidden; }
.soon-panel ul { list-style: none; padding: 0; margin: 14px 0 6px; display: grid; gap: 10px; }
.soon-panel li { display: flex; gap: 10px; align-items: flex-start; }
.soon-panel li svg.i { color: var(--accent); margin-top: 2px; width: 16px; height: 16px; }

/* ---------- Уведомления ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; max-width: 360px; box-shadow: var(--shadow-lg); cursor: pointer; font-weight: 700; animation: slide .2s ease; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.err::before { background: #ef4444; }

/* ---------- Телефон ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 104px; z-index: 50; transform: translateX(-110%); transition: transform .22s ease; height: 100%; }
  .rail.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .4); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--rail); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobile-top .btn { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
  .mobile-top .logo-word { color: #fff; }
  .mobile-top .logo-sub { color: #a5f3fc; }
  .main { padding: 18px 14px 110px; }
  .page-head h1 { font-size: 22px; }
  .grid2, .grid3, .filters { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .drawer { padding: 14px 12px 60px; }
  .stepper { grid-template-columns: repeat(4, 1fr); }
  .hbar { grid-template-columns: 110px 1fr 36px; }
  .kpi .value { font-size: 27px; }
  .tabbar.on { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 35; padding: 8px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; border-radius: 14px; color: var(--muted); font-size: 11px; font-weight: 800; }
  .tabbar a.active { color: var(--accent); background: var(--accent-soft); }
  .tabbar .fab { width: 54px; height: 54px; border-radius: 18px; border: 0; color: #fff; background: var(--rail); box-shadow: 0 12px 28px -10px rgba(29, 92, 188, .9); display: grid; place-items: center; }
  .tabbar .fab svg.i { width: 24px; height: 24px; stroke-width: 2.2; }
  #toasts { left: 16px; right: 16px; bottom: 96px; }
}

/* Услуги и постоянные расходы */
.panel-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.panel-top .hint { max-width: 720px; }
.panel-top .btn { flex-shrink: 0; }
.cost-sum { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.cost-sum b { color: var(--text); font-family: var(--display); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn + .btn { margin-left: 6px; }
tr.cost-ended td { opacity: .55; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) {
  .panel-top { flex-direction: column; }
  .row2 { grid-template-columns: 1fr; }
}
.kpi .note { white-space: pre-line; }

/* Диалоги: переписки бота */
.main.wide { max-width: none; padding-right: 24px; padding-bottom: 20px; }
.dlg-layout { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 520px; }
.dlg-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.dlg-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.dlg-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.dlg-item:hover { border-color: var(--line-2); }
.dlg-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.dlg-item.unread b { color: var(--accent-text); }
.dlg-item.unread .dlg-text { color: var(--text); font-weight: 700; }
.dlg-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.dlg-top { display: flex; justify-content: space-between; gap: 8px; }
.dlg-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.dlg-time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.dlg-text { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dlg-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.dlg-tags .pill { padding: 2px 9px 2px 7px; font-size: 11px; }
.dlg-chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.dlg-chat > .empty { margin: auto; }
.dlg-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dlg-who-box { min-width: 0; flex: 1; }
.dlg-who-box h2 { margin: 0 0 4px; font: 700 17px var(--display); }
.dlg-head .toolbar { gap: 6px; flex-wrap: wrap; }
.dlg-head .btn .pill { padding: 1px 8px 1px 6px; font-size: 11px; }
.dlg-back { display: none; }
.btn.good { background: var(--t-green-bg); color: var(--t-green); border-color: transparent; }
.dlg-bot { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.dlg-bot .dot { width: 8px; height: 8px; border-radius: 50%; }
.dlg-bot .hint { font-size: 12px; }
.dlg-dossier { padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.dlg-dossier summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.dlg-dossier .kv { margin-top: 8px; grid-template-columns: 120px 1fr; }
.dlg-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.dlg-day { align-self: center; font-size: 11px; color: var(--faint); background: var(--surface-3); border-radius: 999px; padding: 3px 10px; margin: 6px 0; }
.dlg-msg { max-width: min(560px, 82%); display: flex; flex-direction: column; gap: 3px; align-self: flex-start; }
.dlg-msg.bot, .dlg-msg.manager { align-self: flex-end; align-items: flex-end; }
.dlg-who { font-size: 11px; font-weight: 800; color: var(--muted); }
.dlg-bubble { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.45; background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 6px; }
.dlg-msg.bot .dlg-bubble { background: var(--t-violet-bg); border-color: transparent; border-top-left-radius: 16px; border-top-right-radius: 6px; }
.dlg-msg.manager .dlg-bubble { background: var(--accent); color: #fff; border-color: transparent; border-top-left-radius: 16px; border-top-right-radius: 6px; }
.dlg-at { font-size: 10.5px; color: var(--faint); }
.dlg-imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.dlg-photo { border: 1px dashed var(--line-2); background: var(--surface); color: var(--muted); border-radius: 12px; padding: 8px 12px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font: inherit; font-size: 12.5px; }
.dlg-photo img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; }
.dlg-photo:has(img) { padding: 0; border: 0; }
.dlg-warn { padding: 8px 16px; font-size: 12.5px; color: var(--t-amber); background: var(--t-amber-bg); }
.dlg-compose { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.dlg-compose textarea { flex: 1; min-height: 46px; max-height: 180px; resize: vertical; }
.act.chat { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.act.chat .sub { font-weight: 600; opacity: .8; }
@media (max-width: 900px) {
  .dlg-layout { grid-template-columns: 1fr; height: calc(100dvh - 215px); min-height: 440px; }
  .dlg-head .toolbar { width: 100%; }
  .dlg-layout.chat-open .dlg-side { display: none; }
  .dlg-layout:not(.chat-open) .dlg-chat { display: none; }
  .dlg-back { display: inline-flex; }
  .dlg-msg { max-width: 92%; }
}

.btn.rate.on.good { background: #16a34a; color: #fff; box-shadow: 0 0 0 3px rgba(22, 163, 74, .25); }
.btn.rate.on.danger { background: #e11d48; color: #fff; box-shadow: 0 0 0 3px rgba(225, 29, 72, .22); }
.dlg-rate { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.dlg-rate svg.i { width: 15px; height: 15px; flex: none; }
.dlg-rate.good { background: var(--t-green-bg); color: var(--t-green); font-weight: 700; }
.dlg-rate.junk { background: var(--t-red-bg); color: var(--t-red); font-weight: 700; }
.dlg-excl { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dlg-rate { flex-wrap: wrap; padding: 10px 16px; }
.dlg-rate.todo { background: rgba(245, 158, 11, .12); color: #fbbf24; }
[data-theme="light"] .dlg-rate.todo { background: #fffbeb; color: #92400e; }
.dlg-rate-label { color: var(--text); font-size: 13.5px; }
.rate-seg { display: inline-flex; gap: 6px; }
.rate-seg .btn.rate { min-width: 104px; justify-content: center; font-weight: 700; }
.rate-seg .btn.rate.good:not(.on) { border-color: rgba(22, 163, 74, .55); color: var(--t-green); }
.rate-seg .btn.rate.danger:not(.on) { border-color: rgba(225, 29, 72, .5); color: var(--t-red); }
.dlg-rate-text { flex: 1 1 260px; }


/* Отчёт монтажника «Объект готов» */
.rep-page { max-width: 680px; margin: 0 auto; }
.rep-form { display: grid; gap: 16px; }
.rep-sec { border: 1px solid var(--line); margin: 0; min-width: 0; }
.rep-sec legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-weight: 800; font-size: 15px; letter-spacing: .01em; }
.rep-sec legend + * { clear: both; }
.rep-sec input[name="phone"] { font-size: 18px; font-weight: 700; letter-spacing: .03em; }
.rep-look { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; margin: 0 0 14px; font-size: 13px; line-height: 1.45;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.rep-look svg.i { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.rep-look b { color: var(--text); }
.rep-look .sub { color: var(--muted); margin-top: 2px; }
.rep-look.found { background: var(--t-green-bg); border-color: transparent; color: var(--t-green); }
.rep-look.found b { color: var(--t-green); }
.rep-look.new { background: var(--t-blue-bg); border-color: transparent; color: var(--t-blue); }
.rep-job { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13.5px; }
.rep-job svg.i { width: 16px; height: 16px; }
.num-step { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; align-items: center; }
.num-step .btn.icon { width: 44px; height: 44px; font-size: 20px; font-weight: 700; justify-content: center; padding: 0; }
.num-step .num-in { text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.msg-block { white-space: pre-wrap; font-size: 13px; line-height: 1.55; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); max-height: 260px; overflow: auto; }
.who-sub.lost-why { color: var(--t-red); }
.rep-form > .btn.block { min-height: 52px; font-size: 15px; justify-content: center; }
.rep-form .panel .hint { margin: 6px 0 0; }
tfoot td { font-weight: 800; border-top: 1px solid var(--line-2); color: var(--text); }
a.fab { text-decoration: none; }
.rep-sec .err:empty { min-height: 0; margin: 0; }
.rep-sec input[name="phone"]::placeholder { font-weight: 500; letter-spacing: .06em; }

/* Новая заявка: быстрый ввод как в Excel менеджера */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip svg.i { width: 14px; height: 14px; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips.small .chip { padding: 5px 10px; font-size: 12px; font-weight: 500; }
.chips.small { margin-top: 8px; }
.nl-form .field { margin-bottom: 12px; }
.nl-extra { margin: -2px 0 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.nl-extra .field { margin-bottom: 0; }
.nl-match:empty { display: none; }
.nl-match { margin: -4px 0 14px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.nl-match > .hint { padding: 10px 12px; margin: 0; }
.nl-match-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 700; font-size: 12.5px; background: var(--t-blue-bg); color: var(--t-blue); }
.nl-match-head.exact { background: var(--t-amber-bg); color: var(--t-amber); }
.nl-match-head svg.i { width: 15px; height: 15px; }
.nl-hit { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.nl-hit-main { flex: 1; min-width: 0; }
.nl-hit-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 3px; }
.nl-hit-act { display: flex; gap: 6px; flex: none; }
@media (max-width: 640px) { .nl-hit { flex-direction: column; align-items: stretch; } }
.modal:has(.nl-form) { width: min(760px, 100%); }
.meta-line .src .sub::before { content: "· "; margin-left: 5px; }

.dlg-count { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 8px 4px 4px; font-size: 12.5px; color: var(--muted); }
.dlg-count-unread { color: var(--accent-text); }
.dlg-unr { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-right: 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; }
.dlg-item.unread { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }

/* Кто онлайн (для админов) */
.rail-foot .online-btn { grid-column: 1 / -1; width: auto; min-width: 56px; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.on-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); flex: none; }
.online-pop { position: fixed; left: 104px; bottom: 18px; z-index: 60; width: min(340px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.on-head { display: grid; gap: 2px; margin-bottom: 10px; }
.on-head .hint { font-size: 12px; color: var(--muted); }
.on-row { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); }
.on-who { min-width: 0; }
.seen { font-size: 12.5px; color: var(--muted); }
.seen.on { color: var(--t-green); font-weight: 700; }
.seen.on::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 6px; vertical-align: 1px; }
@media (max-width: 860px) { .online-pop { left: 12px; bottom: 80px; } }

/* Таблицы на всю ширину и без горизонтальной прокрутки */
.main.full { max-width: none; padding-right: 28px; }
.leads-table { table-layout: fixed; min-width: 880px; }
.leads-table th, .leads-table td { padding: 10px 12px; overflow: hidden; }
.leads-table col.c-client { width: 30%; }
.leads-table col.c-phone { width: 11%; }
.leads-table col.c-src { width: 15%; }
.leads-table col.c-stage { width: 13%; }
.leads-table col.c-mgr { width: 11%; }
.leads-table col.c-date { width: 11%; }
.leads-table col.c-amount { width: 9%; }
.leads-table .who > div { min-width: 0; overflow: hidden; }
.leads-table .who-sub { display: block; }
.leads-table .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leads-table .src { display: flex; max-width: 100%; min-width: 0; }
.leads-table .src > span:last-child { min-width: 0; overflow: hidden; }
.leads-table .src > span:last-child > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leads-table .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1150px) {
  .leads-table col.c-client { width: 29%; } .leads-table col.c-phone { width: 14%; } .leads-table col.c-mgr { width: 6%; }
  .leads-table td.c-mgr .who > span { display: none; } .leads-table th.c-mgr { font-size: 0; }
}
/* Этапы над таблицей помещаются без прокрутки: переносятся во второй ряд, если не влезают */
.main.full .stage-strip { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); overflow: visible; }
.main.full .stage-card { padding: 11px 12px 10px; }
.main.full .stage-card .nm { white-space: normal; line-height: 1.25; min-height: 2.5em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.main.full .stage-card .ct { font-size: 21px; margin-top: 4px; }

.bk-list { display: grid; }
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.bk-row:first-child { border-top: 0; }

/* ---------- Коммерческое предложение ---------- */
.offer-modal { width: min(1020px, 100%); }
.of-grid { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.of-mine, .of-tpls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.of-old { display: inline-flex; gap: 8px; align-items: center; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.linkbtn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.of-chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.of-chip > button:first-child { border: 0; background: none; padding: 6px 4px 6px 12px; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; }
.of-chip:hover { border-color: var(--accent); }
.of-x { border: 0; background: none; color: var(--muted); padding: 6px 10px 6px 6px; cursor: pointer; font: inherit; font-weight: 800; }
.of-x.arm { color: #fff; background: var(--t-red, #ef4444); padding: 6px 10px; }
.of-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px) auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.of-search { position: relative; }
.of-results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; padding: 4px; }
.of-res { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 10px; cursor: pointer; color: var(--text); font: inherit; }
.of-res:hover, .of-res:focus-visible { background: var(--surface-2); }
.of-res img, .of-noimg { width: 38px; height: 38px; border-radius: 8px; object-fit: contain; background: #fff; flex: none; border: 1px solid var(--line); }
.of-res b { display: block; font-size: 13px; }
.of-cams { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.of-table-wrap { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; }
.of-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.of-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 8px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; z-index: 1; }
.of-table td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.of-table .num { text-align: right; white-space: nowrap; font-weight: 700; }
.of-img { width: 46px; }
.of-img img { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); display: block; }
.of-name { font-weight: 700; line-height: 1.3; }
.of-qbox { display: flex; align-items: center; gap: 6px; }
.of-qty { width: 76px; }
.of-price { width: 110px; }
.of-price.need { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.of-tot { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: var(--muted); padding-bottom: 4px; }
.of-tot b { font-size: 18px; color: var(--text); }
.of-cond { margin: 6px 0 10px; }
.of-cond summary { cursor: pointer; font-weight: 700; margin-bottom: 6px; }
.of-err { color: var(--t-red, #ef4444); font-weight: 700; min-height: 18px; }
.of-foot { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.of-tplsave { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.of-tplsave .input { flex: 1; }
.of-done { font: 800 26px var(--display); margin: 0 0 12px; }
@media (max-width: 760px) { .of-grid, .of-tools { grid-template-columns: 1fr; } .of-img { display: none; } }
