:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7f8;
  color: #1f2933;
}

body {
  margin: 0;
}

a {
  color: #155e75;
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d8dee4;
  display: flex;
  justify-content: space-between;
  padding: 14px 28px;
}

.brand {
  color: #111827;
  font-weight: 700;
}

nav {
  align-items: center;
  display: flex;
  gap: 18px;
}

.container {
  margin: 0 auto;
  max-width: 1380px;
  padding: 28px;
}

.page-head {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
}

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

h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

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

.section-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.section-title-row h2 {
  margin-bottom: 14px;
}

.unsaved-indicator {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
  padding: 4px 9px;
}

.table-wrap {
  background: #ffffff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f4;
  font-size: 13px;
  text-transform: uppercase;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.line-review-table tr[data-review-fbr-line] td {
  background: #f8fafc;
  border-bottom-color: #d8dee4;
}

.line-review-table .changed-cell {
  background: #fffbeb !important;
  color: #92400e;
  font-weight: 700;
}

.line-review-table td:first-child {
  min-width: 220px;
}

.button-link,
button {
  background: #155e75;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  padding: 8px 12px;
}

.link-button {
  background: transparent;
  color: #155e75;
  padding: 0;
}

.nav-form {
  margin: 0;
}

select,
input {
  border: 1px solid #cbd5df;
  border-radius: 6px;
  font: inherit;
  padding: 8px 10px;
}

.filter-form,
.connect-form {
  display: flex;
  gap: 10px;
}

.connect-form {
  align-items: start;
  flex-direction: column;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}

.summary-grid div,
.review-strip,
section.alert,
.auth-panel {
  background: #ffffff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  padding: 14px;
}

.auth-panel {
  max-width: 420px;
}

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

.fbr-editable-fields {
  border: 0;
  margin: 0;
  padding: 0;
}

.fbr-editable-fields:disabled {
  opacity: .78;
}

.fbr-editable-fields:disabled input,
.fbr-editable-fields:disabled select {
  cursor: not-allowed;
}

.form-grid label,
.line-extra label {
  color: #52616b;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 5px;
}

.fbr-form input,
.fbr-form select {
  box-sizing: border-box;
  width: 100%;
}

.detail-row td {
  background: #f8fafc;
}

.fbr-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fbr-line {
  background: #ffffff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
}

.line-main {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 30px minmax(210px, 1.25fr) minmax(120px, .65fr) minmax(82px, .4fr) minmax(150px, .8fr) repeat(4, minmax(120px, .65fr)) minmax(170px, .9fr);
  padding: 10px;
}

.line-extra {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.line-main label {
  color: #52616b;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 5px;
  min-width: 0;
}

.line-main input,
.line-main select {
  min-width: 0;
}

.include-line {
  align-items: center;
  align-self: center;
  cursor: help;
  flex-direction: row !important;
  justify-content: center;
  min-height: 40px;
  padding-top: 19px;
}

.include-line input {
  height: 16px;
  margin: 0;
  width: 16px;
}

.excluded-line {
  border-style: dashed;
}

.excluded-line .line-main {
  background: #f8fafc;
}

.excluded-line input,
.excluded-line select {
  background: #f8fafc;
  color: #4b5563;
}

.line-errors {
  background: #fff1f2;
  border-top: 1px solid #fecdd3;
  color: #9f1239;
  padding: 8px 10px;
}

.line-errors p {
  font-size: 13px;
  margin: 3px 0;
}

.line-warning {
  background: #fff7ed;
  border-top: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  padding: 8px 10px;
}

.line-advanced {
  border-top: 1px solid #e5e7eb;
  padding: 8px 10px 10px;
}

.line-advanced summary {
  color: #155e75;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 8px;
}

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

.submit-signature {
  color: #52616b;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 5px;
  min-width: 220px;
}

.secondary-button {
  background: #64748b;
}

.danger-button {
  background: #b91c1c;
}

.submitted-badge {
  align-self: center;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
}

.validation-result {
  background: #ffffff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin-bottom: 24px;
  padding: 14px;
}

.validation-result h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.fbr-error-list {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  color: #9f1239;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.fbr-error-list ul {
  margin: 0;
  padding-left: 20px;
}

.raw-diagnostics {
  margin-top: 18px;
}

.raw-diagnostics h2 {
  margin-bottom: 10px;
}

.raw-response {
  border-top: 1px solid #e5e7eb;
  padding: 8px 0;
}

.raw-response summary {
  color: #155e75;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.raw-response pre {
  background: #0f172a;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.45;
  margin: 8px 0 0;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
}

.fbr-summary {
  background: #ffffff;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin-bottom: 12px;
  padding: 14px;
}

.fbr-summary h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

.compare-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 10px;
}

.compare-grid div {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px;
}

.compare-grid span {
  color: #52616b;
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.line-summary-list {
  color: #374151;
  font-size: 13px;
}

.line-summary-list p {
  margin: 4px 0;
}

.summary-excluded {
  color: #6b7280;
  text-decoration: line-through;
}

.draft-note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  color: #92400e;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.production-note {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.submitted-note {
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: 6px;
  color: #166534;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.field-legend {
  align-items: center;
  color: #52616b;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 10px 16px;
  margin: 0 0 10px;
}

.field-legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.legend-swatch {
  border: 1px solid #cbd5df;
  border-radius: 4px;
  display: inline-block;
  height: 12px;
  width: 18px;
}

.legend-swatch.mapped {
  background: #ecfeff;
  border-color: #0891b2;
}

.legend-swatch.override {
  background: #fffbeb;
  border-color: #d97706;
}

.legend-swatch.api-error {
  background: #fff1f2;
  border-color: #e11d48;
}

.legend-swatch.form-error {
  background: #fef2f2;
  border-color: #f97316;
}

.mapped-value,
.mapped-different {
  border-color: #0891b2;
  background: #ecfeff;
}

.mapped-different {
  border-color: #d97706;
  background: #fffbeb;
}

.calc-error {
  background: #fff1f2;
  border-color: #e11d48;
}

.field-api-error {
  background: #fff1f2 !important;
  border-color: #e11d48 !important;
}

.summary-grid span,
dt {
  color: #52616b;
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.review-strip {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.customer-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.customer-line span {
  color: #52616b;
}

.readiness-compact {
  min-width: 240px;
}

.readiness-compact summary {
  color: #1d2b36;
  cursor: pointer;
  font-weight: 700;
}

.readiness-compact p {
  color: #52616b;
  margin: 8px 0 0;
}

.missing {
  margin: 8px 0 0;
  padding-left: 20px;
}

.alerts {
  margin-bottom: 18px;
}

.alert {
  border-radius: 6px;
  margin-bottom: 8px;
  padding: 10px 12px;
}

.alert.error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}

.alert.success {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.empty {
  color: #6b7280;
  text-align: center;
}

.muted-block {
  color: #6b7280;
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.archive-chip {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  color: #3730a3;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  padding: 2px 7px;
  text-transform: uppercase;
}

.archive-meta {
  color: #52616b;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0;
}

.archive-meta p {
  margin: 0;
}

.nested-raw {
  margin-left: 14px;
}

.pager {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  margin-top: 18px;
}

pre {
  background: #111827;
  border-radius: 6px;
  color: #f9fafb;
  overflow: auto;
  padding: 14px;
}

@media (max-width: 700px) {
  .topbar,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .container {
    padding: 18px;
  }

  .filter-form {
    flex-direction: column;
  }

  .line-main {
    grid-template-columns: 1fr;
  }
}
