/* ============= QAREKET CRM — STYLES ============= */
:root{
  --bg: #0b1220;
  --bg-2: #0f172a;
  --panel: #111a2e;
  --panel-2: #162136;
  --line: #1f2a44;
  --line-2: #243152;
  --text: #e6edf7;
  --muted: #8a98b3;
  --muted-2: #6b7895;
  --primary: #14b8a6;
  --primary-2: #0d9488;
  --accent: #22d3ee;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #a78bfa;
  --blue: #60a5fa;
  --pink: #f472b6;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
}
body.theme-light{
  --bg: #f4f6fb;
  --bg-2: #eef2f8;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #e6eaf2;
  --line-2: #d9deea;
  --text: #0f172a;
  --muted: #5b6781;
  --muted-2: #8590a8;
  --shadow: 0 8px 24px rgba(15,23,42,.08);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  -webkit-font-smoothing:antialiased;
  transition:background .25s,color .25s;
}
a{color:inherit;text-decoration:none;cursor:pointer}
button{font-family:inherit;cursor:pointer}
.muted{color:var(--muted)}
.ok-text{color:var(--green)}
.teal-text{color:var(--primary)}

/* ============= AUTH SCREEN ============= */
.auth-screen{
  position:fixed;inset:0;
  background:linear-gradient(135deg, #0b1220 0%, #111a2e 50%, #0f172a 100%);
  display:flex;align-items:center;justify-content:center;
  z-index:1000;
}
.auth-card{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);padding:40px;width:400px;max-width:90%;
  box-shadow:var(--shadow);
}
.auth-form{display:flex;flex-direction:column;gap:14px}
.auth-form label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted)}
.auth-form input{
  background:var(--panel-2);border:1px solid var(--line);
  padding:10px 14px;border-radius:8px;color:var(--text);font-size:14px;
  outline:none;transition:.15s;
}
.auth-form input:focus{border-color:var(--primary)}
.auth-error{color:var(--red);font-size:13px;text-align:center;margin-top:8px;min-height:20px}

/* ============= LAYOUT ============= */
.app{display:flex;min-height:100vh}
.sidebar{
  width:260px;flex-shrink:0;
  background:var(--panel);border-right:1px solid var(--line);
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
  transition:width .25s;
}
.sidebar.collapsed{width:76px}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-item .badge,
.sidebar.collapsed .integration-card{display:none}
.sidebar.collapsed .nav-item{justify-content:center}

.sidebar-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:18px 18px;border-bottom:1px solid var(--line);
}
.logo{display:flex;align-items:center;gap:10px}
.logo-mark{
  width:36px;height:36px;border-radius:10px;
  background:linear-gradient(135deg,var(--primary),var(--accent));
  display:flex;align-items:center;justify-content:center;color:#fff;
  box-shadow:0 4px 14px rgba(20,184,166,.4);
}
.logo-title{font-weight:800;font-size:15px;letter-spacing:.5px}
.logo-title span{color:var(--primary)}
.logo-sub{font-size:10px;color:var(--muted);letter-spacing:2px}

.icon-btn{
  background:transparent;border:none;color:var(--muted);
  width:34px;height:34px;border-radius:8px;
  display:inline-flex;align-items:center;justify-content:center;
  transition:.15s;
}
.icon-btn:hover{background:var(--panel-2);color:var(--text)}
.icon-btn .feather{width:18px;height:18px}

.nav{flex:1;padding:14px 10px;overflow-y:auto}
.nav-item{
  display:flex;align-items:center;gap:12px;
  padding:10px 12px;border-radius:10px;
  color:var(--muted);font-weight:500;
  margin-bottom:2px;position:relative;
  transition:.15s;cursor:pointer;
}
.nav-item:hover{background:var(--panel-2);color:var(--text)}
.nav-item.active{
  background:rgba(20,184,166,.12);color:var(--primary);
}
.nav-item.active::before{
  content:'';position:absolute;left:-10px;top:8px;bottom:8px;
  width:3px;border-radius:3px;background:var(--primary);
}
.nav-item .feather{width:18px;height:18px;flex-shrink:0}
.nav-item .badge{
  margin-left:auto;background:var(--primary);color:#fff;
  font-size:11px;font-weight:700;padding:2px 7px;border-radius:10px;
}
.nav-item .badge.orange{background:var(--orange)}

.sidebar-foot{padding:14px;border-top:1px solid var(--line)}
.integration-card{
  background:var(--panel-2);border:1px solid var(--line);
  border-radius:12px;padding:12px;
}
.integ-head{display:flex;gap:10px;align-items:center;margin-bottom:8px}
.integ-icon{
  width:30px;height:30px;border-radius:8px;background:#0a66c2;
  display:flex;align-items:center;justify-content:center;color:#fff;
}
.integ-icon .feather{width:16px;height:16px}
.integ-title{font-weight:600;font-size:13px}
.integ-status{font-size:11px;color:var(--muted);display:flex;align-items:center;gap:4px}
.dot{width:6px;height:6px;border-radius:50%;background:var(--muted)}
.dot.ok{background:var(--green);box-shadow:0 0 0 3px rgba(34,197,94,.18)}
.integ-meta{font-size:11px;color:var(--muted);margin-bottom:10px;line-height:1.5}

/* ============= MAIN ============= */
.main{flex:1;display:flex;flex-direction:column;min-width:0}

.topbar{
  display:flex;align-items:center;gap:12px;
  padding:10px 16px;
  background:var(--panel);border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:30;
  overflow-x:hidden;min-width:0;
}
.search{
  flex:1;max-width:520px;position:relative;
  display:flex;align-items:center;background:var(--panel-2);
  border:1px solid var(--line);border-radius:10px;padding:0 12px;
}
.search .feather{width:16px;height:16px;color:var(--muted)}
.search input{
  flex:1;background:transparent;border:none;outline:none;
  color:var(--text);font-size:13px;padding:9px 8px;
}
.kbd{
  font-size:11px;color:var(--muted);
  background:var(--bg-2);border:1px solid var(--line);
  padding:2px 6px;border-radius:5px;
}
.top-actions{margin-left:auto;display:flex;align-items:center;gap:8px}
.notif{position:relative}
.dot-badge{
  position:absolute;top:3px;right:3px;min-width:16px;height:16px;
  background:var(--red);color:#fff;font-size:10px;font-weight:700;
  border-radius:10px;display:flex;align-items:center;justify-content:center;
  padding:0 4px;border:2px solid var(--panel);
}
.sync-pill{
  display:flex;align-items:center;gap:6px;
  background:var(--panel-2);border:1px solid var(--line);
  padding:6px 10px;border-radius:8px;font-size:12px;color:var(--muted);
}
.sync-pill .feather{width:14px;height:14px}
.status-dot{width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 0 3px rgba(34,197,94,.18)}

.user-chip{
  display:flex;align-items:center;gap:10px;
  background:var(--panel-2);border:1px solid var(--line);
  padding:5px 10px 5px 5px;border-radius:30px;cursor:pointer;
}
.user-chip img{width:32px;height:32px;border-radius:50%}
.u-name{font-size:13px;font-weight:600}
.u-role{font-size:11px;color:var(--muted)}
.user-chip .feather{width:14px;height:14px;color:var(--muted)}

/* ============= VIEWS ============= */
.views{padding:26px;flex:1}
.view{display:none}
.view.active{display:block;animation:fadeIn .25s}
@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

.page-head{
  display:flex;align-items:flex-start;justify-content:space-between;
  margin-bottom:22px;gap:16px;flex-wrap:wrap;
}
.page-head h1{font-size:22px;font-weight:700;margin:0 0 4px}
.page-head .muted{font-size:13px}
.page-sub{font-size:12px;color:var(--muted);font-weight:400;margin-left:8px}
.page-head-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}

.date-pill,.filter-pill{
  display:inline-flex;align-items:center;gap:6px;
  background:var(--panel);border:1px solid var(--line);
  padding:8px 12px;border-radius:8px;font-size:13px;color:var(--muted);
}
.filter-pill.sm{padding:5px 10px;font-size:12px}
.date-pill .feather,.filter-pill .feather{width:14px;height:14px}

.btn{
  display:inline-flex;align-items:center;gap:6px;
  border:none;background:var(--panel-2);color:var(--text);
  padding:8px 14px;border-radius:8px;font-size:13px;font-weight:500;
  border:1px solid var(--line);transition:.15s;
}
.btn:hover{background:var(--line)}
.btn .feather{width:15px;height:15px}
.btn-primary{
  background:var(--primary);border-color:var(--primary);color:#fff;
}
.btn-primary:hover{background:var(--primary-2);border-color:var(--primary-2)}
.btn-ghost{background:transparent;color:var(--muted)}
.btn-block{width:100%;justify-content:center}

