/* ============================================================
   MNA Interface - design system for BOP CRM redesign
   Derived from MNA brand-kit v10 (landing) -> adapted for a dense CRM.
   Single source of truth: tokens + all components live here.
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  /* --- base (from MNA as-is) --- */
  --bg:          #FFFFFF;   /* app background, cards on mute */
  --bg-mute:     #F7F7F5;   /* app canvas / secondary surfaces */
  --bg-sink:     #F1F0EC;   /* deeper inset (kanban column, inputs) */
  --text:        #1A1D21;   /* primary ink - never pure black */
  --text-mute:   #6B7280;   /* secondary text, labels */
  --text-soft:   #9CA3AF;   /* captions, placeholders */
  --line:        #E5E5E0;   /* borders, dividers */
  --line-soft:   #EFEEE9;   /* hairline inner dividers */

  /* --- brand accents (highlight only, not semantics) --- */
  --peach:       #FFAA58;
  --peach-deep:  #FF7C16;
  --peach-soft:  #FFF3E6;
  --lime:        #D0FF37;
  --lime-deep:   #B8E632;
  --lime-soft:   #F2FFCC;

  /* --- CTA --- */
  --cta-bg:      #1A1D21;
  --cta-text:    #FFFFFF;
  --cta-hover:   #000000;

  /* --- functional / semantic layer (CRM-only, warm-muted) --- */
  --ok:          #2F9E6B;   --ok-soft:      #E7F4EE;
  --warn:        #D98425;   --warn-soft:    #FCF1E3;
  --danger:      #D6493B;   --danger-soft:  #FBEAE7;
  --info:        #3B7BD4;   --info-soft:    #E9F0FB;
  --neutral:     #8A8F98;   --neutral-soft: #F0F0EE;

  /* --- pipeline stage scale (8, readable on white) --- */
  --st-new:        #3B7BD4;  --st-new-soft:        #E9F0FB; /* info  */
  --st-inprogress: #7C6FE0;  --st-inprogress-soft: #EDEBFB; /* violet */
  --st-scheduled:  --replaced; /* set below */
  --st-arrived:    #D98425;  --st-arrived-soft:    #FCF1E3; /* amber */
  --st-done:       #2F9E6B;  --st-done-soft:       #E7F4EE; /* green */
  --st-paid:       #178A57;  --st-paid-soft:       #E0F1E9; /* deep green */
  --st-cancel1:    #D6493B;  --st-cancel1-soft:    #FBEAE7; /* red */
  --st-cancel2:    #8A8F98;  --st-cancel2-soft:    #F0F0EE; /* neutral */

  /* --- radii --- */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full: 999px;

  /* --- shadows (minimal) --- */
  --sh-card: 0 1px 2px rgba(26,29,33,.06), 0 4px 12px rgba(26,29,33,.04);
  --sh-elev: 0 4px 12px rgba(26,29,33,.08), 0 16px 32px rgba(26,29,33,.06);
  --sh-pop:  0 12px 28px rgba(26,29,33,.12), 0 32px 64px rgba(26,29,33,.10);
  --ring:    0 0 0 3px rgba(255,170,88,.30);

  /* --- spacing --- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-12: 48px; --s-16: 64px;

  /* --- fonts --- */
  --f-display: 'PT Root UI', 'Inter', system-ui, sans-serif;
  --f-body:    'Inter', system-ui, sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* --- motion --- */
  --ease: cubic-bezier(.4,0,.2,1);
  --t-fast: 150ms;
  --t: 250ms;
}
/* scheduled stage = violet-lite, defined separately to avoid the placeholder above */
:root { --st-scheduled: #9A8CE8; --st-scheduled-soft: #F0EDFB; }

/* ---------- 2. RESET + BASE ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -.004em;
  color: var(--text);
  background: var(--bg-mute);
}
h1,h2,h3,h4 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.tab { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--text-mute); }
.soft  { color: var(--text-soft); }

/* tone text helpers */
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); }
.t-danger { color: var(--danger); } .t-info { color: var(--info); }
.t-neutral { color: var(--neutral); }

/* ---------- 3. TYPOGRAPHY SCALE (UI-dense) ---------- */
.display   { font-family: var(--f-mono); font-weight: 500; font-size: clamp(40px,6vw,72px); line-height: 1; letter-spacing: -.03em; }
.h-page    { font-family: var(--f-display); font-weight: 700; font-size: 28px; letter-spacing: -.02em; }
.h-section { font-family: var(--f-display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.h-card    { font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.num       { font-family: var(--f-mono); font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.eyebrow   { font-family: var(--f-mono); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-soft); }
.caption   { font-size: 12px; color: var(--text-mute); }

/* ---------- 4. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 38px; padding: 0 16px;
  font-size: 14px; font-weight: 500;
  border: 1.5px solid transparent; border-radius: var(--r-md);
  background: var(--bg); color: var(--text);
  border-color: var(--line);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--bg-mute); }
.btn:active { transform: translateY(1px); }
.btn .ic { display: inline-flex; }

.btn-primary { background: var(--cta-bg); color: var(--cta-text); border-color: var(--cta-bg); }
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }

.btn-accent { background: var(--peach); color: var(--text); border-color: var(--peach); }
.btn-accent:hover { background: var(--peach-deep); border-color: var(--peach-deep); }

.btn-ghost { background: transparent; border-color: var(--text); }
.btn-ghost:hover { background: var(--text); color: var(--bg); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--text-mute); }
.btn-quiet:hover { background: var(--bg-sink); color: var(--text); }

.btn-icon { width: 38px; padding: 0; justify-content: center; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }

.link-cta { font-weight: 500; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link-cta:hover { color: var(--peach-deep); }

/* ---------- 5. INPUTS ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--text-mute); }
.input, .select, textarea.input {
  height: 38px; width: 100%; padding: 0 12px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input::placeholder { color: var(--text-soft); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--peach); box-shadow: var(--ring); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236B7280' stroke-width='1.5'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-soft); pointer-events: none; }
.search .input { padding-left: 34px; }

/* ---------- 6. TAGS / STATUS CHIPS ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  font-size: 12px; font-weight: 500; line-height: 1;
  border-radius: var(--r-full);
  background: var(--neutral-soft); color: var(--neutral);
  white-space: nowrap;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok      { background: var(--ok-soft);      color: var(--ok); }
.tag.warn    { background: var(--warn-soft);    color: var(--warn); }
.tag.danger  { background: var(--danger-soft);  color: var(--danger); }
.tag.info    { background: var(--info-soft);    color: var(--info); }
.tag.neutral { background: var(--neutral-soft); color: var(--neutral); }
.tag.peach   { background: var(--peach-soft);   color: var(--peach-deep); }
.tag.lime    { background: var(--lime-soft);    color: var(--lime-deep); }

/* live pill with pulse */
.tag.live { background: var(--ok-soft); color: var(--ok); }
.tag.live .led { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(47,158,107,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,158,107,.45); } 70% { box-shadow: 0 0 0 6px rgba(47,158,107,0); } 100% { box-shadow: 0 0 0 0 rgba(47,158,107,0); } }

/* stage chips */
.tag.st-new        { background: var(--st-new-soft);        color: var(--st-new); }
.tag.st-inprogress { background: var(--st-inprogress-soft); color: var(--st-inprogress); }
.tag.st-scheduled  { background: var(--st-scheduled-soft);  color: var(--st-scheduled); }
.tag.st-arrived    { background: var(--st-arrived-soft);    color: var(--st-arrived); }
.tag.st-done       { background: var(--st-done-soft);       color: var(--st-done); }
.tag.st-paid       { background: var(--st-paid-soft);       color: var(--st-paid); }
.tag.st-cancel1    { background: var(--st-cancel1-soft);    color: var(--st-cancel1); }
.tag.st-cancel2    { background: var(--st-cancel2-soft);    color: var(--st-cancel2); }

/* ---------- 7. AVATAR ---------- */
.av {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  font-family: var(--f-display); font-weight: 600; font-size: 12px;
  border-radius: var(--r-sm); background: var(--bg-sink); color: var(--text);
}
.av.lg { width: 44px; height: 44px; font-size: 15px; border-radius: var(--r-md); }
.av.sm { width: 26px; height: 26px; font-size: 11px; border-radius: 7px; }
.av.peach { background: var(--peach-soft); color: var(--peach-deep); }
.av.lime  { background: var(--lime-soft);  color: var(--lime-deep); }
.av.info  { background: var(--info-soft);  color: var(--info); }
.av.ok    { background: var(--ok-soft);    color: var(--ok); }
.av.violet{ background: var(--st-inprogress-soft); color: var(--st-inprogress); }

/* ---------- 8. CARD / PANEL ---------- */
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--sh-card);
}
.panel {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line-soft);
}
.panel-head .sub { font-size: 12px; color: var(--text-soft); }
.panel-body { padding: var(--s-2) var(--s-3); }

/* ---------- 9. KPI TILE + HERO ---------- */
.kpi {
  display: flex; gap: var(--s-4); align-items: flex-start;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--sh-card);
}
.kpi .icn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none; border-radius: var(--r-md);
  background: var(--bg-sink); color: var(--text-mute);
}
.kpi .icn.peach { background: var(--peach-soft); color: var(--peach-deep); }
.kpi .icn.info  { background: var(--info-soft);  color: var(--info); }
.kpi .icn.violet{ background: var(--st-inprogress-soft); color: var(--st-inprogress); }
.kpi .icn.ok    { background: var(--ok-soft);    color: var(--ok); }
.kpi .body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--text-mute); }
.kpi .val   { font-family: var(--f-mono); font-weight: 500; font-size: 30px; line-height: 1.05; letter-spacing: -.02em; }
.kpi .val .u { font-size: 18px; color: var(--text-mute); margin-left: 2px; }
.kpi .delta { font-size: 12px; color: var(--text-soft); }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--danger); }

.hero {
  display: flex; flex-direction: column; gap: var(--s-3);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: var(--s-6);
  box-shadow: var(--sh-card);
}
.hero .top { display: flex; align-items: center; justify-content: space-between; }
.hero .figure { display: flex; align-items: baseline; gap: 10px; }
.hero .figure .num { font-size: clamp(44px,5vw,64px); }
.hero .figure .cur { font-family: var(--f-mono); font-size: 24px; color: var(--text-mute); }
.hero .delta { font-size: 13px; }

