/* ── Design Tokens ── */
:root {
  --bg-primary: #f7f3ec;
  --bg-secondary: #fffdf9;
  --bg-card: #f1ebe0;
  --bg-card-hover: #e9e0d1;
  --bg-input: #f7f3ec;
  --border: #e5dbc9;
  --border-accent: rgba(160, 104, 53, 0.28);
  --text-primary: #211a12;
  --text-secondary: #5c5245;
  --text-muted: #9c9184;
  --accent: #a06835;
  --accent-light: #b8763e;
  --accent-2: #7c5228;
  --accent-glow: rgba(160, 104, 53, 0.1);
  --accent-gradient: linear-gradient(135deg, #a06835, #7c5228);
  --brand-lime: #d4f92e;
  --brand-lime-light: #e2ff5c;
  --brand-lime-dark: #0f1710;
  --success: #4d7c0f;
  --success-bg: rgba(77, 124, 15, 0.08);
  --warning: #b45309;
  --danger: #b91c1c;
  --danger-bg: rgba(185, 28, 28, 0.06);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(33, 26, 18, 0.05), 0 1px 3px rgba(33, 26, 18, 0.06);
  --shadow: 0 8px 24px -4px rgba(33, 26, 18, 0.1), 0 4px 8px -4px rgba(33, 26, 18, 0.06);
  --shadow-lg: 0 20px 44px -12px rgba(33, 26, 18, 0.16);
  --transition: 0.2s ease;
  --font-heading: "Playfair Display", Georgia, serif;

  color-scheme: light;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { min-height: 100vh; background: var(--bg-primary); }

button, input { font: inherit; color: inherit; }

/* ── Top Nav ── */
.topnav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #080e1c;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topnav-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.logo-icon { width: 24px; height: 17px; color: #d4f92e; flex-shrink: 0; }
.logo-text { font-size: 1.1rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: #fff; }
.logo-text strong { color: #fff; font-weight: 900; }

.topnav-links { display: flex; align-items: center; gap: 24px; }
.topnav-link {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  color: #0f1710;
  padding: 9px 20px;
  border-radius: 999px;
  background: #d4f92e;
  box-shadow: 0 4px 16px rgba(212, 249, 46, 0.3);
  border-bottom: none;
  text-decoration: none;
  transition: all var(--transition);
}
.topnav-link:hover { transform: translateY(-2px); background: #c4e828; box-shadow: 0 8px 24px rgba(212, 249, 46, 0.4); }
.topnav-link.is-disabled { pointer-events: none; opacity: 0.5; }

/* Shared landing-style header for inspection and report screens */
.topnav.site-header {
  display: block;
  padding: 0;
  background: rgba(8, 14, 28, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  z-index: 100;
}
.site-header-inner {
  width: 100%;
  max-width: 1440px;
  min-height: 68px;
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 36px;
}
.site-brand { display:flex; align-items:center; gap:10px; flex-shrink:0; text-decoration:none; }
.site-brand-icon { width:24px; height:22px; color:#d4f92e; flex-shrink:0; }
.site-brand-text { color:#fff; font-size:1.34rem; font-weight:700; line-height:1; }
.site-brand-text strong { font-weight:900; }
.site-nav-links { display:flex; align-items:center; justify-content:center; gap:30px; flex:1; }
.site-nav-link { color:rgba(255,255,255,.62); font-size:1rem; font-weight:500; white-space:nowrap; text-decoration:none; transition:color .15s ease; }
.site-nav-link:hover, .site-nav-link:focus-visible { color:#fff; }
.site-nav-actions { display:flex; align-items:center; gap:10px; margin-left:auto; flex-shrink:0; }
.site-cta, .site-mobile-cta {
  display:inline-flex; align-items:center; justify-content:center; padding:10px 22px;
  border-radius:999px; background:#d4f92e; color:#0f1710; font-size:.86rem; font-weight:700;
  white-space:nowrap; text-decoration:none; box-shadow:0 4px 16px rgba(212,249,46,.3); transition:all .2s ease;
}
.site-cta:hover, .site-mobile-cta:hover { transform:translateY(-2px); background:#c4e828; box-shadow:0 8px 24px rgba(212,249,46,.4); }
.site-menu-toggle { display:none; flex-direction:column; gap:5px; padding:7px; border:0; background:transparent; cursor:pointer; }
.site-menu-toggle span { width:22px; height:2px; border-radius:2px; background:#fff; transition:transform .2s ease, opacity .2s ease; }
.site-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform:translateY(7px) rotate(45deg); }
.site-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity:0; }
.site-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform:translateY(-7px) rotate(-45deg); }
.site-mobile-menu { display:none; padding:10px 28px 18px; border-top:1px solid rgba(255,255,255,.08); }
.site-mobile-menu a:not(.site-mobile-cta) { display:block; padding:11px 0; border-bottom:1px solid rgba(255,255,255,.07); color:rgba(255,255,255,.78); font-size:.95rem; text-decoration:none; }
.site-mobile-menu a:not(.site-mobile-cta):hover { color:#fff; }
.site-mobile-menu .site-mobile-cta { width:100%; margin-top:12px; }
.site-mobile-menu.is-open { display:flex; flex-direction:column; }

.decision-alert {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Page Head (breadcrumb + steps) ── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 28px 18px;
  background: var(--bg-primary);
}

.breadcrumb { font-size: 0.78rem; color: var(--text-primary); font-weight: 600; margin-bottom: 8px; }
.breadcrumb span:first-child { color: var(--accent); }
.breadcrumb span:last-child { color: var(--text-secondary); }

.page-head h1 {
  font-family: "Oswald", Inter, sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    line-height: 0.96;
    color: #0f172a;
}
.page-sub { font-size: 0.86rem; color: var(--text-secondary); margin-top: 4px; }

.step-indicator { display: flex; align-items: center; gap: 10px; list-style: none; flex-shrink: 0; }

.step { display: flex; align-items: center; gap: 9px; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; border: 2px solid var(--border);
  color: var(--text-muted); font-size: 0.78rem; font-weight: 800;
  transition: all var(--transition);
}
.step-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }

.step.is-active .step-num { background: var(--brand-lime); border-color: transparent; color: var(--brand-lime-dark); }
.step.is-active .step-label { color: var(--text-primary); }
.step.is-done .step-num { background: var(--brand-lime); border-color: transparent; color: var(--brand-lime-dark); }
.step.is-done .step-label { color: var(--text-primary); }

.step-line { width: 32px; height: 2px; background: var(--border); flex-shrink: 0; transition: background var(--transition); }
.step-line.is-done { background: var(--accent); }

/* ── View Tabs ── */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  overflow-x: auto;
}

.view-tab {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.view-tab:hover:not(:disabled) { background: var(--bg-card); color: var(--text-primary); }
.view-tab:disabled { cursor: not-allowed; opacity: 0.4; }

.view-tab.is-active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 700;
}

.view-tabs-spacer { flex: 1; }

.legend-chips {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 50vw;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Thumbnail Strip (multi-photo) ── */
.thumb-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 12px 24px;
  border: 0;
  background: transparent;
  overflow-x: auto;
  flex-shrink: 0;
}

.control-panel > .thumb-strip { min-height: 0; }

.thumb-item {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--bg-card);
  transition: all var(--transition);
}
.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-item:hover { border-color: var(--accent-light); }
.thumb-item.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.thumb-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}

.thumb-remove {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(16, 24, 40, 0.65);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
  border: 0;
  cursor: pointer;
}
.thumb-item:hover .thumb-remove { display: flex; }

.thumb-add {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
}
.thumb-add:hover { border-color: var(--accent-light); color: var(--accent); }
.thumb-add input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.thumb-add:focus-within { outline: 3px solid var(--accent-glow); outline-offset: 2px; }

/* ── Layout ── */
.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 0 28px 24px;
  overflow-y: auto;
}

/* ── Stage Card (left: viewer) ── */
.stage-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.stage-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

/* ── Results view: image left, report right (only once results are ready) ── */
.workspace.has-results .stage-card {
  flex-direction: row;
}

.workspace.has-results .stage-main {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.workspace.has-results .control-panel {
  width: 380px;
  flex-shrink: 0;
  border-top: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.workspace.has-results #resultsPanel {
  height: 100%;
}

.stage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 24px 0;
}

/* Keep the empty upload screen focused on the centered dropzone. */
.stage-card:not(.has-photos) .stage-card-head,
.stage-card:not(.has-photos) .view-tabs { display: none; }

/* Keep the uploaded photo on the open inspection canvas, without a second card shell. */
.stage-card.has-photos {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.stage-card.has-photos .stage-card-head,
.stage-card.has-photos .view-tabs { display: none; }
.stage-card.has-photos .stage-main { background: transparent; }

.stage-card-head h2 { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); }

.viewer-controls { display: flex; align-items: center; gap: 16px; }
.image-stage > .viewer-controls {
  position: absolute;
  z-index: 5;
  top: 16px;
  right: 20px;
  padding: 8px 10px;
  border: 1px solid rgba(160, 104, 53, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(34, 29, 23, 0.08);
  backdrop-filter: blur(10px);
}

.annotations-toggle {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer;
}
.annotations-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 34px; height: 19px; border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform var(--transition);
}
.annotations-toggle input:checked + .toggle-track { background: var(--accent-gradient); }
.annotations-toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(15px); }

.zoom-controls {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.zoom-btn {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.zoom-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.zoom-value { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); width: 36px; text-align: center; }

/* ── Stage Footer (file chips + actions) ── */
.stage-footer {
  display: none;
}

.file-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.file-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.76rem; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 999px;
}
.file-chip svg { flex-shrink: 0; color: var(--text-muted); }

.stage-actions { display: flex; align-items: center; gap: 10px; }

.ghost-button {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}
.ghost-button:hover:not(:disabled) { border-color: var(--accent-light); color: var(--accent); background: var(--accent-glow); }
.ghost-button.loading .btn-svg { animation: spin 0.7s linear infinite; }
.ghost-button input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}

/* ── Control Panel (bottom bar: tips / results) ── */
.control-panel {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.control-panel.has-photos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 0;
}

.control-panel.has-photos > .thumb-strip { grid-column: 1; min-width:0; max-width:100%; }
.control-panel.has-photos > .side-placeholder { grid-column: 2; justify-content: flex-end; align-items: center; padding: 12px 24px 12px 8px; }
.control-panel.has-photos .tips-bar,
.control-panel.has-photos .tips-bar-add { display: none; }
.control-panel.has-photos .tips-bar-btn { width: auto; margin: 0; }
.workspace.has-results .control-panel.has-photos { display: flex; }

/* ── Tips bar (bottom bar shown before analyze) ── */
.side-placeholder {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.tips-bar {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}

.tips-bar-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tips-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tips-bar-btn { flex-shrink: 0; margin-top: 2px; }
.tips-bar-add { flex-shrink: 0; margin-top: 2px; white-space: nowrap; }

#resultsPanel { display: flex; flex-direction: column; gap: 18px; padding: 22px; }

.panel-header { display: flex; flex-direction: column; gap: 16px; }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.status-row strong { font-size: 1rem; font-weight: 800; color: var(--text-primary); }

.decision-text { font-weight: 800; }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}
.status-dot.analyzing { background: var(--accent); animation: pulse-dot 1s ease infinite; }
.status-dot.clean { background: var(--success); }
.status-dot.error { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.condition-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
}
.condition-row svg { color: var(--text-muted); flex-shrink: 0; }
.condition-pill {
  margin-left: auto;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 800;
}

.review-note {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.76rem; color: var(--text-muted);
  padding-top: 4px;
}
.review-note svg { flex-shrink: 0; }

.tip-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--accent-glow);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tip-icon svg { width: 16px; height: 16px; }

.tip-body { display: flex; flex-direction: column; gap: 2px; }
.tip-body strong { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.tip-body small { font-size: 0.75rem; color: var(--text-secondary); }

/* ── Primary Button ── */
.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--brand-lime);
  color: var(--brand-lime-dark);
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(212, 249, 46, 0.3);
}