/* ============= KPI ============= */
.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px;margin-bottom:18px}
.kpi-card{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);padding:16px;
  transition:.2s;
}
.kpi-card:hover{border-color:var(--line-2);transform:translateY(-1px)}
.kpi-top{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.kpi-icon{
  width:34px;height:34px;border-radius:9px;
  display:flex;align-items:center;justify-content:center;color:#fff;
}
.kpi-icon .feather{width:17px;height:17px}
.kpi-icon.teal{background:rgba(20,184,166,.18);color:var(--primary)}
.kpi-icon.green{background:rgba(34,197,94,.18);color:var(--green)}
.kpi-icon.orange{background:rgba(245,158,11,.18);color:var(--orange)}
.kpi-icon.purple{background:rgba(167,139,250,.18);color:var(--purple)}
.kpi-icon.red{background:rgba(239,68,68,.18);color:#ef4444}
.kpi-label{font-size:12px;color:var(--muted)}
.kpi-value{font-size:24px;font-weight:700;margin-bottom:8px}
.kpi-foot{display:flex;align-items:center;justify-content:space-between;font-size:11px}
.kpi-foot .up{color:var(--green);font-weight:600}
.spark{width:80px;height:30px}

/* ============= PANEL ============= */
.panel{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);padding:18px;margin-bottom:14px;
}
.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.panel-title{font-weight:600;font-size:15px}
.panel-foot-link{
  display:inline-block;margin-top:8px;color:var(--primary);
  font-size:13px;font-weight:500;
}

/* GRIDS */
.grid-2-1{display:grid;grid-template-columns:1.6fr 1fr;gap:14px;margin-bottom:14px}
.grid-3{display:grid;grid-template-columns:1fr 1.4fr 1fr;gap:14px}

@media(max-width:1200px){
  .grid-2-1,.grid-3{grid-template-columns:1fr}
  .kpi-grid{grid-template-columns:repeat(2,1fr)}
}

/* TABLE */
.table-wrap{overflow-x:auto}
.table{width:100%;border-collapse:collapse;font-size:13px}
.table th{text-align:left;padding:10px 12px;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);border-bottom:1px solid var(--line)}
.table td{padding:12px 12px;border-bottom:1px solid var(--line)}
.table tr:hover td{background:var(--panel-2)}
.status-pill{display:inline-block;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600;background:rgba(239,68,68,.12);color:#ef4444}
.status-pill.ok{background:rgba(34,197,94,.12);color:#22c55e}
.data-table{width:100%;border-collapse:collapse;font-size:13px}
.data-table th{
  text-align:left;color:var(--muted);font-weight:500;
  padding:10px 12px;border-bottom:1px solid var(--line);
  font-size:12px;
}
.data-table td{
  padding:14px 12px;border-bottom:1px solid var(--line);
  vertical-align:middle;
}
.data-table tr:hover td{background:var(--panel-2)}
.data-table.big td{padding:14px 12px}
.lead-id{color:var(--primary);font-weight:600;cursor:pointer}
.cell-user{display:inline-flex;align-items:center;gap:8px}
.cell-user img{width:24px;height:24px;border-radius:50%}
.cell-date{color:var(--muted);font-size:12px;line-height:1.4}

.status{
  display:inline-block;padding:4px 10px;border-radius:20px;
  font-size:11px;font-weight:600;
}
.status[data-status="Новая"]{background:rgba(96,165,250,.15);color:#60a5fa}
.status[data-status="В работе"]{background:rgba(20,184,166,.15);color:var(--primary)}
.status[data-status="Ожидает КП"]{background:rgba(245,158,11,.15);color:var(--orange)}
.status[data-status="Завершена"]{background:rgba(34,197,94,.15);color:var(--green)}
.status[data-status="Отклонена"]{background:rgba(239,68,68,.15);color:var(--red)}
.status[data-status="Черновик"]{background:rgba(138,152,179,.18);color:var(--muted)}
.status[data-status="Отправлено"]{background:rgba(96,165,250,.15);color:#60a5fa}
.status[data-status="Принято"]{background:rgba(34,197,94,.15);color:var(--green)}

.row-action{
  background:transparent;border:1px solid var(--line);color:var(--muted);
  padding:4px 8px;border-radius:6px;font-size:11px;margin-right:4px;
}
.row-action:hover{color:var(--primary);border-color:var(--primary)}
.row-action.primary{color:var(--primary);border-color:rgba(20,184,166,.4)}

/* ACTIVITY */
.activity{list-style:none;margin:0;padding:0}
.activity li{
  display:flex;gap:10px;padding:10px 0;
  border-bottom:1px solid var(--line);
}
.activity li:last-child{border-bottom:none}
.act-ico{
  width:30px;height:30px;border-radius:8px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
}
.act-ico .feather{width:14px;height:14px;color:#fff}
.act-body{flex:1;font-size:13px}
.act-title{font-weight:500}
.act-sub{font-size:12px;color:var(--muted);margin-top:2px}
.act-time{font-size:11px;color:var(--muted-2);white-space:nowrap}

/* DONUT */
.donut-wrap{position:relative;height:200px;display:flex;align-items:center;justify-content:center}
.donut-wrap canvas{max-height:200px}
.donut-center{position:absolute;text-align:center;left:0;right:0;pointer-events:none}
.donut-center .dc-val{font-size:26px;font-weight:700}
.donut-center .dc-lbl{font-size:11px;color:var(--muted)}
.legend{list-style:none;margin:8px 0 0;padding:0;display:grid;grid-template-columns:1fr 1fr;gap:6px;font-size:12px}
.legend li{display:flex;align-items:center;gap:6px;color:var(--muted)}
.legend .lg-dot{width:8px;height:8px;border-radius:50%}
.legend b{color:var(--text);margin-left:auto;font-weight:600}

/* REVENUE */
.rev-head{display:flex;justify-content:space-between;align-items:flex-end;margin-bottom:8px}
.rev-val{font-size:22px;font-weight:700}
.rev-delta{font-size:12px}
.rev-delta.up{color:var(--green)}

/* TASKS */
.task-list{list-style:none;margin:0;padding:0}
.task-list li{
  display:flex;align-items:center;gap:8px;
  padding:8px 0;border-bottom:1px dashed var(--line);
  font-size:13px;
}
.task-list li:last-child{border-bottom:none}
.task-list .t-check{
  width:16px;height:16px;border:1.5px solid var(--muted);border-radius:4px;flex-shrink:0;
}
.task-list .t-check.done{background:var(--primary);border-color:var(--primary);position:relative}
.task-list .t-check.done::after{content:'✓';color:#fff;font-size:11px;position:absolute;top:-2px;left:2px;font-weight:700}
.task-list .t-text{flex:1}
.task-list .t-date{font-size:11px;color:var(--orange)}
.task-list li.done .t-text{color:var(--muted);text-decoration:line-through}

/* FILTERS */
.filters-bar{display:flex;justify-content:space-between;gap:10px;margin-bottom:14px;flex-wrap:wrap}
.filter-tabs{display:flex;gap:4px;background:var(--panel);border:1px solid var(--line);padding:4px;border-radius:10px;flex-wrap:wrap}
.ft{
  background:transparent;border:none;color:var(--muted);
  padding:6px 12px;border-radius:7px;font-size:12px;font-weight:500;
  display:flex;align-items:center;gap:6px;transition:.15s;cursor:pointer;
}
.ft:hover{color:var(--text)}
.ft.active{background:var(--panel-2);color:var(--text)}
.ft b{font-size:11px;background:var(--line);padding:1px 6px;border-radius:8px;color:var(--muted)}
.ft.active b{background:var(--primary);color:#fff}
.search-inline{
  background:var(--panel);border:1px solid var(--line);
  padding:8px 14px;border-radius:8px;color:var(--text);font-size:13px;
  min-width:260px;outline:none;
}

/* CLIENTS */
.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px}
.client-card{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);padding:16px;
}
.cc-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.cc-logo{
  width:42px;height:42px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:700;font-size:16px;
}
.cc-name{font-weight:600}
.cc-bin{font-size:11px;color:var(--muted)}
.cc-stats{display:flex;gap:14px;font-size:12px;color:var(--muted);margin-top:6px}
.cc-stats b{display:block;color:var(--text);font-size:15px}

/* PRODUCTS */
.prod-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
.prod-card{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;
  transition:.2s;
}
.prod-card:hover{border-color:var(--primary);transform:translateY(-2px);box-shadow:var(--shadow)}
.prod-img{
  height:120px;
  display:flex;align-items:center;justify-content:center;
  font-size:38px;
}
.prod-info{padding:12px;flex:1;display:flex;flex-direction:column}
.prod-cat{font-size:10px;color:var(--primary);font-weight:600;text-transform:uppercase;letter-spacing:.5px}
.prod-name{font-size:13px;font-weight:600;margin:4px 0 8px;line-height:1.3}
.prod-foot{display:flex;justify-content:space-between;align-items:center;margin-top:auto}
.prod-price{font-weight:700;font-size:15px}
.prod-stock{font-size:11px;color:var(--green)}
.prod-stock.low{color:var(--orange)}
.prod-stock.out{color:var(--red)}
.prod-stock-edit{display:flex;align-items:center;gap:4px;margin-top:2px;transition:outline .2s}
.stock-btn{width:20px;height:20px;border-radius:5px;border:1px solid var(--line);background:var(--panel-2);
  color:var(--text);font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.stock-btn:hover{background:var(--primary);color:#fff;border-color:var(--primary)}
.stock-input{width:48px;height:20px;text-align:center;font-size:12px;font-weight:600;border:1px solid var(--line);
  border-radius:5px;background:var(--panel);color:var(--text);padding:0 2px}
.stock-input:focus{outline:1px solid var(--primary)}

/* Табличный режим Склада — плотные строки для быстрого ввода остатков */
.prod-stock-table{width:100%;border-collapse:collapse}
.prod-stock-table th{text-align:left;font-size:10px;text-transform:uppercase;letter-spacing:.05em;
  color:var(--muted);padding:6px 8px;border-bottom:1px solid var(--line)}
.prod-stock-table td{padding:3px 8px;border-bottom:1px solid var(--line);font-size:12px;vertical-align:middle;line-height:1.3}
.prod-stock-table tr:hover{background:var(--panel-2)}
.prod-stock-table .stock-input{width:56px;height:24px;font-size:12px}
.prod-stock-table .stock-btn{width:22px;height:22px}
.prod-stock-table .prod-id-cell{font-family:monospace;font-size:11px;color:var(--muted);white-space:nowrap}
.prod-note-input{width:100%;min-width:120px;height:24px;font-size:12px;border:1px solid var(--line);
  border-radius:5px;background:var(--panel);color:var(--text);padding:0 6px;transition:outline .2s}
.prod-note-input:focus{outline:1px solid var(--primary)}
.prod-note-input::placeholder{color:var(--muted);font-style:italic}

.wp-tag{
  font-size:9px;background:rgba(127,84,179,.2);color:#a78bfa;
  padding:2px 6px;border-radius:4px;font-weight:600;
}

/* KANBAN */
.kanban{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.kanban-col{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);padding:12px;min-height:400px;
  display:flex;flex-direction:column;
}
.kc-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-weight:600;font-size:13px}
.kc-head b{background:var(--line);font-size:11px;padding:2px 8px;border-radius:10px;font-weight:600}
.kc-cards{flex:1;min-height:80px;transition:background .15s}
.kc-cards.drag-over{background:rgba(20,184,166,.08);border-radius:8px;outline:2px dashed var(--accent)}
.kanban-card{
  background:var(--panel-2);border:1px solid var(--line);
  border-radius:10px;padding:10px;margin-bottom:8px;
  font-size:12px;cursor:pointer;transition:border-color .15s,transform .1s;
}
.kanban-card:hover{border-color:var(--accent);transform:translateY(-1px)}
.kanban-card.dragging{opacity:.5;transform:scale(.97)}
.kc-card-title{font-weight:600;font-size:13px;margin-bottom:6px}
.kc-card-meta{display:flex;justify-content:space-between;color:var(--muted);font-size:11px;margin-top:8px;align-items:center}
.kc-card-meta img{width:20px;height:20px;border-radius:50%;object-fit:cover}

@media(max-width:1000px){.kanban{grid-template-columns:repeat(2,1fr)}}


/* MAIL */
/* ===== OUTLOOK-STYLE MAIL ===== */
.mail-section{height:calc(100vh - 120px);display:flex;flex-direction:column}
.mail-shell{display:grid;grid-template-columns:200px 320px 1fr;height:100%;gap:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--panel)}

/* Sidebar */
.mail-sidebar{display:flex;flex-direction:column;background:var(--panel-2);border-right:1px solid var(--line);padding:12px 8px;gap:4px}
.mail-sidebar-top{padding:0 4px 12px}
.mail-sidebar-top .btn{width:100%;justify-content:center}
.mail-folders{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:2px}
.mf-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:8px;cursor:pointer;font-size:13px;color:var(--text);transition:.15s;user-select:none}
.mf-item:hover{background:var(--panel)}
.mf-item.active{background:rgba(20,184,166,.12);color:var(--primary);font-weight:600}
.mf-item .feather{width:15px;height:15px;flex-shrink:0}
.mf-item span{flex:1}
.mf-count{background:var(--primary);color:#fff;font-size:10px;font-weight:700;padding:1px 6px;border-radius:10px;min-width:18px;text-align:center}
/* Многоящичный сайдбар */
.mf-account-group{list-style:none}
.mf-account-header{display:flex;align-items:center;gap:6px;padding:7px 10px 5px;cursor:pointer;border-radius:8px;font-size:12px;font-weight:600;color:var(--text);user-select:none;transition:.15s}
.mf-account-header:hover{background:var(--panel)}
.mf-account-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}
.mf-account-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.mf-chevron{transition:transform .2s;flex-shrink:0}
.mf-account-group.collapsed .mf-chevron{transform:rotate(-90deg)}
.mf-account-folders{list-style:none;padding:0 0 4px 10px;margin:0;display:flex;flex-direction:column;gap:1px}
.mf-account-folders.hidden{display:none}
.mf-account-folders .mf-item{padding:6px 10px;font-size:12.5px}
.mf-sep{margin-top:4px;border-top:1px solid var(--line);padding-top:8px}
.mail-settings-link{display:flex;align-items:center;gap:6px;background:none;border:none;cursor:pointer;color:var(--muted);font-size:12px;padding:8px 10px;border-radius:8px;width:100%;text-align:left;transition:.15s}
.mail-settings-link:hover{color:var(--text);background:var(--panel)}
.mail-settings-link .feather{width:14px;height:14px}

/* List column */
.mail-list-col{display:flex;flex-direction:column;border-right:1px solid var(--line);background:var(--panel)}
.mail-list-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px 8px;font-weight:700;font-size:14px;flex-shrink:0}
.mail-search-row{display:flex;align-items:center;gap:8px;margin:0 10px 8px;background:var(--panel-2);border:1px solid var(--line);border-radius:8px;padding:6px 10px;flex-shrink:0}
.mail-search-row .feather{width:14px;height:14px;color:var(--muted);flex-shrink:0}
.mail-search{background:none;border:none;outline:none;font-size:13px;color:var(--text);width:100%}
.mail-list-items{overflow-y:auto;flex:1}

/* Mail item row */
.mail-item-row{display:flex;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line);cursor:pointer;transition:.12s;align-items:flex-start;position:relative}
.mail-item-row:hover{background:var(--panel-2)}
.mail-item-row.active{background:rgba(20,184,166,.08);border-left:3px solid var(--primary);padding-left:11px}
.mail-item-row.unread .mir-from,.mail-item-row.unread .mir-subject{font-weight:700}
.mir-restore-btn{position:absolute;right:10px;top:50%;transform:translateY(-50%);width:30px;height:30px;border-radius:50%;
  background:var(--panel);border:1px solid var(--line);color:#22c55e;display:flex;align-items:center;justify-content:center;
  cursor:pointer;opacity:0;transition:opacity .15s;flex-shrink:0}
.mail-item-row:hover .mir-restore-btn{opacity:1}
.mir-restore-btn:hover{background:#22c55e;color:#fff;border-color:#22c55e}
.mir-restore-btn svg{width:14px;height:14px}
.mir-avatar{width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,var(--primary),var(--secondary));display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;color:#fff;flex-shrink:0}
.mir-body{flex:1;min-width:0}
.mir-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:3px}
.mir-from{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:160px}
.mir-time{font-size:11px;color:var(--muted);flex-shrink:0}
.mir-subject{font-size:13px;margin-bottom:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mir-preview{font-size:11px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:4px}
.mir-tags{display:flex;gap:4px;flex-wrap:wrap}
.mir-badge{font-size:10px;padding:1px 6px;border-radius:4px;font-weight:600}
.mir-badge.lead{background:rgba(20,184,166,.15);color:var(--primary)}
.mir-badge.attach{background:var(--panel-2);color:var(--muted)}

/* Content column */
.mail-content-col{overflow-y:auto;background:var(--bg)}
.mail-empty-state{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--muted);gap:12px;padding:40px}
.mail-empty-state .feather{width:48px;height:48px;opacity:.3}
.mv-wrapper{padding:28px 32px;max-width:900px}
.mv-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}
.mv-subject{font-size:22px;font-weight:700;line-height:1.3;flex:1}
.mv-actions-row{display:flex;gap:6px;flex-shrink:0;flex-wrap:wrap}
.mv-meta-row{display:flex;align-items:center;gap:12px;padding:14px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);margin-bottom:18px}
.mv-sender-ava{width:40px;height:40px;border-radius:50%;background:linear-gradient(135deg,var(--primary),var(--secondary));display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:700;color:#fff;flex-shrink:0}
.mv-sender-details{flex:1;min-width:0}
.mv-sender-name{font-weight:600;font-size:14px}
.mv-sender-addr{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mv-date-str{font-size:12px;color:var(--muted);flex-shrink:0}
.mv-attachments{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:12px 16px;margin-bottom:18px}
.mv-att-label{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;margin-bottom:10px;color:var(--muted)}
.mv-att-label .feather{width:14px;height:14px}
.mv-att-list{display:flex;flex-wrap:wrap;gap:8px}
.mv-att-chip{display:flex;align-items:center;gap:6px;background:var(--panel-2);border:1px solid var(--line);border-radius:8px;padding:6px 12px;font-size:12px;text-decoration:none;color:var(--text);transition:.15s}
.mv-att-chip:hover{border-color:var(--primary);color:var(--primary)}
.mv-att-chip .feather{width:14px;height:14px}
.mv-att-chip small{color:var(--muted)}
.mv-body-wrap{font-size:14px;line-height:1.8}
.mv-body-wrap p{margin:0 0 12px}
.lead-banner{background:rgba(20,184,166,.1);border:1px solid rgba(20,184,166,.3);border-radius:10px;padding:10px 14px;margin-bottom:16px;display:flex;align-items:center;gap:10px;font-size:13px}
.lead-banner .feather{color:var(--primary);width:16px;height:16px}

/* Compose */
.compose-card{width:700px;max-width:96vw;display:flex;flex-direction:column;max-height:90vh}
.compose-card .modal-body{flex:1;overflow:hidden;display:flex;flex-direction:column;padding:0!important}
.compose-fields{border-bottom:1px solid var(--line)}
.compose-field-row{display:flex;align-items:center;gap:0;border-bottom:1px solid var(--line);padding:0 16px}
.compose-field-row:last-child{border-bottom:none}
.compose-label{font-size:12px;color:var(--muted);width:50px;flex-shrink:0;font-weight:500}
.compose-input{flex:1;background:none;border:none;outline:none;padding:10px 0;font-size:14px;color:var(--text)}
.compose-select{flex:1;background:none;border:none;outline:none;padding:10px 0;font-size:14px;color:var(--text);cursor:pointer}
.attach-row{align-items:flex-start;padding:8px 16px}
.compose-attach-list{display:flex;flex-wrap:wrap;gap:6px;flex:1}
.attach-chip{display:inline-flex;align-items:center;gap:4px;background:var(--panel-2);border:1px solid var(--line);border-radius:6px;padding:3px 8px;font-size:12px}
.attach-chip .feather{width:12px;height:12px}
.compose-toolbar{display:flex;align-items:center;gap:4px;padding:6px 12px;border-bottom:1px solid var(--line);background:var(--panel-2);flex-shrink:0}
.compose-tool{display:flex;align-items:center;gap:5px;background:none;border:none;cursor:pointer;color:var(--muted);font-size:12px;padding:5px 8px;border-radius:6px;transition:.15s}
.compose-tool:hover{background:var(--panel);color:var(--text)}
.compose-tool .feather{width:14px;height:14px}
.compose-tool-sep{width:1px;height:16px;background:var(--line);margin:0 4px}
.compose-body-wrap{flex:1;overflow:hidden;display:flex}
.compose-textarea{flex:1;background:none;border:none;outline:none;resize:none;padding:16px;font-size:14px;line-height:1.7;color:var(--text);font-family:inherit;min-height:200px}

@media(max-width:900px){
  .mail-shell{grid-template-columns:0 1fr 0}
  .mail-sidebar,.mail-list-col{display:none}
  .mail-content-col{display:block}
}


/* SETTINGS */
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media(max-width:900px){.settings-grid{grid-template-columns:1fr}}
.settings-card h3{font-size:15px;display:flex;align-items:center;gap:8px;margin:0 0 6px}
.settings-card h3 .feather{width:18px;height:18px;color:var(--primary)}
.form{display:flex;flex-direction:column;gap:10px;margin-top:14px}
.form label{display:flex;flex-direction:column;gap:5px;font-size:12px;color:var(--muted)}
.form .row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.form input,.form select,.form textarea{
  background:var(--panel-2);border:1px solid var(--line);
  padding:8px 12px;border-radius:8px;color:var(--text);font-size:13px;
  font-family:inherit;outline:none;
}
.form input:focus,.form select:focus,.form textarea:focus{border-color:var(--primary)}
.form .checkbox{flex-direction:row;align-items:center;gap:6px;color:var(--text);font-size:13px}

/* Универсальный класс для input/select вне .form обёртки (модалки, фильтры) */
.input{
  background:var(--panel-2);border:1px solid var(--line);
  padding:8px 12px;border-radius:8px;color:var(--text);font-size:13px;
  font-family:inherit;outline:none;
}
.input:focus{border-color:var(--primary)}

/* EMPTY */
.empty{text-align:center;padding:40px;color:var(--muted)}
.empty .feather{width:48px;height:48px;opacity:.4;margin-bottom:8px}

/* ============= NOTIFICATIONS POPUP ============= */
.notif-popup{
  position:fixed;top:62px;right:24px;width:380px;
  background:var(--panel);border:1px solid var(--line);
  border-radius:12px;box-shadow:var(--shadow);
  z-index:90;opacity:0;transform:translateY(-8px);
  pointer-events:none;transition:.2s;
}
.notif-popup.open{opacity:1;transform:translateY(0);pointer-events:auto}
.np-head{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line);font-size:14px}
.np-head a{font-size:12px;color:var(--primary);cursor:pointer}
.np-list{list-style:none;margin:0;padding:0;max-height:400px;overflow-y:auto}
.np-list li{display:flex;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line)}
.np-list li:last-child{border-bottom:none}
.np-ico{width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:#fff}
.np-ico .feather{width:15px;height:15px}
.np-body{font-size:13px;flex:1}
.np-title{font-weight:500}
.np-sub{font-size:11px;color:var(--muted);margin-top:2px}

/* ============= TOAST ============= */
.toast-wrap{position:fixed;top:80px;right:24px;z-index:200;display:flex;flex-direction:column;gap:8px}
.toast{
  background:var(--panel);border:1px solid var(--line);border-left:3px solid var(--primary);
  border-radius:10px;padding:12px 16px;display:flex;gap:10px;align-items:center;
  box-shadow:var(--shadow);min-width:280px;
  animation:slideIn .3s;
}
.toast.success{border-left-color:var(--green)}
.toast.warning{border-left-color:var(--orange)}
.toast .feather{width:18px;height:18px;color:var(--primary)}
.toast.success .feather{color:var(--green)}
.toast.warning .feather{color:var(--orange)}
.toast-body{font-size:13px}
.toast-title{font-weight:600}
.toast-sub{font-size:11px;color:var(--muted);margin-top:2px}
@keyframes slideIn{from{transform:translateX(20px);opacity:0}to{transform:none;opacity:1}}

/* ============= MODAL ============= */
.modal{
  position:fixed;inset:0;background:rgba(8,12,24,.7);backdrop-filter:blur(4px);
  display:none;align-items:flex-start;justify-content:center;
  padding:60px 20px 20px;z-index:100;overflow-y:auto;
}
.modal.open{display:flex}
.modal-card{
  background:var(--panel);border:1px solid var(--line);
  border-radius:14px;width:520px;max-width:100%;
  box-shadow:var(--shadow);animation:slideIn .25s;
}
.modal-card.xl{width:900px}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;border-bottom:1px solid var(--line)}
.modal-head h3{margin:0;font-size:16px}
.modal-body{padding:18px 20px;max-height:65vh;overflow-y:auto}
.modal-foot{padding:14px 20px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:8px}

