/* ==========================================================================
   Дизайн-система платформы — один файл стилей для всех страниц:
   лендинг, вход и регистрация, кабинет, конструктор, аналитика, админка.

   Светлая тема, акцент #2563eb, системный шрифт, без внешних шрифтов и CDN.
   Брейкпоинты: 960px (планшет) и 640px (телефон).
   Классы из «CSS-словаря» (docs/ARCHITECTURE.md) — публичный контракт:
   их используют все шаблоны, переименовывать нельзя.
   ========================================================================== */

/* ---------------------------------------------------------------- токены */

:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-2: #334155;
  --muted: #5b6477;
  --placeholder: #8a94a6;

  --success: #16a34a;
  --success-700: #15803d;
  --success-50: #f0fdf4;
  --warning: #d97706;
  --warning-700: #b45309;
  --warning-50: #fffbeb;
  --danger: #dc2626;
  --danger-700: #b91c1c;
  --danger-50: #fef2f2;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 16px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .14);
  --ring: 0 0 0 3px rgba(37, 99, 235, .3);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --container: 1200px;
  --gutter: 24px;
  --check-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
  --check-green: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2316a34a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
  --check-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232563eb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- база */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip; /* страховка от горизонтальной прокрутки на телефонах (sticky при этом работает) */
}

main {
  flex: 1 0 auto;
  min-width: 0;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .5em;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--text);
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p {
  margin: 0 0 1em;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
}

img, video {
  height: auto;
}

hr {
  height: 0;
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

ul, ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: .92em;
}

code {
  padding: .1em .35em;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
}

small {
  font-size: 13px;
}

strong, b {
  font-weight: 650;
}

table {
  border-collapse: collapse;
}

::selection {
  background: var(--primary-100);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- утилиты */

.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; }
.mono {
  font-family: var(--font-mono);
  font-size: .92em;
  overflow-wrap: anywhere;
}
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success-700); }
.text-warning { color: var(--warning-700); }
.text-danger { color: var(--danger-700); }
.lead { font-size: 17px; color: var(--text-2); }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- раскладка */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.page {
  padding-top: 28px;
  padding-bottom: 56px;
}

/* Вертикальный ритм: блоки верхнего уровня страницы отделены друг от друга */
.page > * + * {
  margin-top: 20px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 24px;
}

.page-header > :first-child {
  min-width: 0;
}

.page-header h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.page-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid > *,
.grid-2 > *,
.grid-3 > *,
.grid-4 > * {
  min-width: 0;
}

.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 16px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.spacer {
  flex: 1 1 auto;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  vertical-align: middle;
}

/* ---------------------------------------------------------------- шапка и подвал */

.topbar {
  position: relative;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.logo:hover {
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .35);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav a:not(.btn) {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 550;
  white-space: nowrap;
}

.topnav a:not(.btn):hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.topnav a.active,
.topnav a.active:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}

.topnav .btn,
.topnav .inline-form {
  margin-left: 6px;
}

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px;
}

.footer-inner a {
  color: var(--muted);
}

.footer-inner a:hover {
  color: var(--text);
}

/* ---------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease,
    transform .05s ease;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn:disabled,
.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .25);
}

.btn-primary:hover {
  border-color: var(--primary-600);
  background: var(--primary-600);
  color: #fff;
}

.btn-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: #94a3b8;
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  border-color: var(--danger-700);
  background: var(--danger-700);
  color: #fff;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 13.5px;
}

.btn-sm svg {
  width: 16px;
  height: 16px;
}

.btn-lg {
  min-height: 50px;
  padding: 13px 24px;
  border-radius: 10px;
  font-size: 16.5px;
}

.btn-block {
  display: flex;
  width: 100%;
  white-space: normal;
}

/* ---------------------------------------------------------------- бейджи */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1e40af; }

/* ---------------------------------------------------------------- флеш-сообщения и плашки */

.flash-wrap {
  margin-top: 16px;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}

