/* ==================================================
   ROOT VARIABLES
================================================== */

:root {
  --navy: #052746;
  --teal: #087e8b;
  --blue: #0b73c9;

  --bg: #f4f7fa;
  --card: #ffffff;

  --text: #172b3a;
  --muted: #66788a;

  --line: #dbe4ea;
  --input: #e8f4ff;
}

/* ==================================================
   GLOBAL
================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

/* ==================================================
   HEADER
================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  gap: 18px;

  padding: 10px 4vw;

  background: #fff;
  border-bottom: 1px solid var(--line);

  box-shadow: 0 4px 18px rgba(5, 39, 70, 0.06);
}

.brand img {
  width: 150px;
  height: 58px;
  object-fit: contain;
}

.site-header nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.nav-btn,
.secondary {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;

  background: #fff;
  color: var(--navy);

  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--navy);
  color: #fff;
}

.secondary:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* ==================================================
   MAIN
================================================== */

main {
  max-width: 1280px;
  margin: 28px auto;
  padding: 0 22px;
}

.worksheet {
  display: none;
}

.worksheet.active {
  display: block;
}

/* ==================================================
   HERO
================================================== */

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 34px;

  align-items: center;

  padding: 48px;

  background: linear-gradient(
    135deg,
    #ffffff,
    #eaf6f8
  );

  border: 1px solid var(--line);
  border-radius: 24px;
}

.hero img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
}

.eyebrow {
  margin: 0;

  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  color: var(--teal);
}

h1 {
  margin: 12px 0;

  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1.02;

  color: var(--navy);
}

h2 {
  margin: 6px 0;
  font-size: 2rem;
  color: var(--navy);
}

h3 {
  color: var(--navy);
}

.lead {
  max-width: 680px;
  font-size: 1.15rem;
  color: #3c5265;
}

.revision {
  display: inline-block;

  margin-top: 12px;
  padding: 8px 12px;

  border-radius: 999px;
  border: 1px solid var(--line);

  background: #fff;

  font-weight: 700;
}

/* ==================================================
   CARDS
================================================== */

.card,
.band-card,
.steps article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;

  padding: 20px;

  box-shadow: 0 10px 25px rgba(5, 39, 70, 0.04);
}

.card h3 {
  margin-top: 0;
}

/* ==================================================
   INTRO STEPS
================================================== */

.steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;

  margin-top: 20px;
}

.steps span {
  display: grid;
  place-items: center;

  width: 34px;
  height: 34px;

  border-radius: 50%;

  background: var(--navy);
  color: #fff;

  font-weight: 800;
}

