﻿.adx-wrap {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #ffffff;
  border: 1px solid #dbe5f1;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(18, 38, 63, 0.08);
  padding: 20px;
}

.adx-head h2 {
  margin: 0;
  color: #13263b;
}

.adx-meta {
  margin: 10px 0 0;
  color: #51637a;
}

.adx-dev-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: #35506f;
}

.adx-form {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.adx-file-label {
  font-size: 13px;
  font-weight: 600;
  color: #1f3348;
}

.adx-file-input {
  border: 1px solid #c8d4e2;
  border-radius: 10px;
  padding: 8px;
  background: #f8fbff;
}

#adx-submit {
  justify-self: start;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #0f7b8f;
  border-radius: 10px;
  background: #0f7b8f;
  color: #f7fcff;
  font-weight: 700;
  cursor: pointer;
}

#adx-submit:disabled {
  opacity: 0.65;
  cursor: default;
}

#adx-submit:hover:not(:disabled),
#adx-submit:focus-visible:not(:disabled) {
  background: #1f9ab0;
  border-color: #1f9ab0;
}

.adx-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f8ff;
  color: #1b3a5a;
}

.adx-status.adx-error {
  background: #fff2f2;
  color: #942323;
  font-weight: 600;
}

.adx-output-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.adx-output-panel {
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: #f9fcff;
  overflow: hidden;
}

.adx-output-title {
  margin: 0;
  padding: 10px 12px;
  font-weight: 700;
  color: #13263b;
  border-bottom: 1px solid #e3edf7;
  background: #f2f7fd;
}

.adx-output-copy {
  margin: 10px 12px 0;
  color: #4e6179;
  font-size: 13px;
}

.adx-output-panel p {
  margin: 10px 12px;
}

.adx-output-panel a {
  color: #0f7b8f;
  font-weight: 600;
}

.adx-quote-notice {
  min-height: 18px;
  color: #35506f;
}

.adx-preview {
  margin: 10px 12px 12px;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #d6e4ff;
  min-height: 72px;
  max-height: 360px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.adx-wrap:not(.is-debug) #adx-preview-parser,
.adx-wrap:not(.is-debug) #adx-preview-scope {
  display: none;
}

.adx-wrap:not(.is-debug) #adx-download-quote-debug {
  display: none !important;
}

.adx-review-panel {
  margin-top: 16px;
  border: 1px solid #f0cf9a;
  border-radius: 12px;
  background: #fffaf0;
  padding: 14px 16px;
}

.adx-review-head h3 {
  margin: 0;
  color: #13263b;
}

.adx-review-copy {
  margin: 8px 0 0;
  color: #6a5327;
  font-size: 13px;
}

.adx-review-progress {
  margin: 8px 0 0;
  font-weight: 700;
  color: #7a5300;
}

.adx-review-findings {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.adx-review-empty {
  margin: 0;
  color: #51637a;
  font-size: 13px;
}

.adx-review-group {
  border: 1px solid #ecdcb8;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
}

.adx-review-group-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #13263b;
}

.adx-finding {
  border: 1px solid #e6ecf4;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  background: #f9fcff;
}

.adx-review-group > .adx-finding:first-of-type {
  margin-top: 0;
}

.adx-finding.is-resolved {
  background: #f4fbf5;
  border-color: #cdeccf;
}

.adx-finding-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.adx-finding-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: #51637a;
}