.users-pick{list-style:none;margin:14px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.users-pick li{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:10px;border:1.5px solid var(--line);cursor:pointer;
  transition:.15s;
}
.users-pick li:hover{border-color:var(--line-2)}
.users-pick li.selected{border-color:var(--primary);background:rgba(20,184,166,.08)}
.users-pick img{width:34px;height:34px;border-radius:50%}
.users-pick b{display:block;font-size:13px}
.users-pick span{font-size:11px;color:var(--muted)}
.users-pick li > div{flex:1}

/* ===== SIDE PANEL (Lead Detail) ===== */
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1000;
  background: rgba(0,0,0,.4);
  display: flex; justify-content: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.side-panel.open { opacity: 1; pointer-events: all; }
.side-panel-inner {
  width: 640px; max-width: 96vw;
  background: var(--panel);
  height: 100%; overflow-y: auto;
  display: flex; flex-direction: column;
  transform: translateX(60px);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,.35);
}
.side-panel.open .side-panel-inner { transform: translateX(0); }
.sp-loading { display: flex; align-items: center; gap: 10px; padding: 40px; color: var(--muted); font-size: 14px; }
.sp-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 24px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.sp-badges { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--line); }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.sp-body { padding: 0; flex: 1; }
.sp-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.sp-section:last-child { border-bottom: none; }
.sp-section-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 14px;
}
.sp-section-title .feather { width: 13px; height: 13px; }
.sp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sp-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.sp-email-card {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
}
.sp-email-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.sp-email-subject { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.sp-email-body {
  font-size: 13px; line-height: 1.6; color: var(--muted);
  max-height: 200px; overflow-y: auto;
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px;
  white-space: pre-wrap; word-break: break-word;
}
.sp-comment-form { display: flex; gap: 8px; margin-bottom: 14px; }
.sp-comment-ta {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
  color: var(--text); font-family: inherit; resize: none; outline: none;
  transition: border-color .15s;
}
.sp-comment-ta:focus { border-color: var(--primary); }
.sp-timeline { display: flex; flex-direction: column; gap: 8px; }
.sp-timeline-item {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px;
}
.sp-timeline-item.comment .sp-tl-body {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; flex: 1;
}
.sp-tl-ava { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-top: 2px; }
.sp-tl-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); border: 2px solid var(--panel-2);
  flex-shrink: 0; margin-top: 6px; margin-left: 9px;
}
.sp-tl-body { flex: 1; }
.sp-tl-author { font-weight: 600; }
.sp-tl-text { color: var(--text); }
.sp-tl-time { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ===== TASK COMMENTS ===== */
.task-comment { display: flex; gap: 10px; align-items: flex-start; }
.tc-body {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 13px;
}
.tc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 13px; }
.tc-text { font-size: 13px; line-height: 1.6; color: var(--text); }