/* ---------- 10. DEAL CARD (kanban) + DEAL ROW (list) ---------- */
.deal-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--s-4);
  box-shadow: var(--sh-card); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.deal-card:hover { border-color: var(--line-hi, #D8D7D0); box-shadow: var(--sh-elev); transform: translateY(-1px); }
.deal-card .top { display: flex; align-items: center; gap: 10px; }
.deal-card .top .who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.deal-card .top .who b { font-size: 14px; font-weight: 600; }
.deal-card .top .who span { font-size: 12px; color: var(--text-soft); font-family: var(--f-mono); }
.deal-card .car { font-size: 12px; color: var(--text-mute); display: flex; align-items: center; gap: 6px; }
.deal-card .mid { display: flex; align-items: center; justify-content: space-between; }
.deal-card .mid .price { font-family: var(--f-mono); font-weight: 500; font-size: 15px; }
.deal-card .bottom { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-soft); padding-top: 8px; border-top: 1px solid var(--line-soft); }
.deal-card .bottom .age.fresh { color: var(--ok); }
.deal-card .bottom .age.urgent { color: var(--danger); font-weight: 500; }
.deal-card.urgent { border-color: var(--danger-soft); }

.deal-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px 12px; border-radius: var(--r-md); cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.deal-row:hover { background: var(--bg-mute); }
.deal-row .dr-meta { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.deal-row .dr-meta b { font-size: 14px; font-weight: 600; }
.deal-row .dr-meta span { font-size: 12px; color: var(--text-soft); }
.deal-row .price { font-family: var(--f-mono); font-weight: 500; font-size: 14px; }
.deal-row .price.zero { color: var(--text-soft); }

/* ---------- 11. FUNNEL + SOURCE BARS ---------- */
.funnel-row {
  display: grid; grid-template-columns: 8px 1fr 80px auto; align-items: center; gap: 12px;
  padding: 9px 4px;
}
.funnel-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stage,var(--neutral)); }
.funnel-row .name { font-size: 13px; color: var(--text); }
.funnel-row .bar { height: 6px; border-radius: var(--r-full); background: var(--bg-sink); position: relative; }
.funnel-row .bar::after { content: ''; position: absolute; inset: 0; width: var(--p,0%); border-radius: var(--r-full); background: var(--stage,var(--neutral)); transition: width var(--t) var(--ease); }
.funnel-row .n { font-family: var(--f-mono); font-weight: 500; font-size: 13px; text-align: right; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.funnel-row .n .amt-mini { font-size: 11px; color: var(--ok); }
.funnel-row.empty { opacity: .45; }
.funnel-row .n.zero { color: var(--text-soft); }

.src-row {
  display: grid; grid-template-columns: 140px 1fr 32px; align-items: center; gap: 12px;
  padding: 8px 4px;
}
.src-row .name { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.src-row .name .ic { color: var(--text-mute); display: inline-flex; }
.src-row .progress { height: 6px; border-radius: var(--r-full); background: var(--bg-sink); position: relative; }
.src-row .progress::after { content: ''; position: absolute; inset: 0; width: var(--p,0%); border-radius: var(--r-full); background: var(--peach); }
.src-row .n { font-family: var(--f-mono); font-weight: 500; font-size: 13px; text-align: right; }

/* ---------- 12. ACTIVITY TIMELINE ---------- */
.act-row { display: flex; align-items: baseline; gap: 8px; padding: 7px 4px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.act-row:last-child { border-bottom: none; }
.act-row .when { font-family: var(--f-mono); font-size: 11px; color: var(--text-soft); width: 64px; flex: none; }
.act-row b { font-weight: 600; }
.act-row .muted { color: var(--text-mute); }

/* ---------- 13. TABLE ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 500; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-soft);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--t-fast) var(--ease); cursor: pointer; }
table.data tbody tr:hover { background: var(--bg-mute); }
table.data .num { text-align: right; }

/* ---------- 14. TASK ROW ---------- */
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-md); transition: background var(--t-fast) var(--ease); }
.task-row:hover { background: var(--bg-mute); }
.task-check { width: 18px; height: 18px; flex: none; border: 1.5px solid var(--line); border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: all var(--t-fast) var(--ease); }
.task-check:hover { border-color: var(--peach); }
.task-row.done .task-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-row .t-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-row .t-info b { font-size: 14px; font-weight: 500; }
.task-row .t-info span { font-size: 12px; color: var(--text-soft); }
.task-row.done .t-info b { text-decoration: line-through; color: var(--text-soft); }
.task-due { font-family: var(--f-mono); font-size: 12px; color: var(--text-mute); }
.task-due.over { color: var(--danger); }
.task-due.soon { color: var(--warn); }

/* summary tiles (tasks) */
.sum-tile { display: flex; flex-direction: column; gap: 6px; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); cursor: pointer; transition: border-color var(--t-fast) var(--ease); }
.sum-tile:hover { border-color: var(--peach); }
.sum-tile.active { border-color: var(--text); }
.sum-tile .label { font-size: 12px; color: var(--text-mute); }
.sum-tile .val { font-family: var(--f-mono); font-weight: 500; font-size: 26px; }

/* ---------- 15. COMMAND CARDS ---------- */
.mini-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--s-3); }
.mini-head h3 { font-family: var(--f-display); font-weight: 600; font-size: 14px; }
.mini-head span { font-size: 11px; color: var(--text-soft); }

.brief-line { font-size: 14px; line-height: 1.5; color: var(--text); }
.brief-line b { font-weight: 600; }
.action-row { display: flex; gap: 8px; margin-top: var(--s-4); }

.attention-list { display: flex; flex-direction: column; gap: 2px; }
.attention-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--r-sm); }
.attention-item .signal { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--warn); }
.attention-item.risk .signal { background: var(--danger); }
.attention-item.ok .signal { background: var(--ok); }
.attention-item > div { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.attention-item b { font-size: 13px; font-weight: 600; }
.attention-item span { font-size: 12px; color: var(--text-soft); }
.attention-item .n { font-family: var(--f-mono); font-weight: 500; font-size: 13px; }

.forecast-number { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--s-3); }
.forecast-number strong { font-family: var(--f-mono); font-weight: 500; font-size: 32px; letter-spacing: -.02em; }
.forecast-number span { font-size: 12px; color: var(--text-mute); }
.forecast-progress { height: 8px; border-radius: var(--r-full); background: var(--bg-sink); overflow: hidden; }
.forecast-progress span { display: block; height: 100%; background: var(--peach); border-radius: var(--r-full); }
.forecast-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: var(--s-4); }
.forecast-split .mini { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--bg-mute); border-radius: var(--r-sm); }
.forecast-split .mini span { font-size: 11px; color: var(--text-soft); }
.forecast-split .mini b { font-family: var(--f-mono); font-weight: 500; font-size: 15px; }
.forecast-note { margin-top: var(--s-4); font-size: 12px; color: var(--text-mute); line-height: 1.5; }

/* ---------- 16. DRAWER ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(26,29,33,.32); backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 0; right: 0; z-index: 50; height: 100vh; width: 520px; max-width: 92vw; background: var(--bg); box-shadow: var(--sh-pop); display: flex; flex-direction: column; }
/* мобилка: дровер выезжает СНИЗУ (bottom-sheet), а не справа */
@media (max-width: 760px) {
  .drawer {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%; max-width: 100%; height: 92vh; max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 32px rgba(0,0,0,.18);
  }
}

