/* ADULT CRM — интерфейс по эталону outputs/2026-09-19_crm-design-v2/ (решение Петра 19.09).
   Токены: сайт atelieradult.com и презентация Ложи v4 (темнее, тоньше, свет вместо плашек). */
/* У Athelas нет обычных (лининговых) цифр: «2.10» читается как «2.1o», «L-001» как «L-ooı».
   Буквы берём из Athelas, цифры — из следующего шрифта стека (Palatino). */
@font-face { font-family: "ADULT Serif"; src: local("Athelas Regular"), local("Athelas-Regular"); unicode-range: U+0000-002F, U+003A-10FFFF; }

:root {
  --ink: #070405;
  --ink-2: #0d0709;
  --surface: #120b0d;
  --field: #160e11;
  --line: #241a1d;
  --line-2: #3a2a2f;
  --cream: #efe6da;
  --cream-dim: #ab9d90;
  --mute: #8f7f74;
  --wine: #4a1220;
  --wine-lit: #7a2033;
  --wine-glow: rgba(122, 32, 51, .45);
  --bronze: #b08b4f;
  --danger: #d9826f;
  --serif: "ADULT Serif", Palatino, "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mark: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --shadow: 0 24px 70px rgba(0, 0, 0, .55);
  color-scheme: dark;
  font-family: var(--sans);
  color: var(--cream);
  background: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(60rem 26rem at 88% -8rem, rgba(122, 32, 51, .16), transparent 70%),
    radial-gradient(40rem 20rem at -10% -6rem, rgba(176, 139, 79, .045), transparent 70%),
    var(--ink);
}
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ——— Верхняя панель ——— */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 28px;
  min-height: 60px; padding: 10px 32px;
  background: rgba(7, 4, 5, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.identity { display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; font-family: var(--mark); font-weight: 300; font-size: 16px; letter-spacing: .06em; white-space: nowrap; }
.brand i { display: inline-block; width: .15em; height: .15em; margin: 0 .22em; border-radius: 50%; background: var(--wine-lit); box-shadow: 0 0 10px var(--wine-glow); }
.product-name { padding-left: 14px; border-left: 1px solid var(--line-2); color: var(--bronze); font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; }
.tools { display: flex; gap: 10px; min-width: 0; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input, .owner-filter select {
  width: 100%; min-height: 38px; padding: 0 12px;
  background: var(--field); border: 1px solid var(--line); border-radius: 6px;
  font-size: 13.5px; transition: border-color .15s;
}
.search input { padding-right: 44px; }
.search input::placeholder { color: var(--mute); }
.search input:hover, .owner-filter select:hover { border-color: var(--line-2); }
.search kbd { position: absolute; right: 9px; top: 8px; display: grid; place-items: center; min-width: 22px; height: 22px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--mute); font: 11px var(--sans); }
.owner-filter { width: 200px; flex: none; }
.session { display: flex; align-items: center; gap: 16px; }
.demo-badge { padding: 5px 10px; border: 1px solid rgba(176, 139, 79, .3); border-radius: 999px; color: var(--bronze); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.session-name { color: var(--cream-dim); font-size: 12px; }

/* ——— Вход и синхронизация ——— */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); display: grid; gap: 30px; padding: 36px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(18, 11, 13, .92); box-shadow: var(--shadow); }
.auth-card > .brand { justify-self: start; font-size: 20px; }
.auth-card small { color: var(--bronze); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; }
.auth-card h1 { margin: 7px 0 8px; font-size: 38px; }
.auth-card p { margin: 0; color: var(--cream-dim); line-height: 1.5; }
.auth-card form { display: grid; gap: 16px; }
.auth-card .field input { min-height: 46px; }
.auth-card .button { min-height: 46px; }
.auth-card .button:disabled { opacity: .65; cursor: wait; }
.auth-loading { justify-items: center; text-align: center; }
.auth-error { color: var(--danger) !important; font-size: 12.5px; }
.sync-notice { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 10px 24px; border-bottom: 1px solid var(--line); color: var(--cream-dim); background: rgba(176, 139, 79, .07); font-size: 12.5px; }
.sync-notice.is-error { color: var(--danger); background: rgba(217, 130, 111, .08); }
.sync-notice .button { min-height: 34px; padding: 0 12px; }
.drawer .sync-notice { position: relative; z-index: 1; justify-content: space-between; align-items: flex-start; padding: 12px 24px; }