/* ===== ATTACH EMAIL LIST ===== */
.attach-email-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.attach-email-item {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; transition: .15s;
}
.attach-email-item:hover { background: var(--panel-2); border-color: var(--primary); }
.attach-email-item.selected { background: rgba(20,184,166,.1); border-color: var(--primary); }

/* ===== LEAD ROW CLICKABLE ===== */
.lead-row { cursor: pointer; }
.lead-row:hover td { background: var(--panel-2); }
.status-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 6px; white-space: nowrap;
}

/* Интерактивный select, выглядящий как status-badge */
.status-badge-select {
  font-size: 11px; font-weight: 600;
  padding: 3px 22px 3px 9px; border-radius: 6px; white-space: nowrap;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a98b3' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  outline: none;
}
.status-badge-select option { background: var(--panel); color: var(--text); font-weight: 500; }
.status-badge-select:hover { filter: brightness(1.1); }

/* ===== USER CHECK ROW ===== */
.user-check-row:hover { background: var(--panel-2); border-color: var(--primary) !important; }

/* ===== LOGO UPGRADE ===== */
.logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}

/* Search inline (в модалках) */
.search-inline {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
  color: var(--text); outline: none; transition: border-color .15s;
  box-sizing: border-box;
}
.search-inline:focus { border-color: var(--primary); }