/* ============ ЧАТЫ / INBOX ============ */
.chats-page { box-sizing: border-box; height: calc(100vh - 120px); min-height: 0; overflow: hidden; }
.chats-layout { height: 100%; min-height: 0; display: grid; grid-template-columns: 300px minmax(420px, 1fr) 260px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); box-shadow: 0 8px 28px rgba(24,28,34,.06); }
.chats-list { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: #fafaf9; }
.chats-list-head { min-height: 58px; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 8px; }
.chats-list-head > div { display: flex; flex-direction: column; gap: 2px; }
.chats-list-head b { font-size: 15px; letter-spacing: -.01em; }
.chats-list-head span { color: var(--text-soft); font-size: 11px; }
.chats-live { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: #e9f7ef; color: #268b56 !important; font-size: 10px !important; text-transform: uppercase; letter-spacing: .04em; }
.chats-live i, .chat-wa-status i { width: 6px; height: 6px; border-radius: 50%; background: #2db875; display: inline-block; }
.chats-list-search { height: 34px; box-sizing: border-box; display: flex; align-items: center; gap: 7px; margin: 4px 12px 10px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text-soft); }
.chats-list-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; }
.chats-list-scroll { min-height: 0; flex: 1; overflow-y: auto; }
.chat-list-row { width: 100%; min-height: 68px; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; border-top: 1px solid rgba(229,230,226,.8); background: transparent; color: var(--text); text-align: left; cursor: pointer; transition: background .15s ease, box-shadow .15s ease; }
.chat-list-row:hover { background: #f1f3f1; }
.chat-list-row.active { background: var(--bg); box-shadow: inset 3px 0 0 var(--indigo); }
.chat-list-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.chat-list-main b, .chat-list-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-main b { font-size: 13px; font-weight: 650; }
.chat-list-main span, .chat-list-meta { color: var(--text-mute); font-size: 11px; }
.chat-list-meta { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.chat-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint, #31b77a); }
.chat-list-empty { padding: 28px 16px; color: var(--text-mute); font-size: 13px; text-align: center; }
.chat-conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-mute); }
.chat-conversation-head { min-height: 64px; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--bg); }
.chat-conversation-head > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-conversation-head > div b, .chat-conversation-head > div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conversation-head > div b { font-size: 14px; }
.chat-conversation-head > div span { color: var(--text-mute); font-size: 12px; }
.chat-wa-status { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: #278856; font-size: 11px; white-space: nowrap; }
.chat-head-deal { margin-left: 4px; white-space: nowrap; }
.chat-conversation-body { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: auto; padding: 22px 24px 18px; background: #f6f7f5; }
.chat-conversation-body .dp-msg { width: fit-content; max-width: min(78%, 560px); min-width: 72px; margin: 0 0 8px; padding: 10px 12px; border-radius: 12px; box-shadow: 0 1px 2px rgba(24,28,34,.05); }
.chat-conversation-body .dp-msg.out { align-self: flex-end; background: var(--text); color: var(--bg); border-bottom-right-radius: 4px; }
.chat-conversation-body .dp-msg.in { align-self: flex-start; background: var(--bg); border: 1px solid #e3e5e1; border-bottom-left-radius: 4px; }
.chat-conversation-body .dp-msg img, .chat-conversation-body .dp-msg video { max-width: 100%; max-height: 360px; width: auto; object-fit: contain; border-radius: 8px; }
.chat-conversation-compose { min-height: 68px; box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.chat-compose-icon { width: 36px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text-mute); font-size: 20px; line-height: 1; cursor: pointer; }
.chat-conversation-compose .input { min-width: 0; flex: 1; height: 40px; box-sizing: border-box; border-radius: 10px; }
.chat-conversation-compose .btn { height: 40px; white-space: nowrap; }
.chat-empty-state { height: 100%; min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--text-mute); text-align: center; }
.chat-empty-state b { color: var(--text); font-size: 16px; }
.chats-context { min-width: 0; padding: 18px; overflow: auto; border-left: 1px solid var(--line); background: var(--bg); }
.chat-context-card { display: flex; flex-direction: column; gap: 15px; }
.chat-context-person { display: flex; align-items: center; gap: 10px; }
.chat-context-person > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-context-person > div b { font-size: 14px; }
.chat-context-person span:not(.av) { color: var(--text-mute); font-size: 12px; overflow-wrap: anywhere; }
.chat-context-row { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-context-row span { color: var(--text-soft); font-size: 11px; }
.chat-context-row b { font-size: 13px; overflow-wrap: anywhere; }
.chat-open-deal { width: 100%; justify-content: center; margin-top: 2px; }

@media (max-width: 980px) {
  .chats-layout { grid-template-columns: 250px minmax(340px, 1fr); }
  .chats-context { display: none; }
}

@media (max-width: 760px) {
  .chats-page { height: calc(100vh - 112px); }
  .chats-layout { min-height: 0; display: flex; flex-direction: column; border-radius: 12px; }
  .chats-list { flex: 0 0 190px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-conversation { min-height: 0; flex: 1; }
  .chat-conversation-head { padding: 10px 12px; }
  .chat-wa-status { display: none; }
  .chat-conversation-body { padding: 14px 12px; }
  .chat-conversation-compose { padding: 8px; }
  .chat-conversation-compose .btn { padding-left: 12px; padding-right: 12px; }
}
.dealdr-head { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.dealdr-head h2 { font-size: 22px; }
.dealdr-body { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); }
.df-actions { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { display: flex; flex-direction: column; gap: 3px; padding: var(--s-4); background: var(--bg-mute); border-radius: var(--r-md); }
.stat-box span { font-size: 11px; color: var(--text-soft); }
.stat-box b { font-family: var(--f-mono); font-weight: 500; font-size: 18px; }

/* ---------- 17. EMPTY STATE ---------- */
.state-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 36px 20px; color: var(--text-soft); }
.state-empty b { font-size: 14px; color: var(--text-mute); font-weight: 600; }
.state-empty span { font-size: 13px; }

/* ---------- 18. APP SHELL (sidebar + topbar) ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg); border-right: 1px solid var(--line); padding: var(--s-5) var(--s-4); display: flex; flex-direction: column; gap: var(--s-5); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand .mark { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: #000; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-weight: 500; font-size: 13px; flex: none; }
.brand .mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand .name { font-family: var(--f-display); font-weight: 700; font-size: 15px; }
.brand .name small { display: block; font-family: var(--f-mono); font-weight: 400; font-size: 10px; color: var(--text-soft); letter-spacing: .08em; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .gl { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-soft); padding: 8px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); font-size: 14px; color: var(--text-mute); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.nav-item .ic { display: inline-flex; }
.nav-item:hover { background: var(--bg-mute); color: var(--text); }
.nav-item.active { background: var(--text); color: var(--bg); }
.nav-item .badge { margin-left: auto; font-family: var(--f-mono); font-size: 11px; background: var(--peach-soft); color: var(--peach-deep); padding: 1px 7px; border-radius: var(--r-full); }
.nav-item.active .badge { background: rgba(255,255,255,.18); color: #fff; }
.user-chip { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md); background: var(--bg-mute); }
.user-chip .dr-meta { display: flex; flex-direction: column; gap: 1px; }
.user-chip .dr-meta b { font-size: 13px; font-weight: 600; }
.user-chip .dr-meta span { font-size: 11px; color: var(--text-soft); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: var(--s-5) var(--s-6); background: var(--bg-mute); position: sticky; top: 0; z-index: 5; }
.topbar .ph { display: flex; flex-direction: column; gap: 4px; }
.topbar .ph .sub { font-size: 13px; color: var(--text-mute); }
.topbar .ph .sub b { color: var(--text); font-weight: 600; }
.topbar .controls { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; font-size: 13px; border: none; background: transparent; color: var(--text-mute); border-radius: 8px; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg button.on { background: var(--text); color: var(--bg); }

.page { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); }

/* layout helpers */
.grid { display: grid; gap: var(--s-5); }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.cols-2 { grid-template-columns: repeat(2,1fr); }
.dash-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s-5); }
.dash-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--s-5); }
.dash-cmd { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--s-5); }
.dash-mid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }

/* ---------- 19. CHART (svg sparkline area) ---------- */
.chart-wrap { padding: var(--s-3) var(--s-5) var(--s-5); }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 0 var(--s-3); }
.chart-head .peak { font-family: var(--f-mono); font-size: 11px; color: var(--text-soft); }
.chart svg { width: 100%; height: auto; display: block; }

/* ---------- 20. RESPONSIVE ---------- */
@media (max-width: 1100px) {
  .dash-top, .dash-cmd, .dash-mid, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .dash-kpis { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page { padding: var(--s-4); }
  .topbar { padding: var(--s-4); }
}

/* ---------- foundation page helpers ---------- */
.fd-wrap { max-width: 1080px; margin: 0 auto; padding: 48px 32px 96px; }
.fd-sec { margin-top: 56px; }
.fd-sec > h2 { font-size: 22px; margin-bottom: 4px; }
.fd-sec > .caption { margin-bottom: 24px; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 14px; }
.swatch { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--bg); }
.swatch .chip { height: 72px; }
.swatch .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.swatch .meta b { font-size: 13px; font-weight: 600; }
.swatch .meta code { font-family: var(--f-mono); font-size: 11px; color: var(--text-soft); }
.demo-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.demo-grid { display: grid; gap: 16px; }
.radii-row { display: flex; gap: 20px; flex-wrap: wrap; }
.radii-box { width: 90px; height: 90px; background: var(--peach-soft); border: 1px solid var(--peach); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-family: var(--f-mono); font-size: 11px; color: var(--peach-deep); }
.comp-frame { background: var(--bg-mute); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; }
.comp-label { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-soft); margin-bottom: 14px; }

/* ---------- 21. KANBAN (pipeline) ---------- */
.filter-bar { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-4) var(--s-5); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); }
.filter-bar .grp { display: flex; align-items: center; gap: 8px; }
.filter-bar .gl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); }
.chips { display: inline-flex; gap: 4px; background: var(--bg-sink); border-radius: var(--r-md); padding: 3px; }
.chips button { height: 28px; padding: 0 12px; font-size: 13px; border: none; background: transparent; color: var(--text-mute); border-radius: 8px; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.chips button.on { background: var(--bg); color: var(--text); box-shadow: var(--sh-card); }
.filter-bar .spacer { flex: 1; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(248px, 1fr); gap: var(--s-4); overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-mute); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; min-width: 0; }
.col-head { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.col-head .label-row { display: flex; align-items: center; gap: 8px; }
.col-head .label-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stage,var(--neutral)); }
.col-head .label-row .label { font-size: 13px; font-weight: 600; flex: 1; }
.col-head .label-row .count { font-family: var(--f-mono); font-size: 12px; color: var(--text-mute); }
.col-head .sub { font-family: var(--f-mono); font-size: 11px; color: var(--text-soft); }
.col-body { display: flex; flex-direction: column; gap: 10px; padding: 12px; flex: 1; min-height: 80px; }
.col-add { padding: 8px 12px 12px; }
.col-add button { width: 100%; height: 34px; border: 1px dashed var(--line); background: transparent; color: var(--text-soft); border-radius: var(--r-sm); font-size: 13px; transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.col-add button:hover { border-color: var(--peach); color: var(--peach-deep); }

/* ---------- 22. FINANCE / TEAM / SETTINGS ---------- */
.fin-figure { display: flex; align-items: baseline; gap: 10px; }
.fin-figure .num { font-family: var(--f-mono); font-weight: 500; font-size: clamp(40px,5vw,56px); letter-spacing: -.03em; }
.fin-figure .cur { font-family: var(--f-mono); font-size: 22px; color: var(--text-mute); }

.mgr-card { display: flex; flex-direction: column; gap: var(--s-4); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--sh-card); }
.mgr-head { display: flex; align-items: center; gap: 12px; }
.mgr-head .who { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.mgr-head .who b { font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.mgr-head .who span { font-size: 12px; color: var(--text-soft); }
.mgr-head .crown { font-size: 11px; font-weight: 500; color: var(--peach-deep); background: var(--peach-soft); padding: 2px 8px; border-radius: var(--r-full); }
.mgr-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.mgr-stats .st { display: flex; flex-direction: column; gap: 2px; }
.mgr-stats .st b { font-family: var(--f-mono); font-weight: 500; font-size: 18px; }
.mgr-stats .st span { font-size: 11px; color: var(--text-soft); }
.mgr-plan { display: flex; flex-direction: column; gap: 6px; }
.mgr-plan .row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.mgr-plan .bar { height: 8px; border-radius: var(--r-full); background: var(--bg-sink); overflow: hidden; }
.mgr-plan .bar span { display: block; height: 100%; background: var(--ok); border-radius: var(--r-full); }

.setting-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.setting-row:last-child { border-bottom: none; }
.setting-row .meta { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.setting-row .meta b { font-size: 14px; font-weight: 600; }
.setting-row .meta span { font-size: 12px; color: var(--text-soft); }
.toggle { width: 40px; height: 23px; border-radius: var(--r-full); background: var(--bg-sink); position: relative; cursor: pointer; transition: background var(--t-fast) var(--ease); flex: none; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--bg); box-shadow: var(--sh-card); transition: left var(--t-fast) var(--ease); }
.toggle.on { background: var(--ok); }
.toggle.on::after { left: 19px; }

.seg-tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--line); }
.seg-tabs button { height: 38px; padding: 0 16px; border: none; background: transparent; color: var(--text-mute); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.seg-tabs button.on { color: var(--text); border-bottom-color: var(--peach); font-weight: 500; }

@media (max-width: 1100px) { .kanban { grid-auto-columns: minmax(240px, 1fr); } }

/* ---------- 23. FORMS ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-sec { display: flex; flex-direction: column; gap: 14px; }
.amount-preview { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; background: var(--bg-mute); border-radius: var(--r-md); }
.amount-preview b { font-family: var(--f-mono); font-weight: 500; font-size: 24px; }
.amount-preview span { font-size: 12px; color: var(--text-soft); }

/* segmented choice (source / role pick) */
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-full); font-size: 13px; cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.choice label:hover { border-color: var(--peach); }
.choice input { display: none; }
.choice input:checked + label, .choice label.on { border-color: var(--text); background: var(--text); color: var(--bg); }

