/* ==========================================================================
   CRM «Дома Ташкента» — дизайн-система
   Тёплая бумага, чернила, терракота. Playfair Display + Inter.
   ========================================================================== */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/inter-400-latin.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: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/inter-500-latin.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: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter-600-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/inter-600-latin.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: 'Playfair Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/playfair-display-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/playfair-display-400-latin.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: 'Playfair Display'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/playfair-display-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/playfair-display-500-latin.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: 'Playfair Display'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/playfair-display-600-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/playfair-display-600-latin.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; }

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

  --bg: #f3eee4;
  --bg-2: #ece4d6;
  --surface: #fffdf8;
  --surface-2: #f8f2e8;
  --surface-3: #f1e8da;
  --ink: #1a1510;
  --ink-2: #4c4438;
  --muted: #837767;
  --faint: #a49784;
  --line: #e0d5c3;
  --line-2: #cec0aa;
  --accent: #b24a2b;
  --accent-2: #8f3a20;
  --accent-soft: #f4dcd0;
  --green: #2f6b4f;
  --green-soft: #dfece2;
  --gold: #a87d27;
  --gold-soft: #f4e8ca;
  --blue: #3e5f88;
  --blue-soft: #e2e9f2;
  --purple: #6f5887;
  --purple-soft: #ece5f2;
  --red: #a33a32;
  --red-soft: #f5dedb;
  --side: #17130f;
  --side-2: #211b15;
  --side-text: #f7efe2;
  --side-muted: #a99a86;
  --shadow-xs: 0 1px 2px rgba(26, 21, 16, .05);
  --shadow-sm: 0 2px 6px rgba(26, 21, 16, .05), 0 16px 36px -30px rgba(26, 21, 16, .35);
  --shadow-md: 0 24px 60px -42px rgba(26, 21, 16, .45);
  --shadow-lg: 0 40px 100px -55px rgba(26, 21, 16, .55);
  --radius-xs: 8px;
  --radius-sm: 11px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --ease: cubic-bezier(.22, .7, .2, 1);
  --side-w: 264px;
  --top-h: 76px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 22px; height: 22px; }

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ================================ каркас ================================= */
.app-shell { min-height: 100vh; }
.app-main {
  margin-left: var(--side-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ---- сайдбар ---- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 80;
  width: var(--side-w);
  display: flex; flex-direction: column;
  padding: 26px 18px 20px;
  color: var(--side-text);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(178, 74, 43, .20), transparent 58%),
    radial-gradient(100% 50% at 100% 100%, rgba(201, 162, 39, .08), transparent 60%),
    var(--side);
  overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 24px; }
.side-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--accent); border: 1px solid rgba(247, 239, 226, .18);
  border-radius: 11px; background: rgba(255, 255, 255, .04);
}
.brand-mark svg { width: 26px; height: 26px; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.side-brand-name { font-family: var(--font-serif); font-size: 24px; letter-spacing: -.02em; }
.side-brand-sub { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--side-muted); margin-top: 3px; }
.side-close { display: none; background: none; border: 0; color: var(--side-muted); padding: 6px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font-size: 9.5px; font-weight: 600; letter-spacing: .19em; text-transform: uppercase;
  color: rgba(247, 239, 226, .38); padding: 14px 12px 7px;
}
.side-label--spaced { margin-top: 12px; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  height: 41px; padding: 0 12px; border-radius: 10px;
  color: rgba(247, 239, 226, .73); font-size: 13.5px; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.side-link .icon { opacity: .85; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.is-active {
  background: var(--side-text); color: var(--ink); font-weight: 600;
  box-shadow: 0 6px 20px -12px rgba(0, 0, 0, .7);
}
.side-link.is-active .icon { color: var(--accent); opacity: 1; }
.side-badge {
  margin-left: auto; min-width: 21px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
}
.side-link.is-active .side-badge { background: var(--accent); color: #fff; }
.side-badge--warn { background: rgba(178, 74, 43, .25); color: #f0b49f; }
.side-link.is-active .side-badge--warn { background: var(--accent-soft); color: var(--accent-2); }

.side-bottom { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.side-site-link {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border: 1px solid rgba(247, 239, 226, .13); border-radius: 12px;
  background: rgba(255, 255, 255, .03); transition: background .18s, border-color .18s;
}
.side-site-link:hover { background: rgba(255, 255, 255, .07); border-color: rgba(247, 239, 226, .25); }
.side-site-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(178, 74, 43, .18); color: #e8a58d; }
.side-site-link span:nth-child(2) { display: flex; flex-direction: column; line-height: 1.25; }
.side-site-link small { color: var(--side-muted); font-size: 10px; letter-spacing: .04em; }
.side-site-link strong { font-size: 12.5px; font-weight: 500; }
.side-site-arrow { margin-left: auto; width: 16px; height: 16px; color: var(--side-muted); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 6px 0; }
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-2); color: var(--ink); font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); letter-spacing: .02em;
}
.avatar--side { background: rgba(247, 239, 226, .12); border-color: rgba(247, 239, 226, .16); color: var(--side-text); }
.avatar--sm { width: 28px; height: 28px; font-size: 10px; }
.avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.side-user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user-text strong { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: var(--side-muted); font-size: 10.5px; }
.side-logout { background: none; border: 0; color: var(--side-muted); padding: 7px; border-radius: 8px; }
.side-logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-demo { font-size: 9.5px; color: rgba(247, 239, 226, .3); padding: 4px 6px 0; letter-spacing: .02em; }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(23, 19, 15, .5); z-index: 79; backdrop-filter: blur(2px); }

/* ---- верхняя панель ---- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 38px;
  background: rgba(243, 238, 228, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.topbar-left .topbar-menu { display: none; }
.global-search {
  position: relative; display: flex; align-items: center;
  width: min(440px, 100%);
}
.global-search .icon { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.global-search input {
  width: 100%; height: 40px; padding: 0 46px 0 40px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 13px;
  transition: border-color .18s, box-shadow .18s;
}
.global-search input::placeholder { color: var(--faint); }
.global-search input:focus { outline: none; border-color: var(--line-2); box-shadow: 0 0 0 3px rgba(178, 74, 43, .09); }
.global-search kbd {
  position: absolute; right: 12px; font-family: var(--font-sans);
  font-size: 10px; color: var(--faint); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; background: var(--surface-2);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: 11.5px; color: var(--muted); text-transform: capitalize; margin-right: 4px; }
.icon-btn {
  position: relative; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 50%;
  background: transparent; color: var(--ink-2);
  transition: background .18s, border-color .18s;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.bell { position: relative; }
.bell-dot {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 600; display: grid; place-items: center;
  padding: 0 4px; border: 2px solid var(--bg);
}
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: 360px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: drop .18s var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px 12px; border-bottom: 1px solid var(--line); }
.bell-head strong { font-size: 13px; }
.bell-head a { font-size: 11.5px; color: var(--accent); }
.bell-list { max-height: 330px; overflow-y: auto; }
.bell-item { display: flex; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.bell-item:hover { background: var(--surface-2); }
.bell-item-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.bell-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-item-body strong { font-size: 12px; font-weight: 500; line-height: 1.35; }
.bell-item-body small { font-size: 10.5px; color: var(--muted); }
.bell-empty { padding: 22px 18px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.bell-footer { display: flex; align-items: center; gap: 8px; padding: 12px 18px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); }
.bell-footer:hover { color: var(--accent); }
.bell-footer .icon { width: 15px; height: 15px; }

/* ---- контент ---- */
.app-content { flex: 1; padding: 32px 38px 70px; max-width: 1700px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head-main { min-width: 0; }
.page-head h1 {
  font-family: var(--font-serif); font-weight: 400; font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.08; letter-spacing: -.02em; margin-top: 7px;
}
.page-head h1 em { font-style: italic; color: var(--accent); }
.page-head .lede { margin-top: 9px; color: var(--muted); font-size: 13px; max-width: 640px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .19em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); }
.eyebrow--light { color: rgba(247, 239, 226, .8); }
.eyebrow--light::before { background: var(--accent); }
.eyebrow--plain::before { display: none; }

/* ================================ элементы =============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  font-size: 12.5px; font-weight: 500; letter-spacing: -.005em;
  white-space: nowrap; transition: background .18s var(--ease), color .18s, border-color .18s, transform .18s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-2); }
.btn-outline { border-color: var(--line-2); background: var(--surface); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-soft { background: var(--surface-2); color: var(--ink-2); }
.btn-soft:hover { background: var(--bg-2); color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { height: 35px; padding: 0 14px; font-size: 11.5px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; }
.btn-icon:hover { border-color: var(--line-2); background: var(--surface-2); color: var(--ink); }
.btn-icon .icon { width: 16px; height: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-xs);
}
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-title { font-family: var(--font-serif); font-size: 21px; font-weight: 400; letter-spacing: -.015em; }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.card-link { font-size: 11.5px; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.card-link .icon { width: 14px; height: 14px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 23px; padding: 0 9px; border-radius: 999px;
  font-size: 10px; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--won { background: var(--green-soft); color: var(--green); }
.badge--lost { background: var(--red-soft); color: var(--red); }
.badge--open { background: var(--gold-soft); color: var(--gold); }
.badge--accent { background: var(--accent-soft); color: var(--accent-2); }
.badge--muted { background: var(--surface-2); color: var(--muted); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 10px; color: var(--ink-2); background: var(--surface-2);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); font-size: 11.5px; color: var(--ink-2);
  transition: border-color .18s, background .18s;
}
.chip:hover { border-color: var(--line-2); background: var(--surface-2); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .count { font-size: 10px; opacity: .65; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; border: 2px solid var(--surface); }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .icon { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--line-2); }
.empty-state h3 { font-family: var(--font-serif); font-size: 22px; color: var(--ink); font-weight: 400; margin-bottom: 6px; }
.empty-state p { font-size: 12.5px; max-width: 420px; margin: 0 auto 18px; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---- поля ---- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.field .req { color: var(--accent); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  padding: 10px 13px; font-size: 13px; line-height: 1.45;
  transition: border-color .18s, box-shadow .18s;
}
.input, .select { height: 43px; }
.textarea { min-height: 92px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(178, 74, 43, .10); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23837767' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.input[type="color"] { padding: 3px; width: 52px; height: 38px; }
.input[type="datetime-local"], .input[type="date"] { padding-right: 8px; }
.field-help { font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.field-error { font-size: 10.5px; color: var(--red); font-weight: 500; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--red); }
.field--check { flex-direction: row; align-items: flex-start; gap: 10px; padding: 4px 0; cursor: pointer; }
.field--check .check-wrap { display: flex; padding-top: 1px; }
.field-check-text { font-size: 12.5px; color: var(--ink-2); text-transform: none; letter-spacing: 0; font-weight: 400; }
.field-check-text small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.check-input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { padding: 24px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-head { margin-bottom: 18px; }
.form-section-head h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 400; }
.form-section-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.form-actions { display: flex; align-items: center; gap: 10px; padding: 18px 24px; background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.errorlist { color: var(--red); font-size: 10.5px; margin: 0; padding: 0; list-style: none; }

/* ============================== уведомления ============================== */
.flash-stack { position: fixed; top: calc(var(--top-h) + 14px); right: 38px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); font-size: 12.5px;
  animation: drop .2s var(--ease);
}
.flash .icon { width: 17px; height: 17px; color: var(--green); }
.flash-error .icon { color: var(--red); }
.flash-warning .icon { color: var(--gold); }
.flash-close { margin-left: auto; background: none; border: 0; color: var(--faint); padding: 2px; }
.flash-close .icon { width: 13px; height: 13px; color: inherit; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 12px; opacity: 0; pointer-events: none; transition: .25s var(--ease); z-index: 150;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--red); color: #fff; }