.pdf-button { width: 100%; }

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--brand-lime-light);
  box-shadow: 0 8px 22px rgba(212, 249, 46, 0.4);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0);
}

.primary-button:disabled {
  background: #dde3ec;
  color: #9aa5b1;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-svg { width: 17px; height: 17px; flex-shrink: 0; }

.primary-button.loading .btn-svg { animation: spin 0.7s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }


.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.metric-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.metric-value {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.metric-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Parts Status Table ── */
.parts-table-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

.parts-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.parts-table-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  max-height: 480px;
}

.parts-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.part-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  animation: slide-in 0.25s ease both;
  transition: border-color var(--transition);
}

.part-row:hover { border-color: var(--border-accent); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 1; transform: translateX(0); }
}

.part-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.part-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 0;
}

.part-name-top { display: flex; align-items: center; gap: 7px; }

.part-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.part-location { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); }

.part-status-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.part-confidence { display: flex; flex-direction: column; gap: 5px; }
.part-confidence-head { display: flex; align-items: center; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.part-confidence-bar { width: 100%; height: 5px; border-radius: 999px; background: var(--bg-card); overflow: hidden; }
.part-confidence-bar span { display: block; height: 100%; border-radius: 999px; }
.part-low-confidence { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--warning); font-weight: 600; }
.part-low-confidence svg { flex-shrink: 0; }