/* ---------- 24. STATUS PICKER ---------- */
.status-picker { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-pop); max-width: 320px; }
.status-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; transition: background var(--t-fast) var(--ease); }
.status-opt:hover { background: var(--bg-mute); }
.status-opt.current { background: var(--bg-mute); }
.status-opt .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stage,var(--neutral)); flex: none; }
.status-opt .check { margin-left: auto; color: var(--ok); display: inline-flex; }

/* ---------- 25. TOAST ---------- */
.toast-stack { display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--text); color: var(--bg); border-radius: var(--r-md); box-shadow: var(--sh-pop); min-width: 280px; }
.toast .ic { display: inline-flex; flex: none; }
.toast.ok .ic { color: #6BE3A8; }
.toast.danger .ic { color: #FF9B8E; }
.toast > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.toast b { font-size: 14px; font-weight: 500; }
.toast span { font-size: 12px; opacity: .7; }
.toast .x { margin-left: auto; opacity: .6; cursor: pointer; display: inline-flex; }

/* ---------- 26. MOBILE BOTTOM NAV ---------- */
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .mobile-nav { display: grid; grid-template-columns: repeat(5,1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 10px; color: var(--text-soft); }
  .mobile-nav a.active { color: var(--text); }
  .page { padding-bottom: 76px; }
}

/* ---------- 27. LOGIN ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg-mute); padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-elev); padding: 40px 36px; display: flex; flex-direction: column; gap: 22px; }
.login-card .brand { justify-content: center; }
.login-card .mark { width: 44px; height: 44px; border-radius: 50%; font-size: 15px; }
.login-card h1 { font-size: 24px; text-align: center; }
.login-card .lead { text-align: center; font-size: 14px; color: var(--text-mute); margin-top: -14px; }

/* ---------- 28. FULL-SCREEN DEAL ---------- */
.deal-full { position: fixed; inset: 0; z-index: 55; background: var(--bg-mute); display: flex; flex-direction: column; }
.deal-full .dft { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--bg); border-bottom: 1px solid var(--line); }
.deal-full .dft .who { display: flex; flex-direction: column; gap: 2px; }
.deal-full .dft .who h2 { font-size: 20px; }
.deal-full .dft .who .caption { font-family: var(--f-mono); }
.deal-full .dft .spacer { flex: 1; }
.deal-full .dfs { flex: 1; overflow-y: auto; padding: 28px; }
.deal-full .dfcols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; max-width: 1180px; margin: 0 auto; align-items: start; }
.deal-full .dfcol { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 920px) { .deal-full .dfcols { grid-template-columns: 1fr; } }

.svc-line { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.svc-line .nm { font-weight: 500; }
.svc-line .nt { font-size: 12px; color: var(--text-soft); }
.svc-line .pr { font-family: var(--f-mono); font-weight: 500; }
.svc-sum { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.svc-sum .r { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.svc-sum .r b { font-family: var(--f-mono); font-weight: 500; }
.svc-sum .r.total { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 15px; }
.svc-sum .r.total b { font-size: 18px; }
.svc-sum .r.paid b { color: var(--ok); }
.svc-sum .r.due b { color: var(--warn); }

.info-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-mute); }
.info-row .v { font-weight: 500; text-align: right; }
.comment-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.comment-box .input { flex: 1; }

/* ---------- 29. WHATSAPP CHAT (in deal) ---------- */
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head .wa { width: 30px; height: 30px; flex: none; border-radius: 8px; background: #25D366; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.chat-head .who { display: flex; flex-direction: column; gap: 1px; }
.chat-head .who b { font-size: 14px; font-weight: 600; }
.chat-head .who span { font-size: 11px; color: var(--text-soft); }
.chat-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; max-height: 360px; overflow-y: auto; background: var(--bg-mute); }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.msg.in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--cta-bg); color: var(--cta-text); border-bottom-right-radius: 4px; }
.msg .tm { display: block; font-size: 10px; opacity: .55; margin-top: 4px; text-align: right; font-family: var(--f-mono); }
.chat-day { align-self: center; font-size: 11px; color: var(--text-soft); padding: 2px 0; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.chat-input .input { flex: 1; }
.chat-noint { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 20px; color: var(--text-soft); }
.chat-noint .wa-mut { width: 38px; height: 38px; border-radius: 10px; background: var(--bg-sink); color: var(--text-soft); display: inline-flex; align-items: center; justify-content: center; }
.chat-noint b { font-size: 14px; color: var(--text-mute); font-weight: 600; }
.chat-noint span { font-size: 13px; }

/* ---------- 30. MANAGER EARNINGS (3%) ---------- */
.earn-card { background: var(--cta-bg); color: #fff; border-radius: var(--r-xl); padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--sh-card); }
.earn-card .top { display: flex; align-items: center; justify-content: space-between; }
.earn-card .eyebrow { color: rgba(255,255,255,.5); }
.earn-card .rate { font-family: var(--f-mono); font-size: 12px; color: var(--lime); background: rgba(208,255,55,.12); padding: 3px 10px; border-radius: var(--r-full); }
.earn-card .big { font-family: var(--f-mono); font-weight: 500; font-size: clamp(38px,4.5vw,56px); color: var(--lime); letter-spacing: -.03em; line-height: 1; }
.earn-card .lead { font-size: 13px; color: rgba(255,255,255,.6); }
.earn-card .split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.earn-card .split .it { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: rgba(255,255,255,.05); border-radius: var(--r-md); }
.earn-card .split .it span { font-size: 11px; color: rgba(255,255,255,.45); }
.earn-card .split .it b { font-family: var(--f-mono); font-weight: 500; font-size: 16px; }
.earn-card .split .it b.lime { color: var(--lime); }

/* ===== Модалка гонорара (иконка-замок в топбаре → пароль → эта панель) ===== */
@keyframes payoutFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes payoutPop { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
#payout-icon-btn.active { background: var(--cta-bg); color: #fff; }
.payout-backdrop { position: fixed; inset: 0; z-index: 9000; background: rgba(8,10,12,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 86px 16px 24px; animation: payoutFade .16s ease-out; }
.payout-modal { width: min(440px, 94vw); background: #15171A; border: 1px solid rgba(255,255,255,.08); border-radius: 24px; padding: 24px 24px 12px; box-shadow: 0 30px 90px rgba(0,0,0,.6); color: #fff; animation: payoutPop .2s cubic-bezier(.2,.8,.2,1); }
.pm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.pm-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.45); }
.pm-period { font-size: 14px; color: rgba(255,255,255,.9); margin-top: 4px; text-transform: capitalize; }
.pm-close { flex: none; width: 32px; height: 32px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; transition: background .15s; }
.pm-close:hover { background: rgba(255,255,255,.18); }
.pm-period-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.pm-seg { display: inline-flex; background: rgba(255,255,255,.06); border-radius: 11px; padding: 3px; }
.pm-seg-btn { border: 0; background: transparent; color: rgba(255,255,255,.55); font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 8px; cursor: pointer; transition: all .15s; }
.pm-seg-btn:hover { color: #fff; }
.pm-seg-btn.active { background: var(--lime); color: #14160f; }
.pm-nav { display: inline-flex; align-items: center; gap: 4px; }
.pm-nav-btn { width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgba(255,255,255,.06); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; transition: background .15s; }
.pm-nav-btn:hover { background: rgba(255,255,255,.16); }
.pm-nav-btn.is-now { opacity: .4; }
.pm-nav-label { min-width: 116px; text-align: center; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); text-transform: capitalize; }
.pm-hero { margin-bottom: 20px; }
.pm-total { font-family: var(--f-mono); font-weight: 500; font-size: clamp(36px, 9vw, 50px); line-height: 1; color: var(--lime); letter-spacing: -.035em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm-cur { font-size: .5em; margin-left: .18em; color: rgba(208,255,55,.75); }
.pm-share { margin-top: 14px; display: inline-flex; align-items: center; font-size: 13px; color: rgba(255,255,255,.7); background: rgba(208,255,55,.1); border: 1px solid rgba(208,255,55,.18); padding: 7px 14px; border-radius: 999px; }
.pm-share b { color: var(--lime); font-family: var(--f-mono); font-weight: 600; margin: 0 .25em; }
.pm-rows { display: flex; flex-direction: column; }
.pm-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid rgba(255,255,255,.07); }
.pm-row .l { font-size: 12.5px; color: rgba(255,255,255,.5); line-height: 1.4; }
.pm-row .v { font-family: var(--f-mono); font-size: 15px; font-weight: 600; white-space: nowrap; }
.pm-row .v.pos { color: var(--lime); }
.pm-row .v.neg { color: #ff7a7a; }

.payout-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.payout-row:last-child { border-bottom: none; }
.payout-row .who { display: flex; align-items: center; gap: 10px; }
.payout-row .who .nm { font-weight: 500; }
.payout-row .who .rl { font-size: 11px; color: var(--text-soft); }
.payout-row .rev { font-family: var(--f-mono); font-size: 13px; color: var(--text-mute); text-align: right; }
.payout-row .pay { font-family: var(--f-mono); font-weight: 500; font-size: 15px; text-align: right; min-width: 96px; }
.payout-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--bg-mute); border-top: 1px solid var(--line); }
.payout-foot b { font-family: var(--f-mono); font-weight: 500; font-size: 18px; }

.mgr-earn { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--bg-mute); border-radius: var(--r-md); }
.mgr-earn span { font-size: 12px; color: var(--text-mute); }
.mgr-earn b { font-family: var(--f-mono); font-weight: 500; font-size: 17px; }

/* ---------- 31. KANBAN DRAG ---------- */
.deal-card { position: relative; }
.deal-card.dragging { opacity: .4; }
.col.drop-on { background: var(--peach-soft); outline: 2px dashed var(--peach); outline-offset: -2px; }

/* column reorder (drag by head) */
.col-head { cursor: grab; }
.col-head:active { cursor: grabbing; }
.col.col-dragging { opacity: .5; outline: 2px dashed var(--peach); outline-offset: -2px; border-radius: var(--r-md); }

/* bulk selection checkbox on card */
.card-select { position: absolute; top: 10px; right: 10px; width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--bg); display: inline-flex; align-items: center; justify-content: center; color: #fff; cursor: pointer; opacity: 0; transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); z-index: 2; }
.card-select svg { opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.deal-card:hover .card-select { opacity: 1; }
.deal-card.selected .card-select { opacity: 1; background: var(--peach); border-color: var(--peach); }
.deal-card.selected .card-select svg { opacity: 1; }
.deal-card.selected { border-color: var(--peach); box-shadow: var(--ring); }

/* bulk action bar */
.bulk-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 75; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; background: var(--text); color: var(--bg); border-radius: var(--r-full); box-shadow: var(--sh-pop); }
.bulk-bar .cnt { font-size: 13px; color: rgba(255,255,255,.85); white-space: nowrap; }
.bulk-bar .cnt b { font-family: var(--f-mono); font-weight: 600; color: #fff; }
.bulk-bar .cnt i { font-style: normal; }
.bulk-bar .bsp { width: 1px; height: 22px; background: rgba(255,255,255,.18); margin: 0 4px; }
.bulk-bar .btn { background: rgba(255,255,255,.10); border-color: transparent; color: #fff; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.20); }
.bulk-bar .btn-quiet { background: transparent; color: rgba(255,255,255,.7); }
.bulk-bar .btn-quiet:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- 32. NOTIFICATIONS ---------- */
.bell { position: relative; }
.bell .badge-dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--bg-mute); }
.notif-pop { position: fixed; top: 64px; right: 24px; z-index: 65; width: 360px; max-width: calc(100vw - 32px); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-pop); overflow: hidden; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.notif-item:last-child { border-bottom: none; }
.notif-item .ic { width: 32px; height: 32px; flex: none; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.notif-item .bd { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-item .bd b { font-size: 13px; font-weight: 600; }
.notif-item .bd span { font-size: 12px; color: var(--text-soft); }
.notif-item .tm { font-family: var(--f-mono); font-size: 10px; color: var(--text-soft); }
.notif-item.unread { background: var(--peach-soft); }

/* ---------- 33. CALENDAR ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); text-align: center; padding-bottom: 4px; }
.cal .cell { min-height: 92px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; display: flex; flex-direction: column; gap: 5px; background: var(--bg); }
.cal .cell.dim { background: var(--bg-mute); color: var(--text-soft); }
.cal .cell.today { border-color: var(--peach); box-shadow: var(--ring); }
.cal .cell .d { font-family: var(--f-mono); font-size: 12px; color: var(--text-mute); }
.cal .cell.today .d { color: var(--peach-deep); font-weight: 500; }
.cal .ev { font-size: 11px; padding: 3px 6px; border-radius: 5px; background: var(--st-scheduled-soft); color: var(--st-scheduled); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal .ev.arrived { background: var(--st-arrived-soft); color: var(--st-arrived); }
.cal .ev.paid { background: var(--st-paid-soft); color: var(--st-paid); }

/* ---------- 34. PLAN on earn-card ---------- */
.earn-card .planline { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.6); margin-top: 4px; }
.earn-card .planline b { color: #fff; font-family: var(--f-mono); font-weight: 500; }
.earn-card .planbar { height: 7px; border-radius: var(--r-full); background: rgba(255,255,255,.12); overflow: hidden; margin-top: 7px; }
.earn-card .planbar span { display: block; height: 100%; background: var(--lime); border-radius: var(--r-full); }
.mgr-plan .row .amt { font-family: var(--f-mono); font-size: 12px; color: var(--text-mute); }

/* ===================================================================
   v3 ENGINE SUPPLEMENT - классы движка v2, которых нет в дизайн-системе.
   Держим в конце файла, чтобы не размывать дизайн-токены выше.
   =================================================================== */

/* Меню пользователя в футере сайдбара (.user-chip .more -> #user-menu) */
.user-chip .more { padding: 0; }
.user-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-pop, 0 8px 24px rgba(0,0,0,.12));
  padding: 6px;
  z-index: 30;
}
.user-menu.open { display: flex; }
.user-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-mute);
  cursor: pointer;
}
.user-menu a:hover { background: var(--bg-mute); color: var(--text); }
.user-menu a.rust-text,
.rust-text { color: var(--danger); }
.rust-text:hover { color: var(--danger); }

