:root {
  color-scheme: light;
  --ink: #102a31;
  --muted: #64777b;
  --line: #dbe4e5;
  --line-strong: #bdcccc;
  --paper: #ffffff;
  --wash: #f4f7f7;
  --accent: #0a6770;
  --accent-dark: #074d54;
  --accent-soft: #e5f2f2;
  --danger: #a83b37;
  --radius: 12px;
  font-family: "Segoe UI Variable", "Aptos", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  min-width: 320px;
}

button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.brand, .print-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--accent);
  color: white;
  font-weight: 800;
  letter-spacing: -.05em;
}

.brand strong, .brand small, .print-brand strong, .print-brand small { display: block; }
.brand strong { font-size: .96rem; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: .72rem; margin-top: 2px; }

.topbar-meta, .footer-actions { display: flex; align-items: center; gap: 12px; }

.status { color: var(--muted); font-size: .8rem; margin-right: 8px; }
.status span { display: inline-block; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; margin-right: 6px; }

.button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: .86rem;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}

.button:active { transform: translateY(1px); }
.button:focus-visible, input:focus-visible, .company-card:focus-within { outline: 3px solid rgba(10,103,112,.25); outline-offset: 2px; }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: var(--ink); background: white; border-color: var(--line-strong); }
.button-secondary:hover { background: var(--wash); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 132px; }

.intro {
  display: grid;
  grid-template-columns: 1.45fr .55fr;
  gap: 64px;
  align-items: end;
  padding: 62px 0 48px;
}

.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; max-width: 760px; font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.062em; font-weight: 760; }
.intro-copy { margin: 0 0 5px; color: var(--muted); line-height: 1.65; font-size: .98rem; max-width: 34ch; }

