:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #16191d;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --brand: #1f4fd1;
  --brand-hover: #1a43b3;
  --brand-soft: #eaf0fd;
  --sidebar: #0f1b2d;
  --sidebar-text: #c6cfdc;
  --green: #127a46;  --green-soft: #e5f5ec;
  --blue: #1f5fbf;   --blue-soft: #e8f0fc;
  --amber: #9a5b00;  --amber-soft: #fdf3e1;
  --red: #b42318;    --red-soft: #fdecea;
  --purple: #6b3fa0; --purple-soft: #f1ebfa;
  --gray: #4b5563;   --gray-soft: #eef0f3;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.hidden, [hidden] { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 15px; padding: 0 8px 22px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--sidebar-text); font-weight: 500; }
.nav a svg { width: 17px; height: 17px; opacity: 0.85; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12.5px; }
.sidebar-foot button { background: none; border: 0; color: var(--sidebar-text); padding: 6px 0; cursor: pointer; font: inherit; }
.sidebar-foot button:hover { color: #fff; }
.main { min-width: 0; }
.content { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-body { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-danger { color: var(--red); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.loading { pointer-events: none; opacity: 0.75; }
.btn.loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 550; font-size: 13px; }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.field .error { font-size: 12.5px; color: var(--red); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: 14px var(--font);
}
textarea { height: auto; padding: 10px 11px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; min-height: 460px; white-space: pre; tab-size: 2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.invalid input, .invalid textarea { border-color: var(--red); }
.checkbox { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.checkbox input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--brand); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--gray-soft); color: var(--gray); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 5px; background: var(--gray-soft); font-family: var(--mono); font-size: 12px; border: 1px solid transparent; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--border-strong); }
.chip.warn { background: var(--amber-soft); color: var(--amber); cursor: default; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: 6px; border: 1px solid; font-size: 13.5px; align-items: flex-start; }
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert.info { background: var(--blue-soft); border-color: #c8d9f5; color: #18407c; }
.alert.warn { background: var(--amber-soft); border-color: #f1d9a8; color: #6e4200; }
.alert.error { background: var(--red-soft); border-color: #f4c2bd; color: #8a1c12; }
.alert.success { background: var(--green-soft); border-color: #b9e2ca; color: #0c5a33; }
.banner { margin: 0 0 18px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12.5px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 4px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--text-3); }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; }

.meter { height: 8px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; display: flex; }
.meter > span { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.03em; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .reason { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 13px; }
.cell-title { font-weight: 550; }
.cell-sub { color: var(--text-3); font-size: 12.5px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--gray-soft); border-radius: 7px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 5px; font: 500 13px var(--font); color: var(--text-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs .count { color: var(--text-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.selbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--brand-soft); border-bottom: 1px solid #c9d7f7; font-weight: 500; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }

.progress { height: 6px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: var(--brand); transition: width 0.4s; }

/* ---------- Wizard ---------- */
.steps { display: flex; gap: 0; margin-bottom: 22px; counter-reset: step; border-bottom: 1px solid var(--border); }
.steps button { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 4px 14px; border: 0; background: none; font: 500 13.5px var(--font); color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; text-align: left; }
.steps button:disabled { cursor: not-allowed; }
.steps .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-soft); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.steps button[aria-current="step"] { color: var(--text); border-bottom-color: var(--brand); }
.steps button[aria-current="step"] .num { background: var(--brand); color: #fff; }
.steps button.done .num { background: var(--green-soft); color: var(--green); }
.wizard-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }

.dropzone { display: block; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 34px 20px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { width: 30px; height: 30px; color: var(--text-3); }
.dropzone strong { display: block; margin-top: 8px; }

.preview-frame { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 6px; background: #fff; display: block; }
.preview-head { padding: 10px 12px; border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-2); font-size: 13px; }
.preview-head + .preview-frame { border-radius: 0 0 6px 6px; }
.preview-head div { display: flex; gap: 8px; }
.preview-head dt { color: var(--text-3); width: 58px; flex-shrink: 0; }
.preview-head dl { margin: 0; display: grid; gap: 3px; }
.preview-head dd { margin: 0; overflow-wrap: anywhere; }

.summary { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; margin: 0; }
.summary dt { color: var(--text-3); }
.summary dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Dialog / drawer / toast ---------- */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(620px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25); color: var(--text); }
dialog::backdrop { background: rgba(15, 27, 45, 0.45); }
.dialog-head { padding: 18px 20px 6px; }
.dialog-body { padding: 10px 20px 4px; max-height: 60vh; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); box-shadow: -10px 0 40px rgba(16, 24, 40, 0.18); z-index: 40; display: flex; flex-direction: column; transform: translateX(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.drawer-body { padding: 18px 20px; overflow: auto; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 14px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline .when { font-size: 12px; color: var(--text-3); }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--text-3); }
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #111827; color: #fff; padding: 11px 16px; border-radius: 7px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); max-width: 420px; font-size: 13.5px; animation: toastIn 0.18s ease; }
.toast.error { background: var(--red); }
.toast.success { background: #0f6b3d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.code-box { display: flex; gap: 8px; align-items: center; }
.code-box input[readonly] { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); }
ol.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(180deg, #0f1b2d 0, #0f1b2d 42%, var(--bg) 42%); }
.login-card { width: min(400px, 100%); padding: 32px 30px; }
.login-card .brand { color: var(--text); padding: 0 0 22px; }

/* ---------- Contacts ---------- */
.contacts-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.group-list { padding: 6px; position: sticky; top: 16px; }
.group-list-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 12px; }
.group-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 6px; font: 500 13.5px var(--font); color: var(--text); cursor: pointer; text-align: left; }
.group-item:hover { background: var(--surface-2); }
.group-item[aria-current="true"] { background: var(--brand-soft); color: var(--brand); }
.group-item .group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.group-item .count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.group-sep { height: 1px; background: var(--border); margin: 6px 8px; }
.field-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.field-chip { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 7px; border-radius: 5px; background: var(--gray-soft); font-size: 12px; }
.nowrap { white-space: nowrap; }
.grp-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.kv-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; align-items: center; }
.group-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.group-option { border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; }
.group-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.save-group { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.btn-destructive { background: var(--red); border-color: var(--red); }
.btn-destructive:hover:not(:disabled) { background: #96190f; }

/* ---------- Template step ---------- */
.insert-box { border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); padding: 12px; }
.insert-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; align-items: baseline; }
.chip-insert { background: var(--brand-soft); color: var(--brand); border-color: #c9d7f7; }
.chip-insert:hover { background: #dde7fc; border-color: var(--brand); }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.check-list { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.check-list li { padding-left: 22px; position: relative; }
.check-list li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.check-list li.ok::before { content: "✓"; color: var(--green); }
.check-list li.bad::before { content: "!"; color: var(--amber); width: 14px; text-align: center; }
.check-list .btn { margin-left: 6px; vertical-align: middle; }
.ph-table td, .ph-table th { padding: 8px 14px; }

/* ---------- Desktop / mobile preview ---------- */
.device-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.device-tabs button svg { width: 14px; height: 14px; }
.device-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.device-stage[data-stage="mobile"] { background: var(--gray-soft); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 6px 6px; padding: 18px 12px 22px; display: flex; justify-content: center; }
.device-stage:first-child[data-stage="mobile"] { border-top: 1px solid var(--border); border-radius: 6px; }
.device-stage[data-stage="mobile"] .preview-frame { width: 375px; max-width: 100%; height: 667px; border: 10px solid #1d2430; border-radius: 30px; box-shadow: 0 12px 30px rgba(16, 24, 40, 0.22); }
.preview-head + .device-stage[data-stage="desktop"] .preview-frame { border-radius: 0 0 6px 6px; }
.mobile-note { display: flex; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.mobile-note > svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--green); }
.mobile-note .check-list { margin-top: 4px; }

/* ---------- Scheduling ---------- */
.send-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.send-mode { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 7px; padding: 11px 12px; cursor: pointer; }
.send-mode:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.send-mode input { margin-top: 3px; accent-color: var(--brand); }
.send-mode strong { display: flex; align-items: center; gap: 6px; }
.send-mode strong svg { width: 14px; height: 14px; }
.chip[data-quick] { font-family: var(--font); background: var(--surface); border-color: var(--border-strong); }
.chip[data-quick]:hover { border-color: var(--brand); color: var(--brand); }
.send-mode .hint { font-weight: 400; display: block; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
input[type="datetime-local"] { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: 14px var(--font); }
.invalid input[type="datetime-local"] { border-color: var(--red); }
.schedule-bar { margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.schedule-bar .schedule-text { flex: 1; min-width: 240px; }
.schedule-bar > svg { margin-top: 0; }

/* ---------- Reports ---------- */
.report-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .bar-sent { fill: var(--blue); opacity: 0.85; }
.chart .bar-failed { fill: var(--red); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(31, 79, 209, 0.06); }
.chart path { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.chart .line-open { stroke: var(--green); }
.chart .line-click { stroke: var(--purple); stroke-dasharray: 5 4; }
.legend i.line { height: 3px; width: 14px; border-radius: 2px; }
.funnel { display: grid; gap: 14px; }
.funnel-row { display: grid; grid-template-columns: 1fr 52px; gap: 4px 10px; align-items: center; }
.funnel-label { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 13px; }
.funnel-label strong { font-variant-numeric: tabular-nums; }
.funnel-bar { height: 10px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 99px; }
.funnel-pct { text-align: right; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rate-bad { color: var(--red); font-weight: 600; }
.reason-full { max-width: 420px; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }

/* ---------- Company branding (logo is the white "reversed" version, so it only sits on dark backgrounds) ---------- */
.brand-logo { flex-direction: column; align-items: flex-start; gap: 10px; padding: 2px 8px 22px; }
.brand-logo img { width: 160px; height: auto; display: block; }
.brand-logo .brand-name { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--sidebar-text); padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); width: 100%; }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; background: var(--sidebar); color: #fff; margin: -32px -30px 26px; padding: 24px 30px 20px; border-radius: var(--radius) var(--radius) 0 0; }
.login-brand img { width: 190px; height: auto; display: block; }
.login-brand span { font-weight: 600; font-size: 14px; color: var(--sidebar-text); letter-spacing: 0.02em; }

/* ---------- Content editor (plain text | HTML) ---------- */
.content-editor .tabs button { font-weight: 550; }
textarea.prose { min-height: 380px; font: 15px/1.6 var(--font); padding: 12px 14px; }
.fmt-help { font-size: 12.5px; color: var(--text-2); border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); padding: 8px 12px; }
.fmt-help summary { cursor: pointer; font-weight: 550; color: var(--text); }
.fmt-help table { margin-top: 8px; }
.fmt-help td { padding: 4px 10px 4px 0; border: 0; vertical-align: top; }
.fmt-help td:first-child { white-space: nowrap; }
label.btn.loading { pointer-events: none; opacity: 0.7; }

/* ---------- IAM ---------- */
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.role-card { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.foot-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.forced-pw { max-width: 460px; margin: 24px auto; }
dd.mono { font-family: var(--mono); font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .split, .grid-2, .report-grid { grid-template-columns: minmax(0, 1fr); }
  .contacts-layout { grid-template-columns: minmax(0, 1fr); }
  .group-list { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .brand { padding: 0; }
  .brand-logo img { width: 96px; }
  .brand-logo .brand-name { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a span { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .sidebar-foot .who { display: none; }
  .content { padding: 20px 16px 48px; }
  .steps .label { display: none; }
  .summary { grid-template-columns: 1fr; gap: 2px; }
  .summary dd { margin-bottom: 8px; }
  textarea.code { min-height: 300px; }
  .preview-frame { height: 420px; }
  .send-modes { grid-template-columns: 1fr; }
  .device-stage[data-stage="mobile"] .preview-frame { height: 560px; border-width: 6px; border-radius: 22px; }
}
