:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #16211f;
  --muted: #66736f;
  --line: #dbe3e0;
  --primary: #126e5a;
  --primary-dark: #0e5848;
  --accent: #c83f2b;
  --soft: #edf5f2;
  --warning: #fff5df;
  --warning-border: #e2b34d;
  --shadow: 0 18px 45px rgba(22, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.login-shell {
  align-items: center;
}

.login-panel {
  max-width: 720px;
}

.login-form {
  margin-top: 20px;
}

.auth-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}

.auth-help-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faf9;
}

.auth-help-panel p {
  margin-bottom: 8px;
}

.debug-auth-button {
  align-self: center;
  font-size: 0.82rem;
  opacity: 0.78;
}

.debug-auth-note {
  margin-top: 8px;
  font-size: 0.82rem;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.validation.success {
  color: var(--primary);
}

.panel {
  width: min(860px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.config-source {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.build-marker {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 2.7vw, 2rem);
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.instruction-block {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.disclaimer {
  margin-bottom: 16px;
  border: 1px solid var(--warning-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--warning);
  font-weight: 900;
}

.instruction-section {
  border-left: 4px solid var(--primary);
  padding: 10px 12px;
  background: #f8faf9;
}

.instruction-section h3 {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

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

.instruction-section ul {
  padding-left: 20px;
}

.progress {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.save-status {
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
}

.save-status.info {
  color: #5a4115;
  background: #f4ead8;
}

.save-status.success {
  color: #075a45;
  background: #dff4ec;
}

.save-status.error {
  color: #9f1d15;
  background: #ffe5e1;
}

.progress-track {
  height: 8px;
  background: #e8eeee;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 160ms ease;
}

#wizardForm {
  display: flex;
  flex: 1;
  flex-direction: column;
}

#screen {
  flex: 1;
}

.intro {
  display: grid;
  align-content: center;
  min-height: 460px;
  gap: 20px;
}

.lead {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
  max-width: 620px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

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

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.optional {
  color: var(--muted);
  font-weight: 700;
}

.file-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  overflow-wrap: anywhere;
}

.warning-text {
  margin: 0;
  color: #9b5d00;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.examples-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 14px 16px;
}

.examples-box ul {
  columns: 2;
  margin: 8px 0 0;
  padding-left: 22px;
}

label,
.label {
  color: #263532;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid #bfcac6;
  border-radius: 6px;
  padding: 13px 14px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(18, 110, 90, 0.18);
  border-color: var(--primary);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

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

.choice {
  position: relative;
}

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

.choice span,
.check-choice {
  min-height: 62px;
  border: 2px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-weight: 800;
  background: #fff;
}

.choice input:checked + span,
.check-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--soft);
  color: var(--primary-dark);
}

.choice span.status-option-yellow {
  border-color: #e0bd65;
}

.choice span.status-option-red {
  border-color: #e19288;
}

.choice span.status-option-na {
  border-color: #c8bfae;
}

.choice input:checked + span.status-option-yellow {
  border-color: #d9a441;
  background: #fff8e8;
  color: #7a5510;
}

.choice input:checked + span.status-option-red {
  border-color: #d92d20;
  background: #fff3f0;
  color: #b42318;
}

.choice input:checked + span.status-option-na {
  border-color: #c8bfae;
  background: #f8f5ef;
  color: #5f5547;
}

.inspection-subcheck-list {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.inspection-subcheck,
.rollup-summary {
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow-wrap: anywhere;
}

.rollup-summary {
  margin: 18px 0 10px;
}

.subcheck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.subcheck-header h3 {
  margin: 0;
  font-size: 1rem;
}

.subcheck-status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

.subcheck-photo-field {
  margin-top: 12px;
}

.section-level-evidence {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.v2-dev-button {
  border-style: dashed;
}

.lead-warning-badge {
  border-color: #b91c1c;
  color: #8f1515;
  background: #fff0ee;
}

.lead-warning-badge.lead-warning-critical {
  border-color: #7f1d1d;
  color: #fff;
  background: #b91c1c;
  box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.45);
  animation: leadPulse 1.8s ease-in-out infinite;
}

.lead-warning-badge.lead-warning-soon {
  border-color: #b7791f;
  color: #5f3b05;
  background: #fff4d6;
}

@keyframes leadPulse {
  0% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.42); }
  70% { box-shadow: 0 0 0 8px rgba(185, 28, 28, 0); }
  100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .lead-warning-badge.lead-warning-critical {
    animation: none;
  }
}

.lead-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.lead-summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7faf8;
}

.lead-summary-card span,
.lead-row small {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.lead-summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.lead-filter-row {
  margin-bottom: 12px;
}

.lead-table {
  display: grid;
  gap: 8px;
}

.lead-table-header,
.lead-row {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 0.8fr 1fr 1.2fr 0.9fr 0.5fr;
  gap: 10px;
  align-items: center;
}

.customer-table-header,
.customer-row {
  grid-template-columns: 1.2fr 1.2fr 0.7fr 1fr 0.9fr 0.5fr;
}

.lead-table-header {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 12px;
}

.lead-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.lead-row.warning {
  border-color: #d6a339;
  background: #fff9eb;
}

.lead-row.danger {
  border-color: #cf3d2e;
  background: #fff2f0;
}

.lead-detail-panel {
  margin-top: 16px;
}

.lead-detail-panel.focused {
  margin-top: 0;
}

.lead-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.lead-detail-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8faf9;
  overflow-wrap: anywhere;
}

.lead-detail-summary span,
.lead-event-list small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.lead-action-row {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.lead-event-list li {
  display: grid;
  gap: 3px;
}

.lead-linked-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
  color: var(--muted);
}

.lead-link-panel {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
  background: #fbfcfb;
}

.lead-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.lead-match-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
  background: #fff;
}

.lead-match-card.strong {
  border-color: #2f7d4f;
  background: #f0fbf4;
}

.lead-match-card.possible {
  border-color: #d6a339;
  background: #fff9eb;
}

.compact-fields {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.38);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
}

