:root {
  color-scheme: light;
  --bg: #f4f5f6;
  --panel: #ffffff;
  --text: #15171a;
  --muted: #68717d;
  --line: #dde1e6;
  --brand: #ef233c;
  --brand-dark: #c91027;
  --ink: #111216;
  --green: #147d55;
  --amber: #a86600;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.auth-locked {
  min-height: 100vh;
}

body::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--brand), #111216 56%, var(--brand));
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(21, 128, 61, 0.2);
  background: #f0fdf4;
  color: #14532d;
  box-shadow: 0 16px 34px rgba(17, 18, 22, 0.12);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.toast.success {
  border-color: rgba(21, 128, 61, 0.2);
  background: #f0fdf4;
  color: #14532d;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.auth-gate {
  width: min(680px, calc(100vw - 32px));
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  display: grid;
  align-items: center;
}

.auth-gate-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(17, 18, 22, 0.1);
  padding: 32px;
}

.auth-gate-logo {
  width: 190px;
  max-width: 100%;
  height: auto;
  margin-bottom: 20px;
}

.auth-gate-eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.auth-gate-card h1 {
  margin-bottom: 12px;
}

.auth-gate-status {
  font-size: 15px;
  line-height: 1.5;
  max-width: 46ch;
}

.auth-gate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 24px;
}

.auth-gate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.auth-gate-button:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 12px 30px rgba(17, 18, 22, 0.08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-lockup img {
  width: 180px;
  height: auto;
  flex: 0 0 auto;
}

.brand-lockup p,
.top-meta p {
  margin-bottom: 0;
}

.brand-lockup p {
  color: var(--muted);
  font-size: 13px;
  max-width: 560px;
}

.pilot-guidance {
  margin: -6px 0 18px;
  padding: 10px 14px;
  border: 1px solid #f3c96b;
  border-radius: 8px;
  background: #fff8e6;
  color: #4e3b06;
  font-size: 13px;
}

.pilot-guidance strong {
  color: #111827;
}

.top-meta {
  display: grid;
  justify-items: end;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.auth-panel {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.auth-status {
  text-align: right;
}

.ai-health-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
  width: fit-content;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.ai-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa4b2;
  box-shadow: 0 0 0 3px rgba(154, 164, 178, 0.14);
  flex: 0 0 auto;
}

.ai-health-green {
  color: #0f7a4f;
  border-color: rgba(15, 122, 79, 0.28);
  background: rgba(15, 122, 79, 0.08);
}

.ai-health-green .ai-health-dot {
  background: #0f9d62;
  box-shadow: 0 0 0 3px rgba(15, 157, 98, 0.16);
}

.ai-health-amber {
  color: #8a5b00;
  border-color: rgba(180, 120, 0, 0.3);
  background: rgba(255, 193, 7, 0.12);
}

.ai-health-amber .ai-health-dot {
  background: #f2a900;
  box-shadow: 0 0 0 3px rgba(242, 169, 0, 0.18);
}

.ai-health-red {
  color: #9f1d2b;
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.08);
}

.ai-health-red .ai-health-dot {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}

.ai-health-grey .ai-health-dot {
  background: #9aa4b2;
}

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

.auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  text-decoration: none;
}

.auth-link.secondary {
  background: #f0f1f3;
  color: var(--text);
  border: 1px solid #d4d8de;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
}

.auth-link.secondary:hover {
  background: #e6e8eb;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 26px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(24, 33, 47, 0.04);
}

