
/* ═══════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface2: #f1f3f8;
  --surface3: #e8ecf4;

  /* Borders */
  --border: #e8eaf0;
  --border2: #d5d9e2;

  /* Text */
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;

  /* Accent */
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --accent-hover: #4338ca;

  /* Semantic Colors */
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --blue: #2563eb;
  --blue-bg: #eff6ff;

  /* Radii */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow: 0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.02);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.03);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.08);

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}

button { cursor: pointer; font-family: inherit; transition: var(--transition); }
input, select, textarea { font-family: inherit; transition: var(--transition); }
a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  background: #0f172a; color: #e2e8f0;
  display: flex; flex-direction: column;
  width: 240px; z-index: 100;
  transition: width .3s var(--ease);
  overflow: hidden;
}
.sidebar.collapsed { width: 56px; }
.collapsed .hide-c { display: none; }

.sidebar-top {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 28px; height: 28px; background: var(--accent);
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -.3px; }

.nav-section {
  padding: 20px 10px 4px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.8px; color: #475569;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer;
  font-size: 13px; font-weight: 500;
  border-radius: 8px; margin: 1px 8px;
  transition: var(--transition);
  white-space: nowrap; color: #94a3b8;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: #e2e8f0; }
.nav-item.active { background: rgba(79,70,229,.15); color: #a5b4fc; }
.nav-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }

.toggle-sb {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.06); border: none; color: #94a3b8;
  width: 32px; height: 32px; border-radius: 8px; font-size: 12px;
}
.toggle-sb:hover { background: rgba(255,255,255,.1); }

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.main {
  margin-left: 240px; min-height: 100vh;
  transition: margin-left .3s var(--ease);
}
.main.shifted { margin-left: 56px; }

/* ═══════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════ */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap; gap: 10px;
}
.top-left { display: flex; align-items: center; gap: 14px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 10px;
  border-radius: 20px; background: var(--accent-light); color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH
   ═══════════════════════════════════════════════════════════════ */

.search-wrap { position: relative; }
.search-wrap input {
  background: var(--surface2); border: 1px solid transparent;
  border-radius: 8px; padding: 8px 12px 8px 34px;
  font-size: 13px; width: 240px; color: var(--text);
}
.search-wrap::before {
  content: "🔍"; position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); font-size: 12px; pointer-events: none;
}
.search-dd {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 60; max-height: 320px; overflow-y: auto; margin-top: 4px;
}
.search-dd-item {
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--surface2);
  display: flex; gap: 10px; align-items: center;
  transition: var(--transition);
}
.search-dd-item:hover { background: var(--accent-light); }
.search-dd-sub { font-size: 11px; color: var(--text3); }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
  padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; border: none;
  transition: var(--transition); display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