/* ── Image Stage ── */
.image-stage {
  position: relative;
  display: grid;
  place-items: safe center;
  flex: 1;
  min-height: 0;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(160, 104, 53, 0.1) 1px, transparent 0),
    var(--bg-secondary);
  background-size: 24px 24px;
}

.analysis-loading {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.24);
  -webkit-backdrop-filter: blur(11px) saturate(.76);
  backdrop-filter: blur(11px) saturate(.76);
  animation: analysis-fade-in .18s ease-out both;
}
.analysis-loading-card {
  width: min(100%, 440px);
  padding: 30px 32px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 76px rgba(33, 26, 18, 0.18);
  text-align: center;
}
.analysis-spinner {
  position: relative;
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  margin: 0 auto 17px;
  color: var(--accent);
}
.analysis-spinner::before {
  position: absolute;
  inset: 0;
  border: 3px solid #eee8de;
  border-top-color: var(--accent);
  border-right-color: var(--brand-lime);
  border-radius: 50%;
  content: "";
  animation: analysis-spin .9s linear infinite;
}
.analysis-spinner svg { width:27px; height:27px; }
@keyframes analysis-fade-in { from { opacity:0; } to { opacity:1; } }
@keyframes analysis-spin { to { transform:rotate(360deg); } }
@keyframes analysis-progress-sweep {
  from { transform:translateX(-110%); }
  to { transform:translateX(360%); }
}
.analysis-loading-eyebrow { color:var(--accent); font-size:.65rem; font-weight:900; letter-spacing:.12em; }
.analysis-loading-card h2 { margin-top:8px; color:var(--text-primary); font-size:1.15rem; }
.analysis-loader-detail { margin-top:8px; color:var(--text-secondary); font-size:.78rem; line-height:1.5; overflow-wrap:anywhere; }
.analysis-progress-track { position:relative; height:8px; margin-top:22px; overflow:hidden; border-radius:999px; background:#eee8de; }
.analysis-progress-track > span { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,#a06835,#d4f92e); transition:width .35s ease; }
.analysis-progress-track.is-busy::after { position:absolute; inset:0 auto 0 0; width:28%; border-radius:inherit; background:linear-gradient(90deg,transparent,rgba(255,255,255,.88),transparent); content:""; animation:analysis-progress-sweep 1.25s ease-in-out infinite; }
.analysis-progress-meta { display:flex; justify-content:space-between; gap:12px; margin-top:9px; color:var(--text-muted); font-size:.65rem; font-weight:700; }
.analysis-progress-meta strong { color:var(--text-primary); }
.analysis-elapsed { margin-top:14px; color:var(--text-muted); font-size:.68rem; font-weight:700; font-variant-numeric:tabular-nums; }
.analysis-loading.has-error .analysis-spinner { display:none; }
.analysis-loading.has-error .analysis-loading-eyebrow { color:var(--danger); }
.analysis-error-actions { display:flex; justify-content:center; gap:10px; margin-top:18px; }
.analysis-retry-btn { min-height:42px; margin:0; padding:0 22px; border:0; border-radius:999px; background:var(--brand-lime); color:var(--brand-lime-dark); font-size:.78rem; font-weight:800; cursor:pointer; transition:transform var(--transition),background var(--transition); }
.analysis-retry-btn:hover { transform:translateY(-1px); background:#c4e828; }
.analysis-retry-btn:focus-visible { outline:3px solid rgba(160,104,53,.35); outline-offset:3px; }
.analysis-dismiss-btn { min-height:42px; padding:0 18px; border:1px solid var(--border); border-radius:999px; background:#fff; color:var(--text-secondary); font-size:.78rem; font-weight:700; cursor:pointer; }
.analysis-dismiss-btn:hover { border-color:var(--accent-light); color:var(--accent); }
.analysis-dismiss-btn:focus-visible { outline:3px solid rgba(160,104,53,.25); outline-offset:3px; }
body.is-analyzing { overflow:hidden; }
@media (prefers-reduced-motion: reduce) {
  .analysis-loading, .analysis-spinner::before, .analysis-progress-track.is-busy::after { animation-duration:.01ms; animation-iteration-count:1; }
}
.control-panel.is-analyzing { pointer-events:none; opacity:.72; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 640px;
  text-align: center;
  animation: fade-up 0.4s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Dropzone (upload card inside empty state) ── */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 40px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(160, 104, 53, 0.1);
}

.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-illustration { position: relative; margin-bottom: 8px; }
.dropzone-illustration > svg { width: 60px; height: 60px; color: var(--text-primary); opacity: 0.85; }

.dropzone-badge {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-lime);
  color: var(--brand-lime-dark);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(212, 249, 46, 0.4);
}
.dropzone-badge svg { width: 14px; height: 14px; }

.dropzone-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.015em; color: var(--text-primary); }
.dropzone-sub { font-size: 0.88rem; color: var(--text-secondary); margin-top: 2px; }

.dropzone-browse-btn {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  background: var(--brand-lime);
  color: var(--brand-lime-dark);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(212, 249, 46, 0.3);
  pointer-events: none;
}

.dropzone-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 6px; }

.dropzone-divider { width: 100%; max-width: 220px; height: 1px; background: var(--border); margin: 14px 0 12px; }

.sample-link {
  position: relative;
  z-index: 2;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.sample-link:hover { color:var(--accent-2); }
.sample-link:focus-visible { outline:3px solid rgba(160,104,53,.28); outline-offset:4px; border-radius:4px; }
.sample-dialog { width:min(760px,calc(100% - 32px)); max-width:none; max-height:min(86vh,760px); margin:auto; padding:26px; overflow:auto; border:1px solid var(--border); border-radius:20px; background:#fffdf9; color:var(--text-primary); box-shadow:0 28px 90px rgba(8,14,28,.28); }
.sample-dialog::backdrop { background:rgba(8,14,28,.38); -webkit-backdrop-filter:blur(7px); backdrop-filter:blur(7px); }
.sample-dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
.sample-dialog-head h2 { margin-top:5px; font-size:1.35rem; letter-spacing:-.03em; }
.sample-dialog-head p:last-child { margin-top:6px; color:var(--text-muted); font-size:.8rem; }
.sample-dialog-close { display:grid; width:36px; height:36px; flex:none; place-items:center; border:1px solid var(--border); border-radius:50%; background:#fff; color:var(--text-secondary); font-size:1.4rem; line-height:1; cursor:pointer; }
.sample-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.sample-option { position:relative; display:flex; min-width:0; flex-direction:column; overflow:hidden; padding:0; border:1px solid var(--border); border-radius:13px; background:#fff; text-align:left; cursor:pointer; transition:border-color var(--transition),box-shadow var(--transition),transform var(--transition); }
.sample-option:hover { transform:translateY(-2px); box-shadow:0 8px 24px rgba(33,26,18,.1); }
.sample-option[aria-pressed="true"] { border-color:var(--accent); box-shadow:0 0 0 2px rgba(160,104,53,.16); }
.sample-option img { display:block; width:100%; height:142px; object-fit:cover; background:#f1ebe0; }
.sample-option-copy { display:flex; min-width:0; flex-direction:column; gap:5px; padding:12px 38px 13px 13px; }
.sample-option-copy strong { color:var(--text-primary); font-size:.78rem; }
.sample-option-copy small { color:var(--text-muted); font-size:.68rem; line-height:1.35; }
.sample-option-check { position:absolute; right:11px; bottom:14px; display:grid; width:20px; height:20px; place-items:center; border:1px solid var(--border); border-radius:50%; background:#fff; }
.sample-option[aria-pressed="true"] .sample-option-check { border-color:var(--accent); background:var(--accent); color:#fff; }
.sample-option[aria-pressed="true"] .sample-option-check::after { content:"✓"; font-size:.72rem; font-weight:900; }
.sample-dialog-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:20px; padding-top:16px; border-top:1px solid var(--border); }
.sample-dialog-footer > span { color:var(--text-muted); font-size:.75rem; font-weight:700; }
.sample-add-btn { min-height:42px; padding:0 19px; border:0; border-radius:999px; background:var(--brand-lime); color:var(--brand-lime-dark); font-size:.76rem; font-weight:800; cursor:pointer; }
.sample-add-btn:disabled { background:#e7e4dd; color:#9c978d; cursor:not-allowed; }
.sample-add-btn:not(:disabled):hover { background:#c4e828; }
.sample-dialog-error { margin-top:12px; color:var(--danger); font-size:.75rem; }
.sample-dialog-error.is-hidden { display:none; }

.preview-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scale-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.preview-frame {
  position: relative;
  display: inline-flex;
  max-width: min(90vw, 1360px);
  max-height: min(68vh, calc(100vh - 300px), 720px);
}

.preview-frame img {
  display: block;
  max-width: min(90vw, 1360px);
  max-height: min(68vh, calc(100vh - 300px), 720px);
  width: auto;
  height: auto;
  object-fit: contain !important;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  background: #fff;
}

#overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: var(--radius-lg);
}

.app-shell.is-report-view { height: auto; min-height: 100vh; overflow: visible; }
.app-shell.is-report-view > .topnav { position:sticky; top:0; z-index:20; flex:none; }

.report-page { display: block; width: 100%; padding: 0 clamp(18px,3vw,48px) 56px; }
.report-shell { max-width: 1480px; margin: 0 auto; }
.report-topbar { display:flex; min-height:62px; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--border); }
.report-back-btn, .report-new-btn { border:0; background:transparent; color:var(--text-secondary); font-size:.82rem; font-weight:700; cursor:pointer; }
.report-back-btn:hover, .report-new-btn:hover { color:var(--accent); }
.report-back-btn:focus-visible, .report-new-btn:focus-visible { outline:3px solid rgba(160,104,53,.28); outline-offset:4px; border-radius:5px; }
.report-brand { display:flex; align-items:center; gap:10px; color:var(--text-primary); font-size:.78rem; font-weight:900; letter-spacing:.06em; }
.report-brand span { padding-left:10px; border-left:1px solid var(--border); color:var(--text-muted); font-size:.65rem; letter-spacing:.12em; }
.report-heading-row { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; padding:30px 0 26px; }
.report-eyebrow { display:flex; align-items:center; gap:8px; margin-bottom:10px; color:var(--success); font-size:.72rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.report-live-dot { width:8px; height:8px; border-radius:50%; background:#84cc16; box-shadow:0 0 0 4px rgba(132,204,22,.13); }
.report-heading-row h1 { color:var(--text-primary); font-size:clamp(1.8rem,3vw,2.6rem); letter-spacing:-.04em; }
.report-subtitle { margin-top:8px; color:var(--text-secondary); font-size:.9rem; }
.report-meta { display:flex; align-items:center; gap:20px; flex-wrap:wrap; justify-content:flex-end; }
.report-meta span { display:flex; flex-direction:column; gap:5px; color:var(--text-muted); font-size:.59rem; font-weight:800; letter-spacing:.09em; }
.report-meta strong { color:var(--text-primary); font-size:.75rem; letter-spacing:0; }
.report-summary-grid { display:grid; grid-template-columns:1.2fr repeat(3,1fr); gap:16px; margin-bottom:20px; }
.report-condition-card, .report-stat-card, .report-card { border:1px solid var(--border); border-radius:18px; background:#fff; box-shadow:0 4px 16px rgba(33,26,18,.045); }
.report-condition-card, .report-stat-card { min-height:132px; padding:21px 23px; display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:7px; }
.report-condition-card { border-color:#172334; background:linear-gradient(145deg,#101b2a,#19283a); color:#fff; box-shadow:0 8px 22px rgba(16,27,42,.12); }
.report-condition-card .report-card-label { color:rgba(255,255,255,.62); }
.report-condition-card strong { font-size:1.55rem; letter-spacing:-.03em; }
.report-condition-card > span:last-child { color:rgba(255,255,255,.58); font-size:.72rem; }
.report-card-label { color:var(--text-muted); font-size:.64rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.report-stat-card strong { color:var(--text-primary); font-size:1.35rem; letter-spacing:-.03em; }
.report-stat-card > span:last-child { color:var(--text-muted); font-size:.72rem; }
.report-main-grid { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(300px,.8fr); align-items:start; gap:20px; }
.report-main-column { display:grid; gap:20px; min-width:0; }
.report-card { padding:24px; min-width:0; }
.report-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.report-section-heading h2, .report-cost-card h2 { margin-top:5px; color:var(--text-primary); font-size:1.08rem; letter-spacing:-.02em; }
.report-photo-count { padding:6px 10px; border:1px solid var(--border); border-radius:999px; color:var(--text-secondary); font-size:.68rem; font-weight:700; white-space:nowrap; }
.report-photo-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr)); gap:18px; }
.report-photo-item { min-width:0; overflow:hidden; border:1px solid var(--border); border-radius:15px; background:var(--bg-primary); box-shadow:0 6px 20px rgba(28,35,42,.055); }
.report-photo-visual { position:relative; width:100%; height:clamp(280px,34vw,440px); overflow:hidden; background:radial-gradient(#e9e3d9 .8px,transparent .8px),#f8f6f2; background-size:14px 14px; }
.report-photo-visual img { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:contain; }
.report-detection-overlay { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; pointer-events:none; }
.report-photo-item figcaption { display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0; padding:11px 13px; color:var(--text-secondary); font-size:.7rem; }
.report-photo-item figcaption > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.report-photo-mark-count { flex:none; color:var(--text-muted); font-size:.66rem; font-weight:700; }
.report-table-wrap { overflow-x:auto; }
.report-table { width:100%; border-collapse:collapse; min-width:700px; text-align:left; }
.report-table th { padding:10px 12px; background:#f8f6f2; color:var(--text-muted); font-size:.62rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.report-table td { padding:14px 12px; border-bottom:1px solid #f0ece5; color:var(--text-secondary); font-size:.76rem; vertical-align:middle; }
.report-table tbody tr:hover td { background:#fcfaf6; }
.report-table tr:last-child td { border-bottom:0; }
.report-table td:first-child { color:var(--text-primary); font-weight:800; }
.report-severity { display:inline-flex; padding:4px 8px; border-radius:999px; font-size:.64rem; font-weight:800; }
.report-severity.minor { background:#eff8e8; color:#4d7c0f; }
.report-severity.medium { background:#fff4df; color:#a16207; }
.report-severity.severe { background:#fff0ed; color:#b42318; }
.report-empty-row { padding:24px !important; color:var(--success) !important; text-align:center; font-weight:700; }
.report-cost-card { position:sticky; top:82px; }
.report-cost-note { margin-top:7px; color:var(--text-muted); font-size:.76rem; line-height:1.5; }
.report-cost-lines { display:grid; gap:16px; margin-top:26px; }
.report-cost-lines > div, .report-total-line { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.report-cost-lines span { color:var(--text-secondary); font-size:.8rem; }
.report-cost-lines strong { color:var(--text-primary); font-size:.8rem; }
.report-total-line { margin-top:20px; padding-top:18px; border-top:1px solid var(--border); }
.report-total-line span { color:var(--text-primary); font-size:.8rem; font-weight:800; }
.report-total-line strong { color:var(--accent); font-size:1.35rem; letter-spacing:-.03em; }
.report-download-btn { display:flex; width:100%; min-height:48px; align-items:center; justify-content:center; gap:9px; margin-top:22px; border:0; border-radius:11px; background:var(--brand-lime); color:var(--brand-lime-dark); font-size:.8rem; font-weight:800; cursor:pointer; transition:transform var(--transition),background var(--transition); }
.report-download-btn:hover { transform:translateY(-1px); background:#c4e828; }
.report-download-btn:focus-visible { outline:3px solid rgba(160,104,53,.3); outline-offset:3px; }
.report-download-btn svg { width:17px; height:17px; }
.report-disclaimer { margin-top:14px; color:var(--text-muted); font-size:.67rem; line-height:1.55; }

@media (max-width: 960px) {
  .report-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .report-main-grid { grid-template-columns:1fr; }
  .report-cost-card { position:static; }
}

@media (max-width: 900px) {
  .site-header-inner { flex-wrap:nowrap; }
  .report-main-grid, .report-summary-grid, .report-photo-grid { min-width:0; }
  .report-table-wrap { max-width:100%; overscroll-behavior-inline:contain; }
}

@media (max-width: 640px) {
  .sample-dialog { width:calc(100% - 24px); padding:18px; border-radius:16px; }
  .sample-options { grid-template-columns:minmax(0,1fr); gap:9px; }
  .sample-option { display:grid; grid-template-columns:94px minmax(0,1fr) 22px; align-items:center; min-height:88px; }
  .sample-option img { width:94px; height:88px; }
  .sample-option-copy { padding:10px; }
  .sample-option-check { position:static; margin-right:12px; }
  .sample-dialog-footer { align-items:stretch; flex-direction:column; }
  .sample-add-btn { width:100%; }
  .report-page { padding:0 16px 32px; }
  .report-topbar { min-height:56px; padding:10px 0; }
  .report-back-btn, .report-new-btn { font-size:.74rem; }
  .report-brand { display:none; }
  .report-heading-row { align-items:flex-start; flex-direction:column; padding:24px 0 18px; }
  .report-meta { gap:14px; }
  .report-summary-grid { gap:10px; }
  .report-condition-card, .report-stat-card { min-height:108px; padding:14px; }
  .report-condition-card strong { font-size:1.25rem; }
  .report-stat-card strong { font-size:1.05rem; }
  .report-card { padding:17px; }
  .report-section-heading { align-items:flex-start; gap:10px; }
  .report-section-heading h2 { font-size:1.05rem; }
  .report-photo-visual { height:clamp(240px,68vw,340px); }
  .report-photo-grid { grid-template-columns:minmax(0,1fr); }
  .report-meta { width:100%; justify-content:space-between; padding-top:12px; border-top:1px solid var(--border); }
  .report-meta span { min-width:0; }
  .report-meta strong { font-size:.7rem; }
  .report-table { min-width:680px; }
}

.is-hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .control-panel { padding: 18px 0 0; }
}

@media (max-width: 900px) {
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .workspace { overflow-y: visible; padding: 0 16px 20px; }
  .control-panel { height: auto; }
  .stage-card { height: auto; }
  .image-stage { height: auto; min-height: 340px; overflow: visible; padding: 20px 14px; }
  .preview-wrap { min-width: 0; padding: 16px; }
  .preview-frame, .preview-frame img { max-width: 100%; }

  .workspace.has-results .stage-card { flex-direction: column; }
  .workspace.has-results .stage-main { border-right: 0; }
  .workspace.has-results .control-panel { width: 100%; border-left: 0; border-top: 1px solid var(--border); overflow-y: visible; }

  .topnav { padding: 10px 16px; gap: 16px; }
  .topnav-links { gap: 14px; }
  .topnav-link { font-size: 0.8rem; }

  .page-head { padding: 16px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-head h1 { font-size: 1.3rem; }

  .stage-card-head { padding: 16px 16px 0; flex-direction: column; align-items: flex-start; }
  .view-tabs { padding: 12px 16px; }
  .stage-footer { padding: 14px 16px; }

  .image-stage > .viewer-controls { top: 10px; right: 10px; gap: 8px; padding: 6px 8px; }

  .empty-state { max-width: 420px; }
  .dropzone { padding: 32px 20px; }

  .side-placeholder { flex-direction: column; align-items: stretch; gap: 14px; }
  .tips-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .tips-bar-btn { width: 100%; justify-content: center; }
  .tips-bar-add { width: 100%; justify-content: center; }
  .control-panel.has-photos { grid-template-columns: auto minmax(0, 1fr); }
  .control-panel.has-photos > .side-placeholder { flex-direction: row; align-items: center; padding: 12px 16px 12px 6px; }
  .control-panel.has-photos .tips-bar-btn { width: auto; }
  .workspace:not(.has-results) .control-panel.has-photos {
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    padding:10px 12px;
  }
  .workspace:not(.has-results) .control-panel.has-photos > .thumb-strip {
    width:100%;
    padding:4px 2px 8px;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
  }
  .workspace:not(.has-results) .control-panel.has-photos > .side-placeholder {
    width:100%;
    padding:0;
  }
  .workspace:not(.has-results) .control-panel.has-photos .tips-bar-btn {
    width:100%;
    min-height:48px;
    margin:0;
  }
}

@media (max-width: 640px) {
  .step-label { display: none; }
  .step-line { width: 16px; }
  .step-indicator { gap: 6px; }

  .view-tabs { flex-wrap: wrap; row-gap: 8px; }
  .view-tabs-spacer { flex-basis: 100%; height: 0; }
  .legend-chips { justify-content: flex-start; max-width: 100%; }

  .view-tab span, .view-tab { white-space: nowrap; }
  .image-stage > .viewer-controls { left: 10px; right: 10px; justify-content: space-between; }

  .empty-state { max-width: 92%; }
  .dropzone { padding: 28px 18px; }
  .dropzone-illustration > svg { width: 48px; height: 48px; }
  .dropzone-title { font-size: 1rem; }
  .dropzone-sub { font-size: 0.82rem; }
  .dropzone-browse-btn { padding: 9px 20px; font-size: 0.82rem; }

  .parts-table-body { max-height: 260px; }

  .stage-footer { flex-direction: column; align-items: stretch; }
  .stage-actions { flex-direction: column; align-items: stretch; justify-content: stretch; }
  .stage-actions .ghost-button { flex: 1; min-height: 44px; white-space: normal; text-align: center; line-height: 1.25; }

  .topnav-links { display: none; }
  .site-cta { display:none; }
}


@media (max-width: 480px) {
  .logo-text { font-size: 1.05rem; }

  .image-stage > .viewer-controls { gap:6px; padding:5px 7px; }
  .annotations-toggle { gap:6px; font-size:.72rem; }
  .zoom-value { width:32px; font-size:.7rem; }
  .zoom-btn { width:22px; height:22px; }

  .view-tab { padding: 6px 12px; font-size: 0.8rem; }
  .view-tab svg { display: none; }

  .control-panel { padding: 14px; gap: 12px; }
  .metrics { gap: 6px; }
  .metric-card { padding: 10px; }
  .metric-value { font-size: 1.25rem; }

  .image-stage { height: auto; min-height: 260px; overflow: visible; padding: 16px 10px; }
  .preview-wrap { padding: 10px; }

  .empty-state { max-width: 100%; }
  .dropzone { padding: 24px 14px; }
  .dropzone-illustration > svg { width: 42px; height: 42px; }
  .dropzone-badge { width: 22px; height: 22px; }
  .dropzone-badge svg { width: 12px; height: 12px; }
  .dropzone-title { font-size: 0.94rem; }
  .dropzone-sub { font-size: 0.78rem; }
  .dropzone-hint { font-size: 0.7rem; }
  .dropzone-browse-btn { width: 100%; justify-content: center; margin-top: 12px; padding: 10px; }
  .sample-link { font-size: 0.78rem; }

  .part-name { font-size: 0.82rem; }
  .part-status-badge { font-size: 0.65rem; padding: 3px 8px; }

  .file-chips { width: 100%; }
  .file-chip { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 360px) {
  .decision-alert span:last-child { display: none; }
  .site-header-inner { padding-inline:12px; }
  .site-brand { gap:7px; }
  .site-brand-text { font-size:1rem; }
  .site-cta { padding:8px 11px; font-size:.7rem; }
  .report-page { padding-inline:12px; }
  .report-card { padding:14px; }
}

@media (max-height: 560px) and (max-width: 900px) {
  .image-stage { height: auto; min-height: 220px; overflow: visible; padding: 14px; }
  .page-head { padding: 10px 16px; gap: 6px; }
  .page-head h1 { font-size: 1.4rem; }
  .page-sub { display: none; }
  .step-label { display: none; }
  .breadcrumb { display: none; }
}

@media (hover: none) and (pointer: coarse) {
  .part-row:hover { border-color: var(--border); }
  .metric-card:hover { transform: none; box-shadow: none; }
}

/* ── Premium PDF Report Styling ── */
#invoiceTemplate {
  width: 680px; /* Exact width to fit A4 with 0.5in margins (7.27 inches) */
  background: white;
  color: #0f172a;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
.watermark-bg {
  position: absolute;
  top: 35%;
  left: 15%;
  font-size: 120px;
  font-weight: 900;
  color: #94a3b8;
  opacity: 0.08;
  transform: rotate(-30deg);
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
}
.pro-report {
  padding: 25px;
  position: relative;
  z-index: 2;
}
.pro-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 4px solid #a06835;
  padding-bottom: 15px;
  margin-bottom: 25px;
}
.pro-logo-row { display: flex; align-items: center; gap: 12px; }
.pro-logo h1 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: #101828;
  letter-spacing: -0.02em;
}
.pro-logo h1 strong { color: #a06835; font-weight: 900; }
.pro-logo p {
  margin: 2px 0 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pro-header-right {
  display: flex;
  gap: 20px;
  align-items: center;
}
.pro-qr {
  width: 65px;
  height: 65px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
.pro-meta {
  text-align: right;
  font-size: 13px;
  color: #334155;
}
.pro-meta p {
  margin: 3px 0;
}
.pro-meta strong {
  color: #0f172a;
}
.pro-image-split {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  page-break-inside: avoid;
}
.split-col {
  flex: 1;
  background: #f8fafc;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  text-align: center;
}
.split-title {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.split-col img {
  max-width: 100%;
  max-height: 250px;
  border-radius: 2px;
  object-fit: contain;
}
.pro-summary-container {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  align-items: stretch;
  page-break-inside: avoid;
}
.pro-summary-box {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-item {
  flex: 1;
  background: #f8fafc;
  padding: 12px 15px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #b8763e;
  display: flex;
  flex-direction: column;
}
.summary-item span {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.summary-item strong {
  font-size: 15px;
  color: #0f172a;
}
.pro-section {
  margin-bottom: 30px;
  page-break-inside: avoid;
}
.pro-section-title {
  font-size: 15px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: #a06835;
  background: #f1f5f9;
  padding: 8px 12px;
  margin: 0 0 12px 0;
  border-left: 4px solid #a06835;
}
.pro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid #cbd5e1;
}
.pro-table th {
  background: #1e293b;
  color: #f8fafc;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}
.pro-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}
.pro-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.cost-table {
  width: 50%;
  margin-left: auto;
  border: 2px solid #cbd5e1;
}
.cost-table td {
  padding: 8px 12px;
}
.cost-val {
  text-align: right;
  font-weight: 600;
}
.pro-total-row {
  background: #f1f5f9;
}
.pro-total-row td {
  font-weight: 800;
  color: #0f172a;
  font-size: 15px;
  border-top: 2px solid #94a3b8;
  padding: 12px;
}
.total-val {
  color: #a06835;
  font-size: 16px !important;
}
/* Signatures & Terms */
.pro-signatures {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  page-break-inside: avoid;
}
.terms-text {
  font-size: 11px;
  color: #64748b;
  font-style: italic;
  line-height: 1.4;
}
.sig-blocks {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.sig-box {
  text-align: center;
  width: 180px;
}
.sig-line {
  border-bottom: 2px solid #334155;
  height: 40px;
  margin-bottom: 5px;
}
.sig-box span {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
}

.pro-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  border-top: 1px solid #cbd5e1;
  padding-top: 15px;
}
/* Severity Badges */
.sev-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.sev-minor { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.sev-medium { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.sev-severe { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

@media (max-width: 1100px) {
  .site-header-inner { gap:20px; }
  .site-nav-links { gap:18px; }
  .site-nav-link { font-size:.9rem; }
}
@media (max-width: 900px) {
  .site-header-inner { min-height:64px; }
  .site-nav-links { display:none; }
  .site-menu-toggle { display:flex; }
}
@media (max-width: 640px) {
  .site-header-inner { padding:10px 16px; gap:12px; }
  .site-brand-text { font-size:1.1rem; }
  .site-brand-icon { width:22px; }
  .site-cta { padding:9px 14px; font-size:.76rem; }
  .site-menu-toggle { padding:6px; }
  .site-mobile-menu { padding:10px 18px 18px; }
}

/* Clean, print-focused PDF report theme */
#invoiceTemplate {
  width:680px;
  overflow:visible;
  background:#fff;
  color:#172033;
  font-family:Inter,Arial,sans-serif;
}
.pro-report { padding:30px; color:#172033; background:#fff; }
.pro-header {
  align-items:center;
  gap:20px;
  margin:-30px -30px 24px;
  padding:22px 26px 20px;
  border:0;
  border-bottom:4px solid #d4f92e;
  border-radius:0;
  background:#080e1c;
}
.pro-logo-row { gap:11px; }
.pro-logo h1 { color:#fff; font-size:25px; }
.pro-logo h1 strong { color:#d4f92e; }
.pro-logo p { margin-top:5px; color:#b7c0d0; font-size:9px; letter-spacing:.12em; }
.pro-header-right { gap:0; }
.pro-meta { display:grid; grid-template-columns:1fr 1fr 50px; gap:14px; color:#fff; font-size:10px; text-align:left; }
.pro-meta p { display:flex; flex-direction:column; gap:4px; margin:0; }
.pro-meta strong { color:#aeb8c8; font-size:8px; letter-spacing:.1em; }
.pro-meta span { max-width:150px; overflow-wrap:anywhere; color:#fff; font-size:11px; font-weight:700; }
.pro-intro { margin-bottom:18px; }
.pro-intro > span { color:#a06835; font-size:8px; font-weight:800; letter-spacing:.16em; }
.pro-intro h2 { margin:4px 0; color:#101828; font-family:Outfit,Inter,sans-serif; font-size:23px; line-height:1.15; }
.pro-intro p { margin:0; color:#667085; font-size:10px; }
.pro-photo-context { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 7px; color:#667085; font-size:8px; }
.pro-photo-context strong { color:#172033; font-size:8px; letter-spacing:.08em; text-transform:uppercase; }
.pro-photo-context span { overflow:hidden; text-align:right; text-overflow:ellipsis; white-space:nowrap; }
.pro-image-split { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:18px; break-inside:avoid; page-break-inside:avoid; }
.split-col { min-width:0; padding:9px; border:1px solid #e5dbc9; border-radius:10px; background:#fbf9f5; }
.split-title { margin-bottom:7px; color:#5c5245; font-size:8px; letter-spacing:.12em; }
.split-col img { display:block; width:100%; height:190px; max-height:190px; object-fit:contain; border-radius:6px; background:#f1ebe0; }
.pro-summary-container { flex-direction:column; gap:12px; margin-bottom:20px; break-inside:avoid; page-break-inside:avoid; }
.pro-summary-box { flex:none; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.summary-item { min-width:0; justify-content:center; padding:13px; border:1px solid #e5dbc9; border-left:3px solid #a06835; border-radius:9px; background:#fbf9f5; }
.summary-condition { border-bottom:3px solid #d4f92e !important; border-left:0; text-align:left !important; }
.summary-repair-time { border-bottom:3px solid #a06835 !important; border-left:0; text-align:left !important; }
.summary-item span { color:#817565; font-size:8px; letter-spacing:.1em; }
.summary-item strong { color:#101828; font-size:15px !important; }
.pro-section { margin-bottom:20px; page-break-inside:auto; break-inside:auto; }
.pro-section-title { margin-bottom:8px; padding:9px 11px; border-left:3px solid #d4f92e; border-radius:0 7px 7px 0; background:#f7f3ec; color:#172033; font-size:11px; break-after:avoid; page-break-after:avoid; }
.pro-table { table-layout:fixed; border:1px solid #e5dbc9; border-radius:7px; font-size:9px; }
.pro-table th { padding:8px 7px; background:#101828; color:#fff; font-size:7px; letter-spacing:.07em; }
.pro-table td { padding:8px 7px; border-color:#eee8df; color:#344054; vertical-align:top; overflow-wrap:anywhere; }
.pro-table th:nth-child(1) { width:7%; }
.pro-table th:nth-child(2) { width:22%; }
.pro-table th:nth-child(3) { width:20%; }
.pro-table th:nth-child(4) { width:23%; }
.pro-table th:nth-child(5) { width:28%; }
.pro-table tbody tr { break-inside:avoid; page-break-inside:avoid; }
.cost-table { width:65%; margin-left:auto; border:1px solid #e5dbc9; }
.cost-table td { padding:8px 10px; }
.pro-total-row { background:#f7f3ec; }
.pro-total-row td { border-top:2px solid #d4f92e; color:#101828; }
.total-val { color:#8a572c; }
.pro-signatures { margin-top:22px; padding:14px 16px; gap:0; border:1px solid #e5dbc9; border-radius:9px; background:#fbf9f5; break-inside:avoid; page-break-inside:avoid; }
.terms-text { color:#667085; font-size:9px; font-style:normal; line-height:1.55; }
.terms-text strong { display:block; margin-bottom:4px; color:#101828; font-size:9px; }
.pro-footer { margin-top:18px; padding-top:10px; border-top:1px solid #e5dbc9; color:#8b8275; font-size:8px; }
.pro-footer p { margin:0; }
.sev-minor { background:#eff8e8; color:#4d7c0f; border-color:#cbe5b5; }
.sev-medium { background:#fff4df; color:#a16207; border-color:#f5d28a; }
.sev-severe { background:#fff0ed; color:#b42318; border-color:#f4c7bf; }
.pro-report, .pro-report * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
.pro-report { font-size:12px; }
.pro-logo p { font-size:10px; }
.pro-meta strong { font-size:9px; }
.pro-meta span { font-size:12px; }
.pro-intro > span { font-size:9px; }
.pro-intro p { font-size:11px; }
.pro-photo-context, .pro-photo-context strong { font-size:9px; }
.split-title { font-size:9px; }
.pro-summary-box { grid-template-columns:repeat(3,minmax(0,1fr)); }
.summary-item { padding:12px 10px; }
.summary-item span { font-size:9px; }
.summary-item strong { font-size:16px !important; }
.pro-section-title { font-size:12px; }
.pro-table { font-size:11px; }
.pro-table th { font-size:9px; }
.pro-table td { padding:9px 8px; }
.cost-table { width:70%; }
.terms-text, .terms-text strong { font-size:10px; }
.pro-footer { font-size:9px; }
.pro-footer { display:none; }
#invoiceTemplate { width:727px; overflow:visible; }
.pro-report { width:727px; padding:0; }
.pdf-page {
  position:relative;
  display:flex;
  width:727px;
  flex-direction:column;
  padding:24px;
  border:1px solid #e8e1d6;
  border-radius:14px;
  background:#fff;
  box-sizing:border-box;
}
.pdf-overview-page { break-inside:auto; page-break-inside:auto; margin-bottom:8px; }
.pdf-photo-page { break-inside:auto; page-break-inside:auto; margin-bottom:8px; }
.pdf-photo-page .pdf-page-heading { margin-bottom:12px; padding-bottom:10px; }
.pdf-photo-block { break-inside:avoid; page-break-inside:avoid; }
.pdf-photo-block + .pdf-photo-block { margin-top:20px; padding-top:18px; border-top:1px solid #e8e1d6; }
.pdf-photo-page .pro-photo-context { margin-bottom:10px; }
.pdf-photo-page .pro-image-split {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:stretch;
  gap:12px;
  margin-bottom:0;
  break-inside:avoid;
  page-break-inside:avoid;
}
.pdf-photo-page .split-col { display:flex; flex-direction:column; align-items:center; width:100%; break-inside:avoid; page-break-inside:avoid; }
.pdf-photo-page .split-col img {
  width:auto;
  max-width:100%;
  height:auto;
  max-height:340px;
  margin:0 auto;
  object-fit:contain;
}
.pdf-photo-findings { margin-top:12px; padding:11px 15px; border:1px solid #e5dbc9; border-radius:9px; background:#fbf9f5; }
.pdf-photo-findings-title { margin-bottom:9px; color:#101828; font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.pdf-photo-findings-chips { display:flex; flex-wrap:wrap; gap:8px; }
.pdf-finding-chip { display:inline-flex; align-items:center; gap:5px; padding:6px 10px; border:1px solid #e5dbc9; border-radius:999px; background:#fff; color:#344054; font-size:9px; }
.pdf-finding-chip strong { color:#101828; }
.pdf-finding-chip .sev-badge { padding:2px 7px; font-size:8px; }
.pdf-photo-page .pdf-page-footer { margin-top:20px; }
.pro-header { margin:0 0 22px; padding:20px 22px 18px; border-radius:11px 11px 2px 2px; }
.pro-intro { margin-bottom:14px; }
.pro-intro h2 { font-size:25px; }
.pro-photo-context { margin-bottom:8px; }
.pro-image-split { margin-bottom:18px; }
.split-col img { height:205px; max-height:205px; }
.pro-summary-container { margin-bottom:18px; }
.pro-summary-box { grid-template-columns:repeat(3,minmax(0,1fr)); }
.summary-item { min-height:68px; }
.pdf-overview-note { margin-top:18px; padding:13px 15px; border-left:3px solid #d4f92e; border-radius:0 8px 8px 0; background:#f7f8f1; }
.pdf-overview-note strong { display:block; margin-bottom:5px; color:#101828; font-size:11px; }
.pdf-overview-note p { margin:0; color:#667085; font-size:10px; line-height:1.5; }
.pdf-page-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:18px; padding-top:10px; border-top:1px solid #e8e1d6; color:#8b8275; font-size:8px; }
.pdf-page-footer strong { flex:none; color:#8a572c; font-size:8px; letter-spacing:.1em; }
.pdf-page-heading { margin:0 0 22px; padding-bottom:15px; border-bottom:1px solid #e8e1d6; }
.pdf-page-heading > span { color:#a06835; font-size:9px; font-weight:800; letter-spacing:.14em; }
.pdf-page-heading h2 { margin:5px 0 4px; color:#101828; font-family:Outfit,Inter,sans-serif; font-size:24px; line-height:1.15; }
.pdf-page-heading p { margin:0; color:#667085; font-size:11px; }
.pdf-details-page { break-inside:auto; page-break-inside:auto; }
.pdf-details-page .pro-section { margin-bottom:16px; }
.pdf-details-page .pro-damage-section { flex:0 0 auto; }
.pdf-details-page .cost-table { width:100%; }
.pdf-details-page .pro-signatures { margin-top:2px; }
.pdf-details-page .pdf-page-footer { margin-top:14px; }
.pdf-page, .pro-header, .pro-image-split, .pro-summary-container, .pdf-overview-note, .pro-section, .pro-signatures, .pdf-page-footer { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