.flash::before {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.flash-ok {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #14532d;
}

.flash-ok::before {
  content: "";
  background: var(--success) var(--check-white) center / 12px no-repeat;
}

.flash-error {
  border-color: #fecaca;
  background: var(--danger-50);
  color: #7f1d1d;
}

.flash-error::before {
  content: "!";
  background: var(--danger);
}

.alert {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  line-height: 1.5;
}

.alert:last-child,
.alert > :last-child {
  margin-bottom: 0;
}

.alert a:not(.btn) {
  color: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.alert .btn {
  margin-top: 4px;
}

.alert-info {
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: #1e3a8a;
}

.alert-warn {
  border-color: #fde68a;
  background: var(--warning-50);
  color: #78350f;
}

.alert-danger {
  border-color: #fecaca;
  background: var(--danger-50);
  color: #7f1d1d;
}

/* ---------------------------------------------------------------- карточки */

.card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow-wrap: break-word;
}

.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.card > h2 { font-size: 18px; }
.card > h3 { font-size: 16px; }

/* Карточки подряд вне сеток — с отступом; в сетках отступ задаёт gap */
.card + .card {
  margin-top: 20px;
}

:is(.grid, .grid-2, .grid-3, .grid-4, .stack, .row, .kpis, .pricing, .template-cards, .builder, .builder-main) > .card + .card {
  margin-top: 0;
}

.card-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.3;
}

.card-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.card-title + :not(.card-hint) {
  margin-top: 12px;
}

/* ---------------------------------------------------------------- формы */

label {
  font-weight: 500;
}

.field {
  min-width: 0;
  margin-bottom: 18px;
}

.field > label:not(.field-inline),
.field > .label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.field label .muted,
.field label small {
  font-weight: 400;
}

:where(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"],
  input[type="url"], input[type="search"], input[type="date"], input[type="time"], input[type="datetime-local"],
  input[type="month"], input:not([type]), select, textarea) {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}

:where(input, select, textarea):hover {
  border-color: #94a3b8;
}

:where(input, select, textarea):focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

:where(input, textarea)::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

