/* Career Compass — Design System
   Clean, professional, trust-building.
   Serif headings + sans body, calm palette, rounded but restrained. */

:root {
  --ink-900: #0f1530;
  --ink-700: #2a3354;
  --ink-500: #5a6485;
  --ink-300: #9aa3bf;
  --ink-100: #e7eaf3;
  --paper:   #fbfaf6;
  --card:    #ffffff;
  --line:    #e5e3da;
  --line-strong: #c9c5b6;

  --accent:        #1a4ad6;   /* deep blue, primary */
  --accent-soft:   #e7edff;
  --accent-deep:   #102d8b;
  --gold:          #b8893d;
  --gold-soft:     #fbf3e0;

  --r-realistic:   #b86b3a;
  --r-investigative:#1f6f8b;
  --r-artistic:    #8e3e8c;
  --r-social:      #2f8f5b;
  --r-enterprising:#c34a3a;
  --r-conventional:#5d6e93;

  --high:    #1f8a4f;
  --high-bg: #e8f4ed;
  --mid:     #b8893d;
  --mid-bg:  #fbf3e0;
  --low:     #93704a;
  --low-bg:  #f4eddb;

  --danger:  #c0392b;
  --warn:    #c47f1f;
  --ok:      #1f8a4f;

  --radius:   10px;
  --radius-lg:14px;
  --shadow-sm: 0 1px 2px rgba(15,21,48,.05);
  --shadow:    0 4px 16px rgba(15,21,48,.08);
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-700);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 {
  font-family: 'Crimson Pro', Georgia, serif;
  color: var(--ink-900);
  font-weight: 600;
  margin: 0 0 .4em;
  letter-spacing: -.01em;
}
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 18px; line-height: 1.25; }
h4 { font-size: 15px; line-height: 1.3; font-family: 'Inter', sans-serif; font-weight: 600; }

p { margin: 0 0 .9em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--ink-500); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 50;
}
.topbar .row { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: nowrap; }
.topbar .container { max-width: 1320px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink-900); font-weight: 600; text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--ink-900); }
.brand > span { display: inline-flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; display: grid; place-items: center; font-family: 'Crimson Pro', serif;
  font-weight: 700; font-size: 18px; letter-spacing: -1px;
  flex-shrink: 0;
}
.brand .mark-logo {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  width: auto; height: 38px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 0;
}
.brand .mark-logo img {
  height: 22px; max-width: 140px; width: auto; display: block;
  object-fit: contain;
}
.brand .title { font-family: 'Crimson Pro', serif; font-size: 20px; white-space: nowrap; }
.brand .sub { color: var(--ink-500); font-size: 12px; margin-left: 6px; white-space: nowrap; }
.brand-auth { justify-content: center; margin-bottom: 18px; flex-direction: column; text-align: center; gap: 8px; }
.brand-auth > span { flex-direction: column; gap: 4px; }
.brand-auth .title { white-space: normal; }
.brand-auth .sub { margin-left: 0; }
/* Letter-tile sizing applies only when there's NO uploaded logo */
.brand-auth .mark:not(.mark-logo) { width: 40px; height: 40px; font-size: 22px; }
/* Logo box: width auto (so it sizes to image width) — explicit so no other
   .brand-auth rule can override it. */
.brand-auth .mark-logo { width: auto; height: 56px; padding: 8px 16px; }
.brand-auth .mark-logo img { height: 32px; max-width: 220px; }
.brand-auth .title { font-size: 22px; }

.nav { display: flex; align-items: center; gap: 18px; flex-wrap: nowrap; }
.nav a { color: var(--ink-700); font-size: 14px; white-space: nowrap; }
.nav a:hover { color: var(--ink-900); text-decoration: none; }
.nav a.active { color: var(--accent); font-weight: 600; }

.user-pill {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px;
  background: var(--ink-100); border-radius: 999px; font-size: 13px;
  white-space: nowrap; flex-shrink: 0;
}
.avatar { width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px;
}

/* ---------- Page ---------- */
main.page { padding: 32px 0 64px; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--ink-500); font-size: 14px; }
.crumbs { color: var(--ink-500); font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--ink-500); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card .head { display: flex; justify-content: space-between; align-items: center; margin: -22px -22px 18px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(to bottom, #fdfcf7, #fff); border-radius: var(--radius) var(--radius) 0 0; }
.card .head h3 { margin: 0; }
.card.flat { box-shadow: none; }
.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card-grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px;
  padding: 0 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 500; font-size: 14px;
  line-height: 1.2;
  cursor: pointer; transition: all .15s; text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-deep); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-700); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--ink-100); color: var(--ink-900); }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #9d7232; }