.steps h3 {
  margin: 10px 0 2px;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

/* ==================================================
   GUIDANCE
================================================== */

.section-head {
  margin-bottom: 22px;
}

.band-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.band-card {
  border-top: 7px solid var(--band);
}

.band-range {
  font-weight: 800;
  color: var(--band);
}

.band-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==================================================
   FORM LAYOUT
================================================== */

.summary-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

label {
  font-weight: 700;
  color: #334b5c;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;

  padding: 11px 12px;

  border: 1px solid #b9cfde;
  border-radius: 9px;

  background: var(--input);

  color: var(--text);
  font: inherit;
}

select {
  min-width: 220px;
}

/* ==================================================
   SCORE CARD
================================================== */

.score-card {
  text-align: center;
  border-top: 8px solid var(--band, #22a06b);
}

.score-card > span {
  text-transform: uppercase;
  letter-spacing: 0.09em;

  color: var(--muted);
  font-weight: 800;
}

.score-card strong {
  display: block;

  font-size: 4.5rem;
  line-height: 1.1;

  color: var(--navy);
}

.score-class {
  font-size: 1.15rem;
  font-weight: 900;

  color: var(--band);
}

.score-card p {
  font-size: 0.88rem;
  text-align: left;
  color: var(--muted);
}

/* ==================================================
   TOOLBAR
================================================== */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin: 18px 0;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar input {
  width: auto;
  margin: 0;
}

/* ==================================================
   TABLE
================================================== */

.table-wrap {
  overflow: auto;

  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;

  font-size: 0.88rem;
}

th,
td {
  padding: 10px 12px;
  text-align: left;

  border-bottom: 1px solid var(--line);
}

th {
  background: var(--navy);
  color: #fff;

  position: static;
}

td.num {
  text-align: center;
}

.excluded {
  opacity: 0.45;
  background: #f3f4f6;
}

/* Hide Included and Score columns */

table th:nth-child(5),
table td:nth-child(5),
table th:nth-child(6),
table td:nth-child(6) {
  display: none;
}

/* Widths */

th:nth-child(1),
td:nth-child(1) {
  width: 5%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 30%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 10%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 55%;
}

/* ==================================================
   NOTES
================================================== */

.notes {
  display: block;
  margin-top: 18px;
}

/* ==================================================
   TOP 5 COMPLEXITY DRIVERS
================================================== */

.drivers {
  margin-top: 24px;
}

.drivers h3 {
  margin-bottom: 18px;
}

.driver {
  display: grid;
  grid-template-columns: 260px 1fr 70px;
  gap: 16px;

  align-items: center;

  margin-bottom: 12px;
}

.driver span {
  font-weight: 600;
}

.driver strong {
  text-align: right;
  font-weight: 700;
  color: var(--navy);
}

.bar {
  height: 14px;

  background: #e6edf2;

  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;

  border-radius: inherit;

  background: linear-gradient(
    90deg,
    var(--teal),
    #f97316
  );
}

/* ==================================================
   PDF PRINT SUMMARY
================================================== */

.pdf-summary {
  display: none;
}

/* ==================================================
   FOOTER
================================================== */

footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
}

/* ==================================================
   RESPONSIVE
================================================== */

@media (max-width: 900px) {

  .site-header {
    flex-wrap: wrap;
  }

  .brand {
    width: 100%;
    text-align: center;
  }

  .site-header nav {
    margin: 0;
    overflow: auto;
  }

  .hero,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .steps,
  .band-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {

  main {
    padding: 0 12px;
  }

  .hero {
    padding: 26px;
  }

  .steps,
  .band-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
  }

  .site-header nav {
    width: 100%;
  }

  .nav-btn {
    flex: 1;
    padding: 9px 6px;

    font-size: 0.8rem;
  }

  .site-header > .secondary {
    width: 100%;
  }

  .driver {
    grid-template-columns: 1fr;
  }

  .score-card strong {
    font-size: 3.5rem;
  }
}

/* ==================================================
   PRINT / PDF
================================================== */

@media print {

  .site-header,
  .toolbar,
  footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  #introduction,
  #guidance {
    display: none !important;
  }

  #calculator {
    display: block !important;
  }

  .pdf-summary {
    display: block !important;
  }

  .notes {
    display: none !important;
  }

  .drivers {
    page-break-after: always;
  }

  .table-wrap {
    page-break-before: always;
    overflow: visible;
  }

  table {
    font-size: 8pt;
  }

  th,
  td {
    padding: 5px;
  }

  .hero,
  .card,
  .band-card,
  .table-wrap {
    box-shadow: none;
  }

  select,
  input,
  textarea {
    background: #fff;
    border: 1px solid #aaa;
  }
}

/* ==================================================
   BRAND / LOGO REFINEMENT
================================================== */
.brand {
  display: flex;
  align-items: center;
  width: 88px;
  height: 68px;
  overflow: hidden;
  text-decoration: none;
}
.brand img {
  width: 88px;
  height: 68px;
  object-fit: contain;
  object-position: center;
  transform: scale(1.35);
}
.hero > img {
  width: min(100%, 330px);
  max-height: 255px;
  justify-self: center;
  filter: drop-shadow(0 8px 18px rgba(5,39,70,.08));
}
.print-header { display: none; }