:where(input, select, textarea):disabled {
  background-color: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

:where(input, textarea)[readonly] {
  background-color: var(--surface-3);
  color: var(--text-2);
}

select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 18px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

select[multiple],
select[size] {
  min-height: 120px;
  padding-right: 12px;
  background-image: none;
}

textarea {
  min-height: 96px;
  line-height: 1.5;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="color"] {
  flex: none;
  width: 52px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

input[type="file"] {
  max-width: 100%;
  font: inherit;
  font-size: 14px;
}

fieldset {
  min-width: 0;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

legend {
  padding: 0 6px;
  font-weight: 650;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.error {
  margin: 6px 0 0;
  color: var(--danger-700);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.45;
}

.error:empty {
  display: none;
}

.field.has-error :where(input, select, textarea),
.field.invalid :where(input, select, textarea),
:where(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--danger);
}

.field.has-error :where(input, select, textarea):focus,
.field.invalid :where(input, select, textarea):focus,
:where(input, select, textarea)[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .2);
}

/* Отдельным правилом: старый браузер без :has() не потеряет остальные стили */
.field:has(.error:not(:empty)) :where(input, select, textarea) {
  border-color: var(--danger);
}

.field-inline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
}

.field-inline > input[type="checkbox"],
.field-inline > input[type="radio"] {
  margin-top: 1px;
}

.field-inline label {
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}

.field-inline .hint {
  margin-top: 2px;
}

.field > .field-inline:last-child {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Поля внутри строк и компактных форм не растягиваются на всю ширину */
.row > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea) {
  flex: 1 1 160px;
  width: auto;
}

.row > .field {
  flex: 1 1 180px;
  margin-bottom: 0;
}

.row > .field-inline {
  margin-bottom: 0;
}

.inline-form :where(input:not([type="checkbox"]):not([type="radio"]), select) {
  width: auto;
  min-width: 0;
}

.inline-form select {
  min-height: 32px;
  padding: 4px 30px 4px 10px;
  background-position: right 6px center;
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- таблицы */

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.table th,
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
}

.table thead th {
  text-transform: uppercase;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table tbody tr:hover > td {
  background: var(--surface-3);
}

.table .num,
.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table td a:not(.btn) {
  font-weight: 550;
}

.table .actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.table tr.is-current > td,
.table tr.is-current:hover > td {
  background: var(--primary-50);
}

/* ---------------------------------------------------------------- KPI */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 16px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-value {
  color: var(--text);
  font-size: 28px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kpi-label {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.35;
}

.kpi-hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

/* ---------------------------------------------------------------- вкладки и шапка ассистента */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: inset 0 -1px 0 var(--border);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
}

.tab.active,
.tab[aria-selected="true"],
.tab[aria-current="page"] {
  border-bottom-color: var(--primary);
  color: var(--primary-700);
}

.bot-header {
  margin-bottom: 16px;
}

.bot-header > a {
  display: inline-block;
  margin-bottom: 6px;
}

.bot-header-title {
  gap: 12px;
}

.bot-header-title h1 {
  margin: 0;
  font-size: 26px;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- пустое состояние */

.empty {
  padding: 56px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty > :last-child {
  margin-bottom: 0;
}

.empty h1,
.empty h2,
.empty h3 {
  margin-bottom: 8px;
}

.empty p {
  max-width: 560px;
  margin-inline: auto;
  color: var(--muted);
}

.empty .btn {
  margin-top: 8px;
}

.empty .empty-code {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
}

/* ---------------------------------------------------------------- код и копирование */

.code-block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.code-block code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

textarea.code-block {
  min-height: 0;
  resize: vertical;
}

.copy-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.copy-row > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.copy-row > .btn {
  flex: none;
}

/* ---------------------------------------------------------------- прогресс */

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.progress-bar {
  width: 0;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .4s ease;
}

.progress-success .progress-bar { background: var(--success); }
.progress-warn .progress-bar { background: var(--warning); }
.progress-danger .progress-bar { background: var(--danger); }
.progress-lg { height: 12px; }

/* ---------------------------------------------------------------- график (вертикальные столбики) */

/*
  <div class="chart-bars">
    <div title="12.11: 8 диалогов, 2 заявки">          ← колонка дня (или сразу .bar)
      <div class="bar" style="height: 80%"></div>
      <div class="bar bar-secondary" style="height: 20%"></div>
      <span class="bar-label">12.11</span>
    </div>
  </div>
  Высота столбика — в процентах от высоты графика. .bar-secondary внутри .bar — его часть.
*/
.chart-bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 4px;
  height: 220px;
  margin-bottom: 30px;
  padding: 0 2px;
  border-bottom: 1px solid var(--border-strong);
  background-image: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px),
    var(--border) calc(25% - 1px), var(--border) 25%);
  background-clip: content-box;
}

.chart-bars > * {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
}

.bar,
.bar-secondary {
  position: relative;
  flex: 1 1 0;
  min-width: 2px;
  max-width: 44px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--primary);
  transition: opacity .15s ease;
}

.chart-bars > .bar {
  max-width: 56px;
}

.bar-secondary {
  background: #93c5fd;
}

.bar > .bar-secondary {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-width: none;
  border-radius: inherit;
}

.bar:hover,
.chart-bars > :hover .bar {
  opacity: .85;
}

.bar-label {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Много столбиков — подписываем не каждый, чтобы подписи не налезали друг на друга */
.chart-bars > :first-child:nth-last-child(n+15) ~ * .bar-label {
  visibility: hidden;
}

.chart-bars > :first-child:nth-last-child(n+15) ~ :nth-child(7n+1) .bar-label {
  visibility: visible;
}

.chart-bars > :first-child:nth-last-child(n+46) ~ :nth-child(7n+1) .bar-label {
  visibility: hidden;
}

.chart-bars > :first-child:nth-last-child(n+46) ~ :nth-child(14n+1) .bar-label {
  visibility: visible;
}

.chart-bars:has(> :nth-child(31)) {
  gap: 1px;
}

/* ---------------------------------------------------------------- чат (переписка) */

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.msg {
  position: relative;
  max-width: min(78%, 560px);
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}

.msg-user {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: var(--primary);
  color: #fff;
}

.msg-assistant {
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

.msg-user a {
  color: #fff;
  text-decoration: underline;
}

/* Текст сообщения с сохранением переносов строк: <div class="msg-text">{{ text }}</div> */
.msg-text {
  white-space: pre-line;
}

.msg-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
}

.msg-user .msg-meta {
  color: rgba(255, 255, 255, .82);
  text-align: right;
}

.chat > .msg-meta {
  align-self: center;
  margin: 0;
}

.msg-user + .msg-meta {
  align-self: flex-end;
  margin-top: -6px;
}

.msg-assistant + .msg-meta {
  align-self: flex-start;
  margin-top: -6px;
}

/* ---------------------------------------------------------------- редактор списков (услуги, вопросы, поля) */

.list-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-editor > .btn {
  align-self: flex-start;
}

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.list-row:hover {
  border-color: var(--border-strong);
}

.list-row:focus-within {
  border-color: var(--primary-200);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.list-row > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, .field) {
  flex: 1 1 180px;
  width: auto;
  min-width: 0;
  margin: 0;
}

.list-row > textarea {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
}

.list-row > .field-inline {
  flex: none;
  align-self: center;
  margin: 0;
}

.list-row > label:not(.field-inline) {
  flex: 1 1 180px;
  min-width: 0;
  margin: 0;
}

.list-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-left: auto;
}

