/* Падел CRM — гамма «Графит и терракота», как у сайта и бота. Светлая и тёмная темы. */
:root {
  --bg: #F1ECE4;
  --surface: #FBF8F3;
  --surface-2: #F5F0E8;
  --ink: #1B1B1D;
  --ink-2: #4A4640;
  --muted: #8A847B;
  --line: rgba(27, 27, 29, .10);
  --line-2: rgba(27, 27, 29, .18);
  --terra: #C8643B;
  --terra-ink: #A84F2B;
  --terra-soft: rgba(200, 100, 59, .12);
  --sand: #E8D6B5;
  --sand-ink: #7A6236;
  --ok: #3E7D4F;
  --ok-soft: rgba(62, 125, 79, .12);
  --rail: #1B1B1D;
  --rail-ink: #F1ECE4;
  --bubble-in: #FFFFFF;
  --bubble-bot: #ECE6DC;
  --shadow: 0 1px 2px rgba(27, 27, 29, .06), 0 8px 24px rgba(27, 27, 29, .06);
  --display: 'Dela Gothic One', 'Golos Text', system-ui, sans-serif;
  --text: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161618; --surface: #1F1F22; --surface-2: #26262A; --ink: #F1ECE4; --ink-2: #CFC8BD; --muted: #8F897F;
    --line: rgba(241, 236, 228, .09); --line-2: rgba(241, 236, 228, .16); --terra-ink: #E08A63;
    --terra-soft: rgba(200, 100, 59, .18); --sand-ink: #E8D6B5; --ok: #7CC08E; --ok-soft: rgba(124, 192, 142, .14);
    --rail: #0F0F11; --bubble-in: #2A2A2E; --bubble-bot: #232326; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161618; --surface: #1F1F22; --surface-2: #26262A; --ink: #F1ECE4; --ink-2: #CFC8BD; --muted: #8F897F;
  --line: rgba(241, 236, 228, .09); --line-2: rgba(241, 236, 228, .16); --terra-ink: #E08A63;
  --terra-soft: rgba(200, 100, 59, .18); --sand-ink: #E8D6B5; --ok: #7CC08E; --ok-soft: rgba(124, 192, 142, .14);
  --rail: #0F0F11; --bubble-in: #2A2A2E; --bubble-bot: #232326; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--text);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--terra-ink); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; }
.boot { height: 100vh; display: grid; place-items: center; }
.boot img { border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 84px 1fr; height: 100dvh; }
.rail {
  background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 4px;
}
.rail .logo { width: 40px; height: 40px; border-radius: 11px; margin-bottom: 14px; }
.nav-btn {
  position: relative; width: 72px; padding: 9px 0 7px; border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; font-size: 11px; letter-spacing: .01em; color: rgba(241, 236, 228, .62);
  text-decoration: none;
}
.nav-btn:hover { color: var(--rail-ink); background: rgba(241, 236, 228, .06); }
.nav-btn.on { color: var(--rail-ink); background: rgba(200, 100, 59, .22); }
.nav-btn.on svg { stroke: #E9875E; }
.nav-btn .dot {
  position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--terra); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.rail .spacer { flex: 1; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* ---------- входящие: список + диалог + анкета ---------- */
.inbox { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.inbox.with-card { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) 320px; }
.list-col { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.list-head { padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.list-head h1, .page-head h1 { margin: 0; font: 22px/1.1 var(--display); letter-spacing: .01em; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); height: 100%; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-2);
  font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip b { font-weight: 600; color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.on b { color: inherit; opacity: .7; }
.chip.hot b { color: var(--terra-ink); }
.chip.on.hot b { color: inherit; }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; text-decoration: none;
  color: inherit; border-bottom: 1px solid var(--line); position: relative;
}
.row:hover { background: var(--surface-2); }
.row.on { background: var(--terra-soft); }
.row .av { grid-row: span 3; }
.row .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.unread .nm { font-weight: 700; }
.row .tm { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.row.unread .tm { color: var(--terra-ink); font-weight: 600; }
.row .sub { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 2 / 4; }
.row .pv { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.unread .pv { color: var(--ink); }
.row .pv i { font-style: normal; color: var(--ink-2); }
.row .side { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.cnt {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--terra); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px;
  font-weight: 600; letter-spacing: .01em; white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
}
.tag.wait { background: var(--terra); color: #fff; }
.tag.s6 { background: var(--ok-soft); color: var(--ok); }
.tag.s5 { background: rgba(232, 214, 181, .45); color: var(--sand-ink); }
.tag.s1, .tag.s2, .tag.s3 { background: var(--surface-2); color: var(--muted); }
.av {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px;
  background: var(--surface-2); color: var(--ink-2); flex: none; border: 1px solid var(--line);
}
.av { position: relative; overflow: hidden; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.founders { background: var(--terra); color: #fff; border-color: transparent; }
.av.trainers { background: var(--sand); color: #5A4626; border-color: transparent; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 16px; }

/* диалог */
.chat { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 64px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); flex: none;
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { background: var(--terra-soft); color: var(--terra-ink); }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px clamp(12px, 3vw, 32px) 8px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; margin: 12px 0 6px; font-size: 12px; color: var(--muted); background: var(--surface); padding: 3px 10px; border-radius: 10px; border: 1px solid var(--line); }
.note-start { align-self: center; max-width: 420px; text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 12px; }
.m { max-width: min(78%, 560px); display: flex; flex-direction: column; gap: 3px; }
.m.in { align-self: flex-start; }
.m.out { align-self: flex-end; align-items: flex-end; }
.b {
  padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow);
}
.m.in .b { background: var(--bubble-in); border-bottom-left-radius: 6px; }
.m.in.form .b { background: transparent; box-shadow: none; border: 1px dashed var(--line-2); }
.m.out .b { border-bottom-right-radius: 6px; }
.m.out.reply .b { background: var(--terra); color: #fff; }
.m.out.bot .b { background: var(--bubble-bot); color: var(--ink-2); box-shadow: none; font-size: 14px; }
.m.out.bot .b.clip { cursor: pointer; }
.m.out.bot .b.clip .tx { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.m .meta { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.m .meta .who { font-weight: 600; color: var(--ink-2); }
.pill {
  align-self: flex-start; font-size: 12.5px; color: var(--ink-2); padding: 4px 10px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface);
}
.pill.cmd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pill .t { color: var(--muted); margin-left: 6px; font-size: 11px; }
.b img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: -2px -4px 4px; }
.b audio { display: block; max-width: 260px; }
.compose {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b)); background: var(--surface);
  border-top: 1px solid var(--line);
}
.compose textarea {
  flex: 1; min-height: 44px; max-height: 40vh; resize: none; border-radius: 22px; border: 1px solid var(--line-2);
  background: var(--bg); padding: 11px 16px; outline: none; line-height: 1.4;
}
.compose textarea:focus { border-color: var(--terra); }
.send {
  width: 44px; height: 44px; border-radius: 50%; background: var(--terra); color: #fff; display: grid; place-items: center; flex: none;
}
.send:disabled { opacity: .4; }
.hint { font-size: 11.5px; color: var(--muted); padding: 0 16px 6px; background: var(--surface); }
.placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.placeholder svg { width: 40px; height: 40px; stroke-width: 1.3; margin-bottom: 8px; }

/* анкета */
.card-col { min-height: 0; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); padding: 20px 18px 32px; }
.card-col h3 { margin: 22px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.card-col h3:first-child { margin-top: 0; }
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px 0 6px; }
.steps i { height: 5px; border-radius: 3px; background: var(--line-2); }
.steps i.on { background: var(--terra); }
.steps.done i.on { background: var(--ok); }
.stage-name { font-weight: 600; }
.stage-note { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 10px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.topics span { font-size: 12.5px; padding: 4px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.quote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--terra); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: 14px; white-space: pre-wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  height: 40px; padding: 0 14px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-size: 14px; border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--terra); color: #fff; border-color: var(--terra); }
.btn.primary:hover { background: var(--terra-ink); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.big { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.timeline li span:last-child { color: var(--muted); white-space: nowrap; }
.sheet-close { display: none; }

/* ---------- обычные страницы ---------- */
.page { flex: 1; overflow-y: auto; padding: 24px clamp(16px, 4vw, 48px) calc(40px + var(--safe-b)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; max-width: 760px; }
.panel h2 { margin: 0 0 4px; font-size: 17px; }
.panel > p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.panel .muted { color: var(--muted); font-size: 13px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-2); position: relative; flex: none; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--terra); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle small { display: block; color: var(--muted); font-size: 12.5px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 12px; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ok::before { background: var(--ok); }
.status.warn::before { background: var(--terra); }
.steps-ios { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.steps-ios li { margin: 4px 0; }
.staff { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.staff .av { width: 40px; height: 40px; font-size: 14px; }
.staff b { display: block; }
.staff small { color: var(--muted); font-size: 12.5px; }
.staff select { height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 8px; max-width: 170px; }
.staff.pending { background: var(--terra-soft); margin: 0 -18px; padding: 10px 18px; }
.soon { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); max-width: 1000px; }
.soon .panel { margin: 0; }
.soon .panel h2 { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.soon .panel p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.badge-soon { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--terra-ink); background: var(--terra-soft); padding: 3px 8px; border-radius: 8px; }

/* аналитика */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); max-width: 1000px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); }
.kpi b { display: block; font: 28px/1.15 var(--display); margin-top: 4px; }
.kpi small { color: var(--muted); font-size: 12px; }
.funnel { display: grid; gap: 8px; }
.funnel .fr { display: grid; grid-template-columns: 150px 1fr 48px; gap: 10px; align-items: center; font-size: 14px; }
.funnel .bar { height: 22px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.funnel .bar i { display: block; height: 100%; background: var(--terra); border-radius: 6px; min-width: 2px; }
.funnel .fr b { text-align: right; font-variant-numeric: tabular-nums; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
table.t td { padding: 8px; border-bottom: 1px solid var(--line); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--rail); color: var(--rail-ink); }
.login .box { width: 100%; max-width: 380px; text-align: center; }
.login img { width: 84px; height: 84px; border-radius: 22px; }
.login h1 { font: 28px/1.15 var(--display); margin: 22px 0 8px; }
.login p { color: rgba(241, 236, 228, .66); margin: 0 0 26px; }
.login .btn { width: 100%; }
.login .wait { margin-top: 18px; font-size: 14px; color: rgba(241, 236, 228, .66); min-height: 42px; }
.login .wait b { color: var(--rail-ink); }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; transition: .2s; z-index: 50;
  max-width: calc(100vw - 32px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.banner {
  display: flex; align-items: center; gap: 10px; margin: 0 12px 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--terra-soft); color: var(--ink); font-size: 13.5px;
}
.banner span { flex: 1; }
.banner .btn { height: 32px; font-size: 13px; padding: 0 10px; }


/* ---------- аналитика рассылки, правка ответа ---------- */
.scroll-x { overflow-x: auto; margin: 0 -4px; }
.sub-h { margin: 18px 0 6px; font-size: 14px; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 150px; align-items: end; }
.dbar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.dbar i { display: block; width: 100%; max-width: 28px; min-height: 2px; background: var(--terra); border-radius: 4px 4px 0 0; }
.dbar b { font-size: 11px; font-weight: 600; order: -1; }
.dbar span { font-size: 10px; color: var(--muted); white-space: nowrap; }
.edit-msg { color: inherit; text-decoration: underline; font-size: inherit; }
.edit-area { display: block; width: min(460px, 70vw); border: 0; color: #1B1B1D; background: #fff; border-radius: 8px; padding: 8px; font: inherit; resize: vertical; }
.edit-btns { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.m.out.reply .edit-btns .btn { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }

/* ---------- рассылка ---------- */
.muted { color: var(--muted); font-size: 13px; }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn.small svg.i { width: 16px; height: 16px; }
.btn.wa { border-color: rgba(37, 165, 90, .45); }
.o-head .btn.small { align-self: flex-start; }
.today { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.today svg.i { width: 15px; height: 15px; }
.today.warn { color: var(--terra-ink); font-weight: 600; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: 1 0 auto; text-align: center; padding: 7px 10px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.seg a b, .seg button b { font-weight: 600; color: var(--muted); }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 500; }
.seg.st { flex-wrap: wrap; }
.seg.st button { flex: 1 1 auto; }
.seg.st .on { background: var(--ink); color: var(--bg); }
.o-row { grid-template-columns: minmax(0, 1fr) auto; }
.o-row .sub { grid-column: 1 / 3; }
.chans { display: flex; gap: 4px; align-items: center; }
.ch { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--muted); background: var(--surface-2); }
.ch svg.i { width: 14px; height: 14px; }
.ch.p { color: var(--terra-ink); background: var(--terra-soft); }
.tag.sent { background: rgba(232, 214, 181, .45); color: var(--sand-ink); }
.tag.replied { background: var(--terra-soft); color: var(--terra-ink); }
.tag.refused { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.more { display: block; width: calc(100% - 32px); margin: 12px 16px 24px; height: 40px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--ink-2); }
.detail { background: var(--surface); }
.o-card { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px clamp(16px, 3vw, 32px) calc(32px + var(--safe-b)); }
.o-sec { padding: 16px 0; border-bottom: 1px solid var(--line); max-width: 720px; }
.o-sec:last-child { border-bottom: 0; }
.o-sec h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.o-sec h3:not(:first-child) { margin-top: 18px; }
.o-sec > p { margin: 8px 0 0; }
.o-bot { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); font-size: 14px; }
.o-next { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.o-next input { height: 32px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 8px; }
.o-field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; color: var(--ink-2); }
.o-field input, .o-input { height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 12px; outline: none; }
.o-field input { flex: 1; max-width: 260px; }
.o-input { display: block; width: 100%; margin-bottom: 8px; }
textarea.o-input, .o-note { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; width: 100%; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); outline: none; }
.o-field input:focus, .o-input:focus, .o-note:focus { border-color: var(--terra); }
.o-scripts { margin: 0 0 10px; padding: 0; }
.o-msg { white-space: pre-wrap; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 14.5px; margin-bottom: 10px; overflow-wrap: anywhere; }
.o-msg.empty-script { border-style: dashed; color: var(--muted); text-align: center; padding: 22px 14px; }
.o-person { margin: 0 0 8px; }
.cline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.cval { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
.cbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.script-form .actions { align-items: center; }
.script-top { display: flex; gap: 8px; }
.script-top input { flex: 1; }
.script-top select { width: 150px; flex: none; }
.tg-seg { margin-bottom: 10px; }
#toast .undo { margin-left: 10px; color: #E9875E; font-weight: 600; }
@media (max-width: 799px) {
  .outreach.conv-open .list-col { display: none; }
  .outreach:not(.conv-open) .detail { display: none; }
}

/* ---------- телефон ---------- */
@media (max-width: 1279px) {
  .inbox.with-card { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .card-col {
    position: fixed; inset: 0 0 0 auto; width: min(380px, 100vw); z-index: 30; box-shadow: -12px 0 40px rgba(0,0,0,.18);
    transform: translateX(100%); transition: transform .2s ease; padding-top: calc(20px + var(--safe-t));
  }
  .card-col.open { transform: none; }
  .sheet-close { display: grid; position: absolute; top: calc(10px + var(--safe-t)); right: 10px; }
}
@media (max-width: 799px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail {
    order: 2; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + var(--safe-b)); gap: 0;
    border-top: 1px solid rgba(241, 236, 228, .08);
  }
  .rail .logo, .rail .spacer { display: none; }
  .nav-btn { width: auto; flex: 1; padding: 8px 0 6px; font-size: 10.5px; }
  .nav-btn .dot { right: calc(50% - 22px); }
  .main { order: 1; }
  .list-head { padding-top: calc(14px + var(--safe-t)); }
  .page { padding-top: calc(20px + var(--safe-t)); }
  .inbox, .inbox.with-card { grid-template-columns: minmax(0, 1fr); }
  .inbox.conv-open .list-col { display: none; }
  .inbox:not(.conv-open) .chat { display: none; }
  .chat-head { padding-top: calc(10px + var(--safe-t)); padding-left: 6px; }
  .back { display: grid; }
  .m { max-width: 86%; }
  .shell.in-conv { grid-template-rows: 1fr; }
  .shell.in-conv .rail { display: none; }
  .funnel .fr { grid-template-columns: 110px 1fr 40px; font-size: 13px; }
  #toast { bottom: calc(76px + var(--safe-b)); }
}
