:root {
  --ink: #16181d;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --card: #ffffff;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --green: #d1fae5;
  --green-dark: #047857;
  --amber: #b45309;
  --danger: #dc2626;
  --sidebar-bg: #14152b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
code { background: #f1f1f4; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

/* ---------- Public site ---------- */
body.pub { background: #fff; }
.pub-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 48px; border-bottom: 1px solid var(--line); }
.pub-brand { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.brand-mark { background: var(--brand); color: #fff; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.pub-nav { display: flex; align-items: center; gap: 28px; font-weight: 600; font-size: 14.5px; }
.btn-primary { background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 8px; }
.hero { text-align: center; padding: 100px 24px 70px; max-width: 780px; margin: 0 auto; }
.eyebrow { color: var(--brand-dark); font-weight: 700; font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.hero h1 { font-size: 46px; line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.02em; }
.hero .sub { font-size: 18px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 9px; font-weight: 700; font-size: 15px; cursor: pointer; border: none; }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-block { width: 100%; text-align: center; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.section { max-width: 1100px; margin: 0 auto; padding: 70px 24px; }
.section h2 { font-size: 32px; text-align: center; margin-bottom: 10px; letter-spacing: -0.01em; }
.lede { text-align: center; color: var(--ink-soft); font-size: 16px; margin-bottom: 46px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card { border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.feature-card .icon { font-size: 26px; margin-bottom: 10px; }
.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.price-card { border: 1.5px solid var(--line); border-radius: 16px; padding: 28px; position: relative; }
.price-card.featured { border-color: var(--brand); box-shadow: 0 8px 24px rgba(99,102,241,0.12); }
.price-card .tag { position: absolute; top: -12px; left: 24px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.price-card h3 { margin: 6px 0 4px; }
.price-card .price { font-size: 32px; font-weight: 800; margin-bottom: 18px; }
.price-card .price span { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.price-card ul { list-style: none; padding: 0; margin: 0 0 22px; }
.price-card li { padding: 7px 0; font-size: 14px; color: #374151; border-top: 1px solid #f1f1f4; }
.price-card li:first-child { border-top: none; }
.pub-footer { text-align: center; padding: 40px 24px; color: var(--ink-soft); font-size: 13.5px; border-top: 1px solid var(--line); }

/* ---------- Auth ---------- */
.auth-wrap, .onboard-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-card { background: var(--card); border-radius: 16px; padding: 40px; width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card .sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 14.5px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-soft); }
.auth-alt a { color: var(--brand-dark); font-weight: 600; }
.error-box { background: #fee2e2; color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 14.5px; font-family: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar-bg); color: #e5e7eb; display: flex; flex-direction: column; padding: 22px 16px; flex-shrink: 0; }
.brand { font-weight: 800; font-size: 19px; display: flex; align-items: center; gap: 8px; padding: 0 8px 20px; }
.store-name { padding: 10px 8px 18px; font-weight: 700; font-size: 14px; border-bottom: 1px solid #2a2d3a; margin-bottom: 14px; }
.plan-sub { font-weight: 400; color: #9296a6; font-size: 12px; text-transform: capitalize; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { padding: 10px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 600; color: #c7cad4; display: flex; align-items: center; gap: 10px; }
.side-nav a.active, .side-nav a:hover { background: #23263280; color: #fff; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer { border-top: 1px solid #2a2d3a; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-mode-pill { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; width: fit-content; }
.ai-mode-pill.live { background: #05372a; color: #34d399; }
.ai-mode-pill.test { background: #3a2e05; color: #fbbf24; }
.link-btn { background: none; border: none; color: #9296a6; font-size: 13.5px; cursor: pointer; padding: 0; font-weight: 600; }
.link-btn:hover { color: #fff; }
.main-pane { flex: 1; padding: 32px 40px; max-width: 1180px; }
.flash { background: var(--green); color: var(--green-dark); padding: 10px 16px; border-radius: 8px; margin-bottom: 20px; font-weight: 600; font-size: 14px; }
.flash.danger { background: #fee2e2; color: var(--danger); }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; gap: 20px; }
.page-header h1 { margin: 0 0 4px; font-size: 26px; }
.page-header p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat-card .label { color: var(--ink-soft); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 800; }
.stat-card .value.green { color: var(--green-dark); }
.stat-card .value.danger { color: var(--danger); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 20px; }
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h2.no-margin { margin: 0; }
.card-sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 16px; }
.empty-state { color: var(--ink-soft); font-size: 14px; padding: 30px 10px; text-align: center; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); padding: 12px 20px; border-bottom: 1px solid var(--line); }
td { padding: 14px 20px; border-bottom: 1px solid #f1f1f4; font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: #fafafb; }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; background: #eef2ff; color: #4338ca; }
.pill.completed, .pill.done, .pill.active { background: var(--green); color: var(--green-dark); }
.pill.failed { background: #fee2e2; color: var(--danger); }
.pill.running { background: #fef3c7; color: var(--amber); }

.btn.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Workflow steps editor */
.step-row { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.step-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.step-fields input { font-weight: 700; }
.step-fields textarea { min-height: 56px; }
.step-actions { display: flex; flex-direction: column; gap: 4px; }
.icon-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; color: var(--ink-soft); }
.icon-btn:hover { background: #f4f4f6; }
.icon-btn.danger { color: var(--danger); }
.add-btn { background: none; border: 1.5px dashed var(--line); border-radius: 8px; padding: 10px; width: 100%; font-weight: 700; font-size: 13.5px; color: var(--brand-dark); cursor: pointer; margin-top: 4px; }

/* Run panel */
.run-output { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.run-step-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.run-step-card .rs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.run-step-card .rs-name { font-weight: 800; font-size: 14px; }
.run-step-output, .run-step-card .rs-body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: #374151; background: #fafafb; border-radius: 8px; padding: 12px; }
.engine-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.engine-badge.mock { background: #fef3c7; color: var(--amber); }
.engine-badge.gemini, .engine-badge.claude { background: var(--green); color: var(--green-dark); }
.engine-badge.error { background: #fee2e2; color: var(--danger); }
.run-spinner { color: var(--ink-soft); font-size: 13.5px; padding: 10px 0; }

/* Templates */
.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.template-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.template-card h3 { margin: 0 0 6px; }
.template-card p { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 14px; }
.template-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.step-chip { background: #eef2ff; color: #4338ca; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.step-arrow { color: var(--ink-soft); font-size: 13px; }

@media (max-width: 900px) {
  .feature-grid, .pricing-grid, .stat-grid, .template-grid, .form-grid-2 { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
}

/* ---------- Onboarding steps ---------- */
.onboard-steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; width: 420px; }
.onboard-steps .step { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.onboard-steps .step.done { background: var(--brand); }

/* ---------- Dynamic rows (FAQ) ---------- */
.faq-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.remove-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 15px; color: var(--ink-soft); flex-shrink: 0; }
.remove-btn:hover { background: #fef2f2; color: var(--danger); }

/* ---------- Shopper chat / inbox ---------- */
.inbox-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 16px; height: 640px; }
.conv-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-y: auto; padding: 8px; }
.conv-item { display: block; padding: 12px; border-radius: 10px; margin-bottom: 4px; }
.conv-item:hover { background: #f4f4f6; }
.conv-item.active { background: #ecfdf5; }
.conv-item .cname { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.conv-item .cpreview { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pane { background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.chat-header .who { font-weight: 700; font-size: 15px; }
.chat-header .sub { color: var(--ink-soft); font-size: 12.5px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 70%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.bubble.customer { align-self: flex-start; background: #f1f1f4; border-bottom-left-radius: 4px; }
.bubble.agent { align-self: flex-end; background: #d1fae5; color: #065f46; border-bottom-right-radius: 4px; }
.chat-input-row { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.chat-input-row input { flex: 1; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-size: 14px; }

/* ---------- Carts & recovery ---------- */
.cart-row { border-bottom: 1px solid #f1f1f4; padding: 16px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cart-row:last-child { border-bottom: none; }
.cart-row-main { flex: 1; min-width: 240px; }
.cart-items-line { font-size: 13.5px; color: #374151; margin: 4px 0 2px; }
.cart-row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.followup-out { width: 100%; margin-top: 10px; }
.followup-out:empty { display: none; }
.followup-card { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 14px; font-size: 13.5px; line-height: 1.6; color: #134e4a; white-space: pre-wrap; }
.followup-card .fu-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ---------- Misc shared with run/engine displays ---------- */
.engine-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.engine-badge.mock { background: #fef3c7; color: var(--amber); }
.engine-badge.gemini, .engine-badge.claude { background: var(--green); color: var(--green-dark); }
.engine-badge.error { background: #fee2e2; color: var(--danger); }
.run-spinner { color: var(--ink-soft); font-size: 13.5px; padding: 4px 0; }

/* ---------- Pipeline (kanban) ---------- */
.kanban-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #f4f4f7; border-radius: 12px; padding: 12px; min-height: 200px; }
.kanban-col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); }
.kanban-col-head .count { background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.deal-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; font-size: 13.5px; }
.deal-card .dc-title { font-weight: 700; margin-bottom: 4px; }
.deal-card .dc-value { color: var(--green-dark); font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.deal-card .dc-who { color: var(--ink-soft); font-size: 12px; margin-bottom: 8px; }
.deal-card .dc-move { display: flex; gap: 6px; flex-wrap: wrap; }
.deal-card .dc-move button { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-soft); }
.deal-card .dc-move button:hover { background: #f4f4f6; color: var(--ink); }
.deal-card.won { border-color: #99f6e4; background: #f0fdfa; }
.deal-card.lost { border-color: #fecaca; background: #fef2f2; opacity: 0.75; }

/* ---------- Score badge ---------- */
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; font-size: 12.5px; flex-shrink: 0; }
.score-badge.hot { background: var(--green); color: var(--green-dark); }
.score-badge.warm { background: #fef3c7; color: var(--amber); }
.score-badge.cold { background: #f1f1f4; color: var(--ink-soft); }

/* ---------- Contact detail / activity timeline ---------- */
.contact-head { display: flex; gap: 16px; align-items: center; margin-bottom: 4px; }
.contact-head h1 { margin: 0; }
.next-action { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; border-radius: 10px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 20px; display: flex; gap: 10px; align-items: flex-start; }
.next-action .na-icon { font-size: 16px; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { padding: 12px 0; border-top: 1px solid #f1f1f4; display: flex; gap: 10px; }
.timeline-item:first-child { border-top: none; }
.timeline-item .ti-icon { font-size: 15px; margin-top: 1px; }
.timeline-item .ti-body { flex: 1; font-size: 13.5px; white-space: pre-wrap; line-height: 1.55; }
.timeline-item .ti-meta { color: var(--ink-soft); font-size: 11.5px; margin-top: 4px; }
.ai-suggest-out { margin-top: 12px; }
.ai-suggest-out:empty { display: none; }
.suggest-card { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 14px; font-size: 13.5px; line-height: 1.6; color: #134e4a; white-space: pre-wrap; }
.suggest-card .sc-actions { margin-top: 10px; display: flex; gap: 8px; }
.tag-chip { display: inline-block; background: #eef2ff; color: #4338ca; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-right: 4px; }

@media (max-width: 900px) {
  .inbox-wrap { grid-template-columns: 1fr; height: auto; }
}

/* ---------- API docs ---------- */
.doc-wrap { max-width: 860px; margin: 0 auto; padding: 60px 24px 100px; }
.doc-wrap h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -0.01em; }
.doc-wrap .sub { color: var(--ink-soft); font-size: 16px; margin: 0 0 40px; }
.doc-group { margin-bottom: 40px; }
.doc-group h2 { font-size: 20px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 14px; }
.doc-group-note { color: var(--ink-soft); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.doc-endpoint { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; }
.doc-endpoint p { font-size: 14px; color: var(--ink); margin: 0 0 14px; }
.doc-endpoint-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.doc-method { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 6px; letter-spacing: 0.03em; }
.doc-method-get { background: var(--green); color: var(--green-dark); }
.doc-method-post { background: #eef2ff; color: #4338ca; }
.doc-path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; font-weight: 700; }
.doc-block { margin-bottom: 10px; }
.doc-block:last-child { margin-bottom: 0; }
.doc-block-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 4px; }
.doc-block pre { background: #0f1117; color: #d8dae2; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; overflow-x: auto; margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