/* ---------------------------------------------------------------- карточки шаблонов */

.template-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 16px;
}

.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.template-card:hover {
  border-color: #93c5fd;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.template-card.selected,
.template-card.active,
.template-card[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.template-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.template-card:has(input:focus-visible) {
  box-shadow: var(--ring);
}

.template-card input[type="radio"],
.template-card input[type="checkbox"] {
  position: absolute;
  top: 16px;
  right: 16px;
}

.template-icon {
  font-size: 28px;
  line-height: 1.1;
}

.template-card strong,
.template-card h3,
.template-title {
  margin: 0;
  padding-right: 26px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
}

.template-card p,
.template-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- тарифы */

.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  align-items: stretch;
  gap: 20px;
}

.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 28px 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.price-card.featured {
  border: 2px solid var(--primary);
  box-shadow: 0 18px 44px rgba(37, 99, 235, .16);
}

.price-badge {
  position: absolute;
  top: -13px;
  left: 22px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}

.price-card h3,
.price-title {
  margin: 0;
  font-size: 19px;
}

.price-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.price-value,
.price-card .price {
  color: var(--text);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.price-period {
  margin-left: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.price-card ul,
.price-features {
  display: grid;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 0;
  list-style: none;
}

.price-card li {
  position: relative;
  margin: 0;
  padding-left: 26px;
  font-size: 14.5px;
}

.price-card li::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #dcfce7 var(--check-green) center / 11px no-repeat;
}

.price-card .btn {
  margin-top: auto;
}

/* ---------------------------------------------------------------- чек-лист готовности */

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0;
  padding: 12px 0 12px 36px;
  border-bottom: 1px solid var(--border);
}

.check-item:last-child {
  border-bottom: 0;
}

.check-item::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
}

.check-item.done::before {
  border-color: var(--success);
  background: var(--success) var(--check-white) center / 12px no-repeat;
}

.check-item > a:last-child,
.check-item > .btn:last-child,
.check-item > .badge:last-child {
  margin-left: auto;
}

a.check-item {
  color: var(--text);
}

a.check-item:hover {
  background: var(--surface-3);
  text-decoration: none;
}

/* ---------------------------------------------------------------- конструктор: шаги | форма | превью */

.builder {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 380px;
  align-items: start;
  gap: 24px;
}

.builder-nav {
  position: sticky;
  top: 16px;
  min-width: 0;
}

.builder-main {
  min-width: 0;
}

.builder-main > * + * {
  margin-top: 16px;
}

.builder-preview {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.builder-preview iframe {
  display: block;
  width: 100%;
  height: 640px;
  height: min(640px, calc(100vh - 120px));
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1.3;
  text-decoration: none;
  counter-increment: step;
}

.step::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

.step:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

/* Шаг-<li> со ссылкой внутри: кликабельна вся строка */
.step > a {
  flex: 1;
  min-width: 0;
  color: inherit;
}

.step > a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.step > a:hover {
  text-decoration: none;
}

.step.done::before {
  content: "";
  border-color: var(--success);
  background: var(--success) var(--check-white) center / 12px no-repeat;
}

.step.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 650;
}

