/* Import / Export tables should fit the page: wrap long messages/commands
   inside the card instead of forcing a page-level horizontal scrollbar. */
#stgCard { min-width: 0; }
#stgCard .card-head { min-width: 0; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; }

/* Grouped tab bar: three labelled clusters (Summary / Staging / Tools) so the
   bar reads as three things, not nine equal pills. */
#stgTabs.tabbar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.tabgroup { display: flex; flex-direction: column; gap: 5px; }
.tabgroup.primary .seg { box-shadow: var(--shadow-card); }
.tabgroup-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bfc-muted); padding-left: 6px; opacity: 0.75;
}
#stgTabs .seg button { display: inline-flex; align-items: center; gap: 6px; }
.tab-badge {
  font-family: var(--font-display); font-size: 11px; font-weight: 800; line-height: 1;
  padding: 2px 6px; border-radius: 999px; background: var(--bfc-soft-2); color: var(--bfc-muted);
}
.tab-badge.danger { background: var(--bfc-danger-bg); color: var(--bfc-danger-text); }
.tab-badge.warn { background: var(--bfc-warn-bg); color: var(--bfc-warn-text); }

/* Header context chip — which customer/box this session is pointed at. */
.env-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 12.5px; font-weight: 650; color: var(--bfc-navy);
  background: var(--bfc-surface); border: 1px solid var(--bfc-line-strong);
  border-radius: 999px; padding: 6px 12px;
}
.env-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bfc-teal); }
.env-chip .sep { color: var(--bfc-line-strong); }
.env-chip code { font-family: var(--font-mono); font-size: 12px; color: var(--bfc-indigo-dark); }
#stgBody .report-banner { flex-wrap: wrap; }
#stgBody .report-banner .clear { margin-left: 0; }
.staging-filter-help {
  flex-basis: 100%;
  color: var(--bfc-muted);
  font-size: 12.5px;
  line-height: 1.4;
  padding-left: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Tab-aware filters: controls hidden for the current tab must fully collapse
   out of the flex row, not just render invisible. */
.staging-filters [hidden] { display: none !important; }
/* The effective-window hint shown when the date fields are left empty. */
.filter-window {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--bfc-indigo-dark);
  background: var(--bfc-soft-2);
  border: 1px solid var(--bfc-line);
  border-radius: 999px;
  padding: 3px 10px;
}
#stgBody .report-banner select { min-width: 150px; max-width: 100%; }
.staging-table-wrap { max-width: 100%; overflow-x: auto; }
table.staging-data { table-layout: fixed; min-width: 980px; }
table.staging-data thead th,
table.staging-data tbody td {
  padding: 10px 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}
table.staging-data .code-chip { white-space: normal; overflow-wrap: anywhere; }
table.staging-data .pill,
table.staging-data td.num,
table.staging-data th.num { white-space: nowrap; }
table.staging-data td.num { font-variant-numeric: tabular-nums; }
/* Overview lives in a flush card body, so give its content real breathing
   room instead of letting cards/lists kiss the card edges. */
.integration-pane { padding: 20px 22px; display: grid; gap: 24px; }
.overview-modern { gap: 26px; }
.pane-section { display: grid; gap: 12px; }
.pane-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pane-section-head h3 {
  font-family: var(--font-display); font-size: 15px; font-weight: 800;
  color: var(--bfc-navy); margin: 0; letter-spacing: -0.01em;
}
.pane-note { font-size: 12.5px; color: var(--bfc-muted); }
.link-more { font-size: 12.5px; font-weight: 700; color: var(--bfc-indigo); background: none; border: 0; cursor: pointer; padding: 0; }
.link-more:hover { text-decoration: underline; }