.collapsible-panel .section-title {
  margin: -18px -18px 0;
  padding: 16px 18px;
  border-bottom: 1px solid #e6eaef;
  background: linear-gradient(180deg, #fbfcfd 0%, #f6f8fa 100%);
  border-radius: 8px 8px 0 0;
}

.collapsible-panel .panel-content {
  margin-top: 16px;
}

.collapsible-panel.is-collapsed .panel-content {
  display: none;
}

.collapse-toggle {
  min-width: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 1px solid #d6dbe2;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(24, 33, 47, 0.04);
}

.panel-footer-toggle {
  display: flex;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #eef2f5;
}

.grid.two,
.grid.three,
.grid.four,
.grid.five {
  display: grid;
  gap: 14px;
}

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

.grid.three {
  grid-template-columns: 2fr 1fr 1fr;
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.job-detail-grid {
  grid-template-columns: minmax(120px, 0.9fr) minmax(180px, 1.35fr) minmax(160px, 1.1fr) minmax(130px, 0.95fr);
  align-items: stretch;
}

.job-detail-grid > label,
.job-address-field {
  grid-template-rows: auto minmax(42px, auto);
  align-self: stretch;
}

.job-detail-grid input,
.job-detail-grid select,
.job-address-field input {
  min-height: 42px;
}

.job-address-field {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
  margin-top: 0;
}

.input-panel > label {
  margin-top: 16px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

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

button.secondary {
  background: #f0f1f3;
  color: var(--text);
  border: 1px solid #d4d8de;
}

button.secondary:hover {
  background: #e6e8eb;
}

button.quote-button {
  background: var(--ink);
  color: #fff;
}

button.quote-button:hover {
  background: #2b2f36;
}

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

.actions.compact {
  margin-top: 0;
}

.sync-window-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-window-field input {
  min-height: 38px;
  min-width: 150px;
}

.professional-edit-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.professional {
  min-height: 28px;
  margin-bottom: 0;
  color: #26364b;
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-wrap;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
  font-family: inherit;
  font-weight: 500;
}

.normalizer-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.normalizer-status.is-ai-working {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
}

.normalizer-status.is-ai-working::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 999px;
  border: 2px solid #c7d2fe;
  border-top-color: #4f46e5;
  animation: spin 0.8s linear infinite;
}

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

.analysis-line-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.analysis-line-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  background: #fbfcfd;
}

.analysis-line-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.4;
}

.analysis-line-source {
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

.analysis-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.analysis-badge.billable {
  background: #ecfdf3;
  color: #147d55;
}

.analysis-badge.ignored {
  background: #f3f4f6;
  color: #4b5563;
}

.analysis-badge.review {
  background: #fff7ed;
  color: #b45309;
}

.analysis-section-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
}

.analysis-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #fafbfc;
}

.analysis-card-sticky {
  position: sticky;
  top: 16px;
}

.analysis-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.analysis-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.analysis-card li {
  line-height: 1.45;
}

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

.analysis-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.analysis-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.review-card {
  margin-top: 14px;
  border-color: #fed7aa;
  background: #fffbeb;
}

.review-card-collapsed summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.review-card-collapsed summary::-webkit-details-marker {
  display: none;
}

.review-card-collapsed[open] summary {
  margin-bottom: 10px;
}

.inline-toggle {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  color: var(--text);
}

