/* Inspections-only styles layered on top of inspections_shell.css. */

[data-inspection-wizard-source] {
  display: none;
}

.inspections-page .ipi-mobile-cell-label {
  display: none;
}

.insp-wizard-modal .modal__dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: 640px;
  max-height: min(90vh, 840px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
}

.insp-wizard-modal .modal__header.insp-wizard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--ipi-rule);
  flex-shrink: 0;
}

.insp-wizard-header__main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.insp-wizard-step-label {
  margin: 0;
  color: var(--ipi-accent);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.insp-wizard-title {
  margin: 0;
  color: var(--ipi-ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.insp-wizard-progress {
  display: flex;
  gap: 4px;
}

.insp-wizard-progress__seg {
  height: 3px;
  flex: 1 1 0;
  border-radius: 99px;
  background: var(--ipi-bg-inset);
  transition: background-color 0.2s ease;
}

.insp-wizard-progress__seg.is-active {
  background: var(--ipi-accent);
}

.insp-wizard-modal .modal__close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ipi-bg-inset);
  color: var(--ipi-ink-4);
  border: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
}

.insp-wizard-modal .modal__close:hover {
  background: #e5e1d8;
  color: var(--ipi-ink-3);
}

.insp-wizard-modal .modal__body.insp-wizard-modal__body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px;
}

.insp-wizard-modal .insp-wizard-steps {
  min-height: 100%;
}