.step.active::before {
  border-color: var(--primary);
  background-color: var(--primary);
  color: #fff;
}

.step.active.done::before {
  background: var(--primary) var(--check-white) center / 12px no-repeat;
}

/* ---------------------------------------------------------------- пагинация, опасная зона, переключатели */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.pagination a,
.pagination span,
.pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
}

.pagination a:hover,
.pagination button:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.pagination .active,
.pagination .current,
.pagination [aria-current="page"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.pagination .disabled,
.pagination [aria-disabled="true"] {
  opacity: .5;
  pointer-events: none;
}

.danger-zone {
  margin-top: 32px;
  padding: 20px 24px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: #fffafa;
}

.danger-zone h2,
.danger-zone h3,
.danger-zone .card-title {
  margin-top: 0;
  color: var(--danger-700);
}

.danger-zone > :last-child {
  margin-bottom: 0;
}

.pill-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  vertical-align: middle;
}

.pill-group::-webkit-scrollbar {
  display: none;
}

.pill-group > a,
.pill-group > button,
.pill-group > label,
.pill-group > span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 32px;
  margin: 0;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
}

.pill-group > :hover {
  background: rgba(255, 255, 255, .7);
  color: var(--text);
  text-decoration: none;
}

.pill-group > .active,
.pill-group > [aria-current="page"],
.pill-group > [aria-pressed="true"],
.pill-group > [aria-selected="true"] {
  background: var(--surface);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

.pill-group > label:has(input:checked) {
  background: var(--surface);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

.pill-group > label:has(input:focus-visible) {
  box-shadow: var(--ring);
}

.pill-group input[type="radio"],
.pill-group input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- вход и регистрация */

.auth-main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  padding: 48px 16px 64px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 6px;
  font-size: 25px;
}

.auth-sub {
  margin-bottom: 20px;
  color: var(--muted);
}

.auth-card .alert {
  margin-bottom: 18px;
}

.auth-form .btn-block {
  margin-top: 6px;
}

.auth-perks {
  display: grid;
  gap: 6px;
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  list-style: none;
  font-size: 14px;
}

.auth-perks li {
  position: relative;
  margin: 0;
  padding-left: 24px;
}

.auth-perks li::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 16px;
  height: 16px;
  background: var(--check-blue) center / 14px no-repeat;
}

.auth-consent {
  margin-bottom: 0;
  font-size: 14px;
}