/* Needs-attention finding cards. */
.findings { display: grid; gap: 10px; }
.finding {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px;
  border: 1px solid var(--bfc-line); border-left-width: 4px;
  border-radius: var(--radius-md); padding: 14px 16px; background: var(--bfc-surface);
}
.finding.danger { border-left-color: var(--bfc-danger-text); background: var(--bfc-danger-bg); border-color: var(--bfc-danger-line); }
.finding.warn { border-left-color: var(--bfc-yellow); background: var(--bfc-warn-bg); border-color: var(--bfc-warn-line); }
.finding-main { min-width: 0; }
.finding-title { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 14.5px; color: var(--bfc-navy); }
.finding-msg { color: var(--bfc-copy); font-size: 13.5px; line-height: 1.5; margin-top: 4px; }
.finding-action { color: var(--bfc-ink); font-size: 13px; line-height: 1.5; margin-top: 8px; }
.finding-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--bfc-muted); }
.finding-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
/* A calm "nothing to see here" line, not a celebratory green banner — it sits
   quietly under the section heading and stays out of the way. */
.allclear {
  display: flex; align-items: center; gap: 8px; padding: 2px 2px 0;
  color: var(--bfc-muted); font-weight: 500; font-size: 13px; line-height: 1.4;
}
.allclear span[aria-hidden] { color: var(--bfc-teal); font-weight: 800; font-size: 13px; }

/* Overview's compact health status — a calm line when clear, a prominent
   banner that points to Health when there are issues. Overview no longer
   duplicates the full issue list; Health owns that. */
.overview-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.overview-status .allclear { padding: 0; }
.overview-status.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bfc-line);
  background: var(--bfc-surface);
}
.overview-status.alert.danger { background: var(--bfc-danger-bg); border-color: var(--bfc-danger-line); }
.overview-status.alert.warn { background: var(--bfc-warn-bg); border-color: var(--bfc-warn-line); }
.overview-status-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.overview-status-main strong { font-family: var(--font-display); font-weight: 800; font-size: 14.5px; color: var(--bfc-navy); }
.overview-status-sub { color: var(--bfc-muted); font-size: 12.5px; }

/* Health "checks performed" — a small reassurance list of the areas scanned,
   each pass (✓) or attention (!). Shown even when everything is clear. */
.health-checks { margin-top: 14px; display: grid; gap: 7px; }
.health-checks-label { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bfc-muted); }
.health-check { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.health-check-mark { flex: 0 0 auto; width: 16px; text-align: center; font-weight: 800; }
.health-check.ok .health-check-mark { color: var(--bfc-teal); }
.health-check.attn .health-check-mark { color: var(--bfc-warn-text); }
.health-check-label { font-weight: 650; color: var(--bfc-navy); min-width: 130px; }
.health-check-note { color: var(--bfc-muted); }

.sevdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sevdot.critical { background: var(--bfc-danger-text); }
.sevdot.warning { background: var(--bfc-yellow); }
.sevdot.info { background: var(--bfc-teal); }

/* Recent-activity peek list. */
.peek-list { display: grid; gap: 8px; }
.peek-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 12px; background: var(--bfc-soft); border: 1px solid var(--bfc-line);
  border-radius: var(--radius-md); font-size: 13px;
}
.peek-row .peek-time { color: var(--bfc-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.peek-row .peek-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bfc-navy); font-weight: 600; }
.peek-row .peek-lane { color: var(--bfc-muted); white-space: nowrap; }

/* Timestamp KPI — a relative phrase, not a giant number. */
.kpi-value.stamp { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin-top: 9px; }

/* Right-align the trailing control on integration banners without touching the
   shared .report-banner used elsewhere (payload controls, order search). */
.report-banner.integration-banner { justify-content: space-between; }

