:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --ink: #12151a;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --blue: #005ff9;
  --blue-press: #0047c7;
  --blue-soft: #e8f0ff;
  --green: #0f8a62;
  --amber: #b54708;
  --sidebar: #0f1218;
  --sidebar-2: #171b24;
  --sidebar-text: #cfd5df;
  --sidebar-muted: #8b93a3;
  --danger: #d92d20;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --r: 10px;
  --shadow: 0 10px 30px rgba(15, 18, 24, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #0b0d11;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(0, 95, 249, 0.08), transparent 55%),
    linear-gradient(180deg, #e9edf3, var(--bg) 160px);
}

/* Boot */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: #0f1218; transition: opacity .28s ease, visibility .28s ease;
}
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-card { text-align: center; color: #fff; width: 220px; }
.boot-mark {
  width: 40px; height: 40px; margin: 0 auto 14px; border-radius: 10px;
  background: linear-gradient(135deg, transparent 46%, #fff 46% 54%, transparent 54%), var(--blue);
}
.boot-title { font-weight: 700; letter-spacing: -0.03em; margin-bottom: 16px; }
.boot-bar {
  height: 3px; background: #2a303c; border-radius: 99px; overflow: hidden; margin-bottom: 10px;
}
.boot-bar i {
  display: block; height: 100%; width: 0; background: var(--blue);
  animation: load 0.7s ease forwards;
}
@keyframes load { to { width: 100%; } }
.boot-sub { font-family: var(--mono); font-size: 11px; color: #8b93a3; }

.ghost.iconish { width: 34px; padding: 0; font-size: 16px; }
.ghost.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.linkish.inline { display: inline; padding: 0; }

/* Topbar */
.topbar {
  height: 56px;
  display: grid;
  grid-template-columns: 250px minmax(240px, 560px) 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.mail-mark {
  width: 24px; height: 24px; border-radius: 7px;
  background:
    linear-gradient(135deg, transparent 46%, #fff 46% 54%, transparent 54%),
    var(--blue);
}
.product-name { font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }
.product-name .dot { color: var(--blue); }
.env {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--green); background: #e8f7f0;
  border: 1px solid #b7e4cf; padding: 2px 6px; border-radius: 4px;
}

.search {
  display: flex; align-items: center; gap: 8px; height: 36px;
  padding: 0 12px; background: #f2f4f7; border: 1px solid transparent;
  border-radius: 10px; color: var(--muted); transition: .15s ease;
  width: 100%; justify-self: center;
}
.search:focus-within { background: #fff; border-color: var(--blue); color: var(--ink); box-shadow: 0 0 0 3px rgba(0,95,249,.12); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); min-width: 0; }
.search kbd {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

.topbar-right { display: flex; align-items: center; gap: 6px; justify-self: end; }
.ghost {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 10px; border-radius: 8px;
}
.ghost:hover, .ghost.on { background: #eef2f7; color: var(--ink); }
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid #2a3140;
  background: linear-gradient(160deg, #1b2130, #0f1218); color: #fff;
  font-size: 11px; font-weight: 650;
}

/* Workspace */
.workspace {
  flex: 1; display: grid; grid-template-columns: 250px 1fr; min-height: 0; overflow: hidden;
}
.workspace.with-drawer { grid-template-columns: 250px 1fr 340px; }

.statusbar {
  height: 28px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 14px; background: #12151a; color: #9aa3b2;
  font-size: 11px; border-top: 1px solid #1c2230; flex-shrink: 0;
}
.sb-left, .sb-right, .sb-mid { display: flex; align-items: center; gap: 8px; }
.sb-mid { opacity: .75; }
.sb-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(15,138,98,.18);
}
.sb-dot.busy { background: var(--amber); animation: pulse 1s infinite; }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
  color: var(--sidebar-text); padding: 14px 12px;
  display: flex; flex-direction: column; gap: 14px; border-right: 1px solid #1c2230;
}

.compose {
  height: 40px; border: 0; border-radius: 10px; background: var(--blue);
  color: #fff; font-weight: 650; letter-spacing: -0.01em;
  box-shadow: 0 8px 20px rgba(0,95,249,.28); transition: .15s ease;
}
.compose:hover { background: var(--blue-press); transform: translateY(-1px); }
.compose:active { transform: translateY(0); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px;
  width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--sidebar-text); padding: 10px 10px; border-radius: 9px; transition: .15s ease;
}
.side-link .ico { font-family: var(--mono); font-size: 12px; color: var(--sidebar-muted); }
.side-link .count {
  font-family: var(--mono); font-size: 11px; color: #fff; background: var(--blue);
  min-width: 18px; text-align: center; border-radius: 5px; padding: 1px 6px;
}
.side-link:hover { background: rgba(255,255,255,.04); color: #fff; }
.side-link.active {
  background: rgba(0,95,249,.16); color: #fff;
  box-shadow: inset 2px 0 0 var(--blue);
}
.side-link.active .ico { color: #8eb4ff; }

.side-meta { margin-top: auto; padding-top: 12px; border-top: 1px solid #242a36; }
.meter-label {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--sidebar-muted); margin-bottom: 6px;
}
.meter-bar { height: 4px; background: #2a303c; border-radius: 99px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3d7dff, var(--blue)); border-radius: 99px; }
.side-hint { margin: 10px 0 8px; font-size: 12px; color: var(--sidebar-muted); line-height: 1.4; }
.side-upgrade {
  width: 100%; border: 1px solid #2c3444; background: transparent; color: #9eb6ff;
  border-radius: 8px; padding: 8px 10px; text-align: left; font-size: 12px;
}
.side-upgrade:hover { border-color: #3d4d6a; background: rgba(255,255,255,.03); }

.stage { padding: 18px 22px 20px; overflow: auto; min-width: 0; display: flex; flex-direction: column; }
.view { animation: in .18s ease; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.inbox-view { min-height: 0; }
@keyframes in { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.stage-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px; flex-shrink: 0;
}
.stage-head.compact { margin-bottom: 10px; }

.split {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface);
}

.preview-pane {
  display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: #fbfcfe;
}
.preview-empty {
  display: grid; place-items: center; color: var(--muted); font-size: 13px; height: 100%;
}
.preview-head {
  display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--line); background: #fff; flex-shrink: 0;
}
.preview-head h2 { margin: 8px 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.preview-from { margin: 0; font-size: 13px; color: var(--muted); }
.preview-meta { display: flex; gap: 8px; align-items: center; }
.pill-kind {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 4px; background: var(--blue-soft); color: var(--blue);
}
.pill-kind.maybe { background: #fff4e5; color: var(--amber); }
.conf { font-size: 11px; color: var(--muted); }
.preview-actions { display: flex; gap: 8px; align-items: flex-start; flex-shrink: 0; }
.preview-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.preview-stats > div {
  background: #fff; padding: 10px 14px; display: flex; flex-direction: column; gap: 3px;
}
.preview-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.preview-stats strong { font-size: 13px; }
.preview-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; max-width: 92%;
}
.bubble.me { align-self: flex-end; background: #eef4ff; border-color: #c9dbff; }
.bubble header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-size: 12px; }
.bubble time { font-family: var(--mono); color: var(--muted); }
.bubble p { margin: 0; font-size: 13px; line-height: 1.45; color: #334155; }
.preview-foot {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line);
  background: #fff; flex-shrink: 0;
}
h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.035em; }
.sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.crumb {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-bottom: 4px; letter-spacing: .03em;
}

.filters { display: flex; gap: 4px; }
.filter {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 7px 11px; border-radius: 8px; font-size: 13px;
}
.filter.on { border-color: #b7ccff; background: var(--blue-soft); color: var(--blue); font-weight: 650; }

.btn {
  height: 36px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 550; font-size: 13px;
  transition: .15s ease;
}
.btn:hover { background: #f7f8fa; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-press); border-color: var(--blue-press); }
.btn.wide { width: 100%; height: 42px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Detect */
.detect-bar {
  display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center;
  gap: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface);
  border: 1px solid #c9dbff; border-radius: var(--r);
  box-shadow: 0 0 0 3px rgba(0,95,249,.04);
}
.detect-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 0 0 rgba(0,95,249,.45); animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(0,95,249,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,95,249,0); }
}
.detect-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detect-copy strong { font-size: 13px; }
.detect-copy span {
  font-size: 12px; color: var(--muted); font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Mail */
.mail-table {
  background: var(--surface); overflow: auto; min-height: 0; border: 0; border-radius: 0;
}
.mail-row {
  display: grid; grid-template-columns: 18px 150px 1fr 96px 56px; gap: 10px;
  align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
}
.mail-row.compact {
  grid-template-columns: 14px 1fr; align-items: start; padding: 11px 12px;
}
.mail-main { min-width: 0; }
.mail-line {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 2px;
}
.mail-line.sub { margin-top: 4px; color: var(--muted); font-size: 11px; }
.mail-row .subj {
  font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink);
}
.mail-row .prev {
  font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: #f6f8fb; }
.mail-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.mail-row.detected { background: #f7faff; }
.mail-row.detected:hover { background: #eef4ff; }
.mail-row.selected { background: #e8f0ff; box-shadow: inset 3px 0 0 var(--blue); }
.mail-row.unread .subj, .mail-row.unread strong { font-weight: 750; }
.mail-row.unread .status-dot.deal { box-shadow: 0 0 0 3px rgba(0,95,249,.18); }
.mail-row.dim { opacity: .7; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; justify-self: center; margin-top: 5px; }
.status-dot.deal { background: var(--blue); }
.status-dot.maybe { background: var(--amber); }
.status-dot.none { background: #c5cad3; }
.from { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg {
  min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted);
}
.msg b { color: var(--ink); font-weight: 650; }
.sep { margin: 0 4px; color: #c0c6d0; }
.amt { text-align: right; font-family: var(--mono); font-size: 12px; font-weight: 550; }
.amt.muted { color: var(--muted); font-weight: 400; }
.when { text-align: right; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Pipeline */
.pipeline {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; min-height: 440px;
}
.pipe-col {
  background: rgba(255,255,255,.55); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 8px;
}
.pipe-col header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px 8px; font-size: 12px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.pipe-col .n {
  font-family: var(--mono); font-weight: 500; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px;
  text-transform: none; letter-spacing: 0;
}
.pipe-empty {
  padding: 18px 10px; text-align: center; color: var(--muted); font-size: 12px;
  border: 1px dashed var(--line); border-radius: 8px;
}
.deal-item {
  display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%;
  padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  transition: .15s ease;
}
.deal-item:hover { border-color: #b7ccff; transform: translateY(-1px); box-shadow: var(--shadow); }
.deal-item.focus { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.deal-item.done { opacity: .72; }
.di-title { font-size: 13px; font-weight: 650; }
.di-desc { font-size: 12px; color: var(--muted); }
.di-foot {
  display: flex; justify-content: space-between; font-family: var(--mono);
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
.di-foot .due { color: var(--amber); }
.di-foot .src { color: var(--blue); }

/* Deal */
.deal-layout, .pay-layout, .avito-layout {
  display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; align-items: start;
}
.props {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; margin-bottom: 20px;
}
.prop { background: var(--surface); padding: 13px 14px; display: flex; flex-direction: column; gap: 4px; }
.prop.wide { grid-column: 1 / -1; }
.prop span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prop strong { font-size: 14px; font-weight: 650; }
.prop .st { color: var(--green); }
.prop .path { font-family: var(--mono); font-size: 12px; font-weight: 500; }

.block-title {
  margin: 0 0 10px; font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.thread {
  list-style: none; margin: 0; padding: 0; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); overflow: hidden;
}
.thread li {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.thread li:last-child { border-bottom: 0; }
.thread time { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-top: 2px; }
.thread b { font-size: 13px; }
.thread p { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

.deal-side, .pay-side, .checklist {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
}
.file-list { list-style: none; margin: 0 0 18px; padding: 0; }
.file-list li {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer;
}
.file-list li:hover { color: var(--blue); }
.file-list li:last-child { border-bottom: 0; }
.empty-inline { color: var(--muted); cursor: default !important; }
.ext {
  font-family: var(--mono); font-size: 10px; font-weight: 550; color: var(--blue);
  background: var(--blue-soft); text-align: center; padding: 3px 0; border-radius: 4px;
}
.file-list .src { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.todo { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.todo li { margin-bottom: 6px; }
.linkish {
  border: 0; background: transparent; color: var(--blue); padding: 0;
  font-size: 13px; font-weight: 550;
}
.linkish:hover { text-decoration: underline; }

/* Invoice */
.invoice {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px;
}
.inv-row {
  display: flex; justify-content: space-between; gap: 16px; padding: 10px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.inv-row span { color: var(--muted); }
.inv-sum { font-size: 38px; font-weight: 700; letter-spacing: -0.04em; margin: 18px 0 6px; }
.inv-fee { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.inv-note { margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.invoice-list { display: flex; flex-direction: column; gap: 6px; }
.inv-item {
  display: flex; justify-content: space-between; gap: 10px; width: 100%;
  text-align: left; border: 1px solid var(--line); background: #fafbfd;
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
}
.inv-item.on { border-color: #b7ccff; background: var(--blue-soft); }
.muted-p { color: var(--muted); font-size: 13px; }

/* Avito */
.listing {
  display: grid; grid-template-columns: 210px 1fr; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.listing-media {
  min-height: 210px;
  background:
    linear-gradient(160deg, #2a3340 0%, #111318 100%),
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(255,255,255,.03) 8px, rgba(255,255,255,.03) 9px);
  position: relative;
}
.listing-media::after {
  content: "AVITO"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: rgba(255,255,255,.35);
}
.listing-body { padding: 18px 20px; }
.listing-src { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.listing-body h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.listing-body .mono { margin: 0 0 8px; font-size: 20px; font-weight: 650; }
.listing-desc { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.plain { margin: 0; padding-left: 16px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.plain li { margin-bottom: 6px; }
.checklist { padding: 16px 16px 16px 32px; }

/* Tariffs */
.tariffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tariff {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; position: relative; display: flex; flex-direction: column;
}
.tariff.recommended {
  border-color: var(--blue);
  background: linear-gradient(180deg, #f5f8ff 0%, #fff 42%);
}
.badge {
  position: absolute; top: 12px; right: 12px; font-family: var(--mono); font-size: 10px;
  color: var(--blue); background: var(--blue-soft); border: 1px solid #c9dbff;
  padding: 2px 6px; border-radius: 4px;
}
.tariff h3 { margin: 0; font-size: 14px; font-weight: 650; }
.tariff-price { margin: 10px 0 14px; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.tariff-price span { font-size: 13px; font-weight: 400; color: var(--muted); }
.tariff ul { margin: 0 0 16px; padding-left: 16px; color: var(--muted); font-size: 13px; flex: 1; }
.tariff li { margin-bottom: 6px; }

/* Drawer */
.drawer {
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(12px); opacity: 0;} to { transform: none; opacity: 1;} }
.drawer header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.drawer h3 { margin: 0; font-size: 15px; }
.drawer-body { padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.drawer-row {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center;
  text-align: left; border: 1px solid var(--line); background: #fafbfd;
  border-radius: 9px; padding: 10px;
}
.drawer-row b { display: block; font-size: 13px; }
.drawer-row small { color: var(--muted); font-size: 11px; }
.drawer-event {
  border: 1px solid var(--line); border-radius: 9px; padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.drawer-event span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.profile { align-items: center; text-align: center; gap: 8px; padding-top: 24px; }
.avatar-lg {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: #12151a; color: #fff; font-weight: 700; margin-bottom: 4px;
}
.pill-soft {
  font-family: var(--mono); font-size: 11px; color: var(--blue);
  background: var(--blue-soft); border-radius: 99px; padding: 4px 10px;
}

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--muted);
}
.icon-btn:hover { color: var(--ink); background: #f5f7fa; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 16, .48);
  display: grid; place-items: center; z-index: 80; padding: 20px;
  backdrop-filter: blur(4px); animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0;} to { opacity: 1;} }
.modal {
  width: min(460px, 100%); background: #fff; border-radius: 14px;
  border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.22);
  overflow: hidden; animation: pop .18s ease;
}
.modal.compact { width: min(360px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0;} to { transform: none; opacity: 1;} }
.modal header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal h3 { margin: 0; font-size: 16px; }
.form { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.form input {
  height: 40px; border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 0 12px; color: var(--ink); outline: none;
}
.form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,95,249,.12); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.status-list { display: flex; flex-direction: column; padding: 8px; gap: 4px; }
.status-option {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
  padding: 12px; border-radius: 9px; text-align: left;
}
.status-option:hover, .status-option.on { background: var(--blue-soft); }
.status-option .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-option .dot.lead { background: var(--amber); }
.status-option .dot.work { background: var(--blue); }
.status-option .dot.pay { background: #7a5af8; }
.status-option .dot.done { background: var(--green); }

/* Toasts */
.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 24px));
}
.toast {
  background: #12151a; color: #fff; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.28); display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transform: translateY(8px); transition: .2s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast strong { font-size: 13px; }
.toast span { font-size: 12px; color: #a8b0bd; }
.toast.err { background: #3b1212; }
.toast.info { background: #142033; }

@media (max-width: 1100px) {
  .pipeline { grid-template-columns: 1fr 1fr; }
  .workspace.with-drawer { grid-template-columns: 250px 1fr; }
  .drawer { position: fixed; right: 0; top: 56px; bottom: 28px; width: min(340px, 100%); z-index: 40; }
  .split { grid-template-columns: 1fr; }
  .preview-pane { border-left: 0; border-top: 1px solid var(--line); min-height: 360px; }
}
@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .search { display: none; }
  .workspace, .workspace.with-drawer { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side-meta { display: none; }
  .deal-layout, .pay-layout, .avito-layout, .tariffs, .listing, .pipeline { grid-template-columns: 1fr; }
  .sb-mid { display: none; }
}
