:root {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #65738b;
  --border: #d9e2ec;
  --accent: #1565c0;
  --accent-soft: #e9f3ff;
  --success: #138a4b;
  --danger: #c62828;
  --shadow: 0 14px 36px rgba(27, 46, 74, 0.10);
}

html[data-theme="dark"] { --bg:#0f1724; --surface:#172133; --surface-soft:#202c40; --text:#ecf2f8; --muted:#aab6c7; --border:#33435a; --accent:#60a5fa; --accent-soft:#1d3553; --shadow:0 14px 36px rgba(0,0,0,.28); }
html[data-theme="blue"] { --bg:#eef6ff; --surface:#fff; --surface-soft:#f4f9ff; --text:#123052; --muted:#58728f; --border:#c9ddf3; --accent:#0b67c2; --accent-soft:#dceeff; }
html[data-theme="green"] { --bg:#eff8f2; --surface:#fff; --surface-soft:#f4fbf6; --text:#173c28; --muted:#5d7869; --border:#cfe4d5; --accent:#16814b; --accent-soft:#ddf4e5; }
html[data-theme="orange"] { --bg:#fff6eb; --surface:#fff; --surface-soft:#fffaf4; --text:#4a2a11; --muted:#80684f; --border:#ead7c2; --accent:#d56a08; --accent-soft:#ffead5; }
html[data-theme="red"] { --bg:#fff1f2; --surface:#fff; --surface-soft:#fff7f7; --text:#4a1820; --muted:#815a61; --border:#ebcbd0; --accent:#c52f43; --accent-soft:#ffe1e5; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.panel, .mobile-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.panel-heading h2, .mobile-panel h2 { margin:0; font-size:18px; line-height:1.25; }
.help-button { width:30px; height:30px; border-radius:10px; border:1px solid var(--border); background:var(--surface-soft); color:var(--accent); font-weight:900; cursor:pointer; }
.status-ok { color:var(--success); }
.status-error { color:var(--danger); }
.decision-list { display:grid; gap:10px; }
.decision-item { display:flex; gap:10px; align-items:flex-start; padding:11px 12px; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft); }
.decision-item > span { display:inline-flex; width:22px; height:22px; align-items:center; justify-content:center; flex:0 0 22px; border-radius:50%; background:var(--accent-soft); color:var(--accent); font-weight:900; }
.decision-item p { margin:0; line-height:1.42; }
.primary-button { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:0 18px; border-radius:12px; background:var(--accent); color:#fff; text-decoration:none; font-weight:800; }
.error-panel { display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:16px; min-height:320px; }
.error-code { font-size:72px; font-weight:900; color:var(--accent); line-height:1; }

.help-overlay { position:fixed; inset:0; background:rgba(10,20,35,.42); z-index:90; }
.help-drawer { position:fixed; top:0; right:0; bottom:0; width:min(420px, 100vw); background:var(--surface); border-left:1px solid var(--border); box-shadow:-18px 0 50px rgba(0,0,0,.18); transform:translateX(105%); transition:transform .22s ease; z-index:100; }
.help-drawer.is-open { transform:translateX(0); }
.help-drawer-header { display:flex; justify-content:space-between; align-items:center; min-height:72px; padding:18px 20px; border-bottom:1px solid var(--border); }
.help-drawer-header h2 { margin:0; font-size:20px; }
.help-drawer-header button { width:34px; height:34px; border:0; border-radius:10px; background:var(--surface-soft); color:var(--text); font-size:24px; cursor:pointer; }
.help-drawer-body { padding:22px 20px; color:var(--muted); line-height:1.6; white-space:pre-wrap; }

.toast { position:fixed; top:18px; left:50%; transform:translate(-50%,-20px); opacity:0; z-index:120; padding:12px 18px; border-radius:12px; background:var(--accent); color:#fff; font-weight:800; box-shadow:var(--shadow); transition:.2s ease; }
.toast.is-visible { transform:translate(-50%,0); opacity:1; }

.muted-text { margin:6px 0 0; color:var(--muted); font-size:13px; }
.secondary-button { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:0 18px; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft); color:var(--text); text-decoration:none; font-weight:800; cursor:pointer; }
.secondary-button:hover { border-color:var(--accent); color:var(--accent); }
.inline-form { margin-top:14px; }

.auth-card-header { margin-bottom:20px; }
.auth-card-header.centered { text-align:center; }
.auth-card-header h1, .auth-card-header h2 { margin:0 0 7px; font-size:27px; line-height:1.2; }
.auth-card-header p { margin:0; color:var(--muted); line-height:1.5; }
.auth-form { display:grid; gap:15px; }
.form-grid { display:grid; gap:14px; }
.form-grid.two-columns { grid-template-columns:repeat(2,minmax(0,1fr)); }
.field { display:grid; gap:7px; }
.field > span { font-size:13px; font-weight:800; }
.field input, .field select, .field textarea { width:100%; min-height:44px; border:1px solid var(--border); border-radius:11px; background:var(--surface); color:var(--text); padding:10px 12px; outline:none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.field small { color:var(--muted); font-size:12px; line-height:1.35; }
.check-field { display:flex; align-items:flex-start; gap:10px; color:var(--text); font-size:13px; line-height:1.45; cursor:pointer; }
.check-field input { width:18px; height:18px; margin:1px 0 0; flex:0 0 18px; accent-color:var(--accent); }
.form-submit { width:100%; border:0; cursor:pointer; }
.form-alert { padding:12px 14px; border-radius:12px; margin-bottom:16px; font-size:13px; font-weight:750; line-height:1.45; }
.form-alert-error { border:1px solid color-mix(in srgb, var(--danger) 32%, var(--border)); background:color-mix(in srgb, var(--danger) 8%, var(--surface)); color:var(--danger); }
.trial-warning { display:grid; gap:4px; padding:12px 14px; border:1px solid var(--accent); border-radius:12px; background:var(--accent-soft); }
.trial-warning strong { color:var(--accent); font-size:13px; }
.trial-warning span { font-size:12px; line-height:1.45; }
.auth-card-footer { margin-top:18px; padding-top:16px; border-top:1px solid var(--border); text-align:center; color:var(--muted); font-size:13px; }
.auth-card-footer a { color:var(--accent); font-weight:800; text-decoration:none; }
.auth-version { color:var(--muted); font-size:11px; text-align:center; margin-top:14px; }
.result-icon { width:64px; height:64px; display:flex; align-items:center; justify-content:center; margin:0 auto 18px; border-radius:20px; background:var(--accent-soft); color:var(--accent); font-size:30px; font-weight:900; }
.result-icon.result-error { background:color-mix(in srgb, var(--danger) 12%, var(--surface)); color:var(--danger); }
.email-chip { margin:0 auto 16px; width:max-content; max-width:100%; padding:8px 12px; border-radius:999px; background:var(--surface-soft); border:1px solid var(--border); font-size:13px; font-weight:800; overflow-wrap:anywhere; }
.compact-form { margin-top:16px; }

/* Niche setup wizard */
.wizard-header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:16px; }
.wizard-header h2 { margin:4px 0 6px; font-size:23px; }
.wizard-header p { margin:0; color:var(--muted); line-height:1.5; }
.wizard-kicker { color:var(--accent); font-size:12px; font-weight:900; text-transform:uppercase; letter-spacing:.05em; }
.wizard-progress { display:grid; grid-template-columns:repeat(9,minmax(28px,1fr)); gap:8px; margin:0 0 20px; }
.wizard-progress-item { position:relative; min-height:8px; border-radius:999px; background:var(--border); text-decoration:none; }
.wizard-progress-item span { position:absolute; top:-24px; left:50%; transform:translateX(-50%); width:22px; height:22px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:var(--surface-soft); border:1px solid var(--border); color:var(--muted); font-size:10px; font-weight:900; }
.wizard-progress-item.is-current, .wizard-progress-item.is-complete { background:var(--accent); }
.wizard-progress-item.is-current span, .wizard-progress-item.is-complete span { background:var(--accent); border-color:var(--accent); color:#fff; }
.wizard-form { display:grid; gap:16px; }
.wizard-form textarea { resize:vertical; min-height:110px; line-height:1.45; }
.form-grid.three-columns { grid-template-columns:repeat(3,minmax(0,1fr)); }
.short-field { max-width:260px; }
.wizard-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:6px; }
.wizard-actions .primary-button { border:0; cursor:pointer; }
.final-actions { margin-top:18px; }
.summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.summary-card { padding:14px; border:1px solid var(--border); border-radius:14px; background:var(--surface-soft); min-width:0; }
.summary-card > span { display:block; margin-bottom:7px; color:var(--muted); font-size:12px; font-weight:800; }
.summary-card strong { display:block; margin-bottom:7px; font-size:16px; }
.summary-card p { margin:0 0 7px; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.45; }
.summary-card small { color:var(--muted); }
.wizard-final-note, .queue-note { margin-top:16px; padding:13px 14px; border:1px solid var(--accent); border-radius:12px; background:var(--accent-soft); line-height:1.45; }
.queue-note { display:grid; gap:4px; }
.queue-note strong { color:var(--accent); }
.queue-note span { color:var(--muted); font-size:13px; }
.niche-detail-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:16px; }
.niche-detail-head h2 { margin:8px 0 4px; font-size:24px; }
.niche-detail-head p { margin:0; color:var(--muted); }
.status-pill { display:inline-flex; align-items:center; min-height:28px; padding:0 10px; border-radius:999px; background:var(--surface-soft); border:1px solid var(--border); font-size:12px; font-weight:900; }
.status-pill.status-queued, .status-pill.status-active { color:var(--success); background:color-mix(in srgb,var(--success) 9%,var(--surface)); border-color:color-mix(in srgb,var(--success) 28%,var(--border)); }
.next-action { margin-top:12px; }
.mobile-full-button { width:100%; margin-top:12px; }
@media (max-width:760px) { .form-grid.two-columns, .form-grid.three-columns, .summary-grid { grid-template-columns:1fr; } .short-field { max-width:none; } }

/* Registration alignment */
.form-grid-note { display:block; margin-top:-8px; color:var(--muted); font-size:12px; line-height:1.35; }

/* Guided onboarding */
.onboarding { position:fixed; inset:0; z-index:200; }
.onboarding-backdrop { position:absolute; inset:0; background:rgba(8,18,34,.72); }
.onboarding-card { position:fixed; z-index:203; width:min(390px,calc(100vw - 28px)); padding:22px; border:1px solid var(--border); border-radius:18px; background:var(--surface); color:var(--text); box-shadow:0 24px 70px rgba(0,0,0,.35); }
.onboarding-card h2 { margin:4px 0 10px; font-size:23px; line-height:1.25; }
.onboarding-card p { margin:0; color:var(--muted); line-height:1.55; }
.onboarding-step-label { color:var(--accent); font-size:12px; font-weight:900; text-transform:uppercase; letter-spacing:.04em; }
.onboarding-actions { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:20px; }
.onboarding-actions > div { display:flex; gap:9px; }
.onboarding-actions .primary-button { border:0; cursor:pointer; }
.onboarding-link { border:0; background:transparent; color:var(--muted); padding:8px 0; cursor:pointer; font-weight:750; }
.onboarding-link:hover { color:var(--accent); }
.onboarding-highlight { position:relative !important; z-index:202 !important; box-shadow:0 0 0 5px var(--surface),0 0 0 9px var(--accent),0 12px 38px rgba(0,0,0,.35) !important; background:var(--surface) !important; color:var(--accent) !important; pointer-events:none; }
body.onboarding-open { overflow:hidden; }

/* Organization profile */
.organization-form { display:grid; gap:16px; max-width:1180px; margin:0 auto; }
.organization-panel { display:grid; gap:18px; }
.organization-fields { display:grid; gap:14px; }
.organization-fields textarea { resize:vertical; min-height:130px; line-height:1.5; }
.organization-span-two { grid-column:1 / -1; }
.organization-actions { display:flex; justify-content:flex-end; }
.organization-actions .primary-button { border:0; cursor:pointer; min-width:190px; }
.niche-detail-actions { display:flex; align-items:center; gap:10px; }

@media (max-width:760px) {
  .onboarding-card { padding:18px; }
  .onboarding-card h2 { font-size:20px; }
  .onboarding-actions { align-items:flex-end; }
  .onboarding-actions > div { flex-wrap:wrap; justify-content:flex-end; }
}
