/*
 * PO data readability layer.
 *
 * The base stylesheet keeps the editorial ledger appearance. This file is
 * intentionally loaded afterwards and raises only business-data typography,
 * spacing and table usability without enlarging unrelated navigation chrome.
 */

@media (min-width: 1181px) {
  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Production overview: balance both panels and make PO facts readable. */
.ledger-panel > header {
  min-height: 82px;
  padding: 20px 24px;
}
.ledger-panel header p {
  font-size: 10px;
}
.ledger-panel h2 {
  font-size: 26px;
}
.ledger-panel header a,
.ledger-panel :where(header) > span {
  font-size: 12px;
}
.urgent-row {
  min-height: 90px;
  padding: 14px 20px;
  grid-template-columns: 52px 84px minmax(0, 1fr) auto;
  gap: 16px;
}
.urgent-row b {
  font-size: 14px;
}
.urgent-row small {
  font-size: 11px;
  line-height: 1.45;
}
.urgent-row > strong {
  font-size: 22px;
}
.date-block strong {
  font-size: 21px;
}
.customer-bars {
  padding: 12px 24px 24px;
}
.customer-bars > div {
  min-height: 58px;
  grid-template-columns: 28px minmax(105px, 0.85fr) 1fr 28px;
  gap: 12px;
}
.customer-bars > div > span {
  font-size: 11px;
}
.customer-bars b {
  font-size: 12px;
}
.customer-bars i {
  height: 6px;
}
.customer-bars strong {
  font-size: 16px;
}

/* Shared PO badges and placeholders. */
.customer-stamp {
  min-height: 28px;
  padding: 0 8px;
  font-size: 10px;
  line-height: 1.2;
}
.po-image-placeholder i {
  font-size: 8px;
}
.po-image-placeholder small {
  font-size: 7px;
}

/* PO management table. */
.results-panel > header p {
  font-size: 13px;
}
.results-panel > header small {
  font-size: 11px;
}
.table-head {
  min-height: 44px;
  font-size: 11px;
}
.table-row {
  min-height: 82px;
  padding-top: 13px;
  padding-bottom: 13px;
}
.table-row > span {
  font-size: 13px;
  line-height: 1.45;
}
.table-row b {
  font-size: 13px;
}
.table-row small {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
}
.status {
  min-height: 27px;
  padding: 0 9px;
  font-size: 11px;
}

/* Complete progress matrix: larger cells, sticky context and clearer status. */
.node-matrix-scroll {
  position: relative;
  scrollbar-gutter: stable;
}
.node-matrix {
  min-width: 2460px;
}
.node-matrix th,
.node-matrix td {
  height: 82px;
  padding: 10px;
  border-color: #d6d0c3;
}
.node-matrix th {
  height: 62px;
  color: #5d6966;
  font-size: 11px;
  line-height: 1.4;
}
.node-matrix th:first-child {
  width: 72px;
}
.node-matrix th:nth-child(2) {
  width: 270px;
}
.node-matrix th:last-child {
  width: 130px;
}
.node-matrix th span {
  margin-bottom: 5px;
  font-size: 14px;
}
.node-matrix button {
  min-height: 64px;
}
.matrix-identity {
  gap: 6px;
}
.matrix-identity b {
  font-size: 14px;
}
.matrix-identity small {
  font-size: 11px;
  line-height: 1.35;
}
.matrix-state b {
  font-size: 11px;
  line-height: 1.35;
}
.matrix-state small,
.matrix-state i {
  margin-top: 5px;
  font-size: 9px;
  line-height: 1.35;
}
.matrix-date {
  font-size: 12px;
  font-weight: 700;
}
.node-matrix thead th {
  position: sticky;
  z-index: 4;
  top: 0;
}
.node-matrix th:first-child,
.node-matrix td:first-child {
  position: sticky;
  z-index: 3;
  left: 0;
}
.node-matrix th:nth-child(2),
.node-matrix td:nth-child(2) {
  position: sticky;
  z-index: 3;
  left: 72px;
  box-shadow: 2px 0 0 #d6d0c3;
}
.node-matrix thead th:first-child,
.node-matrix thead th:nth-child(2) {
  z-index: 6;
  background: #eeebe2;
}
.node-matrix tbody td:first-child,
.node-matrix tbody td:nth-child(2) {
  background: var(--card);
}
.node-matrix tbody tr:hover td:first-child,
.node-matrix tbody tr:hover td:nth-child(2) {
  background: #f8f5ed;
}
.progress-card-section > summary {
  padding: 16px 22px;
  font-size: 12px;
}
.track-legend span {
  font-size: 11px;
}

/* Persistent horizontal control for the wide complete-progress matrix. */
.progress-floating-scroll {
  position: fixed;
  z-index: 45;
  right: clamp(24px, 4vw, 64px);
  bottom: 14px;
  left: calc(var(--sidebar) + clamp(24px, 4vw, 64px));
  display: grid;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid rgba(23, 58, 64, 0.28);
  border-radius: 8px;
  opacity: 0;
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 10px 30px rgba(24, 41, 44, 0.16);
  pointer-events: none;
  transform: translateY(calc(100% + 24px));
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  grid-template-columns: 38px auto minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(10px);
}
.progress-floating-scroll.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.progress-floating-scroll__hint {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.progress-floating-scroll__button {
  display: grid;
  width: 36px;
  height: 34px;
  color: white;
  background: var(--green);
  cursor: pointer;
  place-content: center;
  font: 24px / 1 var(--serif);
}
.progress-floating-scroll__button:hover:not(:disabled) {
  background: #0e2b30;
}
.progress-floating-scroll__button:disabled {
  color: #969b96;
  background: #e5e2d8;
  cursor: default;
}
.progress-floating-scroll__viewport {
  min-width: 0;
  height: 25px;
  overflow-x: auto;
  overflow-y: hidden;
  outline: 0;
  scrollbar-color: var(--green-2) var(--paper-deep);
  scrollbar-width: auto;
}
.progress-floating-scroll__viewport:focus-visible {
  box-shadow: 0 0 0 2px var(--amber);
}
.progress-floating-scroll__viewport::-webkit-scrollbar {
  height: 15px;
}
.progress-floating-scroll__viewport::-webkit-scrollbar-track {
  border: 1px solid #d5d0c4;
  background: var(--paper-deep);
}
.progress-floating-scroll__viewport::-webkit-scrollbar-thumb {
  min-width: 70px;
  border: 3px solid var(--paper-deep);
  background: var(--green-2);
}
.progress-floating-scroll__viewport::-webkit-scrollbar-thumb:hover {
  background: var(--green);
}
.progress-floating-scroll__spacer {
  height: 1px;
}

/* Alternate progress cards. */
.progress-row {
  min-height: 104px;
}
.progress-identity b {
  font-size: 13px;
}
.progress-identity small {
  font-size: 11px;
  line-height: 1.35;
}
.current-stage small,
.ship-cell small {
  font-size: 10px;
}
.current-stage b,
.ship-cell b {
  font-size: 13px;
}
.current-stage span {
  font-size: 11px;
}
.progress-qty strong {
  font-size: 22px;
}
.progress-qty > span {
  font-size: 11px;
}

/* Complete progress detail drawer and 53-field ledger. */
.progress-summary small {
  font-size: 11px;
}
.stage-section > header {
  min-height: 78px;
}
.stage-section h3 {
  font-size: 19px;
}
.stage-section header p {
  font-size: 11px;
}
.stage-section header > strong {
  font-size: 17px;
}
.field-ledger > div {
  min-height: 76px;
  padding: 14px 16px;
  grid-template-columns: 36px 1fr auto;
  gap: 9px;
}
.field-ledger > div > span {
  font-size: 10px;
}
.field-ledger b {
  font-size: 12px;
}
.field-ledger strong {
  font-size: 13px;
}
.field-ledger small {
  font-size: 10px;
  line-height: 1.35;
}

/* Import and document pages also display PO facts and must remain legible. */
.import-preview-table table {
  min-width: 2550px;
}
.import-preview-table th {
  padding: 11px 12px;
  font-size: 10px;
}
.import-preview-table th small {
  font-size: 9px;
}
.import-preview-table td {
  padding: 13px 12px;
  font-size: 11px;
}
.import-preview-table td b {
  font-size: 12px;
}
.import-preview-table td small {
  font-size: 10px;
}
.import-cell-input {
  height: 38px;
  font-size: 11px;
}
.import-list b {
  font-size: 12px;
}
.import-list small,
.import-list article > span {
  font-size: 10px;
}
.document-selection-list label {
  min-height: 64px;
}
.document-selection-list b {
  font-size: 12px;
}
.document-selection-list small,
.document-selection-list time {
  font-size: 10px;
}
.business-po-meta {
  font-size: 11px;
}
.detail-grid dt {
  font-size: 11px;
}
.detail-grid dd {
  font-size: 17px;
}

@media (max-width: 1180px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .progress-floating-scroll {
    right: 14px;
    bottom: 10px;
    left: 14px;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }
  .progress-floating-scroll__hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .urgent-row {
    grid-template-columns: 42px 66px minmax(0, 1fr);
    gap: 10px;
  }
  .urgent-row b {
    font-size: 13px;
  }
  .urgent-row small {
    font-size: 10px;
  }
  .table-row > span,
  .table-row b {
    font-size: 12px;
  }
  .table-row small {
    font-size: 10px;
  }
  .progress-floating-scroll {
    min-height: 46px;
    padding: 6px 8px;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 7px;
  }
  .progress-floating-scroll__button {
    width: 32px;
    height: 31px;
  }
}