/* Уведомления-поповер из топбара (window.BOP.toggleNotifs) */
#notif-pop {
  position: absolute;
  top: 56px; right: 24px;
  width: 320px; max-width: calc(100vw - 32px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-pop, 0 8px 24px rgba(0,0,0,.12));
  padding: 12px;
  z-index: 60;
}

/* ========================================================================
   SUPPLEMENT (production) - классы которых нет в дизайн-системе выше.
   Добавлено при миграции экранов на вёрстку редизайна. НЕ трогать токены/
   компоненты выше - только дополнения.
   ======================================================================== */
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } }

/* бейдж возвратного клиента на карточке сделки */
.repeat-badge { font-size: 11px; opacity: .85; }

/* дата-инпуты в фильтр-баре воронки */
.pipe-date { height: 36px; }

/* highlight выбранной карточки (drawer/selected) */
.deal-card.is-selected { border-color: var(--peach); box-shadow: var(--sh-elev); }

/* ---- DEAL PAGE (.deal-full) hook-классы из движка v2 ---- */
/* статус-пилюли смены этапа */
.dp-status-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.df-pill { cursor: pointer; border: none; font-family: inherit; }
.df-pill.active { outline: 2px solid var(--text); outline-offset: 1px; }
.df-pill[disabled] { cursor: default; opacity: .6; }

/* action-bar (заметка/задача/звонок) */
.dp-action-bar { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.dp-action-tabs { display: inline-flex; gap: 4px; background: var(--bg-sink); border-radius: var(--r-md); padding: 3px; align-self: flex-start; }
.dp-action-tabs button { height: 30px; padding: 0 12px; font-size: 13px; border: none; background: transparent; color: var(--text-mute); border-radius: 8px; }
.dp-action-tabs button.active { background: var(--bg); color: var(--text); box-shadow: var(--sh-card); }
.dp-action-form textarea { width: 100%; resize: vertical; min-height: 44px; font-family: inherit; }
.dp-action-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; justify-content: flex-end; }
.dp-action-due-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-mute); }

/* таймлайн событий */
.dp-timeline { display: flex; flex-direction: column; gap: 2px; }
.dp-date-chip { font-size: 11px; color: var(--text-soft); font-family: var(--f-mono); padding: 10px 0 4px; }
.dp-event { display: flex; gap: 10px; padding: 8px 0; align-items: flex-start; }
.dp-event-ic { width: 26px; height: 26px; flex: none; border-radius: 7px; background: var(--bg-mute); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.dp-event-body { flex: 1; min-width: 0; }
.dp-event-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dp-event-head b { font-size: 14px; font-weight: 500; }
.dp-event-head .muted { font-size: 11px; color: var(--text-soft); font-family: var(--f-mono); flex: none; }
.dp-event-meta { font-size: 13px; color: var(--text-mute); margin-top: 2px; }

/* банер возвратного клиента */
.dp-return-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--peach-soft); border: 1px solid var(--peach); border-radius: var(--r-md); cursor: pointer; }
.dp-return-icon { font-size: 18px; }
.dp-return-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dp-return-text b { font-size: 13px; font-weight: 600; color: var(--peach-deep); }
.dp-return-text span { font-size: 12px; color: var(--text-mute); }
.dp-return-arrow { font-size: 12px; color: var(--peach-deep); white-space: nowrap; }