.inline-toggle input {
  width: 18px;
  height: 18px;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.loading-indicator.ai-active {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}

.loading-indicator.ai-active::before {
  border-color: #c7d2fe;
  border-top-color: #4f46e5;
}

.loading-indicator::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #d4d8de;
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

button.is-loading {
  opacity: 0.8;
  cursor: wait;
}

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

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title > .collapse-toggle {
  order: -1;
}

.section-title > h2,
.section-title > div:first-child {
  margin-right: auto;
}

.review-flow {
  display: grid;
  gap: 14px;
}

.review-step {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfd;
}

.review-step-heading {
  display: flex;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.review-step-heading h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.review-step-heading p {
  margin: 0;
}

.review-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.review-step .review-meta {
  margin-bottom: 12px;
}

.review-step-actions {
  background: #f7fafc;
}

.review-step-subtools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.joblogic-audit-panel {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.joblogic-audit-dropdown {
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #fbfcfd;
  overflow: hidden;
}

.joblogic-audit-summary {
  cursor: pointer;
  list-style: none;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4f8fc;
}

.joblogic-audit-summary::-webkit-details-marker {
  display: none;
}

.joblogic-audit-summary::marker {
  display: none;
}

.joblogic-audit-summary-copy {
  display: grid;
  gap: 4px;
  flex: 1;
}

.joblogic-audit-summary-copy strong {
  display: block;
}

.joblogic-audit-summary-icon {
  width: 12px;
  height: 12px;
  border-right: 2px solid #5b6f86;
  border-bottom: 2px solid #5b6f86;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
  margin-left: 2px;
  flex: 0 0 auto;
}

.joblogic-audit-summary-icon.is-open {
  transform: rotate(45deg);
}

.joblogic-audit-summary-hint {
  color: var(--muted);
  font-size: 12px;
}

.joblogic-audit-body {
  padding: 0 12px 12px;
}

.joblogic-source-picker {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.joblogic-source-select-wrap {
  display: grid;
  gap: 8px;
}

.joblogic-source-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.joblogic-source-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.joblogic-source-option input {
  margin-top: 2px;
}

.joblogic-source-option small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.joblogic-audit-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.joblogic-audit-tab {
  white-space: nowrap;
}

.joblogic-audit-tab.active {
  background: #102033;
  border-color: #102033;
  color: #fff;
}

.joblogic-audit-tab-panel {
  display: grid;
  gap: 10px;
}

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

.joblogic-audit-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.joblogic-audit-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.joblogic-audit-sections {
  display: grid;
  gap: 10px;
}

.joblogic-audit-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.joblogic-audit-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.joblogic-audit-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.joblogic-audit-section-heading h4 {
  margin: 0;
}

.joblogic-audit-section pre {
  margin: 0;
  white-space: pre-wrap;
  font: 13px/1.45 Arial, Helvetica, sans-serif;
  color: #223042;
}

.joblogic-audit-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.joblogic-audit-attachments {
  display: grid;
  gap: 12px;
}

.joblogic-audit-attachment-group {
  display: grid;
  gap: 8px;
}

.joblogic-audit-attachment-group h5 {
  margin: 0;
  font-size: 13px;
}

.joblogic-audit-link-list {
  gap: 10px;
}

.joblogic-audit-link-list a {
  font-weight: 600;
  text-decoration: none;
}

.joblogic-audit-link-list a:hover {
  text-decoration: underline;
}

.joblogic-audit-link-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.review-step-toolbar {
  display: grid;
  gap: 10px;
}

.review-primary-actions,
.review-secondary-actions {
  margin-top: 0;
}

.review-ai-toggle {
  margin-left: auto;
}

.matches-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.matches-header {
  align-items: center;
}

.matches-header-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.matches-header-hint {
  margin: 0;
  max-width: 720px;
}

.matches-strategy {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.78rem;
  font-weight: 700;
}

.matches-strategy.is-ai {
  background: #eef2ff;
  color: #4338ca;
}

.matches-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  min-width: min(360px, 100%);
}

.match-editable-copy {
  display: flex;
  align-items: start;
  gap: 8px;
  flex-wrap: wrap;
}

.match-description-input {
  min-width: min(420px, 100%);
  width: 100%;
  resize: vertical;
  margin: 0;
  line-height: 1.35;
}

.match-meta-row {
  margin-top: 6px;
}

.match-long-description {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  color: #334155;
  font-size: 0.86rem;
  line-height: 1.35;
  max-height: 6.2rem;
  overflow: auto;
}

.match-long-description strong {
  color: #1e3a8a;
}

.match-quantity-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.match-qty-input {
  max-width: 96px;
}

.match-row-actions {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.match-row-actions button {
  min-height: 36px;
}

.match-row-actions .icon-only-button {
  width: 36px;
  min-width: 36px;
}

.override {
  width: min(460px, 100%);
}

.override-compact {
  margin-bottom: 0;
}

.override-compact input {
  min-height: 40px;
}

.queue-panel {
  border-color: #c9d8eb;
}

.queue-operator-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.queue-operator-field {
  min-width: min(420px, 100%);
  margin-bottom: 0;
}

.queue-lock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-size: 13px;
  font-weight: 700;
}

.queue-lock-badge.is-own-lock {
  background: #eefbf5;
  color: #147d55;
  border-color: #b7ead3;
}

.queue-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.queue-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 12px;
}

.queue-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.queue-filter-field input,
.queue-filter-field select {
  min-height: 40px;
}

.queue-filter-search {
  min-width: 0;
}

.queue-filter-summary {
  margin: 0 0 12px;
  font-size: 13px;
}

.queue-stat {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
}

.queue-stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.queue-list {
  display: grid;
  gap: 10px;
}

.queue-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.queue-picker select {
  width: 100%;
}

.queue-picker-note {
  color: var(--muted);
  font-size: 13px;
}

.queue-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.queue-row.is-selected {
  border-color: #7aa7d6;
  box-shadow: 0 0 0 2px rgba(18, 84, 146, 0.08);
}

.queue-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.queue-row-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-selected-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 12px;
  background: #147d55;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(20, 125, 85, 0.18);
}

.queue-row-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.queue-row-note {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.queue-row-actions {
  display: flex;
  align-items: center;
}

.queue-row-actions .secondary[disabled] {
  opacity: 0.72;
}

.analysis-instruction {
  margin: 0 0 10px;
  font-size: 12px;
}

.analysis-dropzone {
  min-height: 220px;
  border: 1px dashed #d8e0e8;
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.ignored-editor-list.analysis-dropzone,
.analysis-dropzone[data-analysis-dropzone="ignored"] {
  min-height: min(58vh, 520px);
}

.analysis-dropzone.is-drop-target {
  border-color: var(--brand);
  background: #fff6f7;
  box-shadow: 0 0 0 3px rgba(239, 35, 60, 0.08);
}

.analysis-draggable {
  cursor: grab;
}

.analysis-draggable.is-dragging {
  opacity: 0.55;
}

.ignored-editor-list {
  display: grid;
  gap: 8px;
}

.ignored-editor-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.empty-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
}

.invoice-fields {
  margin-bottom: 14px;
}

.quote-import-card {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: linear-gradient(180deg, #fcfdff 0%, #f8fafc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.queue-upload-area {
  margin-top: 16px;
}

.quote-import-card h3 {
  margin-bottom: 6px;
}

.quote-import-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.quote-import-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.quote-import-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4fb;
  border: 1px solid #d5e2f0;
  color: #285987;
  font-size: 12px;
  font-weight: 700;
}

.quote-import-dropzone {
  margin-top: 10px;
  padding: 22px 18px;
  border: 2px dashed #bfd0e1;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.quote-import-dropzone.is-dragover {
  border-color: var(--brand);
  background: #fff5f6;
  box-shadow: 0 0 0 4px rgba(239, 35, 60, 0.08);
  transform: translateY(-1px);
}

.quote-import-dropzone button {
  margin-top: 10px;
}

.quote-import-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  margin: 0 auto 10px;
  background: #eef4fb;
  color: #2b5f8f;
  font-size: 24px;
  font-weight: 700;
}

.quote-import-dropzone-title {
  margin-bottom: 6px;
  color: var(--ink);
}

.quote-import-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.quote-import-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid #dde6ef;
  color: #506274;
  font-size: 12px;
  font-weight: 700;
}