.insp-wizard-modal .insp-wizard-form .insp-step-card.insp-wizard-step-card {
  background: var(--ipi-bg-inset);
  border: 1px solid var(--ipi-rule-h);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: none;
  margin-bottom: 4px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-step-card__header {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-step-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ipi-accent-bg);
  border: 1px solid var(--ipi-accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ipi-accent);
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-step-card__icon svg {
  width: 18px;
  height: 18px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-step-card__eyebrow {
  margin: 0 0 3px;
  color: var(--ipi-accent);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-step-card__title {
  margin: 0 0 3px;
  color: var(--ipi-ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-step-card__copy {
  margin: 0;
  color: var(--ipi-ink-4);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.5;
}

.ipi-td-insp-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.ipi-td-insp-link:hover .ipi-td-insp-name,
.ipi-td-insp-link:focus-visible .ipi-td-insp-name {
  text-decoration: underline;
}

.ipi-td-insp-link:focus-visible {
  outline: 2px solid var(--ipi-accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-grid {
  gap: 14px;
}

.insp-wizard-modal .insp-wizard-form input[type="text"],
.insp-wizard-modal .insp-wizard-form input[type="tel"],
.insp-wizard-modal .insp-wizard-form input[type="date"],
.insp-wizard-modal .insp-wizard-form input[type="datetime-local"],
.insp-wizard-modal .insp-wizard-form select,
.insp-wizard-modal .insp-wizard-form textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--ipi-bg-card);
  border: 1px solid var(--ipi-rule-h);
  border-radius: 8px;
  color: var(--ipi-ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  box-shadow: none;
}

.insp-wizard-modal .insp-wizard-form textarea {
  min-height: 92px;
  resize: vertical;
}

.insp-wizard-modal .insp-wizard-form input:focus,
.insp-wizard-modal .insp-wizard-form select:focus,
.insp-wizard-modal .insp-wizard-form textarea:focus {
  border-color: var(--ipi-accent-border);
  box-shadow: 0 0 0 3px var(--ipi-accent-bg);
}

.insp-wizard-modal .insp-wizard-form .form-hint {
  color: var(--ipi-ink-4);
  font-size: 12px;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-signature {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-field__label {
  color: var(--ipi-ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-field__optional {
  color: var(--ipi-ink-4);
  font-size: 12px;
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-signature__empty {
  width: 100%;
  padding: 10px 14px;
  background: var(--ipi-bg-card);
  border: 1px solid var(--ipi-rule-h);
  border-radius: 8px;
  color: var(--ipi-ink-4);
  font-size: 13px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-suggestions {
  margin-top: 6px;
  margin-bottom: 16px;
  border: 0;
  background: none;
  box-shadow: none;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-suggestions summary {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 7px;
  background: var(--ipi-bg-card);
  border: 1px solid var(--ipi-rule-h);
  color: var(--ipi-ink-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-suggestions summary::-webkit-details-marker {
  display: none;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-suggestions[open] summary {
  margin-bottom: 8px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-suggestions .quick-fill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-suggestions .quick-fill {
  background: var(--ipi-bg-card);
  border-color: var(--ipi-rule-h);
  color: var(--ipi-ink-3);
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-photo-zone .file-upload-card__action {
  min-height: 152px;
  border: 2px dashed var(--ipi-rule-h);
  border-radius: 10px;
  background: var(--ipi-bg-card);
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-photo-zone .file-upload-card__action:hover,
.insp-wizard-modal .insp-wizard-form .insp-wizard-photo-zone.file-upload-card--has-value .file-upload-card__action {
  border-color: var(--ipi-accent-border);
  background: var(--ipi-accent-bg);
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-photo-zone .file-upload-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--ipi-bg-inset);
  border: 1px solid var(--ipi-rule-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card {
  background: var(--ipi-bg-card);
  border: 1px solid var(--ipi-rule-h);
  border-radius: 10px;
  padding: 16px;
  margin-top: 14px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-repeater__list {
  min-height: 0;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card [data-floorplan-empty] {
  margin: 0 0 12px;
  color: var(--ipi-ink-4);
  font-size: 13px;
  font-weight: 300;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-repeater__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card [data-floorplan-add] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ipi-accent-bg);
  border: 1px solid var(--ipi-accent-border);
  color: var(--ipi-accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-repeater__limit {
  color: var(--ipi-ink-4);
  font-size: 12.5px;
  font-weight: 500;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card {
  border-radius: 10px;
  background: var(--ipi-bg-card);
  border: 1px solid var(--ipi-rule-h);
  box-shadow: none;
  padding: 16px;
  gap: 12px;
  margin-top: 14px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__header h4 {
  margin: 0;
  color: var(--ipi-ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__header .btn.btn-link,
.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card [data-floorplan-remove] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--ipi-rule-h);
  background: var(--ipi-bg-card);
  color: var(--ipi-ink-3);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--ipi-shadow-sm);
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__fields label,
.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__notes label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__fields .small-text,
.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__notes .small-text,
.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .file-field__label {
  color: var(--ipi-ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card__notes textarea {
  width: 100%;
  min-height: 80px;
  border-radius: 8px;
  border: 1px solid var(--ipi-rule-h);
  background: var(--ipi-bg-card);
  color: var(--ipi-ink);
  padding: 9px 12px;
  font-size: 13.5px;
  resize: vertical;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card .form-hint {
  margin-top: 3px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card .file-upload-card__action {
  min-height: 132px;
  border: 2px dashed var(--ipi-rule-h);
  border-radius: 10px;
  background: var(--ipi-bg-card);
  justify-content: center;
  text-align: center;
  padding: 20px 16px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-floorplan-card .floorplan-card .file-upload-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--ipi-bg-inset);
  border: 1px solid var(--ipi-rule-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-top: 1px solid var(--ipi-rule);
  margin: 0 -20px -20px;
  background: var(--ipi-bg-card);
  flex-wrap: wrap;
  position: sticky;
  bottom: -20px;
  z-index: 2;
}

.insp-wizard-modal .insp-wizard-form .insp-wizard-actions__note {
  margin: 0;
  color: var(--ipi-ink-4);
  font-size: 12.5px;
  font-weight: 300;
  flex: 1 1 auto;
}

.insp-wizard-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 20px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.insp-wizard-footer-btn--ghost {
  background: var(--ipi-bg-card);
  color: var(--ipi-ink-3);
  border-color: var(--ipi-rule-h);
}

.insp-wizard-footer-btn--ghost:hover {
  background: var(--ipi-bg-hover);
  color: var(--ipi-ink-2);
}

.insp-wizard-footer-btn--accent {
  background: #1a1815;
  border-color: #1a1815;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.insp-wizard-footer-btn--accent:hover {
  background: #3d3a34;
  border-color: #3d3a34;
}

.insp-wizard-footer-btn[hidden] {
  display: none !important;
}

.insp-wizard-modal .insp-wizard-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.insp-wizard-modal .insp-wizard-form .insp-step-card {
  margin: 0;
}

.insp-wizard-modal .insp-wizard-form .insp-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.insp-wizard-modal .insp-wizard-form .table-subtext {
  color: var(--ipi-ink-4);
  font-size: 12px;
  font-weight: 300;
  text-transform: none;
  letter-spacing: 0;
}

.insp-wizard-modal .insp-wizard-form .file-upload-card {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.insp-wizard-modal .insp-wizard-form .file-upload-card__action strong {
  display: block;
  color: var(--ipi-ink-2);
  font-size: 13.5px;
}

.insp-wizard-modal .insp-wizard-form .file-upload-card__action p {
  margin: 0;
  color: var(--ipi-ink-4);
  font-size: 12.5px;
  font-weight: 300;
}

.insp-wizard-modal .insp-wizard-form .floorplan-repeater {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  gap: 0;
}

.ipi-chip--cancelled {
  background: var(--ipi-red-bg);
  color: var(--ipi-red);
  border: 1px solid var(--ipi-red-border);
}

@media (max-width: 900px) {
  .insp-wizard-modal .insp-wizard-form .insp-form-grid {
    grid-template-columns: 1fr;
  }

  /* Canonical footer: 2-col grid with `:last-child:nth-child(odd)` full-width
     rule so 2 buttons = row of 2, 3 = 2+1, 1 = full-width. Matches every other
     modal family in the app. Replaces the prior `width: 100%` on every button
     which stacked them vertically. The note is moved to a dedicated row above
     the buttons so it doesn't compete for grid cells. */
  .insp-wizard-modal .insp-wizard-form .insp-wizard-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .insp-wizard-modal .insp-wizard-form .insp-wizard-actions__note {
    grid-column: 1 / -1;
    order: -1;
    margin: 0 0 4px;
  }

  /* `.insp-wizard-actions` has a `<p class="insp-wizard-actions__note">` as
     its first grid child (full-width via `order: -1` + `grid-column: 1 / -1`).
     That means `:nth-child(odd)` counts including the note and misfires, so
     the canonical odd-last-child pattern doesn't work here. Use
     `:nth-of-type(odd):last-of-type` which counts only `<button>` siblings:
     1 btn → full-width, 2 btns → row of 2, 3 btns → 2+1 full-width. */
  .insp-wizard-modal .insp-wizard-form .insp-wizard-actions > .insp-wizard-footer-btn:nth-of-type(odd):last-of-type {
    grid-column: 1 / -1;
  }

  .insp-wizard-footer-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

[data-inspection-client-modal] .modal__dialog {
  width: min(400px, calc(100vw - 48px));
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

[data-inspection-client-modal] .ipi-client-modal__header {
  position: relative;
  padding: 20px 20px 16px;
  margin: 0;
  border-bottom: 1px solid var(--ipi-rule);
  background: var(--ipi-card);
}

[data-inspection-client-modal] .ipi-client-modal__header-copy {
  padding-right: 44px;
}

[data-inspection-client-modal] .ipi-client-modal__eyebrow {
  margin: 0 0 5px;
  color: var(--ipi-ink-4);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

[data-inspection-client-modal] .ipi-client-modal__title {
  margin: 0;
  color: var(--ipi-ink);
  font-family: 'Sora', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

[data-inspection-client-modal] .ipi-client-modal__close {
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ipi-bg-inset);
  color: var(--ipi-ink-4);
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  transition: background 0.15s ease;
}

[data-inspection-client-modal] .ipi-client-modal__close:hover {
  background: var(--ipi-bg-deep);
}

[data-inspection-client-modal] .ipi-client-modal__close svg {
  width: 12px;
  height: 12px;
}

[data-inspection-client-modal] .ipi-client-modal__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: var(--ipi-card);
  margin: 0;
}

[data-inspection-client-modal] .ipi-client-modal__current-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-inspection-client-modal] .ipi-client-modal__current-label,
[data-inspection-client-modal] .ipi-client-modal__field-label {
  color: var(--ipi-ink-4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

[data-inspection-client-modal] .ipi-client-modal-current {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--ipi-bg);
  border: 1px solid var(--ipi-rule-h);
  color: var(--ipi-ink-3);
  font-size: 13.5px;
  font-weight: 500;
}

[data-inspection-client-modal] .ipi-client-modal__divider {
  height: 1px;
  background: var(--ipi-rule);
}

[data-inspection-client-modal] .ipi-client-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-inspection-client-modal] .ipi-client-modal__select {
  width: 100%;
  min-height: 42px;
  padding: 10px 32px 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--ipi-rule-h);
  background: var(--ipi-bg-inset);
  color: var(--ipi-ink-2);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%239A9188' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
}

[data-inspection-client-modal] .ipi-client-modal__select:focus {
  border-color: var(--ipi-accent-border);
  box-shadow: 0 0 0 3px rgba(196, 149, 16, 0.12);
}

[data-inspection-client-modal] .history-status-alert {
  margin-top: -2px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ipi-bg);
  border: 1px solid var(--ipi-rule);
  color: var(--ipi-ink-3);
  font-size: 12.5px;
}

[data-inspection-client-modal] .ipi-client-modal__actions {
  padding-top: 14px;
  border-top: 1px solid var(--ipi-rule);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

[data-inspection-client-modal] .ipi-client-modal__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 20px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

[data-inspection-client-modal] .ipi-client-modal__btn--ghost {
  background: var(--ipi-card);
  border-color: var(--ipi-rule-h);
  color: var(--ipi-ink-3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-inspection-client-modal] .ipi-client-modal__btn--ghost:hover {
  background: var(--ipi-bg-hover);
  color: var(--ipi-ink-2);
}

[data-inspection-client-modal] .ipi-client-modal__btn--accent {
  background: #1a1815;
  border-color: #1a1815;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-inspection-client-modal] .ipi-client-modal__btn--accent:hover {
  background: #3d3a34;
  border-color: #3d3a34;
}

[data-inspection-client-modal] .ipi-client-modal__btn--accent:disabled {
  opacity: 1;
  background: rgba(26, 24, 21, 0.32);
  border-color: rgba(26, 24, 21, 0.32);
  color: rgba(255, 255, 255, 0.92);
  cursor: not-allowed;
  box-shadow: none;
}

.insp-step-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 24px;
  padding: 22px;
  background: var(--card, #ffffff);
  box-shadow: var(--panel-shadow, 0 14px 28px rgba(15, 23, 42, 0.08));
}

.insp-step-animate {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 320ms ease-out, transform 320ms ease-out;
}

.insp-step-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.insp-form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 12px;
}

.insp-signature-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.insp-signature-preview__img {
  max-width: 220px;
  max-height: 90px;
  border: 1px solid #d0d7e5;
  border-radius: 10px;
  padding: 6px;
  background: #fff;
}

.insp-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #0f172a;
}

.insp-form input,
.insp-form textarea,
.insp-form select {
  border: 1px solid #d0d7e5;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  width: 100%;
}

.insp-form textarea {
  min-height: 68px;
  resize: vertical;
}

.insp-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.insp-history-panel {
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.insp-history-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 16px;
}

.insp-history-table {
  width: 100%;
  border-collapse: collapse;
}

.insp-history-table th,
.insp-history-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.insp-history-table tr[data-insp-link] {
  cursor: pointer;
}

.insp-history-table tr[data-insp-link]:hover {
  background: rgba(239, 246, 255, 0.75);
}

.insp-flash {
  margin-bottom: 16px;
}

html[data-theme="dark"] .insp-step-card,
html[data-theme="dark"] .insp-history-panel {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--panel-shadow);
}

html[data-theme="dark"] .insp-signature-preview__img {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.28);
}

/* ============================================================================
   Inspections canonical modal primitives — `.inspection-modal*`
   Mirrors the .set-modal / .qbm-modal language so every inspection-page modal
   (wizard, history status, client, delete + the 6 show-page modals) shares
   the same shell, inputs, footer slots and mobile bottom-sheet behaviour.
   Values lifted from settings-shell.css `.set-modal` block (~line 6320).
   ============================================================================ */

.inspection-modal {
    --insp-accent: var(--accent, #c49510);
    --insp-accent-soft: var(--accent-soft, rgba(196, 149, 16, 0.1));
    --insp-accent-strong: rgba(196, 149, 16, 0.34);
    --insp-ink: var(--ink, #1a1815);
    --insp-ink-muted: var(--ink-3, #6b6458);
    --insp-ink-faint: var(--ink-4, #9a9188);
    --insp-border: var(--rule, rgba(26, 24, 21, 0.08));
    --insp-border-rule: rgba(26, 24, 21, 0.07);
    --insp-border-input: rgba(26, 24, 21, 0.14);
    --insp-bg-warm: #f7f5f0;
    --insp-surface: var(--surface-card, #ffffff);
    --insp-surface-soft: #fcfaf4;

    /* --ipi-* token aliases so canonical primitives (.ipi-tabs, .ipi-tab,
       .ipi-filter-search) render correctly inside the modal scope. */
    --ipi-bg: var(--canvas, #f7f5f0);
    --ipi-bg-inset: var(--surface-inset, #edeae3);
    --ipi-bg-card: var(--surface-card, #ffffff);
    --ipi-bg-hover: rgba(26, 24, 21, 0.04);
    --ipi-rule: var(--rule, rgba(26, 24, 21, 0.08));
    --ipi-rule-h: rgba(26, 24, 21, 0.11);
    --ipi-ink: var(--ink, #1a1815);
    --ipi-ink-2: #3d3a34;
    --ipi-ink-3: var(--ink-3, #6b6458);
    --ipi-ink-4: var(--ink-4, #9a9188);
    --ipi-accent: var(--accent, #c49510);
    --ipi-accent-bg: rgba(196, 149, 16, 0.08);
    --ipi-accent-border: rgba(196, 149, 16, 0.34);
    --ipi-shadow-sm: 0 1px 3px rgba(26, 24, 21, 0.06), 0 1px 2px rgba(26, 24, 21, 0.04);
    --ipi-shadow-card: 0 1px 4px rgba(26, 24, 21, 0.06), 0 0 0 1px rgba(26, 24, 21, 0.05);
}

/* Default dialog: content-driven height. Use --stable on tabbed/multi-state modals. */
.inspection-modal .inspection-modal__dialog {
    width: min(880px, calc(100vw - 32px));
    max-height: min(90vh, 960px);
    border-radius: 16px;
    border: 1px solid var(--insp-border);
    background: var(--insp-surface);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.18),
        0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.inspection-modal .inspection-modal__dialog--stable {
    height: min(85vh, 760px);
    min-height: min(60vh, 520px);
}

.inspection-modal .inspection-modal__dialog--narrow {
    width: min(560px, calc(100vw - 32px));
}

.inspection-modal .inspection-modal__dialog--wide {
    width: min(1280px, calc(100vw - 32px));
}

/* Form wrapping body+footer must be flex so body's overflow-y:auto has a
   constrained parent. */
.inspection-modal form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    width: 100%;
}

.inspection-modal .inspection-modal__header {
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--insp-border-rule);
    flex-shrink: 0;
    background: var(--insp-surface);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.inspection-modal .inspection-modal__header > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.inspection-modal .inspection-modal__header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.inspection-modal .inspection-modal__header .eyebrow {
    margin: 0;
    color: var(--insp-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.inspection-modal .inspection-modal__header .modal__title,
.inspection-modal .inspection-modal__header h3 {
    margin: 0;
    font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
    font-size: 1.28rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--insp-ink);
}

.inspection-modal .inspection-modal__header .text-muted,
.inspection-modal .inspection-modal__header > div > p:not(.eyebrow) {
    margin: 4px 0 0;
    max-width: 60ch;
    color: var(--insp-ink-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
}

.inspection-modal .modal__close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--surface-inset, #edeae3);
    border: none;
    color: var(--insp-ink-muted);
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.inspection-modal .modal__close:hover {
    background: rgba(26, 24, 21, 0.1);
    color: var(--insp-ink);
}

.inspection-modal .inspection-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px 22px 22px;
    background: var(--insp-bg-warm);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.inspection-modal .inspection-modal__footer {
    padding: 13px 22px 14px;
    border-top: 1px solid var(--insp-border-rule);
    background: var(--insp-surface);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.inspection-modal .inspection-modal__footer-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.inspection-modal .inspection-modal__footer-copy strong {
    font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
    font-size: 13px;
    font-weight: 700;
    color: var(--insp-ink);
}

.inspection-modal .inspection-modal__footer-copy p {
    margin: 0;
    font-size: 12px;
    color: var(--insp-ink-faint);
}

.inspection-modal .inspection-modal__footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.inspection-modal .inspection-modal__footer .btn {
    min-height: 40px;
    padding: 8px 18px;
}

/* --------------------------------------------------------------------------
   .inspection-modal--danger — destructive action modifier (Delete inspection)
   `!important` on color required to beat the canonical modal eyebrow rule
   at `style.css:4990` per css-standards.md gotcha #10.
   -------------------------------------------------------------------------- */
.modal.inspection-modal.inspection-modal--danger .inspection-modal__header .eyebrow {
    color: var(--danger, #b03030) !important;
}

.modal.inspection-modal.inspection-modal--danger .inspection-modal__footer-actions .btn-danger {
    background: var(--danger, #b03030);
    color: #ffffff;
    border: none;
    font-weight: 600;
}

.modal.inspection-modal.inspection-modal--danger .inspection-modal__footer-actions .btn-danger:hover {
    background: #952828;
}

html[data-theme="dark"] .modal.inspection-modal.inspection-modal--danger .inspection-modal__header .eyebrow {
    color: #f87171 !important;
}

html[data-theme="dark"] .modal.inspection-modal.inspection-modal--danger .inspection-modal__footer-actions .btn-danger {
    background: #dc2626;
}

html[data-theme="dark"] .modal.inspection-modal.inspection-modal--danger .inspection-modal__footer-actions .btn-danger:hover {
    background: #b91c1c;
}

/* Form controls */
.inspection-modal :where(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="url"], input[type="search"], input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea) {
    min-height: 40px;
    padding: 10px 13px;
    border-radius: 9px;
    border: 1px solid var(--insp-border-input);
    background: var(--insp-surface);
    font-family: var(--font-sans, inherit);
    font-size: 13.5px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--insp-ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    width: 100%;
}

.inspection-modal :where(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="url"], input[type="search"], input[type="date"], input[type="datetime-local"], select, textarea):focus {
    border-color: var(--insp-accent-strong);
    box-shadow: 0 0 0 3px var(--insp-accent-soft);
    outline: none;
}

.inspection-modal textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.5;
}

.inspection-modal select {
    padding-right: 34px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239a9188' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    cursor: pointer;
}

/* Dark mode */
html[data-theme="dark"] .inspection-modal {
    --insp-surface: #0f172a;
    --insp-surface-soft: rgba(15, 23, 42, 0.6);
    --insp-bg-warm: #0b1220;
    --insp-ink: #e2e8f0;
    --insp-ink-muted: #94a3b8;
    --insp-ink-faint: #94a3b8;
    --insp-border: rgba(148, 163, 184, 0.22);
    --insp-border-rule: rgba(148, 163, 184, 0.18);
    --insp-border-input: rgba(148, 163, 184, 0.28);
    --insp-accent: #e3b008;
    --insp-accent-soft: rgba(227, 176, 8, 0.18);
    --insp-accent-strong: rgba(244, 217, 139, 0.5);

    --ipi-bg: rgba(15, 23, 42, 0.55);
    --ipi-bg-inset: rgba(15, 23, 42, 0.62);
    --ipi-bg-card: rgba(15, 23, 42, 0.7);
    --ipi-bg-hover: rgba(148, 163, 184, 0.08);
    --ipi-rule: rgba(148, 163, 184, 0.22);
    --ipi-rule-h: rgba(148, 163, 184, 0.28);
    --ipi-ink: #e2e8f0;
    --ipi-ink-2: #cbd5e1;
    --ipi-ink-3: #94a3b8;
    --ipi-ink-4: #94a3b8;
    --ipi-accent: #e3b008;
    --ipi-accent-bg: rgba(227, 176, 8, 0.18);
    --ipi-accent-border: rgba(244, 217, 139, 0.5);
    --ipi-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --ipi-shadow-card: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(148, 163, 184, 0.1);
}

html[data-theme="dark"] .inspection-modal .inspection-modal__dialog {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .inspection-modal .modal__close {
    background: rgba(148, 163, 184, 0.16);
    color: rgba(226, 232, 240, 0.92);
}

html[data-theme="dark"] .inspection-modal .modal__close:hover {
    background: rgba(148, 163, 184, 0.28);
}

/* Mobile modal overrides (≤900px) — full-screen behaviour + chrome handled by
   canonical + gold-spec in style.css. Inspections-specific content layout below. */
@media (max-width: 900px) {
    .inspection-modal .inspection-modal__body {
        gap: 12px;
    }

    .inspection-modal .inspection-modal__footer-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .inspection-modal .inspection-modal__footer-actions > *:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .inspection-modal .inspection-modal__footer-actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        font-size: 13px;
        padding-left: 6px;
        padding-right: 6px;
    }
}

html[data-theme="dark"] .insp-form label {
  color: var(--text-muted);
}

html[data-theme="dark"] .insp-form input,
html[data-theme="dark"] .insp-form textarea,
html[data-theme="dark"] .insp-form select {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.36);
  color: var(--text);
}

@media (max-width: 900px) {
  .insp-history-table.table-stack-mobile tr[data-insp-link] {
    position: relative;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    -webkit-tap-highlight-color: transparent;
  }

  .insp-history-table.table-stack-mobile tr[data-insp-link]::after {
    content: '';
    position: absolute;
    top: 14px;
    right: 14px;
    width: 10px;
    height: 10px;
    border-right: 2px solid color-mix(in srgb, var(--text) 45%, transparent);
    border-bottom: 2px solid color-mix(in srgb, var(--text) 45%, transparent);
    transform: rotate(-45deg);
    pointer-events: none;
    opacity: 0.75;
  }

  .insp-history-table.table-stack-mobile tr[data-insp-link]:active {
    transform: translateY(1px);
  }

  .insp-history-table.table-stack-mobile tr[data-insp-link].nav-pending {
    opacity: 0.85;
  }

  .insp-history-table.table-stack-mobile tr[data-insp-link].nav-pending::after {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--text) 20%, transparent);
    border-right-color: transparent;
    border-bottom-color: transparent;
    animation: fdBtnSpin 0.8s linear infinite;
    transform: none;
    opacity: 1;
  }

  .insp-history-table.table-stack-mobile td {
    width: 100%;
    padding: 10px 14px;
  }

  /* --- Inspections main table: card-ify rows on mobile --- */
  .inspections-page .ipi-table-wrap {
    overflow-x: visible;
  }

  .inspections-page .ipi-table {
    min-width: 0;
  }

  .inspections-page .ipi-table,
  .inspections-page .ipi-table thead,
  .inspections-page .ipi-table tbody,
  .inspections-page .ipi-table tr,
  .inspections-page .ipi-table th,
  .inspections-page .ipi-table td {
    display: block;
    width: 100%;
  }

  .inspections-page .ipi-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .inspections-page .ipi-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .inspections-page .ipi-table tr {
    border: 1px solid rgba(26, 24, 21, 0.1);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    padding: 6px 0;
  }

  .inspections-page .ipi-table td {
    position: relative;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(26, 24, 21, 0.06);
    text-align: left !important;
    white-space: normal;
  }

  .inspections-page .ipi-table td:last-child {
    border-bottom: none;
  }

  .inspections-page .ipi-mobile-cell-label {
    display: block;
    margin-bottom: 4px;
    color: #9a9188;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* Hide expand chevron column on mobile */
  .inspections-page .ipi-table td.ipi-td-expand {
    display: none;
  }

  .inspections-page .ipi-table td.ipi-actions {
    padding-left: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .inspections-page .ipi-table td.ipi-actions .btn {
    min-height: 44px;
  }

  .inspections-page .ipi-table td[data-label="Inspection"] {
    padding-left: 14px;
  }

  .inspections-page .ipi-table td[data-label="Inspection"] .ipi-td-insp-name {
    font-size: 14px;
    font-weight: 600;
  }
}

/* --- Dark mode: inspections table cards on mobile --- */
@media (max-width: 900px) {
  html[data-theme="dark"] .inspections-page .ipi-table tr {
    background: var(--card);
    border-color: var(--border);
    box-shadow: none;
  }

  html[data-theme="dark"] .inspections-page .ipi-table td {
    border-bottom-color: rgba(71, 85, 105, 0.4);
    color: var(--text);
  }

  html[data-theme="dark"] .inspections-page .ipi-mobile-cell-label {
    color: var(--text-muted);
  }
}

/* ==========================================================================
   New-inspection wizard modal — mobile body padding
   --------------------------------------------------------------------------
   The wizard has no dedicated `.modal__footer`; its Prev/Next buttons live
   inside each `.insp-wizard-step-card` within the body. The canonical
   `.modal.modal--sheet .modal__body { padding-bottom: 48px + safe-area }`
   rule creates a visible gap BELOW the last button between it and the
   dialog bottom — that reads as a floating footer on mobile. Trim the
   body scroll-past room to 24px+safe-area so the last button sits closer
   to the viewport bottom while still clearing the home indicator.
   ========================================================================== */
@media (max-width: 900px) {
  .modal.modal--sheet.insp-wizard-modal .insp-wizard-modal__body.modal__body {
    padding: 14px 16px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .insp-wizard-modal .insp-wizard-form .insp-wizard-step-card {
    padding: 16px 14px;
  }
}