/* чат-бабблы (рендерятся из dp-msg* в renderDealMessages) */
.dp-chat-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 20px; color: var(--text-soft); }
.dp-chat-empty b { font-size: 14px; color: var(--text-mute); font-weight: 600; }
.dp-chat-empty span { font-size: 13px; }
.dp-chat-daysep { align-self: center; font-size: 11px; color: var(--text-soft); padding: 6px 0; font-family: var(--f-mono); }
.dp-chat-source-card { align-self: center; width: min(92%, 620px); box-sizing: border-box; margin: 4px auto 14px; padding: 11px 14px; border: 1px solid #dfe7e1; border-radius: 12px; background: #eef7f0; color: var(--text-mute); font-size: 12px; line-height: 1.45; }
.dp-chat-source-label { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; color: #268b56; font-size: 11px; font-weight: 650; }
.dp-chat-source-label span { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #d7efdd; }
.dp-chat-source-card a { display: block; color: #237f50; text-decoration: underline; overflow-wrap: anywhere; }
.dp-chat-source-text { margin-top: 4px; color: var(--text-mute); white-space: pre-wrap; }
.dp-msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; display: flex; flex-direction: column; }
.dp-msg.in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.dp-msg.out { align-self: flex-end; background: var(--cta-bg); color: var(--cta-text); border-bottom-right-radius: 4px; }
.dp-msg-bubble { white-space: pre-wrap; word-break: break-word; }
.dp-msg-time { font-size: 10px; opacity: .55; margin-top: 4px; text-align: right; font-family: var(--f-mono); }
.dp-msg img, .dp-msg video { max-width: 100%; border-radius: 8px; }
.dp-msg-tick.read { color: #6BE3A8; }
.dp-msg-tick.failed { color: var(--danger); }

/* chat-body нужно колоночное направление для бабблов */
.chat-body.dp-chat-msgs { display: flex; flex-direction: column; gap: 8px; }
.chat-input.dp-chat-input { align-items: center; }

/* ── FIX: оболочка движка вкладывает контент в .view внутри .page.
   В песочнице контент лежал прямо в .page (flex column + gap).
   Возвращаем тот же layout видимой вьюхе, чтобы блоки не слипались. ── */
#view-host { padding: 0; }                 /* паддинг даёт сама .view как .page */
#view-host > .view:not([hidden]) {
  display: flex; flex-direction: column; gap: var(--s-5);
  padding: var(--s-6);
  min-height: 100%;
}
@media (max-width: 760px) {
  #view-host > .view:not([hidden]) { padding: var(--s-4); padding-bottom: 76px; }
}

/* ========================================================================
   SUPPLEMENT 2 (production) - доведение сырых интерактивных компонентов
   движка v2 до MNA-дизайна. Stage/Service редакторы, статус-пилюли,
   тон-палитра, dp-* поля сделки, дроверы. Токены/компоненты выше НЕ трогаем.
   ======================================================================== */

/* ---- 35. TONE SCALE (этапы воронки: tone -> цвет) ----
   Привязка имён тонов движка к палитре дизайн-системы (--st-*).
   Каждый .tone-* задаёт --tone (насыщенный) + --tone-soft (фон-плашка). */
.tone-sky    { --tone: var(--st-new);        --tone-soft: var(--st-new-soft); }
.tone-indigo { --tone: var(--st-inprogress); --tone-soft: var(--st-inprogress-soft); }
.tone-violet { --tone: var(--st-scheduled);  --tone-soft: var(--st-scheduled-soft); }
.tone-amber  { --tone: var(--st-arrived);    --tone-soft: var(--st-arrived-soft); }
.tone-ember  { --tone: var(--peach-deep);    --tone-soft: var(--peach-soft); }
.tone-mint   { --tone: var(--st-done);       --tone-soft: var(--st-done-soft); }
.tone-rust   { --tone: var(--danger);        --tone-soft: var(--danger-soft); }
.tone-mut    { --tone: var(--neutral);       --tone-soft: var(--neutral-soft); }
.tone-cyan   { --tone: var(--info);          --tone-soft: var(--info-soft); }
.tone-teal   { --tone: var(--st-paid);       --tone-soft: var(--st-paid-soft); }
.tone-pink   { --tone: #C2557E;              --tone-soft: #FBEAF1; }
.tone-purple { --tone: #8A56C9;              --tone-soft: #F0E9FB; }

/* ---- 36. SETTINGS · СТАДИИ ВОРОНКИ ---- */
.stages-sortable .stage-row { gap: 12px; cursor: default; }
.stages-sortable .stage-row.drag-over { box-shadow: inset 0 2px 0 0 var(--peach); }
.stages-sortable .stage-row.dragging { opacity: .45; }

.stage-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; flex: none; color: var(--text-soft); cursor: grab;
}
.stage-grip:active { cursor: grabbing; }
.stage-row[draggable="false"] .stage-grip { display: none; }

/* лейбл-плашка в цвет стадии (как .tag.st-* в эталоне) */
.stage-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 26px; padding: 0 12px 0 9px;
  border-radius: var(--r-full);
  background: var(--tone-soft, var(--neutral-soft));
  color: var(--tone, var(--neutral));
  max-width: 320px;
}
.stage-tone-dot {
  width: 9px; height: 9px; flex: none; padding: 0;
  border: none; border-radius: 50%;
  background: var(--tone, var(--neutral)); cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.stage-tone-dot:hover { transform: scale(1.25); box-shadow: 0 0 0 3px var(--tone-soft); }
.stage-tone-dot[onclick=""], .stage-row[draggable="false"] .stage-tone-dot { cursor: default; }
.stage-label {
  font-size: 13px; font-weight: 600; line-height: 1;
  color: var(--tone, var(--text)); outline: none; white-space: nowrap;
}
.stage-label[contenteditable="true"]:focus {
  background: var(--bg); color: var(--text);
  border-radius: 4px; padding: 1px 4px; margin: -1px -4px;
  box-shadow: var(--ring);
}
.stage-sub { display: inline-flex; gap: 6px; align-items: center; }
.stage-flag {
  font-size: 10px; font-weight: 500; line-height: 1;
  padding: 3px 8px; border-radius: var(--r-full);
  background: var(--bg-sink); color: var(--text-soft);
  text-transform: none; letter-spacing: 0;
}
.stage-flag.won  { background: var(--ok-soft);     color: var(--ok); }
.stage-flag.lost { background: var(--danger-soft); color: var(--danger); }
.stage-spacer { flex: 1; }
.stage-delete { color: var(--text-soft); }
.stage-delete:hover { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

/* палитра выбора цвета стадии (всплывашка) */
.stage-color-pop {
  position: fixed; z-index: 80;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  padding: 12px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-pop);
}
.stage-color-swatch {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  background: var(--tone, var(--neutral));
  transition: transform var(--t-fast) var(--ease);
}
.stage-color-swatch:hover { transform: scale(1.12); }
.stage-color-swatch.is-on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }

/* ---- 37. SETTINGS · УСЛУГИ ---- */
.services-sortable { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.svc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); cursor: default;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.svc-item:hover { border-color: var(--line-hi, #D8D7D0); box-shadow: var(--sh-card); }
.svc-item.drag-over { box-shadow: inset 0 2px 0 0 var(--peach); }
.svc-item.dragging { opacity: .45; }
.svc-grip { display: inline-flex; align-items: center; width: 16px; flex: none; color: var(--text-soft); cursor: grab; }
.svc-grip:active { cursor: grabbing; }
.svc-name { flex: 1; font-size: 14px; font-weight: 500; min-width: 0; }
.svc-remove {
  width: 26px; height: 26px; flex: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-sm); background: transparent;
  color: var(--text-soft); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.svc-remove:hover { background: var(--danger-soft); color: var(--danger); }
.svc-add {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px; align-self: flex-start;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  background: transparent; color: var(--text-mute); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.svc-add:hover { border-color: var(--peach); color: var(--peach-deep); }

/* ---- 38. DEAL PAGE · СТАТУС-ПИЛЮЛИ (.df-pill.tag tone-*) ---- */
/* .tag берёт нейтральный фон из дизайн-системы; перекрываем тоном этапа */
.df-pill.tag {
  height: 30px; padding: 0 13px; cursor: pointer;
  background: var(--tone-soft, var(--neutral-soft));
  color: var(--tone, var(--neutral));
  border: 1.5px solid transparent;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.df-pill.tag::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--tone, currentColor); flex: none;
}
.df-pill.tag:hover { border-color: var(--tone, var(--neutral)); }
.df-pill.tag:active { transform: translateY(1px); }
.df-pill.tag.active { background: var(--tone, var(--text)); color: #fff; }
.df-pill.tag.active::before { background: #fff; }
.df-pill.tag[disabled] { cursor: default; opacity: .55; }
.df-pill.tag[disabled]:hover { border-color: transparent; }
/* пилюли используют tone-классы движка (sky/ember/...) для --tone */
.df-pill.tag.sky    { --tone: var(--st-new);        --tone-soft: var(--st-new-soft); }
.df-pill.tag.indigo { --tone: var(--st-inprogress); --tone-soft: var(--st-inprogress-soft); }
.df-pill.tag.violet { --tone: var(--st-scheduled);  --tone-soft: var(--st-scheduled-soft); }
.df-pill.tag.amber  { --tone: var(--st-arrived);    --tone-soft: var(--st-arrived-soft); }
.df-pill.tag.ember  { --tone: var(--peach-deep);    --tone-soft: var(--peach-soft); }
.df-pill.tag.mint   { --tone: var(--st-done);       --tone-soft: var(--st-done-soft); }
.df-pill.tag.rust   { --tone: var(--danger);        --tone-soft: var(--danger-soft); }
.df-pill.tag.mut    { --tone: var(--neutral);       --tone-soft: var(--neutral-soft); }
.df-pill.tag.cyan   { --tone: var(--info);          --tone-soft: var(--info-soft); }
.df-pill.tag.teal   { --tone: var(--st-paid);       --tone-soft: var(--st-paid-soft); }
.df-pill.tag.pink   { --tone: #C2557E;              --tone-soft: #FBEAF1; }
.df-pill.tag.purple { --tone: #8A56C9;              --tone-soft: #F0E9FB; }

/* ---- 39. DEAL PAGE · разное ---- */
.deal-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--s-3); }
.deal-section-head h3 { font-family: var(--f-display); font-weight: 600; font-size: 15px; }

/* action-tabs submit-row уже в SUPPLEMENT-1; добавляем мелочи */
.dp-action-submit { flex: none; }

/* инлайн-редактор поля (dp-fvalue -> input/select) */
.dp-fvalue { cursor: pointer; border-bottom: 1px dashed transparent; transition: border-color var(--t-fast) var(--ease); }
.dp-fvalue:hover { border-bottom-color: var(--line); }
.dp-field-input {
  height: 32px; padding: 0 10px; font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--peach); border-radius: var(--r-sm);
  box-shadow: var(--ring); outline: none; min-width: 120px;
}
select.dp-field-input { appearance: none; padding-right: 26px; }
.dp-field-ctrls { display: inline-flex; gap: 4px; margin-left: 6px; }
.dp-field-ok, .dp-field-cancel {
  width: 28px; height: 28px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); cursor: pointer; font-size: 13px; line-height: 1;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.dp-field-ok { color: var(--ok); }
.dp-field-ok:hover { background: var(--ok); color: #fff; border-color: var(--ok); }
.dp-field-cancel { color: var(--text-soft); }
.dp-field-cancel:hover { background: var(--bg-mute); color: var(--text); }

/* редактор услуг-чипами (dp-services-picker) */
.dp-services-picker {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  padding: 10px; background: var(--bg-mute);
  border: 1px solid var(--line); border-radius: var(--r-md);
}
.dp-service-chip {
  height: 30px; padding: 0 12px; font-size: 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-full);
  background: var(--bg); color: var(--text-mute); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.dp-service-chip:hover { border-color: var(--peach); }
.dp-service-chip.is-on { border-color: var(--text); background: var(--text); color: var(--bg); }
.dp-services-done {
  height: 30px; padding: 0 14px; font-size: 13px; font-weight: 500;
  border: none; border-radius: var(--r-full);
  background: var(--peach); color: var(--text); cursor: pointer; margin-left: auto;
}
.dp-services-done:hover { background: var(--peach-deep); }

/* chat-input в сделке: компактный ряд, инпут тянется */
.chat-input.dp-chat-input .input { flex: 1; min-width: 0; }
.chat-input.dp-chat-input .btn-icon { flex: none; }
.dp-chat-mic.is-recording { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---- 40. CUSTOMER / MANAGER DRAWER ---- */
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--line);
}
.drawer-kicker { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-soft); margin-bottom: 6px; }
.drawer-title { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.drawer-close {
  width: 34px; height: 34px; flex: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text-mute); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.drawer-close:hover { background: var(--bg-mute); color: var(--text); }
.drawer-body { padding: var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); }

/* также для deal-drawer-* (вариант дровера сделки) */
.deal-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--line); }
.deal-drawer-kicker { font-family: var(--f-mono); font-size: 11px; color: var(--text-soft); margin-bottom: 6px; }
.deal-drawer-title { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.deal-drawer-body { padding: var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); }
.deal-stage-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 12px; font-size: 12px; font-weight: 500; border-radius: var(--r-full); align-self: flex-start; }

/* строка сделки в карточке клиента */
.cust-deal-row { transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.cust-deal-row:hover { border-color: var(--line-hi, #D8D7D0) !important; box-shadow: var(--sh-card); }

/* ---- 41. DEAL · контекст-меню (toggleDealMenu -> #deal-menu-pop) ---- */
.deal-menu-pop {
  position: fixed; z-index: 80; min-width: 220px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-pop);
}
.deal-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-mute); cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.deal-menu-item:hover { background: var(--bg-mute); color: var(--text); }
.deal-menu-item.danger, .deal-menu-item.rust-text { color: var(--danger); }

/* ---- 42. NOTIFS · содержимое поповера (#notif-pop) ---- */
#notif-pop { padding: 6px; width: 340px; }
.notif-sec { padding: 10px 10px 4px; }
.notif-sec b { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); }
.notif-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.notif-row:hover { background: var(--bg-mute); }
.notif-dot { width: 8px; height: 8px; flex: none; margin-top: 5px; border-radius: 50%; background: var(--tone, var(--neutral)); }
.notif-dot.mint   { background: var(--ok); }
.notif-dot.rust   { background: var(--danger); }
.notif-dot.indigo { background: var(--st-inprogress); }
.notif-dot.amber  { background: var(--warn); }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-body b { font-size: 13px; font-weight: 600; }
.notif-body .muted { font-size: 12px; color: var(--text-soft); }
.notif-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-soft); }

