:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --accent: #0d9488;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 400px at 0% 0%, #e0e7ff 0%, transparent 55%),
    radial-gradient(700px 300px at 100% 0%, #ccfbf1 0%, transparent 50%),
    var(--bg);
  line-height: 1.45;
}
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }
.app-shell { max-width: 1120px; margin: 0 auto; padding: 16px 16px 64px; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, #6366f1, #4f46e5 50%, #0d9488);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}
.brand strong { display: block; font-size: 1.05rem; letter-spacing: -0.02em; }
.brand span { display: block; font-size: 0.78rem; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav button, .btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.88rem;
}
.nav button.active, .btn.primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn.primary:hover { background: var(--primary-dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.hero {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 45%, #0f766e 100%);
  color: #fff; border-radius: 20px; padding: 28px 24px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 1.65rem; letter-spacing: -0.03em; }
.hero p { margin: 0 0 14px; opacity: 0.92; max-width: 560px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills span {
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22);
  padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 8px; }
.card p.muted, .muted { color: var(--muted); font-size: 0.9rem; }
.stat strong { display: block; font-size: 1.5rem; color: var(--primary-dark); margin-top: 4px; }
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: #e0e7ff; color: #3730a3; margin-bottom: 8px;
}
.badge.live { background: #d1fae5; color: #065f46; }
.badge.finance { background: #fef3c7; color: #92400e; }

label { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(79, 70, 229, 0.3); border-color: var(--primary);
}
.auth-box { max-width: 420px; margin: 40px auto; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 999px;
  font-weight: 600; font-size: 0.9rem; z-index: 50; max-width: 90vw; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.toast[hidden] { display: none !important; }

.wizard-steps {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px;
}
.wizard-steps span {
  font-size: 0.72rem; font-weight: 700; padding: 4px 8px; border-radius: 999px;
  background: #f1f5f9; color: var(--muted);
}
.wizard-steps span.done { background: #d1fae5; color: #065f46; }
.wizard-steps span.current { background: #4f46e5; color: #fff; }

/* Automation OS */
.hero-role {
  margin: 0 0 4px; font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.85;
}
.more-menu {
  display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 14px;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px;
}
.more-menu.hidden { display: none !important; }
.more-menu button, .more-menu a {
  border: 1px solid var(--border); background: #f8fafc; color: var(--text);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600;
  font-size: 0.82rem; text-decoration: none;
}
.celeb-card {
  background: #ecfdf5; border-color: #a7f3d0; margin-bottom: 12px;
}
.priority-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
}
.priority-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.badge.impact-high { background: #fee2e2; color: #991b1b; }
.badge.impact-medium { background: #fef3c7; color: #92400e; }
.badge.impact-low { background: #e2e8f0; color: #475569; }
.badge.status-working { background: #d1fae5; color: #065f46; }
.badge.status-beta { background: #e0e7ff; color: #3730a3; }
.badge.status-coming_soon { background: #f1f5f9; color: #475569; }
.progress-bar {
  height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin: 8px 0 12px;
}
.progress-bar > div { height: 100%; background: #0d9488; border-radius: 99px; }
.success-path { padding-left: 18px; }
.success-path li { margin-bottom: 8px; }
.success-path li.done strong { color: #065f46; }
.q-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.q-chip {
  background: #f1f5f9; border-radius: 999px; padding: 6px 12px;
  font-size: 0.85rem; font-weight: 600; color: #334155;
}
.hub-filters { margin-bottom: 14px; }
.hub-filter-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px;
}
.hub-filter-row .grow { grid-column: span 2; }
@media (max-width: 700px) { .hub-filter-row .grow { grid-column: span 1; } }
.dept-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.hub-card-top { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.hub-problem { font-size: 0.92rem; margin: 6px 0; }
.prob-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;
}
.prob-card { text-align: left; cursor: pointer; border: 1px solid var(--border); width: 100%; }
.prob-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.guide-block { border-bottom: 1px solid var(--border); padding: 12px 0; }
.journey-list { padding-left: 18px; }
.journey-list li { margin-bottom: 6px; }
.video-ph {
  background: #0f172a; color: #fff; border-radius: 12px; padding: 28px 16px;
  text-align: center; font-weight: 700;
}
.perf-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border); padding: 10px 0;
}
.btn.sm { padding: 6px 10px; font-size: 0.8rem; }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.preview-box {
  background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 14px;
  white-space: pre-wrap; font-size: 0.88rem; font-family: ui-monospace, Consolas, monospace;
  max-height: 240px; overflow: auto;
}
.footer {
  margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.hidden { display: none !important; }
.err { color: var(--danger); font-size: 0.88rem; margin: 8px 0; }
.ok { color: var(--ok); font-weight: 600; }

/* Product tour */
#tourOverlay:not(.hidden) {
  display: flex !important;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 40;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