.btn.danger { background: var(--danger); }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }

.btn-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
/* Forms inside a btn-row flow as transparent containers so each button
   participates in the parent's flex layout instead of stacking. */
.btn-row > form,
.btn-row > form[style*="inline"] {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0;
}
/* Ensure inputs/selects and buttons align to the same baseline height */
.btn-row .input, .btn-row .select { height: 40px; padding-top: 0; padding-bottom: 0; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--ink-700); font-weight: 500; margin-bottom: 6px; }
label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; font: inherit; color: var(--ink-900);
  transition: border .15s, box-shadow .15s;
  line-height: 1.4;
}
.input, .select { height: 40px; padding-top: 0; padding-bottom: 0; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,74,214,.12);
}
.field { margin-bottom: 16px; }
.field .help { font-size: 12px; color: var(--ink-500); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); padding: 12px 14px; background: #fbfaf6; border-bottom: 1px solid var(--line); }
.table td { padding: 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table tr:hover td { background: #fbfaf6; }
.table .nowrap { white-space: nowrap; }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--ink-100); color: var(--ink-700); font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}
.pill.high { background: var(--high-bg); color: var(--high); }
.pill.mid { background: var(--mid-bg); color: var(--mid); }
.pill.low { background: var(--low-bg); color: var(--low); }
.pill.accent { background: var(--accent-soft); color: var(--accent-deep); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.danger { background: #fce8e6; color: var(--danger); }

/* ---------- Empty / hero ---------- */
.empty { text-align: center; padding: 56px 32px; color: var(--ink-500); }
.empty h3 { color: var(--ink-700); margin-bottom: 8px; }

/* ---------- Flash messages ---------- */
.flash {
  padding: 12px 16px; margin-bottom: 16px; border-radius: 8px;
  border: 1px solid; font-size: 14px;
}
.flash.info { background: var(--accent-soft); border-color: #c5d2f8; color: var(--accent-deep); }
.flash.warn { background: var(--mid-bg); border-color: #ecd9a3; color: var(--mid); }
.flash.error { background: #fce8e6; border-color: #f3c0bb; color: var(--danger); }
.flash.success { background: var(--high-bg); border-color: #b9dec9; color: var(--high); }

/* ---------- Auth pages ---------- */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f1e8 0%, #ecf0fa 100%);
  display: grid; place-items: center; padding: 24px;
}
.auth-card {
  background: #fff; max-width: 420px; width: 100%;
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.auth-card .brand { justify-content: center; margin-bottom: 18px; }
.auth-card h1 { text-align: center; font-size: 24px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--ink-500); margin-bottom: 24px; font-size: 14px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); }
.stat .val { font-family: 'Crimson Pro', serif; font-size: 30px; color: var(--ink-900); margin-top: 4px; }
.stat .delta { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ---------- Bars ---------- */
.bar { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.bar-label { width: 168px; font-size: 13.5px; color: var(--ink-700); flex-shrink: 0; }
.bar-track { flex: 1; height: 10px; background: var(--ink-100); border-radius: 999px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #4a7cff); }
.bar-fill.r { background: var(--r-realistic); }
.bar-fill.i { background: var(--r-investigative); }
.bar-fill.a { background: var(--r-artistic); }
.bar-fill.s { background: var(--r-social); }
.bar-fill.e { background: var(--r-enterprising); }
.bar-fill.c { background: var(--r-conventional); }
.bar-value { width: 50px; text-align: right; font-size: 13px; color: var(--ink-700); font-feature-settings: "tnum"; flex-shrink: 0; }

/* ---------- Likert (assessment screen) ---------- */
.assessment-frame {
  max-width: 760px; margin: 0 auto; padding: 24px;
}
.progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.progress-track { flex: 1; height: 6px; background: var(--ink-100); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .25s; }
.progress-text { font-size: 13px; color: var(--ink-500); white-space: nowrap; }

.q-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 36px; box-shadow: var(--shadow-sm); min-height: 320px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.q-meta { font-size: 12px; color: var(--ink-500); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.q-text { font-family: 'Crimson Pro', serif; font-size: 24px; line-height: 1.3; color: var(--ink-900); margin: 6px 0 24px; }

.likert {
  display: grid; gap: 10px;
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 600px) { .likert { grid-template-columns: 1fr; } }
.likert label {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 10px; border: 2px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: all .15s;
  background: #fff; text-align: center; gap: 6px;
}
.likert label:hover { border-color: var(--ink-300); background: #fbfaf6; }
.likert label .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-300); }
.likert label .lbl { font-size: 12.5px; color: var(--ink-700); font-weight: 500; line-height: 1.2; }
.likert input { display: none; }
.likert input:checked + .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px rgba(26,74,214,.18); }
.likert label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; }

/* ---------- Report ---------- */
.report { max-width: 880px; margin: 0 auto; }
.report-cover {
  background: linear-gradient(135deg, #102d8b 0%, #1a4ad6 100%);
  color: #fff; padding: 56px 48px; border-radius: var(--radius-lg);
  margin-bottom: 28px;
}
.report-cover h1 { color: #fff; font-size: 36px; line-height: 1.1; margin-bottom: 8px; }
.report-cover .meta { display: flex; gap: 24px; flex-wrap: wrap; opacity: .85; font-size: 14px; margin-top: 18px; }

.report-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 18px; }
.report-section h2 { font-size: 24px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* Consultant's personal note in the body of the report (visible to the family). */
.report-section.consultant-note {
  background: linear-gradient(135deg, #fffdf3 0%, #fdf6dd 100%);
  border: 1px solid #e9d59a;
  border-left: 4px solid var(--gold);
}
.report-section.consultant-note .kicker { color: var(--gold); }
.report-section.consultant-note h2 { border-bottom-color: #e9d59a; color: #6b4f1d; }
.report-section.consultant-note .consultant-note-body {
  font-size: 15.5px;
  line-height: 1.75;
  color: #4f3a14;
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
}

.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; margin-bottom: 4px; }

.callout {
  padding: 18px 22px; border-radius: var(--radius); border-left: 4px solid;
  background: #fbfaf6; margin: 16px 0;
}
.callout.science { border-color: var(--accent); background: var(--accent-soft); }
.callout.caveat { border-color: var(--gold); background: var(--gold-soft); }
.callout h4 { margin: 0 0 6px; color: var(--ink-900); }
.callout p { margin: 0; font-size: 14px; }

.zone-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 14px; background: #fff;
}
.zone-card.top { border-color: var(--accent); border-width: 2px; box-shadow: 0 4px 16px rgba(26,74,214,.1); }
.zone-card .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.zone-card h3 { margin: 0; }
.zone-card .score-pill { background: var(--accent); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.zone-card .careers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.career-tag { padding: 4px 10px; background: var(--ink-100); color: var(--ink-700); border-radius: 6px; font-size: 12.5px; }

.upsell-box {
  background: linear-gradient(135deg, #fbf3e0 0%, #f9ecd0 100%);
  border: 1px solid #e9d59a; border-radius: var(--radius-lg);
  padding: 28px; margin: 24px 0;
}
.upsell-box h3 { color: #6b4f1d; margin-bottom: 8px; font-size: 22px; }
.upsell-box .checks { margin: 12px 0 16px; padding: 0; list-style: none; }
.upsell-box .checks li { padding: 4px 0 4px 26px; position: relative; color: #6b4f1d; font-size: 14px; }
.upsell-box .checks li:before {
  content: "✓"; position: absolute; left: 0; top: 2px;
  width: 18px; height: 18px; background: var(--gold); color: #fff;
  border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

/* ---------- Print (baseline; report pages inject @page rules dynamically) ---------- */
@media print {
  body { background: #fff; font-size: 10.5pt; }

  /* Hide everything that's only useful on screen */
  .topbar, .nav, .no-print, .btn, .flash, footer, .crumbs, .page-head .btn-row { display: none !important; }

  .container, .container-narrow, .container-wide { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }

  /* Card-like containers must never split across pages */
  .card, .report-section, .zone-card, .callout, .upsell-box, .stat,
  .auth-card, .q-card { break-inside: avoid !important; page-break-inside: avoid !important; }

  /* Headings should sit with their following content */
  h1, h2, h3, h4 { break-after: avoid; page-break-after: avoid; }

  /* Avoid splitting bars / pills */
  .bar, .career-tag, .pill, .score-pill { break-inside: avoid; }

  /* Coloured backgrounds + cover gradient must print */
  .report-cover, .upsell-box, .pill, .callout, .zone-card.top, .bar-fill,
  .score-pill, .career-tag, .kicker { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  a { color: inherit !important; text-decoration: none !important; }
  p, li { orphans: 3; widows: 3; }

  /* Cover always ends a page; padding inside cover stays generous */
  .report-cover {
    break-after: page !important;
    page-break-after: always !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  /* Strip section borders/shadows/padding so the @page header doesn't clash with section frames */
  .report-section {
    box-shadow: none !important;
    border: 0 !important;
    padding: 6mm 0 !important;
    margin: 0 !important;
    break-before: auto;
  }
  .card, .zone-card { box-shadow: none !important; }
}

/* Utility */
.flex { display: flex; gap: 12px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-500); }
.text-small { font-size: 13px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
