.quotes-page,
.quote-modal,
.quote-create-modal,
.remedial-quote-modal,
.remedial-inspection-modal,
[data-quote-delete-modal] {
  --qpi-blue: #2563a8;
  --qpi-blue-bg: rgba(37, 99, 168, 0.08);
  --qpi-amber: #c49510;
  --qpi-amber-bg: rgba(196, 149, 16, 0.08);
  --qpi-green: #1e7a45;
  --qpi-green-bg: rgba(30, 122, 69, 0.08);
}

.quote-create-modal {
  --qcm-accent: #c49510;
  --qcm-ink: #1a1815;
  --qcm-ink-muted: #6b6458;
  --qcm-ink-faint: #9a9188;
  --qcm-bg-warm: #f7f5f0;
  --qcm-surface: #ffffff;
  --qcm-border: rgba(26, 24, 21, 0.08);
  --qcm-border-choice: rgba(26, 24, 21, 0.1);
}

.quotes-page.page-section {
  padding-top: 0;
  padding-bottom: 0;
}

.quotes-proto {
  margin-inline: calc(var(--ipi-page-gutter) * -1);
}

.quotes-page .ipi-stats-strip {
  padding-bottom: 18px;
}

.quotes-page .ipi-result-meta {
  margin-top: 2px;
}

.quotes-page .qpi-filter-bar {
  grid-template-columns: minmax(220px, 1fr) auto auto auto auto auto;
}

.quotes-page .qpi-filter-date {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid var(--ipi-rule-h);
  border-radius: 7px;
  background: var(--ipi-bg);
}

.quotes-page .qpi-filter-date span {
  flex-shrink: 0;
  color: var(--ipi-ink-4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quotes-page .qpi-filter-date input {
  min-width: 0;
  width: 100%;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--ipi-ink);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 18px;
  outline: none;
}

.quotes-page .qpi-filter-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Clickable quote rows --- */
.quotes-page .ipi-table tr[data-invoice-source-type] {
  cursor: pointer;
}

/* --- Unassigned property indicator on fire door quote rows --- */
.quotes-page .ipi-table tr.qpi-row--no-property {
  border-left: 3px solid var(--danger, #b03030);
  background: rgba(176, 48, 48, 0.03);
}

html[data-theme="dark"] .quotes-page .ipi-table tr.qpi-row--no-property {
  border-left-color: #f87171;
  background: rgba(248, 113, 113, 0.05);
}

.quotes-page .qpi-quote-cell,
.quotes-page .qpi-client-cell,
.quotes-page .qpi-status-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quotes-page .qpi-quote-number {
  color: var(--ipi-ink);
}

.quotes-page .qpi-client-cell,
.quotes-page .qpi-status-cell {
  font-size: 12.5px;
  color: var(--ipi-ink-2);
}

.quotes-page .qpi-status-cell .small-text,
.quotes-page .qpi-status-cell .text-muted {
  font-size: 11.5px;
}

.quotes-page .ipi-table-wrap {
  border-radius: 10px;
}

.quotes-page .ipi-table td {
  vertical-align: top;
}

.quotes-page .quote-history-table td:last-child,
.quotes-page .quote-history-table th:last-child {
  text-align: right;
}

.quotes-page .quote-history-table__actions {
  white-space: nowrap;
}

.quotes-page .quote-history-table__actions .table-actions {
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.quotes-page .quote-history-table__actions form {
  display: inline;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.quotes-page .quote-history-table__actions .btn {
  box-shadow: none;
}

.quotes-page .qpi-action-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: max-content;
}

.quotes-page .qpi-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

.quotes-page .qpi-action-btn--primary {
  min-width: 92px;
}

.quotes-page .qpi-action-btn--utility {
  min-width: 64px;
  border-color: var(--ipi-rule);
  background: var(--ipi-bg);
  color: var(--ipi-ink-3);
}

.quotes-page .qpi-action-btn--utility:hover {
  background: var(--ipi-bg-card);
  border-color: var(--ipi-rule);
  color: var(--ipi-ink);
}

.quotes-page .qpi-action-btn--invoice {
  white-space: nowrap;
}

.quotes-page .qpi-action-btn--more {
  width: 32px;
  min-width: 32px;
  padding: 0;
  border: 1px solid var(--ipi-rule);
  background: var(--ipi-bg);
  color: var(--ipi-ink-3);
}

.quotes-page .qpi-action-btn--more::marker,
.quotes-page .qpi-action-btn--more::-webkit-details-marker {
  display: none;
}

.quotes-page .qpi-delete-btn {
  margin-left: 2px;
  color: var(--ipi-ink-4);
}

.quotes-page .qpi-delete-btn:hover {
  color: #b03030;
}

.quotes-page .qpi-empty-state {
  background: var(--ipi-bg-card);
  border-radius: 12px;
  box-shadow: var(--ipi-shadow-card);
}

.quotes-page .qpi-empty-state__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 26px 24px;
}

.quotes-page .qpi-empty-state__body h3 {
  margin: 0;
  color: var(--ipi-ink);
  font-family: var(--font-display);
  font-size: 18px;
}

/* Create Quote modal — converged with RAMs create-picker (warm shell, compact choices) */

.modal.quote-create-modal .qcm-modal__dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  border-radius: 14px;
  border: 1px solid var(--qcm-border);
  background: var(--qcm-surface);
  box-shadow:
    0 4px 24px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.modal.quote-create-modal .qcm-modal__header.modal__header {
  align-items: flex-start;
  padding: 18px 20px 14px;
  background: var(--qcm-surface);
  border-bottom: 1px solid rgba(26, 24, 21, 0.07);
  flex-shrink: 0;
}

.modal.quote-create-modal .qcm-modal__header-main {
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 8px;
}

.modal.quote-create-modal .qcm-modal__eyebrow {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--qcm-accent);
}

.modal.quote-create-modal .qcm-modal__title {
  margin: 0 0 8px;
  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(--qcm-ink);
}

.modal.quote-create-modal .qcm-modal__lede {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  max-width: 54ch;
  color: var(--qcm-ink-muted);
}

.modal.quote-create-modal .qcm-modal__body.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--qcm-bg-warm);
}

.modal.quote-create-modal .qcm-modal__inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 16px 20px 0;
  gap: 12px;
}

.modal.quote-create-modal .qcm-modal__step-badge {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qcm-ink-muted);
  flex-shrink: 0;
}

.modal.quote-create-modal .qcm-modal__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}

.modal.quote-create-modal .qcm-modal__section {
  border: 1px solid var(--qcm-border);
  border-radius: 10px;
  background: var(--qcm-surface);
  padding: 14px 16px;
  box-shadow: none;
}