.quote-import-extra-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #dbe3ec;
}

.quote-import-extra-copy h4 {
  margin: 0 0 4px;
}

.quote-import-extra-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #4f6071;
}

.quote-import-extra-field textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  font-weight: 400;
  color: var(--ink);
}

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

.quote-import-extra-actions button {
  min-width: 220px;
}

.package-filter-picker {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.package-filter-summary {
  font-weight: 700;
  color: var(--ink);
}

.package-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.package-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #d8e1ea;
  border-radius: 999px;
  background: #f7fafc;
  font-size: 13px;
  font-weight: 700;
  color: #46596b;
}

.package-filter-option input {
  margin: 0;
}

.invoice-fields label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.invoice-fields label.checkbox-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.invoice-fields label.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.lot-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.lot-add-row button {
  margin-top: 0;
  min-height: 40px;
}

.invoice-document-grid {
  margin-bottom: 14px;
}

.invoice-document-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 176px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.invoice-document-card label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.invoice-document-card button {
  width: 100%;
  min-height: 42px;
  margin-top: auto;
}

.invoice-module {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.basket-tool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.basket-tool-tab {
  min-height: 38px;
  border: 1px solid #d4d8de;
  border-radius: 6px;
  background: #f0f1f3;
  color: var(--text);
  padding: 8px 12px;
  font-weight: 700;
}

.basket-tool-tab:hover {
  background: #e6e8eb;
}

.basket-tool-tab.is-active {
  background: #102033;
  border-color: #102033;
  color: #ffffff;
}

.basket-tool-module {
  margin: 0 0 14px;
}

.basket-tool-module > summary {
  display: none;
}

.invoice-module summary {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.invoice-module summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 13px;
}

.invoice-module[open] summary::before {
  content: "▾";
}

.invoice-module summary::-webkit-details-marker {
  display: none;
}

.invoice-module[open] summary {
  border-bottom: 1px solid #e6eaef;
  background: #f6f8fa;
}

.invoice-module-title {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.invoice-module-title-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.invoice-module-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #1f2937;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}

.invoice-module-hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.invoice-module-body {
  padding: 14px;
}

.invoice-addon-panel {
  margin: 14px 0 16px;
  padding: 14px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.invoice-addon-panel .section-title {
  margin-bottom: 10px;
}

.invoice-addon-panel h2 {
  margin-bottom: 0;
  font-size: 16px;
}

.invoice-module .invoice-addon-panel,
.invoice-module .quote-import-card {
  margin: 0;
}

.discount-matrix-admin {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.discount-matrix-admin summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.discount-matrix-admin summary::-webkit-details-marker {
  display: none;
}

.discount-matrix-admin summary::before {
  content: "▸";
  color: var(--muted);
  margin-right: 8px;
}

.discount-matrix-admin[open] summary::before {
  content: "▾";
}

.discount-matrix-admin-body {
  padding: 0 14px 14px;
}

.commercial-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.commercial-admin-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.commercial-admin-card .section-title {
  margin-bottom: 8px;
}

.commercial-admin-card h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.discount-matrix-lock-row {
  display: grid;
  grid-template-columns: minmax(220px, 280px) auto auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 12px;
}

.discount-matrix-lock-row label {
  display: grid;
  gap: 6px;
}

.discount-matrix-lock-row button {
  min-height: 42px;
}

.queue-admin-toolbar {
  margin-bottom: 12px;
}

.queue-admin-toolbar label {
  display: grid;
  gap: 6px;
  max-width: 480px;
}

.queue-admin-toolbar input {
  min-height: 42px;
}

.invoice-inline-action {
  display: flex;
  align-items: stretch;
}

.invoice-inline-action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.invoice-inline-action-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.invoice-inline-action button {
  width: 100%;
  min-height: 42px;
}

.invoice-sor-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: stretch;
}

.invoice-sor-search-results {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.invoice-sor-search-meta,
.invoice-sor-search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.invoice-sor-search-footer {
  justify-content: center;
  padding-top: 4px;
}

.invoice-sor-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #ffffff;
}

.invoice-sor-result-copy {
  min-width: 0;
}

.invoice-sor-result-row button {
  min-height: 40px;
}

.icon-only-button {
  min-width: 40px;
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.default-line-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(160px, 220px);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.default-basket-lines-list {
  display: grid;
  gap: 10px;
}

.default-line-row {
  display: grid;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #ffffff;
}

.default-line-primary {
  display: grid;
  grid-template-columns: 100px minmax(280px, 1fr);
  gap: 10px;
  align-items: end;
}

.default-line-secondary {
  display: grid;
  grid-template-columns: 90px 90px 110px minmax(170px, 220px) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
}

.default-line-row .mini-input,
.default-line-row select {
  min-width: 0;
  width: 100%;
  max-width: none;
}

.default-line-code {
  max-width: 100px;
}

.default-line-description {
  min-width: 280px;
}

.default-line-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.default-line-field-label {
  font-size: 12px;
  font-weight: 700;
  color: #5f7285;
}

.default-line-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.default-line-row button {
  min-height: 40px;
}

.default-line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.default-line-meta-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid #dde6ef;
  color: #506274;
  font-size: 11px;
  font-weight: 700;
}

.invoice-action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.invoice-action-row button {
  min-height: 44px;
}

.invoice-package-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.invoice-package-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.package-summary-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.package-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f6fa;
  border: 1px solid #dbe3ec;
  color: #35506b;
  font-size: 12px;
  font-weight: 700;
}

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

.invoice-summary-card {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfd;
}

.invoice-summary-card.is-total {
  background: #f5f9ff;
  border-color: #cfddee;
}

.invoice-summary-card.is-alert {
  background: #fff8eb;
  border-color: #f5c56b;
}

.invoice-summary-card.is-danger {
  background: #fff1f2;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
  animation: budget-pulse 1.4s ease-in-out infinite;
}

.invoice-summary-card.is-on-target {
  background: #eefbf4;
  border-color: rgba(20, 125, 85, 0.28);
}

.invoice-summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.invoice-summary-value {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.invoice-summary-note {
  color: #5b6776;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

#packageBudgetSummary.is-over-budget {
  color: #b42318;
  font-weight: 800;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
  background: #fff1f2;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
  animation: budget-pulse 1.4s ease-in-out infinite;
}

#packageBudgetSummary.is-under-budget {
  color: #9a6700;
  font-weight: 700;
}

#packageBudgetSummary.is-on-target {
  color: #147d55;
  font-weight: 700;
}

@keyframes budget-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.16);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.05);
  }
}

