:root {
  --ink: #17212f;
  --muted: #667383;
  --paper: #fffaf3;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(23, 33, 47, 0.12);
  --blue: #174a7c;
  --blue-deep: #0b3156;
  --gold: #bd8a2e;
  --green: #2f7a4b;
  --amber: #a76616;
  --red: #a64038;
  --shadow: 0 18px 42px rgba(25, 30, 35, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(160deg, rgba(255, 247, 235, 0.95), rgba(237, 244, 242, 0.96)),
    #f7f0e7;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 12px 28px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 0 12px;
  background: linear-gradient(180deg, rgba(249, 243, 235, 0.96), rgba(249, 243, 235, 0.78));
  backdrop-filter: blur(18px);
}

.logo-lockup {
  justify-self: center;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.logo-lockup img,
.report-brand img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.logo-lockup span,
.eyebrow,
.label {
  display: block;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.logo-lockup strong {
  display: block;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.05;
  white-space: nowrap;
}

.nav-button {
  min-height: 40px;
  padding: 8px;
  border: 1px solid rgba(23, 74, 124, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
  color: var(--blue-deep);
  font-size: 0.82rem;
  font-weight: 850;
}

.screen {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: calc(100vh - 78px);
}

.screen-head {
  display: grid;
  gap: 8px;
  padding: 4px 0 2px;
}

.screen-head h1,
.screen-head h2,
.screen-head h3 {
  margin: 0;
  color: var(--blue-deep);
  line-height: 1.05;
}

.screen-head h1 {
  font-size: clamp(2.25rem, 10vw, 4.3rem);
}

.screen-head h2 {
  font-size: clamp(2rem, 8vw, 3.25rem);
}

.screen-head h3 {
  font-size: clamp(1.35rem, 5vw, 2rem);
}

.section-title {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(23, 33, 47, 0.1);
}

.screen-head p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.progress-wrap {
  display: grid;
  gap: 7px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 74, 124, 0.1);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--blue));
}

.panel,
.context-card,
.summary-card,
.report-card,
.history-card,
.selector-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.context-card,
.summary-card,
.report-card,
.history-card {
  padding: 15px;
}

.context-grid,
.form-grid,
.details-grid,
.photo-grid,
.summary-grid,
.history-grid,
.report-grid {
  display: grid;
  gap: 12px;
}

.context-card {
  display: grid;
  gap: 12px;
}

.context-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(23, 33, 47, 0.08);
}

.context-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.context-row strong {
  line-height: 1.25;
}

.primary-button,
.secondary-button,
.ghost-button,
.choice,
.pill-button {
  min-height: 48px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 12px 14px;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  box-shadow: 0 14px 26px rgba(23, 74, 124, 0.24);
}

.secondary-button {
  width: 100%;
  color: var(--blue-deep);
  background: var(--surface-strong);
  border-color: rgba(23, 74, 124, 0.18);
}