/* Kanban аватарки стэком */
.kc-card-meta img:first-child { margin-left: 0 !important; }

/* ===== REAL LOGO IN SIDEBAR ===== */
.sidebar-logo-img {
  max-width: 160px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: brightness(1.05);
  transition: opacity .2s;
}
.sidebar.collapsed .sidebar-logo-img {
  max-width: 38px;
  object-fit: cover;
  object-position: left center;
}
.sidebar-head .logo {
  display: flex;
  align-items: center;
  overflow: hidden;
}
.auth-card img {
  display: block;
  margin: 0 auto;
}

/* ===== CALENDAR ===== */
.cal-shell { display: flex; flex-direction: column; gap: 20px; }
.cal-header { display: flex; align-items: center; gap: 14px; }
.cal-header h2 { font-size: 20px; font-weight: 700; flex: 1; text-align: center; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; text-transform: uppercase; }
.cal-day {
  min-height: 90px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; cursor: pointer; transition: border-color .15s, background .15s;
  position: relative;
}
.cal-day:hover { border-color: var(--primary); background: var(--panel-3, var(--panel-2)); }
.cal-day.today { border-color: var(--primary); }
.cal-day.other-month .cal-day-num { color: var(--muted); opacity: .4; }
.cal-day.selected { background: rgba(20,184,166,.12); border-color: var(--primary); }
.cal-day-num { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-day.today .cal-day-num {
  background: var(--primary); color: #fff; width: 22px; height: 22px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.cal-event-dot {
  font-size: 10px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(20,184,166,.18); color: var(--primary); font-weight: 500;
  display: block;
}
.cal-event-dot.reminder { background: rgba(245,158,11,.18); color: #f59e0b; }
.cal-event-dot.meeting { background: rgba(99,102,241,.18); color: #818cf8; }
.cal-event-dot.task { background: rgba(34,197,94,.18); color: #22c55e; }
.cal-sidebar { min-width: 280px; max-width: 300px; }
.cal-detail-panel { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.cal-detail-panel h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.cal-event-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 8px; cursor: pointer; transition: border-color .15s;
}
.cal-event-item:hover { border-color: var(--primary); }
.cal-event-color { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; }
.cal-event-title { font-size: 13px; font-weight: 500; }
.cal-event-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cal-layout { display: flex; gap: 20px; align-items: flex-start; }
.cal-main { flex: 1; min-width: 0; }
.cal-add-btn { width: 100%; }

/* ===== NOTIFICATION SOUND INDICATOR ===== */
.notif-sound-toggle { cursor: pointer; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.notif-sound-toggle.on { color: var(--primary); }

/* ===== MESSENGER ===== */
.messenger-section { height: calc(100vh - 60px); display: flex; flex-direction: column; padding: 0 !important; }
.messenger-shell { display: flex; flex: 1; height: 100%; overflow: hidden; }
.msg-sidebar { width: 300px; flex-shrink: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--panel); }
.msg-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.msg-search-wrap { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.msg-search-wrap svg { color: var(--muted); width: 15px; height: 15px; flex-shrink: 0; }
.msg-search-wrap input { background: none; border: none; outline: none; font-size: 13px; color: var(--text); flex: 1; }
.msg-chat-list { flex: 1; overflow-y: auto; }
.msg-loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--muted); gap: 8px; }

.chat-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; transition: background .12s; position: relative; border-bottom: 1px solid var(--line); }
.chat-row:hover { background: var(--panel-2); }
.chat-row.active { background: rgba(20,184,166,.1); }
.chat-row-ava { position: relative; flex-shrink: 0; }
.chat-avatar-img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.chat-avatar-img.sm { width: 28px; height: 28px; }
.chat-avatar-letter { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.chat-avatar-letter.sm { width: 28px; height: 28px; font-size: 11px; }
.chat-group-dot { position: absolute; bottom: -2px; right: -2px; background: var(--primary); border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; color: #fff; }
.chat-row-body { flex: 1; min-width: 0; }
.chat-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.chat-row-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.chat-row-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-unread-badge { background: var(--primary); color: #fff; border-radius: 10px; min-width: 18px; height: 18px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; }

.msg-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.msg-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; color: var(--muted); text-align: center; }

.msg-chat-wrap { display: flex; flex-direction: column; height: 100%; }
.msg-chat-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-shrink: 0; }
.msg-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.msg-empty-msgs { text-align: center; color: var(--muted); font-size: 13px; margin: auto; }
.msg-date-sep { text-align: center; margin: 12px 0; }
.msg-date-sep span { font-size: 11px; color: var(--muted); background: var(--panel-2); padding: 3px 10px; border-radius: 10px; }

.msg-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 4px; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-bubble-wrap { display: flex; flex-direction: column; max-width: 65%; }
.msg-row.mine .msg-bubble-wrap { align-items: flex-end; }
.msg-sender-name { font-size: 11px; color: var(--muted); margin-bottom: 3px; margin-left: 4px; }
.msg-bubble { background: var(--panel-2); border-radius: 14px 14px 14px 3px; padding: 9px 12px; position: relative; border: 1px solid var(--line); }
.msg-row.mine .msg-bubble { background: rgba(20,184,166,.15); border-radius: 14px 14px 3px 14px; border-color: rgba(20,184,166,.3); }
.msg-text { font-size: 13px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.msg-deleted { font-size: 12px; color: var(--muted); font-style: italic; padding: 6px 10px; }
.msg-actions { display: none; gap: 4px; margin-top: 3px; }
.msg-row:hover .msg-actions { display: flex; }
.msg-row.mine .msg-actions { justify-content: flex-end; }
.msg-action-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; cursor: pointer; color: var(--muted); display: flex; align-items: center; }
.msg-action-btn:hover { color: var(--text); border-color: var(--primary); }
.msg-reply-preview { background: rgba(20,184,166,.1); border-left: 3px solid var(--primary); border-radius: 6px; padding: 5px 8px; margin-bottom: 6px; cursor: pointer; font-size: 12px; }
.msg-reply-preview b { display: block; color: var(--primary); }
.msg-reply-preview span { color: var(--muted); }
.msg-img-attach { max-width: 220px; max-height: 180px; border-radius: 8px; object-fit: cover; display: block; margin-top: 6px; cursor: pointer; }
.msg-file-attach { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--primary); text-decoration: none; padding: 6px 8px; background: var(--panel); border-radius: 6px; margin-top: 4px; }
.msg-file-attach span { font-size: 10px; color: var(--muted); margin-left: auto; }

.msg-reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(20,184,166,.08); border-top: 1px solid var(--line); font-size: 12px; flex-shrink: 0; }
.msg-input-area { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); flex-shrink: 0; }
.msg-attach-btn { cursor: pointer; color: var(--muted); display: flex; align-items: center; padding: 6px; border-radius: 8px; transition: color .15s; flex-shrink: 0; align-self: flex-end; }
.msg-attach-btn:hover { color: var(--primary); }
.msg-textarea { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 13px; color: var(--text); outline: none; resize: none; line-height: 1.4; min-height: 38px; max-height: 120px; font-family: inherit; transition: border-color .15s; }
.msg-textarea:focus { border-color: var(--primary); }
.msg-send-btn { background: var(--primary); color: #fff; border: none; border-radius: 10px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: opacity .15s; }
.msg-send-btn:hover { opacity: .85; }
.msg-send-btn:disabled { opacity: .4; cursor: not-allowed; }
.msg-files-preview { display: flex; flex-wrap: wrap; gap: 4px; align-self: flex-end; }
.msg-file-chip { display: flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 11px; }
.msg-file-chip button { background: none; border: none; cursor: pointer; color: var(--muted); padding: 0; display: flex; }

/* ===== LINKED EMAILS IN LEAD ===== */
.linked-emails-list { display: flex; flex-direction: column; gap: 8px; }
.linked-email-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; transition: border-color .15s; }
.linked-email-card:hover { border-color: rgba(129,140,248,.5); }
.linked-email-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.linked-email-from { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex: 1; }
.linked-email-date { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.linked-email-subject { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.linked-email-preview { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Link email modal row */
.link-email-row { display: flex; gap: 10px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color .15s; align-items: flex-start; }
.link-email-row:hover { border-color: var(--primary); }
.link-email-info { flex: 1; min-width: 0; }
.link-email-subject { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.link-email-meta { display: flex; gap: 10px; font-size: 11px; color: var(--muted); align-items: center; margin-bottom: 3px; }
.link-email-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== BIN DUPLICATE ALERT ===== */
.bin-duplicate-alert { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.4); border-radius: 8px; padding: 10px 12px; font-size: 13px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bin-duplicate-alert a { color: var(--primary); cursor: pointer; }

/* ===== PROFILE MODAL ===== */
.user-chip { cursor: pointer; transition: background .15s; border-radius: 8px; padding: 4px 6px; }
.user-chip:hover { background: rgba(255,255,255,.06); }
.user-chip-ava { position: relative; flex-shrink: 0; }
.user-chip-ava img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }

.profile-hero { display: flex; align-items: center; gap: 20px; padding: 24px; background: linear-gradient(135deg, rgba(20,184,166,.12), rgba(129,140,248,.08)); border-bottom: 1px solid var(--line); }
.profile-ava-wrap { position: relative; width: 80px; height: 80px; border-radius: 50%; overflow: hidden; cursor: pointer; flex-shrink: 0; border: 3px solid var(--primary); box-shadow: 0 0 0 3px rgba(20,184,166,.2); }
.profile-ava-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-ava-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; color: #fff; font-size: 11px; gap: 4px; }
.profile-ava-wrap:hover .profile-ava-overlay { opacity: 1; }
.profile-hero-name { font-size: 18px; font-weight: 700; }
.profile-hero-role { font-size: 13px; color: var(--primary); font-weight: 500; margin-top: 2px; }
.profile-hero-dept { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.profile-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 20px; }
.profile-tab { background: none; border: none; padding: 12px 16px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; margin-bottom: -1px; }
.profile-tab:hover { color: var(--text); }
.profile-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.profile-tab-content { min-height: 200px; }

.profile-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.profile-stat-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.profile-stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.profile-stat-val { font-size: 22px; font-weight: 700; }
.profile-stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ===== PROPOSAL BUILDER ===== */
.wc-search-wrap { display:flex; align-items:center; gap:8px; background:var(--panel-2); border:1px solid var(--line); border-radius:8px; padding:8px 12px; }
.wc-search-wrap svg { color:var(--muted); width:15px; height:15px; flex-shrink:0; }
.wc-search-wrap input { flex:1; background:none; border:none; outline:none; font-size:13px; color:var(--text); }
.wc-search-results { display:flex; flex-direction:column; gap:4px; margin-top:6px; max-height:240px; overflow-y:auto; }
.wc-result-item { display:flex; align-items:center; gap:10px; padding:8px 10px; background:var(--panel-2); border:1px solid var(--line); border-radius:8px; cursor:pointer; transition:border-color .15s; }
.wc-result-item:hover { border-color:var(--primary); }
.wc-thumb { width:48px; height:48px; object-fit:contain; border-radius:6px; flex-shrink:0; background:#fff; }
.wc-thumb-empty { width:48px; height:48px; border-radius:6px; background:var(--panel-2); display:flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--muted); }
.wc-result-info { flex:1; min-width:0; }
.wc-result-name { font-size:13px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wc-result-meta { display:flex; gap:8px; font-size:11px; color:var(--muted); margin-top:2px; }
.wc-result-price { font-size:13px; font-weight:600; white-space:nowrap; flex-shrink:0; }
.wc-noresult { padding:10px; font-size:13px; color:var(--muted); text-align:center; background:var(--panel-2); border-radius:8px; }
.wc-alt-hint {
  display:flex; align-items:center; gap:6px; margin-top:5px; padding:5px 8px;
  background:rgba(245,158,11,.12); color:#f59e0b; border-radius:6px;
  font-size:11px; font-weight:600; cursor:pointer; transition:background .15s;
}
.wc-alt-hint:hover { background:rgba(245,158,11,.22); }
.wc-alt-hint svg { width:12px; height:12px; flex-shrink:0; }

.cp-items-table td { padding:4px 5px; vertical-align:middle; }
.cp-inline { width:100%; background:transparent; border:none; outline:none; font-size:12px; color:var(--text); padding:2px 4px; border-radius:4px; }
.cp-inline:focus { background:var(--panel-2); border:1px solid var(--primary); }
.cp-desc { font-size:11px; color:var(--muted); margin-top:2px; }
.cp-inline.tc { text-align:center; }
.cp-inline.tr { text-align:right; }

.cp-totals-row { display:flex; justify-content:space-between; align-items:center; padding:5px 8px; font-size:13px; border-radius:6px; }
.cp-totals-row.grand { background:var(--primary); color:#fff; font-weight:700; font-size:15px; padding:8px 10px; margin-top:4px; }

/* ===== RESPONSIVE / MOBILE ADAPTATION ===== */
:root { --sidebar-w: 240px; }

@media (max-width: 1100px) {
  .grid-2-1 { grid-template-columns: 1fr; }
  .cal-layout { flex-direction: column; }
  .cal-sidebar { max-width: 100%; min-width: 0; }
  .messenger-shell { flex-direction: column; }
  .msg-sidebar { width: 100%; max-height: 260px; border-right: none; border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); z-index: 200; transition: transform .25s; width: 240px; position: fixed; top: 0; bottom: 0; }
  .sidebar.mobile-open { transform: translateX(0); }
  .shell { margin-left: 0 !important; }
  .header { padding: 0 10px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar .search { max-width: none; flex: 1; min-width: 0; }
  .topbar .kbd { display: none; }
  .topbar .sync-pill { display: none; }
  .topbar .u-name, .topbar .u-role { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { gap: 4px; flex-shrink: 0; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head-actions { width: 100%; flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .wc-result-price { display: none; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .report-tabs { overflow-x: auto; white-space: nowrap; }
  .table-wrap { overflow-x: auto; }
  .modal-card { margin: 8px; max-width: calc(100vw - 16px) !important; }
  .modal-card.xl { max-width: calc(100vw - 16px) !important; }
  .compose-card { margin: 0; border-radius: 0; height: 100vh; }
  .currency-strip { flex-wrap: wrap; gap: 8px; }
  .profile-hero { flex-direction: column; text-align: center; }
  .best-manager-card { flex-direction: column; text-align: center; }
  .header .sync-pill { display: none; }
  .btn-label { display: none; }
}

/* Mobile burger menu */
.mobile-burger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
@media (max-width: 900px) {
  .mobile-burger { display: flex; align-items: center; }
}
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}
.mobile-overlay.open { display: block; }

/* ===== CURRENCY STRIP ===== */
.currency-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.currency-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: 6px;
}
.currency-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  transition: border-color .15s;
}
.currency-item:hover { border-color: var(--primary); }
.currency-flag { font-size: 16px; }
.currency-code { font-size: 11px; font-weight: 700; color: var(--muted); }
.currency-rate { font-size: 13px; font-weight: 700; color: var(--text); }
.currency-loading { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.currency-updated { font-size: 10px; color: var(--muted); margin-left: auto; }

/* ===== REPORTS ===== */
.report-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.report-tab { background: none; border: none; padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; border-radius: 7px; transition: all .15s; white-space: nowrap; }
.report-tab:hover { color: var(--text); background: var(--panel-2); }
.report-tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.report-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--muted); font-size: 14px; }
.inp-small { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: var(--text); font-size: 13px; }

.best-manager-card {
  display: flex; align-items: center; gap: 20px;
  background: linear-gradient(135deg, #1A3A5C, #2563eb);
  border-radius: 12px; padding: 18px 22px; color: #fff;
}
.best-manager-trophy { font-size: 36px; flex-shrink: 0; }
.best-manager-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .75; }
.best-manager-name { font-size: 20px; font-weight: 700; margin: 4px 0; }
.best-manager-stats { font-size: 13px; opacity: .85; }

/* ===== MAIL SECTION ===== */
.mail-layout { display: flex; height: calc(100vh - 120px); gap: 0; overflow: hidden; }
.mail-list-wrap { width: 320px; flex-shrink: 0; border-right: 1px solid var(--line); overflow-y: auto; background: var(--panel); }
.mail-view-wrap {
  flex: 1; overflow-y: auto; /* ФИКС: письмо теперь прокручивается */
  padding: 20px; background: var(--panel-2);
}
.mail-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.mail-item:hover { background: var(--panel-2); }
.mail-item.active { background: rgba(20,184,166,.1); border-left: 3px solid var(--primary); }
.mail-item.unread .mail-item-subject { font-weight: 700; }
.mail-item-from { font-size: 12px; font-weight: 600; margin-bottom: 2px; display: flex; justify-content: space-between; }
.mail-item-subject { font-size: 12px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item-preview { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item-time { font-size: 10px; color: var(--muted); flex-shrink: 0; }
.mail-email-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.mail-email-header { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; }
.mail-email-subject { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.mail-email-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.mail-email-meta span b { color: var(--text); }
.mail-email-body {
  font-size: 14px; line-height: 1.7;
  max-height: none; /* убираем ограничение */
  overflow: visible;
  word-break: break-word;
}
.mail-email-body img { max-width: 100%; }

/* ===== RICH TEXT COMPOSE ===== */
.compose-toolbar {
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.compose-tool {
  background: none; border: 1px solid transparent; border-radius: 5px;
  padding: 4px 8px; cursor: pointer; font-size: 12px; color: var(--text);
  transition: all .12s; white-space: nowrap;
}
.compose-tool:hover { background: var(--panel); border-color: var(--line); }
.compose-tool-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.compose-font-size { height: 28px; font-size: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; color: var(--text); padding: 0 4px; cursor: pointer; }
.compose-richtext {
  min-height: 240px; padding: 14px 16px; font-size: 13px; line-height: 1.6;
  color: var(--text); outline: none; width: 100%;
  background: var(--panel);
}
.compose-richtext:empty:before { content: attr(data-placeholder); color: var(--muted); }
.compose-richtext:focus { background: var(--panel); }
.compose-color-pick { background: var(--panel) !important; }

/* ===== LIXOR FOOTER ===== */
.lixor-footer {
  position: fixed; bottom: 0; left: var(--sidebar-w); right: 0;
  text-align: center; font-size: 10px; color: var(--muted);
  padding: 4px 0; background: var(--panel); border-top: 1px solid var(--line);
  z-index: 10; letter-spacing: .3px;
  transition: left .25s;
}
.lixor-footer a { color: var(--primary); text-decoration: none; }
.lixor-footer a:hover { text-decoration: underline; }
.view { padding-bottom: 28px; } /* отступ под footer */
@media (max-width: 900px) { .lixor-footer { left: 0; } }

/* ===== PERSONAL CONTACTS ===== */
.contacts-search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 20px;
}
.contacts-search-wrap svg { color: var(--muted); width: 16px; height: 16px; flex-shrink: 0; }
.contacts-search {
  flex: 1; background: none; border: none; outline: none;
  font-size: 14px; color: var(--text);
}
.contacts-grid { display: flex; flex-direction: column; gap: 6px; }
.contacts-group { margin-bottom: 8px; }
.contacts-group-letter {
  font-size: 12px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.contacts-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.contacts-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; gap: 16px; text-align: center; color: var(--muted);
}

.contact-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; cursor: pointer; transition: border-color .15s, transform .1s;
}
.contact-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.contact-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}
.contact-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.contact-fav-btn { color: var(--muted); }
.contact-fav-btn.active { color: #f59e0b; }
.contact-fav-btn.active svg { fill: #f59e0b; }
.contact-card-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.contact-card-company { font-size: 11px; color: var(--primary); display: flex; align-items: center; gap: 3px; }
.contact-card-pos { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.contact-card-contacts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.contact-chip {
  display: flex; align-items: center; gap: 5px; font-size: 11px;
  padding: 3px 7px; border-radius: 6px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .15s;
}
.contact-chip:hover { opacity: .75; }
.contact-chip.phone   { background: rgba(20,184,166,.1);  color: var(--primary); }
.contact-chip.email   { background: rgba(99,102,241,.1);  color: #818cf8; }
.contact-chip.tg      { background: rgba(59,130,246,.1);  color: #3b82f6; }

/* Contact detail */
.contact-detail-rows { display: flex; flex-direction: column; gap: 10px; }
.cdr {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  padding: 8px 10px; background: var(--panel-2); border-radius: 8px;
}
.cdr svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; }
.cdr a { color: var(--text); text-decoration: none; }
.cdr a:hover { color: var(--primary); }

.tag-pill {
  background: rgba(20,184,166,.12); color: var(--primary);
  font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 500;
}

.active-filter { background: rgba(20,184,166,.15) !important; color: var(--primary) !important; border-color: var(--primary) !important; }

@media (max-width: 600px) {
  .contacts-cards-row { grid-template-columns: 1fr; }
}

/* ===== NOTIFICATIONS V2 ===== */
.notif-tabs { display:flex; gap:2px; }
.notif-tab { background:none; border:none; padding:6px 14px; font-size:12px; font-weight:500; color:var(--muted); cursor:pointer; border-radius:6px; transition:all .15s; }
.notif-tab:hover { color:var(--text); }
.notif-tab.active { background:var(--primary); color:#fff; }
.np-actions { display:flex; gap:6px; padding:6px 10px; border-bottom:1px solid var(--line); flex-wrap:wrap; }
.np-action-btn { background:none; border:1px solid var(--line); border-radius:6px; padding:4px 8px; font-size:11px; cursor:pointer; color:var(--muted); transition:all .15s; white-space:nowrap; }
.np-action-btn:hover { border-color:var(--primary); color:var(--primary); }
.notif-item { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border-bottom:1px solid var(--line); transition:background .12s; }
.notif-item:hover { background:var(--panel-2); }
.notif-item.unread { border-left:3px solid var(--primary); }
.notif-item.unread .np-title { font-weight:700; }
.notif-actions { display:flex; gap:2px; flex-shrink:0; margin-left:auto; opacity:0; transition:opacity .15s; }
.notif-item:hover .notif-actions { opacity:1; }
.np-ico { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.np-time { font-size:10px; color:var(--muted); margin-top:2px; }
.notif-empty { padding:20px; text-align:center; color:var(--muted); font-size:13px; list-style:none; }

/* ===== MESSENGER TOOLBAR ===== */
.msg-toolbar {
  display:flex; align-items:center; gap:2px; padding:5px 10px;
  border-top:1px solid var(--line); background:var(--panel-2); flex-shrink:0; flex-wrap:wrap;
}
.msg-tool-btn {
  background:none; border:1px solid transparent; border-radius:5px;
  padding:3px 7px; cursor:pointer; font-size:12px; color:var(--muted);
  transition:all .12s; line-height:1;
}
.msg-tool-btn:hover { background:var(--panel); border-color:var(--line); color:var(--text); }
.msg-tool-sep { width:1px; height:16px; background:var(--line); margin:0 2px; }

/* Emoji picker */
.emoji-picker {
  position:absolute; bottom:calc(100% + 6px); left:0; right:0;
  background:var(--panel); border:1px solid var(--line); border-radius:12px;
  box-shadow:0 8px 32px rgba(0,0,0,.2); z-index:200;
  display:flex; flex-direction:column; overflow:hidden;
  min-width:300px; max-width:360px;
}
.ep-search-wrap { padding:8px 10px 4px; border-bottom:1px solid var(--line); }
.ep-search { width:100%; background:var(--panel-2); border:1px solid var(--line); border-radius:8px; padding:6px 10px; font-size:13px; color:var(--text); outline:none; box-sizing:border-box; }
.ep-search:focus { border-color:var(--primary); }
.ep-tabs { display:flex; gap:2px; padding:6px 8px; border-bottom:1px solid var(--line); overflow-x:auto; scrollbar-width:none; }
.ep-tabs::-webkit-scrollbar { display:none; }
.ep-tab { background:none; border:none; cursor:pointer; font-size:16px; padding:4px 6px; border-radius:6px; transition:background .1s; flex-shrink:0; }
.ep-tab:hover { background:var(--panel-2); }
.ep-tab.active { background:var(--panel-2); box-shadow:0 0 0 1px var(--primary); }
.ep-body { display:flex; flex-wrap:wrap; gap:2px; padding:8px; max-height:160px; overflow-y:auto; }
.emoji-btn { background:none; border:none; cursor:pointer; font-size:20px; padding:5px; border-radius:6px; transition:background .1s; line-height:1; }
.emoji-btn:hover { background:var(--panel-2); transform:scale(1.2); }

/* Mail list scroll fix */
.mail-section { height:calc(100vh - 64px); display:flex; flex-direction:column; }
.mail-list-col { min-height:0; }
.mail-list-items { overflow-y:auto; flex:1; min-height:0; }

/* Mail folder separator */
.mf-sep { margin-top:8px; border-top:1px solid var(--line); padding-top:8px; }

/* Message markdown styles */
.msg-text strong { font-weight:700; }
.msg-text em { font-style:italic; }
.msg-text del { text-decoration:line-through; opacity:.8; }
.msg-text .msg-code-block { background:var(--panel-2); border:1px solid var(--line); border-radius:6px; padding:8px 10px; margin:4px 0; font-family:monospace; font-size:12px; overflow-x:auto; white-space:pre; display:block; }
.msg-text .msg-code-inline { background:var(--panel-2); border:1px solid var(--line); border-radius:4px; padding:1px 5px; font-family:monospace; font-size:12px; }

/* Context menu */
.ctx-menu {
  position:fixed; z-index:9999; background:var(--panel); border:1px solid var(--line);
  border-radius:10px; padding:4px; box-shadow:0 8px 24px rgba(0,0,0,.2); min-width:180px;
}
.ctx-menu button {
  display:flex; align-items:center; gap:8px; width:100%;
  background:none; border:none; padding:8px 12px; font-size:13px;
  color:var(--text); cursor:pointer; border-radius:6px; text-align:left; transition:background .12s;
}
.ctx-menu button:hover { background:var(--panel-2); }

/* ===== PRODUCTS GRID ===== */
.prod-search-wrap { display:flex; align-items:center; gap:10px; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:10px 14px; margin-bottom:16px; }
.prod-search-wrap svg { color:var(--muted); width:16px; height:16px; flex-shrink:0; }
.prod-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:14px; }
.prod-card { background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:hidden; cursor:pointer; transition:border-color .15s,transform .1s; }
.prod-card:hover { border-color:var(--primary); transform:translateY(-2px); }
.prod-img { height:110px; display:flex; align-items:center; justify-content:center; background:var(--panel-2); }
.prod-info { padding:10px 12px; }
.prod-cat { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:3px; }
.prod-name { font-size:13px; font-weight:600; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.prod-foot { display:flex; align-items:flex-end; justify-content:space-between; margin-top:8px; }
.prod-price { font-size:14px; font-weight:700; color:var(--primary); }
.prod-stock { font-size:11px; color:#22c55e; }
.prod-stock.out { color:#ef4444; }
.prod-stock.low { color:#f59e0b; }
.wp-tag { font-size:10px; background:#21759b22; color:#21759b; padding:2px 6px; border-radius:4px; font-weight:700; }

/* ===== ASSIGN MULTISELECT ===== */
#usersPick li .pick-check { transition:opacity .15s; }
#usersPick li.selected { background:rgba(20,184,166,.1); border-color:var(--primary) !important; }

/* ===== LIGHT THEME FIXES ===== */
[data-theme="light"] {
  --bg:       #f4f6fa;
  --panel:    #ffffff;
  --panel-2:  #f0f2f8;
  --text:     #1a1a2e;
  --muted:    #64748b;
  --line:     #e2e8f0;
  --primary:  #0d9488;
  --hover:    rgba(13,148,136,.08);
}
[data-theme="light"] .sidebar { background:#1a2744; }
[data-theme="light"] .nav-item { color:#94a3b8; }
[data-theme="light"] .nav-item.active, [data-theme="light"] .nav-item:hover { color:#fff; background:rgba(255,255,255,.1); }
[data-theme="light"] .logo { color:#fff; }

/* ===== SIGNATURE RICH-TEXT EDITOR ===== */
.sig-editor-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 12px;
}
.sig-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.sig-tool {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  height: 26px;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}
.sig-tool:hover { background: var(--panel); border-color: var(--line); }
.sig-tool select, select.sig-tool {
  height: 26px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.sig-tool.sig-color {
  width: 26px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.sig-tool-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 3px;
}
.sig-tab:hover { filter: brightness(1.08); }
.sig-editor[contenteditable="false"] { cursor: not-allowed; }
.sig-editor {
  min-height: 100px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  line-height: 1.6;
}
.sig-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
  white-space: pre;
}
.sig-editor a { color: var(--primary); }
.sig-editor img { max-height: 60px; max-width: 200px; object-fit: contain; }

/* ===== COMPOSE TOOLBAR — шрифты ===== */
.compose-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.compose-font-family {
  height: 26px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  max-width: 130px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