/* ========================================================================
   SUPPLEMENT 3 (production) - совместимость компонентов интерфейса.
   Дроверы (клиент/менеджер) и часть форм используют старые CSS-переменные
   (--bg-2/--mut/--value/--indigo/--ink) и классы кнопок (.btn.ghost/.indigo).
   Их НЕ было в дизайн-системе -> элементы выглядели сырыми (прозрачный фон,
   чёрный текст). Привязываем к MNA-токенам. Токены/компоненты выше не трогаем.
   ======================================================================== */

/* ---- 43. LEGACY VAR ALIASES (v2 -> MNA) ---- */
:root {
  --bg-2:   var(--bg-mute);     /* инсет-плашки в дроверах */
  --mut:    var(--text-mute);   /* приглушённый текст */
  --value:  var(--text);        /* денежные значения */
  --ink:    var(--text);
  --line-2: var(--line-soft);
  /* tone-имена движка как цвета (тосты, мини-чарты, инлайн-стили) */
  --indigo: var(--st-inprogress);
  --mint:   var(--ok);
  --rust:   var(--danger);
  --sky:    var(--st-new);
  --violet: var(--st-scheduled);
  --amber:  var(--warn);
  --ember:  var(--peach-deep);
  --cyan:   var(--info);
  --teal:   var(--st-paid);
}

/* ---- 44. LEGACY BUTTON VARIANTS (.btn.ghost / .btn.indigo / .icon-only) ---- */
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-mute); }
.btn.ghost:hover { background: var(--bg-mute); color: var(--text); }
.btn.indigo { background: var(--cta-bg); color: var(--cta-text); border-color: var(--cta-bg); }
.btn.indigo:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn.icon-only { width: 38px; padding: 0; justify-content: center; }
.btn.ghost.icon-only { color: var(--text-mute); }
.btn.ghost.icon-only:hover { background: var(--bg-mute); color: var(--text); }

/* ---- 45. .tag c именами тонов (используются в дроверах: tag mut/mint/sky..) ----
   Дизайн-система знает .tag.ok/.warn/.st-*, но не tone-имена движка. Добавляем. */
.tag.sky    { background: var(--st-new-soft);        color: var(--st-new); }
.tag.indigo { background: var(--st-inprogress-soft); color: var(--st-inprogress); }
.tag.violet { background: var(--st-scheduled-soft);  color: var(--st-scheduled); }
.tag.amber  { background: var(--st-arrived-soft);    color: var(--st-arrived); }
.tag.ember  { background: var(--peach-soft);         color: var(--peach-deep); }
.tag.mint   { background: var(--st-done-soft);       color: var(--st-done); }
.tag.rust   { background: var(--danger-soft);        color: var(--danger); }
.tag.mut    { background: var(--neutral-soft);       color: var(--neutral); }
.tag.cyan   { background: var(--info-soft);          color: var(--info); }
.tag.teal   { background: var(--st-paid-soft);       color: var(--st-paid); }
.tag.pink   { background: #FBEAF1;                   color: #C2557E; }
.tag.purple { background: #F0E9FB;                   color: #8A56C9; }

/* ---- 46. DRAWER · kicker над заголовком (.dealdr-stage / .dealdr-head) ---- */
.dealdr-stage {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-soft);
  margin-bottom: 6px;
}
.dealdr-head h2 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; }

/* ---- 47. FORMS в дровере (.df / .df-row / .df-chk / .df-radio ...) ---- */
.df { display: flex; flex-direction: column; min-height: 0; }
.df .dealdr-body { display: flex; flex-direction: column; gap: var(--s-4); }
.df-row { display: flex; flex-direction: column; gap: 6px; }
.df-row > label { font-size: 12px; font-weight: 500; color: var(--text-mute); }
.df-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.df-req { color: var(--danger); }

/* услуги-чекбоксы -> чипы (нативный input скрыт) */
.df-chk-grid, .df-radio-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.df-chk {
  display: inline-flex; align-items: center; gap: 0;
  height: 34px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-full);
  font-size: 13px; color: var(--text-mute); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.df-chk:hover { border-color: var(--peach); }
.df-chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.df-chk:has(input:checked) { border-color: var(--text); background: var(--text); color: var(--bg); }

/* источник-радио -> пилюли */
.df-radio {
  display: inline-flex; align-items: center; gap: 0;
  height: 34px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-full);
  font-size: 13px; color: var(--text-mute); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.df-radio:hover { border-color: var(--peach); }
.df-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.df-radio:has(input:checked) { border-color: var(--text); background: var(--text); color: var(--bg); }

/* контейнер группы услуг/источников: если поле не обёрнуто, расставим строкой */
.df-row.df-chips { gap: 8px; }
.df-row.df-chips > .df-chk, .df-row.df-chips > .df-radio { margin: 0; }

.df-status-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.df-err { font-size: 13px; color: var(--danger); min-height: 16px; }
.df .df-actions { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--line); display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--bg); }
.df .df-actions .btn { flex: 1; justify-content: center; }

/* ============================================================
   43. ТОПБАР · колокольчик уведомлений + badge (#bell-btn)
   ============================================================ */
.topbar .controls .bell-btn { position: relative; }
.bell-dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid var(--bg);
  pointer-events: none;
}

