/* ===========================================================================
   FormType — light/day theme
   =========================================================================== */
:root {
  --bg: #f5f7fe;
  --bg-2: #eaf0ff;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --border: #e6e8f0;
  --text: #1b2240;
  --muted: #6b7390;
  --faint: #9aa1bd;

  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --brand-ink: #4338ca;
  --accent: #06b6d4;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #06b6d4 120%);
  --grad-soft: linear-gradient(135deg, #eef1ff 0%, #f5f0ff 60%, #ecfbff 100%);

  --shadow-sm: 0 1px 2px rgba(27, 34, 64, 0.06), 0 1px 3px rgba(27, 34, 64, 0.05);
  --shadow: 0 10px 30px -12px rgba(67, 56, 202, 0.25), 0 4px 12px rgba(27, 34, 64, 0.06);
  --shadow-lg: 0 24px 60px -20px rgba(67, 56, 202, 0.4);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 100% -10%, #e7ecff 0%, rgba(231, 236, 255, 0) 60%),
    radial-gradient(900px 500px at -10% 0%, #e6fbff 0%, rgba(230, 251, 255, 0) 55%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--grad);
  box-shadow: 0 6px 16px -4px rgba(99, 102, 241, 0.6);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px 7px auto auto;
  width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: 0.9;
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--text); }
.brand-name span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: 10px;
}
.nav-link:hover { color: var(--brand-ink); background: var(--surface-2); }

/* ---------- layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 36px); }

.hero { text-align: center; padding: 40px 16px 12px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand-ink); background: #eceeff; border: 1px solid #dfe2ff;
  padding: 6px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px); line-height: 1.1; letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto; font-size: 17px; }

/* ---------- panels / cards ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.step {
  flex: none; width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: var(--grad); box-shadow: 0 8px 18px -8px rgba(99,102,241,0.7);
}
.panel-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.panel .hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.panel .hint code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* ---------- forms ---------- */
textarea, input[type="text"], input:not([type]) {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea { min-height: 150px; font-family: ui-monospace, "SF Mono", Menlo, monospace; resize: vertical; }
textarea:focus, input:focus {
  outline: none; background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
::placeholder { color: var(--faint); }

/* ---------- buttons ---------- */
button, .btn {
  font-family: inherit; font-size: 14px; font-weight: 700;
  border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer;
  color: #fff; background: var(--grad);
  box-shadow: 0 10px 22px -10px rgba(99, 102, 241, 0.8);
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
button.ghost, .btn.ghost {
  background: #fff; color: var(--brand-ink);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
button.ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
button.small {
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  background: #fff; color: var(--danger); border: 1px solid var(--border); box-shadow: none;
}
button.small:hover { border-color: var(--danger); background: #fff5f5; }
button.small.view { color: var(--brand-ink); margin-top: 8px; }
button.small.view:hover { border-color: var(--brand); background: var(--surface-2); }

/* ---------- status text ---------- */
.status { color: var(--muted); margin-top: 10px; min-height: 18px; font-size: 14px; }

/* ---------- personas ---------- */
#personaList { list-style: none; padding: 0; margin: 16px 0; }
.persona-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px;
}
.persona-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.persona-head strong { font-size: 15px; }
.persona-desc {
  margin: 10px 0 0; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted);
  max-height: 170px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
}
.inline { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 600; }
.inline input { width: auto; margin: 0; accent-color: var(--brand); }

/* persona "best page" leader row */
.persona-leader { margin-top: 10px; }
.leader-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: #f3f0ff; border: 1px solid #e2dcff; border-radius: 10px;
  padding: 8px 12px; font-size: 13px;
}
.leader-label { font-weight: 700; color: var(--brand-ink); }
.leader-stats { color: var(--muted); }
.leader-row .view { margin-top: 0; margin-left: auto; }
.leader-empty { color: var(--faint); font-size: 13px; font-style: italic; }

/* ---------- metrics table ---------- */
.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: auto; margin-top: 16px; background: #fff;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
thead th {
  background: var(--surface-2); color: var(--muted);
  font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
  padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: center;
}
thead tr:first-child th { color: var(--brand-ink); }
tbody td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: center; color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td:first-child, th:first-child { text-align: left; }
.col-sep { border-left: 2px solid var(--bg-2); }
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-weight: 700; font-size: 12px;
}
.pill.hi { background: #e7faf1; color: #047857; }
.pill.mid { background: #fff4e1; color: #b45309; }
.pill.lo { background: #fdeaea; color: #b91c1c; }

/* ---------- pricing cards (buyer view) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; align-items: stretch; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card.tier-better {
  border-color: transparent;
  box-shadow: var(--shadow-lg);
  background:
    linear-gradient(#fff, #fff) padding-box,
    var(--grad) border-box;
  border: 2px solid transparent;
  transform: translateY(-6px) scale(1.02);
}
.card.tier-better:hover { transform: translateY(-10px) scale(1.02); }
.ribbon {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--grad); color: #fff; font-size: 11px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 14px;
  border-radius: 999px; box-shadow: 0 8px 18px -6px rgba(99,102,241,0.8); white-space: nowrap;
}
.tier-name { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-ink); margin: 0; }
.card .price { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 4px; }
.card .price .per { font-size: 15px; font-weight: 600; color: var(--muted); }
.card ul { list-style: none; padding: 0; margin: 14px 0 4px; flex: 1; }
.card li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; color: var(--text); font-size: 14px; }
.card li::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: #e7faf1 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/12px no-repeat;
}
/* Choose button: pinned to the top of each option, sticky while scrolling. */
.card .choose {
  width: 100%; padding: 13px; font-size: 15px; order: -1;
  position: sticky; top: 76px; z-index: 5; margin: 0 0 14px;
}
.card.tier-good .choose, .card.tier-best .choose { background: #fff; color: var(--brand-ink); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.card.tier-good .choose:hover, .card.tier-best .choose:hover { border-color: var(--brand); }

/* ---------- thank you ---------- */
.center-wrap { max-width: 560px; margin: 8vh auto; text-align: center; }
.thanks-emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; }
.confetti-card { padding: 40px clamp(20px, 5vw, 48px); }

/* ---------- misc ---------- */
small { color: var(--muted); }
.muted { color: var(--muted); }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
footer { text-align: center; color: var(--faint); font-size: 13px; padding: 30px 16px 50px; }
footer.made-with { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.kiro-logo { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; vertical-align: middle; box-shadow: var(--shadow-sm); }
a { color: var(--brand-ink); }

/* ---------- auth gate (prevents UI flash before redirect) ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center; gap: 18px;
  background:
    radial-gradient(900px 500px at 50% 0%, #e7ecff 0%, rgba(231, 236, 255, 0) 60%),
    var(--bg);
}
.auth-gate.hidden { display: none; }
.auth-gate .gate-brand { display: flex; align-items: center; gap: 10px; }
.auth-gate .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid #dfe2ff; border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
.auth-gate .gate-text { color: var(--muted); font-size: 14px; font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .nav-link { display: none; }
  .hero { padding-top: 26px; }
}