/* ================================ дашборд =============================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi {
  position: relative; padding: 19px 20px 17px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.kpi::after { content: ""; position: absolute; right: -30px; top: -40px; width: 110px; height: 110px; border-radius: 50%; background: var(--surface-2); opacity: .8; }
.kpi--accent::after { background: var(--accent-soft); }
.kpi-label { position: relative; z-index: 1; font-size: 9.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kpi-label .icon { width: 14px; height: 14px; color: var(--accent); }
.kpi-value { position: relative; z-index: 1; font-family: var(--font-serif); font-size: 37px; line-height: 1.05; letter-spacing: -.03em; margin-top: 9px; display: flex; align-items: baseline; gap: 7px; }
.kpi-value small { font-family: var(--font-sans); font-size: 11px; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.kpi-meta { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--muted); margin-top: 8px; }
.kpi-meta .up { color: var(--green); font-weight: 600; }
.kpi-meta .down { color: var(--red); font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, 1fr); gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.funnel-card { padding: 24px; }
.funnel { display: flex; flex-direction: column; gap: 15px; margin-top: 6px; }
.funnel-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) 80px 92px; align-items: center; gap: 14px; }
.funnel-name { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.funnel-name .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.funnel-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-bar { height: 12px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 4px; min-width: 4px; transition: width .5s var(--ease); }
.funnel-count { font-size: 12px; font-weight: 600; text-align: right; }
.funnel-sum { font-size: 11px; color: var(--muted); text-align: right; }
.funnel-total { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.funnel-total strong { font-family: var(--font-serif); font-size: 22px; color: var(--ink); font-weight: 400; }

.chart-card { padding: 22px 24px; }
.chart { display: flex; align-items: flex-end; gap: 7px; height: 120px; margin-top: 18px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 22px; border-radius: 4px 4px 2px 2px; background: var(--line); transition: background .18s; position: relative; }
.chart-col:hover .chart-bar { background: var(--accent); }
.chart-col.today .chart-bar { background: var(--accent); }
.chart-label { font-size: 8.5px; color: var(--faint); white-space: nowrap; }
.chart-col.today .chart-label { color: var(--accent); font-weight: 600; }

.recent-table { width: 100%; border-collapse: collapse; }
.recent-table th { text-align: left; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 0 0 9px; border-bottom: 1px solid var(--line); }
.recent-table td { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.recent-table tr:last-child td { border-bottom: 0; }
.recent-table tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.lead-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lead-cell-text { min-width: 0; }
.lead-cell-text strong { display: block; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.lead-cell-text small { font-size: 10px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.source-pill { font-size: 10px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }

.tasks-mini { display: flex; flex-direction: column; }
.task-mini { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.task-mini:last-child { border-bottom: 0; }
.task-mini-check { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--surface); flex: 0 0 auto; margin-top: 2px; display: grid; place-items: center; color: transparent; }
.task-mini-check:hover { border-color: var(--green); color: var(--green); }
.task-mini-body { min-width: 0; flex: 1; }
.task-mini-body strong { display: block; font-size: 11.5px; font-weight: 500; line-height: 1.35; }
.task-mini-body small { display: flex; gap: 6px; color: var(--muted); font-size: 10px; margin-top: 3px; }
.task-mini.is-overdue .task-mini-body small { color: var(--red); }

.source-list { display: flex; flex-direction: column; gap: 13px; }
.source-row { display: grid; grid-template-columns: 88px 1fr 46px; align-items: center; gap: 10px; font-size: 11px; }
.source-row-name { display: flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-row-bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.source-row-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.source-row-count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: 0 0 auto; }
.activity-ico .icon { width: 14px; height: 14px; }
.activity-ico--stage { background: var(--accent-soft); color: var(--accent); }
.activity-ico--create { background: var(--green-soft); color: var(--green); }
.activity-ico--call { background: var(--blue-soft); color: var(--blue); }
.activity-body { min-width: 0; font-size: 11.5px; line-height: 1.45; }
.activity-body a { font-weight: 500; }
.activity-body time { display: block; font-size: 9.5px; color: var(--faint); margin-top: 2px; }

.attention-card { padding: 20px 22px; }
.attention-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.attention-title .icon { width: 15px; height: 15px; }
.attention-num { font-family: var(--font-serif); font-size: 30px; }
.attention-note { font-size: 10.5px; color: var(--muted); }

/* ================================= доска ================================= */
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.pipeline-tabs { display: flex; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.pipeline-tab { height: 31px; padding: 0 14px; border-radius: 999px; font-size: 11.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.pipeline-tab:hover { background: var(--surface-2); }
.pipeline-tab.is-active { background: var(--ink); color: var(--bg); }
.pipeline-tab .dot { width: 6px; height: 6px; border-radius: 50%; }

.board-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.board-filters .search-mini { position: relative; }
.board-filters .search-mini .icon { position: absolute; left: 11px; top: 10px; width: 14px; height: 14px; color: var(--muted); }
.board-filters .search-mini input { width: 220px; height: 34px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 0 12px 0 32px; font-size: 11.5px; }
.board-filters .search-mini input:focus { outline: none; border-color: var(--accent); }
.board-filters .select { height: 34px; font-size: 11.5px; border-radius: 999px; padding-left: 12px; width: auto; min-width: 120px; }
.board-filters .filter-count { font-size: 10.5px; color: var(--muted); margin-left: auto; }

.board-scroll { overflow-x: auto; margin: 0 -38px; padding: 0 38px 20px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 12px; align-items: start; min-height: 480px; }
.board-col { background: rgba(236, 228, 214, .55); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 300px; transition: background .15s, border-color .15s; }
.board-col.is-over { background: var(--accent-soft); border-color: var(--accent); }
.board-col-head { padding: 13px 14px 11px; border-bottom: 1px solid var(--line); }
.board-col-title { display: flex; align-items: center; gap: 7px; }
.board-col-title .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.board-col-title strong { font-size: 11.5px; font-weight: 600; }
.board-col-title .count { font-size: 10px; color: var(--muted); margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; height: 19px; display: grid; place-items: center; }
.board-col-add { color: var(--muted); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; }
.board-col-add:hover { background: var(--surface); color: var(--accent); }
.board-col-meta { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted); margin-top: 7px; }
.board-col-meta strong { font-weight: 500; color: var(--ink-2); }
.board-col-body { padding: 8px; display: flex; flex-direction: column; gap: 7px; min-height: 70px; flex: 1; }
.board-empty { padding: 22px 10px; text-align: center; font-size: 10.5px; color: var(--faint); }

.lead-card {
  position: relative; display: block; padding: 12px 12px 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(26, 21, 16, .03);
  cursor: grab; transition: box-shadow .16s, border-color .16s, transform .16s;
}
.lead-card:hover { box-shadow: var(--shadow-sm); border-color: var(--line-2); }
.lead-card.is-dragging { opacity: .45; cursor: grabbing; }
.lead-card.is-updating { opacity: .5; }
.lead-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.lead-card-source { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.lead-card-source .icon { width: 12px; height: 12px; }
.lead-card-priority { width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.lead-card-priority--high { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lead-card-title { font-size: 12.5px; font-weight: 500; line-height: 1.35; letter-spacing: -.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-card-client { font-size: 10.5px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.lead-card-client .icon { width: 11px; height: 11px; }
.lead-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.lead-card-amount { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lead-card-meta { display: flex; align-items: center; gap: 8px; }
.lead-card-meta .icon { width: 12px; height: 12px; color: var(--faint); }
.lead-card-due { font-size: 9.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.lead-card-due.is-overdue { color: var(--red); font-weight: 500; }
.lead-card-contacts { display: flex; gap: 3px; margin-top: 8px; flex-wrap: wrap; }
.channel-mini { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.channel-mini .icon { width: 11px; height: 11px; }
.channel-mini--telegram { background: var(--blue-soft); color: #3d7db1; }
.channel-mini--whatsapp { background: var(--green-soft); color: #2f8a54; }
.channel-mini--max { background: var(--purple-soft); color: var(--purple); }

/* ================================= лиды ================================== */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.toolbar .field { flex-direction: row; align-items: center; gap: 6px; }
.toolbar .field > label { display: none; }
.toolbar .input, .toolbar .select { height: 36px; font-size: 11.5px; border-radius: 9px; width: auto; }
.toolbar .search-field { position: relative; flex: 1; min-width: 220px; }
.toolbar .search-field .icon { position: absolute; left: 11px; top: 10px; width: 15px; height: 15px; color: var(--muted); }
.toolbar .search-field input { width: 100%; padding-left: 33px; }
.toolbar .spacer { flex: 1; }
.toolbar .btn { height: 36px; }

.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lead-table { width: 100%; border-collapse: collapse; }
.lead-table thead th { text-align: left; padding: 13px 16px; font-size: 9px; letter-spacing: .13em; text-transform: uppercase; color: var(--faint); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.lead-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.lead-table tbody tr:last-child td { border-bottom: 0; }
.lead-table tbody tr { transition: background .12s; }
.lead-table tbody tr:hover { background: var(--surface-2); }
.lead-table .lead-main { display: flex; align-items: center; gap: 11px; min-width: 230px; }
.lead-table .lead-main strong { display: block; font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.lead-table .lead-main small { display: flex; gap: 6px; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.lead-table .owner-cell { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-2); }
.lead-table .amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lead-table .stage-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 500; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.lead-table .stage-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.lead-table .next-cell { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.lead-table .next-cell.is-overdue { color: var(--red); font-weight: 500; }
.lead-table .row-link { color: var(--faint); }
.lead-table .row-link:hover { color: var(--accent); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.pagination { display: flex; gap: 4px; align-items: center; }
.pagination a, .pagination span { min-width: 28px; height: 28px; padding: 0 7px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: 11px; }
.pagination a:hover { border-color: var(--line-2); }
.pagination .is-current { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ============================ карточка лида ============================= */
.lead-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.lead-head-main { min-width: 0; flex: 1; }
.lead-back { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.lead-back:hover { color: var(--accent); }
.lead-title { font-family: var(--font-serif); font-size: clamp(26px, 3vw, 36px); font-weight: 400; line-height: 1.1; letter-spacing: -.02em; }
.lead-head-meta { display: flex; align-items: center; gap: 9px; margin-top: 10px; flex-wrap: wrap; }
.lead-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 18px; align-items: start; }
.lead-main-col, .lead-side-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lead-side-col { position: sticky; top: calc(var(--top-h) + 18px); }
.lead-card-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lead-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.lead-block-head h2 { font-size: 12px; font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 7px; }
.lead-block-head h2 .icon { width: 15px; height: 15px; color: var(--accent); }
.lead-block-head a { font-size: 10.5px; color: var(--accent); }
.lead-block-body { padding: 18px 20px; }
.lead-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 20px; }
.fact { min-width: 0; }
.fact-label { font-size: 9px; letter-spacing: .11em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.fact-value { font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.fact-value a:hover { color: var(--accent); }
.fact--wide { grid-column: 1 / -1; }
.lead-description { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); white-space: pre-line; }
.lead-amount-big { font-family: var(--font-serif); font-size: 32px; line-height: 1; letter-spacing: -.02em; }
.lead-amount-sub { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.contact-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.contact-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 10.5px; color: var(--ink-2); }
.contact-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.contact-btn .icon { width: 13px; height: 13px; }

.stage-track { display: flex; gap: 3px; padding: 4px; background: var(--surface-2); border-radius: 10px; overflow-x: auto; }
.stage-track-item { flex: 1; min-width: 86px; padding: 7px 8px 8px; border-radius: 7px; font-size: 9.5px; color: var(--muted); text-align: center; white-space: nowrap; position: relative; }
.stage-track-item .bar { height: 3px; border-radius: 2px; background: var(--line); margin-bottom: 5px; }
.stage-track-item.is-done .bar { background: var(--green); }
.stage-track-item.is-current { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-xs); }
.stage-track-item.is-current .bar { background: var(--accent); }
.stage-track-item.is-lost .bar { background: var(--red); }
.stage-control { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.stage-control .select { height: 38px; font-size: 12px; flex: 1; min-width: 160px; }
.stage-control .btn { height: 38px; }
.lost-reason { flex-basis: 100%; }

.timeline { padding: 4px 20px 20px; }
.timeline-item { position: relative; display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: 0 0 auto; }
.timeline-ico .icon { width: 14px; height: 14px; }
.timeline-ico--stage { background: var(--accent-soft); color: var(--accent); }
.timeline-ico--note { background: var(--gold-soft); color: var(--gold); }
.timeline-ico--call { background: var(--blue-soft); color: var(--blue); }
.timeline-ico--task { background: var(--purple-soft); color: var(--purple); }
.timeline-ico--create { background: var(--green-soft); color: var(--green); }
.timeline-body { min-width: 0; flex: 1; }
.timeline-text { font-size: 12px; line-height: 1.55; color: var(--ink-2); white-space: pre-line; }
.timeline-meta { display: flex; gap: 8px; font-size: 9.5px; color: var(--faint); margin-top: 4px; flex-wrap: wrap; }
.timeline-meta strong { color: var(--muted); font-weight: 500; }
.timeline-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); }
.timeline-form { padding: 18px 20px; }
.timeline-form + .timeline-form { border-left: 1px solid var(--line); }
.timeline-form h3 { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.timeline-form h3 .icon { width: 14px; height: 14px; color: var(--accent); }
.timeline-form .textarea { min-height: 64px; font-size: 12px; }
.timeline-form .btn { margin-top: 9px; }
.inline-select { display: flex; gap: 7px; }
.inline-select .select { height: 38px; font-size: 12px; }

.tasks-list { padding: 4px 20px 16px; }
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--surface); flex: 0 0 auto; margin-top: 1px; display: grid; place-items: center; color: transparent; }
.task-check:hover { border-color: var(--green); color: var(--green); }
.task-row.is-done .task-check { background: var(--green); border-color: var(--green); color: #fff; }
.task-row.is-done .task-body strong { text-decoration: line-through; color: var(--muted); }
.task-body { flex: 1; min-width: 0; }
.task-body strong { display: block; font-size: 11.5px; font-weight: 500; line-height: 1.4; }
.task-body small { display: flex; gap: 7px; font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.task-body small .is-overdue { color: var(--red); font-weight: 500; }
.task-add-form { padding: 13px 20px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.task-add-form .task-line { display: flex; gap: 7px; }
.task-add-form .input { height: 38px; font-size: 12px; }
.task-add-form .btn { height: 38px; }
.task-add-more { display: flex; gap: 7px; margin-top: 7px; }
.task-add-more .input { height: 34px; font-size: 11px; }

.chat-preview { display: flex; flex-direction: column; gap: 9px; padding: 16px 20px; }
.chat-preview-empty { padding: 22px 20px; font-size: 11.5px; color: var(--muted); }
.bubble-row { display: flex; gap: 7px; align-items: flex-end; }
.bubble-row--out { flex-direction: row-reverse; }
.bubble { max-width: 78%; padding: 8px 11px; border-radius: 11px; background: var(--surface-2); font-size: 11.5px; line-height: 1.45; white-space: pre-line; }
.bubble-row--out .bubble { background: var(--ink); color: var(--bg); }
.bubble-time { font-size: 8.5px; color: var(--faint); margin-bottom: 2px; }
.chat-open { display: flex; gap: 7px; padding: 0 20px 18px; flex-wrap: wrap; }

.side-facts { padding: 4px 20px 14px; }
.side-fact { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.side-fact:last-child { border-bottom: 0; }
.side-fact-label { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.side-fact-label .icon { width: 14px; height: 14px; }
.side-fact-value { text-align: right; font-weight: 500; }
.danger-zone { padding: 14px 20px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.danger-zone p { font-size: 10px; color: var(--muted); }

/* ================================ входящие ============================== */
.inbox-shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - var(--top-h) - 190px); min-height: 500px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.inbox-list-head { padding: 14px 14px 11px; border-bottom: 1px solid var(--line); }
.inbox-list-head h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 400; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.inbox-list-head h2 span { font-family: var(--font-sans); font-size: 10px; color: var(--muted); }
.inbox-search { position: relative; }
.inbox-search .icon { position: absolute; left: 10px; top: 9px; width: 14px; height: 14px; color: var(--muted); }
.inbox-search input { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 0 10px 0 31px; font-size: 11px; }
.inbox-search input:focus { outline: none; border-color: var(--accent); }
.inbox-tabs { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.inbox-tab { font-size: 10px; padding: 5px 9px; border-radius: 999px; border: 1px solid transparent; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.inbox-tab:hover { background: var(--surface-2); }
.inbox-tab.is-active { background: var(--ink); color: var(--bg); }
.inbox-items { overflow-y: auto; flex: 1; }
.dialog-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
.dialog-item:hover { background: var(--surface-2); }
.dialog-item.is-active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.dialog-ava { position: relative; }
.dialog-ava .channel-badge { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--surface); }
.dialog-ava .channel-badge .icon { width: 9px; height: 9px; }
.channel-badge--telegram { background: #3d7db1; color: #fff; }
.channel-badge--whatsapp { background: #2f8a54; color: #fff; }
.channel-badge--max { background: var(--purple); color: #fff; }
.dialog-body { min-width: 0; flex: 1; }
.dialog-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.dialog-top strong { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-top time { font-size: 8.5px; color: var(--faint); flex: 0 0 auto; }
.dialog-sub { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.dialog-last { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.dialog-item.has-unread .dialog-last { color: var(--ink-2); font-weight: 500; }
.dialog-unread { position: absolute; right: 14px; bottom: 12px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 8.5px; display: grid; place-items: center; }
.inbox-empty { padding: 40px 20px; font-size: 11.5px; color: var(--muted); text-align: center; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 11px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head-body { min-width: 0; flex: 1; }
.chat-head-body strong { font-size: 13px; font-weight: 600; display: block; }
.chat-head-body small { font-size: 10px; color: var(--muted); }
.chat-head-actions { display: flex; align-items: center; gap: 6px; }
.chat-stage { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.chat-stage .dot { width: 5px; height: 5px; border-radius: 50%; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.chat-day { align-self: center; font-size: 9px; color: var(--faint); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin: 4px 0; }
.chat-msg { display: flex; gap: 7px; align-items: flex-end; width: fit-content; max-width: 78%; flex: 0 0 auto; }
.chat-msg--out { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-ava { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 8px; color: var(--muted); flex: 0 0 auto; }
.chat-bubble { max-width: 100%; padding: 9px 12px; border-radius: 13px 13px 13px 4px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; line-height: 1.5; white-space: pre-line; word-break: break-word; }
.chat-msg--out .chat-bubble { background: var(--ink); border-color: var(--ink); color: var(--bg); border-radius: 13px 13px 4px 13px; }
.chat-bubble-meta { display: flex; gap: 5px; justify-content: flex-end; font-size: 8px; color: var(--faint); margin-top: 3px; }
.chat-msg--out .chat-bubble-meta { color: rgba(251, 246, 238, .55); }
.chat-msg--out .chat-bubble-meta .is-error { color: #f0a59a; }
.chat-composer { border-top: 1px solid var(--line); padding: 10px 16px; background: var(--surface); }
.chat-composer textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 9px 11px; font-size: 12px; resize: none; min-height: 42px; max-height: 130px; }
.chat-composer textarea:focus { outline: none; border-color: var(--accent); }
.chat-composer-row { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.chat-composer-row .small { margin-right: auto; font-size: 9.5px; color: var(--faint); }
.chat-simulate { background: none; border: 0; color: var(--muted); font-size: 9.5px; display: inline-flex; align-items: center; gap: 4px; }
.chat-simulate:hover { color: var(--accent); }
.chat-side { display: none; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; padding: 40px; }
.chat-empty .icon { width: 32px; height: 32px; color: var(--line-2); }
.chat-empty h3 { font-family: var(--font-serif); font-size: 22px; color: var(--ink); font-weight: 400; }
.chat-empty p { font-size: 11.5px; max-width: 320px; }

/* ============================== воронки ================================= */
.pipeline-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pipeline-card { padding: 22px; position: relative; }
.pipeline-card.is-archived { opacity: .62; }
.pipeline-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.pipeline-card h2 { font-family: var(--font-serif); font-size: 24px; font-weight: 400; letter-spacing: -.015em; display: flex; align-items: center; gap: 9px; }
.pipeline-card h2 .dot { width: 9px; height: 9px; border-radius: 50%; }
.pipeline-card p { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.pipeline-stats { display: flex; gap: 22px; margin-top: 18px; }
.pipeline-stat strong { font-family: var(--font-serif); font-size: 24px; font-weight: 400; display: block; line-height: 1; }
.pipeline-stat span { font-size: 9px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.pipeline-flow { display: flex; gap: 4px; margin-top: 18px; }
.pipeline-flow span { height: 5px; border-radius: 3px; flex: 1; min-width: 10px; }
.pipeline-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.pipeline-card-foot .actions { display: flex; gap: 7px; align-items: center; }
.pipeline-card-foot a { color: var(--accent); }

.formset-table { width: 100%; border-collapse: collapse; }
.formset-table th { font-size: 9px; letter-spacing: .11em; text-transform: uppercase; color: var(--faint); text-align: left; padding: 0 8px 8px; font-weight: 600; }
.formset-table td { padding: 7px 8px; vertical-align: top; border-top: 1px solid var(--line); }
.formset-table .input, .formset-table .select { height: 38px; font-size: 12px; }
.formset-table .delete-cell { text-align: center; width: 44px; }
.formset-delete { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; font-size: 8px; color: var(--muted); cursor: pointer; }
.formset-delete input { accent-color: var(--red); }
.stage-row-hidden { display: none; }
.formset-empty { display: none; }
.stage-swatch { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); display: block; }

/* ============================== источники ============================== */
.integration-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.integration-card { padding: 20px; display: flex; flex-direction: column; min-height: 188px; position: relative; overflow: hidden; }
.integration-card::after { content: ""; position: absolute; right: -38px; top: -38px; width: 120px; height: 120px; border-radius: 50%; background: var(--surface-2); }
.integration-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); margin-bottom: 14px; position: relative; z-index: 1; }
.integration-ico .icon { width: 21px; height: 21px; }
.integration-ico--yandex { background: var(--red-soft); color: #a33a32; }
.integration-ico--sheets { background: var(--green-soft); color: var(--green); }
.integration-ico--quiz { background: var(--gold-soft); color: var(--gold); }
.integration-ico--api { background: var(--blue-soft); color: var(--blue); }
.integration-card h3 { font-size: 13px; font-weight: 600; position: relative; z-index: 1; }
.integration-card p { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 5px; flex: 1; position: relative; z-index: 1; }
.integration-card .integration-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; position: relative; z-index: 1; }
.integration-card .integration-status { font-size: 9px; display: inline-flex; align-items: center; gap: 5px; color: var(--green); }
.integration-card .integration-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.integration-card .integration-status--muted { color: var(--muted); }
.integration-card a.integration-link { font-size: 10.5px; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }

.source-table .source-name { display: flex; align-items: center; gap: 9px; }
.source-kind-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.source-kind-ico .icon { width: 15px; height: 15px; }
.source-table .source-name strong { display: block; font-size: 12px; font-weight: 500; }
.source-table .source-name small { font-size: 9.5px; color: var(--muted); }
.endpoint-box { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px dashed var(--line-2); border-radius: 9px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; color: var(--ink-2); overflow: hidden; }
.endpoint-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-box .copy-btn { flex: 0 0 auto; border: 0; background: var(--surface); border-radius: 6px; padding: 5px 7px; color: var(--muted); display: grid; place-items: center; }
.endpoint-box .copy-btn:hover { color: var(--accent); }
.endpoint-box .copy-btn .icon { width: 13px; height: 13px; }
.code-block { background: var(--side); color: #d9cfc0; border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.code-block .c { color: #8f8373; }
.help-steps { display: flex; flex-direction: column; gap: 12px; counter-reset: step; }
.help-step { display: flex; gap: 11px; font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.help-step::before { counter-increment: step; content: counter(step); width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 9px; color: var(--muted); flex: 0 0 auto; margin-top: 1px; }
.help-step strong { font-weight: 600; }
.source-detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.sheet-preview { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.sheet-preview table { width: 100%; border-collapse: collapse; font-size: 10.5px; white-space: nowrap; }
.sheet-preview th { text-align: left; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 8.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sheet-preview td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.sheet-preview tr:last-child td { border-bottom: 0; }
.event-log { display: flex; flex-direction: column; }
.event-item { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 10.5px; }
.event-item:last-child { border-bottom: 0; }
.event-item .icon { width: 13px; height: 13px; color: var(--muted); margin-top: 2px; }
.event-item time { font-size: 8.5px; color: var(--faint); display: block; }

/* ============================== мессенджеры ============================ */
.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.channel-card { overflow: hidden; }
.channel-card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.channel-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.channel-logo--telegram { background: #3d7db1; }
.channel-logo--whatsapp { background: #2f8a54; }
.channel-logo--max { background: var(--purple); }
.channel-logo .icon { width: 22px; height: 22px; }
.channel-card-head h2 { font-size: 13px; font-weight: 600; }
.channel-card-head small { font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.channel-status { display: inline-flex; align-items: center; gap: 4px; }
.channel-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.channel-status--on { color: var(--green); }
.channel-status--on .dot { background: var(--green); }
.channel-card-body { padding: 17px 20px; }
.channel-card-body .field + .field { margin-top: 11px; }
.channel-card-body .input { height: 38px; font-size: 11.5px; }
.channel-webhook { margin-top: 13px; }
.channel-webhook label { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 600; display: block; margin-bottom: 5px; }
.channel-webhook .endpoint-box { font-size: 9px; }
.channel-card-foot { display: flex; align-items: center; gap: 6px; padding: 13px 20px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }
.channel-card-foot .btn { height: 32px; padding: 0 11px; font-size: 10.5px; }
.channel-note { font-size: 10px; color: var(--muted); padding: 0 20px 16px; line-height: 1.5; }

/* ================================ квизы =============================== */
.form-card-list { display: flex; flex-direction: column; gap: 10px; }
.form-list-item { display: flex; align-items: center; gap: 14px; padding: 15px 18px; }
.form-list-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; flex: 0 0 auto; }
.form-list-body { flex: 1; min-width: 0; }
.form-list-body strong { font-size: 12.5px; font-weight: 500; display: block; }
.form-list-body small { font-size: 10px; color: var(--muted); display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.form-list-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.form-list-actions .btn { height: 32px; padding: 0 11px; font-size: 10.5px; }
.empty-hint { padding: 22px; border: 1px dashed var(--line-2); border-radius: var(--radius); text-align: center; font-size: 11.5px; color: var(--muted); }

.formset-row { display: grid; grid-template-columns: 1.4fr .8fr 1fr .6fr 50px; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); align-items: start; }
.formset-row .field { gap: 4px; }
.formset-row .field > label { font-size: 8.5px; }
.formset-row .input, .formset-row .select { height: 36px; font-size: 11px; }
.formset-row .textarea { min-height: 60px; font-size: 11px; }
.formset-row .delete-row { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 8px; color: var(--muted); padding-top: 16px; }
.capture-builder-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 0 4px; flex-wrap: wrap; }
.embed-box { margin-top: 10px; }
.embed-box .code-block { font-size: 9.5px; }

/* ============================= уведомления ============================= */
.notif-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.notif-list { display: flex; flex-direction: column; }
.notif-item { display: flex; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.is-unread { background: color-mix(in srgb, var(--accent-soft) 27%, var(--surface)); }
.notif-ico { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.notif-ico--telegram { background: var(--blue-soft); color: #3d7db1; }
.notif-ico--email { background: var(--gold-soft); color: var(--gold); }
.notif-ico--webhook { background: var(--purple-soft); color: var(--purple); }
.notif-ico--app { background: var(--accent-soft); color: var(--accent); }
.notif-body { flex: 1; min-width: 0; }
.notif-body h3 { font-size: 12px; font-weight: 500; line-height: 1.4; }
.notif-body h3 a:hover { color: var(--accent); }
.notif-body p { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.notif-meta { display: flex; gap: 8px; align-items: center; font-size: 9px; color: var(--faint); margin-top: 5px; flex-wrap: wrap; }
.notif-actions { display: flex; gap: 4px; align-items: flex-start; }
.notif-actions button { background: none; border: 0; color: var(--faint); padding: 3px; border-radius: 5px; }
.notif-actions button:hover { color: var(--accent); }
.read-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: 0 0 auto; }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table th { text-align: left; padding: 11px 16px; font-size: 8.5px; text-transform: uppercase; letter-spacing: .11em; color: var(--faint); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.rules-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.rules-table tr:last-child td { border-bottom: 0; }
.rules-table .rule-name { min-width: 190px; }
.rules-table .rule-name strong { font-size: 11.5px; font-weight: 500; display: block; }
.rules-table .rule-name small { font-size: 9.5px; color: var(--muted); }
.rules-table .rule-actions { display: flex; gap: 4px; justify-content: flex-end; }
.rules-table .rule-actions form { display: inline; }
.channel-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; padding: 3px 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); }
.template-hint { font-size: 10px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.placeholders { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.placeholders code { font-size: 9px; padding: 2px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

/* ================================ задачи =============================== */
.tasks-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.task-group { margin-bottom: 18px; }
.task-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.task-group-head h2 { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.task-group-head .count { font-size: 9px; background: var(--surface-3); border-radius: 999px; padding: 1px 7px; color: var(--muted); }
.task-group-head .count--alert { background: var(--red-soft); color: var(--red); }
.task-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.task-list-row { display: flex; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.task-list-row:last-child { border-bottom: 0; }
.task-list-row:hover { background: var(--surface-2); }
.task-list-main { flex: 1; min-width: 0; }
.task-list-main strong { font-size: 12px; font-weight: 500; display: block; }
.task-list-main small { font-size: 10px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.task-list-main small a { color: var(--accent); }
.task-list-row.is-overdue .task-list-main strong { color: var(--red); }

/* ================================ вход ================================= */
.auth-body { background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(480px, .85fr); }
.auth-visual { position: relative; overflow: hidden; color: #f7efe2; display: flex; flex-direction: column; padding: 34px 44px 30px; }
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-visual-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15, 12, 9, .62) 0%, rgba(15, 12, 9, .38) 40%, rgba(15, 12, 9, .82) 100%); }
.auth-visual-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand .brand-mark { border-color: rgba(247, 239, 226, .3); }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand-text strong { font-family: var(--font-serif); font-size: 22px; font-weight: 400; }
.auth-brand-text small { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: rgba(247, 239, 226, .65); }
.auth-site-link { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(247, 239, 226, .8); border-bottom: 1px solid rgba(247, 239, 226, .3); padding-bottom: 2px; }
.auth-site-link .icon { width: 13px; height: 13px; }
.auth-visual-copy { position: relative; z-index: 1; margin: auto 0; max-width: 580px; padding: 70px 0 40px; }
.auth-visual-copy h1 { font-family: var(--font-serif); font-size: clamp(42px, 4.5vw, 66px); font-weight: 400; line-height: 1.02; letter-spacing: -.03em; margin-top: 20px; }
.auth-visual-copy h1 em { font-style: italic; color: #e8a78f; }
.auth-visual-lead { font-size: 13px; line-height: 1.65; color: rgba(247, 239, 226, .72); max-width: 420px; margin-top: 22px; }
.auth-proof { position: relative; z-index: 1; display: flex; gap: 40px; border-top: 1px solid rgba(247, 239, 226, .22); padding-top: 20px; }
.auth-proof strong { display: block; font-family: var(--font-serif); font-size: 28px; font-weight: 400; line-height: 1; }
.auth-proof span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: rgba(247, 239, 226, .55); }
.auth-panel { background: var(--surface); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; position: relative; }
.auth-box { width: min(390px, 100%); }
.auth-box h2 { font-family: var(--font-serif); font-size: 38px; font-weight: 400; letter-spacing: -.02em; margin-top: 8px; }
.auth-sub { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.55; }
.auth-form { margin-top: 26px; display: flex; flex-direction: column; gap: 15px; }
.auth-form .input { height: 47px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 44px; }
.password-toggle { position: absolute; right: 5px; top: 5px; width: 37px; height: 37px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; border-radius: 8px; }
.password-toggle:hover { background: var(--surface-2); color: var(--ink); }
.auth-submit { margin-top: 4px; height: 47px; }
.auth-error { margin-top: 16px; padding: 10px 12px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 11.5px; }
.demo-access { margin-top: 22px; padding: 13px 15px; border: 1px dashed var(--line-2); border-radius: 11px; background: var(--surface-2); }
.demo-access-head { display: flex; align-items: center; gap: 6px; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; margin-bottom: 7px; }
.demo-access-head .icon { width: 13px; height: 13px; }
.demo-access p { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 2px 0; }
.demo-access code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.auth-note { font-size: 10px; color: var(--faint); line-height: 1.55; margin-top: 16px; }
.auth-note a { color: var(--accent); }
.auth-footer { position: absolute; bottom: 26px; font-size: 9.5px; color: var(--faint); }

/* ============================== публичная форма ======================== */
.form-body { background: var(--bg); min-height: 100vh; }
.form-page { min-height: 100vh; display: flex; flex-direction: column; }
.form-topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px clamp(20px, 5vw, 56px); }
.form-brand { display: flex; align-items: center; gap: 10px; }
.form-brand .brand-mark { width: 36px; height: 36px; color: var(--accent); border-color: var(--line); }
.form-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.form-brand-text strong { font-family: var(--font-serif); font-size: 21px; font-weight: 400; }
.form-brand-text small { font-size: 8.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.form-topbar-link { font-size: 10.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.form-topbar-link:hover { color: var(--accent); }
.form-topbar-link .icon { width: 13px; height: 13px; }
.form-shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); max-width: 1180px; width: 100%; margin: 0 auto; padding: 20px clamp(20px, 5vw, 56px) 60px; gap: clamp(28px, 5vw, 64px); align-items: center; }
.form-aside { align-self: stretch; min-height: 480px; border-radius: var(--radius-lg); overflow: hidden; position: relative; background: var(--ink); color: #f7efe2; }
.form-aside img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .58; }
.form-aside::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 16, 12, .2), rgba(20, 16, 12, .82)); }
.form-aside-content { position: relative; z-index: 1; padding: 36px; display: flex; flex-direction: column; height: 100%; justify-content: flex-end; }
.form-aside-content h2 { font-family: var(--font-serif); font-size: clamp(30px, 3.4vw, 44px); font-weight: 400; line-height: 1.05; letter-spacing: -.02em; margin-top: 16px; }
.form-aside-content h2 em { font-style: italic; color: #e8a78f; }
.form-aside-content p { font-size: 12px; line-height: 1.6; color: rgba(247, 239, 226, .72); margin-top: 14px; max-width: 360px; }
.form-aside-bullets { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.form-aside-bullets span { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(247, 239, 226, .8); }
.form-aside-bullets .icon { width: 14px; height: 14px; color: #e8a78f; }
.form-main { max-width: 480px; width: 100%; justify-self: center; }
.form-main .eyebrow { margin-bottom: 12px; }
.form-main h1 { font-family: var(--font-serif); font-size: clamp(30px, 3.5vw, 42px); font-weight: 400; line-height: 1.09; letter-spacing: -.02em; }
.form-main .form-sub { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 10px; }
.public-form { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.public-form .field > label { font-size: 10px; }
.public-form .input, .public-form .select { height: 46px; background: var(--surface); }
.public-form .textarea { min-height: 84px; background: var(--surface); }
.public-form .btn { height: 48px; margin-top: 4px; }
.public-form-note { font-size: 9.5px; color: var(--faint); line-height: 1.55; margin-top: 2px; }
.form-success { text-align: center; padding: 30px 10px; }
.form-success .success-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 0 auto 18px; }
.form-success .success-ico .icon { width: 30px; height: 30px; }
.form-success h1 { font-size: clamp(30px, 3.4vw, 42px); }
.form-success p { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 10px; }
.form-success .btn { margin-top: 22px; }
.form-closed { max-width: 520px; margin: 12vh auto; text-align: center; padding: 30px; }
.form-closed h1 { font-family: var(--font-serif); font-size: 38px; font-weight: 400; }
.form-closed p { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.form-footer { text-align: center; padding: 18px; font-size: 9.5px; color: var(--faint); }
.form-footer a { color: var(--muted); }

.choice-list { display: flex; flex-direction: column; gap: 7px; }
.choice-item { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 12px; transition: border-color .15s, background .15s; }
.choice-item:hover { border-color: var(--line-2); }
.choice-item input { accent-color: var(--accent); width: 15px; height: 15px; }
.choice-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.honeypot { position: absolute !important; left: -9999px !important; opacity: 0; height: 0; width: 0; overflow: hidden; }

/* =============================== адаптив =============================== */
@media (max-width: 1320px) {
  :root { --side-w: 236px; }
  .app-content, .topbar { padding-left: 28px; padding-right: 28px; }
  .board-scroll { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel-row { grid-template-columns: 140px minmax(0, 1fr) 60px 80px; }
}

@media (max-width: 1120px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .lead-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .pipeline-grid { grid-template-columns: 1fr; }
  .source-detail-grid { grid-template-columns: 1fr; }
  .notif-layout { grid-template-columns: 1fr; }
  .tasks-page-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; }
  .form-shell { grid-template-columns: 1fr; }
  .form-aside { min-height: 260px; order: 2; }
  .form-aside-content { padding: 24px; }
  .form-main { order: 1; max-width: 560px; }
}

@media (max-width: 960px) {
  :root { --top-h: 68px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); width: 280px; }
  .sidebar.is-open { transform: none; }
  .side-close { display: block; }
  .app-main { margin-left: 0; }
  .topbar-left .topbar-menu { display: grid; }
  .topbar { padding: 0 20px; gap: 12px; }
  .app-content { padding: 24px 20px 60px; }
  .board-scroll { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
  .topbar-date { display: none; }
  .lead-layout { grid-template-columns: 1fr; }
  .lead-side-col { position: static; }
  .inbox-shell { grid-template-columns: 290px minmax(0, 1fr); height: calc(100vh - var(--top-h) - 170px); }
  .flash-stack { right: 20px; left: 20px; max-width: none; }
  .formset-row { grid-template-columns: 1fr 1fr; }
  .formset-row .delete-row { padding-top: 0; }
  .timeline-forms { grid-template-columns: 1fr; }
  .timeline-form + .timeline-form { border-left: 0; border-top: 1px solid var(--line); }
  .channel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar-create span { display: none; }
  .topbar-create { width: 40px; padding: 0; border-radius: 50%; }
  .global-search { width: 100%; }
  .global-search kbd { display: none; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 32px; }
  .page-actions { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 15px; }
  .kpi-value { font-size: 29px; }
  .funnel-row { grid-template-columns: 120px minmax(0, 1fr) 44px; }
  .funnel-sum { display: none; }
  .lead-table thead { display: none; }
  .lead-table, .lead-table tbody, .lead-table tr, .lead-table td { display: block; width: 100%; }
  .lead-table tr { padding: 13px 15px; border-bottom: 1px solid var(--line); position: relative; }
  .lead-table tbody td { padding: 0; border: 0; }
  .lead-table tbody td + td { margin-top: 7px; }
  .lead-table .lead-main { min-width: 0; padding-right: 38px; }
  .lead-table .amount { font-size: 14px; }
  .lead-table .row-link { position: absolute; right: 14px; top: 15px; }
  .toolbar { gap: 7px; }
  .toolbar .search-field { flex-basis: 100%; }
  .board { grid-auto-columns: 86vw; }
  .inbox-shell { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .inbox-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 44vh; }
  .chat { min-height: 55vh; }
  .chat-body { min-height: 300px; }
  .integration-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .lead-facts { grid-template-columns: 1fr; }
  .auth-panel { padding: 28px 22px; }
  .auth-box h2 { font-size: 32px; }
  .auth-footer { position: static; margin-top: 28px; }
  .form-topbar { padding: 16px 20px; }
  .form-shell { padding: 10px 20px 40px; gap: 22px; }
  .form-aside { display: none; }
  .form-main { max-width: none; }
  .pipeline-tabs { width: 100%; overflow-x: auto; }
  .pipeline-tab { white-space: nowrap; }
  .board-filters .filter-count { display: none; }
  .notif-item { padding: 13px 15px; }
  .notif-actions { flex-direction: column; }
  .rules-table thead { display: none; }
  .rules-table, .rules-table tbody, .rules-table tr, .rules-table td { display: block; width: 100%; }
  .rules-table tr { padding: 13px 15px; border-bottom: 1px solid var(--line); }
  .rules-table td { padding: 3px 0; border: 0; }
  .rules-table .rule-actions { justify-content: flex-start; margin-top: 7px; }
  .stage-track-item { min-width: 78px; }
}

@media (max-width: 520px) {
  .app-content { padding: 20px 15px 56px; }
  .topbar { padding: 0 15px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 32px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 29px; }
  .page-actions .btn { flex: 1; }
  .lead-head-actions { width: 100%; }
  .lead-head-actions .btn { flex: 1; }
  .card-pad, .funnel-card, .chart-card { padding: 17px; }
  .lead-block-body { padding: 15px; }
  .timeline { padding: 4px 15px 15px; }
  .timeline-form { padding: 15px; }
  .chat-body { padding: 14px; }
  .chat-msg { max-width: 92%; }
  .form-actions { padding: 14px 15px; }
  .form-section { padding: 18px 15px; }
  .formset-row { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 105px minmax(0, 1fr) 38px; gap: 9px; }
  .funnel-name { font-size: 10.5px; }
  .chart-label { font-size: 7px; }
  .lead-title { font-size: 27px; }
  .auth-panel { padding: 24px 18px; }
}

/* ---- дополнения: формы лида, выбор воронки, мелочи ---- */
.pipeline-picker .select { height: 35px; font-size: 11.5px; border-radius: 999px; padding-left: 12px; min-width: 150px; background-color: var(--surface); }
.lead-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.lead-form-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lead-form-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--top-h) + 18px); }
.field-label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.channel-card .field--check { padding: 2px 0; }
.channel-card details summary { list-style: none; }
.channel-card details summary::-webkit-details-marker { display: none; }
.channel-card details summary::before { content: "＋ "; color: var(--accent); }
.channel-card details[open] summary::before { content: "− "; }
.channel-card .help-step { font-size: 10.5px; }
.channel-card .help-step::before { width: 18px; height: 18px; font-size: 8px; }
.channel-card .channel-card-body .field > label { font-size: 9px; }
.channel-card .endpoint-box { font-size: 8.5px; }
.form-list-item { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.pipeline-card .pipeline-flow span { min-width: 14px; }
.rules-table .rule-actions { flex-wrap: nowrap; }
.rules-table .rule-actions form { display: inline; }
.rules-table .btn-ghost { color: var(--muted); }
.notif-layout .chips { margin-bottom: 2px; }
.formset-row .delete-row input { accent-color: var(--red); }
.formset-row .field--check { grid-column: span 1 !important; }
.formset-row .field--check .field-check-text { font-size: 10px; }
.lead-form-side .help-step { font-size: 11.5px; }
.mt-4 { margin-top: 32px; }
.timeline-form .select { height: 36px; font-size: 11.5px; }
.form-main .form-sub { max-width: 440px; }
.chat-composer textarea { background: var(--surface-2); }
.chat-composer textarea:focus { background: var(--surface); }
.chat-msg .chat-msg-ava { display: none; }
.chat-msg--in .chat-msg-ava { display: grid; }

@media (max-width: 1120px) {
  .lead-form-layout { grid-template-columns: minmax(0, 1fr); }
  .lead-form-side { position: static; }
}
@media (max-width: 720px) {
  .formset-row { grid-template-columns: 1fr 1fr; }
  .formset-row .field[style*="grid-column"] { grid-column: auto !important; }
  .formset-row .field--check { grid-column: auto !important; }
  .lead-form-side { gap: 12px; }
}

.chat-back-mobile { display: none; }
@media (max-width: 760px) {
  .inbox-shell { display: block; height: auto; min-height: 0; }
  .inbox-list { max-height: none; border-right: 0; }
  .inbox-shell:not(.has-dialog) .chat { display: none; }
  .inbox-shell.has-dialog .inbox-list { display: none; }
  .inbox-shell.has-dialog .chat { display: flex; height: calc(100dvh - 260px); min-height: 440px; }
  .chat-back-mobile { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); flex: 0 0 auto; }
  .chat-back-mobile .icon { width: 15px; height: 15px; }
  .chat-head { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .chat-head-body { min-width: 140px; }
  .chat-head-actions { margin-left: auto; }
  .chat-head-actions .chat-stage { display: none; }
  .chat-head-actions .btn { height: 30px; padding: 0 9px; font-size: 10px; }
  .chat-head .avatar--lg { width: 36px; height: 36px; font-size: 12px; }
  .page-inbox .page-head { margin-bottom: 14px; }
  .page-inbox .page-head .lede { display: none; }
  .page-inbox .page-head h1 { font-size: 32px; }
  .page-inbox .page-actions .btn { width: 100%; }
}
