/* ==========================================================================
   Practice Freedom Scorecard: Passive Income Dentist brand
   Palette and type taken from passiveincome.dentist
   ========================================================================== */

:root {
  --ink: #2a2520;
  --ink-soft: #4a4440;
  --ink-muted: #6e6660;
  --purple: #c069ee;
  --purple-deep: #9a4fd0;
  --purple-light: #d9a8f2;
  --lav-50: #faf5fe;
  --lav-100: #f1e6fa;
  --lav-200: #e5d2f4;
  --peach: #e6b5a5;
  --peach-soft: #f5e9e3;
  --sage: #3e7a5c;
  --white: #ffffff;
  --line: #ebe0f3;

  --low: #c4553f;
  --mid: #d9962b;
  --high: #3e7a5c;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Jost', 'Inter', system-ui, sans-serif;
  --font-accent: 'Playfair Display', Georgia, serif;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(42, 37, 32, .04), 0 8px 28px rgba(110, 60, 150, .08);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--lav-50);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--purple-deep); }
a:hover { color: var(--ink); }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 .5em;
}
h1 em, h2 em {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  color: var(--purple-deep);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 760px; }
.wrap.tiny { max-width: 440px; }
.wrap.wide { max-width: 1240px; }

.eyebrow {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--purple-deep);
  margin: 0 0 12px;
}

/* ---- Header / footer ---------------------------------------------------- */

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-text { font-family: var(--font-head); font-weight: 700; font-size: 20px; }

.site-footer {
  padding: 40px 0 48px;
  color: var(--ink-muted);
  font-size: 14px;
  text-align: center;
}
.site-footer a { color: inherit; }

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--purple-deep);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(154, 79, 208, .28);
}
.btn-primary:hover { background: #8740bd; color: var(--white); box-shadow: 0 8px 24px rgba(154, 79, 208, .36); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--purple); color: var(--ink); }
.btn-light { background: var(--white); color: var(--ink); }
.btn-light:hover { background: var(--lav-100); color: var(--ink); }
.btn-lg { padding: 16px 28px; font-size: 17px; }
.btn-link { color: var(--ink-muted); font-size: 14px; }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--purple-light); outline-offset: 2px; }

/* ---- Cards & alerts ----------------------------------------------------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 0 0 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 18px;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 0 0 20px;
  font-weight: 500;
}
.alert-error { background: #fbeae6; color: #8a3323; border: 1px solid #f1c9bf; }

/* ---- Survey ------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 64px 0 44px;
  text-align: center;
  background:
    radial-gradient(600px 300px at 85% 0%, rgba(192, 105, 238, .18), transparent 70%),
    radial-gradient(500px 260px at 0% 100%, rgba(230, 181, 165, .30), transparent 70%),
    var(--lav-50);
}
.hero h1 { font-size: clamp(34px, 6vw, 54px); margin-bottom: 18px; }
.lede { font-size: 18px; color: var(--ink-soft); max-width: 620px; margin: 0 auto; }

.progress {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(250, 245, 254, .94);
  backdrop-filter: blur(6px);
  padding: 14px 0 10px;
  margin: 0 0 12px;
}
.progress-bar { height: 8px; background: var(--lav-200); border-radius: 99px; overflow: hidden; }
.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--peach), var(--purple), var(--purple-deep));
  border-radius: 99px;
  transition: width .35s ease;
}
.progress-label { margin: 6px 0 0; font-size: 13px; color: var(--ink-muted); text-align: right; }

fieldset.card { min-width: 0; }
/* float keeps the legend inside the card instead of on its border */
.question legend, .contact legend { float: left; width: 100%; padding: 0; margin-bottom: 18px; }
.question legend + *, .contact legend + * { clear: both; }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.q-num {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  color: var(--white);
  background: var(--ink);
  border-radius: 8px;
  padding: 2px 8px;
  letter-spacing: .04em;
}
.q-cat { font-size: 13px; font-weight: 600; color: var(--purple-deep); letter-spacing: .04em; }
.q-text { display: block; font-family: var(--font-head); font-size: 21px; font-weight: 600; line-height: 1.3; }
.q-help { display: block; color: var(--ink-muted); margin-top: 4px; font-size: 15px; }

.options { display: grid; gap: 10px; }
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.option:hover { border-color: var(--purple-light); background: var(--lav-50); }
.option input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid #cbbbd8;
  border-radius: 50%;
  background: var(--white);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.option input::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple-deep);
  transform: scale(0);
  transition: transform .15s ease;
}
.option input:checked { border-color: var(--purple-deep); }
.option input:checked::after { transform: scale(1); }
.option:has(input:checked) { border-color: var(--purple-deep); background: var(--lav-100); }
.option span { font-size: 16px; }