.error-text {
  color: #b42318;
  font-weight: 800;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.checkbox-grid.single {
  grid-template-columns: 1fr;
}

.check-choice {
  justify-content: flex-start;
  gap: 10px;
}

.check-choice input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

.conditional {
  margin-top: 14px;
}

.validation {
  min-height: 24px;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 800;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
}

.button {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  padding: 0 24px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: #e8eeee;
  color: var(--ink);
}

.button.compact {
  min-height: 48px;
  padding: 0 16px;
  white-space: nowrap;
}

.button.small-button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.92rem;
}

.inline-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

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

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  align-items: start;
}

.review-card,
.flag-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-card dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.review-card dt {
  color: var(--muted);
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-card dd {
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
  white-space: normal;
}

.flag-box {
  margin-top: 18px;
  background: var(--warning);
  border-color: var(--warning-border);
}

.paused-alert {
  border: 3px solid #b42318;
  border-radius: 8px;
  padding: 22px;
  background: #fff7f5;
}

.paused-alert.urgent {
  border-color: #8f1d14;
  background: #fff0ed;
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.14);
}

.paused-kicker {
  margin: 0 0 6px;
  color: #b42318;
  font-size: 1rem;
  font-weight: 900;
}

.paused-alert h2 {
  margin-bottom: 6px;
  color: #8f1d14;
  font-size: clamp(2rem, 5vw, 3rem);
}

.paused-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.paused-detail {
  border: 1px solid #e4a29a;
  border-radius: 6px;
  padding: 14px;
  background: #ffffff;
}

.paused-detail h3,
.paused-detail p {
  margin: 0;
}

.paused-detail h3 {
  margin-bottom: 6px;
}

