:root {
  --fit-orange:  #f7951c;
  --fit-blue:    #2b7bb9;
  --fit-navy:    #1c3f6e;
  --fit-navy2:   #23508a;
  --fit-text:    #4c4c4e;
  --fit-green:   #8db580;
  --good:        #198754;
  --good-bg:     #d1e7dd;
  --avg:         #c07a00;
  --avg-bg:      #fff3cd;
  --poor:        #dc3545;
  --poor-bg:     #f8d7da;
  --info:        #0c5460;
  --info-bg:     #d1ecf1;
}

/* ── Layout ── */
body {
  background: #f4f6f9;
  color: var(--fit-text);
  font-family: 'Poppins', 'Segoe UI', sans-serif;
}
.fit-navbar  { background: linear-gradient(90deg, var(--fit-navy) 0%, var(--fit-navy2) 100%); }
.fit-main    { padding: 28px 0; min-height: calc(100vh - 58px); }
.fit-main-full { min-height: 100vh; }

/* ── Brand ── */
.fit-brand-badge {
  background: var(--fit-orange); color: #fff;
  padding: 2px 10px; border-radius: 10px;
  font-size: 0.75em; font-weight: 700;
}
.fit-role-badge {
  background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.85);
  padding: 1px 8px; border-radius: 8px; font-size: 0.75em;
}

/* ── Cards ── */
.fit-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}
.fit-card-header {
  padding: 14px 20px; font-weight: 700; font-size: 0.95em;
  background: #f7f9fc; border-bottom: 1px solid #e6ecf0;
}

/* ── Score gauge ── */
.score-gauge-wrap { position: relative; width: 160px; margin: 0 auto; }
.score-gauge-label {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; line-height: 1.1;
}
.score-gauge-num    { font-size: 2.2em; font-weight: 800; }
.score-gauge-sub    { font-size: 0.7em; color: #888; text-transform: uppercase; }
.score-gauge-rating { font-size: 0.95em; font-weight: 700; margin-top: 4px; }

/* ── Rating badges ── */
.badge-good    { background: var(--good-bg); color: var(--good); }
.badge-average { background: var(--avg-bg);  color: var(--avg);  }
.badge-poor    { background: var(--poor-bg); color: var(--poor); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.rating-badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 12px; font-size: 0.76em; font-weight: 700;
  white-space: nowrap;
}

/* ── Module grid ── */
.module-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 992px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .module-grid { grid-template-columns: 1fr; } }