.package-quotes-list {
  display: grid;
  gap: 10px;
}

.package-quote-card {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfd;
}

.package-quote-copy {
  min-width: 0;
}

.package-quote-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.package-quote-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.package-quote-actions {
  display: flex;
  justify-content: flex-end;
}

.package-quote-actions button {
  min-height: 36px;
}

.invoice-export-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.invoice-export-row button {
  min-height: 42px;
}

.invoice-fields label button.secondary {
  margin-top: 8px;
}

.payload-preview {
  margin: 10px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1720;
  color: #d9e2ec;
  font: 12px/1.5 "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.invoice-total {
  color: #5b6776;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.warning-card {
  border-color: #f5c56b;
  background: #fff8eb;
}

.sor-warning-card {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #f1d79a;
  border-radius: 6px;
  background: #fff8eb;
}

.sor-warning-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.sor-warning-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.sor-warning-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #f1d79a;
}

.sor-warning-row.is-danger {
  background: #fff4f4;
  border-color: #ef9a9a;
}

.sor-warning-action {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.warning-flag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.warning-flag-item {
  padding: 10px 12px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #f1d79a;
}

.warning-flag-item.is-danger {
  border-color: #ef9a9a;
  background: #fff4f4;
}

.warning-flag-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.warning-flag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f6b94c;
  color: #1f2933;
  font-size: 12px;
  font-weight: 800;
}

