/* Bounded — фирменный шрифт (self-hosted, работает оффлайн и в РФ). Вариативный. */
  @font-face{
    font-family:'Bounded';
    /* woff2 (151КБ) первым — грузится в 2.4 раза быстрее; ttf — фолбэк */
    src:url('/fonts/Bounded-Variable.woff2') format('woff2-variations'),
        url('/fonts/Bounded-Variable.ttf') format('truetype-variations');
    font-weight:100 900;
    font-stretch:75% 125%;
    font-display:swap;
  }
  /* ═══ ДИЗАЙН-ТОКЕНЫ: две темы одного дизайна ═══
     Светлая = Boutique Light (тёплый премиум, банковский стиль).
     Тёмная  = Cinema Dark (глубокий фон, красное свечение).
     Тема ставится атрибутом data-theme на <html> (см. applyTheme в JS). */
  :root{
    --bg:#F7F6F3; --card:#ffffff; --card-solid:#ffffff; --ink:#141518; --muted:#8a8d94; --line:#ECEAE5;
    --red:#ed1c24; --red2:#ff4a3d; --redsoft:#FBEAEB; --red-txt:#B42932;
    --btn:#b42932; --btn2:#cf3744; --btn-hover:#932027;
    --field:#F5F4EF; --field-focus:#ffffff; --panel:#F1EFEA; --hover:#F1EFEA;
    --chev:#c9c6bf; --faint:#b5b2ab; --nav-muted:#a0a3aa; --placeholder:#b0ada6;
    --sec-bg:#F1EFEA; --danger-bg:#fff5f5; --danger-line:#ffd4d4;
    --ok-bg:#f0fbf4; --ok-line:#bfe6cd; --ok:#1f9d57;
    --b-new-bg:#fff3e0; --b-new-c:#e08600; --b-call-bg:#e7f0ff; --b-call-c:#2f6bdb;
    --b-deal-bg:#e3f6ea; --b-deal-c:#1f9d57; --b-no-bg:#F1EFEA; --b-no-c:#8a8d94;
    --shadow:0 2px 10px rgba(20,21,24,.045);
    --shadow-lift:0 10px 26px rgba(20,21,24,.08);
    --nav-bg:rgba(255,255,255,.98); --scrim:rgba(20,22,31,.5);
    --frame:#11141f; --desk-bg:#E7E4DE;
  }
  html[data-theme="dark"]{
    --bg:#0a0a0e; --card:#15151b; --card-solid:#17171d; --ink:#EDEDEF; --muted:#8A8F98; --line:rgba(255,255,255,.09);
    --red:#ed1c24; --red2:#ff4a3d; --redsoft:rgba(237,28,36,.14); --red-txt:#FF4D55;
    --btn:#c92730; --btn2:#e0333d; --btn-hover:#a31f27;
    --field:rgba(255,255,255,.06); --field-focus:rgba(255,255,255,.1); --panel:#101015; --hover:rgba(255,255,255,.07);
    --chev:#5a5e68; --faint:#5f636d; --nav-muted:#8A8F98; --placeholder:#6b6f79;
    --sec-bg:rgba(255,255,255,.08); --danger-bg:rgba(237,28,36,.12); --danger-line:rgba(237,28,36,.3);
    --ok-bg:rgba(74,222,128,.12); --ok-line:rgba(74,222,128,.25); --ok:#4ade80;
    --b-new-bg:rgba(255,163,26,.14); --b-new-c:#ffb54d; --b-call-bg:rgba(86,143,255,.14); --b-call-c:#7ba6ff;
    --b-deal-bg:rgba(74,222,128,.12); --b-deal-c:#4ade80; --b-no-bg:rgba(255,255,255,.07); --b-no-c:#8A8F98;
    --shadow:0 2px 12px rgba(0,0,0,.25);
    --shadow-lift:0 12px 30px rgba(0,0,0,.4);
    --nav-bg:rgba(14,14,18,.94); --scrim:rgba(0,0,0,.6);
    --frame:#000000; --desk-bg:#141419;
  }
  *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
  body{ margin:0; font-family:'Bounded',-apple-system,"Segoe UI",Roboto,Inter,Arial,sans-serif; color:var(--ink); line-height:1.5; font-weight:400; letter-spacing:.1px;
    background:var(--bg); }
  html[data-theme="dark"] .app{ background:linear-gradient(180deg,#111116 0%,#0a0a0e 55%,#08080b 100%); }
  .app{ position:relative; min-height:100vh; display:flex; flex-direction:column; overflow:hidden; background:var(--bg); }
  .scroll{ flex:1; overflow-y:auto; overflow-x:hidden; padding:18px 16px 80px; scrollbar-width:none; -ms-overflow-style:none; position:relative; z-index:1; }
  .scroll::-webkit-scrollbar{ display:none; width:0; height:0; }
  h1,h2,h3{ margin:0; }

  /* Телефонная рамка на ПК — фикс пропорция, без «лопаты» */
  @media (min-width:600px){
    body{ display:flex; align-items:center; justify-content:center; background:var(--desk-bg); padding:20px; min-height:100vh; }
    .app{ width:380px; height:780px; min-height:0; border:12px solid var(--frame); border-radius:46px;
      box-shadow:0 30px 80px rgba(0,0,0,.45); }
    /* «Озерцо» (Dynamic Island) в ПК-рамке + отступ контента под него —
       как на реальном iPhone (там отступ даёт env(safe-area-inset-top)) */
    .app::before{ content:''; position:absolute; top:12px; left:50%; transform:translateX(-50%);
      width:98px; height:27px; border-radius:16px; background:#000; z-index:60;
      box-shadow:inset 0 0 0 1px rgba(255,255,255,.05); pointer-events:none; }
    .scroll{ padding-top:52px; }
    #loginView{ padding-top:60px; }
  }

  /* Safe-area: вырез/«чёлка»/Dynamic Island сверху и нижний индикатор на телефонах (PWA) */
  @supports (padding: env(safe-area-inset-bottom)){
    @media (max-width:599px){
      .nav{ height:calc(58px + env(safe-area-inset-bottom)); padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
      .scroll{ padding-bottom:calc(80px + env(safe-area-inset-bottom)); padding-top:calc(18px + env(safe-area-inset-top)); }
      body.in-chat #homeScroll{ padding-bottom:calc(env(safe-area-inset-bottom) + 16px); }
      #loginView{ padding-top:calc(34px + env(safe-area-inset-top)); }
    }
  }

  /* ===== ДЕСКТОП-РЕЖИМ — каркас на будущее (Этап 4, см. ПЛАТФОРМЫ-роадмап.md) =====
     Сейчас на ПК приложение показывается телефоном по центру (блок выше).
     Широкую раскладку для оператора за компьютером добавим здесь — логика
     разделов уже разнесена по функциям, переписывать не придётся. */
  @media (min-width:1100px){
    /* TODO(desktop): мульти-колоночный layout (список заявок + карточка рядом,
       канбан во всю ширину). Включается добавлением стилей/классов здесь. */
  }

  /* ===== SPLASH — лоадер «звезда-змейка» (zip-crm-loader-v1, 2026-07-16) =====
     Тема-зависимый: светлая — белый фон без свечения, тёмная — чернильный фон и
     красный glow. Классы с префиксом sp-, чтобы не пересечься с фоновой .bg-star .snake
     (кейфреймы snake-run общие — определены в блоке звезды-змейки ниже). */
  #splash{ position:absolute; inset:0; z-index:60; background:#fff;
    display:flex; flex-direction:column; align-items:center; justify-content:center; }
  html[data-theme="dark"] #splash{ background:#0B0C0E; }
  #splash.out{ animation:splashOut .6s ease forwards; }
  @keyframes splashOut{ to{ opacity:0; visibility:hidden; } }
  .sp-stage{ flex:1; display:flex; align-items:center; justify-content:center; width:100%; }
  .sp-star{ width:clamp(190px,26vmin,340px); height:clamp(190px,26vmin,340px); }
  .sp-star svg{ width:100%; height:100%; display:block; }
  .sp-snake{ fill:none; stroke:#C9333D; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
    stroke-dasharray:200 800; will-change:stroke-dashoffset; animation:snake-run 3s linear infinite; }
  html[data-theme="dark"] .sp-snake{ filter:drop-shadow(0 0 7px rgba(201,51,61,.55)); }
  .sp-brand{ display:flex; flex-direction:column; align-items:center;
    padding-bottom:clamp(40px,7vh,90px); opacity:0; animation:spFade .6s ease .2s forwards; }
  @keyframes spFade{ to{ opacity:1; } }
  .sp-logo{ width:clamp(74px,9vmin,120px); height:auto; display:block; }
  .sp-logo path{ fill:#B42932; }
  .sp-name{ color:#15181d; text-transform:uppercase; font-weight:800; letter-spacing:.2em;
    font-size:clamp(18px,2.4vmin,28px); margin-top:clamp(12px,2vh,22px); }
  html[data-theme="dark"] .sp-name{ color:#fff; }
  .sp-ver{ font-size:clamp(11px,1.3vmin,14px); color:#9aa1aa; letter-spacing:.08em; margin-top:7px; }
  html[data-theme="dark"] .sp-ver{ color:#6E7682; }
  @media (prefers-reduced-motion:reduce){ .sp-snake{ animation:none; } }

  .app-stage{ position:absolute; inset:0; opacity:0; z-index:1; }
  .app-stage.in{ animation:appIn .7s ease forwards; }
  /* После входа анимация СНИМАЕТСЯ полностью (класс done по animationend):
     «залипшая» fill-forwards-анимация на предке в некоторых браузерах
     (YaBrowser) изолирует backdrop — стекло плашек переставало видеть фон. */
  .app-stage.done{ animation:none; opacity:1; }
  /* ⚠️ Без filter в кадрах: fill-mode:forwards оставлял filter:blur(0) на контейнере
     НАВСЕГДА, а любой filter изолирует backdrop — из-за этого backdrop-filter
     (стекло/liquid glass) плиток не видел фон и НЕ размывал его. */
  @keyframes appIn{ from{ opacity:0; transform:translateY(40px); } to{ opacity:1; transform:translateY(0); } }

  /* ===== общие ===== */
  #welcome{ position:absolute; inset:0; z-index:40; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px;
    background:
      radial-gradient(300px 240px at 80% 16%, rgba(237,28,36,.08), transparent 70%),
      radial-gradient(320px 280px at 14% 84%, rgba(237,28,36,.05), transparent 70%),
      var(--bg); }
  .wel-ava{ width:84px; height:84px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:30px; font-weight:800; color:#fff; background:linear-gradient(135deg,var(--red),var(--red2)); }
  /* Центрируем текст приветствия (при переносе строк уезжал влево — «кривой вход») */
  .wel-hi{ font-size:22px; font-weight:800; text-align:center; padding:0 28px; line-height:1.3; }
  .wel-role{ color:var(--muted); font-size:14px; text-align:center; }

  #loginView{ padding:34px 22px; }
  .logo-txt{ font-weight:900; font-size:34px; } .logo-txt b{ color:var(--red); }
  .logo-txt span{ display:block; font-size:14px; font-weight:700; letter-spacing:.18em; margin-top:2px; }
  .login-title{ font-size:24px; font-weight:800; margin:26px 0 6px; }
  .login-sub{ color:var(--muted); font-size:14px; margin-bottom:24px; }
  label{ display:block; font-size:13px; color:var(--muted); margin:14px 0 6px; }
  input{ width:100%; padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:var(--field); font-size:15px; color:var(--ink); }
  input:focus{ outline:none; border-color:var(--red); background:var(--field-focus); }
  input::placeholder, textarea::placeholder{ color:var(--placeholder); font-weight:400; opacity:1; letter-spacing:0; }
  input, textarea, select, button{ line-height:1.3; font-family:inherit; }
  .btn{ width:100%; margin-top:22px; padding:15px; border:0; border-radius:14px; cursor:pointer; font-size:16px; font-weight:700; color:#fff; background:linear-gradient(135deg,var(--btn2),var(--btn)); box-shadow:0 8px 20px rgba(180,41,50,.32); transition:background .15s, transform .1s; }
  .btn:hover{ background:linear-gradient(135deg,var(--btn),var(--btn-hover)); }
  .btn:active{ transform:translateY(1px); }
  .err{ color:var(--red); font-size:13px; margin-top:12px; min-height:16px; }
  .hint{ color:var(--muted); font-size:12px; margin-top:20px; line-height:1.7; }

  .topbar{ display:flex; align-items:center; gap:12px; padding:8px 4px 18px; }
  .ava{ width:46px; height:46px; border-radius:50%; flex:0 0 auto; display:flex; align-items:center; justify-content:center; font-weight:800; color:#fff; background:linear-gradient(135deg,var(--red),var(--red2)); }
  .greet{ flex:1; } .greet .s{ color:var(--muted); font-size:13px; } .greet .n{ font-size:18px; font-weight:800; }
  .icon-btn{ width:40px; height:40px; border-radius:12px; background:var(--card); border:1px solid var(--line); display:flex; align-items:center; justify-content:center; cursor:pointer; }
  .rolecard{ background:linear-gradient(135deg,var(--btn2),var(--btn)); border-radius:22px; padding:20px; color:#fff; margin-bottom:22px; }
  .rolecard .lbl{ font-size:12px; opacity:.85; } .rolecard .val{ font-size:22px; font-weight:800; margin-top:4px; } .rolecard .row{ display:flex; align-items:center; justify-content:space-between; }
  .daycard .lbl{ font-size:13px; opacity:.9; font-weight:600; } .daycard .quote{ font-size:18px; font-weight:800; line-height:1.4; margin-top:8px; }
  .section-h{ font-size:13px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin:6px 4px 12px; }
  .item{ display:flex; align-items:center; gap:14px; background:var(--card); border:1px solid var(--line); border-radius:18px; padding:14px 16px; margin-bottom:12px; cursor:pointer; box-shadow:var(--shadow); transition:.15s; }
  .item:active{ transform:scale(.99); }
  .item .ibox{ width:44px; height:44px; border-radius:13px; background:var(--redsoft); color:var(--red); display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
  .item .t{ flex:1; } .item .t .nm{ font-weight:700; font-size:15px; } .item .t .ds{ color:var(--muted); font-size:12px; margin-top:2px; }
  .item .chev{ color:var(--chev); }
  /* Разделы на главной — плитки в 2 колонки (как доска) */
  .items-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .item2{ background:var(--card); border:1px solid var(--line); border-radius:18px; padding:14px; cursor:pointer; box-shadow:var(--shadow); transition:.15s; display:flex; flex-direction:column; gap:9px; }
  .item2:active{ transform:scale(.98); }
  .item2 .ibox{ width:40px; height:40px; border-radius:12px; background:var(--redsoft); color:var(--red); display:flex; align-items:center; justify-content:center; }
  .item2 .nm{ font-weight:700; font-size:14px; line-height:1.25; }
  .item2 .ds{ color:var(--muted); font-size:11px; line-height:1.4; margin-top:-4px; }
  .panel-head{ display:flex; align-items:center; gap:12px; margin-bottom:16px; }
  .back{ width:40px; height:40px; border-radius:12px; border:1px solid var(--line); background:var(--card); display:flex; align-items:center; justify-content:center; cursor:pointer; }
  .panel-title{ font-size:20px; font-weight:800; }
  .stub-card{ background:var(--card); border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:var(--shadow); color:var(--muted); font-size:14px; line-height:1.7; }
  .tag{ display:inline-block; font-size:11px; font-weight:700; color:var(--red); background:var(--redsoft); padding:4px 10px; border-radius:20px; margin-bottom:10px; }
  .nav{ position:absolute; left:0; right:0; bottom:0; height:58px; z-index:20; background:var(--card); border-top:1px solid var(--line); display:flex; align-items:flex-end; justify-content:space-around; padding:0 24px 8px; }
  .nav .nbtn{ color:var(--nav-muted); cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10px; }
  .nav .nbtn.active{ color:var(--red-txt); }
  html[data-theme="dark"] .nav .nbtn.active svg{ filter:drop-shadow(0 0 8px rgba(237,28,36,.6)); }
  .hidden{ display:none !important; } .ver{ text-align:center; color:var(--faint); font-size:11px; margin-top:18px; }

  /* ===== концепт-экраны ===== */
  .search{ display:flex; align-items:center; gap:8px; background:var(--card); border:1px solid var(--line); border-radius:14px; padding:11px 14px; margin-bottom:14px; color:var(--muted); }
  .search input{ border:0; background:none; padding:0; font-size:14px; flex:1; color:var(--ink); }
  .chips{ display:flex; gap:8px; overflow-x:auto; margin-bottom:14px; padding-bottom:2px; scrollbar-width:none; }
  .chips::-webkit-scrollbar{ display:none; }
  .chip{ white-space:nowrap; padding:7px 14px; border-radius:20px; font-size:13px; border:1px solid var(--line); background:var(--card); color:var(--muted); cursor:pointer; }
  .chip.on{ background:var(--red); color:#fff; border-color:var(--red); }
  .lead{ display:flex; align-items:center; gap:12px; background:var(--card); border:1px solid var(--line); border-radius:16px; padding:12px 14px; margin-bottom:10px; box-shadow:var(--shadow); }
  .lead .av{ width:42px; height:42px; border-radius:12px; background:var(--redsoft); color:var(--red); display:flex; align-items:center; justify-content:center; font-weight:800; flex:0 0 auto; font-size:15px; }
  .lead .info{ flex:1; min-width:0; } .lead .nm{ font-weight:700; font-size:15px; line-height:1.3; word-break:break-word; overflow-wrap:anywhere; } .lead .ph{ color:var(--muted); font-size:13px; } .lead .ch{ color:var(--faint); font-size:11px; margin-top:2px; }
  .lead .right{ text-align:right; flex:0 0 auto; }
  .badge2{ font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px; white-space:nowrap; }
  .b-new{ background:var(--b-new-bg); color:var(--b-new-c); } .b-call{ background:var(--b-call-bg); color:var(--b-call-c); } .b-deal{ background:var(--b-deal-bg); color:var(--b-deal-c); } .b-no{ background:var(--b-no-bg); color:var(--b-no-c); }
  .lead .dt{ color:var(--faint); font-size:11px; margin-top:5px; }
  .stat-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:14px; }
  .stat{ background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; box-shadow:var(--shadow); }
  .stat .v{ font-size:26px; font-weight:800; } .stat .v.red{ color:var(--red); } .stat .l{ color:var(--muted); font-size:12px; margin-top:2px; }
  .card-box{ background:var(--card); border:1px solid var(--line); border-radius:18px; padding:18px; box-shadow:var(--shadow); margin-bottom:14px; }
  .bars{ display:flex; align-items:flex-end; gap:8px; height:96px; margin-top:14px; }
  .bars .bcol{ flex:1; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:6px; }
  .bars .bar{ width:100%; background:linear-gradient(180deg,var(--red2),var(--red)); border-radius:6px 6px 0 0; }
  .bars .bl{ font-size:10px; color:var(--muted); }
  .field{ margin-bottom:12px; } .field label{ margin:0 0 6px; }
  .select{ width:100%; padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:var(--field); font-size:15px; color:var(--ink); }
  .chat-msg{ max-width:80%; padding:10px 13px; border-radius:16px; margin-bottom:10px; font-size:14px; line-height:1.45; }
  .chat-msg.bot{ background:var(--card); border:1px solid var(--line); border-bottom-left-radius:4px; }
  .chat-msg.me{ background:linear-gradient(135deg,var(--red),var(--red2)); color:#fff; margin-left:auto; border-bottom-right-radius:4px; }
  .composer{ display:flex; gap:8px; margin-top:8px; } .composer input{ flex:1; }
  .composer .send{ width:48px; border:0; border-radius:12px; background:linear-gradient(135deg,var(--red2),var(--red)); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:filter .15s, transform .1s; }
  .composer .send:hover{ filter:brightness(1.08); }
  .composer .send:active{ transform:scale(.94); }
  .chat-screen{ display:flex; flex-direction:column; height:100%; }
  .chat-msgs{ flex:1; min-height:0; overflow-y:auto; display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-end; gap:2px; padding:4px 0 8px; scrollbar-width:none; }
  .chat-msgs .chat-msg{ width:fit-content; }
  .chat-msgs .chat-msg.me{ align-self:flex-end; }
  .chat-msgs .ver{ margin:auto; }
  .msg-who{ font-size:11px; font-weight:700; color:var(--red-txt); margin:0 0 3px; }
  .chat-composer{ flex:0 0 auto; padding-top:8px; }
  .chat-composer .clip{ width:44px; flex:0 0 auto; border:1px solid var(--line); border-radius:12px; background:var(--card); color:var(--muted); cursor:pointer; display:flex; align-items:center; justify-content:center; }
  /* Идёт запись голосового: кнопка-микрофон краснеет и пульсирует */
  .chat-composer .clip.rec{ background:var(--red); border-color:var(--red); color:#fff; animation:micPulse 1.2s ease-in-out infinite; }
  @keyframes micPulse{ 0%,100%{ box-shadow:0 0 0 0 rgba(237,28,36,.45); } 50%{ box-shadow:0 0 0 7px rgba(237,28,36,0); } }
  @media (prefers-reduced-motion:reduce){ .chat-composer .clip.rec{ animation:none; } }
  .chat-msg.has-img{ padding:0; background:transparent; }
  .msg-img{ display:block; max-width:240px; width:100%; border-radius:14px; cursor:pointer; }
  .chat-msg.has-img .msg-who{ margin-left:2px; }
  .chat-msg.has-img .msg-cap{ margin-top:4px; padding:8px 12px; border-radius:14px; font-size:14px; line-height:1.45; }
  .chat-msg.me.has-img .msg-cap{ background:linear-gradient(135deg,var(--red),var(--red2)); color:#fff; }
  .chat-msg.bot.has-img .msg-cap{ background:var(--card); border:1px solid var(--line); color:var(--ink); }
  .lightbox{ position:fixed; inset:0; background:rgba(0,0,0,.88); display:flex; align-items:center; justify-content:center; z-index:120; padding:16px; cursor:zoom-out; }
  .lightbox img{ max-width:100%; max-height:100%; border-radius:10px; }
  .notif-badge{ position:absolute; top:-4px; right:-4px; min-width:16px; height:16px; padding:0 4px; border-radius:9px; background:var(--red); color:#fff; font-size:10px; font-weight:800; line-height:16px; text-align:center; box-shadow:0 0 0 2px var(--card); }
  .notif-ic{ width:42px; height:42px; border-radius:12px; background:var(--redsoft); color:var(--red); display:flex; align-items:center; justify-content:center; font-size:18px; flex:0 0 auto; }
  .lead.unread{ border-color:rgba(237,28,36,.4); box-shadow:0 8px 30px rgba(237,28,36,.1); }
  .notif-dot{ width:9px; height:9px; border-radius:50%; background:var(--red); display:inline-block; }
  body.in-chat .nav{ display:none; }
  body.in-chat .bg-deco{ display:none; }
  /* На экране входа клетку не показываем — мешает читать (фидбек Артура) */
  body.auth-screen .bg-deco::before{ display:none; }
  body.in-chat #homeScroll{ padding-bottom:calc(env(safe-area-inset-bottom) + 16px); }
  .delta{ font-size:13px; font-weight:700; } .delta.down{ color:var(--red-txt); } .delta.up{ color:var(--ok); }

  /* ===== КАНБАН ===== */
  .kb-top{ display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
  .kb-boards{ display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; flex:1; }
  .kb-boards::-webkit-scrollbar{ display:none; }
  .kb-btab{ white-space:nowrap; padding:7px 13px; border-radius:20px; font-size:13px; font-weight:700; border:1px solid var(--line); background:var(--card); color:var(--muted); cursor:pointer; }
  .kb-btab.on{ background:var(--red); color:#fff; border-color:var(--red); }
  .kb-tools{ display:flex; gap:8px; width:100%; }
  .kb-tools .search{ margin:0; flex:1; }
  .kb-filter{ padding:9px 10px; border:1px solid var(--line); border-radius:12px; background:var(--card); font-size:12px; color:var(--ink); max-width:46%; }
  .kb-board{ display:flex; gap:12px; overflow-x:auto; padding-bottom:10px; scrollbar-width:none; align-items:flex-start; }
  .kb-board::-webkit-scrollbar{ display:none; }
  .kb-col{ flex:0 0 250px; max-width:250px; background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:10px; }
  .kb-col.drop{ border-color:var(--red); background:var(--redsoft); }
  .kb-col-h{ display:flex; align-items:center; gap:7px; margin-bottom:10px; padding:0 2px; }
  .kb-col-h .nm{ font-weight:800; font-size:13px; }
  .kb-col-h .cnt{ font-size:11px; color:var(--muted); background:var(--card); border:1px solid var(--line); border-radius:20px; padding:1px 8px; }
  .kb-col-h .add{ margin-left:auto; width:26px; height:26px; border-radius:9px; border:1px solid var(--line); background:var(--card); color:var(--red-txt); font-size:18px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; }
  .kb-cards{ display:flex; flex-direction:column; gap:9px; min-height:24px; }
  .kb-card{ position:relative; background:var(--card-solid); border:1px solid var(--line); border-radius:14px; padding:11px 12px 10px; box-shadow:var(--shadow); cursor:pointer; border-left:4px solid var(--chev); }
  .kb-card.p-urgent{ border-left-color:#ed1c24; } .kb-card.p-high{ border-left-color:#ff8a00; }
  .kb-card.p-normal{ border-left-color:var(--chev); } .kb-card.p-low{ border-left-color:#56b3ff; }
  .kb-card .labels{ display:flex; flex-wrap:wrap; gap:5px; margin-bottom:7px; padding-right:52px; }
  .kb-label{ font-size:10px; font-weight:700; color:#fff; padding:2px 8px; border-radius:20px; }
  .kb-card .tt{ font-size:14px; font-weight:700; line-height:1.3; margin-bottom:8px; padding-right:52px; overflow-wrap:anywhere; }
  .kb-card .lead-link{ font-size:11px; color:var(--red-txt); background:var(--redsoft); border-radius:8px; padding:3px 7px; display:inline-flex; gap:4px; margin-bottom:8px; }
  .kb-meta{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .kb-meta .av{ width:24px; height:24px; border-radius:50%; background:linear-gradient(135deg,var(--red),var(--red2)); color:#fff; font-size:10px; font-weight:800; display:flex; align-items:center; justify-content:center; }
  .kb-due{ font-size:11px; font-weight:700; padding:2px 8px; border-radius:20px; background:var(--b-no-bg); color:var(--b-no-c); }
  .kb-due.today{ background:var(--b-new-bg); color:var(--b-new-c); } .kb-due.over{ background:var(--redsoft); color:var(--red-txt); }
  .kb-chip{ font-size:11px; color:var(--muted); display:inline-flex; align-items:center; gap:3px; }
  .kb-card .arrows{ position:absolute; top:8px; right:8px; display:flex; gap:4px; }
  .kb-card .arrows button{ width:22px; height:22px; border-radius:7px; border:1px solid var(--line); background:var(--field); color:var(--muted); cursor:pointer; font-size:12px; line-height:1; display:flex; align-items:center; justify-content:center; }
  .kb-empty{ font-size:12px; color:var(--faint); text-align:center; padding:10px 0; }
  /* CRM: «протухший» лид (3+ дня без движения) — фишка Pipedrive rotting */
  .kb-card.crm-rot{ border-left-color:var(--red); box-shadow:0 0 0 1px rgba(237,28,36,.25), var(--shadow); }
  .crm-summary,.task-summary{ display:flex; gap:7px; flex-wrap:wrap; margin:0 0 12px; }
  .crm-kpi,.task-kpi{ display:flex; align-items:center; gap:7px; padding:7px 10px; border:1px solid var(--line); border-radius:11px; background:var(--card); color:var(--muted); font-size:11px; }
  .crm-kpi b,.task-kpi b{ color:var(--ink); font-size:12px; }
  .crm-kpi.is-alert,.task-kpi.is-alert{ border-color:var(--danger-line); background:var(--redsoft); }
  .crm-kpi.is-alert b,.task-kpi.is-alert b{ color:var(--red-txt); }
  .task-kpi.is-warn{ border-color:rgba(224,134,0,.35); background:rgba(224,134,0,.09); }
  .task-kpi.is-warn b{ color:#b66d00; }
  /* CRM: таймлайн истории лида в карточке клиента */
  .tl-row{ display:flex; gap:9px; padding:7px 0; border-bottom:1px solid var(--line); font-size:12.5px; align-items:flex-start; }
  .tl-ic{ flex:0 0 auto; width:24px; height:24px; border-radius:8px; background:var(--redsoft); display:flex; align-items:center; justify-content:center; font-size:12px; }
  .tl-row .tx{ flex:1; line-height:1.4; } .tl-row .tx b{ font-weight:700; }
  .tl-row .dt{ color:var(--faint); font-size:10.5px; flex:0 0 auto; }
  /* CRM: центр интеграций и журнал вебхуков */
  .wh-card{ border:1px solid var(--line); background:var(--field); border-radius:15px; padding:12px; margin:9px 0; }
  .wh-top{ display:flex; align-items:flex-start; gap:8px; }
  .wh-top .wh-main{ flex:1; min-width:0; }
  .wh-name{ font-size:14px; font-weight:800; overflow-wrap:anywhere; }
  .wh-url{ color:var(--muted); font-size:11px; margin-top:3px; overflow-wrap:anywhere; }
  .wh-status{ display:inline-flex; align-items:center; gap:5px; border-radius:20px; padding:3px 8px; font-size:10px; font-weight:800; }
  .wh-status.ok{ background:rgba(31,157,87,.14); color:#1f9d57; }
  .wh-status.bad{ background:var(--redsoft); color:var(--red-txt); }
  .wh-status.off{ background:var(--chip-bg); color:var(--muted); }
  .wh-actions{ display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
  .wh-actions button{ border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:9px; padding:6px 9px; font-family:inherit; font-size:11px; font-weight:700; cursor:pointer; }
  .codebox{ background:#11131a; color:#e8ebf3; border-radius:12px; padding:10px 12px; font:11px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace; overflow-wrap:anywhere; white-space:pre-wrap; margin:7px 0; }
  .event-grid{ display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-top:7px; }
  .event-opt{ display:flex; gap:7px; align-items:flex-start; border:1px solid var(--line); border-radius:10px; padding:8px; font-size:11px; line-height:1.25; background:var(--field); cursor:pointer; }
  .event-opt input{ width:auto; margin-top:1px; accent-color:var(--red); }
  .integration-summary,.user-summary{ display:flex; gap:7px; flex-wrap:wrap; }
  .integration-kpi,.user-kpi{ display:flex; align-items:center; gap:7px; padding:7px 10px; border:1px solid var(--line); border-radius:11px; background:var(--card); color:var(--muted); font-size:11px; }
  .integration-kpi b,.user-kpi b{ color:var(--ink); font-size:12px; }
  .integration-columns{ display:block; }
  .users-toolbar{ margin-bottom:14px; }
  /* ═══ Тосты (вместо системных alert) ═══ */
  #toasts{ position:absolute; left:14px; right:14px; bottom:calc(74px + env(safe-area-inset-bottom)); z-index:200; display:flex; flex-direction:column; gap:8px; pointer-events:none; }
  .toast{ pointer-events:auto; padding:12px 15px; border-radius:14px; font-size:13.5px; font-weight:600; line-height:1.4;
    background:var(--card); color:var(--ink); border:1px solid var(--line); box-shadow:0 14px 40px rgba(0,0,0,.25);
    animation:toastIn .25s ease; display:flex; gap:9px; align-items:flex-start; }
  .toast .tico{ flex:0 0 auto; }
  .toast.err{ border-color:rgba(237,28,36,.4); } .toast.err .tico{ color:var(--red); }
  .toast.ok .tico{ color:#1f9d57; } .toast.warn .tico{ color:#e08600; }
  .toast.out{ animation:toastOut .3s ease forwards; }
  @keyframes toastIn{ from{ opacity:0; transform:translateY(14px) scale(.97); } to{ opacity:1; transform:none; } }
  @keyframes toastOut{ to{ opacity:0; transform:translateY(8px); } }

  /* ===== Модалка ===== */
  .modal-ov{ position:absolute; inset:0; z-index:80; background:var(--scrim); display:flex; align-items:flex-end; justify-content:center; }
  /* Карточка клиента: фон позади сильно размывается, чтобы не отвлекал
     (просьба Артура; остальные модалки не трогаем — класс вешает только openLead) */
  .modal-ov.ov-blur{ -webkit-backdrop-filter:blur(16px) saturate(120%); backdrop-filter:blur(16px) saturate(120%); }
  .modal{ width:100%; max-height:92%; overflow-y:auto; background:var(--card-solid); border-radius:22px 22px 0 0; padding:18px 18px 28px; scrollbar-width:none; animation:mUp .25s ease; }
  .modal::-webkit-scrollbar{ display:none; }
  @keyframes mUp{ from{ transform:translateY(40px); opacity:.4; } to{ transform:translateY(0); opacity:1; } }
  .modal-h{ display:flex; align-items:center; gap:10px; margin-bottom:14px; }
  .modal-h .mt{ font-size:17px; font-weight:800; flex:1; }
  .modal-h .x{ width:34px; height:34px; border-radius:10px; border:1px solid var(--line); background:var(--card); cursor:pointer; font-size:18px; color:var(--muted); }
  .modal label{ margin:12px 0 5px; }
  .modal textarea{ width:100%; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--field); font-size:14px; font-family:inherit; resize:vertical; min-height:60px; color:var(--ink); }
  .seg{ display:flex; gap:6px; flex-wrap:wrap; }
  .seg .s{ padding:7px 12px; border-radius:10px; border:1px solid var(--line); background:var(--field); font-size:12px; font-weight:700; cursor:pointer; color:var(--muted); }
  .seg .s.on{ color:#fff; border-color:transparent; }
  .seg .s.on.u{ background:#ed1c24; } .seg .s.on.h{ background:#ff8a00; } .seg .s.on.n{ background:#7a8194; } .seg .s.on.l{ background:#56b3ff; }
  .seg .s.on.t{ background:linear-gradient(135deg,var(--btn2),var(--btn)); }
  .lbpick{ display:flex; flex-wrap:wrap; gap:6px; }
  .lbpick .lb{ font-size:11px; font-weight:700; padding:5px 11px; border-radius:20px; cursor:pointer; border:2px solid transparent; color:#fff; opacity:.45; }
  .lbpick .lb.on{ opacity:1; box-shadow:0 0 0 2px #fff inset; }
  .ck-row{ display:flex; align-items:center; gap:9px; padding:7px 0; border-bottom:1px solid var(--line); }
  .ck-row .box{ width:20px; height:20px; border-radius:6px; border:2px solid var(--line); cursor:pointer; flex:0 0 auto; display:flex; align-items:center; justify-content:center; color:#fff; font-size:12px; }
  .ck-row .box.on{ background:var(--ok); border-color:var(--ok); }
  .ck-row .tx{ flex:1; font-size:14px; } .ck-row .tx.done{ text-decoration:line-through; color:var(--muted); }
  .ck-row .del{ color:var(--chev); cursor:pointer; background:none; border:0; font-size:16px; }
  .cmt{ background:var(--field); border-radius:12px; padding:9px 12px; margin-bottom:8px; }
  .cmt .who{ font-size:11px; font-weight:800; color:var(--red-txt); margin-bottom:2px; }
  .cmt .tx{ font-size:13px; line-height:1.4; }
  .cmt .dt{ font-size:10px; color:var(--faint); margin-top:3px; }
  .mbtns{ display:flex; gap:8px; margin-top:18px; }
  .mbtns .del-card{ flex:0 0 auto; padding:14px 16px; border-radius:14px; border:1px solid var(--danger-line); background:var(--danger-bg); color:var(--red-txt); font-weight:700; cursor:pointer; }

  /* ===== Кастомный выпадающий список (заменяет дешёвый нативный select) ===== */
  .csel{ position:relative; }
  .csel-native{ display:none; }
  .kb-tools{ min-width:0; }
  .kb-tools .csel{ flex:1 1 0; min-width:0; }
  .kb-tools .csel .csel-btn{ font-size:12.5px; padding:11px 11px; }
  .kb-tools .search{ min-width:0; }
  #anaPeriod .card-box{ flex-wrap:nowrap; }
  #anaPeriod .csel{ flex:1 1 0; min-width:0; }
  #anaPeriod .card-box > span{ flex:0 0 auto; }
  #anaPeriod .csel .csel-btn{ font-size:13px; padding:10px 11px; }
  .csel-btn{ width:100%; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:13px 14px; border:1px solid var(--line); border-radius:12px; background:var(--field); font:inherit; font-size:14px; font-weight:600; color:var(--ink); cursor:pointer; text-align:left; transition:.15s; }
  .csel-btn:hover{ border-color:var(--chev); }
  .csel.open .csel-btn{ border-color:var(--red); background:var(--field-focus); box-shadow:0 0 0 3px rgba(237,28,36,.08); }
  .csel-btn .csel-val{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .csel-btn .chev{ flex:0 0 auto; color:var(--muted); transition:transform .2s; }
  .csel.open .csel-btn .chev{ transform:rotate(180deg); }
  .csel-panel{ margin-top:6px; background:var(--card-solid); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow-lift); padding:6px; max-height:240px; overflow-y:auto; scrollbar-width:thin; display:none; }
  .csel.open .csel-panel{ display:block; animation:cselIn .16s ease; }
  @keyframes cselIn{ from{ opacity:0; transform:translateY(-5px); } to{ opacity:1; transform:translateY(0); } }
  .csel-opt{ padding:11px 12px; border-radius:10px; font-size:14px; cursor:pointer; color:var(--ink); }
  .csel-opt:hover{ background:var(--hover); }
  .csel-opt.sel{ background:var(--redsoft); color:var(--red-txt); font-weight:800; }

  /* ═══ Тема-обвязка: шапка, навигация, герой-карта ═══ */
  .topbar{ background:transparent; border:0; padding:8px 4px 16px; margin-bottom:8px; }
  .nav{
    background:var(--nav-bg);
    -webkit-backdrop-filter:blur(20px) saturate(160%); backdrop-filter:blur(20px) saturate(160%);
    border-top:1px solid var(--line);
  }
  /* Герой-карта (красная, как в банковских приложениях) */
  .rolecard{ background:linear-gradient(135deg,#B42932 0%,#ED1C24 100%); box-shadow:0 12px 30px rgba(180,41,50,.28); }
  html[data-theme="dark"] .rolecard{ box-shadow:0 12px 34px rgba(237,28,36,.22); }
  /* Свечение вокруг аватара в тёмной теме */
  html[data-theme="dark"] .ava{ box-shadow:0 0 24px rgba(237,28,36,.3); }
  /* Тёмная тема: плашки — «молочное» стекло как на liquid-test (выбор Артура):
     заметное размытие, фон просвечивает, светлая рамка + блик. ВЕЗДЕ. */
  html[data-theme="dark"] .item, html[data-theme="dark"] .item2, html[data-theme="dark"] .lead,
  html[data-theme="dark"] .card-box, html[data-theme="dark"] .stat, html[data-theme="dark"] .stub-card,
  html[data-theme="dark"] .search, html[data-theme="dark"] .icon-btn, html[data-theme="dark"] .back,
  html[data-theme="dark"] .kb-card, html[data-theme="dark"] .kb-col, html[data-theme="dark"] .modal,
  html[data-theme="dark"] .csel-panel, html[data-theme="dark"] .chip, html[data-theme="dark"] .kb-btab{
    background:rgba(26,26,34,.40);
    /* blur 4px как на liquid-test — «чистое» стекло, не мутное (просьба Артура) */
    -webkit-backdrop-filter:blur(4px) saturate(150%); backdrop-filter:blur(4px) saturate(150%);
    border-color:rgba(255,255,255,.15);
  }
  /* СВЕТЛАЯ тема: те же стеклянные плашки (полупрозрачный белый + чистый blur) */
  html[data-theme="light"] .item, html[data-theme="light"] .item2, html[data-theme="light"] .lead,
  html[data-theme="light"] .card-box, html[data-theme="light"] .stat, html[data-theme="light"] .stub-card,
  html[data-theme="light"] .search, html[data-theme="light"] .icon-btn, html[data-theme="light"] .back,
  html[data-theme="light"] .kb-card, html[data-theme="light"] .kb-col, html[data-theme="light"] .modal,
  html[data-theme="light"] .csel-panel{
    background:rgba(255,255,255,.42);
    /* blur 2px — «чистое» стекло для светлой (4px мутнило, фидбек Артура) */
    -webkit-backdrop-filter:blur(2px) saturate(150%); backdrop-filter:blur(2px) saturate(150%);
  }
  html[data-theme="dark"] .item2, html[data-theme="dark"] .card-box, html[data-theme="dark"] .stat,
  html[data-theme="dark"] .lead, html[data-theme="dark"] .kb-card{
    box-shadow:inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(255,255,255,.03), var(--shadow);
  }
  /* Liquid Glass (по статье habr 974058): feDisplacementMap деформирует фон под
     стеклом — «живое» преломление. Только Chromium: Safari не умеет url() в
     backdrop-filter (детект-хак — hanging-punctuation есть только в Safari,
     значит "not" = все остальные). На iPhone остаётся blur-фолбэк выше. */
  /* ⚠️ ТОЛЬКО В ПРИЛОЖЕНИИ (html[data-app] = установленное PWA или ?app=1),
     сайт в браузере остаётся лёгким — это осознанное разделение сайт/приложение.
     И только «лёгкие» экраны: плитки главной, карточки-боксы, статы (≈8-10 шт).
     На массовых списках (.lead — до 60 плашек) displacement тяжёлый —
     там остаётся быстрый blur-фолбэк выше. */
  @supports not (hanging-punctuation: first){
    /* app-режим: поверх чистого стекла добавляется ЛИНЗА — в ОБЕИХ темах */
    html[data-app="1"][data-theme="dark"] .item2, html[data-app="1"][data-theme="dark"] .card-box,
    html[data-app="1"][data-theme="dark"] .stat, html[data-app="1"][data-theme="dark"] .search{
      -webkit-backdrop-filter:url(#liquidGlass) blur(4px) saturate(150%);
      backdrop-filter:url(#liquidGlass) blur(4px) saturate(150%);
    }
    /* светлая: линза с более чистым стеклом (blur 2px) */
    html[data-app="1"][data-theme="light"] .item2, html[data-app="1"][data-theme="light"] .card-box,
    html[data-app="1"][data-theme="light"] .stat, html[data-app="1"][data-theme="light"] .search{
      -webkit-backdrop-filter:url(#liquidGlass) blur(2px) saturate(150%);
      backdrop-filter:url(#liquidGlass) blur(2px) saturate(150%);
    }
  }
  /* Тёмная тема: файловые иконки (icons/*.svg — чёрные) перекрашиваем в белый */
  html[data-theme="dark"] img[src^="icons/"]{ filter:brightness(0) invert(1); }
  /* ...и inline-SVG в иконбоксах тоже белые (единый стиль) */
  html[data-theme="dark"] .ibox, html[data-theme="dark"] .item2 .ibox{ color:#fff; }

  /* ═══ Живой фон: мягкие световые пятна с медленным дрейфом ═══
     (Артур хотел анимацию фона; при желании заменим на вариант из Тильды) */
  .bg-deco{ position:absolute; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
  .bg-deco i{ position:absolute; display:block; border-radius:50%; will-change:transform; }
  .bg-deco .b1{ width:300px; height:300px; top:-80px; right:-90px;
    background:radial-gradient(circle, rgba(237,28,36,.18), transparent 70%);
    animation:drift1 22s ease-in-out infinite; }
  .bg-deco .b2{ width:260px; height:260px; bottom:16%; left:-110px;
    background:radial-gradient(circle, rgba(237,28,36,.13), transparent 70%);
    animation:drift2 28s ease-in-out infinite; }
  .bg-deco .b3{ width:180px; height:180px; top:42%; right:-60px;
    background:radial-gradient(circle, rgba(20,21,24,.09), transparent 70%);
    animation:drift3 25s ease-in-out infinite; }
  /* Клетчатый фон (выбор Артура: только один тонкий слой, без лишних линий).
     Даёт стеклу «что преломлять» в обеих темах. */
  html[data-theme="dark"] .bg-deco::before{ content:''; position:absolute; inset:0;
    background:repeating-linear-gradient(115deg, rgba(255,255,255,.07) 0 1px, transparent 1px 24px);
  }
  html[data-theme="light"] .bg-deco::before{ content:''; position:absolute; inset:0;
    background:repeating-linear-gradient(115deg, rgba(22,26,38,.12) 0 1px, transparent 1px 24px);
  }
  html[data-theme="dark"] .bg-deco .b1{ background:radial-gradient(circle, rgba(237,28,36,.24), transparent 70%); filter:blur(24px); }
  html[data-theme="dark"] .bg-deco .b2{ background:radial-gradient(circle, rgba(180,41,50,.18), transparent 70%); filter:blur(28px); }
  html[data-theme="dark"] .bg-deco .b3{ background:radial-gradient(circle, rgba(94,106,210,.12), transparent 70%); filter:blur(22px); }
  @keyframes drift1{ 0%,100%{ transform:translate(0,0) scale(1); } 33%{ transform:translate(-36px,44px) scale(1.12); } 66%{ transform:translate(18px,-20px) scale(.95); } }
  @keyframes drift2{ 0%,100%{ transform:translate(0,0) scale(1); } 40%{ transform:translate(46px,-38px) scale(1.08); } 75%{ transform:translate(-14px,22px) scale(.92); } }
  @keyframes drift3{ 0%,100%{ transform:translate(0,0); } 50%{ transform:translate(-40px,-46px) scale(1.15); } }

  /* ═══ Звезда-змейка (анимация Артура из Тильды, 2026-07-15) ═══
     По контуру пятиконечной звезды бежит короткий красный сегмент.
     pathLength=1000 нормализует длину: dash+gap=1000 → всегда ровно один сегмент. */
  .bg-star-wrap{ position:absolute; top:50%; left:0; width:430px; height:430px; margin:-215px 0 0 -150px; }
  .bg-star{ width:100%; height:100%; }
  .bg-star .snake{
    fill:none; stroke:#C9333D; stroke-width:.3; stroke-linecap:round; stroke-linejoin:round;
    opacity:.34; stroke-dasharray:170 830; will-change:stroke-dashoffset;
    animation:snake-run 20s linear infinite;
  }
  html[data-theme="dark"] .bg-star .snake{ opacity:.85; stroke:var(--red2); filter:drop-shadow(0 0 6px rgba(237,28,36,.55)); }
  @keyframes snake-run{ from{ stroke-dashoffset:1000; } to{ stroke-dashoffset:0; } }
  @media (prefers-reduced-motion: reduce){ .bg-deco i, .bg-star .snake{ animation:none; } }

  /* ===== Layout helpers: markup stays structural, presentation lives here ===== */
  .svg-defs{ position:absolute; width:0; height:0; }
  .home-view{ display:flex; flex-direction:column; height:100%; }
  .ui-icon-img{ display:block; }
  .avatar-cover{ width:100%; height:100%; object-fit:cover; border-radius:inherit; display:block; }
  .u-relative{ position:relative; }
  .u-hidden{ display:none; }
  .u-overflow-hidden{ overflow:hidden; }
  .u-clickable{ cursor:pointer; }
  .u-flex{ display:flex; }
  .u-inline-flex{ display:inline-flex; }
  .u-flex-1{ flex:1; }
  .u-flex-auto{ flex:0 0 auto; }
  .u-items-center{ align-items:center; }
  .u-between{ justify-content:space-between; }
  .u-center{ justify-content:center; }
  .u-gap-6{ gap:6px; }
  .u-gap-8{ gap:8px; }
  .u-gap-10{ gap:10px; }
  .u-min-0{ min-width:0; }
  .u-w-full{ width:100%; }
  .u-text-left{ text-align:left; }
  .u-text-center{ text-align:center; }
  .u-muted{ color:var(--muted); }
  .u-faint{ color:var(--faint); }
  .u-danger-text{ color:var(--red-txt); }
  .u-ok-text{ color:var(--ok); }
  .u-inherit-color{ color:inherit; }
  .u-fw-600{ font-weight:600; }
  .u-fw-700{ font-weight:700; }
  .u-fw-800{ font-weight:800; }
  .u-fw-900{ font-weight:900; }
  .u-fs-9{ font-size:9px; }
  .u-fs-11{ font-size:11px; }
  .u-fs-12{ font-size:12px; }
  .u-fs-13{ font-size:13px; }
  .u-fs-14{ font-size:14px; }
  .u-fs-16{ font-size:16px; }
  .u-fs-18{ font-size:18px; }
  .u-fs-20{ font-size:20px; }
  .u-fs-22{ font-size:22px; }
  .u-fs-30{ font-size:30px; }
  .u-fs-34{ font-size:34px; }
  .u-lh-15{ line-height:1.5; }
  .u-lh-16{ line-height:1.6; }
  .u-m-0{ margin:0; }
  .u-mx-0{ margin-left:0; margin-right:0; }
  .u-mb-2{ margin-bottom:2px; }
  .u-mb-3{ margin-bottom:3px; }
  .u-mb-4{ margin-bottom:4px; }
  .u-mb-6{ margin-bottom:6px; }
  .u-mb-8{ margin-bottom:8px; }
  .u-mb-10{ margin-bottom:10px; }
  .u-mb-12{ margin-bottom:12px; }
  .u-mb-14{ margin-bottom:14px; }
  .u-mt-0{ margin-top:0; }
  .u-mt-5{ margin-top:5px; }
  .u-mt-6{ margin-top:6px; }
  .u-mt-7{ margin-top:7px; }
  .u-mt-8{ margin-top:8px; }
  .u-mt-10{ margin-top:10px; }
  .u-mt-12{ margin-top:12px; }
  .u-mt-14{ margin-top:14px; }
  .u-mt-16{ margin-top:16px; }
  .u-ml-auto{ margin-left:auto; }
  .u-word-break{ word-break:break-word; }
  .u-word-break-all{ word-break:break-all; }
  .u-no-decoration{ text-decoration:none; }
  .u-opacity-60{ opacity:.6; }
  .u-opacity-70{ opacity:.7; }
  .tools-mb-10{ margin-bottom:10px; }
  .tools-mb-12{ margin-bottom:12px; }
  .toolbar-heading{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
  .toolbar-heading .section-h{ margin:0; }
  .compact-action{ font-size:12px; font-weight:700; padding:8px 12px; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--btn); cursor:pointer; }
  .btn-more{ display:none; background:var(--chip-bg); color:var(--ink); box-shadow:none; }
  .search-flush{ margin:0; }
  .integration-title{ font-size:18px; font-weight:900; margin-bottom:6px; }
  .chart-frame{ position:relative; height:240px; }
  .section-caption{ font-weight:700; margin-bottom:10px; }
  .stats-detail-grid,.analytics-grid,.analytics-side{ display:block; }
  .support-messages{ padding:2px 0 8px; }
  .btn-leading{ margin:0 0 14px; }
  .profile-card{ text-align:center; }
  .avatar-profile{ width:88px; height:88px; font-size:30px; margin:4px auto 12px; overflow:hidden; }
  .avatar-modal{ width:64px; height:64px; font-size:22px; margin:0 auto; overflow:hidden; }
  .avatar-case{ width:34px; height:34px; font-size:13px; overflow:hidden; }
  .avatar-tiny{ width:20px; height:20px; font-size:9px; }
  .profile-photo-label{ display:block; text-align:center; margin:0 0 6px; }
  .profile-photo-action{ color:var(--btn); font-weight:700; cursor:pointer; }
  .profile-name{ font-weight:800; font-size:18px; }
  .profile-meta{ color:var(--muted); font-size:13px; }
  .field-disabled{ opacity:.6; }
  .btn-form{ margin-top:0; flex:1; }
  .btn-secondary{ background:var(--sec-bg); color:var(--ink); box-shadow:none; }
  .btn-danger{ background:var(--danger-bg); color:var(--red-txt); box-shadow:none; border:1px solid var(--danger-line); }
  .call-link{ text-decoration:none; display:flex; align-items:center; color:var(--ok); border-color:var(--ok-line); background:var(--ok-bg); }
  .mbtns .del-card.btn-secondary{ border-color:var(--line); color:var(--ink); background:var(--card); }
  .mbtns .del-card.call-link{ color:var(--ok); border-color:var(--ok-line); background:var(--ok-bg); }
  .lead .nm.u-fw-600{ font-weight:600; }
  .lead .nm.u-fw-800{ font-weight:800; }
  .composer-flush{ margin:0; }
  .composer-bottom{ margin:0 0 8px; }
  .reminder-time{ flex:0 0 47%; }
  .event-author{ color:var(--muted); font-size:11px; }
  .meta-row-tight{ margin-top:5px; }
  .meta-sum{ margin-left:auto; }
  .fail-description{ text-align:left; margin:0 0 10px; }
  .fail-options{ margin-bottom:12px; }
  .fail-option{ background:var(--btn); }
  .label-top-zero{ margin-top:0; }
  .event-code{ color:var(--faint); }
  .webhook-description{ text-align:left; margin:0; }
  .btn-copy{ margin-top:7px; }
  .chat-actions{ display:flex; gap:10px; margin:0 0 12px; }
  .chat-actions .btn{ margin:0; flex:1; }
  .chat-section-title{ margin:12px 0 8px; }
  .voice-row{ display:flex; align-items:center; gap:6px; }
  .voice-icon{ font-size:18px; }
  .chat-audio{ max-width:210px; height:36px; }
  .chat-file-link{ display:flex; align-items:center; gap:8px; text-decoration:none; color:inherit; font-weight:700; }
  .chat-file-icon{ font-size:20px; }
  .chat-file-hint{ font-size:11px; opacity:.7; margin-top:2px; }
  .ai-button{ font-size:16px; }
  .textarea-lg{ min-height:130px; }
  .textarea-xl{ min-height:140px; }
  .member-check{ width:20px; height:20px; accent-color:var(--btn); margin-right:4px; }
  .member-row{ cursor:pointer; margin:0 0 8px; }
  .empty-case{ text-align:center; }
  .case-empty-icon{ font-size:34px; }
  .case-empty-title{ font-weight:800; margin:8px 0 6px; }
  .case-empty-text{ color:var(--muted); font-size:13px; line-height:1.5; }
  .case-stage-label{ color:var(--muted); font-size:12px; margin-bottom:4px; }
  .case-stage-name{ font-weight:800; font-size:20px; }
  .progress-track{ height:8px; border-radius:6px; background:var(--sec-bg); margin:12px 0 6px; overflow:hidden; }
  .progress-fill{ height:100%; background:linear-gradient(90deg,var(--btn),#ED1C24); border-radius:6px; transition:width .5s; }
  .case-stage-count{ color:var(--muted); font-size:12px; }
  .case-lawyer{ display:flex; align-items:center; gap:10px; margin-top:12px; }
  .case-lawyer-name{ font-size:13px; }
  .waiting-card{ border-left:4px solid var(--btn); }
  .waiting-title{ font-weight:800; margin-bottom:4px; }
  .waiting-text{ font-size:14px; line-height:1.5; }
  .waiting-hint{ color:var(--muted); font-size:12px; margin-top:6px; }
  .guide-card{ cursor:pointer; }
  .guide-head{ display:flex; justify-content:space-between; align-items:center; gap:8px; min-width:0; }
  .guide-title{ font-weight:800; min-width:0; flex:1; overflow-wrap:anywhere; }
  .guide-actions{ display:flex; align-items:center; gap:6px; flex:0 0 auto; }
  .guide-delete{ width:28px; height:28px; border-radius:8px; border:1px solid var(--line); background:var(--card); color:var(--muted); cursor:pointer; }
  .guide-chevron{ display:inline-flex; transition:transform .2s; color:var(--muted); }
  .guide-body{ margin-top:10px; font-size:14px; line-height:1.6; white-space:pre-line; color:var(--ink); }
  .period-label{ margin:0 4px 6px; }
  .period-row{ display:flex; align-items:center; gap:8px; padding:10px 12px; margin-bottom:14px; }
  .period-select{ flex:1; font-size:13px; }
  .period-separator{ color:var(--muted); font-size:13px; flex:0 0 auto; }
  .metric-row{ margin-bottom:8px; }
  .metric-head{ display:flex; justify-content:space-between; font-size:12px; margin-bottom:3px; }
  .metric-track{ height:10px; border-radius:6px; background:var(--chip-bg); overflow:hidden; }
  .metric-fill{ height:100%; border-radius:6px; background:linear-gradient(90deg,var(--red2),var(--red)); }
  .metric-fill-muted{ background:#8a90a3; }
  .kb-label-call,.lb-label-call{ background:#2f6bdb; }
  .kb-label-documents,.lb-label-documents{ background:#9b59b6; }
  .kb-label-meeting,.lb-label-meeting{ background:#e08600; }
  .kb-label-important,.lb-label-important{ background:#161a26; }
  .kb-label-default{ background:#8a90a3; }
  .lead-link-clear{ border:0; background:none; color:var(--red); cursor:pointer; }
  .compact-plus{ cursor:pointer; }
  .lead-result-phone{ color:var(--muted); }
  .support-error{ color:var(--red); }
  .diag-toast{ position:absolute; top:calc(14px + env(safe-area-inset-top)); left:50%; transform:translateX(-50%); z-index:200; background:rgba(20,20,26,.92); color:#fff; font-size:11px; font-weight:700; padding:8px 14px; border-radius:20px; border:1px solid rgba(255,255,255,.15); white-space:nowrap; pointer-events:none; }

  /* ===== Navigation wrappers ===== */
  .mobile-nav{ width:100%; display:flex; align-items:flex-end; justify-content:space-around; }
  .desktop-nav{ display:none; }
  .desktop-page{ width:100%; }
  .desktop-chat-pane{ display:none; }

  /* ===== Full desktop workspace ===== */
  @media (min-width:1100px){
    body{ display:block; min-height:100vh; padding:0; overflow:hidden; background:var(--bg); }
    .app{ width:100%; height:100vh; min-height:100vh; border:0; border-radius:0; box-shadow:none; }
    .app::before{ display:none; }
    .app-stage{ height:100%; }
    body.auth-screen .app-stage.done{ display:grid; place-items:center; }
    #loginView{ width:min(460px,calc(100vw - 48px)); padding:42px; border:1px solid var(--line); border-radius:28px; background:var(--card); box-shadow:var(--shadow-lift); }

    #homeView.home-view{ display:grid; grid-template-columns:288px minmax(0,1fr); height:100%; min-height:0; }
    #homeScroll{ grid-column:2; grid-row:1; height:100vh; padding:30px 38px 42px; z-index:1; }
    .desktop-page{ max-width:1240px; margin:0 auto; }
    .desktop-page.is-wide{ max-width:none; }
    .desktop-page > .panel-head{ margin-bottom:24px; }
    .desktop-page > .panel-head .back{ display:none; }
    .desktop-page > .panel-head .panel-title{ font-size:28px; letter-spacing:-.02em; }

    .nav{ position:relative; grid-column:1; grid-row:1; left:auto; right:auto; bottom:auto; width:288px; height:100vh; padding:0; align-items:stretch; justify-content:stretch; border-top:0; border-right:1px solid var(--line); background:var(--nav-bg); z-index:30; }
    .mobile-nav{ display:none; }
    .desktop-nav{ min-width:0; width:100%; height:100%; padding:26px 18px 18px; display:flex; flex-direction:column; gap:14px; }
    .desktop-brand{ padding:2px 10px 14px; border-bottom:1px solid var(--line); }
    .desktop-brand-name{ font-size:24px; line-height:1; font-weight:900; letter-spacing:.04em; }
    .desktop-brand-name span{ color:var(--red); }
    .desktop-brand-sub{ margin-top:6px; color:var(--muted); font-size:9px; font-weight:700; letter-spacing:.13em; text-transform:uppercase; }
    .desktop-user{ display:flex; align-items:center; gap:11px; padding:10px; border:1px solid var(--line); border-radius:16px; background:var(--card); }
    .desktop-user .ava{ width:38px; height:38px; font-size:13px; }
    .desktop-user > div:last-child{ min-width:0; display:flex; flex-direction:column; }
    .desktop-user b{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
    .desktop-user span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:10px; margin-top:2px; }
    .desktop-add{ width:100%; display:flex; align-items:center; justify-content:center; gap:9px; padding:12px 14px; border:0; border-radius:13px; background:linear-gradient(135deg,var(--red2),var(--red)); color:#fff; font:inherit; font-size:13px; font-weight:800; cursor:pointer; box-shadow:0 8px 20px rgba(180,41,50,.28); }
    .desktop-add.active{ box-shadow:0 0 0 3px var(--redsoft),0 8px 20px rgba(180,41,50,.22); }
    .desktop-add svg{ width:18px; height:18px; }
    .desktop-nav-label{ padding:2px 10px 0; color:var(--faint); font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
    .desktop-nav-list{ min-height:0; display:flex; flex-direction:column; gap:4px; overflow-y:auto; scrollbar-width:none; }
    .desktop-nav-list::-webkit-scrollbar{ display:none; }
    .desktop-nav-item,.desktop-profile{ width:100%; position:relative; display:flex; align-items:center; gap:11px; padding:10px 12px; border:1px solid transparent; border-radius:12px; background:transparent; color:var(--muted); font:inherit; font-size:12px; font-weight:700; text-align:left; cursor:pointer; transition:background .15s,color .15s,border-color .15s; }
    .desktop-nav-item:hover,.desktop-profile:hover{ background:var(--hover); color:var(--ink); }
    .desktop-nav-item.active,.desktop-profile.active{ border-color:var(--danger-line); background:var(--redsoft); color:var(--red-txt); }
    .desktop-nav-item img,.desktop-profile img,.desktop-nav-item svg,.desktop-profile svg{ width:20px; height:20px; flex:0 0 auto; }
    .desktop-nav-item .notif-badge{ top:50%; right:10px; transform:translateY(-50%); }
    .desktop-profile{ margin-top:auto; border-color:var(--line); background:var(--card); }
    body.in-chat .nav{ display:flex; }
    body.in-chat .bg-deco{ display:block; }
    body.in-chat #homeScroll{ padding:30px 38px 42px; }

    .desktop-home-head{ display:grid; grid-template-columns:minmax(0,1fr) minmax(380px,520px); gap:24px; align-items:stretch; margin-bottom:28px; }
    .desktop-home-head .topbar{ min-height:140px; margin:0; padding:24px; border:1px solid var(--line); border-radius:22px; background:var(--card); }
    .desktop-home-head .topbar .ava{ width:58px; height:58px; font-size:18px; }
    .desktop-home-head .greet .s{ font-size:14px; }
    .desktop-home-head .greet .n{ font-size:24px; }
    .desktop-home-head .daycard{ min-height:140px; margin:0; display:flex; flex-direction:column; justify-content:center; }
    .home-page > .section-h{ margin-bottom:14px; }
    .items-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
    .item2{ min-height:146px; padding:18px; justify-content:flex-start; }
    .item2 .ibox{ width:46px; height:46px; }
    .item2 .nm{ font-size:15px; }
    .item2 .ds{ font-size:12px; }

    .kb-board{ gap:14px; padding-bottom:18px; }
    .kb-col{ flex-basis:300px; max-width:300px; padding:12px; }
    .kb-tools{ max-width:920px; }
    .desktop-page.is-wide .kb-tools{ max-width:none; }
    .desktop-page.is-wide > .search{ max-width:920px; }
    .crm-page{ height:calc(100vh - 60px); min-height:0; display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; overflow:hidden; }
    .crm-page > .panel-head{ margin-bottom:18px; }
    .crm-toolbar{ display:grid; grid-template-columns:minmax(320px,1fr) auto; gap:10px 14px; align-items:center; margin-bottom:14px; }
    .crm-toolbar .kb-tools,.crm-toolbar .chips,.crm-toolbar .crm-summary{ margin-bottom:0; }
    .crm-toolbar .chips{ justify-content:flex-end; }
    .crm-toolbar .crm-summary{ grid-column:1/-1; }
    .crm-page #crmBoard{ min-height:0; align-items:stretch; overflow-x:auto; overflow-y:hidden; padding-bottom:12px; }
    .crm-page #crmBoard .kb-col{ height:100%; min-height:0; display:flex; flex-direction:column; }
    .crm-page #crmBoard .kb-col-h{ flex:0 0 auto; }
    .crm-page #crmBoard .kb-cards{ min-height:0; overflow-y:auto; padding-right:3px; scrollbar-width:thin; }
    .crm-page .crm-hint{ margin-top:8px; }
    .tasks-page{ height:calc(100vh - 60px); min-height:0; display:grid; grid-template-rows:auto auto minmax(0,1fr); overflow:hidden; }
    .tasks-page > .panel-head{ margin-bottom:18px; }
    .tasks-toolbar{ display:grid; grid-template-columns:minmax(320px,1fr) minmax(340px,auto); gap:10px 14px; align-items:center; margin-bottom:14px; }
    .tasks-toolbar .kb-top{ grid-column:1/-1; margin-bottom:0; }
    .tasks-toolbar > .kb-tools,.tasks-toolbar .task-summary{ margin-bottom:0; }
    .tasks-toolbar .task-summary{ grid-column:1/-1; }
    .tasks-page #kbBoard{ min-height:0; align-items:stretch; overflow-x:auto; overflow-y:hidden; padding-bottom:12px; }
    .tasks-page #kbBoard .kb-col{ height:100%; min-height:0; display:flex; flex-direction:column; }
    .tasks-page #kbBoard .kb-col-h{ flex:0 0 auto; }
    .tasks-page #kbBoard .kb-cards{ min-height:0; overflow-y:auto; padding-right:3px; scrollbar-width:thin; }
    .leads-page{ height:calc(100vh - 60px); min-height:0; display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; overflow:hidden; }
    .leads-page > .panel-head{ margin-bottom:18px; }
    .leads-toolbar{ display:grid; grid-template-columns:minmax(320px,1fr) minmax(340px,auto); gap:10px 14px; align-items:center; margin-bottom:14px; }
    .leads-toolbar > .search,.leads-toolbar > .kb-tools,.leads-toolbar .toolbar-heading{ margin-bottom:0; }
    .leads-toolbar .toolbar-heading{ grid-column:1/-1; }
    .leads-page #leadsList{ min-height:0; overflow-y:auto; align-content:start; padding-right:4px; scrollbar-width:thin; }
    .leads-page .btn-more{ width:min(360px,100%); justify-self:center; margin-top:12px; }
    .lead-create-page{ max-width:1040px; }
    .lead-create-form{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:2px 18px; padding:24px; }
    .lead-create-form .field{ margin-bottom:10px; }
    .lead-create-form .lead-create-wide,.lead-create-form > .btn{ grid-column:1/-1; }
    .lead-create-form > .btn{ width:min(360px,100%); justify-self:end; margin-top:10px; }
    .stats-page .stat-grid,.analytics-page .stat-grid{ margin-bottom:0; }
    .stats-detail-grid{ display:grid; grid-template-columns:minmax(0,1.15fr) minmax(340px,.85fr); gap:16px; margin-top:16px; }
    .stats-detail-grid .card-box{ min-width:0; margin-bottom:0; }
    .stats-detail-grid .bars{ height:190px; }
    .analytics-overview{ display:grid; grid-template-columns:minmax(0,1fr) 360px; gap:16px; align-items:stretch; margin-bottom:16px; }
    .analytics-overview #anaPeriod{ min-width:0; }
    .analytics-overview #anaPeriod .period-label{ display:block; margin-top:0; }
    .analytics-overview #anaPeriod .card-box{ height:calc(100% - 18px); margin-bottom:0; }
    .analytics-grid{ display:grid; grid-template-columns:minmax(0,1.65fr) minmax(340px,.85fr); gap:16px; align-items:stretch; }
    .analytics-chart-card{ min-width:0; margin-bottom:0; }
    .analytics-chart-card .chart-frame{ height:420px; }
    .analytics-side{ display:grid; grid-template-rows:repeat(2,minmax(0,1fr)); gap:16px; }
    .analytics-side .card-box{ min-height:0; margin-bottom:0; }
    .integration-hero{ display:grid; grid-template-columns:minmax(0,1fr) auto; gap:14px 22px; align-items:center; padding:22px 24px; }
    .integration-hero .integration-main-actions{ margin-top:0; justify-content:flex-end; }
    .integration-hero .integration-summary{ grid-column:1/-1; }
    .integration-columns{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
    .integration-group{ min-width:0; padding:16px; border:1px solid var(--line); border-radius:18px; background:var(--panel); }
    .integration-group > label{ margin:0 0 10px; font-weight:800; color:var(--ink); }
    .integration-group .wh-card{ margin:0 0 10px; }
    .integration-group .wh-card:last-child{ margin-bottom:0; }
    .users-page{ height:calc(100vh - 60px); min-height:0; display:grid; grid-template-rows:auto auto minmax(0,1fr); overflow:hidden; }
    .users-page > .panel-head{ margin-bottom:18px; }
    .users-toolbar{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:14px; }
    .users-toolbar .btn-leading{ width:auto; min-width:220px; margin:0; }
    .users-toolbar .user-summary{ justify-content:flex-end; }
    .users-page #usersList{ min-height:0; overflow-y:auto; align-content:start; padding-right:4px; scrollbar-width:thin; }
    .stat-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); }
    #leadsList,#usersList{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
    #leadsList .lead,#usersList .lead{ margin-bottom:0; }
    #auditList .tl-row{ padding:12px 4px; }
    .profile-card{ max-width:none; }

    .desktop-chat-shell{ height:calc(100vh - 116px); min-height:520px; display:grid; grid-template-columns:minmax(320px,380px) minmax(0,1fr); overflow:hidden; border:1px solid var(--line); border-radius:22px; background:var(--card); box-shadow:var(--shadow); }
    #chatRoot{ min-height:0; overflow-y:auto; padding:18px; border-right:1px solid var(--line); scrollbar-width:thin; }
    .desktop-chat-pane{ min-width:0; min-height:0; display:flex; align-items:stretch; justify-content:stretch; background:var(--bg); }
    .desktop-chat-empty{ width:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:40px; color:var(--muted); text-align:center; }
    .desktop-chat-empty img,.desktop-chat-empty svg{ width:38px; height:38px; opacity:.55; }
    .desktop-chat-empty b{ color:var(--ink); font-size:18px; }
    .desktop-chat-empty span{ max-width:360px; font-size:12px; line-height:1.6; }
    .desktop-chat-pane.active .desktop-chat-empty{ display:none; }
    .desktop-chat-pane .chat-screen{ width:100%; min-height:0; padding:22px 24px 20px; }
    .desktop-chat-pane .panel-head .back{ display:none; }
    .desktop-chat-pane .chat-msgs{ padding:8px 4px 14px; }
    .desktop-chat-pane .chat-msg{ max-width:68%; }
    .chat-page{ height:calc(100vh - 60px); }

    .modal-ov{ position:fixed; align-items:center; padding:32px; }
    .modal{ width:min(760px,calc(100vw - 80px)); max-height:88vh; border-radius:22px; padding:24px 26px 28px; }
    .modal-ov.lead-drawer,.modal-ov.task-drawer,.modal-ov.integration-drawer,.modal-ov.user-drawer{
      align-items:stretch;
      justify-content:flex-end;
      padding:0;
    }
    .modal-ov.lead-drawer .modal,.modal-ov.task-drawer .modal,.modal-ov.integration-drawer .modal,.modal-ov.user-drawer .modal{
      width:min(720px,calc(100vw - 320px));
      height:100vh;
      max-height:100vh;
      padding:28px 32px 40px;
      border-radius:24px 0 0 24px;
      box-shadow:-24px 0 64px rgba(14,18,28,.22);
      animation:lead-drawer-in .22s ease-out;
    }
    .modal-ov.lead-drawer .modal-h,.modal-ov.task-drawer .modal-h,.modal-ov.integration-drawer .modal-h,.modal-ov.user-drawer .modal-h{
      position:sticky;
      top:-28px;
      z-index:4;
      margin:-28px -32px 18px;
      padding:26px 32px 16px;
      border-bottom:1px solid var(--line);
      background:var(--card);
    }
    @keyframes lead-drawer-in{
      from{ transform:translateX(42px); opacity:.55; }
      to{ transform:translateX(0); opacity:1; }
    }
    #toasts{ position:fixed; left:auto; right:24px; bottom:24px; width:390px; }
    .diag-toast{ position:fixed; }
  }

  @media (min-width:1500px){
    #homeScroll{ padding-left:48px; padding-right:48px; }
    .desktop-page{ max-width:1440px; }
    .items-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); }
    #leadsList{ grid-template-columns:repeat(3,minmax(0,1fr)); }
    #usersList{ grid-template-columns:repeat(3,minmax(0,1fr)); }
    .kb-col{ flex-basis:320px; max-width:320px; }
  }

/* ===== Контакты и сделки (новая модель CRM) ===== */
.ch-kind-select{ max-width:132px; }
.doc-kind-select{ max-width:172px; }
.doc-file-input{ flex:1; min-width:0; font-size:12px; }
.contact-body{ max-height:60vh; overflow-y:auto; }
.contact-body .tl-row .del{ flex:0 0 auto; }

/* ===== Аналитика эффективности: таблица разрезов ===== */
.perf-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
.perf-table{ width:100%; border-collapse:collapse; font-size:12.5px; min-width:520px; }
.perf-table th, .perf-table td{ padding:8px 10px; text-align:left; border-bottom:1px solid var(--line); white-space:nowrap; }
.perf-table th{ color:var(--muted); font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.04em; }
.perf-table td.num, .perf-table th.num{ text-align:right; }
.perf-table tbody tr:hover{ background:var(--card); }

/* Резервные коды двухфакторного входа */
.recovery-codes{ margin:0; font-family:"JetBrains Mono",Consolas,monospace; font-size:14px;
  line-height:1.9; letter-spacing:.06em; white-space:pre; overflow-x:auto; }

/* ===== UI-доработки 2026-08-14 (по замечаниям Артура) ===== */

/* 1. Крупнее на десктопе — раньше был мелкий мобильный масштаб на большом экране */
@media (min-width:1100px){ body{ zoom:1.12; } }
@media (min-width:1700px){ body{ zoom:1.2; } }

/* 2. Плашки на главной — hover: подсветка + лёгкий подъём */
@media (hover:hover){
  .item2{ transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease; }
  .item2 .ibox{ transition:background .16s ease, color .16s ease, transform .16s ease; }
  .item2:hover{ transform:translateY(-4px); border-color:var(--danger-line); box-shadow:0 14px 30px rgba(180,41,50,.16); }
  .item2:hover .ibox{ background:var(--red); color:#fff; transform:scale(1.08); }
}

/* 6. Карточка клиента — по центру на ПК (вместо правой шторки) */
@media (min-width:1100px){
  .modal-ov.lead-center{ align-items:center; justify-content:center; padding:32px; }
  .modal-ov.lead-center .modal{ width:min(600px,calc(100vw - 80px)); max-height:88vh; margin:0;
    border-radius:22px; animation:mUp .22s ease-out; }
}

/* 7. Поля в карточке (Напомнить / Комментарий / История) — убрать блёклый серый */
.composer input, .composer .reminder-time{ background:var(--field); border:1px solid var(--line);
  border-radius:12px; color:var(--ink); }
.composer input::placeholder{ color:var(--muted); }
.composer input:focus, .composer .reminder-time:focus{ border-color:var(--danger-line);
  background:var(--field-focus); outline:none; }

/* 5. CRM: убрать внутренний скролл колонок — листаем всю страницу как таблицу (стиль amoCRM) */
@media (min-width:1100px){
  .crm-page{ height:auto; min-height:0; overflow:visible; grid-template-rows:auto auto auto auto; }
  .crm-page #crmBoard{ overflow-x:auto; overflow-y:visible; }
  .crm-page #crmBoard .kb-col{ height:auto; }
  .crm-page #crmBoard .kb-cards{ overflow:visible; padding-right:0; }
}