.section-block {
  margin-bottom: 22px;
  padding: clamp(24px, 4vw, 42px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section-heading { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 30px; }
.section-heading-action { justify-content: space-between; align-items: center; }
.heading-group { display: flex; align-items: flex-start; gap: 18px; }
.step-number { color: var(--accent); font-size: .72rem; font-weight: 800; padding-top: 6px; font-variant-numeric: tabular-nums; }
h2 { margin: 0; font-size: clamp(1.35rem, 2.5vw, 1.9rem); letter-spacing: -.035em; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: .88rem; }
.selection-count { padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); font-size: .78rem; font-weight: 800; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 21px 16px; }
label > span { display: block; margin-bottom: 8px; font-size: .75rem; font-weight: 750; }
input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  padding: 0 38px 0 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:hover, select:focus { border-color: var(--accent); }
.coverage-type-field { grid-column: span 2; max-width: 420px; }
input::placeholder { color: #93a2a4; }
input:hover, input:focus { border-color: var(--accent); }
.money-input { position: relative; }
.money-input > span { position: absolute; z-index: 1; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.money-input input { padding-left: 29px; }

.company-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.company-card {
  min-height: 132px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.company-card:hover { border-color: #8eaaaa; transform: translateY(-1px); }
.company-card.selected { border-color: var(--accent); background: #f6fbfb; box-shadow: inset 0 0 0 1px var(--accent); }
.company-card input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { width: 21px; height: 21px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 6px; color: transparent; font-size: .78rem; font-weight: 900; }
.selected .checkmark { background: var(--accent); border-color: var(--accent); color: white; }
.company-top { display: flex; justify-content: space-between; gap: 8px; }
.company-code { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--wash); color: var(--ink); font-size: .7rem; font-weight: 900; letter-spacing: -.03em; }
.selected .company-code { background: var(--accent-soft); color: var(--accent-dark); }
.company-logo-wrap {
  width: 106px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 6px;
  border-radius: 8px;
  background: white;
  border: 1px solid #e1e8e9;
}
.company-logo-wrap img { display: block; max-width: 94px; max-height: 32px; object-fit: contain; object-position: left center; }
.company-name { display: block; font-size: .88rem; font-weight: 800; }
.company-plan { display: block; margin-top: 4px; color: var(--muted); font-size: .7rem; }
.inline-error { margin: 16px 0 0; color: var(--danger); font-size: .82rem; font-weight: 650; }

.comparison-section { min-height: 320px; }
.empty-state { text-align: center; padding: 28px 20px 38px; }
.empty-monogram { width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 12px; display: grid; place-items: center; background: var(--wash); color: #8ba0a2; font-size: .8rem; font-weight: 800; }
.empty-state h3 { margin: 0; font-size: 1.08rem; }
.empty-state p { margin: 8px 0 0; color: var(--muted); font-size: .84rem; }

.print-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 25px; border-bottom: 2px solid var(--ink); }
.print-brand strong { font-size: 1.08rem; }
.print-brand small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.quote-meta { text-align: right; }
.quote-meta span, .data-summary span, .comparison-summary span { display: block; color: var(--muted); font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.quote-meta strong { display: block; margin: 5px 0 3px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.quote-meta small { color: var(--muted); font-size: .7rem; }

.data-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.data-summary > div { min-width: 0; }
.data-summary > div:first-child { padding-right: 28px; border-right: 1px solid var(--line); }
.data-summary strong { display: block; margin: 8px 0 5px; font-size: 1.15rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.data-summary small { display: block; color: var(--muted); font-size: .73rem; line-height: 1.55; }

.comparison-summary { display: grid; grid-template-columns: repeat(2, 1fr); margin: 22px 0; padding: 16px 18px; background: var(--wash); border-radius: 9px; }
.comparison-summary > div:not(:last-child) { border-right: 1px solid var(--line-strong); margin-right: 18px; }
.comparison-summary strong { display: block; margin-top: 5px; font-size: .83rem; }
.comparison-scroll { overflow-x: auto; }
.comparison-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .73rem; }
.comparison-table th, .comparison-table td { padding: 13px 11px; border: 1px solid var(--line); vertical-align: middle; text-align: center; }
.comparison-table th:first-child, .comparison-table td:first-child { width: 21%; text-align: left; color: var(--muted); font-weight: 750; }
.comparison-table thead th { vertical-align: top; padding-top: 16px; padding-bottom: 16px; background: var(--ink); color: white; }
.comparison-table thead th:first-child { color: #bed0d2; border-radius: 8px 0 0 0; }
.comparison-table thead th:last-child { border-radius: 0 8px 0 0; }
.table-company-code { display: block; color: #91c5c9; font-size: .62rem; letter-spacing: .08em; margin-bottom: 5px; }
.table-company-name { display: block; font-size: .76rem; line-height: 1.25; }
.coverage-yes { color: var(--accent-dark); font-weight: 900; }
.coverage-no { color: #9aabab; }
.editable-cell { padding: 6px !important; }
.table-input { height: 36px; min-width: 82px; padding: 0 7px; text-align: center; font-size: .72rem; border-radius: 7px; background: #fbfdfd; }
.best-price { background: #eef7f6; }
.best-price input { color: var(--accent-dark); font-weight: 800; border-color: #79aeb1; }
.comparison-table tbody .quota-row > td { background: #fff3d8; }
.comparison-table tbody .quota-row > td:first-child { color: #725018; font-weight: 850; }
.comparison-table tbody .quota-row .table-input { background: #fffaf0; border-color: #d6ad62; }
.legal-note { margin: 20px 0 0; color: var(--muted); font-size: .62rem; line-height: 1.55; }

.action-bar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 16px max(24px, calc((100vw - 1180px) / 2));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 36px rgba(16,42,49,.07);
  backdrop-filter: blur(12px);
}
.action-bar > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.action-bar strong { font-size: .86rem; }
.action-bar span { color: var(--muted); font-size: .72rem; }

.toast { position: fixed; right: 24px; bottom: 108px; z-index: 40; padding: 12px 16px; border-radius: 9px; background: var(--ink); color: white; font-size: .78rem; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.pdf-preview {
  margin-top: 34px;
  padding: 24px;
  border-radius: var(--radius);
  background: #e8eeef;
  border: 1px solid #d3dfe0;
}

.preview-toolbar {
  max-width: 820px;
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.preview-toolbar > div { display: flex; flex-direction: column; gap: 4px; }
.preview-toolbar strong { font-size: .88rem; }
.preview-toolbar span { color: var(--muted); font-size: .72rem; }

.pdf-sheet {
  width: 100%;
  max-width: 820px;
  min-height: 1060px;
  margin: 0 auto 24px;
  padding: 28px;
  overflow: hidden;
  background: white;
  color: #0c2146;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(16, 42, 49, .12);
  font-family: "Segoe UI Variable", "Aptos", "Segoe UI", sans-serif;
}

.pdf-sheet:last-child { margin-bottom: 0; }

.pdf-hero {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px 12px 0 0;
  color: white;
  background: linear-gradient(120deg, #081e45, #0b3d70);
}

.pdf-hero-brand { display: flex; align-items: center; gap: 9px; }
.pdf-logo { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #0e7c83; color: white; font-size: .72rem; font-weight: 900; }
.pdf-hero-brand strong, .pdf-hero-brand small { display: block; }
.pdf-hero-brand strong { font-size: .76rem; }
.pdf-hero-brand small { margin-top: 2px; color: #c4d7e7; font-size: .52rem; }
.pdf-title-block { text-align: center; }
.pdf-title-block h3 { margin: 0; color: white; font-size: 1.02rem; line-height: 1.08; letter-spacing: -.025em; text-transform: uppercase; }
.pdf-folio { text-align: right; }
.pdf-folio small, .pdf-folio strong { display: block; }
.pdf-folio small { color: #a8c2d7; font-size: .48rem; letter-spacing: .06em; }
.pdf-folio strong { margin-top: 5px; font-size: .66rem; }

.pdf-client-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 13px 15px;
  border: 1px solid #c9d7df;
  border-top: 0;
  background: #f4f8fa;
}

.pdf-client-strip > div { min-width: 0; padding: 0 12px; border-right: 1px solid #d6e0e5; }
.pdf-client-strip > div:first-child { padding-left: 0; }
.pdf-client-strip > div:last-child { padding-right: 0; border-right: 0; }
.pdf-client-strip span, .pdf-client-strip strong, .pdf-client-strip small { display: block; overflow-wrap: anywhere; }
.pdf-client-strip span { color: #607386; font-size: .48rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.pdf-client-strip strong { margin: 4px 0 2px; color: #0c2146; font-size: .69rem; }
.pdf-client-strip small { color: #617282; font-size: .52rem; line-height: 1.25; }

.pdf-company-grid {
  display: grid;
  grid-template-columns: repeat(var(--pdf-columns), minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 8px;
}

.pdf-company-card {
  min-height: 62px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  position: relative;
  padding: 10px 12px;
  border: 1px solid #cad7df;
  border-radius: 9px;
  background: #f7fafc;
}

.pdf-company-card.is-best-price { border-color: #0e7c83; background: #edf8f8; }
.pdf-company-code { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #0c2d59; color: white; font-size: .58rem; font-weight: 900; }
.pdf-company-card strong, .pdf-company-card small { display: block; }
.pdf-company-card strong { font-size: .67rem; line-height: 1.15; }
.pdf-company-card small { margin-top: 3px; color: #5d7082; font-size: .51rem; }
.pdf-company-card em { position: absolute; top: 5px; right: 6px; color: #0a666d; font-size: .42rem; font-style: normal; font-weight: 900; letter-spacing: .05em; }

.pdf-company-banners {
  display: grid;
  grid-template-columns: repeat(var(--pdf-columns), minmax(0, 1fr));
  margin: 12px 0 0;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  border: 1px solid #c5d1da;
  border-bottom: 0;
}

.pdf-company-banner {
  min-height: 78px;
  display: grid;
  grid-template-columns: 1.1fr 1fr .72fr;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: white;
  background: var(--company-color);
  border-right: 2px solid white;
}

.pdf-company-banner:last-child { border-right: 0; }
.pdf-brand-logo { height: 48px; display: grid; place-items: center; padding: 6px 8px; border-radius: 8px; background: white; }
.pdf-brand-logo img { display: block; width: 100%; max-width: 145px; max-height: 36px; object-fit: contain; }
.pdf-brand-copy strong, .pdf-brand-copy small, .pdf-brand-price span, .pdf-brand-price strong { display: block; }
.pdf-brand-copy strong { font-size: .72rem; line-height: 1.1; }
.pdf-brand-copy small { margin-top: 4px; color: rgba(255, 255, 255, .84); font-size: .52rem; }
.pdf-brand-price { text-align: right; }
.pdf-brand-price span { color: rgba(255, 255, 255, .78); font-size: .42rem; font-weight: 800; letter-spacing: .06em; }
.pdf-brand-price strong { margin-top: 4px; font-size: .7rem; white-space: nowrap; }
.pdf-company-banner.is-best-price .pdf-brand-price span { color: #fff; }

.pdf-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .58rem; }
.pdf-table th, .pdf-table td { padding: 5px 7px; border: 1px solid #c3cfd7; vertical-align: middle; }
.pdf-table tr > *:first-child { width: 29%; }
.pdf-table thead th { color: white; background: #0c2d59; border-color: #294b72; text-align: center; font-size: .55rem; }
.pdf-table thead th:first-child { text-align: left; border-radius: 8px 0 0 0; }
.pdf-table thead th:last-child { border-radius: 0 8px 0 0; }
.pdf-company-banners + .pdf-table thead th:first-child,
.pdf-company-banners + .pdf-table thead th:last-child { border-radius: 0; }
.pdf-table-logo { display: inline-block; max-width: 74px; max-height: 17px; margin: 0 6px 0 0; padding: 2px 4px; border-radius: 4px; background: white; object-fit: contain; vertical-align: middle; }
.pdf-table thead th span { vertical-align: middle; }
.pdf-table tbody th { color: #162c4c; background: #fbfcfd; text-align: left; font-weight: 750; }
.pdf-table tbody td { color: #2b405d; background: #fff; text-align: center; line-height: 1.2; }
.pdf-table tbody tr:nth-child(odd):not(.pdf-group-row) td { background: #f8fafb; }
.pdf-table .pdf-group-row th { padding: 5px 8px; color: white; background: #0e7c83; border-color: #0e7c83; font-size: .52rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.pdf-value-positive { color: #167231; font-weight: 800; }
.pdf-value-negative { color: #c53a32; font-weight: 800; }
.pdf-value-positive b, .pdf-value-negative b { display: inline-block; margin-right: 4px; font-size: .82rem; line-height: 1; }
.pdf-value-positive small, .pdf-value-negative small { display: inline; color: inherit; font-size: .52rem; font-weight: 800; }
.pdf-money { color: #0a666d; font-size: .66rem; }
.pdf-table .pdf-price-row th,
.pdf-table .pdf-price-row td { background: #fff0cd; border-color: #d5b56f; }
.pdf-table .pdf-price-row th { color: #6b4b14; }
.pdf-table .pdf-price-row .pdf-money { color: #8b5200; font-size: .72rem; }

.pdf-footer { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-top: 10px; padding-top: 8px; border-top: 1px solid #cdd8df; color: #697b8b; }
.pdf-footer p { max-width: 78%; margin: 0; font-size: .45rem; line-height: 1.35; }
.pdf-footer strong { font-size: .48rem; white-space: nowrap; }

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 22px; padding-top: 44px; }
  .intro-copy { max-width: 56ch; }
  .form-grid, .company-grid { grid-template-columns: repeat(2, 1fr); }
  .status { display: none; }
}

@media (max-width: 620px) {
  main { width: min(100% - 24px, 1180px); padding-bottom: 160px; }
  .topbar { height: 66px; padding: 0 14px; }
  .brand small, #topPrintButton { display: none; }
  .intro { padding: 34px 3px 30px; }
  h1 { font-size: 2.55rem; }
  .section-block { padding: 23px 17px; }
  .section-heading-action { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .coverage-type-field { grid-column: auto; max-width: none; }
  .company-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .company-card { min-height: 124px; padding: 14px; }
  .data-summary, .comparison-summary { grid-template-columns: 1fr; }
  .data-summary { gap: 16px; }
  .data-summary > div:first-child { padding: 0 0 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .comparison-summary { gap: 15px; }
  .comparison-summary > div:not(:last-child) { border-right: 0; margin-right: 0; }
  .comparison-scroll { margin-right: -17px; padding-right: 17px; }
  .comparison-table { min-width: 660px; }
  .action-bar { align-items: stretch; padding: 12px; flex-direction: column; gap: 10px; }
  .action-bar > div:first-child { display: none; }
  .footer-actions { display: grid; grid-template-columns: .7fr 1.3fr; }
  .footer-actions .button { padding: 0 10px; font-size: .77rem; }
  .pdf-preview { padding: 10px; margin-left: -7px; margin-right: -7px; }
  .preview-toolbar { align-items: stretch; flex-direction: column; }
  .pdf-sheet { min-width: 720px; min-height: 980px; padding: 24px; transform-origin: top left; }
  #pdfPages { overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@page { size: A4 portrait; margin: 8mm; }

@media print {
  :root { --ink: #102a31; --muted: #52666a; --line: #cfd9da; --wash: #f1f5f5; }
  body { background: white; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .no-print, .action-bar, .toast { display: none !important; }
  main { width: 100%; margin: 0; padding: 0; }
  .section-block { display: none; border: 0; margin: 0; padding: 0; }
  .comparison-section { display: block; }
  .print-document { display: none !important; }
  .pdf-preview { display: block !important; margin: 0; padding: 0; border: 0; background: white; }
  .pdf-sheet {
    width: 100%;
    max-width: none;
    min-height: 281mm;
    margin: 0;
    padding: 5mm;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }
  .pdf-sheet:last-child { break-after: auto; page-break-after: auto; }
  .pdf-hero { padding: 4mm; }
  .pdf-title-block h3 { font-size: 12.5pt; }
  .pdf-client-strip { padding: 3mm; }
  .pdf-company-banners { margin: 3mm 0 0; }
  .pdf-company-banner { min-height: 18mm; padding: 2.2mm 3mm; }
  .pdf-table { font-size: 6.5pt; }
  .pdf-table th, .pdf-table td { padding: 1.25mm 1.6mm; }
  .pdf-table .pdf-group-row th { padding: 1.25mm 1.8mm; }
  .pdf-footer { margin-top: 2.2mm; padding-top: 1.8mm; }
  .pdf-table tr, .pdf-company-banner { break-inside: avoid; }
}