.modal.quote-create-modal .qcm-modal__section-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.modal.quote-create-modal .qcm-modal__section-title {
  margin: 0;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--qcm-ink);
}

.modal.quote-create-modal .qcm-modal__section-lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--qcm-ink-muted);
  max-width: 52ch;
}

.modal.quote-create-modal .qcm-modal__footer.modal__footer {
  flex-shrink: 0;
  margin: 0;
  padding: 12px 20px 16px;
  background: var(--qcm-surface);
  border-top: 1px solid rgba(26, 24, 21, 0.07);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.modal.quote-create-modal .qcm-source-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal.quote-create-modal .qcm-source-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid var(--qcm-border-choice);
  border-radius: 10px;
  background: var(--qcm-surface);
  color: var(--qcm-ink);
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.modal.quote-create-modal .qcm-source-choice:hover {
  border-color: rgba(196, 149, 16, 0.3);
  box-shadow: 0 6px 18px rgba(26, 24, 21, 0.05);
}

.modal.quote-create-modal .qcm-source-choice.is-active {
  border-color: rgba(196, 149, 16, 0.42);
  background: #fbf8ef;
  box-shadow: 0 6px 18px rgba(26, 24, 21, 0.05);
}

.modal.quote-create-modal .qcm-source-choice__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(196, 149, 16, 0.1);
  color: var(--qcm-accent);
  flex-shrink: 0;
}

.modal.quote-create-modal .qcm-source-choice__icon svg {
  width: 18px;
  height: 18px;
}

.modal.quote-create-modal .qcm-source-choice__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  text-align: left;
  flex: 1 1 auto;
}

.modal.quote-create-modal .qcm-source-choice__title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.modal.quote-create-modal .qcm-source-choice__meta {
  color: var(--qcm-ink-faint);
  font-size: 12px;
  line-height: 1.45;
  max-width: none;
}

.modal.quote-create-modal .qcm-source-choice__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(26, 24, 21, 0.06);
  color: var(--qcm-ink-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.modal.quote-create-modal .qcm-source-choice.is-active .qcm-source-choice__state {
  background: rgba(196, 149, 16, 0.15);
  color: var(--qcm-ink);
}

.quote-step-card {
  border: 1px solid rgba(26, 24, 21, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  background: #ffffff;
  box-shadow: none;
}

.quote-step-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 14px;
}

.quote-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quote-section-title__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(196, 149, 16, 0.1);
  color: #c49510;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quote-section-title__icon svg {
  width: 18px;
  height: 18px;
}

.quote-step-card__header h3 {
  margin: 0;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #1a1815;
}

.quote-step-card p {
  color: #6b6458;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 4px;
}

.quote-inspection-full {
  margin-top: 0;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-right: 6px;
}

.quote-step-card__header .quote-eyebrow {
  margin-bottom: 4px;
}

.quote-history-table__actions .btn:focus-visible {
  outline-offset: 2px;
}

