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

:root {
  --primary: #3a7afe;
  --primary-dark: #2563eb;
  --primary-light: #eff4ff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --radius: 16px;
  --success: #10b981;
}

html, body {
  min-height: 100vh;
  font-family: 'Poppins', system-ui, sans-serif;
  background: linear-gradient(160deg, #f0f5ff 0%, #f9fafb 60%);
  color: var(--text);
  line-height: 1.6;
}

/* ===== TOPBAR ===== */
.ob-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  z-index: 100;
}
.ob-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.ob-logo-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.ob-progress {
  flex: 1;
  height: 4px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.ob-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.5s ease;
  width: 20%;
}
.ob-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== STEPS ===== */
#onboarding {
  min-height: 100vh;
  padding-top: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.ob-step {
  display: none;
  width: 100%;
  min-height: calc(100vh - 60px);
  padding: 48px 20px 40px;
  align-items: flex-start;
  justify-content: center;
  animation: fadeSlideIn 0.35s ease;
}
.ob-step.active {
  display: flex;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== CARD ===== */
.ob-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  padding: 44px 40px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ob-card-wide { max-width: 860px; }

.ob-icon {
  font-size: 36px;
  line-height: 1;
}
.ob-card h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.ob-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: -8px;
}
.ob-optional {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== GOOGLE BUTTON ===== */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.btn-google:hover { background: var(--bg); border-color: #d1d5db; }

/* ===== DIVIDER ===== */
.ob-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ob-divider::before, .ob-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== FORM FIELDS ===== */
.ob-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ob-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.ob-field input, .ob-field select, .ob-field textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}
.ob-field input:focus, .ob-field select:focus, .ob-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58,122,254,0.1);
}

/* ===== ROLE CARDS ===== */
.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.role-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.role-card:hover { border-color: var(--primary); background: var(--primary-light); }
.role-card.selected { border-color: var(--primary); background: var(--primary-light); }
.role-emoji { font-size: 28px; margin-bottom: 6px; }
.role-label { font-size: 13px; font-weight: 700; }
.role-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== BUTTONS ===== */
.btn-next {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-next:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-skip {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}
.btn-skip:hover { color: var(--text); }
.ob-fine {
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}
.ob-fine a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ===== ADD TABS ===== */
.add-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
}
.add-tab {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.add-tab.active { background: white; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.add-tab-content { display: none; flex-direction: column; gap: 12px; }
.add-tab-content.active { display: flex; }
.tab-hint { font-size: 12px; color: var(--text-muted); }
.add-tab-content textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.add-tab-content textarea:focus { border-color: var(--primary); }
.btn-parse {
  align-self: flex-start;
  padding: 8px 18px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c7d7ff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-parse:hover { background: #dce9ff; }
.btn-add-row {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
}
.parsed-results { display: flex; flex-direction: column; gap: 6px; }
.parsed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 13px;
}
.parsed-row .parsed-name { font-weight: 600; flex: 1; }
.parsed-row .parsed-email { color: var(--text-muted); font-size: 12px; }
.csv-drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.csv-drop:hover { border-color: var(--primary); background: var(--primary-light); }
.csv-drop-icon { font-size: 32px; }
.csv-drop p { font-size: 14px; font-weight: 500; }
.manual-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.manual-row input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.manual-row input:focus { border-color: var(--primary); }
.step3-footer { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ===== MAGIC MOMENT ===== */
.magic-card { gap: 24px; }
.magic-header { display: flex; flex-direction: column; gap: 8px; }
.magic-split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: flex-start;
}
.magic-arrow {
  font-size: 24px;
  color: var(--border);
  padding-top: 44px;
  font-weight: 300;
  flex-shrink: 0;
}
.magic-left, .magic-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.magic-panel-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.magic-label-icon { font-size: 14px; }
.magic-left textarea {
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.15s;
  min-height: 180px;
}
.magic-left textarea:focus { border-color: var(--primary); }
.magic-meta select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: white;
}
.btn-generate {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  position: relative;
  overflow: hidden;
}
.btn-generate:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-generate.loading { pointer-events: none; background: #7aa5fe; }
.magic-output {
  min-height: 220px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fafbff;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  transition: border-color 0.3s;
  position: relative;
}
.magic-output.filled { border-color: var(--primary); background: white; }
.magic-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 180px;
  color: var(--text-muted);
  text-align: center;
}
.magic-placeholder-icon { font-size: 24px; opacity: 0.3; }
.magic-placeholder p { font-size: 13px; }
.magic-shimmer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shimmer-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f0f0 0%, #e4e4e4 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.magic-actions {
  display: flex;
  gap: 8px;
}
.btn-edit-msg {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-edit-msg:hover { background: var(--bg); }
.btn-send-msg {
  flex: 2;
  padding: 10px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-send-msg:hover { background: #059669; transform: translateY(-1px); }

/* ===== SUCCESS ===== */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 200;
}
.success-card {
  text-align: center;
  align-items: center;
  max-width: 520px;
}
.success-emoji { font-size: 56px; }
.success-card h1 { font-size: 26px; }
.success-sent-to {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #065f46;
  width: 100%;
  text-align: center;
}
.success-preview {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  text-align: left;
  max-height: 160px;
  overflow: hidden;
  position: relative;
}
.success-preview::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg));
}
.usage-nudge {
  width: 100%;
  background: var(--primary-light);
  border: 1px solid #c7d7ff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.usage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
}
.usage-bar-track {
  flex: 1;
  height: 6px;
  background: #c7d7ff;
  border-radius: 999px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}
.usage-note { font-size: 13px; color: var(--text-muted); }
.usage-note strong { color: var(--text); }
.success-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-see-plans {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.success-fine {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .ob-card { padding: 28px 20px; }
  .magic-split { grid-template-columns: 1fr; }
  .magic-arrow { display: none; }
  .role-cards { grid-template-columns: 1fr; }
  .manual-row { grid-template-columns: 1fr; }
  .add-tab { font-size: 11px; padding: 7px 6px; }
}