.warning-flag-item.is-danger .warning-flag-icon {
  background: #d64545;
  color: #ffffff;
}

.handoff-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.handoff-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.handoff-card-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.handoff-card-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}

.handoff-toggle-row {
  margin-top: 10px;
}

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

.analysis-card-header h3 {
  margin-bottom: 0;
}

.analysis-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.billable-manual-search {
  min-width: min(320px, 100%);
  flex: 1 1 320px;
}

.billable-manual-search input {
  width: 100%;
}

.billable-editor-list {
  display: grid;
  gap: 8px;
}

.billable-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.billable-editor-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.billable-editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.billable-editor-row input,
.billable-editor-row select {
  min-height: 38px;
}

.billable-editor-row input {
  min-width: 0;
}

.billable-room-select {
  min-width: 170px;
}

.billable-row-room-select {
  width: 150px;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid #d7dde4;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.meta-pill.is-claimed {
  background: #eefbf5;
  border-color: #b7ead3;
  color: #147d55;
}

.meta-pill.is-new {
  background: #eef6ff;
  border-color: #c8dcf5;
  color: #195b9b;
}

.meta-pill.is-matched {
  background: #edf7ed;
  border-color: #cce7cf;
  color: #216e39;
}

.meta-pill.is-review {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #b45309;
}

.meta-pill.is-approved {
  background: #eefbf3;
  border-color: #b7e6c2;
  color: #1b6f3a;
}

.meta-pill.is-quoted {
  background: #f3f0ff;
  border-color: #d6ccff;
  color: #5b3cc4;
}

.meta-pill.is-invoiced {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

.matches-table {
  table-layout: fixed;
  min-width: 1180px;
}

.matches-table th:nth-child(1),
.matches-table td:nth-child(1) {
  width: 64px;
}

.matches-table th:nth-child(2),
.matches-table td:nth-child(2) {
  width: 118px;
}

.matches-table th:nth-child(3),
.matches-table td:nth-child(3) {
  width: 34%;
  min-width: 360px;
}

.matches-table th:nth-child(4),
.matches-table td:nth-child(4) {
  width: 150px;
}

.matches-table th:nth-child(5),
.matches-table td:nth-child(5) {
  width: 23%;
  min-width: 240px;
}

.matches-table th:nth-child(6),
.matches-table td:nth-child(6) {
  width: 128px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  border-top: 2px solid var(--brand);
}

tr.is-approved-row td {
  background: #eefbf5;
}

tr.just-approved td {
  animation: approvedFlash 1.8s ease;
}

tr.is-sor-warning-row td {
  position: relative;
}

tr.is-sor-warning-caution td {
  background: #fff8eb;
  border-top-color: #f1d79a;
  border-bottom-color: #f1d79a;
}

tr.is-sor-warning-danger td {
  background: #fff4f4;
  border-top-color: #ef9a9a;
  border-bottom-color: #ef9a9a;
  animation: sorRiskPulse 1.6s ease-in-out infinite;
}

@keyframes sorRiskPulse {
  0%, 100% {
    box-shadow: inset 0 0 0 0 rgba(214, 69, 69, 0.08);
  }
  50% {
    box-shadow: inset 0 0 0 999px rgba(214, 69, 69, 0.08);
  }
}

.task-group-row td {
  background: #f7f8fa;
  color: var(--ink);
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding: 0;
}

.task-group-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.task-group-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-left: 4px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-sizing: border-box;
}

