@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

  /* ----------  RRG Brand System  ---------- */
  :root {
    --navy:       #0F1F47;
    --teal:       #1D9E75;
    --gold:       #D4A537;
    --stone:      #F1EFE8;
    --paper:      #FAFAF7;
    --charcoal:   #2C2C2A;
    --gray:       #888780;
    --gray-soft:  #D9D7CF;
    --white:      #FFFFFF;
    --danger:     #8a2a2a;

    --shadow-sm:  0 1px 2px rgba(15,31,71,0.06);
    --shadow-md:  0 4px 12px rgba(15,31,71,0.08);
    --shadow-lg:  0 12px 32px rgba(15,31,71,0.12);

    --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }

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

  html, body {
    margin: 0; padding: 0;
    background: var(--paper); color: var(--charcoal);
    font-family: var(--sans);
    font-size: 16px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }

  .wrap { max-width: 880px; margin: 0 auto; padding: 0 24px 80px; }

  .print-header { display: none; }

  /* ----------  Screen header  ---------- */
  .header {
    background: var(--navy); color: var(--white);
    padding: 48px 24px 56px;
    border-bottom: 6px solid var(--gold);
  }
  .header-inner { max-width: 880px; margin: 0 auto; }
  .header-brand-row {
    display: flex; align-items: center; gap: 16px; margin-bottom: 32px;
  }
  .header-logo { width: 44px; height: 56px; flex-shrink: 0; }
  .header-brand-text { display: flex; flex-direction: column; }
  .brand-eyebrow {
    font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--gold); font-weight: 700; margin: 0 0 4px;
  }
  .brand-tagline {
    font-style: italic; color: rgba(255,255,255,0.78);
    font-size: 14.5px; margin: 0;
  }
  .title-block { border-top: 1px solid rgba(255,255,255,0.18); padding-top: 28px; }
  .title-eyebrow {
    font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--teal); font-weight: 700; margin-bottom: 10px;
  }
  .title {
    font-family: var(--serif); font-size: 42px; line-height: 1.1;
    margin: 0 0 12px; font-weight: 700;
  }
  .subtitle {
    font-size: 17px; color: rgba(255,255,255,0.82);
    max-width: 620px; margin: 0;
  }

  /* ----------  Intro  ---------- */
  .intro {
    background: var(--stone); padding: 28px 32px;
    border-left: 4px solid var(--teal);
    margin: 32px 0 24px;
    font-size: 15.5px; color: var(--charcoal);
  }
  .intro strong { color: var(--navy); }
  .intro p { margin: 0 0 10px; }
  .intro p:last-child { margin-bottom: 0; }

  /* ----------  Form  ---------- */
  form { margin: 0; }
  .question {
    background: var(--white);
    border: 1px solid var(--gray-soft); border-radius: 4px;
    padding: 24px 28px; margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
  }
  .question:hover { box-shadow: var(--shadow-md); border-color: var(--gray); }
  .q-number {
    display: inline-block;
    font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
    color: var(--teal); font-weight: 700; margin-bottom: 6px;
  }
  .q-text {
    display: block; font-size: 17px; font-weight: 600;
    color: var(--navy); margin-bottom: 4px; line-height: 1.35;
  }
  .q-hint {
    display: block; font-size: 13.5px; color: var(--gray);
    margin-bottom: 16px; font-style: italic;
  }
  .options { display: flex; flex-direction: column; gap: 8px; }
  .option {
    display: flex; align-items: flex-start;
    padding: 10px 14px;
    border: 1px solid var(--gray-soft); border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--paper);
    font-size: 14.5px; line-height: 1.45;
  }
  .option:hover { border-color: var(--teal); background: var(--white); }
  .option input { margin: 3px 12px 0 0; accent-color: var(--teal); flex-shrink: 0; }
  .option input:checked + span { color: var(--navy); font-weight: 600; }
  .option:has(input:checked) {
    border-color: var(--teal);
    background: rgba(29,158,117,0.06);
  }

  .form-actions {
    display: flex; gap: 12px; justify-content: flex-end;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--gray-soft);
  }

  /* ----------  Buttons  ---------- */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px;
    font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
    border: 1px solid transparent; border-radius: 3px;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s ease;
    font-family: inherit;
  }
  .btn-primary { background: var(--navy); color: var(--white); }
  .btn-primary:hover { background: #1a2d5e; box-shadow: var(--shadow-md); }
  .btn-gold { background: var(--gold); color: var(--navy); }
  .btn-gold:hover { background: #c4972d; box-shadow: var(--shadow-md); }
  .btn-secondary { background: var(--white); color: var(--navy); border-color: var(--navy); }
  .btn-secondary:hover { background: var(--navy); color: var(--white); }
  .btn-ghost { background: transparent; color: var(--gray); border-color: var(--gray-soft); }
  .btn-ghost:hover { color: var(--charcoal); border-color: var(--charcoal); }
  .btn-danger-ghost {
    background: transparent; color: var(--danger);
    border-color: rgba(168,56,56,0.3);
  }
  .btn-danger-ghost:hover {
    background: var(--danger); color: var(--white); border-color: var(--danger);
  }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

  /* ----------  Diagnosis  ---------- */
  #diagnosis { display: none; margin-top: 48px; scroll-margin-top: 20px; }
  #diagnosis.visible { display: block; animation: slideIn 0.4s ease; }
  @keyframes slideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .diag-banner {
    background: var(--navy); color: var(--white);
    padding: 32px 36px;
    border-top: 6px solid var(--gold);
    border-radius: 4px 4px 0 0;
  }
  .diag-eyebrow {
    font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--gold); font-weight: 700; margin-bottom: 10px;
  }
  .diag-title {
    font-family: var(--serif); font-size: 30px;
    margin: 0 0 8px; font-weight: 700;
  }
  .diag-meta { font-size: 14px; color: rgba(255,255,255,0.75); margin: 0; }

  .diag-body {
    background: var(--white);
    border: 1px solid var(--gray-soft); border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 32px 36px 36px;
    box-shadow: var(--shadow-md);
  }

  .tiles {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--gray-soft);
    border: 1px solid var(--gray-soft);
    margin-bottom: 32px;
  }
  .tile { background: var(--stone); padding: 22px 16px; text-align: center; }
  .tile-label {
    font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--gray); font-weight: 700; margin-bottom: 8px;
  }
  .tile-value {
    font-family: var(--serif); font-size: 32px; font-weight: 700;
    color: var(--navy); line-height: 1;
  }
  .tile-value.teal { color: var(--teal); }
  .tile-value.gold { color: var(--gold); }

  .gauge {
    margin: 0 0 32px;
    background: var(--stone); padding: 20px 24px;
    border-left: 4px solid var(--gold);
  }
  .gauge-label {
    font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase;
    color: var(--gray); font-weight: 700; margin-bottom: 8px;
  }
  .gauge-row { display: flex; align-items: center; gap: 16px; }
  .gauge-track {
    flex: 1; height: 12px;
    background: var(--gray-soft); border-radius: 6px;
    overflow: hidden; position: relative;
  }
  .gauge-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--teal) 0%, var(--gold) 60%, #b94545 100%);
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .gauge-number {
    font-family: var(--serif); font-size: 24px; font-weight: 700;
    color: var(--navy); min-width: 70px; text-align: right;
  }

  .summary { font-size: 16px; line-height: 1.65; color: var(--charcoal); margin-bottom: 32px; }
  .summary p { margin: 0 0 14px; }
  .summary p:last-child { margin-bottom: 0; }

  .findings-title {
    font-family: var(--serif); font-size: 22px; color: var(--navy);
    margin: 0 0 16px; padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-soft);
  }
  .finding { padding: 14px 0 16px; border-bottom: 1px solid var(--stone); }
  .finding:last-child { border-bottom: none; }
  .finding-answer {
    background: rgba(29,158,117,0.06);
    border-left: 3px solid var(--teal);
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--charcoal);
    line-height: 1.45;
  }
  .finding-answer-label {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray);
    font-weight: 700;
    margin-right: 6px;
  }
  .finding-answer-text { color: var(--navy); font-weight: 600; }
  .finding-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
  .severity {
    display: inline-block;
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    font-weight: 700; padding: 3px 8px; border-radius: 2px;
    margin-top: 3px; flex-shrink: 0;
    min-width: 76px; text-align: center;
  }
  .sev-critical { background: var(--danger); color: var(--white); }
  .sev-elevated { background: var(--gold); color: var(--navy); }
  .sev-moderate { background: var(--teal); color: var(--white); }
  .finding-title {
    font-size: 15.5px; font-weight: 600; color: var(--navy);
    line-height: 1.35; flex: 1;
  }
  .finding-detail {
    font-size: 14px; color: var(--charcoal);
    margin: 4px 0 0 88px; line-height: 1.5;
  }

  .answer-log { display: none; }

  .closing {
    background: var(--stone); padding: 22px 28px; margin-top: 32px;
    font-style: italic; color: var(--navy);
    font-size: 15px;
    border-left: 4px solid var(--teal);
  }

  .diag-actions {
    display: flex; flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between; align-items: center;
    margin-top: 36px; padding-top: 24px;
    border-top: 2px solid var(--gold);
  }
  .diag-actions-primary, .diag-actions-secondary {
    display: flex; gap: 12px; flex-wrap: wrap;
  }

  .clean-state { text-align: center; padding: 24px 0; }
  .clean-state-icon {
    font-size: 36px; color: var(--teal);
    font-family: var(--serif); margin-bottom: 8px;
  }
  .clean-state-text { font-size: 16px; color: var(--navy); font-weight: 600; }

  .footer {
    text-align: center; color: var(--gray); font-size: 12.5px;
    margin-top: 56px; padding-top: 24px;
    border-top: 1px solid var(--gray-soft);
  }
  .footer strong { color: var(--navy); }

  .validation-msg {
    background: #fef5f0; border: 1px solid var(--gold);
    color: #8a5a1a; padding: 14px 18px; border-radius: 3px;
    margin: 16px 0; font-size: 14px;
    display: none;
  }
  .validation-msg.visible { display: block; }

  /* ----------  Modal  ---------- */
  .modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,31,71,0.55);
    z-index: 1000;
    align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
  }
  .modal-backdrop.visible { display: flex; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .modal {
    background: var(--white);
    max-width: 540px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    border-radius: 4px;
    border-top: 6px solid var(--gold);
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes modalIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .modal-header { padding: 24px 28px 0; }
  .modal-eyebrow {
    font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--teal); font-weight: 700; margin-bottom: 8px;
  }
  .modal-title {
    font-family: var(--serif); font-size: 24px; color: var(--navy);
    margin: 0 0 8px; font-weight: 700;
  }
  .modal-intro { color: var(--charcoal); font-size: 14.5px; margin: 0 0 4px; line-height: 1.5; }
  .modal-body { padding: 20px 28px 8px; }
  .form-group { margin-bottom: 16px; }
  .form-label {
    display: block;
    font-size: 13px; font-weight: 600; color: var(--navy);
    margin-bottom: 6px; letter-spacing: 0.02em;
  }
  .form-label .req { color: var(--danger); margin-left: 2px; }
  .form-input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--gray-soft); border-radius: 3px;
    font-family: inherit; font-size: 14.5px; color: var(--charcoal);
    background: var(--paper);
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .form-input:focus {
    outline: none;
    border-color: var(--teal); background: var(--white);
    box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
  }
  .form-input.error { border-color: var(--danger); background: #fef5f5; }
  .consent {
    background: var(--stone);
    padding: 14px 16px;
    border-left: 3px solid var(--teal);
    margin: 16px 0 8px;
    font-size: 13px; color: var(--charcoal); line-height: 1.5;
  }
  .modal-actions {
    display: flex; justify-content: flex-end; gap: 12px;
    padding: 16px 28px 24px;
    border-top: 1px solid var(--gray-soft);
    margin-top: 8px;
  }

  .submit-state { display: none; padding: 32px 28px; text-align: center; }
  .submit-state.visible { display: block; }
  .submit-state-icon { font-family: var(--serif); font-size: 48px; line-height: 1; margin-bottom: 12px; }
  .submit-state-icon.success { color: var(--teal); }
  .submit-state-icon.error { color: var(--danger); }
  .submit-state-title {
    font-family: var(--serif); font-size: 22px; color: var(--navy);
    margin: 0 0 8px; font-weight: 700;
  }
  .submit-state-message { color: var(--charcoal); font-size: 14.5px; line-height: 1.55; margin: 0 0 16px; }
  .spinner {
    display: inline-block;
    width: 36px; height: 36px;
    border: 3px solid var(--gray-soft);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ----------  Responsive  ---------- */
  @media (max-width: 600px) {
    .header { padding: 36px 20px 40px; }
    .title { font-size: 32px; }
    .diag-banner, .diag-body { padding: 24px 20px; }
    .diag-title { font-size: 24px; }
    .tiles { grid-template-columns: 1fr; }
    .finding-detail { margin-left: 0; margin-top: 10px; }
    .form-actions, .diag-actions { flex-direction: column; align-items: stretch; }
    .diag-actions-primary, .diag-actions-secondary { width: 100%; }
    .btn { justify-content: center; }
    .modal-header, .modal-body, .modal-actions { padding-left: 20px; padding-right: 20px; }
  }

  /* ============================================================
     PRINT STYLES — branded leave-behind, not a screen capture
     ============================================================ */
  @media print {
    @page { margin: 0.45in 0.5in 0.55in; size: letter; }

    body { background: var(--white) !important; font-size: 9.5pt; color: var(--charcoal); line-height: 1.4; }

    .header, .intro, form, .form-actions, .diag-actions,
    .footer, .modal-backdrop, .answer-log {
      display: none !important;
    }

    #diagnosis { display: block !important; margin-top: 0; }
    #diagnosis.visible { animation: none; }

    .wrap { max-width: 100%; padding: 0; margin: 0; }

    .print-header {
      display: block;
      border-bottom: 2px solid var(--gold);
      padding-bottom: 8px; margin-bottom: 16px;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .print-header-top {
      display: flex; justify-content: space-between;
      align-items: flex-end; gap: 18px;
    }
    .print-logo-block { display: flex; align-items: center; gap: 10px; }
    .print-logo { width: 32px; height: 40px; flex-shrink: 0; }
    .print-brand-name {
      font-family: var(--serif); font-size: 13pt; font-weight: 700;
      color: var(--navy); margin: 0; line-height: 1.15;
    }
    .print-brand-tagline {
      font-style: italic; font-size: 7.5pt; color: var(--gray); margin: 0;
    }
    .print-contact {
      text-align: right; font-size: 7.5pt;
      color: var(--charcoal); line-height: 1.4;
    }
    .print-contact a { color: var(--teal); text-decoration: none; }
    .print-contact-label {
      color: var(--gray); font-size: 6.5pt;
      letter-spacing: 0.1em; text-transform: uppercase;
      margin-right: 4px;
    }

    .diag-banner {
      background: var(--navy) !important; color: var(--white) !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
      page-break-after: avoid;
      padding: 14px 18px 16px; border-radius: 0;
      border-top: 3px solid var(--gold) !important;
    }
    .diag-eyebrow { font-size: 7pt; margin-bottom: 5px; line-height: 1; }
    .diag-title { font-size: 16pt; margin: 0 0 6px; line-height: 1.1; }
    .diag-meta { font-size: 8pt; margin: 0; line-height: 1.2; color: rgba(255,255,255,0.8); }

    .diag-body {
      box-shadow: none; border: 1px solid var(--gray-soft); border-top: none;
      padding: 14px 16px;
    }

    .tiles {
      page-break-inside: avoid;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
      margin-bottom: 14px;
    }
    .tile { background: var(--stone) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; padding: 10px 8px; }
    .tile-value { font-size: 17pt; }
    .tile-label { font-size: 6.5pt; margin-bottom: 4px; }

    .gauge {
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
      page-break-inside: avoid;
      padding: 10px 14px;
      margin-bottom: 14px;
    }
    .gauge-label { font-size: 7.5pt; margin-bottom: 4px; }
    .gauge-number { font-size: 14pt; min-width: 56px; }
    .gauge-track { height: 9px; }
    .gauge-fill { transition: none; }

    .summary { font-size: 9pt; line-height: 1.45; margin-bottom: 14px; }
    .summary p { margin: 0 0 6px; }

    .findings-title { font-size: 12pt; margin-bottom: 8px; padding-bottom: 4px; }

    .finding { page-break-inside: avoid; padding: 6px 0 8px; }
    .finding-head { gap: 8px; margin-bottom: 3px; }
    .severity {
      font-size: 7pt; padding: 2px 6px;
      min-width: 60px;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .finding-title { font-size: 10pt; }
    .finding-detail { font-size: 8.5pt; margin: 2px 0 0 76px; line-height: 1.4; }
    .finding-answer {
      font-size: 8.5pt; padding: 4px 8px;
      margin-bottom: 5px;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .finding-answer-label { font-size: 6.5pt; margin-right: 4px; }

    .closing {
      -webkit-print-color-adjust: exact; print-color-adjust: exact;
      font-size: 8.5pt; padding: 10px 14px; margin-top: 14px;
      page-break-inside: avoid;
    }

    .print-footer {
      display: block;
      border-top: 1.5px solid var(--gold);
      padding-top: 6px; margin-top: 14px;
      text-align: center;
      font-size: 8pt; color: var(--charcoal);
      -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-footer strong { color: var(--navy); }
    .print-footer a { color: var(--teal); text-decoration: none; }
  }

  .print-footer { display: none; }