.ghost-button {
  color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(23, 74, 124, 0.16);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 49px;
  padding: 12px 13px;
  border: 1px solid rgba(23, 33, 47, 0.14);
  border-radius: var(--radius);
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

.field em,
.question-card em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.field.invalid input,
.field.invalid textarea,
.field.invalid select {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(166, 64, 56, 0.11);
}

.field-error {
  display: block;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.required-note,
.demo-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.welcome,
.completion {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: calc(100vh - 118px);
  max-width: 680px;
  margin: 0 auto;
}

.welcome h1,
.completion h2 {
  margin: 0;
  color: var(--blue-deep);
  font-size: clamp(2.4rem, 10vw, 4.8rem);
  line-height: 0.98;
}

.welcome p,
.completion p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.selection-limit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(23, 74, 124, 0.18);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.selection-limit strong {
  color: var(--blue-deep);
  white-space: nowrap;
}

.selection-limit span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: right;
}

.selection-limit.reached {
  border-left-color: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.field textarea {
  min-height: 118px;
  resize: vertical;
}

.inline-submit {
  margin-top: 14px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(23, 74, 124, 0.54);
  box-shadow: 0 0 0 4px rgba(23, 74, 124, 0.11);
}

.selector-tools {
  display: grid;
  gap: 10px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.pill-button {
  flex: 0 0 auto;
  min-height: 40px;
  color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(23, 74, 124, 0.16);
  font-size: 0.84rem;
  white-space: nowrap;
}

.pill-button.active {
  color: white;
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.appliance-list {
  display: grid;
  gap: 10px;
}

.category-group {
  display: grid;
  gap: 8px;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 0;
}

.selector-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 13px;
  text-align: left;
  color: var(--ink);
}

.selector-card strong,
.summary-card strong,
.report-card h3,
.history-card h3 {
  display: block;
  margin: 0;
  line-height: 1.2;
}

.selector-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
}

.selector-dot {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(23, 74, 124, 0.28);
  border-radius: 50%;
  background: white;
}

.selector-card.selected {
  border-color: rgba(23, 74, 124, 0.68);
  background: var(--surface-strong);
}

.selector-card.selected .selector-dot {
  border-color: var(--blue);
  background:
    radial-gradient(circle at center, white 0 28%, transparent 30%),
    var(--blue);
}

.selected-strip,
.mini-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.selected-strip li,
.mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(23, 33, 47, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
}

.photo-card,
.photo-gallery {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px dashed rgba(23, 74, 124, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.photo-frame {
  min-height: 150px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--muted);
  background: linear-gradient(135deg, rgba(23, 74, 124, 0.08), rgba(189, 138, 46, 0.09));
  font-weight: 800;
}

.photo-frame img,
.issue-thumb img,
.report-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.file-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.file-label {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 11px;
  border-radius: var(--radius);
  font-weight: 900;
}

.file-label.camera {
  color: white;
  background: var(--blue-deep);
}

.file-label.upload {
  color: var(--blue-deep);
  border: 1px solid rgba(23, 74, 124, 0.18);
  background: white;
}

.file-label.add {
  color: var(--blue-deep);
  border: 1px solid rgba(189, 138, 46, 0.38);
  background: rgba(255, 255, 255, 0.8);
}

.thumbnail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.empty-gallery {
  min-height: 100px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed rgba(23, 74, 124, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
  font-weight: 800;
}

.photo-tile {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.photo-preview-button {
  position: relative;
  min-height: 118px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: rgba(23, 74, 124, 0.08);
}

.photo-preview-button img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: cover;
}

.photo-preview-button span {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 5px 8px;
  border-radius: 999px;
  color: white;
  background: rgba(11, 49, 86, 0.82);
  font-size: 0.74rem;
  font-weight: 900;
}

.question-card,
.condition-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.question-card h3,
.condition-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.question-card.missing {
  border-color: rgba(166, 64, 56, 0.48);
}

.question-error {
  margin-top: -3px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice {
  min-width: 0;
  min-height: 50px;
  color: var(--blue-deep);
  background: white;
  border-color: rgba(23, 74, 124, 0.14);
  line-height: 1.15;
  white-space: normal;
}

.choice.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.condition-grid .choice {
  min-height: 58px;
  padding: 10px;
  font-size: 0.92rem;
}

.score-panel {
  display: grid;
  gap: 13px;
  padding: 16px;
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(145deg, var(--blue-deep), var(--blue));
  box-shadow: var(--shadow);
}

.score-display {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.score-display strong {
  font-size: clamp(3.1rem, 18vw, 5.4rem);
  line-height: 0.9;
}

.score-display span {
  padding-bottom: 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1.25rem;
  font-weight: 950;
}

.score-panel input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.score-explanation {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  line-height: 1.45;
}

.score-adjustment,
.findings-panel {
  display: grid;
  gap: 14px;
}

.score-adjustment output {
  color: var(--blue-deep);
  font-size: 1.2rem;
  font-weight: 950;
}

.adjustment-notice {
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  background: rgba(189, 138, 46, 0.1);
  font-size: 0.88rem;
  line-height: 1.4;
}

.findings-textarea {
  min-height: 210px !important;
}

.service-choice {
  background: rgba(255, 255, 255, 0.84);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 950;
  line-height: 1.1;
}

.status-chip.light {
  color: var(--blue-deep);
  background: rgba(23, 74, 124, 0.08);
}

.disclaimer {
  padding: 11px 13px;
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  line-height: 1.4;
}

.summary-card {
  display: grid;
  gap: 12px;
}

.summary-main {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
}

.thumb,
.report-photo {
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--blue);
  background: rgba(23, 74, 124, 0.08);
  font-weight: 950;
}

.thumb {
  width: 70px;
  height: 70px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.score-chip {
  color: var(--blue-deep);
  font-size: 1.36rem;
  font-weight: 950;
  white-space: nowrap;
}

.issue-mini {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.issue-mini img {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.actions {
  display: grid;
  gap: 9px;
}

.photo-preview-panel {
  display: grid;
  gap: 14px;
}

.photo-preview-panel img {
  width: 100%;
  max-height: 66vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: rgba(23, 74, 124, 0.08);
}

.report {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdfa;
  box-shadow: var(--shadow);
}

.report-hero {
  display: grid;
  gap: 14px;
  padding: 20px 16px;
  color: white;
  background: linear-gradient(135deg, rgba(11, 49, 86, 0.97), rgba(23, 74, 124, 0.9));
}

.report-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-brand h1 {
  margin: 0;
  color: white;
  line-height: 1.05;
}

.report-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.report-card {
  display: grid;
  gap: 12px;
}

.report-context {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.report-context div {
  display: grid;
  gap: 4px;
}

.report-context strong {
  color: var(--blue-deep);
}

.report-context span:not(.label) {
  color: var(--muted);
  line-height: 1.35;
}

.report-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0;
  color: var(--blue-deep);
}

.report-score strong {
  font-size: 2.4rem;
  line-height: 0.9;
}

.report-score span {
  font-weight: 900;
}

.report-photos {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-photos figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.report-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.report-photos figcaption {
  padding: 7px 8px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.validation-summary {
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  background: rgba(166, 64, 56, 0.08);
}

.validation-summary ul {
  margin: 7px 0 0;
  padding-left: 20px;
}

.delivery-status {
  display: grid;
  gap: 10px;
}

.delivery-status div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.delivery-status span {
  color: var(--muted);
  text-align: right;
}

.report-card-head {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
}

.report-photo {
  width: 92px;
  height: 92px;
}

.report-section {
  display: grid;
  gap: 5px;
}

.report-section h4 {
  margin: 0;
  color: var(--blue-deep);
}

.report-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.toast {
  position: fixed;
  right: 12px;
  bottom: 14px;
  left: 12px;
  z-index: 40;
  transform: translateY(130%);
  opacity: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: white;
  background: rgba(11, 49, 86, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 900;
  transition: transform 160ms ease, opacity 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (min-width: 700px) {
  .app-shell {
    padding: 14px 18px 32px;
  }

  .context-grid,
  .form-grid,
  .details-grid,
  .photo-grid,
  .summary-grid,
  .history-grid,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .appliance-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-group {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-title {
    grid-column: 1 / -1;
  }

  .choice-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .condition-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .condition-grid .choice {
    min-height: 64px;
    font-size: 0.82rem;
  }

  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .delivery-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .thumbnail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .selection-limit,
  .delivery-status div {
    align-items: flex-start;
    flex-direction: column;
  }

  .selection-limit span,
  .delivery-status span {
    text-align: left;
  }

  .report-context {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1120px) {
  .appliance-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .category-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .thumbnail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