.auth-foot {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.auth-foot.small {
  margin-top: 8px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- тариф и аккаунт */

.plan-card-head {
  justify-content: space-between;
  margin-bottom: 4px;
}

.plan-card-head .card-title {
  margin: 0;
}

.plan-term {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.plan-term-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.plan-term-note {
  color: var(--muted);
  font-size: 13.5px;
}

.usage + .usage {
  margin-top: 18px;
}

.usage-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 8px;
  font-size: 14.5px;
}

.usage .hint {
  margin-top: 6px;
}

.billing-contact {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.pay-steps {
  margin: 0;
  padding-left: 1.3em;
  color: var(--text-2);
  font-size: 14.5px;
}

.pay-steps li + li {
  margin-top: 8px;
}

/* ---------------------------------------------------------------- длинные тексты (политика ПДн) */

.prose-card {
  max-width: 900px;
  margin-inline: auto;
  padding: 40px 48px;
}

.prose {
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.7;
}

.prose h1 {
  margin: 8px 0 4px;
  font-size: 30px;
}

.prose h2 {
  margin: 2em 0 .6em;
  font-size: 20px;
}

.prose h3 {
  margin: 1.5em 0 .5em;
  font-size: 17px;
}

.prose li + li {
  margin-top: .35em;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose .alert {
  margin-bottom: 24px;
  font-size: 15px;
}

mark,
.fill {
  padding: 0 .25em;
  border-radius: 4px;
  background: #fef08a;
  color: #713f12;
}

/* ==========================================================================
   Лендинг
   ========================================================================== */

.landing {
  width: 100%;
}

.lp-section {
  padding: 84px 0;
}

.lp-alt {
  border-block: 1px solid var(--border);
  background: var(--surface);
}

.lp-head {
  max-width: 740px;
  margin: 0 auto 44px;
  text-align: center;
}

.lp-head h2 {
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1.18;
  letter-spacing: -.025em;
}

.lp-head p {
  margin: 0;
  color: var(--muted);
  font-size: 17.5px;
}

.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px 12px;
  border: 1px solid var(--primary-200);
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 13.5px;
  font-weight: 650;
}

.lp-accent {
  color: var(--primary);
}

.lp-btn-white {
  border-color: #fff;
  background: #fff;
  color: var(--primary-700);
}

.lp-btn-white:hover {
  border-color: var(--primary-50);
  background: var(--primary-50);
  color: var(--primary-700);
}

/* первый экран */

.lp-hero {
  position: relative;
  padding: 64px 0 96px;
  overflow: hidden;
  background:
    radial-gradient(1100px 520px at 88% -12%, #dbeafe 0%, rgba(219, 234, 254, 0) 62%),
    radial-gradient(900px 420px at -8% 112%, #ede9fe 0%, rgba(237, 233, 254, 0) 58%),
    var(--bg);
}

.lp-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: 56px;
}

.lp-hero h1 {
  margin-bottom: 18px;
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: -.03em;
}

.lp-lead {
  max-width: 600px;
  margin-bottom: 28px;
  color: var(--text-2);
  font-size: 18.5px;
  line-height: 1.6;
}

.lp-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
}

.lp-checks {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--text-2);
  list-style: none;
}

.lp-checks li {
  position: relative;
  margin: 0;
  padding-left: 30px;
}

.lp-checks li::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dcfce7 var(--check-green) center / 12px no-repeat;
}

.lp-try {
  margin: 18px 0 0;
  color: var(--muted);
}

/* макет чата */

.lp-mock {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 440px;
  margin: 0;
}

.lp-mock-stage {
  position: relative;
  padding-bottom: 28px;
}

.lp-mock-window {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.lp-mock-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
}

.lp-mock-head strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.lp-mock-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  font-weight: 750;
}

.lp-mock-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dbeafe;
  font-size: 12.5px;
}

.lp-mock-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, .3);
}

.lp-mock .chat {
  gap: 9px;
  padding: 16px 14px 64px; /* снизу место под карточку уведомления */
  border: 0;
  border-radius: 0;
}

.lp-mock .msg {
  max-width: 86%;
  font-size: 14px;
}

.lp-mock-day {
  align-self: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.lp-chips {
  display: flex;
  flex-wrap: wrap;
  align-self: flex-start;
  gap: 6px;
}

.lp-chips span {
  padding: 4px 12px;
  border: 1px solid var(--primary-200);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary-700);
  font-size: 13px;
  font-weight: 650;
}

.lp-chips .is-picked {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.lp-mock-notify {
  position: absolute;
  bottom: 0;
  left: -44px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 300px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.4;
}

.lp-mock-notify strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13.5px;
}

.lp-mock-notify span {
  display: block;
  color: var(--text-2);
}

.lp-mock-notify .lp-mock-notify-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0369a1;
}

.lp-mock-notify-icon svg {
  width: 18px;
  height: 18px;
}

.lp-mock-caption {
  margin-top: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* проблема */

.lp-problems {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.lp-problem {
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lp-problem h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.lp-problem p {
  margin: 0;
  color: var(--muted);
}

.lp-problem-icon,
.lp-feature-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 12px;
}

.lp-problem-icon {
  background: var(--danger-50);
  color: var(--danger);
}

.lp-problem-icon svg,
.lp-feature-icon svg {
  width: 22px;
  height: 22px;
}

/* калькулятор */

.lp-calc {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lp-calc-form {
  padding: 40px;
}

.lp-calc-form h2 {
  margin-bottom: 8px;
  font-size: 30px;
  letter-spacing: -.02em;
}

.lp-calc-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin-top: 24px;
}

.lp-calc-form.is-live .lp-calc-submit {
  display: none;
}

.lp-calc-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 40px;
  background: linear-gradient(160deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #fff;
}

.lp-calc-kicker {
  margin: 0;
  color: #bfdbfe;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lp-calc-sum {
  margin: 0;
  font-size: 46px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}

.lp-calc-sum-note {
  display: block;
  margin-top: 8px;
  color: #dbeafe;
  font-size: 17px;
  font-weight: 550;
  letter-spacing: 0;
}

.lp-calc-facts {
  margin: 0;
}

.lp-calc-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .2);
}