.task-group-toggle:hover {
  background: #f1f4f8;
}

.task-group-row.is-recommended td,
.task-group-toggle.is-recommended {
  background: #ecfdf3;
}

.task-group-toggle.is-recommended {
  border-left-color: #15803d;
}

.task-group-row.is-strong td,
.task-group-toggle.is-strong {
  background: #f0fdf4;
}

.task-group-toggle.is-strong {
  border-left-color: #22c55e;
}

.task-group-row.is-review td,
.task-group-toggle.is-review {
  background: #fff7ed;
}

.task-group-toggle.is-review {
  border-left-color: #d97706;
}

.task-group-row.is-weak td,
.task-group-toggle.is-weak {
  background: #fef2f2;
}

.task-group-toggle.is-weak {
  border-left-color: #dc2626;
}

.task-group-row.is-empty td,
.task-group-toggle.is-empty {
  background: #f8fafc;
}

.task-group-toggle.is-empty {
  border-left-color: #94a3b8;
}

.task-group-toggle.is-recommended:hover,
.task-group-toggle.is-strong:hover {
  background: #dcfce7;
}

.task-group-toggle.is-review:hover {
  background: #ffedd5;
}

.task-group-toggle.is-weak:hover {
  background: #fee2e2;
}

.task-group-toggle-icon {
  font-size: 13px;
  color: var(--muted);
}

.task-group-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.task-group-approved-badge {
  border: 1px solid #9bd7b7;
  border-radius: 999px;
  background: #e7f8ee;
  color: #146c43;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
}

.task-group-quality-badge {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
}