/* ==================================================
   CLEAN TWO-PAGE PRINT REPORT
================================================== */
@media print {
  @page { size: A4 portrait; margin: 10mm 11mm 11mm; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { width: auto; margin: 0; background: #fff !important; font-size: 9pt; }
  body.print-report .site-header,
  body.print-report footer,
  body.print-report #introduction,
  body.print-report #guidance,
  body.print-report .toolbar,
  body.print-report .notes { display: none !important; }
  body.print-report main { max-width: none; margin: 0; padding: 0; }
  body.print-report #calculator { display: block !important; }
  body.print-report .print-header {
    display: flex !important;
    align-items: center;
    gap: 8mm;
    padding-bottom: 4mm;
    margin-bottom: 5mm;
    border-bottom: 2px solid var(--teal);
  }
  body.print-report .print-header img { width: 28mm; height: 18mm; object-fit: contain; }
  body.print-report .print-header div { display: grid; line-height: 1.15; color: var(--navy); }
  body.print-report .print-header strong { font-size: 16pt; }
  body.print-report .print-header span { margin-top: 1mm; color: var(--muted); font-size: 9pt; letter-spacing: .08em; text-transform: uppercase; }
  body.print-report .section-head { margin: 0 0 4mm; }
  body.print-report .section-head .eyebrow { font-size: 7pt; }
  body.print-report .section-head h2 { margin: 1mm 0; font-size: 19pt; }
  body.print-report .section-head p { margin: 0; font-size: 9pt; }
  body.print-report .summary-grid { grid-template-columns: 1.55fr .65fr; gap: 4mm; }
  body.print-report .card { border-radius: 3mm; padding: 4mm; box-shadow: none; }
  body.print-report .well-info h3 { margin: 0 0 2.5mm; font-size: 11pt; }
  body.print-report .form-grid { grid-template-columns: repeat(3, 1fr); gap: 2.5mm 3mm; }
  body.print-report label { font-size: 7.5pt; }
  body.print-report input { margin-top: 1mm; padding: 1.5mm 2mm; border-radius: 1.5mm; font-size: 8pt; }
  body.print-report .score-card { border-top-width: 2mm; padding: 4mm; }
  body.print-report .score-card > span { font-size: 7pt; }
  body.print-report .score-card strong { font-size: 32pt; line-height: 1; }
  body.print-report .score-class { font-size: 10pt; }
  body.print-report .score-card p { margin: 2mm 0 0; font-size: 7.2pt; line-height: 1.25; }
  body.print-report .table-wrap { margin-top: 5mm; border-radius: 2mm; overflow: visible; page-break-before: auto; break-before: auto; }
  body.print-report table { table-layout: fixed; font-size: 6.7pt; }
  body.print-report th, body.print-report td { padding: 1.25mm 1.5mm; line-height: 1.15; }
  body.print-report th:nth-child(1), body.print-report td:nth-child(1) { width: 6%; }
  body.print-report th:nth-child(2), body.print-report td:nth-child(2) { width: 31%; }
  body.print-report th:nth-child(3), body.print-report td:nth-child(3) { width: 10%; }
  body.print-report th:nth-child(4), body.print-report td:nth-child(4) { width: 53%; }
  body.print-report select { min-width: 0; margin: 0; padding: 1mm 1.5mm; border: 0; border-radius: 0; background: transparent; font-size: 6.5pt; appearance: none; -webkit-appearance: none; }
  body.print-report tr { break-inside: avoid; page-break-inside: avoid; }
  body.print-report .drivers { margin-top: 4mm; padding: 3.5mm 4mm; break-inside: avoid; page-break-after: auto; }
  body.print-report .drivers h3 { margin: 0 0 2mm; font-size: 10pt; }
  body.print-report .driver { grid-template-columns: 56mm 1fr; gap: 3mm; margin-bottom: 1.5mm; font-size: 7.5pt; }
  body.print-report .bar { height: 2.2mm; }
  body.print-report .pdf-summary { display: none !important; }
}

/* Logo display correction */
.brand{width:190px;height:66px;overflow:visible;flex:0 0 190px}
.brand img{width:190px;height:66px;object-fit:contain;object-position:left center;transform:none;display:block}
.hero>img{width:min(100%,390px);max-height:300px;object-fit:contain;display:block}