.adx-finding-badge--annotation { background: #a2401f; }
.adx-finding-badge--low_confidence { background: #b8860b; }
.adx-finding-badge--missing_catalog { background: #6a3fb8; }
.adx-finding-badge--unknown_door_type { background: #1f6fb8; }

.adx-finding-loc {
  font-size: 12px;
  color: #51637a;
}

.adx-finding-summary {
  margin: 6px 0 0;
  color: #1f3348;
  font-size: 13px;
  white-space: pre-wrap;
}

.adx-finding-status {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #1c7a3c;
}

.adx-finding-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.adx-finding-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #c8d4e2;
  background: #ffffff;
  color: #1f3348;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}

.adx-finding-btn:hover,
.adx-finding-btn:focus-visible {
  border-color: #0f7b8f;
  color: #0f7b8f;
  outline: none;
}

.adx-finding-btn--ack { border-color: #1c7a3c; color: #1c7a3c; }
.adx-finding-btn--exclude { border-color: #942323; color: #942323; }
.adx-finding-btn--override { border-color: #6a3fb8; color: #6a3fb8; }

.adx-finding-override {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.adx-finding-override-input {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #c8d4e2;
  font-size: 12px;
  width: 180px;
}

.adx-review-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#adx-generate-estimate {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #1c7a3c;
  border-radius: 10px;
  background: #1c7a3c;
  color: #f7fff9;
  font-weight: 700;
  cursor: pointer;
}

#adx-generate-estimate:disabled {
  opacity: 0.6;
  cursor: default;
  background: #8a97a6;
  border-color: #8a97a6;
}

#adx-generate-estimate:hover:not(:disabled),
#adx-generate-estimate:focus-visible:not(:disabled) {
  background: #219a4c;
  border-color: #219a4c;
}

.adx-review-block-note {
  margin: 0;
  font-size: 12px;
  color: #7a5300;
}

/* PDF.3: catalog-match finding badges */
.adx-finding-badge--match_ambiguous { background: #b8471f; }
.adx-finding-badge--match_unmatched { background: #7a2323; }

.adx-finding-candidates {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.adx-finding-candidate-select {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #c8d4e2;
  font-size: 12px;
  max-width: 320px;
}

/* PDF.3: auto-matched item rows (informational, non-blocking) */
.adx-auto-match-list {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.adx-auto-match {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #cdeccf;
  border-radius: 8px;
  background: #f4fbf5;
  font-size: 12px;
}

.adx-auto-match-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: #1c7a3c;
  white-space: nowrap;
}

.adx-auto-match-label {
  color: #1f3348;
}

/* PDF.4.3b-4: auto-matched rows can now carry extra badges + informational
   blocks (ignored tokens / not-stocked accessories), so the row is no
   longer a single flex line -- head + stacked detail blocks below it. */
.adx-auto-match {
  display: block;
}

.adx-auto-match-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* PDF.4.3b-4: surfaced-data badges (qty-unknown, non-billable, unreliable
   evidence) -- additive, distinct from the type badge, always visible
   (never hidden behind a click), consistent with the existing
   .adx-finding-badge visual language. */
.adx-extra-badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.adx-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
}

.adx-badge--qty-unknown {
  background: #a2401f;
}

.adx-badge--non-billable {
  background: #51637a;
}

.adx-badge--unreliable {
  background: #b8860b;
}

/* Qty-unknown rows must be unmistakable and actionable: a dedicated,
   high-contrast instruction -- never a guessed default quantity. */
.adx-qty-unknown-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid #f0b199;
  border-radius: 8px;
  background: #fff3ee;
  color: #7a2b12;
  font-size: 12px;
  font-weight: 600;
}

/* Match-rationale transparency: exactly what the matcher ignored/decomposed,
   always visible (never collapsed behind an extra click) so the operator
   can trust (or challenge) an auto/ambiguous match. */
.adx-ignored-tokens,
.adx-not-stocked {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7f9fc;
  border: 1px solid #dfe7f0;
  font-size: 12px;
}

.adx-ignored-tokens-title,
.adx-not-stocked-title {
  margin: 0 0 4px;
  font-weight: 700;
  color: #35506f;
}

.adx-ignored-tokens-list,
.adx-not-stocked-list {
  margin: 0;
  padding-left: 18px;
  color: #1f3348;
}

.adx-ignored-tokens-list li,
.adx-not-stocked-list li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.adx-not-stocked {
  background: #f2f7fd;
  border-color: #c8dcf0;
}

/* PDF.4.3b-4: scannability bar -- type + door counts and quick filters for
   qty-unknown / non-billable rows. Client-side only; never removes a
   finding, only changes which rows currently render. */
.adx-scan-bar {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #e6ecf4;
  border-radius: 10px;
  background: #f9fcff;
  display: grid;
  gap: 8px;
}

.adx-type-filter-row,
.adx-quick-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  /* Never let a long chip row force page-level horizontal scroll: wrap
     first; if a single row is still too wide on a very narrow viewport it
     scrolls WITHIN this bar, not the page. */
  max-width: 100%;
  overflow-x: auto;
}

.adx-type-chip {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #c8d4e2;
  background: #ffffff;
  color: #1f3348;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.adx-type-chip:hover {
  border-color: #0f7b8f;
  color: #0f7b8f;
}

.adx-type-chip.is-active {
  background: #0f7b8f;
  border-color: #0f7b8f;
  color: #ffffff;
}

.adx-quick-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #1f3348;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.adx-quick-filter input[type="checkbox"] {
  min-width: 16px;
  min-height: 16px;
}

/* Visible keyboard focus for the new scannability controls. (Existing
   .adx-finding-btn / .adx-bulk-ack-btn already carry a color-change
   focus-visible indicator at higher specificity -- see their own rules
   above -- so they are left untouched here rather than duplicated.) */
.adx-type-chip:focus-visible,
.adx-quick-filter:focus-within {
  outline: 2px solid #0f7b8f;
  outline-offset: 2px;
}

/* PDF.3: bulk acknowledge rows */
.adx-bulk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.adx-bulk-row--global {
  padding: 10px 12px;
  border: 1px dashed #f0cf9a;
  border-radius: 10px;
  background: #fff6e6;
}

.adx-bulk-ack-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #0f7b8f;
  background: #ffffff;
  color: #0f7b8f;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}

.adx-bulk-ack-btn:hover:not(:disabled),
.adx-bulk-ack-btn:focus-visible:not(:disabled) {
  background: #0f7b8f;
  color: #ffffff;
  outline: none;
}

.adx-bulk-ack-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.adx-bulk-progress {
  font-size: 12px;
  color: #51637a;
}

@media (prefers-reduced-motion: reduce) {
  .adx-finding-btn,
  .adx-bulk-ack-btn,
  .adx-type-chip,
  #adx-generate-estimate {
    transition: none;
  }
}

@media (max-width: 480px) {
  .adx-finding-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .adx-finding-override {
    flex-direction: column;
    align-items: stretch;
  }

  .adx-finding-override-input {
    width: 100%;
  }

  .adx-finding-candidates {
    flex-direction: column;
    align-items: stretch;
  }

  .adx-finding-candidate-select {
    max-width: 100%;
  }

  .adx-bulk-row {
    flex-direction: column;
    align-items: stretch;
  }

  /* PDF.4.3b-4: scannability bar at narrow widths -- chips/quick-filters
     stack for tap-target comfort; the row itself still scrolls within
     .adx-scan-bar (never the page) if content is ever wider than the
     viewport. */
  .adx-quick-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.adx-debug-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.adx-debug-panel {
  border: 1px solid #ccd8e5;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.adx-debug-title {
  padding: 8px 10px;
  font-weight: 700;
  border-bottom: 1px solid #e5edf5;
  background: #f4f8fc;
}

.adx-debug {
  margin: 0;
  padding: 10px;
  background: #111827;
  color: #e5ecf8;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .adx-output-grid {
    grid-template-columns: 1fr;
  }

  .adx-debug-grid {
    grid-template-columns: 1fr;
  }
}