.paused-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.draft-prompt {
  max-width: 680px;
  margin: 0 auto;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button.danger {
  background: #b42318;
}

.button.danger:hover {
  background: #8f1d14;
}

.button.danger-text {
  color: #b42318;
  border: 1px solid #f0b5ad;
}

.button.alert-button {
  color: #ffffff;
  background: #b42318;
}

.button.alert-button:hover {
  background: #8f1d14;
}

.success-text {
  margin-top: 14px;
  color: #126e5a;
  font-weight: 800;
}

.pdf-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.pdf-debug {
  margin-top: 16px;
}

.advisor-overview {
  grid-column: 1 / -1;
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 18px;
  background: #f7fbf9;
}

.advisor-overview h3 {
  margin-bottom: 14px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.overview-grid h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.grouped-concerns,
.concern-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.concern-title {
  margin: 0;
  font-weight: 900;
}

.flag-list {
  margin: 0;
  padding-left: 22px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.flag-list li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.photo-preview {
  width: min(100%, 520px);
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.photo-preview.small {
  max-height: 220px;
}

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

.photo-grid figure {
  margin: 0;
}

.photo-grid figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.quiet {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.muted-text {
  color: var(--muted);
  font-weight: 700;
}

.settings-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
}

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

.settings-readonly {
  margin-top: 14px;
}

.settings-table-wrap {
  overflow-x: auto;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.settings-table th,
.settings-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.settings-table th {
  background: #f4f8f6;
  font-weight: 900;
}

.compact-input,
.settings-table select {
  width: 100%;
  min-width: 120px;
  padding: 8px;
}

.table-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-weight: 800;
  white-space: nowrap;
}

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

.report-queue {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  width: 100%;
}

.report-queue-header,
.report-queue-row {
  display: grid;
  grid-template-columns: minmax(78px, 0.7fr) minmax(86px, 0.8fr) minmax(64px, 0.6fr) minmax(116px, 1.1fr) minmax(128px, 1.2fr) minmax(112px, 1fr) minmax(132px, 1fr);
  gap: 8px;
  align-items: center;
}

.report-queue-header {
  padding: 0 12px 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-queue-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(9, 35, 31, 0.04);
}

.queue-cell {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.vehicle-cell,
.concerns-cell {
  font-weight: 700;
}

.queue-muted {
  color: var(--muted);
  font-weight: 700;
}

.queue-badges,
.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.status-badge,
.concern-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.15;
}

.status-progress {
  color: #075a45;
  background: #dff4ec;
}

.status-paused,
.concern-badge.hard-stop,
.concern-badge.red {
  color: #9f1d15;
  background: #ffe5e1;
}

.status-completed {
  color: #38504a;
  background: #edf3f1;
}

.status-archived {
  color: #5f5547;
  background: #eee8df;
}

.concern-badge.yellow {
  color: #805400;
  background: #fff1c6;
}

.concern-badge.warning {
  color: #5a4115;
  background: #f4ead8;
}

.report-json {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.84rem;
}

.advisor-overview-column,
.report-concern-card,
.saved-report-concern-section,
.saved-report-section-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.advisor-overview-column,
.report-concern-card,
.saved-report-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.saved-report-section {
  background: #ffffff;
}

.saved-photo-groups {
  display: grid;
  gap: 18px;
}

.saved-photo-group {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.saved-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.saved-photo-card {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  min-width: 0;
}

.saved-photo-card img,
.photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #edf3f1;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.saved-file-card .photo-placeholder {
  background: #eef5f4;
  color: var(--primary);
}

.saved-photo-card figcaption {
  display: grid;
  gap: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.saved-photo-card figcaption strong {
  color: var(--ink);
}

.severity-red {
  border-color: #d92d20;
  background: #fff3f0;
}

.severity-yellow {
  border-color: #d9a441;
  background: #fff8e8;
}

.severity-na {
  border-color: #c8bfae;
  background: #f8f5ef;
}

.severity-neutral {
  border-color: var(--line);
  background: #f8faf9;
}

.severity-green {
  border-color: #cfe3dd;
  background: #f7fbf9;
}

.saved-report-concern-section.severity-red > h3,
.advisor-overview-column.severity-red h4 {
  color: #b42318;
}

.saved-report-concern-section.severity-yellow > h3,
.advisor-overview-column.severity-yellow h4 {
  color: #8a6116;
}

.debug-details summary {
  cursor: pointer;
  font-weight: 900;
}

.debug-details[open] summary {
  margin-bottom: 10px;
}

.shop-selection-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

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

.shop-selection-card h3 {
  margin: 0;
}

.full {
  grid-column: 1 / -1;
}

@media (max-width: 680px) {
  .app-shell {
    align-items: stretch;
    padding: 0;
  }

  .panel {
    min-height: 100vh;
    border-radius: 0;
    padding: 20px;
  }

  .topbar,
  .nav-row {
    flex-direction: column;
  }

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

  .field-grid,
  .choice-grid,
  .choice-grid.two,
  .checkbox-grid,
  .photo-grid,
  .overview-grid,
  .review-grid,
  .paused-grid {
    grid-template-columns: 1fr;
  }

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

  .inline-action {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .report-queue-header {
    display: none;
  }

  .lead-table-header {
    display: none;
  }

  .lead-row {
    grid-template-columns: 1fr;
  }

  .report-queue-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .queue-cell {
    display: grid;
    gap: 4px;
  }

  .queue-cell::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .status-cell::before,
  .actions-cell::before {
    display: none;
  }

  .queue-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* V2 app-shell layout pass. Keeps existing workflow/components intact while
   giving module pages a wider, calmer product layout. */
.product-shell {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background: linear-gradient(180deg, #f7faf9 0, #eef4f2 100%);
}

.app-panel {
  width: 100%;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  gap: 0;
  background: transparent;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(210px, 0.85fr) minmax(320px, 1.6fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: center;
  width: 100%;
  border-bottom: 1px solid var(--line);
  padding: 14px clamp(18px, 3vw, 36px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.app-brand {
  min-width: 0;
}

.app-brand h1 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.15;
}

.app-brand .eyebrow,
.app-brand .config-source {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px;
}

.app-nav-item {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: #33413e;
  background: transparent;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 900;
  cursor: pointer;
}

.app-nav-item:hover {
  background: #edf5f2;
  color: var(--primary-dark);
}

.app-nav-item-active {
  border-color: #b8d7cd;
  color: var(--primary-dark);
  background: var(--soft);
}

.app-user-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.app-user-area .config-source {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: min(1280px, calc(100% - 36px));
  margin: 18px auto 0;
}

.workflow-statusbar .progress {
  background: #ffffff;
}

.dev-tools {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.dev-tools summary {
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
}

.dev-tools[open] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.product-shell .progress-track {
  width: min(1280px, calc(100% - 36px));
  margin: 12px auto 0;
}

.product-shell #wizardForm {
  width: min(1280px, calc(100% - 36px));
  margin: 18px auto 36px;
}

.product-shell #screen {
  min-width: 0;
}

.page-container,
.reports-view,
.settings-view {
  display: grid;
  gap: 18px;
}

.page-header,
.section-heading-row.page-header {
  align-items: flex-start;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(13, 46, 40, 0.06);
}

.page-title {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.05rem);
}

.page-subtitle {
  margin: 4px 0 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.45;
}

.page-actions,
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.content-card,
.content-section,
.review-card,
.flag-box,
.advisor-overview,
.lead-link-panel,
.paused-alert {
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13, 46, 40, 0.045);
}

.summary-grid,
.lead-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.metric-card,
.lead-summary-card {
  min-height: 92px;
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(13, 46, 40, 0.04);
}

.lead-summary-card strong {
  font-size: 1.8rem;
}

.form-grid,
.field-grid {
  gap: 18px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.table-wrap,
.lead-table,
.report-queue,
.settings-table-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.data-table,
.settings-table {
  width: 100%;
}

.lead-table-header,
.lead-row {
  min-width: 980px;
}

.customer-table-header,
.customer-row {
  min-width: 860px;
}

.report-queue-header,
.report-queue-row {
  min-width: 1080px;
}

.lead-table-header,
.report-queue-header {
  padding: 0 14px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 900;
}

.lead-row,
.report-queue-row,
.lead-match-card {
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(13, 46, 40, 0.035);
}

.lead-row strong,
.queue-cell {
  line-height: 1.25;
}

.status-badge,
.priority-badge,
.alert-badge,
.concern-badge {
  min-height: 28px;
  border-radius: 999px;
  font-weight: 900;
}

.alert-badge {
  border: 1px solid var(--line);
  padding: 7px 11px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.primary-action,
.button.primary {
  background: var(--primary);
}

.secondary-action,
.button.secondary,
.muted-action {
  background: #edf3f1;
}

.danger-action,
.button.danger,
.button.danger-text {
  color: #b42318;
}

.button {
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.button:hover,
.app-nav-item:hover,
.alert-badge:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.app-nav-item:focus-visible,
.alert-badge:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(18, 110, 90, 0.25);
  outline-offset: 2px;
}

.reports-view > .review-card.full:first-child,
.leads-view > .review-card.full,
.customers-view > .review-card.full,
.estimates-view > .review-card.full,
.settings-view > .review-grid {
  min-width: 0;
}

.lead-filter-row,
.report-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
}

.lead-filter-row .button,
.report-filter-row .button {
  flex: 0 0 auto;
}

.estimate-job-card,
.estimate-line-card {
  background: #ffffff;
}

.estimate-line-card .field-grid {
  margin-top: 0;
}

.estimate-meta-card {
  margin-bottom: 16px;
}

.estimate-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.estimate-meta-grid > div,
.estimate-job-detail-grid > div,
.estimate-totals-list > div {
  display: grid;
  gap: 4px;
}

.estimate-meta-grid span,
.estimate-job-detail-grid span,
.estimate-totals-list span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.estimate-meta-grid small {
  color: var(--muted);
}

.estimate-builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
  align-items: start;
}

.estimate-main-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.estimate-builder-card {
  display: grid;
  gap: 14px;
}

.estimate-jobs-list {
  display: grid;
  gap: 14px;
}

.estimate-job-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 12px 30px rgba(12, 39, 34, 0.06);
}

.estimate-job-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.estimate-job-summary h3 {
  margin: 2px 0 4px;
}

.estimate-job-metrics {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 130px;
}

.estimate-job-metrics strong {
  font-size: 1.15rem;
}

.estimate-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.estimate-job-edit-panel,
.estimate-pending-job-card {
  margin-top: 12px;
  border: 1px solid #cfe3dc;
  border-radius: 8px;
  padding: 12px;
  background: #fbfefd;
}

.estimate-job-expanded {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.estimate-job-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.estimate-job-detail-grid strong {
  font-weight: 700;
  line-height: 1.35;
}

.estimate-line-table-wrap {
  display: grid;
  gap: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.estimate-line-row {
  display: grid;
  grid-template-columns: 90px minmax(220px, 1.5fr) 95px 110px 110px 110px 82px 110px 120px;
  gap: 10px;
  align-items: center;
  min-width: 1040px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.estimate-line-row:last-child {
  border-bottom: 0;
}

.estimate-line-header {
  background: #f4f7f6;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.estimate-line-row small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.estimate-line-edit-row {
  background: #fbfefd;
}

.estimate-line-edit-row input,
.estimate-line-edit-row select {
  width: 100%;
  min-width: 0;
}

.pending-line-row {
  box-shadow: inset 3px 0 0 #1f9a75;
}

.estimate-empty-lines {
  padding: 14px;
}

.estimate-data-warning {
  border-color: #f2b84b;
  background: #fff8e8;
  color: #543400;
}

.estimate-data-warning strong {
  display: block;
  color: #3f2800;
  margin-bottom: 4px;
}

.estimate-orphan-lines-card {
  border-color: #f2b84b;
  background: #fffdf8;
}

.estimate-job-total-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.9rem;
}

.estimate-job-total-row strong {
  color: var(--text);
}

.estimate-totals-panel {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 12px;
}

.estimate-totals-list {
  display: grid;
  gap: 8px;
}

.estimate-totals-list > div {
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.estimate-totals-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.estimate-grand-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 2px solid #123b33;
}

.estimate-grand-total strong {
  font-size: 1.3rem;
}

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

.customer-estimate-preview {
  border-color: #b8d7cd;
  background: #fbfefd;
}

.product-shell #wizardForm > .nav-row {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(247, 250, 249, 0), #f7faf9 28%);
}

@media (max-width: 980px) {
  .app-topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .app-nav {
    width: 100%;
  }

  .app-user-area {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .workflow-statusbar,
  .product-shell .progress-track,
  .product-shell #wizardForm {
    width: min(100% - 24px, 1280px);
  }

  .page-header,
  .section-heading-row.page-header {
    display: grid;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .estimate-builder-layout {
    grid-template-columns: 1fr;
  }

  .estimate-totals-panel {
    position: static;
  }

  .estimate-notes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .product-shell .panel {
    padding: 0;
  }

  .app-topbar {
    padding: 12px;
  }

  .app-brand h1 {
    font-size: 1.05rem;
  }

  .app-nav {
    gap: 4px;
  }

  .app-nav-item {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.88rem;
  }

  .app-user-area {
    gap: 8px;
  }

  .app-user-area .button,
  .dev-tools .button,
  .alert-badge {
    width: auto;
  }

  .app-user-area .config-source {
    max-width: 180px;
  }

  .workflow-statusbar {
    margin-top: 12px;
  }

  .workflow-statusbar .progress,
  .workflow-statusbar .save-status {
    width: auto;
    max-width: none;
  }

  .dev-tools {
    width: 100%;
    margin-left: 0;
  }

  .product-shell #wizardForm {
    margin-top: 12px;
    margin-bottom: 24px;
  }

  .page-header,
  .section-heading-row.page-header,
  .review-card,
  .flag-box,
  .advisor-overview {
    padding: 14px;
  }

  .page-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

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

  .lead-table,
  .report-queue {
    overflow-x: visible;
  }

  .lead-table-header,
  .report-queue-header {
    display: none;
  }

  .lead-row,
  .customer-row,
  .report-queue-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .button:hover,
  .app-nav-item:hover,
  .alert-badge:hover {
    transform: none;
  }

  .estimate-job-summary {
    grid-template-columns: 1fr;
  }

  .estimate-job-metrics {
    justify-items: start;
  }

  .estimate-job-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .estimate-job-actions .button,
  .estimate-line-row .button-row .button {
    width: 100%;
  }

  .estimate-line-table-wrap {
    border: 0;
    gap: 10px;
    overflow-x: visible;
    background: transparent;
  }

  .estimate-line-header {
    display: none;
  }

  .estimate-line-row {
    grid-template-columns: 1fr;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  .estimate-line-edit-row {
    background: #fbfefd;
  }
}