/* ——— Сводка и представления ——— */
main { padding: 26px 32px 48px; }
.overview-title { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
.overview h1 { margin: 0; font-size: 30px; line-height: 1.1; letter-spacing: .005em; }
.ledger { display: flex; gap: 22px; margin: 0; color: var(--cream-dim); font-size: 13px; }
.ledger b { color: var(--cream); font-weight: 500; }
.views { display: flex; gap: 2px; margin-top: 16px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
.views button {
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 42px; padding: 0 14px; border: 0; background: none;
  color: var(--cream-dim); font-size: 13.5px; white-space: nowrap;
}
.views button span { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: rgba(239, 230, 218, .05); color: var(--mute); font-size: 11px; text-align: center; }
.views button:hover { color: var(--cream); }
.views button[aria-pressed="true"] { color: var(--cream); }
.views button[aria-pressed="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 1px; background: var(--wine-lit); box-shadow: 0 0 12px var(--wine-glow); }
.views button[aria-pressed="true"] span { background: rgba(122, 32, 51, .42); color: var(--cream); }
.views button.has-alert span { background: rgba(217, 130, 111, .14); color: var(--danger); }
.result-line { display: flex; align-items: baseline; gap: 14px; margin: 16px 0 12px; }
.result-line span { color: var(--cream-dim); font-size: 12px; }
.result-line small { color: var(--mute); font-size: 11.5px; }

/* ——— Доска ——— */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 16px; align-items: stretch; }
.stage {
  display: flex; flex-direction: column; min-height: calc(100vh - 250px);
  border-top: 1px solid var(--line-2); border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, rgba(23, 14, 17, .6) 0, rgba(23, 14, 17, .2) 260px, rgba(23, 14, 17, .08) 100%);
}
.stage-paid {
  border-top-color: var(--wine-lit);
  background:
    radial-gradient(120% 200px at 50% 0, rgba(122, 32, 51, .2), transparent 72%),
    linear-gradient(180deg, rgba(23, 14, 17, .6) 0, rgba(23, 14, 17, .2) 260px, rgba(23, 14, 17, .08) 100%);
}
.stage-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; row-gap: 10px; padding: 14px 14px 12px; }
.stage-dots { grid-column: 1 / -1; display: flex; gap: 5px; }
.stage-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.stage-dots i.on { background: var(--wine-lit); }
.stage-paid .stage-dots i { box-shadow: 0 0 8px var(--wine-glow); }
.stage-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.stage-title h2 { margin: 0; font-family: var(--sans); font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.stage-count { color: var(--mute); font-size: 12px; }
.stage-sum { margin: 0; color: var(--cream-dim); font-size: 12.5px; white-space: nowrap; }
.stage-paid .stage-sum { color: var(--cream); }
.stage-list { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 2px 10px 14px; border-radius: 6px; transition: background .15s, box-shadow .15s; }
.stage-list.drag-over { background: rgba(122, 32, 51, .1); box-shadow: inset 0 0 0 1px rgba(122, 32, 51, .6); }
.empty { margin: 0; padding: 32px 0; text-align: center; color: var(--mute); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; }

/* ——— Карточка на доске ——— */
.lead-card {
  position: relative; flex: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  user-select: none; -webkit-user-select: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.lead-card::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: transparent; }
.lead-card.needs-decision::before { background: var(--wine-lit); box-shadow: 0 0 10px var(--wine-glow); }
.lead-card.is-overdue::before { background: var(--danger); box-shadow: none; }
.lead-card:hover { border-color: var(--line-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .38); }
.lead-card:focus-within { border-color: rgba(176, 139, 79, .5); }
.lead-card.is-closed { opacity: .7; }
.lead-card.is-dragging {
  z-index: 60; pointer-events: none;
  transform: translate(var(--drag-x, 0), var(--drag-y, 0)) rotate(1.4deg);
  border-color: rgba(176, 139, 79, .5);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .65);
  transition: none;
}
.card-open { display: block; width: 100%; padding: 13px 14px 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.card-open:focus-visible { outline-offset: -3px; border-radius: 6px; }
.card-head { display: flex; align-items: center; gap: 11px; }
.card-id { flex: 1; min-width: 0; }
.avatar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #f6ede2; font-family: var(--serif); font-size: 17px; line-height: 1; box-shadow: inset 0 0 0 1px rgba(239, 230, 218, .1); }
.avatar-lg { width: 56px; height: 56px; font-size: 25px; }
.av-0 { background: linear-gradient(145deg, #8a2a3d, #4a1220); }
.av-1 { background: linear-gradient(145deg, #9a7641, #56401f); }
.av-2 { background: linear-gradient(145deg, #6d4a6e, #3a2440); }
.av-3 { background: linear-gradient(145deg, #4f6b5c, #2a3a31); }
.av-4 { background: linear-gradient(145deg, #4d5d78, #262f40); }
.av-5 { background: linear-gradient(145deg, #93584a, #4e2a22); }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; min-width: 0; }
.tag { flex: none; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--cream-dim); font-size: 9.5px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; }
.tag-returning { border-color: rgba(176, 139, 79, .45); color: var(--bronze); }
.drawer-person { display: flex; align-items: center; gap: 16px; min-width: 0; }
.m-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% - 32px); min-height: 48px; margin: 24px 16px 0; padding: 0 16px; border: 1px dashed var(--line-2); border-radius: 8px; background: none; color: var(--cream-dim); font-size: 13.5px; text-align: left; }
.card-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-name { flex: 0 0 auto; max-width: 100%; overflow: hidden; font-family: var(--serif); font-size: 18px; font-weight: 400; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.card-amount { color: var(--cream-dim); font-size: 12.5px; white-space: nowrap; }
.card-sub { margin-top: 3px; color: var(--mute); font-size: 12px; }
.card-sub > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-owner { flex: none; color: var(--bronze); font-size: 11.5px; }
.card-step { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.4; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; min-height: 34px; padding: 0 8px 8px 14px; }
.card-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.due { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.due i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); }
.due-overdue { color: var(--danger); }
.due-overdue i { background: var(--danger); box-shadow: 0 0 8px rgba(217, 130, 111, .6); }
.due-today { color: var(--cream); }
.due-today i { background: var(--bronze); }
.due-later { color: var(--cream-dim); }
.due-none { color: var(--mute); }
.due-none i { background: transparent; border: 1px solid var(--mute); }
.flag-decision { color: var(--bronze); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.advance {
  flex: none; margin-left: auto; min-height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: 999px;
  background: none; color: var(--mute); font-size: 12px; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.advance:focus-visible { outline-offset: 1px; }
.advance:hover, .advance:focus-visible { color: var(--cream); border-color: var(--line-2); background: rgba(239, 230, 218, .03); }
.stage-agreement .advance:hover, .stage-agreement .advance:focus-visible { border-color: var(--wine-lit); background: rgba(122, 32, 51, .22); }
.outcome-tag { flex: none; padding: 3px 8px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--cream-dim); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }

/* ——— Карточка лида ——— */
.drawer-scrim { position: fixed; inset: 0; z-index: 30; padding: 0; border: 0; background: rgba(3, 2, 2, .62); backdrop-filter: blur(2px); cursor: default; animation: fade .2s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31;
  width: min(560px, 100vw); overflow: auto; outline: none;
  background: #0d080a;
  border-left: 1px solid var(--line); box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
  animation: slide .24s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slide { from { transform: translateX(28px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 16px; background: radial-gradient(90% 180px at 100% 0, rgba(122, 32, 51, .2), transparent 72%), rgba(13, 8, 10, .96); backdrop-filter: blur(12px); }
.drawer-heading small { color: var(--bronze); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; }
.drawer-heading h2 { margin: 6px 0 6px; font-size: 34px; line-height: 1.05; }
.drawer-heading p { margin: 0; color: var(--cream-dim); font-size: 13px; }
.icon-button { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--cream-dim); font-size: 22px; line-height: 1; }
.icon-button:hover { color: var(--cream); border-color: var(--line-2); }
.rail { border-bottom: 1px solid var(--line); }
.stage-rail { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 4px 28px 20px; list-style: none; }
.rail-actions { padding: 0 28px 20px; }
.rail-advance { width: 100%; }
.rail-advance:hover { border-color: var(--wine-lit); background: rgba(122, 32, 51, .18); }
.stage-rail li { position: relative; display: grid; justify-items: start; gap: 9px; color: var(--mute); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.stage-rail li::before { content: ""; position: absolute; top: 4px; left: 9px; right: 0; height: 1px; background: var(--line-2); }
.stage-rail li:last-child::before { display: none; }
.stage-rail i { position: relative; z-index: 1; width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.stage-rail li.past { color: var(--cream-dim); }
.stage-rail li.past i, .stage-rail li.past::before { background: var(--wine-lit); }
.stage-rail li.current { color: var(--cream); }
.stage-rail li.current i { background: var(--wine-lit); box-shadow: 0 0 0 4px rgba(122, 32, 51, .28), 0 0 14px var(--wine-glow); }
#lead-form { padding: 22px 28px 0; }
.panel { min-width: 0; margin: 0 0 24px; padding: 0; border: 0; }
.panel legend { float: left; width: 100%; margin: 0 0 12px; padding: 0; color: var(--bronze); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; }
.panel-next { padding: 16px; border: 1px solid rgba(122, 32, 51, .45); border-radius: 8px; background: rgba(122, 32, 51, .08); }
.form-grid { clear: both; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { display: block; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { display: block; margin-bottom: 6px; color: var(--cream-dim); font-size: 11.5px; }
.field b { margin-left: 3px; color: var(--bronze); font-weight: 400; }
.field input, .field select, .field textarea, .status-row select {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--field); border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; line-height: 1.3; transition: border-color .15s, box-shadow .15s;
}
.field textarea { display: block; min-height: 64px; resize: vertical; line-height: 1.45; }
.field select, .status-row select, .owner-filter select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ab9d90' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field input:hover, .field select:hover, .field textarea:hover, .status-row select:hover { border-color: var(--line-2); }
.field input:focus, .field select:focus, .field textarea:focus, .status-row select:focus, .search input:focus, .owner-filter select:focus { outline: none; border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(176, 139, 79, .14); }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field-error { display: block; margin-top: 5px; color: var(--danger); font-size: 11.5px; }
.checkbox { display: flex; align-items: center; align-self: end; gap: 10px; min-height: 40px; color: var(--cream-dim); font-size: 13px; cursor: pointer; }
.checkbox input { flex: none; appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1px solid var(--line-2); border-radius: 4px; background: var(--field) center / 12px no-repeat; cursor: pointer; transition: background-color .15s, border-color .15s; }
.checkbox input:hover { border-color: var(--cream-dim); }
.checkbox input:checked { border-color: var(--wine-lit); background-color: var(--wine-lit); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23efe6da' stroke-width='1.5'/%3E%3C/svg%3E"); box-shadow: 0 0 10px var(--wine-glow); }
.due-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.due-presets button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: none; color: var(--cream-dim); font-size: 12.5px; transition: border-color .15s, color .15s; }
.due-presets button:hover, .due-presets button:focus-visible { border-color: var(--bronze); color: var(--cream); }
.stage-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--cream-dim); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.stage-chip .stage-dots { gap: 3px; }
.stage-chip .stage-dots i { width: 4px; height: 4px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.status-row small { display: block; margin-bottom: 4px; color: var(--bronze); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; }
.status-row strong { font-family: var(--serif); font-size: 21px; font-weight: 400; }
.status-row select { width: 200px; }
.demo-telegram { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 18px; }
.demo-telegram small { max-width: 250px; color: var(--mute); font-size: 11.5px; line-height: 1.4; text-align: right; }
.text-button { min-height: 40px; padding: 8px 0; border: 0; background: none; color: var(--cream-dim); font-size: 13px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.text-button:hover { color: var(--cream); text-decoration-color: currentColor; }
.text-button.quiet { font-size: 12.5px; text-decoration: none; }
.text-button.quiet:hover { text-decoration: underline; }
.drawer-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; margin: 0 -28px; padding: 14px 28px 18px; background: rgba(11, 6, 8, .95); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
.button { min-height: 42px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 6px; background: transparent; font-size: 14px; transition: background .15s, border-color .15s; }
.button.primary { background: var(--wine-lit); border-color: var(--wine-lit); box-shadow: 0 8px 24px rgba(122, 32, 51, .32); }
.button.primary:hover { background: #8b2539; border-color: #8b2539; }
.button.secondary:hover { border-color: var(--cream-dim); }

/* ——— Подтверждение, уведомление, ошибка ——— */
.confirm-dialog {
  width: min(440px, calc(100vw - 32px)); padding: 28px;
  color: var(--cream); border: 1px solid var(--line); border-radius: 10px;
  background: radial-gradient(100% 160px at 50% 0, rgba(122, 32, 51, .2), transparent 72%), #0e080a;
  box-shadow: var(--shadow);
}
.confirm-dialog::backdrop { background: rgba(3, 2, 2, .72); backdrop-filter: blur(3px); }
.dialog-mark { display: flex; align-items: center; gap: 8px; color: var(--bronze); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; }
.dialog-mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--wine-lit); box-shadow: 0 0 10px var(--wine-glow); }
.confirm-dialog h2 { margin: 12px 0 10px; font-size: 28px; line-height: 1.1; }
.confirm-dialog p { margin: 0; color: var(--cream-dim); font-size: 13.5px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%); padding: 12px 18px 12px 16px; border: 1px solid var(--line-2); border-radius: 8px; background: #150d10; box-shadow: var(--shadow); color: var(--cream); font-size: 13px; white-space: nowrap; }
.toast::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 10px; border-radius: 50%; background: var(--wine-lit); box-shadow: 0 0 8px var(--wine-glow); vertical-align: .12em; }
.fatal { display: grid; place-content: center; justify-items: center; gap: 8px; max-width: 620px; min-height: 100vh; margin: auto; padding: 24px; text-align: center; }
.fatal h1 { margin: 24px 0 4px; font-size: 32px; }
.fatal p { margin: 0 0 12px; color: var(--cream-dim); line-height: 1.5; }

/* ——— Пакет 2: режим, событие, факт против цели ——— */
.mode-switch { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: 999px; }
.mode-switch button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--cream-dim); font-size: 12px; letter-spacing: .04em; }
.mode-switch button[aria-pressed="true"] { background: rgba(122, 32, 51, .42); color: var(--cream); box-shadow: 0 0 12px rgba(122, 32, 51, .3); }
.pilot-badge { border-color: rgba(239, 230, 218, .28); color: var(--cream); }
.overview-title { align-items: flex-end; }
.event-title { display: flex; align-items: center; gap: 18px; }
.event-title h1, .m-title h1 { margin: 0; font-size: inherit; }
.event-picker { position: relative; }
.event-trigger {
  display: inline-flex; align-items: center; gap: 12px; padding: 2px 6px 4px 0; border: 0; border-radius: 6px;
  background: none; color: var(--cream); font: 400 30px/1.1 var(--serif); cursor: pointer;
}
.event-trigger i { width: 9px; height: 9px; margin-top: -6px; border-right: 1.5px solid var(--bronze); border-bottom: 1.5px solid var(--bronze); transform: rotate(45deg); transition: transform .18s, margin .18s; }
.event-trigger[aria-expanded="true"] i { margin-top: 4px; transform: rotate(-135deg); }
.event-trigger:hover i { border-color: var(--cream); }
.event-trigger:focus-visible { outline-offset: 4px; }
.event-menu {
  position: absolute; top: calc(100% + 10px); left: -10px; z-index: 26; min-width: 290px; margin: 0; padding: 6px; list-style: none;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: radial-gradient(120% 90px at 0 0, rgba(122, 32, 51, .16), transparent 70%), #110a0c;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .6); animation: menu .14s ease-out;
}
@keyframes menu { from { opacity: 0; transform: translateY(-4px); } }
.event-menu button {
  position: relative; display: grid; gap: 3px; width: 100%; padding: 10px 14px 10px 30px; border: 0; border-radius: 7px;
  background: none; color: var(--cream-dim); text-align: left; cursor: pointer;
}
.event-menu button::before { content: ""; position: absolute; left: 13px; top: 19px; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.event-menu button:hover, .event-menu button:focus-visible { background: rgba(239, 230, 218, .05); color: var(--cream); outline: none; }
.event-menu button[aria-selected="true"] { color: var(--cream); background: rgba(122, 32, 51, .2); }
.event-menu button[aria-selected="true"]::before { background: var(--wine-lit); box-shadow: 0 0 10px var(--wine-glow); }
.event-option-name { font-family: var(--serif); font-size: 19px; line-height: 1.15; }
.event-menu small { color: var(--mute); font-size: 11.5px; }
.event-menu button[aria-selected="true"] small { color: var(--cream-dim); }
.new-lead { min-height: 38px; padding: 0 16px; font-size: 13.5px; white-space: nowrap; }
.event-summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 300px; max-width: 460px; overflow: hidden; }
.progress-copy small { color: var(--bronze); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; }
.progress-copy p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 0; margin: 4px 0 0; color: var(--cream-dim); font-size: 13px; }
.progress-copy p > *:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--mute); }
.progress-copy b, .progress-copy strong { color: var(--cream); font-weight: 500; }
.progress-bars { display: block; width: 100%; max-width: 100%; height: 9px; }
.progress-bars .track { fill: var(--line-2); }
.progress-bars .fill { fill: var(--wine-lit); filter: drop-shadow(0 0 3px rgba(122, 32, 51, .8)); }
.progress-none, .event-ledger { margin: 0; color: var(--mute); font-size: 12px; }
.event-ledger b { color: var(--cream-dim); font-weight: 500; }
.transfer-tag { color: var(--cream-dim); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.safe-empty { display: grid; justify-items: start; gap: 10px; max-width: 520px; margin: 40px 0; padding: 28px; border: 1px dashed var(--line-2); border-radius: 10px; }
.safe-empty h2 { margin: 0; font-size: 26px; }
.safe-empty p { margin: 0 0 6px; color: var(--cream-dim); line-height: 1.5; }
.safe-empty .button + .button { margin-top: -2px; }

/* ——— Пакет 2: карточка лида и диалоги ——— */
.rail-actions { display: grid; gap: 8px; }
.price-override { grid-column: 1 / -1; }
.price-override.is-default { display: none; }
.field input:disabled, .field select:disabled { opacity: .6; cursor: not-allowed; }
.payment-fact { display: grid; gap: 4px; margin: 0 0 20px; padding: 14px 16px; border: 1px solid rgba(122, 32, 51, .45); border-radius: 8px; background: rgba(122, 32, 51, .1); }
.payment-fact small { color: var(--bronze); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; }
.payment-fact strong { font-family: var(--serif); font-size: 20px; font-weight: 400; }
.payment-fact span { color: var(--cream-dim); font-size: 12.5px; }
.dialog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin-top: 18px; }
.dialog-fields .field.wide { grid-column: 1 / -1; }
.dialog-fields input { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--cream); font-size: 14px; }
.dialog-fields input:focus { outline: none; border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(176, 139, 79, .14); }
.dialog-fields .field > span { display: block; margin-bottom: 6px; color: var(--cream-dim); font-size: 11.5px; }
.dialog-fields input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.dialog-fields input::-webkit-inner-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dialog-error { display: block; margin-top: 12px; color: var(--danger); font-size: 12.5px; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ——— Адаптивность ——— */
@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto auto; row-gap: 10px; }
  .tools { grid-column: 1 / -1; grid-row: 2; }
  .search { max-width: none; }
  .session { justify-self: end; }
  .overview-title { flex-direction: column; align-items: flex-start; }
  .event-summary { max-width: none; width: 100%; }
  .board { display: flex; gap: 12px; overflow-x: auto; margin: 0 -32px; padding: 0 32px 16px; scroll-padding: 0 32px; scroll-snap-type: x proximity; scrollbar-color: var(--line-2) transparent; }
  .stage { flex: 0 0 300px; scroll-snap-align: start; min-height: 60vh; }
}
@media (max-width: 640px) {
  /* Телефон: свой каркас (views.js → mobile), компьютерная доска не выводится. */
  .m-top { padding: 14px 16px 4px; }
  .m-bar { display: flex; align-items: center; gap: 10px; min-height: 40px; }
  .m-bar .product-name { padding-left: 10px; }
  .m-bar .demo-badge { margin-left: auto; }
  .m-top .search { display: block; max-width: none; margin-top: 10px; }
  .m-top .search input { min-height: 44px; padding-right: 12px; font-size: 16px; }
  .m-top .search kbd { display: none; }
  .m-owners { display: flex; gap: 6px; margin: 10px -16px 0; padding: 0 16px 4px; overflow-x: auto; scrollbar-width: none; }
  .m-owners::-webkit-scrollbar { display: none; }
  .m-owners button { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--cream-dim); font-size: 13.5px; }
  .m-owners button[aria-pressed="true"] { border-color: var(--wine-lit); background: rgba(122, 32, 51, .24); color: var(--cream); }
  .m-main { padding: 6px 0 calc(96px + env(safe-area-inset-bottom)); }
  .m-bar .mode-switch { margin-left: auto; }
  .m-session { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
  .m-session { justify-content: flex-end; margin-top: 0; }
  .m-session .demo-badge { display: none; }
  .m-session .text-button { min-height: 40px; padding: 6px 0; }
  .m-session .session-name { margin-left: auto; }
  .auth-card { padding: 28px 22px; }
  .sync-notice { align-items: stretch; flex-direction: column; padding: 10px 16px; }
  .m-bar .mode-switch button { min-height: 38px; padding: 0 14px; }
  .m-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px 16px 4px; }
  .m-title .event-trigger { font-size: 26px; }
  .m-title .event-menu { left: 0; min-width: min(290px, calc(100vw - 32px)); }
  .event-menu button { min-height: 52px; }
  .m-title p { margin: 4px 0 0; color: var(--bronze); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; }
  .m-title .new-lead { min-height: 40px; padding: 0 14px; }
  .event-summary { width: auto; min-width: 0; max-width: none; margin: 14px 16px 0; }
  .progress-copy p { font-size: 12.5px; }
  .dialog-fields { grid-template-columns: 1fr; }
  .dialog-fields input { min-height: 46px; font-size: 16px; }
  .safe-empty { margin: 24px 16px; }
  .m-group h2 { display: flex; align-items: center; gap: 8px; margin: 20px 16px 10px; color: var(--bronze); font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; }
  .m-group h2 span { color: var(--mute); font-size: 12px; letter-spacing: 0; }
  .m-group-overdue h2 { color: var(--danger); }
  .m-list { display: grid; gap: 8px; padding: 0 16px; }
  .m-list > .m-empty { margin: 32px 0; }
  .m-empty { margin: 40px 16px; color: var(--mute); font-size: 13.5px; text-align: center; }
  .m-seg { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; padding: 10px 16px; background: rgba(7, 4, 5, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
  .m-seg button { display: grid; place-items: center; gap: 3px; min-height: 58px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--cream-dim); }
  .m-seg b { color: var(--cream); font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1; }
  .m-seg span { font-size: 10.5px; }
  .m-seg button[aria-pressed="true"] { border-color: var(--wine-lit); background: rgba(122, 32, 51, .22); color: var(--cream); box-shadow: 0 0 16px rgba(122, 32, 51, .25); }
  .m-stage-sum { display: flex; align-items: baseline; justify-content: space-between; margin: 0; padding: 14px 16px 10px; color: var(--cream-dim); font-size: 12.5px; }
  .m-stage-sum b { color: var(--cream); font-weight: 500; }
  .m-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); background: rgba(10, 6, 8, .95); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
  .m-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 58px; padding: 6px 4px; border: 0; background: none; color: var(--cream-dim); }
  .m-nav button::before { content: ""; position: absolute; top: 0; width: 22px; height: 2px; border-radius: 2px; background: transparent; }
  .m-nav button[aria-pressed="true"] { color: var(--cream); }
  .m-nav button[aria-pressed="true"]::before { background: var(--wine-lit); box-shadow: 0 0 12px var(--wine-glow); }
  .m-nav-label { font-size: 12.5px; }
  .m-nav-count { order: -1; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: rgba(239, 230, 218, .06); color: var(--mute); font-size: 12px; }
  .m-nav button[aria-pressed="true"] .m-nav-count { background: rgba(122, 32, 51, .42); color: var(--cream); }
  .m-nav button.has-alert .m-nav-count { background: rgba(217, 130, 111, .16); color: var(--danger); }
  .advance { min-height: 40px; }

  .drawer { width: 100vw; border-left: 0; }
  .drawer-header { padding: 16px 16px 12px; }
  .drawer-heading h2 { font-size: 30px; }
  .stage-rail { padding: 4px 16px 16px; }
  .stage-rail li { font-size: 11px; letter-spacing: 0; text-transform: none; }
  .rail-actions { padding: 0 16px 16px; }
  .rail-advance { min-height: 48px; font-size: 15px; }
  #lead-form { padding: 18px 16px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .field input, .field select, .field textarea, .status-row select { min-height: 46px; font-size: 16px; }
  .checkbox { align-self: start; }
  .due-presets { order: 2; display: grid; grid-template-columns: 1fr 1fr; margin-top: -4px; }
  .panel-next .checkbox { order: 3; }
  .due-presets button { min-height: 42px; padding: 0 10px; font-size: 14px; }
  .status-row { flex-direction: column; align-items: stretch; }
  .status-row select { width: 100%; }
  .demo-telegram { flex-direction: column; align-items: flex-start; gap: 2px; }
  .demo-telegram small { text-align: left; }
  .drawer-actions { margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .drawer-actions .button { flex: 1; min-height: 48px; padding: 0 8px; font-size: 15px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; min-height: 48px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