.lp-calc-facts dt {
  color: #dbeafe;
}

.lp-calc-facts dd {
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}

.lp-calc-compare {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  line-height: 1.5;
}

.lp-calc-result .btn {
  margin-top: auto;
}

.lp-calc-note {
  margin: 0;
  color: #c7d7fe;
  font-size: 12.5px;
  line-height: 1.5;
}

/* как это работает */

.lp-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lp-step {
  position: relative;
  margin: 0;
  padding: 28px 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lp-step-num {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.lp-step h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.lp-step p {
  margin: 0;
  color: var(--muted);
}

.lp-step-time {
  display: inline-block;
  margin-top: 16px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 13px;
  font-weight: 650;
}

.lp-steps-result {
  max-width: 640px;
  margin: 32px auto 0;
  color: var(--text-2);
  text-align: center;
  font-size: 16.5px;
  font-weight: 550;
}

/* возможности */

.lp-features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.lp-feature {
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.lp-feature-icon {
  background: var(--primary-50);
  color: var(--primary);
}

.lp-feature h3 {
  margin-bottom: 6px;
  font-size: 16.5px;
}

.lp-feature p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* шаблоны и тарифы */

.lp-templates {
  max-width: 1040px;
  margin-inline: auto;
}

.lp-templates .template-card {
  padding: 22px;
}

.lp-pricing {
  max-width: 1040px;
  margin-inline: auto;
}

.lp-pricing-note {
  margin: 28px auto 0;
  text-align: center;
  font-size: 14px;
}

/* FAQ */

.lp-faq {
  max-width: 820px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.lp-faq details {
  border-bottom: 1px solid var(--border);
}

.lp-faq summary {
  position: relative;
  display: block;
  padding: 20px 48px 20px 4px;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}

.lp-faq summary::-webkit-details-marker {
  display: none;
}

.lp-faq summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--primary-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 6v12M6 12h12'/%3E%3C/svg%3E") center / 14px no-repeat;
  transition: transform .2s ease;
}

.lp-faq details[open] > summary::after {
  transform: rotate(45deg);
}

.lp-faq summary:hover {
  color: var(--primary-700);
}

.lp-faq summary:focus-visible {
  border-radius: 6px;
}

.lp-faq-body {
  padding: 0 4px 20px;
  color: var(--text-2);
}

.lp-faq-body p:last-child {
  margin-bottom: 0;
}

/* финальный призыв */

.lp-cta {
  padding: 76px 0;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #4f46e5 100%);
  color: #fff;
  text-align: center;
}

.lp-cta-inner {
  max-width: 760px;
}

.lp-cta h2 {
  margin-bottom: 12px;
  color: #fff;
  font-size: 36px;
  letter-spacing: -.02em;
}

.lp-cta p {
  margin-bottom: 28px;
  color: #dbeafe;
  font-size: 18px;
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media (max-width: 1180px) {
  .builder {
    grid-template-columns: 190px minmax(0, 1fr) 330px;
    gap: 18px;
  }

  .lp-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lp-mock-notify {
    left: -16px;
  }
}

@media (max-width: 960px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .builder {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .builder-preview {
    position: static;
    grid-column: 1 / -1;
  }

  .builder-preview iframe {
    height: 600px;
  }

  .prose-card {
    padding: 32px;
  }

  .lp-section {
    padding: 64px 0;
  }

  .lp-hero {
    padding: 48px 0 64px;
  }

  .lp-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .lp-hero h1 {
    font-size: 40px;
  }

  .lp-mock-stage {
    padding-bottom: 0;
  }

  .lp-mock-notify {
    position: relative;
    bottom: auto;
    left: auto;
    max-width: none;
    margin: -44px 16px 0;
  }

  .lp-problems {
    grid-template-columns: minmax(0, 1fr);
  }

  .lp-calc {
    grid-template-columns: minmax(0, 1fr);
  }

  .lp-head h2,
  .lp-cta h2 {
    font-size: 30px;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  h1 { font-size: 24px; }
  h2 { font-size: 20px; }

  /* 16px в полях ввода — iOS не увеличивает страницу при фокусе */
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  .page {
    padding-top: 20px;
    padding-bottom: 40px;
  }

  .page-header {
    align-items: flex-start;
  }

  .page-header .actions {
    width: 100%;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    gap: 16px;
  }

  .card {
    padding: 18px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 6px 12px;
    min-height: 56px;
    padding-block: 10px;
  }

  .topnav {
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 2px;
    width: calc(100% + 2 * var(--gutter));
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topnav::-webkit-scrollbar {
    display: none;
  }

  .topnav a:not(.btn) {
    padding: 6px 10px;
  }

  .topnav .btn,
  .topnav .inline-form {
    margin-left: auto;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .bot-header-title h1 {
    font-size: 22px;
  }

  /* таблица без .table-wrap всё равно прокручивается сама, а не страница */
  :not(.table-wrap) > .table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .table th,
  .table td {
    padding: 10px 12px;
  }

  .copy-row {
    flex-direction: column;
  }

  .form-actions .btn {
    flex: 1 1 auto;
  }

  .list-row > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, .field) {
    flex-basis: 100%;
  }

  .list-row-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .msg {
    max-width: 88%;
  }

  .chart-bars {
    height: 180px;
  }

  .chart-bars > :first-child:nth-last-child(n+9):nth-last-child(-n+14) ~ * .bar-label {
    visibility: hidden;
  }

  .chart-bars > :first-child:nth-last-child(n+9):nth-last-child(-n+14) ~ :nth-child(2n+1) .bar-label {
    visibility: visible;
  }

  .builder {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .builder-nav {
    position: static;
    margin-inline: calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .builder-nav::-webkit-scrollbar {
    display: none;
  }

  .builder-nav .steps {
    flex-direction: row;
    gap: 6px;
    width: max-content;
  }

  .builder-nav .step {
    flex: none;
    padding: 7px 12px 7px 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
  }

  .builder-nav .step.active {
    border-color: var(--primary-200);
    background: var(--primary-50);
  }

  .builder-preview iframe {
    height: 560px;
    min-height: 420px;
  }

  .danger-zone {
    padding: 18px;
  }

  .auth-main {
    padding: 24px 12px 40px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .prose-card {
    padding: 22px 18px;
  }

  .prose {
    font-size: 15px;
  }

  .prose h1 {
    font-size: 24px;
  }

  .lp-section {
    padding: 52px 0;
  }

  .lp-hero {
    padding: 32px 0 52px;
  }

  .lp-hero h1 {
    font-size: 31px;
  }

  .lp-lead {
    font-size: 16.5px;
  }

  .lp-hero-actions .btn {
    width: 100%;
    white-space: normal;
  }

  .lp-head {
    margin-bottom: 32px;
  }

  .lp-head h2,
  .lp-cta h2 {
    font-size: 26px;
  }

  .lp-head p {
    font-size: 16px;
  }

  .lp-mock .msg {
    max-width: 92%;
  }

  .lp-mock-notify {
    margin: -44px 8px 0;
  }

  .lp-calc-form,
  .lp-calc-result {
    padding: 24px 20px;
  }

  .lp-calc-form h2 {
    font-size: 24px;
  }

  .lp-calc-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .lp-calc-sum {
    font-size: 36px;
  }

  .lp-calc-facts div {
    flex-direction: column;
    gap: 2px;
  }

  .lp-steps,
  .lp-features {
    grid-template-columns: minmax(0, 1fr);
  }

  .lp-faq summary {
    font-size: 16px;
  }

  .lp-cta {
    padding: 56px 0;
  }

  .lp-cta .btn {
    width: 100%;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .footer,
  .tabs,
  .builder-nav,
  .builder-preview,
  .form-actions,
  .lp-mock-notify {
    display: none !important;
  }

  .card,
  .kpi,
  .table-wrap {
    box-shadow: none;
  }
}
