:root {
    --bg: #eef2f8;
    --bg-accent: #e3ebf7;
    --card: #fff;
    --text: #111827;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc3545;
    --border: #e2e8f0;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, .12), transparent),
        linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 240px, var(--bg) 100%);
    min-height: 100vh;
}
.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.container--panel { max-width: 1180px; }
.main { padding: 28px 20px 56px; min-height: 60vh; }
.topbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 100;
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 17px; letter-spacing: -.02em; }
.subnav {
    display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
    padding: 6px; background: rgba(255,255,255,.65); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-sm);
}
.subnav a, .subnav button.linkish {
    color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 10px;
    background: transparent; border: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500;
    transition: background .15s, color .15s, box-shadow .15s;
}
.subnav a:hover, .subnav button.linkish:hover { color: var(--text); background: #fff; }
.subnav a.active, .subnav button.linkish.active {
    color: var(--primary); background: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, .12); font-weight: 600;
}
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card--narrow { max-width: 420px; margin: 40px auto; }
.card__head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.form label { display: block; margin-bottom: 12px; }
.form input, .form select { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.form--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form--inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.btn { border: none; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600; transition: transform .1s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .28); }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert--error { background: #fde8e8; color: #9b1c1c; }
.alert--success { background: #e8f8ef; color: #0f6b3a; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.stat span { display: block; font-size: 28px; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.card--quiz h3 { margin-top: 0; }
.card--locked { opacity: .85; }
.badge { display: inline-block; background: #fff7e6; color: #9a6700; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px 8px; text-align: left; }
.code-block { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.checks { display: grid; gap: 8px; margin: 12px 0; }
.check { display: flex; gap: 8px; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tabs--pill .tabs__item { display: inline-flex; align-items: center; gap: 8px; }
.tabs__item {
  padding: 10px 16px; border-radius: 999px; background: #fff;
  border: 1px solid var(--border); color: var(--muted); font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.tabs__item--active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary-dark); border-color: #bfdbfe; font-weight: 600;
}
.tabs__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.page-head { margin-bottom: 16px; }
.page-head h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.03em; font-weight: 800; }
.page-head__sub { margin: 0; color: var(--muted); max-width: 540px; font-size: 15px; line-height: 1.5; }

.integrations-page { max-width: 680px; }

.integration-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.integration-card--on {
  border-color: #93c5fd;
  box-shadow: 0 12px 40px rgba(37, 99, 235, .14);
}
.integration-card__hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 26px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef4ff 55%, #e8f0fe 100%);
  border-bottom: 1px solid var(--border);
}
.integration-card--on .integration-card__hero {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 55%, #cfe3ff 100%);
}
.integration-card__brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.integration-card__icon {
  display: grid; place-items: center;
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 16px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: .05em;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.integration-card__title { margin: 0 0 6px; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.integration-card__tag {
  display: inline-block; font-size: 12px; color: #475569;
  background: rgba(255,255,255,.85); border: 1px solid rgba(148, 163, 184, .35);
  padding: 3px 10px; border-radius: 999px;
}
.integration-card__status {
  flex-shrink: 0; font-size: 13px; font-weight: 600; color: transparent; min-height: 28px;
  padding: 4px 10px; border-radius: 999px; transition: color .15s, background .15s;
}
.integration-card__status--saving { color: #6b7280; background: #f3f4f6; }
.integration-card__status--saved { color: #0f6b3a; background: #e8f8ef; }
.integration-card__status--error { color: #9b1c1c; background: #fde8e8; max-width: 220px; text-align: right; }

.integration-card__body { padding: 4px 26px 22px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px 0; border-bottom: 1px solid var(--border);
}
.setting-row__text strong { display: block; margin-bottom: 6px; font-size: 16px; font-weight: 600; }
.setting-row__text p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; max-width: 420px; }

@media (max-width: 560px) {
  .setting-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .integration-card__hero { flex-direction: column; align-items: flex-start; }
  .integration-card__status { align-self: flex-start; }
  .page-head h1 { font-size: 26px; }
}

.integration-card__field { padding-top: 18px; transition: opacity .2s; }
.integration-card__field--disabled { opacity: .55; pointer-events: none; }
.field-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.field-key-status { font-size: 13px; color: var(--muted); }
.field-key-status--ok { color: #0f6b3a; font-weight: 600; }
.field-key-status--error { color: #9b1c1c; font-weight: 600; }
.field-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: #374151; }
.field-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.field-input-wrap {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 10px;
  background: #f9fafb; overflow: hidden;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field-input-wrap:focus-within {
  border-color: #93c5fd; background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}
.field-input {
  flex: 1; min-width: 0; border: none; background: transparent;
  padding: 12px 14px; font: inherit; color: var(--text); outline: none;
}
.field-input--mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.field-input::placeholder { color: #9ca3af; }
.field-input__action {
  display: grid; place-items: center; width: 44px; flex-shrink: 0;
  border: none; border-left: 1px solid var(--border); background: #fff;
  color: var(--muted); cursor: pointer; transition: color .15s, background .15s;
}
.field-input__action:hover:not(:disabled) { color: var(--primary); background: #f8fafc; }
.field-input__action--active { color: var(--primary); background: #eff6ff; }
.field-input__eye {
  display: block; width: 18px; height: 18px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
}
.field-input__action--active .field-input__eye {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
}

.integration-card__foot {
  padding: 12px 24px 16px; border-top: 1px solid var(--border); background: #fafbfc;
}
.integration-card__endpoint {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.integration-card__endpoint code {
  font-size: 12px; color: #4b5563; background: #fff;
  border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px;
}
.integration-card__endpoint-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; flex-shrink: 0;
}
.integration-card__endpoint-dot--ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }

.switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.switch input {
  position: absolute; opacity: 0; width: 0; height: 0; margin: 0;
  appearance: none; -webkit-appearance: none;
}
.switch__track {
  display: block; width: 52px; height: 30px; border-radius: 999px;
  background: #cbd5e1; padding: 3px; transition: background .2s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
.switch__thumb {
  display: block; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .2s cubic-bezier(.4, 0, .2, 1);
}
.switch input:checked + .switch__track { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { outline: 2px solid #93c5fd; outline-offset: 2px; }
.switch--lg .switch__track { width: 56px; height: 32px; }
.switch--lg .switch__thumb { width: 26px; height: 26px; }
.switch--lg input:checked + .switch__track .switch__thumb { transform: translateX(24px); }

.preview-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 48px 10px 16px;
  background: linear-gradient(90deg, #1e3a8a, #0d6efd);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.preview-banner__hint { opacity: .85; font-size: 13px; }
.preview-banner__close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(255,255,255,.2);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ——— Панель клиники (sidebar) ——— */
.panel-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.panel-sidebar {
  position: sticky;
  top: 76px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  box-shadow: var(--shadow-md);
}
.panel-sidebar__product {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 12px 10px;
}
.panel-sidebar__section { margin-bottom: 8px; }
.panel-sidebar__section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 12px 12px 6px;
}
.panel-sidebar__nav { display: flex; flex-direction: column; gap: 4px; }
.panel-sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s, box-shadow .15s;
}
.panel-sidebar__link:hover { background: #f1f5f9; color: var(--primary-dark); }
.panel-sidebar__link.active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .12);
}
.panel-sidebar__link--leads {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 1px solid #fed7aa;
  font-weight: 600;
}
.panel-sidebar__link--leads:hover { background: linear-gradient(135deg, #ffedd5, #fed7aa); }
.panel-sidebar__link--leads.active {
  background: linear-gradient(135deg, #ffedd5, #fdba74);
  border-color: #fb923c;
  color: #9a3412;
  box-shadow: 0 4px 14px rgba(249, 115, 22, .2);
}
.panel-sidebar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(239, 68, 68, .35);
}
.panel-sidebar__link--leads .panel-sidebar__badge { background: #ea580c; }
.panel-main { min-width: 0; }

.leads-page__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.leads-page__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-card__phone--title {
  font-size: 17px;
  font-weight: 700;
  display: block;
}
.leads-page__head h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.02em; }
.leads-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.leads-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  min-width: 120px;
}
.leads-stat strong { display: block; font-size: 24px; line-height: 1.1; }
.leads-stat span { font-size: 13px; color: var(--muted); }
.leads-stat--unread {
  border-color: #fdba74;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
}
.leads-stat--unread strong { color: #c2410c; }

.lead-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.lead-card:hover { border-color: #93c5fd; box-shadow: var(--shadow-sm); }
.lead-card--unread {
  border-left: 4px solid #f97316;
  background: linear-gradient(90deg, #fffbeb 0%, #fff 28%);
}
.lead-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.lead-card__identity { min-width: 0; flex: 1; }
.lead-card__delete {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  cursor: pointer;
}
.lead-card__delete:hover:not(:disabled) { background: #fee2e2; border-color: #fca5a5; }
.lead-card__delete:disabled { opacity: 0.6; cursor: wait; }
.lead-card__name { font-size: 17px; font-weight: 700; margin: 0; }
.lead-card__phone {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  color: var(--primary-dark);
  text-decoration: none;
}
.lead-card__phone:hover { text-decoration: underline; }
.lead-card__meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.lead-card__treatment { font-size: 14px; line-height: 1.5; color: #334155; }
.lead-card__tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.lead-card__footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.quiz-label-field { margin: 12px 0 14px; }
.quiz-label-field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.quiz-label-field__row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.quiz-label-field__input {
  flex: 1;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.quiz-label-field__hint { margin: 6px 0 0; font-size: 12px; }
.lead-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}
.panel-sidebar--leads { display: flex; flex-direction: column; min-height: 280px; }
.panel-sidebar__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.panel-sidebar__settings-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text); font-size: 14px; font-weight: 600;
  background: #f8fafc; border: 1px solid var(--border);
  transition: background .15s, border-color .15s, color .15s;
}
.panel-sidebar__settings-btn:hover {
  background: #fff; border-color: #cbd5e1; color: var(--primary-dark);
}
.panel-sidebar__settings-icon {
  width: 18px; height: 18px; flex-shrink: 0; background: currentColor; opacity: .75;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E") center/contain no-repeat;
}
.panel-sidebar__back {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 4px 12px; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600;
}
.panel-sidebar__back:hover { color: var(--primary-dark); background: #f1f5f9; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.settings-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.settings-card:hover {
  border-color: #93c5fd; box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.settings-card strong { display: block; margin-bottom: 6px; font-size: 16px; }
.settings-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.settings-card__icon {
  display: block; width: 36px; height: 36px; border-radius: 10px; margin-bottom: 12px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
}
.settings-card__icon--integrations { background: linear-gradient(135deg, #eff6ff, #bfdbfe); }
.settings-card__icon--embed { background: linear-gradient(135deg, #f0fdf4, #bbf7d0); }
.settings-card__icon--quizzes { background: linear-gradient(135deg, #fdf4ff, #e9d5ff); }
.settings-card__icon--test { background: linear-gradient(135deg, #fff7ed, #fed7aa); }
.settings-card__icon--broadcasts { background: linear-gradient(135deg, #fef2f2, #fecaca); }

.panel-shell--centered { display: block; max-width: 560px; margin: 0 auto; }
.max-setup .card { margin-top: 16px; }

.broadcast-msg-field { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.broadcast-msg-field textarea { display: block; width: 100%; margin-top: 6px; font-weight: 400; padding: 10px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; }

.broadcast-chain { margin: 16px 0 0; padding-left: 20px; }
.broadcast-chain li { margin-bottom: 10px; }
.broadcast-chain__when { display: inline-block; min-width: 110px; font-weight: 600; color: var(--muted); }
.broadcast-test { margin-top: 0; }
.broadcast-test__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.broadcast-test__status { font-size: 13px; font-weight: 600; color: #2563eb; }
.broadcast-test__status.hidden { display: none; }
.broadcast-test__progress { margin-top: 10px; }
.broadcast-test__progress.hidden { display: none; }
.broadcast-test__bar { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 10px 0; }
.broadcast-test__fill { height: 100%; width: 0; background: linear-gradient(90deg, #3b82f6, #2563eb); transition: width .3s; }
.max-chain-active { margin: 8px 0 4px; font-size: 14px; color: var(--text, #1f2937); }
.max-chain-active strong { color: #c2410c; }
.card__title-link { text-decoration: none; color: inherit; }
.card__title-link:hover h3 { color: #2563eb; }
.panel-sidebar__link--chains.active { background: linear-gradient(135deg, #fff7ed, #ffedd5); color: #c2410c; }
.panel-sidebar__link--inviting.active { background: linear-gradient(135deg, #fef2f2, #fee2e2); color: #b91c1c; }
.panel-sidebar__warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}
.inviting-alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 12px; margin-bottom: 16px;
  border: 1px solid #fecaca; background: #fef2f2; color: #991b1b;
}
.inviting-alert__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: #dc2626; color: #fff;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.inviting-steps { margin: 0; padding-left: 20px; line-height: 1.6; }
.inviting-steps li { margin-bottom: 8px; }
.lead-tag--channel-ok { background: #e8f8ef; color: #0f6b3a; }
.lead-tag--channel-fail { background: #fef2f2; color: #b91c1c; }
.card--link { text-decoration: none; color: inherit; display: block; }
.card--link:hover { border-color: #93c5fd; }

.bt-axis {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0;
  padding: 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px;
}
.bt-month {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.bt-month--active { border-color: var(--primary); color: var(--primary-dark); background: #eff6ff; }
.bt-month--filled { border-color: #f87171; color: #b91c1c; background: #fef2f2; }
.bt-panel {
  max-height: 0; overflow: hidden; opacity: 0; transition: max-height .25s, opacity .2s, margin .25s;
}
.bt-panel--open { max-height: 520px; opacity: 1; margin-bottom: 16px; }
.bt-panel--open.bt-panel--tall { max-height: min(720px, 75vh); overflow-y: auto; }
.bt-panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bt-hint { margin: 0 0 10px; font-size: 13px; }
.bt-days { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bt-day {
  min-width: 40px; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-weight: 600;
}
.bt-day--on { background: #fef2f2; border-color: #f87171; color: #b91c1c; }
.bt-day--active { outline: 2px solid var(--primary); }
.bt-detail { border-top: 1px solid var(--border); padding-top: 12px; }
.bt-detail__label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.bt-detail__text {
  display: block; width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; resize: vertical;
}
.bt-detail__actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.bt-detail__pre {
  margin: 8px 0 0; padding: 10px; background: #f9fafb; border: 1px solid var(--border);
  border-radius: 8px; white-space: pre-wrap; font-size: 13px; line-height: 1.45;
}
.broadcast-chain-meta { margin-bottom: 12px; align-items: center; }
.bt-templates-group { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px 12px; }
.bt-templates-group summary { cursor: pointer; font-weight: 600; padding: 12px 0 8px; }
.bt-templates-list { display: flex; flex-direction: column; gap: 8px; }
.bt-template-btn {
  text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; transition: border-color .15s, background .15s;
}
.bt-template-btn:hover { border-color: var(--primary); background: #eff6ff; }
.bt-template-meta { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.bt-template-preview { display: block; font-size: 13px; line-height: 1.4; color: var(--text); }

.bt-fill-choice { padding: 4px 0 8px; }
.bt-fill-choice__title { margin: 0 0 12px; font-size: 15px; }
.bt-fill-choice__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.bt-fill-choice__card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px; border: 2px solid var(--border); border-radius: 12px; background: #fff;
  cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s, background .15s;
}
.bt-fill-choice__card:hover {
  border-color: var(--primary); background: #eff6ff; box-shadow: 0 4px 14px rgba(37, 99, 235, .12);
}
.bt-fill-choice__icon { font-size: 22px; line-height: 1; margin-bottom: 2px; }
.bt-fill-choice__card strong { font-size: 14px; color: var(--text); }
.bt-fill-choice__card .muted { font-size: 12px; line-height: 1.35; }

.bt-mode-tabs {
  display: flex; gap: 6px; margin-bottom: 10px; padding: 4px;
  background: #f1f5f9; border-radius: 10px; width: fit-content; max-width: 100%;
}
.bt-mode-tab {
  border: none; background: transparent; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.bt-mode-tab--active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bt-fill-hint { margin: 0 0 10px; font-size: 13px; }

.bt-template-picker { max-height: 340px; overflow-y: auto; padding-right: 4px; }
.bt-template-picker__group { margin-bottom: 12px; }
.bt-template-picker__group-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); margin-bottom: 6px;
}
.bt-template-picker__list { display: flex; flex-direction: column; gap: 6px; }
.bt-template-picker__item {
  text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; transition: border-color .15s, background .15s;
}
.bt-template-picker__item:hover { border-color: var(--primary); background: #eff6ff; }
.bt-template-picker__meta { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.bt-template-picker__text { display: block; font-size: 13px; line-height: 1.4; margin-top: 4px; }
.bt-template-picker__pick {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--primary);
}

.bt-library-hint {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
}
.bt-library-hint.hidden { display: none; }
.bt-library--linked { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(59, 130, 246, .15); }
.bt-axis--pulse { animation: bt-pulse 1.2s ease; }
@keyframes bt-pulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(59, 130, 246, .35); }
}

.bt-test-link { margin-top: 12px; }

@media (max-width: 640px) {
  .bt-fill-choice__grid { grid-template-columns: 1fr; }
}

.lead-tag--sent { background: #e8f8ef; color: #0f6b3a; }
.lead-tag--new { background: #ffedd5; color: #c2410c; }

@media (max-width: 800px) {
  .panel-shell { grid-template-columns: 1fr; }
  .panel-sidebar { position: static; }
}