.has-error { border-color: #e8b3a6; }
.field-error { color: #a63d28; font-size: 14px; font-weight: 500; margin: 10px 0 0; }

.field { margin: 0 0 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.field input {
  width: 100%;
  font: inherit;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
}
.field input:focus { border-color: var(--purple); outline: none; box-shadow: 0 0 0 4px rgba(192, 105, 238, .15); }
.field.has-error input { border-color: #d98a78; }
.req { color: var(--purple-deep); }
.optional { color: var(--ink-muted); font-weight: 400; }

.contact { background: linear-gradient(180deg, var(--white), var(--lav-50)); }
.contact .btn { width: 100%; margin-top: 6px; }
.fine-print { text-align: center; font-size: 13px; color: var(--ink-muted); margin: 12px 0 0; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Report ------------------------------------------------------------- */

.report-toolbar { background: var(--white); border-bottom: 1px solid var(--line); }
.report-toolbar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }

.report-hero {
  background:
    radial-gradient(500px 240px at 90% 10%, rgba(192, 105, 238, .35), transparent 70%),
    radial-gradient(400px 200px at 5% 100%, rgba(230, 181, 165, .22), transparent 70%),
    var(--ink);
  color: var(--lav-50);
  padding: 48px 0 96px;
}
.report-hero .eyebrow { color: var(--purple-light); }
.report-hero h1 { font-size: clamp(30px, 5vw, 46px); color: var(--white); margin-bottom: 8px; }
.report-hero h1 em { color: var(--purple-light); }
.practice-name { margin: 0; font-size: 18px; color: #d8cfd9; }

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 20px;
  margin: -64px 0 20px;
}
.report-grid .card { margin: 0; }
.score-card { text-align: center; }

.chart { display: block; width: 100%; height: auto; }
.chart-gauge { max-width: 300px; margin: 0 auto; }
.g-track { fill: none; stroke: var(--lav-100); stroke-width: 22; stroke-linecap: round; }
.g-fill { fill: none; stroke-width: 22; stroke-linecap: round; }
.g-tick { stroke: #d6c6e2; stroke-width: 2; stroke-linecap: round; }
.g-marker { fill: var(--white); stroke: var(--purple-deep); stroke-width: 4; }
.g-score { font-family: var(--font-head); font-weight: 700; font-size: 62px; fill: var(--ink); }
.g-outof { font-size: 13px; fill: var(--ink-muted); letter-spacing: .08em; text-transform: uppercase; }

.band {
  display: inline-block;
  margin: 10px 0 10px;
  padding: 6px 16px;
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
}
.band-low { background: #fbe9e4; color: var(--low); }
.band-mid { background: #fbf0dc; color: #a46a0d; }
.band-high { background: #e3f0e8; color: var(--high); }
.band-summary { color: var(--ink-soft); margin: 0; font-size: 15px; }

.chart-radar { max-width: 520px; margin: 0 auto; }
.r-grid { fill: none; stroke: var(--line); stroke-width: 1.2; }
.r-grid:last-of-type { stroke: #d9c8e6; }
.r-axis { stroke: var(--line); stroke-width: 1.2; }
.r-area { fill: rgba(192, 105, 238, .22); stroke: var(--purple-deep); stroke-width: 2.5; stroke-linejoin: round; }
.r-dot { fill: var(--white); stroke: var(--purple-deep); stroke-width: 3; }
.r-label { font-family: var(--font-head); font-size: 14px; font-weight: 600; fill: var(--ink); }
.r-value { font-family: var(--font-body); font-weight: 600; fill: var(--purple-deep); }
.chart-note { text-align: center; color: var(--ink-muted); font-size: 13px; margin: 4px 0 0; }

.area-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.area-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.area-name { font-weight: 600; }
.area-pct { font-family: var(--font-head); font-weight: 700; font-size: 18px; }
.bar { height: 12px; background: var(--lav-100); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; }

.level-low { color: var(--low); }
.level-mid { color: var(--mid); }
.level-high { color: var(--high); }
.bar-fill.level-low, .swatch.level-low { background: var(--low); }
.bar-fill.level-mid, .swatch.level-mid { background: var(--mid); }
.bar-fill.level-high, .swatch.level-high { background: var(--high); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 22px 0 0; font-size: 13px; color: var(--ink-muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: 0; }

.section-title { font-size: 26px; margin: 36px 0 16px; }
.focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.focus-card { margin: 0; border-top: 4px solid var(--purple); }
.focus-rank { font-size: 13px; font-weight: 600; color: var(--purple-deep); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.focus-card h3 { font-size: 21px; }
.focus-card p:last-child { margin: 0; color: var(--ink-soft); }

.answers { margin-top: 36px; }
.answer-list { list-style: none; margin: 0; padding: 0; }
.answer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.answer:first-child { border-top: 0; padding-top: 0; }
.answer .q-num { align-self: start; margin-top: 2px; }
.answer-q { margin: 0; font-size: 14px; color: var(--ink-muted); }
.answer-a { margin: 2px 0 0; font-weight: 600; }

.dots { display: inline-flex; gap: 5px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--lav-100); border: 1px solid var(--lav-200); }
.level-low .dot.on { background: var(--low); border-color: var(--low); }
.level-mid .dot.on { background: var(--mid); border-color: var(--mid); }
.level-high .dot.on { background: var(--high); border-color: var(--high); }

.cta {
  margin: 36px 0 0;
  padding: 44px 36px;
  border-radius: var(--radius);
  text-align: center;
  color: var(--lav-50);
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(192, 105, 238, .45), transparent 70%),
    linear-gradient(135deg, var(--ink), #3d2a4a);
}
.cta .eyebrow { color: var(--purple-light); }
.cta h2 { color: var(--white); font-size: clamp(26px, 4vw, 34px); }
.cta p { max-width: 600px; margin: 0 auto 24px; color: #e6dcea; }
.print-only { display: none; }

/* ---- Admin -------------------------------------------------------------- */

.admin { padding-top: 36px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head h1 { font-size: 34px; margin: 0; }
.admin-actions { display: flex; gap: 10px; align-items: center; }
.admin-actions form { margin: 0; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.stat { display: flex; flex-direction: column; padding: 20px 24px; }
.stat-label { font-size: 13px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat-value { font-family: var(--font-head); font-size: 36px; font-weight: 700; }

.search { display: flex; gap: 10px; align-items: center; margin: 4px 0 20px; }
.search input {
  flex: 1;
  max-width: 420px;
  font: inherit;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}

.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); background: var(--lav-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--lav-50); }
.table .num { text-align: right; }
.nowrap { white-space: nowrap; }
.score-pill { display: inline-block; min-width: 40px; text-align: center; padding: 2px 10px; border-radius: 99px; font-weight: 700; color: var(--white); }
.score-pill.level-low { background: var(--low); }
.score-pill.level-mid { background: var(--mid); }
.score-pill.level-high { background: var(--high); }
.empty { padding: 32px; text-align: center; color: var(--ink-muted); margin: 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; color: var(--ink-muted); }

.login-card { margin-top: 64px; }
.login-card .btn { width: 100%; }

.error-page { padding: 80px 20px; text-align: center; }
.debug { text-align: left; white-space: pre-wrap; background: var(--white); border: 1px solid var(--line); padding: 16px; border-radius: var(--radius-sm); font-size: 12px; overflow: auto; }

/* ---- Small screens ------------------------------------------------------ */

@media screen and (max-width: 760px) {
  .report-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .q-text { font-size: 19px; }
  .answer { grid-template-columns: auto 1fr; }
  .answer-score { grid-column: 2; }
  .cta { padding: 32px 20px; }
  .r-label { font-size: 21px; }
}

/* ---- Print / PDF -------------------------------------------------------- */

@page { size: letter; margin: 0.45in; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: var(--white); font-size: 12.5px; }
  .no-print, .site-footer { display: none !important; }
  .print-only { display: block; }

  .site-header { border: 0; }
  .header-inner { min-height: 0; padding-bottom: 10px; }
  .wrap { max-width: none; padding: 0; }

  .card { box-shadow: none; padding: 16px 20px; margin-bottom: 12px; break-inside: avoid; }
  .card-title { margin-bottom: 10px; font-size: 12px; }
  .report-hero { padding: 22px 24px 64px; border-radius: var(--radius); }
  .report-hero h1 { font-size: 28px; }
  .report-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; margin: -48px 0 12px; padding: 0 14px; }
  .chart-gauge { max-width: 220px; }
  .chart-radar { max-width: 400px; }
  .r-label { font-size: 17px; }
  .band-summary { font-size: 12px; }
  .area-bars { gap: 10px; }
  .legend { margin-top: 14px; }

  /* Page 1: summary. Page 2: priorities, answers and next step. */
  .page-break-before { break-before: page; }
  .focus .section-title { margin: 0 0 10px; font-size: 20px; }
  .focus-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .focus-card { break-inside: avoid; padding: 12px 16px; }
  .focus-card p:last-child { font-size: 11.5px; }
  .focus-card h3 { font-size: 17px; }

  .answers { margin-top: 12px; break-inside: auto; }
  .answer { padding: 4px 0; gap: 12px; break-inside: avoid; }
  .answer-q { font-size: 11px; }
  .answer-a { font-size: 12px; }
  .dot { width: 10px; height: 10px; }

  .cta { break-inside: avoid; padding: 16px 26px; margin-top: 10px; }
  .cta .eyebrow { margin-bottom: 4px; }
  .cta p { font-size: 11.5px; }
  .cta h2 { font-size: 22px; }
  .cta p { margin-bottom: 10px; }
  .cta .btn { display: none; }
  .cta-url { font-weight: 600; color: var(--white); margin: 0 auto; }
  a { text-decoration: none; }
}