.integration-lane-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.compact-lane-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.integration-lane-card {
  border: 1px solid var(--bfc-line);
  background: var(--bfc-surface);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  text-align: left;
  display: grid;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.integration-lane-card:hover { border-color: var(--bfc-indigo); box-shadow: var(--shadow-elev); transform: translateY(-1px); }
.integration-lane-card.compact { box-shadow: none; background: var(--bfc-soft); }

/* ──────── Unified loading skeletons ────────
   Every loading region is a content-shaped shimmer that reuses the real
   content's shell (lane card, mini card, finding, transport card) so a load
   reads as the final layout filling in. No bespoke spinners or progress bars. */
.skel-card { pointer-events: none; }
.skel-card .skeleton { min-height: 10px; }
.skel-row { pointer-events: none; }
.stg-skel { display: grid; gap: 12px; }
.stg-skel-table { padding: 16px 18px; }
.stg-skel-table .skeleton:first-child { margin-bottom: 4px; }
.stg-skel-cardgrid {
  padding: 18px 22px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.kpi.kpi-loading { cursor: default; }
.kpi.kpi-loading .kpi-value,
.kpi.kpi-loading .kpi-hint { margin-top: 9px; }
.lane-card-head,
.lane-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.lane-card-head strong { font-family: var(--font-display); font-size: 14.5px; color: var(--bfc-navy); }
.lane-card-meta { color: var(--bfc-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lane-card-evidence { display: flex; gap: 6px; flex-wrap: wrap; }
table.integration-health th:nth-child(1) { width: 10%; }
table.integration-health th:nth-child(2) { width: 34%; }
table.integration-health th:nth-child(3) { width: 12%; }
table.integration-health th:nth-child(4) { width: 12%; }
table.integration-health th:nth-child(5) { width: 32%; }
.mini-card-list,
.source-table-mini-list { display: grid; gap: 10px; }
.mini-card,
.source-table-mini {
  border: 1px solid var(--bfc-line);
  border-radius: 14px;
  background: var(--bfc-surface);
  padding: 12px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.mini-card { display: grid; gap: 7px; }
.mini-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mini-card-head .pill { white-space: normal; }
.mini-card strong,
.source-table-mini strong { color: var(--bfc-navy); font-size: 13.5px; }
.mini-empty { border: 1px dashed var(--bfc-line-strong); border-radius: 14px; padding: 14px; color: var(--bfc-muted); background: var(--bfc-soft); font-size: 13px; }
.source-table-mini { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; }
.source-table-mini span:not(.code-chip) { display: block; margin-top: 3px; color: var(--bfc-muted); font-size: 12.5px; }
.transport-files-layout { padding: 18px 22px; display: grid; gap: 18px; }
.transport-setup-inline { border: 1px solid var(--bfc-line); border-radius: 18px; background: var(--bfc-soft); padding: 14px; display: grid; gap: 12px; }
.transport-setup-inline .mini-card-list { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.transport-row-head { margin-bottom: 10px; }
.transport-file-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.transport-file-card {
  border: 1px solid var(--bfc-line);
  border-radius: 16px;
  background: var(--bfc-surface);
  box-shadow: var(--shadow-card);
  padding: 14px;
  display: grid;
  gap: 11px;
  min-width: 0;
}
.transport-file-card:hover { border-color: var(--bfc-indigo); box-shadow: var(--shadow-elev); }
.transport-file-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.transport-file-title { margin-top: 7px; font-family: var(--font-display); font-weight: 850; color: var(--bfc-navy); overflow-wrap: anywhere; }
.transport-file-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; color: var(--bfc-muted); font-size: 12.5px; }
.transport-file-meta b { color: var(--bfc-navy); }
.transport-file-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.transport-file-times div { border-top: 1px solid var(--bfc-line); padding-top: 8px; }
.transport-file-times span { display: block; color: var(--bfc-muted); font-size: 11.5px; }
.transport-file-times strong { display: block; margin-top: 3px; color: var(--bfc-navy); font-size: 12.5px; overflow-wrap: anywhere; }
.transport-file-message { border-radius: 12px; background: var(--bfc-soft); border: 1px solid var(--bfc-line); padding: 10px; color: var(--bfc-copy); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.transport-file-card.drillable { cursor: pointer; }
.transfer-inbound-note { font-size: 12.5px; color: var(--bfc-muted); margin-bottom: 12px; }
/* Direction badge on an FTP transfer card. */
.ftp-dir { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
.ftp-dir-out { color: var(--bfc-indigo-dark); background: rgba(63, 83, 216, 0.12); }
.ftp-dir-in { color: var(--bfc-success-text); background: var(--bfc-success-bg); }
.ftp-dir { white-space: nowrap; }
/* FTP transfers table (one row per transfer). */
table.ftp-transfers { min-width: 1040px; }
table.ftp-transfers th:nth-child(1) { width: 6%; }
table.ftp-transfers th:nth-child(2) { width: 20%; }
table.ftp-transfers th:nth-child(3) { width: 9%; }
table.ftp-transfers th:nth-child(4) { width: 15%; }
table.ftp-transfers th:nth-child(5) { width: 7%; }
table.ftp-transfers th:nth-child(6) { width: 11%; }
table.ftp-transfers th:nth-child(7) { width: 13%; }
table.ftp-transfers th:nth-child(8) { width: 19%; }
.ftp-transfers tbody tr.drillable { cursor: pointer; }
table.interface-events { min-width: 1120px; }
table.direct-interfaces { min-width: 1160px; }
table.interface-configs { min-width: 1120px; }
.direct-layout { display: grid; gap: 18px; padding: 18px 22px; }
.direct-summary-section { display: grid; gap: 12px; }
.direct-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.direct-card { border: 1px solid var(--bfc-line); border-radius: var(--radius-lg); background: var(--bfc-surface); box-shadow: var(--shadow-card); padding: 16px; display: grid; gap: 13px; }
.direct-card.has-errors { border-color: var(--bfc-danger-line); background: var(--bfc-danger-bg); }
.direct-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.direct-title { font-family: var(--font-display); font-size: 15px; font-weight: 800; color: var(--bfc-navy); }
.direct-sub { margin-top: 5px; color: var(--bfc-muted); font-size: 12.5px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.direct-summary { color: var(--bfc-copy); font-size: 13.5px; line-height: 1.45; }
.direct-context { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--bfc-muted); font-size: 12.5px; }
.direct-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.direct-metric { background: var(--bfc-soft); border: 1px solid var(--bfc-line); border-radius: 10px; padding: 9px; min-width: 0; }
.direct-metric span { display: block; color: var(--bfc-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.direct-metric strong { display: block; margin-top: 3px; color: var(--bfc-navy); font-size: 16px; font-variant-numeric: tabular-nums; }
.direct-metric strong.success { color: var(--bfc-success-text); }
.direct-metric strong.danger { color: var(--bfc-danger-text); }
.direct-metric strong.info { color: var(--bfc-indigo-dark); }
.direct-timeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.direct-timeline div { border-top: 1px solid var(--bfc-line); padding-top: 8px; min-width: 0; }
.direct-timeline span { display: block; color: var(--bfc-muted); font-size: 11.5px; }
.direct-timeline strong { display: block; margin-top: 3px; font-size: 12.5px; color: var(--bfc-navy); overflow-wrap: anywhere; }
.direct-policy { color: var(--bfc-muted); font-size: 12px; line-height: 1.4; }
table.find-anything-results { min-width: 1100px; }
.config-value-stack { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
table.interface-events th:nth-child(1) { width: 12%; }
table.interface-events th:nth-child(2) { width: 9%; }
table.interface-events th:nth-child(3) { width: 10%; }
table.interface-events th:nth-child(4) { width: 9%; }
table.interface-events th:nth-child(5) { width: 38%; }
table.interface-events th:nth-child(6) { width: 10%; }
table.interface-events th:nth-child(7) { width: 5%; }
table.interface-events th:nth-child(8) { width: 7%; }
@media (max-width: 900px) {
  .direct-metrics, .direct-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .direct-card-grid, .transport-files-layout { grid-template-columns: 1fr; }
  .direct-layout, .transport-files-layout { padding: 14px; }
  .transport-file-card-grid { grid-template-columns: 1fr; }
}
.direct-activity-head { align-items: baseline; }
table.direct-interfaces th:nth-child(1) { width: 10%; }
table.direct-interfaces th:nth-child(2) { width: 12%; }
table.direct-interfaces th:nth-child(3) { width: 24%; }
table.direct-interfaces th:nth-child(4) { width: 15%; }
table.direct-interfaces th:nth-child(5) { width: 5%; }
table.direct-interfaces th:nth-child(6) { width: 18%; }
table.direct-interfaces th:nth-child(7) { width: 9%; }
table.direct-interfaces th:nth-child(8) { width: 7%; }
table.direct-interfaces tbody tr.drillable { cursor: pointer; }
table.interface-configs th:nth-child(1) { width: 9%; }
table.interface-configs th:nth-child(2) { width: 17%; }
table.interface-configs th:nth-child(3) { width: 16%; }
table.interface-configs th:nth-child(4) { width: 32%; }
table.interface-configs th:nth-child(5) { width: 18%; }
table.interface-configs th:nth-child(6) { width: 8%; }
table.staging-batches th:nth-child(1) { width: 10%; }
table.staging-batches th:nth-child(2) { width: 8%; }
table.staging-batches th:nth-child(3) { width: 16%; }
table.staging-batches th:nth-child(4) { width: 12%; }
table.staging-batches th:nth-child(5) { width: 5%; }
table.staging-batches th:nth-child(6) { width: 6%; }
table.staging-batches th:nth-child(7) { width: 7%; }
table.staging-batches th:nth-child(8) { width: 11%; }
table.staging-batches th:nth-child(9) { width: 11%; }
table.staging-errors th:nth-child(1) { width: 18%; }
table.staging-errors th:nth-child(2) { width: 13%; }
table.staging-errors th:nth-child(3) { width: 6%; }
table.staging-errors th:nth-child(4) { width: 11%; }
table.staging-errors th:nth-child(5) { width: 17%; }
table.staging-errors th:nth-child(6) { width: 25%; }
table.staging-errors th:nth-child(7) { width: 10%; }
table.staging-export-configs th:nth-child(1) { width: 9%; }
table.staging-export-configs th:nth-child(2) { width: 6%; }
table.staging-export-configs th:nth-child(3) { width: 8%; }
table.staging-export-configs th:nth-child(4) { width: 9%; }
table.staging-export-configs th:nth-child(5) { width: 9%; }
table.staging-export-configs th:nth-child(6) { width: 12%; }
table.staging-export-configs th:nth-child(7) { width: 12%; }
table.staging-export-configs th:nth-child(8) { width: 35%; }
table.staging-logs th:nth-child(1) { width: 12%; }
table.staging-logs th:nth-child(2) { width: 13%; }
table.staging-logs th:nth-child(3) { width: 6%; }
table.staging-logs th:nth-child(4) { width: 10%; }
table.staging-logs th:nth-child(5) { width: 10%; }
table.staging-logs th:nth-child(6) { width: 17%; }
table.staging-logs th:nth-child(7) { width: 32%; }
.order-import-searchbar { gap: 10px; align-items: center; }
.order-import-searchbar input[type="search"] { min-width: 220px; }
.order-import-searchbar label { display: inline-flex; gap: 6px; align-items: center; color: var(--bfc-muted); }
.find-anything-panel { display: grid; gap: 18px; }
.find-section { display: grid; gap: 10px; }
table.find-anything-results th:nth-child(1) { width: 12%; }
table.find-anything-results th:nth-child(2) { width: 10%; }
table.find-anything-results th:nth-child(3) { width: 10%; }
table.find-anything-results th:nth-child(4) { width: 40%; }
table.find-anything-results th:nth-child(5) { width: 13%; }
table.find-anything-results th:nth-child(6) { width: 5%; }
table.find-anything-results th:nth-child(7) { width: 10%; }
table.order-import-results th:nth-child(1) { width: 12%; }
table.order-import-results th:nth-child(2) { width: 10%; }
table.order-import-results th:nth-child(3) { width: 22%; }
table.order-import-results th:nth-child(4) { width: 10%; }
table.order-import-results th:nth-child(5) { width: 12%; }
table.order-import-results th:nth-child(6) { width: 14%; }
table.order-import-results th:nth-child(7) { width: 20%; }
.spool-raw {
  max-height: 360px;
  overflow: auto;
  white-space: pre;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 12px;
  background: var(--bfc-soft-2);
  border-radius: var(--radius-md);
  padding: 12px;
}