.module-mini {
  border-radius: 8px; padding: 12px 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.module-mini:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.module-mini .mod-label { font-size: 0.75em; color: #888; margin-bottom: 2px; }
.module-mini .mod-name  { font-size: 0.85em; font-weight: 700; margin-bottom: 6px; }
.module-mini .mod-score { font-size: 1.35em; font-weight: 800; line-height: 1; }
.module-mini .mod-bar   { height: 5px; border-radius: 3px; background: #e0e0e0; margin-top: 6px; }
.module-mini .mod-fill  { height: 5px; border-radius: 3px; }

/* ── Findings table ── */
.findings-table th { background: #f7f9fc; font-size: 0.8em; color: #666; font-weight: 600; }
.findings-table td { vertical-align: top; font-size: 0.9em; }
.findings-table .rec { color: #666; font-size: 0.83em; margin-top: 3px; }
.findings-table .blocker-tag {
  font-size: 0.72em; font-weight: 700; color: var(--poor);
  margin-left: 6px; white-space: nowrap;
}

/* ── Blockers table ── */
.blockers-card  { border-top: 4px solid var(--poor); }
.blockers-hdr   { background: #fdecea; color: var(--poor); font-weight: 700; padding: 12px 20px; }
.blockers-table th { background: #fdecea; color: var(--poor); font-size: 0.8em; }
.blocker-num    { font-weight: 800; color: var(--poor); font-size: 1.1em; }

/* ── Effort tier ── */
.effort-tier-card {
  border-left: 4px solid var(--fit-orange);
  background: #fff8f0; border-radius: 8px;
  padding: 14px 18px;
}
.effort-label { font-size: 0.72em; color: var(--fit-orange); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Project hours ── */
.hours-card {
  border-left: 4px solid var(--fit-blue);
  background: #f0f6ff; border-radius: 8px;
  padding: 16px 18px;
}
.hours-label { font-size: 0.72em; color: var(--fit-blue); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.hours-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hours-phase { background: #fff; border-radius: 8px; padding: 12px 14px; text-align: center; }
.hours-phase-label { font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.hours-range { font-size: 1.3em; font-weight: 800; }
.hours-unit { font-size: 0.72em; color: #888; }
.hours-protect { border-top: 3px solid var(--fit-blue); }
.hours-enable  { border-top: 3px solid var(--fit-orange); }

/* ── Care plan recommendation ── */
.care-plan-card {
  border-radius: 12px; overflow: hidden;
}
.care-plan-hdr {
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
}
.care-plan-hdr.good    { background: linear-gradient(135deg, #d1f5e0, #a8e6c1); }
.care-plan-hdr.average { background: linear-gradient(135deg, #fff3cd, #ffe69c); }
.care-plan-hdr.poor    { background: linear-gradient(135deg, #f8d7da, #f5c6cb); }
.care-plan-name { font-size: 1.15em; font-weight: 800; }
.care-plan-step { font-size: 0.78em; font-weight: 600; opacity: 0.75; }
.care-plan-body { padding: 16px 20px; }
.care-plan-service {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 0.88em; color: var(--fit-text);
  border-bottom: 1px solid #f0f0f0;
}
.care-plan-service:last-child { border-bottom: none; }

/* ── AI Phased Approach ── */
.phase-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e0e3e8;
}
.phase-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e3e8;
}
.phase-col:last-child { border-right: none; }
.phase-hdr { padding: 14px 16px 12px; color: #fff; }
.phase-col.phase-discover .phase-hdr { background: var(--fit-orange); }
.phase-col.phase-protect  .phase-hdr { background: var(--fit-blue); }
.phase-col.phase-enable   .phase-hdr { background: #3d3d3d; }
.phase-col.phase-amplify  .phase-hdr { background: #8db580; }
.phase-eyebrow {
  font-size: 0.62em; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.8px; opacity: 0.9; margin-bottom: 3px;
}
.phase-title { font-size: 1.6em; font-weight: 900; line-height: 1.1; margin-bottom: 4px; }
.phase-type-label {
  font-size: 0.6em; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; opacity: 0.85;
}
.phase-body-list { padding: 14px 16px; flex: 1; background: #fff; }
.phase-body-list ul { list-style: none; margin: 0; padding: 0; }
.phase-body-list li {
  font-size: 0.82em; color: var(--fit-text);
  padding: 5px 0 5px 16px;
  border-bottom: 1px solid #f5f5f5;
  position: relative; line-height: 1.35;
}
.phase-body-list li:last-child { border-bottom: none; }
.phase-body-list li::before {
  content: "›"; position: absolute; left: 0;
  font-weight: 800; font-size: 1.1em;
}
.phase-col.phase-discover .phase-body-list li::before { color: var(--fit-orange); }
.phase-col.phase-protect  .phase-body-list li::before { color: var(--fit-blue); }
.phase-col.phase-enable   .phase-body-list li::before { color: #3d3d3d; }
.phase-col.phase-amplify  .phase-body-list li::before { color: #8db580; }
.phase-hrs-note {
  font-size: 0.72em; font-weight: 700; color: var(--fit-orange);
  margin-top: 10px; padding-top: 8px; border-top: 1px solid #f0f0f0;
}
@media (max-width: 900px) {
  .phase-row { grid-template-columns: 1fr 1fr; }
  .phase-col:nth-child(2) { border-right: none; }
  .phase-col:nth-child(3) { border-top: 1px solid #e0e3e8; }
  .phase-col:nth-child(4) { border-top: 1px solid #e0e3e8; border-right: none; }
}
@media (max-width: 576px) {
  .phase-row { grid-template-columns: 1fr; }
  .phase-col { border-right: none; border-top: 1px solid #e0e3e8; }
  .phase-col:first-child { border-top: none; }
}

/* ── AI Care Plan Comparison ── */
.care-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 8px;
}
.care-tier-card {
  border-radius: 10px;
  border: 2px solid #dee2e6;
  padding: 24px 20px 20px;
  position: relative;
}
.care-tier-card.recommended {
  border-color: var(--fit-orange);
  background: #fff9f2;
}
.care-tier-rec-badge {
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  background: var(--fit-orange); color: #fff;
  font-size: 0.65em; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 14px; border-radius: 20px; white-space: nowrap;
}
.care-tier-name { font-size: 1.05em; font-weight: 800; color: var(--fit-navy); margin-bottom: 3px; }
.care-tier-tagline { font-size: 0.78em; color: #666; font-style: italic; margin-bottom: 8px; line-height: 1.3; }
.care-tier-features { list-style: none; padding: 0; margin: 0; font-size: 0.82em; }
.care-tier-features li { padding: 5px 0; border-bottom: 1px solid #f0f0f0; line-height: 1.35; }
.care-tier-features li:last-child { border-bottom: none; }
.care-tier-features li::before { content: "✓"; margin-right: 6px; color: var(--fit-orange); font-weight: 700; }
@media (max-width: 768px) {
  .care-tier-grid { grid-template-columns: 1fr; }
}

/* ── Assessment combined score ── */
.combined-card    { border-top: 4px solid var(--fit-blue); }
.combined-score   { font-size: 2.2em; font-weight: 800; }
.combined-grid    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .combined-grid { grid-template-columns: 1fr; } }

/* ── Customer list ── */
.customer-row { transition: background 0.1s; }
.customer-row:hover { background: #f7f9fc; }
.score-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  font-weight: 800; font-size: 1em; border: 3px solid;
}
.score-pill-good    { border-color: var(--good); color: var(--good); background: var(--good-bg); }
.score-pill-average { border-color: var(--avg);  color: var(--avg);  background: var(--avg-bg);  }
.score-pill-poor    { border-color: var(--poor); color: var(--poor); background: var(--poor-bg); }
.score-pill-none    { border-color: #ccc; color: #aaa; background: #f5f5f5; }

/* ── Consent status ── */
.consent-granted { color: var(--good); }
.consent-pending { color: var(--avg); }

/* ── Scan history timeline ── */
.scan-timeline { border-left: 2px solid #e6ecf0; margin-left: 20px; }
.scan-timeline-item { position: relative; padding: 0 0 20px 24px; }
.scan-timeline-item::before {
  content: ''; position: absolute; left: -7px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff;
}
.scan-timeline-item.good::before    { background: var(--good); }
.scan-timeline-item.average::before { background: var(--avg); }
.scan-timeline-item.poor::before    { background: var(--poor); }
.scan-timeline-item.running::before { background: var(--fit-orange); }
.scan-timeline-item.pending::before { background: #aaa; }
.scan-timeline-item.failed::before  { background: var(--poor); }

/* ── Status badge ── */
.status-running { color: var(--fit-orange); font-weight: 600; }
.status-pending { color: #888; }
.status-failed  { color: var(--poor); }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--fit-navy) 0%, var(--fit-navy2) 100%);
}
.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 40px; max-width: 420px; width: 100%;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .brand { background: var(--fit-orange); color: #fff; padding: 4px 16px; border-radius: 12px; font-weight: 700; font-size: 0.85em; }
.login-logo img { max-height: 60px; object-fit: contain; }

/* ── Upload area ── */
.upload-area {
  border: 2px dashed #ccc; border-radius: 8px;
  padding: 24px; text-align: center; color: #888;
  transition: border-color 0.2s, background 0.2s; cursor: pointer;
}
.upload-area:hover { border-color: var(--fit-orange); background: #fff8f0; }

/* ── Questionnaire form ── */
.q-dimension-hdr {
  background: linear-gradient(90deg, var(--fit-navy) 0%, var(--fit-navy2) 100%);
  color: #fff; border-radius: 10px; padding: 14px 20px; margin-bottom: 16px;
}
.q-dimension-hdr .dim-code {
  background: var(--fit-orange); color: #fff;
  padding: 2px 10px; border-radius: 8px; font-size: 0.8em; font-weight: 700; margin-right: 10px;
}
.q-dimension-hdr .dim-name { font-weight: 700; font-size: 1em; }

.q-card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  padding: 18px 20px; margin-bottom: 12px;
}
.q-text { font-weight: 600; font-size: 0.95em; margin-bottom: 12px; color: var(--fit-text); }

.q-options { display: flex; flex-direction: column; gap: 8px; }
.q-option {
  display: flex; align-items: flex-start; gap: 12px;
  border: 2px solid #e8ecf0; border-radius: 8px;
  padding: 10px 14px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.q-option:hover { border-color: var(--fit-blue); background: #f0f6ff; }
.q-option input[type=radio] { margin-top: 2px; accent-color: var(--fit-blue); }
.q-option input[type=radio]:checked ~ .q-option-text { color: var(--fit-navy); font-weight: 600; }
.q-option.selected { border-color: var(--fit-blue); background: #f0f6ff; }
.q-option-num {
  background: #e8ecf0; color: #666; border-radius: 6px;
  padding: 2px 8px; font-size: 0.75em; font-weight: 700;
  min-width: 26px; text-align: center; margin-top: 1px; flex-shrink: 0;
}
.q-option-text { font-size: 0.88em; }

.q-other {
  margin-top: 10px;
}
.q-other summary {
  font-size: 0.8em; color: #888; cursor: pointer; user-select: none;
}
.q-other summary:hover { color: var(--fit-blue); }
.q-other textarea {
  margin-top: 8px; font-size: 0.85em;
}

.q-score-preview {
  position: sticky; bottom: 0; background: var(--fit-navy);
  color: #fff; padding: 12px 24px; border-radius: 0 0 12px 12px;
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 -1px;
}
.q-score-num { font-size: 1.8em; font-weight: 800; }
.q-score-label { font-size: 0.85em; opacity: 0.85; }
.q-score-bar-wrap { background: rgba(255,255,255,0.2); border-radius: 8px; height: 8px; width: 180px; }
.q-score-bar { background: var(--fit-orange); border-radius: 8px; height: 8px; transition: width 0.3s; }

/* ── Questionnaire result ── */
.q-result-hdr {
  padding: 32px; text-align: center; border-radius: 16px 16px 0 0;
  color: #fff;
}
.q-result-hdr.ai-ready      { background: linear-gradient(135deg, #198754, #12612f); }
.q-result-hdr.approaching   { background: linear-gradient(135deg, #c07a00, #8a5500); }
.q-result-hdr.needs-prep    { background: linear-gradient(135deg, #fd7e14, #b35200); }
.q-result-hdr.not-yet       { background: linear-gradient(135deg, #dc3545, #9d1a27); }
.q-result-score { font-size: 4em; font-weight: 900; line-height: 1; }
.q-result-label { font-size: 1.3em; font-weight: 700; margin-top: 8px; }
.q-result-pct   { font-size: 1em; opacity: 0.85; }

.dim-score-bar-wrap { background: #e9ecef; border-radius: 6px; height: 10px; }
.dim-score-bar { border-radius: 6px; height: 10px; transition: width 0.5s 0.2s; }

/* ── Quote document ── */
.quote-doc {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  max-width: 860px;
  margin: 0 auto 40px;
  padding: 40px 48px;
  font-size: .88rem;
}
.quote-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 3px solid #f7951c;
}
.quote-header-left { display: flex; align-items: flex-start; gap: 16px; }
.quote-logo { height: 52px; }
.quote-from { padding-top: 4px; }
.quote-header-right { text-align: right; }
.quote-title {
  font-size: 1.6em;
  font-weight: 800;
  color: var(--fit-navy);
  letter-spacing: 2px;
  margin-bottom: 10px;
}
.quote-meta-table td { padding: 2px 6px 2px 0; vertical-align: top; }
.quote-meta-table td:first-child { padding-right: 12px; }
.quote-bill-to {
  background: #f8fafc;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.quote-scope {
  margin-bottom: 28px;
  padding: 16px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.quote-section-label {
  font-size: .7em;
  font-weight: 700;
  color: var(--fit-orange);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.quote-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}
.quote-items-table thead th {
  background: var(--fit-navy);
  color: #fff;
  padding: 10px 12px;
  font-size: .82em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.quote-items-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.quote-subtotal-row td { padding: 6px 12px; }
.quote-total-row td {
  padding: 12px 12px;
  border-top: 2px solid var(--fit-navy);
  background: #f8fafc;
}
.quote-terms {
  background: #f8fafc;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 32px;
}
.quote-footer {
  text-align: center;
  color: #94a3b8;
  font-size: .78em;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
}

/* ── Print ── */
/* ── Prospect badge ── */
.prospect-badge {
  background: #e8f0fe;
  color: #1c3f6e;
  font-size: .65em;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: middle;
}

/* ── Print cover page (hidden on screen) ── */
.print-cover { display: none; }

@media print {
  .fit-navbar, .no-print { display: none !important; }
  .fit-main { padding: 0; }
  .fit-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }

  /* Hide breadcrumb and header row — covered by the print cover page */
  .container-fluid > .mb-3:first-child,
  .container-fluid > .d-flex.justify-content-between.mb-4:first-of-type { display: none !important; }

  .print-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    padding: 60px 40px;
    background: #fff;
    margin: 0;
    page-break-after: always;
    break-after: page;
    overflow: hidden;
  }
  .print-report-body {}
  .print-cover-logo { max-width: 220px; margin-bottom: 48px; }
  .print-cover-rule {
    width: 80px; height: 4px;
    background: #f7951c;
    border: none; margin: 28px auto;
  }
  .print-cover-title {
    font-size: 2em; font-weight: 800;
    color: #1c3f6e; margin: 0 0 8px;
  }
  .print-cover-subtitle {
    font-size: 1em; color: #666; margin: 0 0 40px;
  }
  .print-cover-meta {
    font-size: 0.88em; color: #444;
    line-height: 2; margin-bottom: 48px;
  }
  .print-cover-meta strong { color: #1c3f6e; }
  .print-cover-footer {
    font-size: 0.78em; color: #aaa;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px; width: 100%;
    text-align: center;
  }
  /* Quote document print overrides */
  .quote-doc {
    border: none;
    border-radius: 0;
    max-width: 100%;
    padding: 20px 32px;
    margin: 0;
  }
  .quote-items-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .quote-total-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