.btn-p { background: var(--accent); color: #fff; }
.btn-p:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-s { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-s:hover { border-color: var(--border2); background: #fff; }
.btn-d { background: var(--red-bg); color: var(--red); }
.btn-d:hover { background: #fee2e2; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-w {
  background: var(--green); color: #fff; border: none;
  padding: 11px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; flex: 1;
}
.btn-w:hover { background: #047857; }
.btn-l {
  background: var(--red); color: #fff; border: none;
  padding: 11px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; flex: 1;
}
.btn-l:hover { background: #b91c1c; }

/* ═══════════════════════════════════════════════════════════════
   VIEW SWITCHER (Канбан / Список)
   ═══════════════════════════════════════════════════════════════ */

.view-sw { display: flex; background: var(--surface2); border-radius: 8px; padding: 2px; }
.view-b {
  border: none; background: transparent; padding: 6px 14px;
  font-size: 12px; font-weight: 500; color: var(--text3); border-radius: 6px;
}
.view-b.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ═══════════════════════════════════════════════════════════════
   KANBAN BOARD
   ═══════════════════════════════════════════════════════════════ */

.board {
  display: flex; gap: 16px; padding: 24px 32px;
  overflow-x: auto; height: calc(100vh - 140px);
  align-items: stretch;
}

/* Column */
.column {
  min-width: 290px; max-width: 310px; flex: 0 0 290px;
  background: var(--surface2); border-radius: var(--radius-lg);
  padding: 0; transition: var(--transition);
  display: flex; flex-direction: column; overflow: hidden;
}
.col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 0; flex-shrink: 0;
  background: var(--surface2);
}
.col-meta {
  font-size: 10.5px; color: var(--text3); padding: 4px 12px 8px;
  flex-shrink: 0; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.col-body {
  flex: 1; overflow-y: auto; padding: 8px 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.col-body::-webkit-scrollbar { width: 4px; }
.col-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.col-body::-webkit-scrollbar-track { background: transparent; }

/* Special drop zones (appear while dragging) */
.drop-zones { display: none; }
.drop-zones.visible { display: block; }
.drop-zone-right {
  position: fixed; right: 0; top: 0; bottom: 0; width: 0;
  background: rgba(99,102,241,.15); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--accent);
  transition: width .2s ease; overflow: hidden; writing-mode: vertical-rl;
  letter-spacing: 1px; opacity: 0; border-left: 2px dashed var(--accent);
}
.drop-zones.visible .drop-zone-right { width: 64px; opacity: 1; }
.drop-zone-right.dz-over { width: 90px; background: rgba(99,102,241,.25); }

.drop-zone-bottom {
  position: fixed; bottom: 0; left: 0; right: 0; height: 0;
  display: flex; gap: 0; z-index: 100; transition: height .2s ease; overflow: hidden;
}
.drop-zones.visible .drop-zone-bottom { height: 64px; }

.dz-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 800; color: #fff;
  transition: var(--transition); cursor: pointer;
}
.dz-btn.dz-won-btn { background: rgba(16,185,129,.12); color: var(--green); border-top: 2px dashed var(--green); }
.dz-btn.dz-lost-btn { background: rgba(239,68,68,.10); color: var(--red); border-top: 2px dashed var(--red); }
.dz-btn.dz-over { filter: none; }
.dz-btn.dz-won-btn.dz-over { background: rgba(16,185,129,.22); }
.dz-btn.dz-lost-btn.dz-over { background: rgba(239,68,68,.18); }

/* Column drop highlight during drag */
.column.drag-over {
  background: var(--accent-light);
  outline: 2px dashed var(--accent); outline-offset: -2px;
}
.column.drag-over .col-head,
.column.drag-over .col-meta {
  background: var(--accent-light);
}
/* Cards become semi-transparent while dragging */
.board.dragging .card { opacity: 0.6; }
.col-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.col-name {
  font-size: 12px; font-weight: 700; flex: 1;
  letter-spacing: -.2px; text-transform: uppercase; color: var(--text2);
}
.col-cnt {
  font-size: 10px; font-weight: 700; color: var(--text3);
  background: var(--border); width: 22px; height: 22px;
  border-radius: 11px; display: flex; align-items: center; justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════
   KANBAN CARD
   ═══════════════════════════════════════════════════════════════ */

.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; cursor: pointer; box-shadow: var(--shadow);
  transition: var(--transition); border: 1px solid var(--border);
  position: relative; overflow: hidden; flex-shrink: 0;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border2);
}
.card.overdue { border-left: 3px solid var(--red); }
.card.warning { border-left: 3px solid var(--amber); }

.card-cover {
  width: calc(100% + 32px); height: 72px;
  margin: -16px -16px 12px; object-fit: cover;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.card-title {
  font-size: 13.5px; font-weight: 700; line-height: 1.35;
  margin-bottom: 3px; letter-spacing: -.2px;
}
.card-client { font-size: 12px; color: var(--text3); margin-bottom: 6px; }
.card-product {
  display: inline-block; font-size: 10px; font-weight: 600;
  color: var(--accent); background: var(--accent-light);
  padding: 2px 8px; border-radius: 4px; margin-bottom: 8px;
}
.card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-amount { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.card-amount.hidden-fin { filter: blur(6px); pointer-events: none; user-select: none; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-deadline { font-size: 11px; color: var(--text3); font-weight: 500; }

/* Card quick note */
.card-note {
  font-size: 11px; color: var(--amber); background: var(--amber-bg);
  padding: 5px 10px; border-radius: 6px; margin-top: 8px;
  font-style: italic; border: 1px solid #fef3c7;
}
.card-note-in {
  width: 100%; font-size: 11px; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  margin-top: 8px; background: var(--amber-bg);
}

/* ═══════════════════════════════════════════════════════════════
   TAGS
   ═══════════════════════════════════════════════════════════════ */

.tag {
  font-size: 9.5px; font-weight: 700; padding: 3px 8px;
  border-radius: 5px; letter-spacing: .2px; text-transform: uppercase;
}
.t-urgent { background: var(--red-bg); color: var(--red); }
.t-vip { background: var(--purple-bg); color: var(--purple); }
.t-large { background: var(--accent-light); color: var(--accent); }
.t-wait { background: var(--amber-bg); color: var(--amber); }
.t-def { background: var(--surface2); color: var(--text3); }

.tag-sel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-opt {
  padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); transition: var(--transition);
}
.tag-opt:hover { border-color: var(--accent); }
.tag-opt.sel { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   PAYMENT BADGES
   ═══════════════════════════════════════════════════════════════ */

.pay-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 5px; margin-bottom: 8px; margin-left: 4px;
}
.pay-not { background: var(--red-bg); color: var(--red); }
.pay-pre { background: var(--amber-bg); color: var(--amber); }
.pay-full { background: var(--green-bg); color: var(--green); }

.pay-sel { display: flex; gap: 6px; margin: 8px 0; }
.pay-opt {
  padding: 6px 14px; border-radius: 6px; font-size: 11.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); transition: var(--transition);
}
.pay-opt:hover { border-color: var(--accent); }
.pay-opt.sel-not { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.pay-opt.sel-pre { border-color: var(--amber); background: var(--amber-bg); color: var(--amber); }
.pay-opt.sel-paid { border-color: var(--green); background: var(--green-bg); color: var(--green); }

/* ═══════════════════════════════════════════════════════════════
   STATUS BADGES
   ═══════════════════════════════════════════════════════════════ */

.overdue-b {
  font-size: 9.5px; font-weight: 700; color: var(--red); background: var(--red-bg);
  padding: 2px 7px; border-radius: 4px; margin-bottom: 4px; display: inline-block;
}
.warn-b {
  font-size: 9.5px; font-weight: 700; color: var(--amber); background: var(--amber-bg);
  padding: 2px 7px; border-radius: 4px; margin-bottom: 4px; display: inline-block;
}
.reg-b {
  font-size: 9px; font-weight: 700; color: var(--green); background: var(--green-bg);
  padding: 2px 6px; border-radius: 4px; margin-left: 4px;
}
.spill {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   MINI AVATAR
   ═══════════════════════════════════════════════════════════════ */

.mini-av {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.emp-av-lg {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff; margin: 0 auto 14px;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL OVERLAY & CONTAINER
   ═══════════════════════════════════════════════════════════════ */

.m-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 200; padding: 48px 16px; overflow-y: auto;
}
.m-overlay.open { display: flex; }

.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 740px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalIn .25s var(--ease);
}
.modal.sm { max-width: 540px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Modal header */
.m-head { padding: 24px 28px 16px; border-bottom: 1px solid var(--border); }
.m-head-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.m-title { font-size: 18px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 8px; }
.m-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.m-funnel { font-size: 12px; color: var(--text3); }

/* Modal tabs */
.m-tabs {
  display: flex; gap: 2px; padding: 0 28px; align-items: center;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.m-tab {
  padding: 13px 16px; border: none; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--text3);
  border-bottom: 2px solid transparent;
  white-space: nowrap; transition: var(--transition);
}
.m-tab.on { font-weight: 700; color: var(--accent); border-bottom-color: var(--accent); }
.m-tab:hover { color: var(--text); }

/* Modal body */
.m-body { padding: 28px; max-height: 60vh; overflow-y: auto; }

/* ═══════════════════════════════════════════════════════════════
   DEAL CARD — two-column Bitrix24 layout
   ═══════════════════════════════════════════════════════════════ */

.modal.lg {
  max-width: 1060px; max-height: 90vh;
  display: flex; flex-direction: column;
}
#dm-c { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.deal-layout {
  display: grid; grid-template-columns: 40% 1fr;
  flex: 1; min-height: 0; overflow: hidden;
}
.deal-left  { overflow-y: auto; padding: 20px 24px; border-right: 1px solid var(--border); }
.deal-right { overflow-y: auto; padding: 20px 24px; }

.dl-section { margin-top: 20px; }
.dl-section:first-child { margin-top: 0; }
.dl-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.dl-section-title { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }

.act-form { padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }

/* ═══════════════════════════════════════════════════════════════
   PIPELINE (stage picker in modal)
   ═══════════════════════════════════════════════════════════════ */

.pipeline {
  display: flex; gap: 3px; padding: 14px 28px;
  overflow-x: auto; align-items: center; flex-wrap: wrap;
}
.pip {
  padding: 7px 14px; border-radius: 7px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: var(--transition);
  border: 1px solid transparent;
}
.pip:hover { filter: brightness(.92); }
.pip.cur { box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor; }

.funnel-sw { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.funnel-sw select {
  padding: 6px 10px; border-radius: 7px; border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; background: #fff; cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════ */

.fl {
  font-size: 12px; font-weight: 600; color: var(--text2);
  margin-top: 12px; margin-bottom: 4px; display: block;
}
.inp {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 13px;
  margin-bottom: 6px; background: #fff; color: var(--text);
}
textarea.inp { min-height: 72px; resize: vertical; }
.rw { display: flex; gap: 12px; }
.rw > * { flex: 1; }

.dl-btns { display: flex; gap: 8px; margin-top: 4px; }
.dl-btn {
  padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  transition: var(--transition);
}
.dl-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.close-r {
  display: flex; gap: 8px; margin-top: 18px;
  padding-top: 18px; border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   INFO ROWS (deal details)
   ═══════════════════════════════════════════════════════════════ */

.info-r {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--surface2); gap: 12px;
}
.info-l { font-size: 13px; color: var(--text3); font-weight: 500; flex-shrink: 0; min-width: 110px; }
.info-v {
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  text-align: right; flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   ACTIVITY LOG
   ═══════════════════════════════════════════════════════════════ */

.act-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--surface2);
}
.act-ic {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.act-stage   { background: var(--accent-light); color: var(--accent); }
.act-comment { background: var(--green-bg); color: var(--green); }
.act-file    { background: var(--purple-bg); color: var(--purple); }
.act-call    { background: var(--amber-bg); color: var(--amber); }
.act-task    { background: var(--red-bg); color: var(--red); }

.act-content { flex: 1; min-width: 0; }
.act-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.act-author { font-size: 12px; font-weight: 700; }
.act-date { font-size: 11px; color: var(--text3); }
.act-text { font-size: 13px; color: var(--text2); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════════
   PHONE & GEO BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.phone-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green); color: #fff; padding: 5px 12px;
  border-radius: 6px; font-size: 12px; font-weight: 600; border: none;
}
.phone-btn:hover { background: #047857; }

.geo-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue); color: #fff; padding: 4px 10px;
  border-radius: 6px; font-size: 11px; font-weight: 600; border: none;
}
.geo-btn:hover { background: #1d4ed8; }

/* ═══════════════════════════════════════════════════════════════
   FILES
   ═══════════════════════════════════════════════════════════════ */

.file-r {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--surface2);
  border-radius: var(--radius); margin-bottom: 6px;
}
.file-ic {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-nm { font-size: 13px; font-weight: 600; }
.file-mt { font-size: 11px; color: var(--text3); }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-dl {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff;
  font-size: 14px; cursor: pointer; transition: var(--transition);
  flex-shrink: 0; color: var(--blue);
}
.file-dl:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

.up-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer;
  margin-bottom: 14px; transition: var(--transition);
  color: var(--text3); font-size: 13px;
}
.up-area:hover { border-color: var(--accent); color: var(--accent); }

.add-r { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.add-r .inp { margin-bottom: 0; }
.add-r .btn { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   TASKS
   ═══════════════════════════════════════════════════════════════ */

.task-it {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; background: var(--surface2);
  border-radius: var(--radius); margin-bottom: 6px;
  cursor: pointer; transition: var(--transition);
}
.task-it:hover { background: var(--surface3); }
.task-it.t-over { background: var(--red-bg); border: 1px solid #fecaca; }

.task-tx { flex: 1; font-size: 13px; font-weight: 500; }
.task-tx.dn { text-decoration: line-through; opacity: .4; }
.task-dl { font-size: 11px; color: var(--text3); white-space: nowrap; }
.task-dl.ov { color: var(--red); font-weight: 600; }

.chk {
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: transparent;
  flex-shrink: 0; transition: var(--transition);
}
.chk.dn { border-color: var(--green); background: var(--green); color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   COVER PHOTO
   ═══════════════════════════════════════════════════════════════ */

.deal-cover {
  width: 100%; height: 160px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: 14px;
}
.cover-up {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center; cursor: pointer;
  margin-bottom: 14px; font-size: 13px; color: var(--text3);
  transition: var(--transition);
}
.cover-up:hover { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

.d-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 32px 36px 0; flex-wrap: wrap; gap: 12px;
}
.d-title { font-size: 26px; font-weight: 800; letter-spacing: -.6px; }
.d-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }

.stats-r {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; padding: 24px 36px;
}
.stat-c {
  display: flex; align-items: center; gap: 14px;
  padding: 20px; border-radius: var(--radius-lg);
  cursor: pointer; transition: var(--transition);
  border: 1px solid var(--border); background: var(--surface);
}
.stat-c:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-i { font-size: 26px; }
.stat-v { font-size: 20px; font-weight: 800; line-height: 1; letter-spacing: -.3px; }
.stat-lb { font-size: 11.5px; color: var(--text3); margin-top: 3px; }

.d-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px; padding: 0 36px 36px;
}
.d-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.d-card-t {
  font-size: 14px; font-weight: 700; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
  letter-spacing: -.2px;
}

/* Plan bar */
.plan-bg { background: var(--surface2); height: 10px; border-radius: 5px; overflow: hidden; margin: 8px 0; }
.plan-bar { height: 100%; border-radius: 5px; transition: width .6s var(--ease); }

/* Team row */
.team-r {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 6px; border-bottom: 1px solid var(--surface2);
  cursor: pointer; border-radius: 6px; transition: var(--transition);
}
.team-r:hover { background: var(--surface2); }
.team-nm { font-size: 13px; font-weight: 600; }
.team-rl { font-size: 11px; color: var(--text3); }

/* Recent deals */
.rec-d {
  padding: 10px 0; border-bottom: 1px solid var(--surface2);
  cursor: pointer; transition: var(--transition);
}
.rec-d:hover { background: var(--surface2); border-radius: 6px; padding: 10px 6px; }
.rec-t { font-size: 13px; font-weight: 600; }
.rec-m { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Tasks on dashboard */
.task-rd { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--surface2); }
.task-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   STATISTICS PAGE
   ═══════════════════════════════════════════════════════════════ */

.stats-pg { padding: 32px 36px; }
.stats-pg h2 { font-size: 22px; font-weight: 800; margin-bottom: 22px; letter-spacing: -.4px; }

.st-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.st-met {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px; border: 1px solid var(--border); text-align: center;
}
.st-mv { font-size: 26px; font-weight: 800; }
.st-ml { font-size: 12px; color: var(--text3); margin-top: 4px; }

.chart-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; border: 1px solid var(--border); margin-bottom: 20px;
}
.chart-t { font-size: 14px; font-weight: 700; margin-bottom: 18px; }

/* Bar chart */
.bar-ch { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 0 10px; }
.bar-gr { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%; border-radius: 4px 4px 0 0; min-height: 4px;
  transition: height .4s var(--ease);
}
.bar-lb { font-size: 10px; color: var(--text3); }
.bar-vl { font-size: 10px; font-weight: 700; }

/* Funnel chart */
.funnel-step { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.funnel-bar-bg {
  flex: 1; height: 28px; background: var(--surface2);
  border-radius: 6px; overflow: hidden; position: relative;
}
.funnel-bar-fill { height: 100%; border-radius: 6px; transition: width .5s ease; }
.funnel-bar-label {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 600; color: var(--text);
}
.funnel-pct { font-size: 12px; font-weight: 700; width: 44px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   CLIENTS LIST
   ═══════════════════════════════════════════════════════════════ */

.cl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  cursor: pointer; border: 1px solid var(--border);
  margin-bottom: 4px; transition: var(--transition);
}
.cl-row:hover { background: var(--accent-light); border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION TOAST
   ═══════════════════════════════════════════════════════════════ */

.notif {
  position: fixed; top: 20px; right: 20px;
  background: var(--text); color: #fff;
  padding: 14px 24px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; z-index: 300;
  opacity: 0; transition: opacity .3s;
  pointer-events: none; box-shadow: var(--shadow-lg);
}
.notif.show { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.empty { text-align: center; padding: 36px; color: var(--text3); font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE MENU BUTTON & SIDEBAR BACKDROP  (desktop: hidden)
   ═══════════════════════════════════════════════════════════════ */

.mobile-menu-btn { display: none; }
.sb-backdrop     { display: none; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE / PWA MOBILE  ≤ 768px
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   MOBILE BASE — все мобильные устройства ≤768px
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ══ 0. Глобально: никакого горизонтального скролла ══ */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-text-size-adjust: 100%;
  }
  #app { overflow-x: hidden; max-width: 100%; }

  /* ══ 1. iOS: поля ввода ≥16px чтобы не было авто-зума ══ */
  input, select, textarea { font-size: 16px !important; }

  /* ══ 2. НАВИГАЦИЯ — drawer sidebar ══ */

  .sidebar {
    position: fixed;
    top: 0; left: 0; height: 100%;
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
    z-index: 350;
    box-shadow: none;
    overflow-y: auto;
    /* Safe area: Dynamic Island / notch + home indicator */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar.collapsed      { transform: translateX(-100%); }
  .sidebar:not(.collapsed) {
    transform: translateX(0);
    box-shadow: 12px 0 48px rgba(0,0,0,.5);
  }

  /* Тач-цели навигации: минимум 48px */
  .nav-item {
    min-height: 48px;
    padding: 13px 16px;
    font-size: 14px;
  }

  /* Кнопка-крестик внутри sidebar */
  .toggle-sb {
    position: static;
    transform: none;
    align-self: flex-end;
    margin: 8px 12px 4px auto;
    width: 44px; height: 44px;
    border-radius: 10px;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
  }

  /* Тёмный backdrop при открытом sidebar */
  .sidebar:not(.collapsed) ~ .sb-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 340;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* ☰ Hamburger — фиксирован вверху-слева, position:fixed т.к. вне DOM топбара */
  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 6px);
    left: 12px;
    z-index: 100;
    width: 44px; height: 44px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 10px;
    font-size: 22px; line-height: 1;
    box-shadow: 0 2px 10px rgba(79,70,229,.45);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }

  /* Main: всегда на всю ширину (sidebar поверх, не толкает) */
  .main         { margin-left: 0 !important; }
  .main.shifted { margin-left: 0 !important; }

  /* ══ 3. ТОПБАР ══ */

  .topbar {
    padding: 10px 12px 10px 60px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    min-height: 56px;
    position: sticky; top: 0; z-index: 50;
    box-sizing: border-box;
    width: 100%;
  }
  .top-left  { gap: 6px; min-width: 0; flex-shrink: 1; overflow: hidden; }
  .top-right { gap: 6px; flex-shrink: 0; flex-wrap: nowrap; }

  .page-title  { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  .badge       { display: none; }
  .search-wrap { display: none; }
  .view-b      { padding: 5px 9px; font-size: 11px; }
  .topbar .btn.btn-p { padding: 8px 12px; font-size: 12px; min-height: 40px; white-space: nowrap; }
  .bell-btn    { width: 44px; height: 44px; flex-shrink: 0; }

  /* ══ 4. КАНБАН — вертикальный список колонок ══ */

  .board {
    flex-direction: column;
    padding: 10px 12px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    height: auto;
    min-height: calc(100svh - 56px);
    gap: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: none;
    box-sizing: border-box;
  }
  .column {
    min-width: 100%;
    flex: 1 1 100%;
    max-width: 100%;
    scroll-snap-align: none;
    box-sizing: border-box;
  }
  .col-body { padding: 6px 10px 10px; gap: 6px; }

  /* Карточки: достаточный padding для пальца */
  .card        { padding: 14px 12px; }
  .card:hover  { transform: none; box-shadow: var(--shadow); }
  .card-title  { font-size: 13px; line-height: 1.4; }
  .card-amount { font-size: 14px; font-weight: 700; }

  /* ══ 5. МОДАЛКИ — bottom sheet ══ */

  .m-overlay {
    padding: 0;
    align-items: flex-end;
  }

  /* Ручка drag handle */
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border2);
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
  }

  .modal,
  .modal.sm,
  .modal.lg {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 94svh;
    overflow-y: auto;
    box-shadow: 0 -8px 48px rgba(0,0,0,.2);
    animation: mobileSlideUp .28s var(--ease);
    /* Отступ для home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
  }
  @keyframes mobileSlideUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Deal modal: override flex для корректного скролла */
  .modal.lg { display: block; max-height: 94svh; }
  #dm-c     { display: block; overflow-y: auto; }

  .m-head     { padding: 12px 16px 10px; }
  .m-title    { font-size: 16px; }
  .m-head-top { gap: 10px; }

  .m-tabs { padding: 0 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .m-tab  { padding: 10px 12px; font-size: 12px; min-height: 44px; white-space: nowrap; }

  .m-head .btn-xs,
  .m-head button { min-height: 40px; min-width: 40px; }

  /* Pipeline: горизонтальный скролл */
  .pipeline {
    padding: 8px 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
  }
  .pip { padding: 8px 12px; font-size: 10px; min-height: 36px; flex-shrink: 0; }

  /* Карточка сделки: одна колонка */
  .deal-layout { display: block; }
  .deal-left {
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 12px;
  }
  .deal-right { overflow-y: visible; padding: 14px 12px; }

  /* ══ 6. ФОРМЫ И КНОПКИ ══ */

  .inp, select.inp    { min-height: 48px; padding: 12px 14px; margin-bottom: 8px; }
  textarea.inp        { min-height: 80px; font-size: 16px !important; }
  .rw                 { flex-direction: column; gap: 0; }
  .fl                 { font-size: 13px; margin-top: 10px; }
  .btn                { min-height: 44px; padding: 10px 16px; font-size: 13px; }
  .btn-xs             { min-height: 36px; padding: 6px 12px; font-size: 12px; }
  .btn-w, .btn-l      { min-height: 48px; }

  .close-r            { flex-direction: column; gap: 8px; }
  .close-r .btn-w,
  .close-r .btn-l     { flex: none; width: 100%; }

  .pay-sel { flex-wrap: wrap; gap: 6px; }
  .pay-opt {
    flex: 1; min-width: 80px; text-align: center;
    min-height: 44px;
    display: flex; align-items: center; justify-content: center;
  }

  .tag-opt  { min-height: 36px; display: flex; align-items: center; }
  .add-r    { flex-wrap: wrap; }
  .add-r .inp { flex: 1; min-width: 0; margin-bottom: 0; }

  .info-r { flex-wrap: wrap; gap: 4px; padding: 8px 0; }
  .info-l { min-width: 90px; font-size: 12px; }
  .info-v { font-size: 12px; justify-content: flex-start; text-align: left; }

  .dl-btns { flex-wrap: wrap; }
  .dl-btn  { min-height: 40px; }

  /* ══ 7. СПИСОК ЛИДОВ ══ */

  /* Строка лида: вертикальный flex — имя / телефон / статус / кнопки */
  .cl-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    align-items: stretch;
    box-sizing: border-box;
    width: 100%;
  }
  /* Точка-индикатор: скрыть */
  .cl-row > *:nth-child(1) { display: none; }
  /* Блок имя+телефон: на всю ширину */
  .cl-row > *:nth-child(2) { width: 100%; min-width: 0; flex: none; box-sizing: border-box; }
  /* Имя: жирно, обрезать */
  .cl-row > *:nth-child(2) > div:first-child {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Телефон/email: мелко, не переносить */
  .cl-row > *:nth-child(2) > div:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Статус-бейдж: по левому краю */
  .cl-row > *:nth-child(3) { align-self: flex-start; }
  /* Источник (4й): скрыть */
  .cl-row > *:nth-child(4) { display: none; }
  /* Мини-аватар (5й): скрыть */
  .cl-row > *:nth-child(5) { display: none; }
  /* Кнопки: flex в ряд, на всю ширину */
  .cl-row > *:nth-child(6) { display: flex; gap: 8px; width: 100%; }
  .cl-row > *:nth-child(6) .btn {
    flex: 1;
    justify-content: center;
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Лиды: скрыть фильтры статусов/менеджеров, кнопка "Новый лид" растягивается */
  .topbar .inp[id="lead-filter-status"],
  .topbar .inp[id="lead-filter-assignee"] { display: none; }
  #lead-filter-status ~ .btn.btn-p { flex: 1; }

  /* List-view (канбан): убрать боковые отступы, строки с flex-wrap */
  div[style*="padding:18px 32px"] { padding: 10px 12px !important; }
  div[style*="padding:18px 32px"] > div[style*="cursor:pointer"] {
    flex-wrap: wrap; gap: 6px; padding: 10px 12px !important;
  }
  /* Заголовок сделки: на всю строку */
  div[style*="padding:18px 32px"] > div[style*="cursor:pointer"] > span:first-child {
    flex: 1 1 100% !important; min-width: 0;
  }
  /* Клиент (2-я колонка): скрыть — дублирует заголовок на мобиле */
  div[style*="padding:18px 32px"] > div[style*="cursor:pointer"] > span:nth-child(2) {
    display: none;
  }

  [style*="overflow-x: auto"] { -webkit-overflow-scrolling: touch; }

  /* ══ 8. ЛЕНТА АКТИВНОСТИ ══ */

  .act-item { padding: 10px 0; gap: 10px; }
  .act-ic   { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; flex-shrink: 0; }
  .act-text { font-size: 12px; }

  /* ══ 9. ЗАДАЧИ И ФАЙЛЫ ══ */

  .task-it { padding: 10px 12px; min-height: 44px; }
  .chk     { width: 24px; height: 24px; flex-shrink: 0; }
  .task-dl { display: none; }

  .file-r  { padding: 8px 10px; gap: 8px; }
  .file-dl { width: 40px; height: 40px; }
  .file-nm { font-size: 12px; }
  .file-mt { font-size: 10px; }

  /* ══ 10. ДАШБОРД ══ */

  .d-head  { padding: 12px 12px 0 60px; flex-wrap: wrap; gap: 6px; align-items: center; }
  .d-title { font-size: 17px; white-space: nowrap; }
  .d-sub   { font-size: 11px; }

  /* KPI: одна колонка */
  .stats-r {
    padding: 10px 12px;
    gap: 8px;
    grid-template-columns: 1fr;
  }
  /* KPI карточка: горизонталь — иконка слева, число+подпись справа */
  .stat-c {
    padding: 12px 14px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .stat-i {
    font-size: 24px; line-height: 1; flex-shrink: 0;
    font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Apple Symbols", system-ui, sans-serif;
  }
  /* Число: не переносить */
  .stat-v  { font-size: 20px; white-space: nowrap; }
  .stat-lb { font-size: 11px; line-height: 1.3; }

  /* План месяца: убрать боковые отступы 36px из inline-стиля */
  div[style*="0 36px 20px"] { padding-left: 12px !important; padding-right: 12px !important; }
  .plan-bg { padding: 0; }

  .d-grid   { padding: 0 12px 20px; grid-template-columns: 1fr; gap: 10px; }
  .d-card   { padding: 14px; }
  .d-card-t { font-size: 13px; margin-bottom: 12px; }

  /* ══ 11. СТАТИСТИКА ══ */

  .stats-pg    { padding: 14px 12px 14px 60px; }
  .stats-pg h2 { font-size: 18px; margin-bottom: 14px; }
  .bar-ch      { height: 160px; }
  .chart-box   { padding: 16px; }

  /* ══ 12. ЛОГИН ══ */

  .login-box { width: calc(100vw - 32px); max-width: 400px; padding: 32px 22px; }
  .login-inp { padding: 14px 16px; }
  .login-btn { padding: 14px; min-height: 52px; }

  /* ══ 13. УВЕДОМЛЕНИЯ ══ */

  .notif-panel { width: calc(100vw - 16px); left: 8px; right: 8px; max-height: 70vh; overflow-y: auto; }
  .notif { right: 10px; left: 10px; width: auto; top: 10px; }

}

/* ═══════════════════════════════════════════════════════════════
   MOBILE PRECISE — iPhone 14 Pro Max и аналоги ≤430px
   viewport 430×932, safe-area top≈59px, bottom≈34px
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 430px) {

  /* Топбар: учитываем Dynamic Island / notch */
  .topbar {
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    padding-left: 60px;
    padding-right: 12px;
    padding-bottom: 10px;
    min-height: calc(env(safe-area-inset-top, 0px) + 52px);
  }

  /* Hamburger: строго под Dynamic Island */
  .mobile-menu-btn {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 12px;
  }

  /* Board: safe area снизу для home indicator */
  .board {
    padding-bottom: calc(env(safe-area-inset-bottom, 34px) + 20px);
    min-height: calc(100svh - env(safe-area-inset-top, 0px) - 52px);
  }

  /* Модалки: safe area снизу внутри контента */
  .modal,
  .modal.sm,
  .modal.lg {
    padding-bottom: env(safe-area-inset-bottom, 34px);
  }

  /* KPI: чуть компактнее подпись */
  .stat-lb { font-size: 10.5px; }
  .stat-v  { font-size: 19px; }

  /* Кнопки в строке лида: ещё компактнее */
  .cl-row > *:nth-child(6) .btn {
    font-size: 10.5px;
    padding: 5px 8px;
  }

  /* Карточки канбана: тайтл не мельче 13px */
  .card       { padding: 12px 10px; }
  .card-title { font-size: 13px; }

  /* Заголовок страницы: короче */
  .page-title { max-width: 130px; font-size: 12px; }

  /* Сайдбар: чуть уже на 390px viewport */
  .sidebar { width: 260px !important; }

  /* Форма: отступы снизу внутри модалки */
  .m-head { padding-bottom: 8px; }

}

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════ */

.login-bg {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 44px 40px; width: 380px; box-shadow: 0 24px 80px rgba(0,0,0,.3);
  text-align: center;
}
.login-logo {
  width: 52px; height: 52px; background: var(--accent);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff; margin: 0 auto 20px;
}
.login-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.4px; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 28px; }
.login-inp {
  width: 100%; padding: 13px 16px; border-radius: 10px;
  border: 1px solid var(--border); font-size: 14px;
  margin-bottom: 12px; background: var(--surface2);
  font-family: inherit; color: var(--text);
}
.login-inp:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.login-btn {
  width: 100%; padding: 14px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; font-size: 14px;
  font-weight: 700; cursor: pointer; margin-top: 6px;
  font-family: inherit; transition: var(--transition);
}
.login-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.login-err {
  color: var(--red); font-size: 12px; font-weight: 600;
  margin-top: 10px; min-height: 18px;
}

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION CENTER
   ═══════════════════════════════════════════════════════════════ */

.bell-wrap { position: relative; }
.bell-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); position: relative;
}
.bell-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.bell-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--surface);
}
.notif-panel {
  position: absolute; top: 48px; right: 0; width: 380px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,.15); border: 1px solid var(--border);
  z-index: 200; max-height: 480px; display: none;
  overflow: hidden;
}
.notif-panel.open { display: flex; flex-direction: column; }
.notif-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.notif-body-scroll { flex: 1; overflow-y: auto; max-height: 420px; }
.notif-body-scroll::-webkit-scrollbar { width: 4px; }
.notif-body-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.notif-item {
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: var(--transition); display: flex; gap: 12px; align-items: flex-start;
}
.notif-item:hover { background: var(--surface2); }
.notif-item:last-child { border-bottom: none; }
.notif-ic {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.notif-ic.red { background: var(--red-bg); color: var(--red); }
.notif-ic.amber { background: var(--amber-bg); color: var(--amber); }
.notif-ic.blue { background: var(--accent-light); color: var(--accent); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.notif-desc { font-size: 11px; color: var(--text3); line-height: 1.4; }
.notif-time { font-size: 10px; color: var(--text3); margin-top: 3px; }
.notif-empty { padding: 40px 20px; text-align: center; color: var(--text3); font-size: 13px; }


/* END OF styles.css */