/* ============================================================
   44. КОМАНДНАЯ ПАЛИТРА / ПОИСК (#search-overlay)
   ============================================================ */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(26,29,33,.28);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  animation: cmdkFade .14s var(--ease);
}
@keyframes cmdkFade { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: 100%; max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  overflow: hidden;
  animation: cmdkUp .16s var(--ease);
}
@keyframes cmdkUp { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }
.cmdk-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.cmdk-head .ic { color: var(--text-soft); display: inline-flex; flex: none; }
.cmdk-input { flex: 1; border: none; outline: none; background: transparent; font-size: 16px; color: var(--text); font-family: inherit; }
.cmdk-input::placeholder { color: var(--text-soft); }
.cmdk-kbd { font-family: var(--f-mono); font-size: 11px; color: var(--text-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; flex: none; }
.cmdk-list { max-height: min(52vh, 440px); overflow-y: auto; padding: 6px; }
.cmdk-sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); padding: 10px 10px 4px; }
.cmdk-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none; color: inherit;
}
.cmdk-row:hover, .cmdk-row.is-active { background: var(--bg-mute); }
.cmdk-row .av { flex: none; }
.cmdk-row-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.cmdk-row-body b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-row-body span { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-row .tag { flex: none; }
.cmdk-empty { padding: 32px 16px; text-align: center; font-size: 13px; color: var(--text-soft); }

/* ============================================================
   45. NOTIF · шапка поповера (#notif-pop)
   ============================================================ */
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.notif-head b { font-size: 14px; font-weight: 700; }
.notif-head .notif-readall { font-size: 12px; color: var(--text-mute); background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.notif-head .notif-readall:hover { background: var(--bg-mute); color: var(--text); }
.notif-pop .notif-scroll { max-height: min(64vh, 480px); overflow-y: auto; }

/* ============================================================
   46. DROPDOWN (источник на воронке, инлайн-эдит) (.dd)
   ============================================================ */
.dd { position: relative; display: inline-flex; }
.dd-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px 0 12px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); cursor: pointer;
  font-size: 13px; color: var(--text); font-family: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.dd-toggle:hover { border-color: var(--text-soft); }
.dd-toggle.is-open { border-color: var(--peach); box-shadow: var(--ring); }
.dd-toggle .dd-val { font-weight: 500; }
.dd-toggle .dd-count { font-size: 11px; color: var(--text-soft); }
.dd-toggle .dd-caret { color: var(--text-soft); display: inline-flex; transition: transform var(--t-fast) var(--ease); }
.dd-toggle.is-open .dd-caret { transform: rotate(180deg); }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  min-width: 220px; max-width: 280px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-pop);
  padding: 5px; overflow: hidden; text-align: left;
  animation: ddOpen .12s var(--ease);
}
.dd-menu.dd-right { left: auto; right: 0; }
@keyframes ddOpen { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dd-scroll { max-height: 280px; overflow-y: auto; }
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px; color: var(--text);
}
.dd-item:hover { background: var(--bg-mute); }
.dd-item.is-on { background: var(--bg-mute); font-weight: 600; }
.dd-item .dd-item-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-item .dd-item-count { font-size: 11px; color: var(--text-soft); font-family: var(--f-mono); }
.dd-item .dd-item-check { color: var(--peach-deep); display: inline-flex; opacity: 0; flex: none; }
.dd-item.is-on .dd-item-check { opacity: 1; }

/* ============================================================
   47. КАЛЕНДАРЬ-ПОПОВЕР (фильтр периода) (.calp)
   ============================================================ */
.calp {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  width: 280px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-pop);
  padding: 14px; animation: ddOpen .12s var(--ease);
}
.calp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.calp-title { font-size: 14px; font-weight: 600; }
.calp-nav { display: flex; gap: 4px; }
.calp-nav button {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--r-sm); cursor: pointer; color: var(--text-mute);
}
.calp-nav button:hover { background: var(--bg-mute); color: var(--text); }
.calp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calp-dow { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); text-align: center; padding-bottom: 6px; }
.calp-day {
  height: 34px; display: grid; place-items: center;
  border: none; background: transparent; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text); cursor: pointer; font-family: inherit;
  position: relative;
}
.calp-day:hover:not(:disabled) { background: var(--bg-mute); }
.calp-day.dim { color: var(--text-soft); }
.calp-day.today { font-weight: 700; color: var(--peach-deep); }
.calp-day.in-range { background: var(--bg-sink); border-radius: 0; }
.calp-day.range-start { background: var(--text); color: var(--bg); border-radius: var(--r-sm) 0 0 var(--r-sm); }
.calp-day.range-end { background: var(--text); color: var(--bg); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.calp-day.range-start.range-end { border-radius: var(--r-sm); }
.calp-day.single { background: var(--text); color: var(--bg); }
.calp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.calp-hint { font-size: 11px; color: var(--text-soft); flex: 1; min-width: 0; }
.calp-foot .btn { height: 30px; padding: 0 12px; font-size: 12px; }

/* инлайн-дропдаун в карточке сделки (О сделке) */
.dd-inline { vertical-align: middle; }
.dd-inline .dd-toggle { height: 30px; padding: 0 8px 0 10px; font-size: 13px; }
.dd-inline .dd-menu { right: 0; left: auto; min-width: 180px; }

/* ── FIX: длинные статус-теги ("Отмена 1 разобрать причину") выпирали за карточку.
   На карточке канбана разрешаем тегу переноситься и оставаться внутри. ── */
.deal-card .mid { flex-wrap: wrap; gap: 6px 8px; }
.deal-card .mid .price { flex: none; }
.deal-card .mid .tag {
  max-width: 100%;
  height: auto; min-height: 22px;
  padding: 4px 10px; line-height: 1.25;
  white-space: normal; text-align: left;
}
.deal-card .mid .tag .dot { flex: none; margin-top: 1px; }

/* ============================================================
   SUPPLEMENT 4 (production) - финальный QA-проход.
   Инлайн-редакт даты в "О сделке" через кастомный календарь
   (вместо нативного input[type=date]).
   ============================================================ */
.dp-date-inline { vertical-align: middle; }
.dp-date-inline .dd-toggle { height: 30px; padding: 0 8px 0 10px; font-size: 13px; }
.dp-date-inline .calp { right: 0; left: auto; top: calc(100% + 6px); }
.dp-date-inline .calp.calp-above { top: auto; bottom: calc(100% + 6px); }
.dp-date-inline .dd-caret svg { color: var(--text-mute); }
/* убрать нативные стрелки у number-инпута инлайн-редакта */
.dp-field-input[type=number]::-webkit-outer-spin-button,
.dp-field-input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dp-field-input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ============================================================
   SUPPLEMENT 4b - кастомные select/date в формах (вместо нативных).
   .dd-field растягивается на ширину поля и выглядит как .input.
   ============================================================ */
.dd-field { display: flex; width: 100%; }
.dd-field .dd-toggle {
  width: 100%;
  height: 38px;
  border-width: 1.5px;
  border-radius: var(--r-sm);
  justify-content: space-between;
  font-size: 14px;
}
.dd-field .dd-toggle .dd-val { font-weight: 400; flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-field .dd-menu { left: 0; right: 0; min-width: 0; max-width: none; max-height: 240px; overflow-y: auto; }
.dd-datefield .calp { left: 0; right: auto; top: calc(100% + 6px); }
.dd-datefield .calp.calp-above { top: auto; bottom: calc(100% + 6px); }
/* у date-триггера иконка слева, текст после */
.dd-datefield .dd-toggle { flex-direction: row; }
.dd-datefield .dd-toggle .dd-val { order: 2; }
.dd-datefield .dd-toggle .dd-caret { order: 1; flex: none; }

/* ============================================================
   SUPPLEMENT 5 (production) - МОБИЛКА (<=760px).
   Топбар-контролы выходили за экран: оборачиваем в ряды,
   делаем search компактным, прячем ⌘K, контролы переносим.
   ============================================================ */
@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
  }
  .topbar .ph { flex: 1 1 auto; min-width: 0; }
  .topbar .ph .h-page { font-size: 22px; }
  .topbar .controls {
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }
  /* ⌘K подсказку прячем на мобиле */
  .topbar .controls .btn .caption.mono { display: none; }
  /* поиск растягиваем, остальные кнопки по контенту */
  .topbar .controls > .btn:first-child { flex: 1 1 auto; justify-content: flex-start; }
  .topbar .controls .seg { flex: 1 1 100%; justify-content: space-between; }
  .topbar .controls .seg button { flex: 1 1 auto; padding: 0 8px; }
  .topbar .controls #dd-dash-period { flex: 1 1 auto; }
  .topbar .controls #dd-dash-period .dd-toggle { width: 100%; justify-content: center; }
  /* Новая сделка - на всю ширину последней строкой */
  .topbar .controls > .btn-primary { flex: 1 1 100%; justify-content: center; }
  /* поповеры календаря/уведомлений не должны вылезать за экран */
  .topbar .calp { left: 0; right: 0; width: auto; max-width: calc(100vw - 32px); }

  /* Воронка: фильтр-бар - группы переносятся, чипы скроллятся по горизонтали */
  .filter-bar .grp { flex-wrap: wrap; }
  .filter-bar .chips {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-bar .chips::-webkit-scrollbar { display: none; }
  .filter-bar .chips button { flex: 0 0 auto; }

  /* таблицы (Клиенты / Последние платежи) - горизонтальный скролл вместо обрезки */
  .tbl-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--s-5));
    padding: 0 var(--s-5);
  }
  .tbl-scroll table.data { min-width: 560px; }

  /* Настройки/панели: заголовок и подпись не должны сталкиваться - переносим */
  .panel-head { flex-wrap: wrap; gap: 4px 10px; }
  .panel-head .sub { flex: 0 0 100%; }
  .panel-head .btn { flex: 0 0 auto; }

  /* Строки настроек (команда, ставка, планы) - переносим управление на 2-ю строку */
  .setting-row { flex-wrap: wrap; gap: 8px 10px; }
  .setting-row .meta { flex: 1 1 60%; min-width: 0; }
  .setting-row .meta b,
  .setting-row .meta span { overflow-wrap: anywhere; }
  /* группа с инпутом+кнопкой (ставка/план) переносится целиком и прижимается вправо */
  .setting-row > div[style*="display:flex"] { flex: 1 1 100%; justify-content: flex-end; }

  /* Полноэкранная карточка сделки: шапка адаптируется под узкий экран.
     Строка 1: [<] [статус] ...spacer... [+Задача][меню][удалить]
     Строка 2: имя клиента + сделка/авто (на всю ширину) */
  .deal-full .dft {
    flex-wrap: wrap;
    gap: 8px 8px;
    padding: 12px 16px;
  }
  .deal-full .dft > [data-close-full] { order: 0; }
  .deal-full .dft > .tag { order: 1; }
  .deal-full .dft > .spacer { order: 2; flex: 1 1 auto; }
  .deal-full .dft > .btn { order: 3; }       /* кнопки действий (+Задача, меню, удалить) */
  .deal-full .dft > .who {
    order: 4;
    flex: 1 1 100%;
    min-width: 0;
  }
  .deal-full .dft .who h2 {
    font-size: 17px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .deal-full .dft .who .caption { white-space: normal; overflow-wrap: anywhere; }
  .deal-full .dft .btn.btn-sm { padding: 0 10px; }
  .deal-full .dfs { padding: 16px; }
}
