:root {
  --bg: #f3f4f6;
  --card: #fff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --ok: #059669;
  --soon: #9ca3af;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); overflow-x: hidden; max-width: 100%; }
body.cabinet-active #auth-screen { display: none !important; }
body.cabinet-active #app-shell { display: grid !important; }
body:not(.cabinet-active) #app-shell { display: none !important; }
#auth-screen[hidden], #app-shell[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; box-shadow: 0 10px 40px rgba(0,0,0,.06); }
.auth-logo { font-weight: 700; font-size: 1.25rem; }
.auth-logo.logo-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}
.auth-logo.logo-brand span {
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.auth-sub { color: var(--muted); margin: .25rem 0 1.25rem; }
.auth-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.auth-tabs button { flex: 1; padding: .55rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.auth-tabs button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.auth-card input { width: 100%; margin-bottom: .75rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; }
.btn-primary { width: 100%; padding: .75rem; border: none; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.btn-secondary { padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.btn-primary.small, .btn-secondary.small { width: auto; font-size: .875rem; }
.error { color: #dc2626; margin-top: .5rem; }

.app-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  max-width: min(360px, calc(100vw - 2rem));
  padding: .75rem 1rem;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.app-toast.show { opacity: 1; transform: translateY(0); }
.app-toast--success { background: #065f46; }
.app-toast--error { background: #991b1b; }
.auth-foot { margin-top: 1rem; font-size: .875rem; }
.auth-verify-hint { font-size: .9rem; color: var(--muted); margin: 0 0 .75rem; line-height: 1.4; }

.otp-inputs { display: flex; gap: .5rem; justify-content: center; margin-bottom: 1rem; }
.otp-digit {
  width: 2.75rem; height: 3rem; text-align: center; font-size: 1.25rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 10px;
}
.onboard-progress { margin-bottom: 1rem; }
.onboard-progress span { font-size: .8rem; color: var(--muted); }
.onboard-bar { height: 4px; background: var(--line); border-radius: 999px; margin-top: .35rem; overflow: hidden; }
.onboard-bar div { height: 100%; background: var(--accent); transition: width .25s; }
.onboard-title { font-size: 1.35rem; font-weight: 700; text-align: center; margin: 0 0 .35rem; letter-spacing: -0.02em; }
.onboard-lead { font-size: .9rem; color: var(--muted); text-align: center; margin: 0 0 1.25rem; line-height: 1.45; }
.onboard-q { font-size: .95rem; font-weight: 600; margin: 0 0 .75rem; text-align: center; }
.onboard-step input[type="url"], .onboard-step input[type="text"]:not(.onboard-custom) { width: 100%; margin-bottom: 0; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.onboard-custom { width: 100%; margin-top: .75rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.onboard-picks { display: grid; gap: .5rem; }
.onboard-picks--compact { grid-template-columns: 1fr; }
.onboard-pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  width: 100%; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; text-align: left; font: inherit; color: var(--text);
  transition: border-color .15s, background .15s;
}
.onboard-pick:hover { border-color: #cbd5e1; background: #fafafa; }
.onboard-pick.selected { border-color: var(--accent); background: var(--accent-soft); }
.onboard-pick-title { font-weight: 600; font-size: .925rem; }
.onboard-pick-sub { font-size: .8rem; color: var(--muted); }
.onboard-pills { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; }
.onboard-pill {
  padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; cursor: pointer; font: inherit; font-size: .875rem; color: var(--text);
  transition: border-color .15s, background .15s;
}
.onboard-pill:hover { border-color: #cbd5e1; }
.onboard-pill.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.onboard-nav { display: flex; gap: .5rem; margin-top: 1.25rem; }
.auth-card--onboard { max-width: 520px; }
.auth-card--onboard .auth-logo,
.auth-card--onboard .auth-sub,
.auth-card--onboard .auth-tabs,
.auth-card--onboard #login-form,
.auth-card--onboard #register-form,
.auth-card--onboard #yandex-auth-block,
.auth-card--onboard #yandex-login-btn { display: none !important; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0 .85rem;
  color: var(--muted);
  font-size: .8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-yandex {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  padding: .75rem 1rem;
  border-radius: 10px;
  border: 1px solid #fc3f1d;
  background: #fff;
  color: #111;
  font-weight: 600;
  text-decoration: none;
  font-size: .95rem;
  transition: background .2s, box-shadow .2s;
}
.btn-yandex:hover {
  background: #fff5f2;
  box-shadow: 0 0 0 2px rgba(252, 63, 29, 0.12);
}
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .82rem;
  color: var(--muted);
  margin: .25rem 0 .75rem;
  line-height: 1.4;
}
.auth-consent input { width: auto; margin-top: .2rem; }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.sidebar-logo { font-weight: 700; font-size: 1.1rem; padding: .25rem .5rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar-nav a { padding: .65rem .75rem; border-radius: 10px; color: var(--text); }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-note { margin-top: auto; font-size: .75rem; color: var(--muted); background: #f9fafb; border: 1px dashed var(--line); border-radius: 10px; padding: .75rem; display: flex; flex-direction: column; gap: .35rem; }
.sidebar-logout { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .55rem; cursor: pointer; }
.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding: .85rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-left { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip { font-size: .8rem; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout-top {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: .45rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.btn-logout-top:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 2px;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(15, 23, 42, 0.45);
}
.sidebar-backdrop.is-open { display: block; }
.page-content { padding: 1.5rem; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
.metric strong { display: block; font-size: 1.75rem; }
.metric span { color: var(--muted); font-size: .875rem; }

.welcome-ab-block { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.welcome-ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: .75rem 0 1rem; }
.welcome-ab-grid label { display: block; font-size: .8rem; color: var(--muted); }
.welcome-ab-grid textarea { width: 100%; margin-top: .25rem; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.ab-stats-table { width: 100%; border-collapse: collapse; font-size: .875rem; margin: .5rem 0; }
.ab-stats-table th, .ab-stats-table td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; }
.ab-stats-table th { background: rgba(0,0,0,.03); }
.welcome-ab-agent-card { margin-top: 1rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
@media (max-width: 720px) {
  .welcome-ab-grid { grid-template-columns: 1fr; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card h3 { margin: 0 0 .5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 360px; gap: 1rem; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 190;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, .12);
    overflow-y: auto;
  }
  .sidebar.is-open { transform: translateX(0); }
  .grid-2 { grid-template-columns: 1fr; }
  .agent-edit-grid > .preview-chat.agent-preview {
    max-width: none;
    margin: 0;
    position: static;
    height: 360px;
    max-height: 360px;
  }
}
@media (min-width: 961px) {
  .sidebar-backdrop { display: none !important; }
}

.agent-list { display: grid; gap: .75rem; }
.agent-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.agent-item-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.agent-item-actions button:disabled { opacity: .45; cursor: not-allowed; }
.badge { font-size: .75rem; padding: .2rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.soon { background: #f3f4f6; color: var(--soon); }
.badge.ok { background: #d1fae5; color: var(--ok); }
.badge.warn { background: #fef3c7; color: #b45309; }

.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: 1rem 0; }
.channel-card { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #fff; cursor: pointer; text-align: left; }
.channel-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.channel-card.disabled { opacity: .55; cursor: not-allowed; }

.form-grid label { display: block; font-size: .875rem; font-weight: 600; margin: .75rem 0 .35rem; }
.form-grid input, .form-grid textarea, .form-grid select { width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.form-grid textarea { min-height: 90px; resize: vertical; }

.agent-edit-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem;
  align-items: flex-start; margin-bottom: .75rem;
}
.agent-edit-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.agent-tabs {
  display: flex; flex-wrap: wrap; gap: .35rem;
  border-bottom: 1px solid var(--line); margin: .5rem 0 1rem; padding-bottom: .5rem;
}
.agent-tab {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: .4rem .85rem; font: inherit; font-size: .8rem; font-weight: 600;
  cursor: pointer; color: var(--muted);
}
.agent-tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.agent-tab-pane { min-height: 120px; }

.ticket-list { display: grid; gap: .65rem; }
.ticket-row {
  display: block; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; color: inherit;
}
.ticket-row:hover { border-color: var(--accent); }
.ticket-thread { display: grid; gap: .75rem; margin: 1rem 0; }
.ticket-msg { padding: .75rem 1rem; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); }
.ticket-msg.staff { background: #ecfdf5; border-color: #a7f3d0; }
.ticket-msg p { margin: .35rem 0 0; white-space: pre-wrap; }

.preview-chat { background: #fff; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-height: 280px; }
.preview-head {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.preview-head-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-reset { flex-shrink: 0; font-size: .7rem !important; padding: .3rem .55rem !important; }
.secret-status-block { margin: .5rem 0 .25rem; }
.secret-saved { font-size: .8rem; color: var(--ok); margin: .2rem 0; }
.secret-saved code { background: #ecfdf5; padding: .1rem .4rem; border-radius: 4px; font-size: .78rem; }
.secret-missing { margin: .2rem 0; }
.preview-msgs { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.agent-edit-grid { align-items: start; }
.agent-edit-grid > .preview-chat.agent-preview {
  width: 100%;
  max-width: 340px;
  height: 420px;
  max-height: min(420px, calc(100vh - 6rem));
  min-height: 0;
  margin-left: auto;
  position: sticky;
  top: 4.25rem;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.1);
}
.msg-user { align-self: flex-end; background: var(--accent-soft); padding: .55rem .8rem; border-radius: 12px 12px 4px 12px; max-width: 85%; }
.msg-bot { align-self: flex-start; background: #f3f4f6; padding: .55rem .8rem; border-radius: 12px 12px 12px 4px; max-width: 85%; }
.msg-operator { align-self: flex-start; background: #dbeafe; border: 1px solid #93c5fd; padding: .55rem .8rem; border-radius: 12px 12px 12px 4px; max-width: 85%; }
.msg-operator small, .msg-bot small { display: block; font-size: .7rem; color: var(--muted); margin-bottom: .2rem; }
.preview-input { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--line); flex-shrink: 0; }
.preview-input input { flex: 1; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }

.embed-box pre { background: #111827; color: #e5e7eb; padding: .75rem; border-radius: 10px; overflow: auto; font-size: .75rem; }
.dialog-item { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.dialog-link { display: block; padding: .85rem 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.dialog-filters { display: flex; gap: .5rem; margin-bottom: .75rem; }
.dialog-filters .active { border-color: var(--accent); color: var(--accent); }
.dialog-item small { color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

.tariff-card .price-lg { font-size: 1.75rem; font-weight: 700; margin: .5rem 0; }

.appearance-block { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fafafa; }
.appearance-block h4 { margin: 0 0 .75rem; font-size: .95rem; }
.appearance-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.appearance-row label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 500; }
.appearance-block input[type="color"] { width: 2.5rem; height: 2rem; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.appearance-block textarea { width: 100%; margin-top: .35rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; }
.preview-chat .msg-bot { background: color-mix(in srgb, var(--preview-accent, #2563eb) 15%, #f3f4f6); }
.tariff-card .price-lg small { font-size: .875rem; font-weight: 400; color: var(--muted); }
.tariff-card .btn-primary.small { margin-top: .75rem; width: auto; }

.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; margin-top: .75rem; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; height: 100%; }
.chart-fill { width: 100%; max-width: 24px; background: linear-gradient(180deg, var(--accent), #93c5fd); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bar small { font-size: .65rem; color: var(--muted); margin-top: .2rem; }

.usage-card { margin-bottom: 1rem; }
.usage-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.usage-meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.usage-meter-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }

.data-table-lite { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table-lite th, .data-table-lite td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  .page-content { padding: 1rem; }
  .topbar { padding: .75rem 1rem; }
  .topbar h1 { font-size: 1rem; }
  .user-chip { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .chart-bars { height: 90px; }
  .wizard-nav { flex-direction: column-reverse; }
  .wizard-nav .btn-primary,
  .wizard-nav .btn-secondary { width: 100%; margin-left: 0; }
  .preview-chat { min-height: 320px; }
}

.wizard-progress { margin-bottom: 1rem; }
.wizard-progress-head { font-size: .875rem; color: var(--muted); margin-bottom: .35rem; }
.wizard-step-card { margin-top: 0; }
.wizard-step-card h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.wizard-step-card > p.muted { margin: 0 0 .75rem; line-height: 1.5; }
.wizard-step-card label { display: block; font-size: .875rem; font-weight: 600; margin: .85rem 0 .4rem; }
.wizard-step-card textarea,
.wizard-step-card input:not([type="checkbox"]),
.wizard-step-card select {
  width: 100%;
  box-sizing: border-box;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  line-height: 1.45;
  background: #fff;
}
.wizard-step-card textarea {
  min-height: 220px;
  resize: vertical;
}
.wizard-editor {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: .25rem;
}
.wizard-editor-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.wizard-help {
  margin: .6rem 0 .85rem;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}
.wizard-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.wizard-help[open] summary { margin-bottom: .5rem; }
.wizard-help ol { margin: .25rem 0 .25rem 1.1rem; }
.wizard-nav {
  display: flex;
  gap: .5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.wizard-nav .btn-primary { margin-left: auto; }
.wizard-json,
#wizard-prompt,
#wizard-structure,
#wizard-desc {
  font-family: inherit;
}
.wizard-json,
#wizard-structure {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  min-height: 280px;
}
#wizard-prompt { min-height: 320px; }
.wizard-sandbox-hint {
  margin: .75rem 0 1rem;
  padding: .85rem 1rem;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  font-size: .875rem;
  line-height: 1.5;
}
.wizard-sandbox-hint p { margin: 0; }
.wizard-next-steps {
  margin: .5rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: .85rem;
}
.wizard-next-steps li { margin: .25rem 0; }
.wizard-step6-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
  min-width: 0;
}
.wizard-step6-actions { min-width: 0; }
.wizard-actions-list {
  list-style: none;
  padding: 0;
  margin: .75rem 0 0;
}
.wizard-actions-list li {
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .78rem;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.wizard-preview-chat {
  min-height: 280px;
  width: 100%;
  min-width: 0;
}
.wizard-step-card { overflow-x: hidden; max-width: 100%; }
.embed-box pre { max-width: 100%; overflow-x: auto; word-break: break-all; }
.wizard-check { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; font-weight: 500; }
.wizard-check input { width: auto; }
.wizard-cta-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.wizard-cta-alt { margin-top: .75rem; padding: .65rem 1rem; }
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.cms-hint-box { margin: .75rem 0; padding: .75rem; background: #f9fafb; border-radius: 10px; font-size: .875rem; }
.msg-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.chat-meta-pill { font-size: .7rem; padding: .15rem .45rem; border-radius: 999px; background: #eef2ff; color: #3730a3; }
.chat-meta-pill.action { background: #ecfdf5; color: #047857; }
.chat-meta-pill.source { background: #f3f4f6; color: #374151; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.guide-hero { margin-bottom: 1rem; }
.guide-hero p { color: var(--muted); margin: .35rem 0 0; }
.guide-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.guide-steps { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.guide-step { display: grid; grid-template-columns: 2rem 1fr auto; gap: .75rem; align-items: start; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.guide-step-num { width: 2rem; height: 2rem; border-radius: 999px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.guide-step h4 { margin: 0 0 .25rem; font-size: .95rem; }
.guide-step p { margin: 0; font-size: .85rem; color: var(--muted); }
.guide-step a.btn-secondary { padding: .35rem .65rem; font-size: .75rem; white-space: nowrap; }

.demo-player { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #0f172a; color: #e2e8f0; margin-top: 1rem; }
.demo-player-head { padding: .65rem 1rem; font-size: .8rem; background: rgba(255,255,255,.06); display: flex; justify-content: space-between; align-items: center; }
.demo-slides { position: relative; height: 220px; }
.demo-slide { position: absolute; inset: 0; padding: 1.25rem; opacity: 0; animation: demoFade 32s infinite; display: flex; flex-direction: column; justify-content: center; }
.demo-slide:nth-child(1) { animation-delay: 0s; }
.demo-slide:nth-child(2) { animation-delay: 4s; }
.demo-slide:nth-child(3) { animation-delay: 8s; }
.demo-slide:nth-child(4) { animation-delay: 12s; }
.demo-slide:nth-child(5) { animation-delay: 16s; }
.demo-slide:nth-child(6) { animation-delay: 20s; }
.demo-slide:nth-child(7) { animation-delay: 24s; }
.demo-slide:nth-child(8) { animation-delay: 28s; }
.demo-mock { border: 1px dashed rgba(255,255,255,.25); border-radius: 10px; padding: .75rem; margin-top: .5rem; font-size: .78rem; }
.demo-mock .hot { color: #34d399; font-weight: 600; }
@keyframes demoFade {
  0%, 2% { opacity: 0; transform: translateY(6px); }
  4%, 10.5% { opacity: 1; transform: translateY(0); }
  12.5%, 100% { opacity: 0; transform: translateY(-4px); }
}

.tour-overlay { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }
.tour-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); pointer-events: auto; }
.tour-spotlight { position: absolute; border: 2px solid var(--accent); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15,23,42,.55); pointer-events: none; transition: all .25s ease; }
.tour-popover { position: fixed; z-index: 10000; max-width: 320px; background: #fff; border-radius: 12px; padding: 1rem; box-shadow: 0 12px 40px rgba(0,0,0,.2); pointer-events: auto; }
.tour-popover h4 { margin: 0 0 .35rem; font-size: .95rem; }
.tour-popover p { margin: 0 0 .75rem; font-size: .85rem; color: var(--muted); }
.tour-popover-nav { display: flex; gap: .5rem; justify-content: flex-end; }

@media (max-width: 520px) {
  .auth-screen { padding: 0.75rem; align-items: flex-start; }
  .auth-card { padding: 1.25rem; border-radius: 12px; }
  .auth-card--onboard { max-width: none; }
  .onboard-pills { justify-content: flex-start; }
  .onboard-pill { flex: 1 1 calc(50% - 0.45rem); text-align: center; min-width: 0; }
  .onboard-nav { flex-direction: column-reverse; }
  .onboard-nav .btn-primary,
  .onboard-nav .btn-secondary { width: 100%; }
}
