body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

h1 {
  font-size: 36px;
  margin: 0 0 8px;
}

h2 {
  margin: 0 0 12px;
}

p {
  line-height: 1.5;
}

button {
  background: #0f172a;
  color: white;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.upload-start {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-start-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.upload-history-button {
  font-size: 18px;
  padding: 18px 26px;
  border-radius: 18px;
}

.upload-start-button {
  font-size: 24px;
  padding: 22px 34px;
  border-radius: 20px;
}
button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

button.small {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  margin-top: 8px;
}

.card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
}

.card.dark {
  background: #020617;
  color: white;
}

.muted {
  color: #64748b;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.tabs .tab-pill,
.tabs button.tab-pill,
.tabs input.tab-pill {
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: Arial, sans-serif;
  line-height: 1.2;
  min-height: 40px;
}

.tabs .tab-pill:hover:not(.active),
.tabs button.tab-pill:hover:not(.active),
.tabs input.tab-pill:hover:not(.active) {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.tabs .tab-pill.active,
.tabs button.tab-pill.active,
.tabs input.tab-pill.active {
  background: #0f172a !important;
  color: #fff !important;
  border-color: #0f172a !important;
}

.tabs .tab-pill:focus-visible,
.tabs button.tab-pill:focus-visible,
.tabs input.tab-pill:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.summary-row div {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px;
}

.summary-row.light div {
  background: #f1f5f9;
}

.summary-row span,
.formula-grid span {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 8px;
}

.summary-row.light span,
.formula-grid span {
  color: #64748b;
}

.summary-row strong,
.formula-grid strong {
  display: block;
  font-size: 20px;
  line-height: 1.3;
}

.summary-row small {
  display: block;
  color: #64748b;
  margin-top: 4px;
}

.scenario {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  padding: 18px 0;
  border-bottom: 1px solid #e2e8f0;
  align-items: flex-start;
}

.scenario:last-child {
  border-bottom: 0;
}

.scenario > div:first-child {
  flex: 1;
  min-width: 0;
}

.scenario > div:first-child strong {
  display: block;
  margin-bottom: 6px;
}

.scenario p {
  margin: 0;
  color: #64748b;
}

.right-value {
  min-width: 240px;
  text-align: right;
  white-space: nowrap;
}

.right-value strong {
  display: inline-block;
  line-height: 1.4;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.barrow {
  display: grid;
  grid-template-columns: 90px 1fr 48px;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.barrow div {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.barrow b {
  display: block;
  height: 100%;
  background: #0f172a;
}

.eyebrow {
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 20px 0;
}

.formula-grid div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
}

.warn-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0 0;
  font-weight: 700;
}

.scenario-best {
  border-color: #16a34a;
  background: #f0fdf4;
}

.chip {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.repair-tag {
  font-size: 12px;
  font-weight: 700;
  margin: 4px 0;
}

.repair-tag--strongly-recommend-repair {
  color: #15803d;
}

.repair-tag--recommend-repair {
  color: #1d4ed8;
}

.repair-tag--consider-repair {
  color: #b45309;
}

.repair-tag--sell-as-is {
  color: #64748b;
}

.toggle {
  display: block;
  color: #64748b;
  font-size: 13px;
  margin-top: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal {
  background: white;
  padding: 24px;
  border-radius: 18px;
  width: min(720px, 100%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal.inspection-history-modal {
  width: min(920px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
}

.inspection-history-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
}

.inspection-history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.inspection-history-list li:last-child {
  border-bottom: 0;
}

.inspection-history-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.inspection-history-row-main strong {
  font-size: 16px;
}

.inspection-history-pairs {
  margin-top: 16px;
  max-height: min(40vh, 360px);
}

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

.form-grid label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.form-grid input,
.form-grid select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

footer {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 24px;
}

@media print {
  .tabs, .hero button, footer, button, .grid.two, .card:first-child, .card:nth-child(2) {
    display: none !important;
  }
  .page {
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: 0;
  }
}

@media (max-width: 800px) {
  .hero,
  .scenario {
    flex-direction: column;
  }

  .summary-row,
  .formula-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .right-value {
    text-align: left;
    white-space: normal;
    min-width: 0;
  }

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

.explain-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.explain-box p {
  margin: 8px 0 0;
  color: #334155;
}

.badge {
  display: inline-block;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.warning {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.badge.success {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
}

.disclaimer {
  color: #475569;
  background: #f8fafc;
  border-left: 4px solid #cbd5e1;
  padding: 12px 14px;
  border-radius: 12px;
}


/* Inspection report card */
.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.inspection-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.inspection-card div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
}

.inspection-card span {
  display: block;
  color: #64748b;
  font-size: 13px;
  margin-bottom: 8px;
}

.inspection-card strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.upload-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-submit-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.upload-start-actions .upload-pick-label {
  background: #0f172a;
  color: #fff;
  border: 0;
  border-radius: 20px;
  padding: 22px 34px;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  margin: 0;
}

.upload-start-actions .upload-pick-label:hover {
  filter: brightness(1.05);
}

.download-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.download-actions .btn-primary {
  background: #0f172a;
  color: #fff;
  text-decoration: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.download-actions .btn-primary:hover {
  filter: brightness(1.05);
}

.download-actions .btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  text-decoration: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.download-actions .btn-secondary:hover {
  filter: brightness(0.97);
}


.upload-start-button.upload-busy {
  opacity: 0.75;
  pointer-events: none;
}

.upload-error {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  color: #b91c1c;
  font-size: 14px;
}

.pair-table-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.pair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pair-table th,
.pair-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.pair-table th {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pair-table td:nth-child(3) {
  word-break: break-word;
}

.raw-pdf-preview {
  max-height: 200px;
  overflow: auto;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  margin-top: 10px;
}

.pctbox {
  border: none;
  background: transparent;
  color: #0f172a;
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 16px;
  text-align: right;
  outline: none;
}

.bignum {
  border: none;
  background: transparent;
  color: #0f172a;
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 24px;
  text-align: center;
  outline: none;
}

@media (max-width: 800px) {
  .section-title-row {
    flex-direction: column;
  }

  .inspection-card {
    grid-template-columns: 1fr;
  }
}