.task-group-quality-badge.is-recommended,
.task-group-quality-badge.is-strong {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.task-group-quality-badge.is-review {
  border-color: #fdba74;
  background: #ffedd5;
  color: #9a3412;
}

.task-group-quality-badge.is-weak {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.task-group-quality-badge.is-empty {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.task-group-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-group-toolbar .icon-only-button {
  align-self: center;
  margin-right: 10px;
}

.task-group-control-row td {
  background: #ffffff;
  padding: 12px;
  border-bottom: 1px solid #dbe3ec;
}

.task-line-tools {
  display: grid;
  gap: 10px;
}

.task-line-editor {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-line-editor textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  line-height: 1.35;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.task-line-actions {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.task-line-manual-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-line-manual-search input {
  min-height: 38px;
}

.invoice-section-row td {
  background: #eef3f8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  border-top: 1px solid #cdd9e7;
}

.invoice-package-row td {
  background: #e3eef9;
  color: #1f4e79;
  font-size: 13px;
  font-weight: 800;
  border-top: 1px solid #bfd2e6;
}

.invoice-section-subtotal-row td {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid #dbe3ee;
}

.invoice-section-subtotal-row td:nth-child(8) {
  color: var(--ink);
}

.invoice-package-subtotal-row td {
  background: #eef5fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid #d8e5f1;
}

.invoice-package-subtotal-row td:nth-child(8) {
  color: var(--ink);
}

.invoice-package-select,
.invoice-section-input {
  min-width: 130px;
}

.invoice-panel table th:nth-child(1),
.invoice-panel table td:nth-child(1) {
  min-width: 140px;
}

.invoice-panel table th:nth-child(4),
.invoice-panel table td:nth-child(4) {
  min-width: 320px;
}

.invoice-panel table th:nth-child(5),
.invoice-panel table td:nth-child(5) {
  min-width: 90px;
}

.invoice-panel table th:nth-child(7),
.invoice-panel table td:nth-child(7) {
  min-width: 100px;
}

.invoice-panel table th:nth-child(8),
.invoice-panel table td:nth-child(8) {
  min-width: 150px;
}

.invoice-panel #invoiceBody .mini-input {
  width: 100%;
  max-width: none;
}

.invoice-description-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.invoice-description-input {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  font: inherit;
  line-height: 1.35;
  color: var(--ink);
  background: #fff;
}

.invoice-qty-input {
  min-width: 82px;
  text-align: right;
}

.invoice-rate-input {
  min-width: 96px;
  text-align: right;
}

#updateBasketBtn.is-pending {
  border-color: #f0b429;
  background: #fff7df;
  color: #6f4b00;
}

.invoice-total-cell {
  min-width: 140px;
}

.invoice-total-cell strong {
  display: block;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.invoice-total-cell .muted {
  display: block;
  margin-top: 4px;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none;
}

.settings-panel {
  border-color: #b8c8dd;
}

.admin-dropdown-panel {
  padding: 0;
  overflow: hidden;
}

.admin-dropdown-summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 18px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f6f8fa 100%);
}

.admin-dropdown-summary::-webkit-details-marker {
  display: none;
}

.admin-dropdown-summary::marker {
  display: none;
}

.admin-dropdown-summary strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.admin-dropdown-summary small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.admin-dropdown-icon {
  width: 32px;
  height: 32px;
  border: 1px solid #d4d8de;
  border-radius: 50%;
  background: #f4f6f8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-dropdown-icon::before {
  content: "▸";
  font-size: 14px;
  color: #1f2a37;
}

.admin-dropdown-panel[open] .admin-dropdown-icon::before {
  content: "▾";
}

.admin-dropdown-content {
  padding: 0 18px 18px;
}

.status-pill {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  background: #f9fbfd;
  font-weight: 700;
}

.status-pill.ready {
  color: var(--green);
  border-color: rgba(20, 125, 85, 0.35);
  background: rgba(20, 125, 85, 0.08);
}

.ai-health-admin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px;
  margin: 12px 0;
}

.ai-health-admin p {
  margin: 4px 0 0;
}

@media (max-width: 1080px) {
  .commercial-admin-grid {
    grid-template-columns: 1fr;
  }
}

.confidence {
  display: inline-flex;
  min-width: 58px;
  max-width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.confidence-button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.confidence-button:hover {
  filter: brightness(0.96);
}

.strong {
  background: #15803d;
}

.likely {
  background: #15803d;
}

.review {
  background: #d97706;
}

.weak {
  background: #b42318;
}

.match-source-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.match-risk-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  vertical-align: middle;
}

.match-risk-badge.is-warning {
  background: #fff1cc;
  color: #9a5b00;
  border: 1px solid #f1d79a;
}

.match-risk-badge.is-danger {
  background: #fee2e2;
  color: #b42318;
  border: 1px solid #ef9a9a;
}

.confidence-detail {
  margin-top: 0.2rem;
  font-size: 0.74rem;
  text-align: center;
}

.match-confidence-cell {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}

.match-confidence-summary {
  max-width: 100%;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.25;
}

.match-reason-detail {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.match-review-assist {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  background: #fffbeb;
}

.match-review-assist-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.match-review-assist h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.match-review-assist p {
  margin: 0;
}

.match-review-assist-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.9fr);
  gap: 14px;
}

.match-review-assist-copy {
  display: grid;
  gap: 10px;
}

.match-review-assist-copy ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.match-review-assist-actions {
  display: grid;
  gap: 10px;
  align-content: start;
}

.match-review-assist-actions button {
  width: 100%;
}

@keyframes approvedFlash {
  0% {
    background: #bbf7d0;
  }
  100% {
    background: #eefbf5;
  }
}

.invoice-panel {
  border-color: #c9d8eb;
}

.pdf-link {
  display: flex;
  min-height: 39px;
  align-items: center;
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.pdf-link[href="#"] {
  color: var(--muted);
  pointer-events: none;
}

.pdf-link-button {
  width: 100%;
  text-align: left;
}

.mini-input {
  max-width: 88px;
  padding: 7px 8px;
}

#discountRulesBody input.mini-input {
  width: 100%;
  max-width: none;
}

#discountRulesBody td:first-child,
.invoice-addon-panel th:first-child {
  min-width: 220px;
}

#discountRulesBody td:first-child,
#discountRulesBody td:first-child input,
#discountRulesBody td:first-child button {
  min-width: 220px;
}

.invoice-total {
  margin-top: 14px;
  text-align: right;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1280px);
    margin-top: 10px;
  }

  .auth-gate {
    width: min(100vw - 20px, 680px);
  }

  .auth-gate-card {
    padding: 24px 20px;
  }

  .topbar,
  .section-title,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-lockup img {
    width: 150px;
  }

  .top-meta {
    justify-items: stretch;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .grid.five,
  .queue-row,
  .queue-filter-bar,
  .queue-stats,
  .stress-grid,
  .handoff-summary {
    grid-template-columns: 1fr;
  }
}