html[data-theme="dark"] .quote-step-card {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .quote-section-title__icon {
  background: rgba(196, 149, 16, 0.16);
  color: #f4d98b;
}

html[data-theme="dark"] .quote-step-card__header h3 {
  color: rgba(226, 232, 240, 0.92);
}

html[data-theme="dark"] .quote-step-card p {
  color: rgba(148, 163, 184, 0.92);
}

html[data-theme="dark"] .remedial-inspection-modal .inspection-builder__table tr {
  background: var(--card);
  border-color: var(--border);
}

html[data-theme="dark"] .remedial-inspection-modal .inspection-builder__table td {
  color: var(--text);
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .remedial-inspection-modal .inspection-builder__table .text-muted.small-text {
  color: var(--text-muted);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__dialog {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--panel-shadow);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__header.modal__header {
  background: var(--card);
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__eyebrow {
  color: #e3b008;
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__title {
  color: var(--text);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__lede,
html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__section-lede {
  color: var(--text-muted);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__body.modal__body {
  background: rgba(15, 23, 42, 0.65);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__step-badge {
  color: var(--text-muted);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__section {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__section-title {
  color: var(--text);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-modal__footer.modal__footer {
  background: var(--card);
  border-top-color: var(--border);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-source-choice {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-source-choice.is-active {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(196, 149, 16, 0.45);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-source-choice__icon {
  background: rgba(196, 149, 16, 0.16);
  color: #f4d98b;
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-source-choice__state {
  background: rgba(30, 41, 59, 0.9);
  color: rgba(226, 232, 240, 0.75);
}

html[data-theme="dark"] .modal.quote-create-modal .qcm-source-choice.is-active .qcm-source-choice__state {
  background: rgba(196, 149, 16, 0.2);
  color: #f4d98b;
}

html[data-theme="dark"] [data-quote-delete-modal] .modal-form-card {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
}

.quotes-page [data-quotes-filters-done] {
  display: none;
}

@media (max-width: 1100px) {
  .quotes-page .qpi-filter-bar {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 1fr)) auto;
  }
}

@media (max-width: 768px) {
  /* --- Tabs: horizontal scroll for 5 tabs on narrow viewports --- */
  .quotes-page .ipi-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;
    scroll-padding-left: 4px;
    scroll-padding-right: 4px;
    width: 100%;
  }

  .quotes-page .ipi-tabs::-webkit-scrollbar {
    display: none;
  }

  .quotes-page .ipi-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  /* --- Body scroll-lock while filter sheet is open --- */
  body.quotes-mobile-filters-open {
    overflow: hidden;
  }

  body.quotes-mobile-filters-open .quotes-page .ipi-list-area {
    pointer-events: none;
  }

  body.quotes-mobile-filters-open .quotes-page .ipi-filter-shell {
    pointer-events: auto;
  }

  /* --- Hide support FAB while filter sheet is visible (prevent ghost taps) --- */
  body.quotes-mobile-filters-open .support-fab,
  body.quotes-mobile-filters-open button[data-support-open] {
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  body.quotes-filter-fab-suppress .support-fab,
  body.quotes-filter-fab-suppress button[data-support-open] {
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .quotes-page .qpi-filter-bar {
    grid-template-columns: 1fr;
  }

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

  .quotes-page .qpi-filter-date {
    min-height: 38px;
  }

  .quotes-page .qpi-action-group {
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  /* --- Quote history table: card-ify rows on mobile --- */
  .quotes-page .quote-history-table,
  .quotes-page .quote-history-table thead,
  .quotes-page .quote-history-table tbody,
  .quotes-page .quote-history-table tr,
  .quotes-page .quote-history-table th,
  .quotes-page .quote-history-table td {
    display: block;
    width: 100%;
  }

  .quotes-page .quote-history-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;
  }

  .quotes-page .quote-history-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .quotes-page .quote-history-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;
  }

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

  .quotes-page .quote-history-table td:last-child {
    border-bottom: none;
  }

  .quotes-page .quote-history-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 14px;
    top: 7px;
    width: 82px;
    color: #9a9188;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* Actions cell: no pseudo-label, right-align buttons */
  .quotes-page .quote-history-table td.ipi-actions,
  .quotes-page .quote-history-table td.quote-history-table__actions {
    padding-left: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .quotes-page .quote-history-table td.ipi-actions::before,
  .quotes-page .quote-history-table td.quote-history-table__actions::before {
    display: none;
  }

  .quotes-page .quote-history-table .qpi-action-group {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  /* Override ipi-table min-width for card layout */
  .quotes-page .ipi-table-wrap {
    overflow-x: visible;
  }

  .quotes-page .ipi-table.quote-history-table {
    min-width: 0;
  }

  /* More menu inside card rows */
  .quotes-page .quote-history-table .table-actions__more {
    position: relative;
  }

  .quotes-page .quote-history-table .table-actions__menu {
    right: 0;
    min-width: 180px;
  }
}

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

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

  html[data-theme="dark"] .quotes-page .quote-history-table td::before {
    color: var(--text-muted);
  }
}

@media (max-width: 900px) {
  /* Dialog must be full-screen on mobile — override the desktop
     width: min(640px, calc(100vw - 32px)) rule that would otherwise
     keep a 16px margin on each side. !important mirrors canonical. */
  .modal.modal--sheet.quote-create-modal .qcm-modal__dialog {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  /* Canonical `.modal--sheet .modal__body` forces 16px horizontal padding
     with !important (style.css:5063). The Create Quote picker also has
     `.qcm-modal__inner` with 14px 16px padding, so the card sat 32px from
     the edge (311px wide) vs Invoices 343px. Zero the canonical body
     padding for this modal only so `.qcm-modal__inner` is the sole 16px
     owner — matches the RAMs Create Picker fix. */
  .modal.modal--sheet.quote-create-modal .qcm-modal__body.modal__body {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .modal.quote-create-modal .qcm-modal__inner {
    padding: 14px 16px 0;
    gap: 10px;
  }

  .modal.quote-create-modal .qcm-source-choice {
    align-items: center;
    flex-wrap: nowrap;
    padding: 10px 12px;
    gap: 10px;
  }

  .modal.quote-create-modal .qcm-source-choice__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .modal.quote-create-modal .qcm-source-choice__icon svg {
    width: 16px;
    height: 16px;
  }

  .modal.quote-create-modal .qcm-source-choice__title {
    font-size: 13px;
  }

  .modal.quote-create-modal .qcm-source-choice__meta {
    font-size: 11.5px;
  }

  .modal.quote-create-modal .qcm-source-choice__state {
    min-width: 0;
    min-height: 26px;
    padding: 4px 8px;
    font-size: 9px;
    margin-left: 0;
  }

  .modal.quote-create-modal .qcm-source-grid {
    gap: 8px;
  }

  .modal.quote-create-modal .qcm-modal__section {
    padding: 12px 14px;
    border-radius: 8px;
  }

  .modal.quote-create-modal .qcm-modal__section-head {
    margin-bottom: 10px;
  }

  .modal.quote-create-modal .qcm-modal__title {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
}

.qbm-modal {
  --qbm-accent: #c49510;
  --qbm-accent-soft: rgba(196, 149, 16, 0.1);
  --qbm-accent-soft-strong: rgba(196, 149, 16, 0.16);
  --qbm-ink: #1a1815;
  --qbm-ink-muted: #6b6458;
  --qbm-ink-faint: #9a9188;
  --qbm-border: rgba(26, 24, 21, 0.08);
  --qbm-border-rule: rgba(26, 24, 21, 0.07);
  --qbm-border-strong: rgba(196, 149, 16, 0.34);
  --qbm-bg-warm: #f7f5f0;
  --qbm-surface: #ffffff;
  --qbm-surface-soft: #fcfaf4;
}

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

.qbm-modal .qbm-modal__dialog {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(90vh, 960px);
  border-radius: 16px;
  border: 1px solid var(--qbm-border);
  background: var(--qbm-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;
  min-height: 0;
  overflow: hidden;
}

.qbm-modal .qbm-modal__header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--qbm-border-rule);
  flex-shrink: 0;
  background: var(--qbm-surface);
}

.qbm-modal .qbm-modal__eyebrow {
  margin-bottom: 6px;
}

.qbm-modal .modal__title {
  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(--qbm-ink);
}

.qbm-modal .qbm-modal__subcopy {
  margin: 6px 0 0;
  max-width: 54ch;
  color: var(--qbm-ink-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}

.qbm-modal .qbm-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  background: var(--qbm-bg-warm);
}

.qbm-modal .qbm-modal__body-inner {
  padding: 20px 22px 22px;
}

.qbm-modal .qbm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 22px;
  align-items: start;
}

.qbm-modal .qbm-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.qbm-modal .qbm-section {
  border: 1px solid var(--qbm-border);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--qbm-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qbm-modal .qbm-section__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.qbm-modal .qbm-section__eyebrow {
  margin: 0;
}

.qbm-modal .qbm-section__header h4 {
  margin: 0;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--qbm-ink);
}

.qbm-modal .qbm-section__header p {
  margin: 0;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  color: var(--qbm-ink-muted);
  max-width: 52ch;
}

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

.qbm-modal .qbm-form-grid label,
.qbm-modal .qbm-note,
.qbm-modal .qbm-line-item__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qbm-ink-faint);
}

.qbm-modal .qbm-form-grid label small,
.qbm-modal .qbm-note small {
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
  color: var(--qbm-ink-faint);
}

.qbm-modal .qbm-form-grid textarea,
.qbm-modal .qbm-note textarea {
  resize: vertical;
}

/* --- Form controls: polished inputs matching remedials --- */
.qbm-modal .qbm-form-grid :where(input, select, textarea),
.qbm-modal .qbm-note :where(input, select, textarea),
.qbm-modal .qbm-line-item :where(input, select, textarea) {
  min-height: 40px;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid rgba(26, 24, 21, 0.14);
  background: var(--qbm-surface);
  font-family: var(--font-sans, inherit);
  font-size: 13.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--qbm-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qbm-modal .qbm-form-grid :where(input, select, textarea):focus,
.qbm-modal .qbm-note :where(input, select, textarea):focus,
.qbm-modal .qbm-line-item :where(input, select, textarea):focus {
  border-color: var(--qbm-border-strong);
  box-shadow: 0 0 0 3px var(--qbm-accent-soft);
  outline: none;
}

.qbm-modal .qbm-form-grid textarea,
.qbm-modal .qbm-note textarea {
  min-height: 72px;
}

.qbm-modal .qbm-form-grid select,
.qbm-modal .qbm-line-item select {
  padding-right: 34px;
  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;
}

.qbm-modal .qbm-note {
  border: 1px solid var(--qbm-border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--qbm-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.qbm-modal .qbm-footnote {
  margin-top: -2px;
  color: var(--qbm-ink-faint);
}

.qbm-modal .qbm-advanced {
  border: 1px solid var(--qbm-border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--qbm-surface-soft);
}

.qbm-modal .qbm-advanced summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.qbm-modal .qbm-advanced summary::-webkit-details-marker {
  display: none;
}

.qbm-modal .qbm-advanced summary::marker {
  content: '';
}

.qbm-modal .qbm-advanced summary::after {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--qbm-ink-faint);
  border-bottom: 2px solid var(--qbm-ink-faint);
  transform: rotate(45deg);
  margin-top: 6px;
  flex: 0 0 auto;
  transition: transform 0.16s ease;
}

.qbm-modal .qbm-advanced[open] summary::after {
  transform: rotate(-135deg);
}

.qbm-modal .qbm-advanced__meta {
  color: var(--qbm-ink-faint);
}

/* --- Preview pane: live quote output --- */
.qbm-modal .qbm-preview {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 1px solid rgba(26, 24, 21, 0.1);
  border-radius: 10px;
  background: var(--qbm-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.qbm-modal .qbm-preview__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--qbm-bg-warm);
  border-bottom: 1px solid var(--qbm-border);
  margin-bottom: 0;
}

.qbm-modal .qbm-preview__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.qbm-modal .qbm-preview__title > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qbm-modal .qbm-preview__title > div h3 {
  margin: 0;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--qbm-ink);
}

.qbm-modal .qbm-preview__title > div p:last-child {
  display: none;
}

.qbm-modal .qbm-preview__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--qbm-accent-soft);
  color: var(--qbm-accent);
  flex-shrink: 0;
}

.qbm-modal .qbm-preview__icon svg {
  width: 14px;
  height: 14px;
}

.qbm-modal .qbm-modal__footer {
  flex-shrink: 0;
  padding: 14px 22px 16px;
  background: var(--qbm-surface);
  border-top: 1px solid var(--qbm-border-rule);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.qbm-modal .qbm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.qbm-modal .qbm-actions .btn {
  min-height: 38px;
  min-width: 112px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid rgba(26, 24, 21, 0.14);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.qbm-modal .qbm-actions .btn:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.qbm-modal .qbm-actions .btn-primary {
  background: #1a1815;
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

.qbm-modal .qbm-actions .btn-primary:hover {
  background: #3d3a34;
}

.qbm-modal .qbm-actions .btn-ghost {
  border-color: transparent;
  box-shadow: none;
  min-width: auto;
}

.qbm-modal .qbm-actions .btn-ghost:hover {
  background: rgba(26, 24, 21, 0.06);
  box-shadow: none;
}

/* --- Summary content inside preview (flatten — no card-in-card) --- */
.qbm-modal .qbm-summary {
  margin: 0;
  min-width: 0;
  padding: 16px 18px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: auto;
}

.qbm-modal .qbm-summary__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--qbm-border);
  margin-bottom: 0;
}

.qbm-modal .qbm-summary__header h4 {
  margin: 0;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--qbm-ink);
}

.qbm-modal .qbm-summary__meta {
  margin: 2px 0 0;
  color: var(--qbm-ink-faint);
  font-size: 11.5px;
}

.qbm-modal .qbm-summary__total {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--qbm-accent-soft);
  border: 1px solid rgba(196, 149, 16, 0.18);
  text-align: right;
}

.qbm-modal .qbm-summary__total span {
  display: block;
  color: var(--qbm-ink-faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qbm-modal .qbm-summary__total strong {
  color: var(--qbm-accent);
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1.25rem;
  line-height: 1.2;
}

/* --- Line items table in preview --- */
.qbm-modal .qbm-line-items-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-top: 0;
}

.qbm-modal .qbm-line-items-table th {
  text-align: left;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--qbm-ink-faint);
  padding: 10px 10px;
  border-bottom: 2px solid rgba(26, 24, 21, 0.08);
  background: transparent;
}

.qbm-modal .qbm-line-items-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(26, 24, 21, 0.05);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  color: var(--qbm-ink);
  font-size: 13px;
}

.qbm-modal .qbm-line-items-table tbody tr:last-child td {
  border-bottom: none;
}

.qbm-modal .qbm-line-items-table td:first-child {
  hyphens: auto;
  font-weight: 500;
}

.qbm-modal .qbm-line-items-table th:not(:first-child),
.qbm-modal .qbm-line-items-table td:not(:first-child) {
  white-space: nowrap;
}

.qbm-modal .qbm-line-items-table td:last-child {
  font-weight: 600;
}

/* --- Empty state --- */
.qbm-modal .qbm-empty-copy {
  margin: 0;
  padding: 28px 18px;
  color: var(--qbm-ink-faint);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

/* --- Totals footer in preview --- */
.qbm-modal .qbm-summary__totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: 0;
  padding: 14px 18px;
  border-top: 2px solid rgba(26, 24, 21, 0.08);
  background: var(--qbm-bg-warm);
}

.qbm-modal .qbm-summary__totals p {
  margin: 0 0 4px;
  color: var(--qbm-ink-muted);
  font-size: 12.5px;
}

.qbm-modal .qbm-summary__totals p strong {
  font-weight: 600;
  color: var(--qbm-ink);
}

.qbm-modal .qbm-summary__totals-amounts p:last-child {
  font-size: 14px;
  font-weight: 700;
  color: var(--qbm-ink);
}

.qbm-modal .qbm-summary__totals-amounts {
  text-align: right;
}

.qbm-modal .qbm-editor {
  padding: 0;
}

/* Flatten: remove the extra card layer when .qbm-advanced is used as .qbm-editor */
.qbm-modal .qbm-advanced.qbm-editor {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.qbm-modal .qbm-editor__hint {
  margin: 0;
  color: var(--qbm-ink-muted);
}

.qbm-modal .qbm-editor__surface {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.qbm-modal .qbm-editor__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qbm-modal .qbm-line-item {
  border: 1px solid rgba(26, 24, 21, 0.1);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--qbm-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qbm-modal .qbm-line-item:hover {
  border-color: rgba(26, 24, 21, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);
}

.qbm-modal .qbm-line-item :where(select, input, textarea) {
  width: 100%;
  min-width: 0;
}

.qbm-modal .qbm-line-item__stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qbm-modal .qbm-line-item__label-toggle {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--qbm-accent);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.qbm-modal .qbm-line-item__label-toggle:hover {
  color: color-mix(in srgb, var(--qbm-accent) 80%, #000000);
}

.qbm-modal .qbm-line-item__label {
  display: none;
}

.qbm-modal .qbm-line-item__label.qbm-line-item__label--visible {
  display: block;
}

.qbm-modal .qbm-line-item__meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.qbm-modal .qbm-line-item__field-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--qbm-ink-faint);
  margin-bottom: 5px;
}

.qbm-modal .qbm-input-prefix {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--qbm-border);
  border-radius: 8px;
  background: var(--qbm-surface);
  padding: 0 10px;
}

.qbm-modal .qbm-input-prefix span {
  font-weight: 700;
  color: var(--qbm-ink-faint);
  flex: 0 0 auto;
}

.qbm-modal .qbm-input-prefix input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 9px 0;
  font: inherit;
  color: inherit;
}

.qbm-modal .qbm-line-item__total {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--qbm-surface-soft);
}

.qbm-modal .qbm-line-item__total-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qbm-modal .qbm-line-item__remove {
  flex-shrink: 0;
}

.qbm-modal .qbm-editor__footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--qbm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.qbm-modal .qbm-editor__subtotal span {
  display: block;
  color: var(--qbm-ink-faint);
  font-size: 0.85rem;
}

.qbm-modal .qbm-editor__subtotal strong {
  display: block;
  color: var(--qbm-ink);
  font-size: 1.15rem;
}

.qbm-modal .qbm-editor__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.qbm-modal .qbm-tracker-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--qbm-border);
}

html[data-theme="dark"] .qbm-modal .qbm-modal__dialog {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--panel-shadow);
}

html[data-theme="dark"] .qbm-modal .qbm-modal__header {
  background: var(--card);
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .qbm-modal .modal__title {
  color: var(--text);
}

html[data-theme="dark"] .qbm-modal .qbm-modal__body {
  background: rgba(15, 23, 42, 0.65);
}

html[data-theme="dark"] .qbm-modal .qbm-modal__footer {
  background: var(--card);
  border-top-color: var(--border);
  box-shadow: none;
}

html[data-theme="dark"] .qbm-modal .qbm-section,
html[data-theme="dark"] .qbm-modal .qbm-note {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: none;
}

html[data-theme="dark"] .qbm-modal .qbm-preview {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: none;
}

html[data-theme="dark"] .qbm-modal .qbm-preview__header {
  background: rgba(15, 23, 42, 0.4);
  border-bottom-color: rgba(71, 85, 105, 0.58);
}

html[data-theme="dark"] .qbm-modal .qbm-summary {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .qbm-modal .qbm-summary__header {
  border-bottom-color: rgba(71, 85, 105, 0.58);
}

html[data-theme="dark"] .qbm-modal .qbm-summary__totals {
  background: rgba(15, 23, 42, 0.4);
  border-top-color: rgba(71, 85, 105, 0.58);
}

html[data-theme="dark"] .qbm-modal .qbm-editor__surface {
  background: transparent;
  border-color: transparent;
}

html[data-theme="dark"] .qbm-modal .qbm-advanced,
html[data-theme="dark"] .qbm-modal .qbm-line-item,
html[data-theme="dark"] .qbm-modal .qbm-line-item__total,
html[data-theme="dark"] .qbm-modal .qbm-input-prefix {
  background: rgba(2, 6, 23, 0.42);
  border-color: rgba(71, 85, 105, 0.58);
  box-shadow: none;
}

html[data-theme="dark"] .qbm-modal .qbm-actions .btn {
  box-shadow: none;
}

html[data-theme="dark"] .qbm-modal .qbm-section__header h4,
html[data-theme="dark"] .qbm-modal .qbm-summary__header h4,
html[data-theme="dark"] .qbm-modal .qbm-preview__title > div h3,
html[data-theme="dark"] .qbm-modal .qbm-form-grid label,
html[data-theme="dark"] .qbm-modal .qbm-note,
html[data-theme="dark"] .qbm-modal .qbm-line-item__field,
html[data-theme="dark"] .qbm-modal .qbm-editor__subtotal strong {
  color: var(--text);
}

html[data-theme="dark"] .qbm-modal .qbm-eyebrow {
  color: #e3b008;
}

html[data-theme="dark"] .qbm-modal .qbm-section__header p,
html[data-theme="dark"] .qbm-modal .qbm-preview__title > div p:last-child,
html[data-theme="dark"] .qbm-modal .qbm-footnote,
html[data-theme="dark"] .qbm-modal .qbm-advanced__meta,
html[data-theme="dark"] .qbm-modal .qbm-summary__total span,
html[data-theme="dark"] .qbm-modal .qbm-summary__totals p,
html[data-theme="dark"] .qbm-modal .qbm-editor__subtotal span,
html[data-theme="dark"] .qbm-modal .qbm-editor__hint,
html[data-theme="dark"] .qbm-modal .qbm-line-item__field-label,
html[data-theme="dark"] .qbm-modal .qbm-input-prefix span,
html[data-theme="dark"] .qbm-modal .qbm-line-items-table th,
html[data-theme="dark"] .qbm-modal .qbm-modal__subcopy,
html[data-theme="dark"] .qbm-modal .qbm-summary__meta,
html[data-theme="dark"] .qbm-modal .qbm-empty-copy {
  color: var(--text-muted);
}

html[data-theme="dark"] .qbm-modal .qbm-preview__icon {
  background: rgba(196, 149, 16, 0.16);
  color: #f4d98b;
}

html[data-theme="dark"] .qbm-modal .qbm-summary__total strong {
  color: #f4d98b;
}

html[data-theme="dark"] .qbm-modal .qbm-tracker-cta,
html[data-theme="dark"] .qbm-modal .qbm-editor__footer {
  border-top-color: rgba(71, 85, 105, 0.58);
}

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

html[data-theme="dark"] .qbm-modal .qbm-line-items-table th {
  background: transparent;
  border-bottom-color: rgba(71, 85, 105, 0.58);
}

html[data-theme="dark"] .qbm-modal .qbm-line-items-table tr {
  background: rgba(2, 6, 23, 0.42);
  border-color: rgba(71, 85, 105, 0.58);
}

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

html[data-theme="dark"] .qbm-modal .qbm-form-grid :where(input, select, textarea):focus,
html[data-theme="dark"] .qbm-modal .qbm-note :where(input, select, textarea):focus,
html[data-theme="dark"] .qbm-modal .qbm-line-item :where(input, select, textarea):focus {
  border-color: rgba(196, 149, 16, 0.45);
  box-shadow: 0 0 0 3px rgba(196, 149, 16, 0.12);
}

html[data-theme="dark"] .qbm-modal .qbm-form-grid :where(input, select, textarea)::placeholder,
html[data-theme="dark"] .qbm-modal .qbm-note :where(input, select, textarea)::placeholder {
  color: rgba(148, 163, 184, 0.92);
}

html[data-theme="dark"] .qbm-modal .qbm-summary__total {
  background: rgba(196, 149, 16, 0.12);
  border-color: rgba(196, 149, 16, 0.22);
}

html[data-theme="dark"] .qbm-modal .qbm-actions .btn-primary {
  background: rgba(226, 232, 240, 0.92);
  color: #0f172a;
}

html[data-theme="dark"] .qbm-modal .qbm-actions .btn-primary:hover {
  background: rgba(226, 232, 240, 0.82);
}

@media (max-width: 900px) {
  /* Bottom-sheet container, overlay, dialog sizing, and slide-up animation
     are now handled by the canonical .modal.modal--sheet rule in style.css.
     But the per-family base rule at ~line 972 (`.qbm-modal .qbm-modal__dialog`)
     has equal specificity (0,3,0) to the canonical mobile rule and loads after
     style.css, so we re-assert the canonical values here with !important to
     guarantee full-screen chrome. Matches the Invoices precedent at
     invoices.css:331. */
  .modal.modal--sheet.qbm-modal .qbm-modal__dialog {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  /* --- Grid collapse (merged from 980px) --- */
  .qbm-modal .qbm-grid {
    grid-template-columns: 1fr;
  }

  .qbm-modal .qbm-preview {
    position: static;
    border-top: 1px solid var(--qbm-border-rule);
    border-radius: 10px;
    padding: 0;
    margin-top: 4px;
    overflow: hidden;
  }

  .qbm-modal .qbm-line-item__meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* --- Internal adjustments --- */
  .qbm-modal .qbm-modal__header {
    padding: 14px 16px 12px;
  }

  /* `qbm-modal__body-inner` is the inner content wrapper. On mobile the
     canonical `.modal.modal--sheet .modal__body` rule (style.css:5063) already
     provides 16px horizontal padding with !important — stacking another 16px
     here was making `.qbm-section` 311px vs Invoices 343px. Keep vertical
     padding; strip horizontal so the section matches Invoices width. */
  .qbm-modal .qbm-modal__body-inner {
    padding: 14px 0 16px;
  }

  .qbm-modal .qbm-section {
    border-radius: 8px;
    padding: 12px 14px;
  }

  .qbm-modal .qbm-form-grid,
  .qbm-modal .qbm-summary__totals,
  .qbm-modal .qbm-line-item__meta {
    grid-template-columns: 1fr;
  }

  .qbm-modal .qbm-line-item {
    border-radius: 6px;
    padding: 10px;
  }

  .qbm-modal .qbm-line-item__remove {
    min-width: 44px;
    min-height: 44px;
  }

  .qbm-modal .qbm-line-item__total-inner,
  .qbm-modal .qbm-editor__footer {
    align-items: stretch;
  }

  /* --- Preview table: card-ify rows on mobile --- */
  .qbm-modal .qbm-line-items-table,
  .qbm-modal .qbm-line-items-table thead,
  .qbm-modal .qbm-line-items-table tbody,
  .qbm-modal .qbm-line-items-table tr,
  .qbm-modal .qbm-line-items-table th,
  .qbm-modal .qbm-line-items-table td {
    display: block;
    width: 100%;
  }

  .qbm-modal .qbm-line-items-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;
  }

  .qbm-modal .qbm-line-items-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .qbm-modal .qbm-line-items-table tr {
    border: 1px solid var(--qbm-border);
    border-radius: 8px;
    background: var(--qbm-surface);
    padding: 4px 0;
  }

  .qbm-modal .qbm-line-items-table td {
    position: relative;
    padding: 7px 12px 7px 110px;
    border-bottom: 1px solid var(--qbm-border);
    text-align: left !important;
    white-space: normal;
  }

  .qbm-modal .qbm-line-items-table td:last-child {
    border-bottom: none;
  }

  .qbm-modal .qbm-line-items-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    top: 7px;
    width: 86px;
    color: var(--qbm-ink-faint);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .qbm-modal .qbm-summary__totals-amounts {
    text-align: left;
  }

  /* --- Footer buttons: 2-col grid; last-child spans full width when alone on its row --- */
  .qbm-modal .qbm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

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

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

  .qbm-modal .qbm-editor__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .qbm-modal .qbm-editor__actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .qbm-modal .qbm-tracker-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .qbm-modal .qbm-tracker-cta .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .qbm-modal .qbm-editor {
    padding: 0;
  }

  .qbm-modal .qbm-editor__surface {
    padding: 0;
  }

  .qbm-modal .qbm-note {
    border-radius: 8px;
    padding: 10px 12px;
  }

  .qbm-modal .qbm-advanced {
    border-radius: 8px;
    padding: 10px 12px;
  }

  .qbm-modal .qbm-summary {
    border-radius: 0;
    padding: 12px 14px;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .qbm-modal .qbm-preview__header {
    padding: 10px 14px;
  }

  .qbm-modal .qbm-summary__totals {
    padding: 10px 14px;
  }

  .qbm-modal .qbm-line-item__total {
    border-radius: 6px;
  }

  .qbm-modal .qbm-input-prefix {
    border-radius: 6px;
  }

}

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

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

.quote-history-table th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b6458;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(26, 24, 21, 0.08);
  background: rgba(247, 245, 240, 0.95);
}

.quote-history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(26, 24, 21, 0.08);
  vertical-align: top;
}

.quote-history-table__actions {
  text-align: right;
}

.quote-history-table tbody tr[data-invoice-source-type] {
  cursor: pointer;
}

.quote-history-table tbody tr[data-invoice-source-type]:hover {
  background: rgba(247, 245, 240, 0.6);
}

html[data-theme="dark"] .quote-history-table th {
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.55);
  border-bottom-color: rgba(71, 85, 105, 0.58);
}

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

html[data-theme="dark"] .quote-history-table tbody tr[data-invoice-source-type]:hover {
  background: rgba(30, 41, 59, 0.5);
}

html[data-theme="dark"] .inspection-builder__alert {
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.22);
  color: #fdba74;
}

.inspection-builder__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inspection-builder__table {
  margin-bottom: 1rem;
}

.inspection-builder__actions-cell {
  text-align: right;
}

.inspection-builder__alert {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: #fff3cd;
  color: #856404;
}

@media (max-width: 1024px) {
  .quote-page .table-stack-mobile td[data-label=""]::before {
    display: none;
  }

  .quote-page .table-stack-mobile td.quote-history-table__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
  }

  .quote-page .table-stack-mobile td.quote-history-table__actions .table-actions {
    gap: 10px;
  }

  .quote-page .table-stack-mobile td.quote-history-table__actions .table-actions__more {
    z-index: 2100;
  }

  .quote-page .table-stack-mobile td.quote-history-table__actions .table-actions__more[open] {
    z-index: 2200;
  }

  .quote-page .table-stack-mobile td.quote-history-table__actions .table-actions__menu {
    top: auto;
    bottom: calc(100% + 8px);
    z-index: 2200;
  }
}

.remedial-inspection-modal .rim-dialog {
  width: min(780px, calc(100vw - 32px));
}

.remedial-inspection-modal .inspection-builder__table table {
  width: 100%;
  border-collapse: collapse;
}

.remedial-inspection-modal .inspection-builder__table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qbm-ink-faint, #9a9188);
  border-bottom: 1px solid var(--qbm-border, rgba(26, 24, 21, 0.08));
}

.remedial-inspection-modal .inspection-builder__table td {
  padding: 10px;
  border-bottom: 1px solid var(--qbm-border, rgba(26, 24, 21, 0.08));
  font-size: 13.5px;
  color: var(--qbm-ink, #1a1815);
}

.remedial-inspection-modal .inspection-builder__table .text-muted.small-text {
  color: var(--qbm-ink-faint, #9a9188);
  font-size: 12px;
}

.remedial-inspection-modal .rim-section .qbm-empty-copy {
  color: var(--qbm-ink-muted, #6b6458);
}

@media (max-width: 900px) {
  .remedial-inspection-modal .inspection-builder__table table,
  .remedial-inspection-modal .inspection-builder__table thead,
  .remedial-inspection-modal .inspection-builder__table tbody,
  .remedial-inspection-modal .inspection-builder__table tr,
  .remedial-inspection-modal .inspection-builder__table th,
  .remedial-inspection-modal .inspection-builder__table td {
    display: block;
    width: 100%;
  }

  .remedial-inspection-modal .inspection-builder__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;
  }

  .remedial-inspection-modal .inspection-builder__table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .remedial-inspection-modal .inspection-builder__table tr {
    border: 1px solid var(--qbm-border, rgba(26, 24, 21, 0.08));
    border-radius: 8px;
    background: var(--qbm-surface, #ffffff);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .remedial-inspection-modal .inspection-builder__table td {
    padding: 0;
    border-bottom: none;
  }

  .remedial-inspection-modal .inspection-builder__table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--qbm-ink-faint, #9a9188);
    margin-bottom: 2px;
  }

  .remedial-inspection-modal .inspection-builder__table td[data-label=""]::before {
    display: none;
  }

  .remedial-inspection-modal .inspection-builder__actions-cell {
    text-align: left;
    padding-top: 4px;
  }

  .remedial-inspection-modal .inspection-builder__actions-cell .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

/* ===================================================================
   FIRE DOOR QUOTE JOBS MODAL
   Matches the fire door job modal visual language exactly.
   Opened from quotes table overflow → "Jobs"
   =================================================================== */

/* --- Dialog --- */
[data-fire-door-jobs-modal] .modal__overlay {
  background: rgba(15, 23, 42, 0.55);
}

[data-fire-door-jobs-modal] .modal__dialog {
  width: min(820px, calc(100vw - 48px));
  max-height: min(90vh, 960px);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* --- Header --- */
[data-fire-door-jobs-modal] .modal__header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(26, 24, 21, 0.07);
  position: relative;
}

[data-fire-door-jobs-modal] .modal__header .fdqj-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #c49510);
  margin: 0 0 6px;
}

[data-fire-door-jobs-modal] .modal__header .modal__title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink, #1a1815);
  margin: 0;
}

[data-fire-door-jobs-modal] .modal__header .text-muted {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-3, #6b6458);
}

[data-fire-door-jobs-modal] .modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 8px;
  background: var(--surface-inset, #edeae3);
  color: var(--ink-4, #9a9188);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

[data-fire-door-jobs-modal] .modal__close:hover {
  background: var(--surface-subtle, #f2efe9);
  color: var(--ink, #1a1815);
}

/* --- Body (warm beige background) --- */
[data-fire-door-jobs-modal] .modal__body {
  padding: 20px 22px 22px;
  background: var(--canvas, #f7f5f0);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Flash alerts --- */
[data-fire-door-jobs-modal] .flash {
  border-radius: 10px;
  margin-bottom: 14px;
}

/* --- Reset global form styles inside modal --- */
[data-fire-door-jobs-modal] form {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: block;
  gap: 0;
  margin: 0;
}

/* --- Top action bar (PDF download) --- */
.fdqj-top-actions {
  margin-bottom: 14px;
}

/* --- Section cards (white on beige) --- */
.fdqj-section {
  border: 1px solid rgba(26, 24, 21, 0.08);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: var(--surface-card, #ffffff);
  box-shadow: 0 1px 3px rgba(26, 24, 21, 0.06), 0 1px 2px rgba(26, 24, 21, 0.04);
}

.fdqj-section:last-child {
  margin-bottom: 0;
}

.fdqj-section__heading {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink, #1a1815);
  margin: 0 0 4px;
}

.fdqj-section__copy {
  font-size: 13px;
  color: var(--ink-3, #6b6458);
  margin: 0 0 14px;
  line-height: 1.45;
}

/* --- Property form --- */
.fdqj-property-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fdqj-property-form select {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(26, 24, 21, 0.14);
  font-size: 13px;
}

.fdqj-property-form select:focus {
  border-color: rgba(196, 149, 16, 0.4);
  box-shadow: 0 0 0 3px rgba(196, 149, 16, 0.1);
  outline: none;
}

.fdqj-property-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fdqj-property-actions .btn {
  border-radius: 8px;
  font-size: 13px;
}

.fdqj-assigned-info {
  font-size: 13px;
  color: var(--ink-3, #6b6458);
  margin: 12px 0 0;
}

.fdqj-assigned-info a {
  color: var(--accent, #c49510);
  text-decoration: none;
  font-weight: 600;
}

.fdqj-assigned-info a:hover {
  text-decoration: underline;
}

/* --- Items list --- */
.fdqj-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fdqj-items-heading {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink, #1a1815);
  margin: 0 0 2px;
}

.fdqj-items-empty {
  font-size: 13px;
  color: var(--ink-3, #6b6458);
}

/* --- Item card (white on beige) --- */
.fdqj-item-card {
  border: 1px solid rgba(26, 24, 21, 0.08);
  border-radius: 12px;
  background: var(--surface-card, #ffffff);
  box-shadow: 0 1px 3px rgba(26, 24, 21, 0.06), 0 1px 2px rgba(26, 24, 21, 0.04);
  overflow: hidden;
}

.fdqj-item-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(26, 24, 21, 0.06);
  background: var(--surface-subtle, #f2efe9);
}

.fdqj-item-card__header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fdqj-item-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-4, #9a9188);
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(26, 24, 21, 0.06);
}

.fdqj-item-title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink, #1a1815);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status badge */
.fdqj-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  flex-shrink: 0;
}

.fdqj-status-badge--draft {
  background: rgba(148, 163, 184, 0.14);
  color: rgba(15, 23, 42, 0.72);
}

.fdqj-status-badge--assigned {
  background: rgba(37, 99, 168, 0.1);
  color: var(--info, #2563a8);
}

.fdqj-status-badge--scheduled {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.fdqj-status-badge--in_progress {
  background: rgba(37, 99, 168, 0.1);
  color: var(--info, #2563a8);
}

.fdqj-status-badge--completed {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.fdqj-status-badge--cancelled {
  background: rgba(176, 48, 48, 0.08);
  color: var(--danger, #b03030);
}

/* --- Item body --- */
.fdqj-item-card__body {
  padding: 18px 20px;
}

.fdqj-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.fdqj-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.fdqj-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3, #6b6458);
  line-height: 1.3;
}

.fdqj-field select,
.fdqj-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(26, 24, 21, 0.14);
  font-size: 13px;
}

.fdqj-field select:focus,
.fdqj-field input:focus {
  border-color: rgba(196, 149, 16, 0.4);
  box-shadow: 0 0 0 3px rgba(196, 149, 16, 0.1);
  outline: none;
}

.fdqj-field-hint {
  font-size: 12px;
  color: var(--ink-4, #9a9188);
  margin: 0;
  line-height: 1.35;
}

.fdqj-linked-info {
  font-size: 12px;
  color: var(--ink-3, #6b6458);
  margin: 2px 0 0;
}

/* --- Evidence strip --- */
.fdqj-evidence-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(26, 24, 21, 0.08);
}

.fdqj-evidence-strip__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3, #6b6458);
}

.fdqj-evidence-version {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-subtle, #f2efe9);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink, #1a1815);
}

.fdqj-evidence-strip a {
  font-size: 12px;
  color: var(--accent, #c49510);
  text-decoration: none;
  font-weight: 600;
}

.fdqj-evidence-strip a:hover {
  text-decoration: underline;
}

.fdqj-evidence-strip__sep {
  color: var(--ink-4, #9a9188);
  font-size: 11px;
}

.fdqj-evidence-empty {
  font-size: 12px;
  color: var(--ink-4, #9a9188);
}

.fdqj-evidence-strip form {
  margin: 0;
}

.fdqj-evidence-strip .btn {
  border-radius: 8px;
  font-size: 12.5px;
}

/* --- Item footer --- */
.fdqj-item-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid rgba(26, 24, 21, 0.06);
  background: var(--surface-subtle, #f2efe9);
  flex-wrap: wrap;
}

.fdqj-item-card__footer form {
  margin: 0;
}

.fdqj-item-card__footer .btn {
  border-radius: 8px;
  font-size: 12.5px;
}

.fdqj-footer-hint {
  font-size: 12px;
  color: var(--ink-4, #9a9188);
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* ===================================================================
   FIRE DOOR QUOTE JOBS MODAL — Dark mode
   =================================================================== */
html[data-theme="dark"] [data-fire-door-jobs-modal] .modal__dialog {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .modal__header {
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .modal__body {
  background: rgba(2, 6, 23, 0.42);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .modal__close {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(148, 163, 184, 0.8);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .modal__close:hover {
  background: rgba(30, 41, 59, 0.8);
  color: rgba(248, 250, 252, 0.96);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-eyebrow {
  color: #e3b008;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-section {
  background: var(--card, rgba(15, 23, 42, 0.92));
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: none;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-section__heading,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-items-heading {
  color: rgba(248, 250, 252, 0.96);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-section__copy,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-assigned-info,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-field-label,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-evidence-strip__label {
  color: rgba(148, 163, 184, 0.9);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-assigned-info a {
  color: #e3b008;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-property-form select {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(248, 250, 252, 0.96);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-item-card {
  background: var(--card, rgba(15, 23, 42, 0.92));
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: none;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-item-card__header {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-item-index {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(148, 163, 184, 0.7);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-item-title {
  color: rgba(248, 250, 252, 0.96);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-status-badge--draft {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(148, 163, 184, 0.8);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-status-badge--assigned,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-status-badge--in_progress {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-status-badge--scheduled {
  background: rgba(196, 149, 16, 0.15);
  color: #fbbf24;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-status-badge--completed {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-status-badge--cancelled {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-field select,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-field input {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(248, 250, 252, 0.96);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-evidence-strip {
  border-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-evidence-version {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(248, 250, 252, 0.9);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-evidence-strip a {
  color: #e3b008;
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-item-card__footer {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-field-hint,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-linked-info,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-footer-hint,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-evidence-empty,
html[data-theme="dark"] [data-fire-door-jobs-modal] .fdqj-items-empty {
  color: rgba(148, 163, 184, 0.6);
}

/* ===================================================================
   FIRE DOOR QUOTE JOBS MODAL — Mobile bottom-sheet (900px)
   =================================================================== */
@media (max-width: 900px) {
  [data-fire-door-jobs-modal] .modal__header {
    padding: 14px 16px 12px;
  }

  [data-fire-door-jobs-modal] .modal__header .modal__title {
    font-size: 1.1rem;
  }

  [data-fire-door-jobs-modal] .modal__close {
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
  }

  [data-fire-door-jobs-modal] .modal__body {
    padding: 14px 16px 16px;
  }

  /* Section cards: tighter on mobile */
  .fdqj-section {
    padding: 14px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
  }

  /* Item cards: tighter */
  .fdqj-item-card {
    border-radius: 10px;
  }

  .fdqj-item-card__header {
    padding: 12px 14px 10px;
  }

  .fdqj-item-card__body {
    padding: 14px 14px;
  }

  .fdqj-item-card__footer {
    padding: 10px 14px;
  }

  /* Field grid: single column */
  .fdqj-field-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* All buttons: 44px touch targets */
  .fdqj-property-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .fdqj-property-actions .btn {
    min-height: 44px;
    justify-content: center;
    width: 100%;
  }

  .fdqj-item-card__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .fdqj-item-card__footer .btn {
    min-height: 44px;
    justify-content: center;
    width: 100%;
  }

  .fdqj-footer-hint {
    text-align: center;
    margin-top: 4px;
  }

  .fdqj-evidence-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .fdqj-evidence-strip .btn {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }


  /* Safe area on last item */
  .fdqj-items-list > :last-child {
    margin-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

/* QDM delete modal CSS now lives in inspections_shell.css (shared) */
