/* ==========================================================================
   Funnel Komcer — application stylesheet
   Light SaaS theme, indigo/violet accent, glassmorphic surfaces.
   ========================================================================== */

:root {
  --indigo: #4f46e5;
  --violet: #8b5cf6;
  --ink: #1f1b3a;
  --muted: #635f82;
  --line: rgba(79, 70, 229, .14);
  --surface: rgba(255, 255, 255, .68);
  --surface-solid: #ffffff;
  --ok: #0f9d63;
  --warn: #b45309;
  --danger: #d1293d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(31, 27, 58, .10);
  --shadow-sm: 0 6px 18px rgba(31, 27, 58, .07);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background-color: #f3f0ff;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(79, 70, 229, .22), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(139, 92, 246, .20), transparent 40%),
    radial-gradient(circle at 78% 92%, rgba(56, 189, 248, .16), transparent 45%),
    radial-gradient(circle at 4% 88%, rgba(236, 72, 153, .12), transparent 42%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .muted { margin: 4px 0 0; }
.card-solid { background: var(--surface-solid); }
.section { margin-top: 32px; }
.section:first-child { margin-top: 0; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .92rem;
  border: 1px solid transparent;
}
.alert-success { background: #e7f8f0; border-color: #bfe9d5; color: #0b6b45; }
.alert-error   { background: #fdeaec; border-color: #f6c6cc; color: #96202f; }
.alert-info    { background: #eef0ff; border-color: #d3d7fb; color: #37328f; }
.alert-warn    { background: #fdf5e6; border-color: #f5e0b8; color: #8a5406; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok     { background: #e4f7ed; color: #0b6b45; border-color: #c3ebd7; }
.badge-info   { background: #eceffe; color: #3a34a0; border-color: #d5dafc; }
.badge-violet { background: #f2ecfe; color: #6b32c9; border-color: #e2d5fd; }
.badge-warn   { background: #fdf5e6; color: #8a5406; border-color: #f4e2bd; }
.badge-danger { background: #fdecee; color: #a32234; border-color: #f7cdd3; }
.badge-muted  { background: #f1f0f7; color: #5d5878; border-color: #e3e1ee; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--indigo), var(--violet)); color: #fff; box-shadow: 0 10px 22px rgba(79, 70, 229, .28); }
.btn-primary:hover { color: #fff; box-shadow: 0 12px 26px rgba(79, 70, 229, .34); }
.btn-secondary { background: rgba(255, 255, 255, .9); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { color: var(--ink); border-color: rgba(79, 70, 229, .34); }
.btn-danger { background: #fdecee; color: #a32234; border-color: #f7cdd3; }
.btn-danger:hover { color: #8d1c2c; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: rgba(79, 70, 229, .07); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; color: #423d63; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(79, 70, 229, .18);
  background: rgba(255, 255, 255, .92);
  font: inherit;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}
input[readonly], input[disabled], select[disabled], textarea[readonly] { background: rgba(240, 239, 248, .8); color: #6c678a; }
textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.checkbox-line { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-line input { width: auto; margin-top: 4px; }

/* ==========================================================================
   Public / auth layout
   ========================================================================== */
.public-body { display: flex; align-items: center; justify-content: center; padding: 40px 20px; min-height: 100vh; }
.public-shell {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 40px;
  max-width: 1020px;
  width: 100%;
  align-items: center;
}
.public-brand { padding: 12px 8px; }
.public-brand h1 { font-size: 2rem; margin-top: 18px; }
.brand-mark {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 12px 24px rgba(79, 70, 229, .3);
}
.brand-mark-sm { width: 38px; height: 38px; border-radius: 12px; font-size: .86rem; }
.brand-tagline { color: #38325c; font-size: 1.02rem; max-width: 42ch; }
.brand-points { list-style: none; padding: 0; margin: 20px 0 24px; display: grid; gap: 10px; }
.brand-points li { position: relative; padding-left: 26px; color: #3c3760; font-size: .93rem; }
.brand-points li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(79, 70, 229, .14); color: var(--indigo);
  font-size: .7rem; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-foot { font-size: .84rem; color: var(--muted); }
.public-form .card { padding: 28px; }
.public-form h2 { margin-bottom: 6px; }
.form-foot { margin-top: 18px; font-size: .88rem; color: var(--muted); }
.notice-card { max-width: 520px; text-align: center; padding: 36px 28px; }
.notice-mark {
  width: 56px; height: 56px; margin: 0 auto 18px;
  border-radius: 50%; background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
}
.notice-mark-warn { background: linear-gradient(135deg, #f59e0b, #f97316); }
.public-wrap { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 40px 20px; }

/* ==========================================================================
   Application shell (admin)
   ========================================================================== */
.app-body { min-height: 100vh; }
.app-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, .7);
  padding: 22px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 4px 8px 8px; }
.sidebar-title { font-weight: 650; font-size: .98rem; }
.sidebar-sub { font-size: .74rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-sep { height: 1px; background: var(--line); margin: 4px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #423d63; font-size: .89rem; font-weight: 500;
}
.nav-link:hover { background: rgba(79, 70, 229, .08); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: linear-gradient(135deg, rgba(79, 70, 229, .96), rgba(139, 92, 246, .92)); color: #fff; box-shadow: 0 10px 20px rgba(79, 70, 229, .26); }
.nav-link-quiet { color: var(--muted); }
.nav-icon { width: 20px; text-align: center; font-size: .95rem; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, .7);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 650; font-size: 1.02rem; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user-name { font-size: .84rem; color: var(--muted); }
.content { padding: 32px 28px 48px; max-width: 1180px; width: 100%; }
.icon-btn {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .85);
  border-radius: 10px; padding: 7px 11px; font-size: 1rem; cursor: pointer; color: var(--ink);
}
.only-mobile { display: none; }

/* ---------- Stats / tiles ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.stat-card {
  background: var(--surface-solid);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.15; margin-top: 6px; }
.stat-foot { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* Grid/flex children default to min-width:auto, so a wide table inside a column
   would stretch the whole page instead of scrolling inside .table-wrap.
   min-width:0 keeps the page width stable and lets the table scroll. */
.grid-2 > *, .grid-3 > *, .tile-grid > *, .stats-grid > *, .filter-bar > *, .form-grid > * { min-width: 0; }
.card { min-width: 0; }
.table-wrap { min-width: 0; max-width: 100%; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(255, 255, 255, .6); }
table.data { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: rgba(255, 255, 255, .75); font-weight: 650; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(79, 70, 229, .04); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-cell { padding: 28px 14px; text-align: center; color: var(--muted); }

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 12px 20px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.dl dd { margin: 0; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed rgba(79, 70, 229, .3);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .42);
}
.empty-state .empty-mark { font-size: 1.8rem; margin-bottom: 10px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin: 0; font-size: .9rem; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar .field { margin-bottom: 0; min-width: 180px; }
.filter-bar .field.grow { flex: 1 1 220px; }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager-link { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .8); font-size: .84rem; }
.pager-link:hover { text-decoration: none; border-color: var(--indigo); }
.pager-link.is-active { background: linear-gradient(135deg, var(--indigo), var(--violet)); color: #fff; border-color: transparent; }
.pager-gap { padding: 6px 4px; color: var(--muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tab { padding: 9px 14px; font-size: .87rem; border-radius: 10px 10px 0 0; color: var(--muted); }
.tab:hover { text-decoration: none; background: rgba(79, 70, 229, .06); }
.tab.is-active { color: var(--ink); background: rgba(255, 255, 255, .85); border: 1px solid var(--line); border-bottom-color: transparent; font-weight: 600; }
.tab.is-disabled { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Affiliate shell
   ========================================================================== */
.affiliate-body { background-attachment: fixed; }
.aff-topbar {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid rgba(255, 255, 255, .7);
  position: sticky; top: 0; z-index: 20;
}
.aff-topbar-inner { max-width: 1060px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 18px; }
.aff-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.aff-brand:hover { text-decoration: none; }
.aff-brand-text { font-weight: 650; }
.aff-nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.aff-nav-link { padding: 8px 14px; border-radius: 999px; font-size: .88rem; color: #423d63; }
.aff-nav-link:hover { background: rgba(79, 70, 229, .08); text-decoration: none; }
.aff-nav-link.is-active { background: linear-gradient(135deg, var(--indigo), var(--violet)); color: #fff; box-shadow: 0 8px 18px rgba(79, 70, 229, .24); }
.aff-nav-quiet { color: var(--muted); }
.aff-content { max-width: 1060px; margin: 0 auto; padding: 32px 20px 56px; }
.aff-footer { max-width: 1060px; margin: 0 auto; padding: 0 20px 40px; color: var(--muted); font-size: .82rem; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--muted); margin: 0; }
.funnel-card { display: flex; flex-direction: column; gap: 12px; }
.funnel-card h3 { margin: 0; }
.funnel-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--muted); }
.funnel-card .card-foot { margin-top: auto; padding-top: 6px; }
.status-line { display: flex; align-items: center; gap: 10px; }

/* ---------- Audit list ---------- */
.audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.audit-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .62);
}
.audit-list .mono { margin-top: 4px; word-break: break-all; }

/* ==========================================================================
   Phase 2 — readiness checklist, form sections, benefits editor
   ========================================================================== */
.form-section-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 30px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.form-section-title:first-of-type { margin-top: 8px; }

.plain-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: .92rem; color: #423d63; }
.plain-list li { line-height: 1.5; }

.checklist { display: grid; gap: 12px; }
.checklist-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .6);
}
.checklist-item.is-done { border-color: rgba(15, 157, 99, .34); background: #f2fbf6; }
.checklist-item.is-later { background: rgba(255, 255, 255, .42); border-style: dashed; }
.checklist-mark {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(79, 70, 229, .12);
  color: var(--indigo);
  font-weight: 700; font-size: .8rem;
}
.checklist-item.is-done .checklist-mark { background: #dcf5e8; color: var(--ok); }
.checklist-item.is-later .checklist-mark { background: #f1f0f7; color: var(--muted); }
.checklist-action { margin-left: auto; }

.benefit-editor { display: grid; gap: 14px; }
.benefit-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, .58);
}
.benefit-row.is-empty { background: rgba(255, 255, 255, .3); border-style: dashed; }
.benefit-row-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.benefit-index { font-weight: 700; color: var(--muted); font-size: .82rem; }
.benefit-row-head .row-actions { margin-left: auto; }
.benefit-row .field { margin-bottom: 0; }
.benefit-row .form-grid { gap: 0 16px; }

/* Rendered email preview: never let a long URL widen the page. */
.email-preview-body {
  background: #fff;
  padding: 24px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.email-preview-body p { margin: 0 0 16px; }

/* ---------- Phase 5: code blocks (email token preview) ---------- */
.code-block {
  background: #0f1420;
  color: #d7e0f5;
  border-radius: 12px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
}
details summary { cursor: pointer; }

/* ---------- Phase 4: link boxes (affiliate tracking links) ---------- */
.link-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .7);
  padding: 12px 14px;
}
.link-box + .link-box { margin-top: 12px; }
.link-box-label {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; margin-bottom: 8px;
}
.link-box-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-box-row input {
  flex: 1 1 240px; min-width: 0; font-size: .84rem;
  padding: 9px 12px; border-radius: 9px;
  border: 1px solid rgba(79, 70, 229, .18); background: #fff;
}
.link-box-row .btn { flex: 0 0 auto; }
.link-box .hint { margin-top: 8px; }

/* ---------- Phase 3: option editor, tag weights, test/preview ---------- */
.option-editor { display: grid; gap: 14px; }
.option-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, .58);
}
.option-row.is-empty { background: rgba(255, 255, 255, .3); border-style: dashed; }
.option-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.option-row-tools label { display: flex; align-items: center; gap: 8px; }
.option-row-tools select { width: auto; padding: 5px 10px; font-size: .82rem; }
.option-row .form-grid { gap: 0 16px; }
.option-row .field { margin-bottom: 0; }

.weight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.weight-field { display: flex; flex-direction: column; gap: 4px; }
.weight-field-label { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: #423d63; }
.weight-field input { padding: 7px 10px; font-size: .86rem; }
.weight-field.is-archived { opacity: .6; }

.row-archived { opacity: .62; }
.row-archived td { background: rgba(240, 239, 248, .5); }

.test-question {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, .5);
}
.test-question-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.test-options { display: grid; gap: 6px; margin-top: 10px; }
.test-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, .7); font-size: .88rem; cursor: pointer;
}
.test-option:hover { border-color: rgba(79, 70, 229, .4); }
.test-option input { width: auto; flex: 0 0 auto; }
.test-option span:first-of-type { flex: 1 1 auto; }
.test-option-score { font-size: .74rem; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.test-option:has(input:checked) { border-color: var(--indigo); background: linear-gradient(135deg, rgba(79, 70, 229, .08), rgba(139, 92, 246, .08)); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 272px; z-index: 40;
    transform: translateX(-104%); transition: transform .22s ease; height: 100vh;
    box-shadow: 0 20px 40px rgba(31, 27, 58, .2);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(31, 27, 58, .35);
    z-index: 30; backdrop-filter: blur(2px);
  }
  .only-mobile { display: inline-flex; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .public-shell { grid-template-columns: 1fr; gap: 26px; }
  .public-brand { text-align: left; }
  .aff-nav { width: 100%; margin-left: 0; }
  .aff-topbar-inner { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .content { padding: 22px 16px 44px; }
  .card { padding: 20px; }
  .dl { grid-template-columns: 1fr; gap: 4px 0; }
  .dl dd { margin-bottom: 12px; }
  .stat-value { font-size: 1.7rem; }
  .topbar-user-name { display: none; }
  .benefit-row-head .row-actions { margin-left: 0; }
  .checklist-item { flex-wrap: wrap; }
  .checklist-action { margin-left: 0; }
}

/* ---------- Analytics: funnel visualisation (additive, admin + affiliate) ---------- */
.funnel-viz { display: flex; flex-direction: column; gap: 4px; }
.funnel-stage { display: flex; flex-direction: column; gap: 8px; }
.funnel-stage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.funnel-stage-label { font-weight: 650; font-size: .95rem; color: var(--ink); }
.funnel-metric-label { font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel-track { height: 14px; border-radius: 999px; background: rgba(79, 70, 229, .1); overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4F46E5, #8B5CF6); }
.funnel-arrow { padding: 4px 2px; font-size: .85rem; color: var(--muted); }
.funnel-arrow strong { color: var(--ink); }
