:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #dbe2ea;
  --line-strong: #cbd5e1;
  --text: #111827;
  --muted: #64748b;
  --blue: #145bd6;
  --blue-dark: #0e46ad;
  --green: #0f8a43;
  --green-bg: #e9f7ee;
  --purple: #6d28d9;
  --amber: #d97706;
  --amber-bg: #fff4df;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-dark: #b91c1c;
  --order-stage-captured-accent: #94a3b8;
  --order-stage-oc-accent: #7c3aed;
  --order-stage-cd1-accent: #4f46e5;
  --order-stage-boe-accent: #0284c7;
  --order-stage-sadc-accent: #0f766e;
  --order-stage-ready-accent: #2563eb;
  --order-stage-moving-accent: #d97706;
  --order-stage-complete-accent: #15803d;
  --order-stage-on-hold-accent: #be123c;
  --order-stage-cancelled-accent: #dc2626;
  --order-stage-parent-tint: 16%;
  --order-stage-line-tint: 7%;
  --orders-overview-link: #0e46ad;
  --on-strong: #fff;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --nav-heading: #0f172a;
  --nav-text: #253044;
  --nav-active-bg: #e8f1ff;
  --nav-active-border: #145bd6;
  --nav-active-text: #0e46ad;
  --hover-bg: #eef5ff;
  --focus-ring: rgba(20, 91, 214, 0.28);
  --avatar-bg: #e7f0ff;
  --form-label: #1f2937;
  --neutral-bg: #eef2f7;
  --neutral-text: #475569;
  --feedback-status-new-bg: #fff4df;
  --feedback-status-new-text: #b45309;
  --feedback-status-reviewing-bg: #dbeafe;
  --feedback-status-reviewing-text: #1d4ed8;
  --feedback-status-planned-bg: #eef2f7;
  --feedback-status-planned-text: #475569;
  --feedback-status-in-progress-bg: #e0e7ff;
  --feedback-status-in-progress-text: #1e3a8a;
  --feedback-status-awaiting-bg: #e0f2fe;
  --feedback-status-awaiting-text: #0369a1;
  --feedback-status-done-bg: #e9f7ee;
  --feedback-status-done-text: #166534;
  --feedback-status-reopened-bg: #f3e8ff;
  --feedback-status-reopened-text: #7e22ce;
  --feedback-status-rejected-bg: #fee2e2;
  --feedback-status-rejected-text: #b91c1c;
  --stock-total-bg: #f3f6fa;
  --warning-border: #f3c9c9;
  --warning-line: #f3d4d4;
  --warning-panel-bg: #fff7f7;
  --warning-text: #7f1d1d;
  --stock-section-bg: #eef5ff;
  --code-text: #334155;
  --login-bg: linear-gradient(180deg, #f8fafc 0%, #eef4f8 100%);
  --sticky-table-top: 64px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.table-value-line {
  display: block;
}

.warning-text {
  color: var(--warning-text, #92400e);
  font-weight: 600;
}

/* Simple operational overview */
.operational-overview {
  display: grid;
  gap: 24px;
  min-width: 0;
  max-width: 1600px;
  margin: 0 auto;
}

.operational-overview-head,
.operational-overview-section-head,
.operational-overview-panel > header,
.operational-overview-activity-card,
.operational-overview-action,
.operational-overview-action header,
.operational-overview-action footer {
  display: flex;
  align-items: center;
}

.operational-overview-head {
  justify-content: space-between;
  gap: 20px;
}

.operational-overview-head h1,
.operational-overview-section-head h2,
.operational-overview-panel h3,
.operational-overview-action h3,
.operational-overview-customer-cards h4 {
  margin: 0;
  color: var(--text);
}

.operational-overview-head h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
}

.operational-overview-head p:last-child,
.operational-overview-section-head p:last-child,
.operational-overview-panel header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.operational-overview-eyebrow,
.operational-overview-section-number {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.operational-overview-filters {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.operational-overview-filters > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.operational-overview-filters > summary::-webkit-details-marker {
  display: none;
}

.operational-overview-filters > summary > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.operational-overview-filters > summary > small {
  color: var(--muted);
  margin-right: auto;
}

.operational-overview-filters > summary > svg:last-child {
  transition: transform 160ms ease;
}

.operational-overview-filters[open] > summary > svg:last-child {
  transform: rotate(180deg);
}

.operational-overview-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 78%, var(--surface));
}

.operational-overview-filter-grid label,
.operational-overview-custom-dates label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--form-label);
  font-size: 0.78rem;
  font-weight: 700;
}

.operational-overview-filter-grid select,
.operational-overview-filter-grid input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}

.operational-overview-custom-dates {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
}

.operational-overview-custom-dates.is-hidden {
  display: none;
}

.operational-overview-search {
  grid-column: span 2;
}

.operational-overview-search-control {
  position: relative;
  display: block;
}

.operational-overview-search-control svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
}

.operational-overview-search-control input {
  padding-left: 38px;
}

.operational-overview-toggle {
  grid-column: span 2;
}

.operational-overview-filter-grid .operational-overview-toggle {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 10px;
  min-height: 40px;
  color: var(--form-label);
  font-size: 0.78rem;
  font-weight: 700;
}

.operational-overview-filter-grid .operational-overview-toggle input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--blue);
}

.operational-overview-filter-grid .operational-overview-toggle small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.operational-overview-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  min-width: max-content;
}

.operational-overview-filter-actions .htmx-indicator {
  align-self: center;
  color: var(--muted);
  font-size: 0.8rem;
}

#operational-overview-results {
  display: grid;
  gap: 28px;
  min-width: 0;
}

.operational-overview-notice {
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--line));
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--text);
}

.operational-overview-sync {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.operational-overview-sync p {
  margin: 0;
}

.operational-overview-sync p + p {
  margin-top: 6px;
}

.superuser-attention-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.superuser-attention-card {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.superuser-attention-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.superuser-attention-card h3,
.superuser-attention-card p {
  margin: 0;
}

.superuser-attention-card p {
  color: var(--muted);
}

.operational-checks-panel {
  overflow: hidden;
}

.daily-control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  scroll-margin-top: 88px;
}

.daily-control-strip-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.daily-control-strip-copy span {
  color: var(--muted);
  font-size: 0.86rem;
}

.operational-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
  padding: 16px;
}

.operational-check-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.operational-check-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.operational-check-card h3,
.operational-check-card p {
  margin: 0;
}

.operational-check-card p {
  color: var(--muted);
}

.operational-check-card-actions {
  justify-content: flex-start;
  margin-top: auto;
  gap: 8px;
}

.attention-management-panel {
  box-shadow: none;
}

.attention-management-list {
  display: grid;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.attention-management-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 12px 18px;
  min-width: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.attention-management-row:first-child {
  border-top: 0;
}

.attention-management-row h3,
.attention-management-row p {
  margin: 0;
}

.attention-management-row .page-actions {
  justify-content: flex-start;
}

.attention-management-row .operational-overview-sync {
  padding: 0;
  border: 0;
}

.attention-management-row .operational-overview-sync,
.attention-management-row .operational-overview-sync form {
  display: grid;
  gap: 8px;
}

@media (max-width: 900px) {
  .superuser-attention-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .daily-control-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .daily-control-strip .page-actions {
    justify-content: flex-start;
  }

  .operational-check-grid {
    padding: 12px;
  }

  .attention-management-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

.operational-overview-notice-error {
  border-color: var(--warning-border);
  background: var(--warning-panel-bg);
  color: var(--warning-text);
}

.action-note {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--line));
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--text);
}

.action-note p {
  margin: 0;
}

.operational-overview-notice p {
  margin: 0;
}

.operational-overview-notice p + p {
  margin-top: 6px;
}

.operational-overview-freshness {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.operational-overview-freshness-item {
  position: relative;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 11px 14px 11px 20px;
  color: var(--text);
  text-decoration: none;
}

.operational-overview-freshness-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--green);
  content: "";
}

.operational-overview-freshness-item.is-missing::before {
  background: var(--amber);
}

.operational-overview-freshness-item + .operational-overview-freshness-item {
  border-left: 1px solid var(--line);
}

.operational-overview-freshness-item span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.operational-overview-freshness-item strong {
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-overview-section {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.operational-overview-section + .operational-overview-section {
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.operational-overview-section-head,
.operational-overview-panel > header {
  justify-content: space-between;
  gap: 20px;
}

.operational-overview-section-head h2 {
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  letter-spacing: -0.025em;
}

.operational-overview-section-head > a,
.operational-overview-panel > header a,
.operational-overview-action footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.operational-overview-section-head a svg,
.operational-overview-panel header a svg,
.operational-overview-action footer a svg {
  width: 15px;
  height: 15px;
}

.operational-overview-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.operational-overview-kpi,
.operational-overview-panel,
.operational-overview-activity-card,
.operational-overview-action {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.operational-overview-kpi {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 138px;
  padding: 18px;
}

.operational-overview-kpi > span,
.operational-overview-activity-card > div:last-child > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.operational-overview-kpi > strong {
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.05;
  text-overflow: ellipsis;
}

.operational-overview-kpi > small,
.operational-overview-activity-card small {
  color: var(--muted);
}

.operational-overview-progress {
  height: 6px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--neutral-bg);
}

.operational-overview-progress span {
  display: block;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.operational-overview-activity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.operational-overview-activity-card {
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
}

.operational-overview-card-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.operational-overview-card-icon svg {
  width: 19px;
  height: 19px;
}

.operational-overview-activity-card > div:last-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.operational-overview-activity-card strong {
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1.1;
}

.operational-overview-activity-card strong small {
  font-size: 0.72rem;
  font-weight: 650;
}

.operational-overview-activity-card p {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.operational-overview-panel {
  min-width: 0;
  overflow: hidden;
}

.operational-overview-panel > header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.operational-overview-panel h3 {
  font-size: 1rem;
}

.operational-overview-panel header p {
  font-size: 0.82rem;
}

.operational-overview-trend-legend {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 10px 18px 0;
  color: var(--muted);
  font-size: 0.72rem;
}

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

.operational-overview-trend-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.operational-overview-trend-legend .is-current,
.operational-overview-trend-bars .is-current {
  background: var(--blue);
}

.operational-overview-trend-legend .is-previous,
.operational-overview-trend-bars .is-previous {
  background: color-mix(in srgb, var(--blue) 28%, var(--surface));
}

.operational-overview-trend {
  display: flex;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
  height: 225px;
  padding: 14px 18px 18px;
}

.operational-overview-trend-point {
  display: grid;
  flex: 1 1 0;
  grid-template-rows: 1fr auto;
  gap: 7px;
  min-width: 8px;
}

.operational-overview-trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.operational-overview-trend-bars span {
  width: min(44%, 18px);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
}

.operational-overview-trend-point small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-overview-customer-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.operational-overview-customer-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.operational-overview-customer-table th,
.operational-overview-customer-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.operational-overview-customer-table thead th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.operational-overview-customer-table th:first-child,
.operational-overview-customer-table td:first-child {
  text-align: left;
}

.operational-overview-customer-table tbody tr:last-child th,
.operational-overview-customer-table tbody tr:last-child td {
  border-bottom: 0;
}

.operational-overview-customer-table a,
.operational-overview-customer-cards a {
  color: var(--blue);
  text-decoration: none;
}

.operational-overview-count-alert {
  display: inline-grid;
  min-width: 25px;
  min-height: 25px;
  place-items: center;
  border-radius: 999px;
  color: var(--red-dark);
  background: var(--red-bg);
  font-weight: 800;
}

.operational-overview-customer-cards {
  display: none;
}

.operational-overview-action-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.operational-overview-action-summary > a,
.operational-overview-action-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.operational-overview-action-summary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-overview-action-summary strong {
  font-size: 1.2rem;
}

.operational-overview-actions {
  display: grid;
  gap: 9px;
}

.operational-overview-action {
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
}

.operational-overview-action-priority {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  color: var(--on-strong);
  background: var(--red-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

.operational-overview-action.is-rank-2 .operational-overview-action-priority,
.operational-overview-action.is-rank-3 .operational-overview-action-priority {
  color: #111827;
  background: var(--amber);
}

.operational-overview-action.is-rank-4 .operational-overview-action-priority,
.operational-overview-action.is-rank-5 .operational-overview-action-priority {
  background: var(--purple);
}

.operational-overview-action-main {
  display: grid;
  flex: 1 1 auto;
  gap: 9px;
  min-width: 0;
  padding: 13px 15px;
}

.operational-overview-action header {
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.operational-overview-action h3 {
  font-size: 0.95rem;
}

.operational-overview-action header span,
.operational-overview-action footer {
  color: var(--muted);
  font-size: 0.76rem;
}

.operational-overview-action header > strong {
  white-space: nowrap;
}

.operational-overview-action header > div {
  min-width: 0;
}

.operational-overview-action h3,
.operational-overview-action header span {
  overflow-wrap: anywhere;
}

.operational-overview-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.operational-overview-reasons span {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--red-dark);
  background: var(--red-bg);
  font-size: 0.72rem;
  font-weight: 700;
}

.operational-overview-action footer {
  flex-wrap: wrap;
  gap: 8px 18px;
}

.operational-overview-action footer span,
.operational-overview-action footer a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.operational-overview-action footer a {
  margin-left: auto;
}

.operational-overview-action footer svg {
  width: 14px;
  height: 14px;
}

.operational-overview-empty {
  margin: 0;
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.operational-overview-empty-action,
.operational-overview-empty-all {
  display: grid;
  justify-items: center;
  gap: 7px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.operational-overview-empty svg {
  width: 26px;
  height: 26px;
  color: var(--green);
}

.operational-overview-empty strong {
  color: var(--text);
}

@media (max-width: 1120px) {
  .operational-overview-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .operational-overview-action-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .operational-overview {
    gap: 18px;
  }

  .operational-overview-filter-grid,
  .operational-overview-activity-grid {
    grid-template-columns: 1fr;
  }

  .operational-overview-search,
  .operational-overview-custom-dates,
  .operational-overview-toggle {
    grid-column: auto;
  }

  .operational-overview-freshness {
    grid-template-columns: 1fr;
  }

  .operational-overview-freshness-item + .operational-overview-freshness-item {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .operational-overview-customer-table-wrap {
    display: none;
  }

  .operational-overview-customer-cards {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .operational-overview-customer-cards article {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
  }

  .operational-overview-customer-cards header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .operational-overview-customer-cards header span {
    color: var(--muted);
    font-size: 0.72rem;
    text-align: right;
  }

  .operational-overview-customer-cards dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 12px 0 0;
  }

  .operational-overview-customer-cards dl div {
    display: grid;
    gap: 2px;
  }

  .operational-overview-customer-cards dt {
    color: var(--muted);
    font-size: 0.7rem;
  }

  .operational-overview-customer-cards dd {
    margin: 0;
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 750;
  }
}

@media (max-width: 560px) {
  .operational-overview-head {
    align-items: flex-start;
  }

  .operational-overview-head .btn {
    padding-inline: 10px;
  }

  .operational-overview-filters > summary {
    flex-wrap: wrap;
  }

  .operational-overview-filters > summary > small {
    flex: 1 0 100%;
    order: 3;
    padding-left: 28px;
  }

  .operational-overview-custom-dates,
  .operational-overview-kpi-grid,
  .operational-overview-action-summary {
    grid-template-columns: 1fr;
  }

  .operational-overview-filter-actions {
    align-items: center;
    min-width: 0;
  }

  .operational-overview-section-head,
  .operational-overview-panel > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .operational-overview-kpi {
    min-height: 0;
  }

  .operational-overview-trend {
    gap: 3px;
    height: 190px;
    padding-inline: 10px;
  }

  .operational-overview-trend-point small {
    writing-mode: vertical-rl;
  }

  .operational-overview-action {
    align-items: stretch;
  }

  .operational-overview-action-priority {
    flex-basis: 32px;
  }

  .operational-overview-action header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .operational-overview-action footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .operational-overview-action footer a {
    margin-left: 0;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #1f2937;
  --line: #334155;
  --line-strong: #475569;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --blue: #60a5fa;
  --blue-dark: #93c5fd;
  --green: #4ade80;
  --green-bg: #06351f;
  --purple: #c4b5fd;
  --amber: #fbbf24;
  --amber-bg: #3a2705;
  --red: #f87171;
  --red-bg: #3b1117;
  --red-dark: #fca5a5;
  --order-stage-captured-accent: #94a3b8;
  --order-stage-oc-accent: #c4b5fd;
  --order-stage-cd1-accent: #a5b4fc;
  --order-stage-boe-accent: #7dd3fc;
  --order-stage-sadc-accent: #5eead4;
  --order-stage-ready-accent: #93c5fd;
  --order-stage-moving-accent: #fbbf24;
  --order-stage-complete-accent: #4ade80;
  --order-stage-on-hold-accent: #fb7185;
  --order-stage-cancelled-accent: #f87171;
  --order-stage-parent-tint: 24%;
  --order-stage-line-tint: 12%;
  --orders-overview-link: #bfdbfe;
  --topbar-bg: rgba(17, 24, 39, 0.92);
  --nav-heading: #e5e7eb;
  --nav-text: #d1d5db;
  --nav-active-bg: rgba(96, 165, 250, 0.2);
  --nav-active-border: #60a5fa;
  --nav-active-text: #bfdbfe;
  --hover-bg: rgba(96, 165, 250, 0.14);
  --focus-ring: rgba(96, 165, 250, 0.36);
  --avatar-bg: #172554;
  --form-label: #d1d5db;
  --neutral-bg: #1e293b;
  --neutral-text: #cbd5e1;
  --feedback-status-new-bg: #3a2705;
  --feedback-status-new-text: #fbbf24;
  --feedback-status-reviewing-bg: #1e3a8a;
  --feedback-status-reviewing-text: #dbeafe;
  --feedback-status-planned-bg: #1e293b;
  --feedback-status-planned-text: #cbd5e1;
  --feedback-status-in-progress-bg: #172554;
  --feedback-status-in-progress-text: #dbeafe;
  --feedback-status-awaiting-bg: #0c4a6e;
  --feedback-status-awaiting-text: #e0f2fe;
  --feedback-status-done-bg: #06351f;
  --feedback-status-done-text: #4ade80;
  --feedback-status-reopened-bg: #581c87;
  --feedback-status-reopened-text: #f3e8ff;
  --feedback-status-rejected-bg: #3b1117;
  --feedback-status-rejected-text: #f87171;
  --stock-total-bg: #1e293b;
  --warning-border: #7f1d1d;
  --warning-line: #7f1d1d;
  --warning-panel-bg: #2f1215;
  --warning-text: #fecaca;
  --stock-section-bg: #172554;
  --code-text: #cbd5e1;
  --login-bg: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 12px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--blue-dark);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: clip;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  background: var(--surface);
  scrollbar-gutter: stable;
}

.brand-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 96px;
  padding: 0 14px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 8px;
  padding: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand span {
  display: none;
}

.brand-logo-wide {
  display: block;
  width: 150px;
  max-width: 100%;
  height: auto;
}

.brand-logo-icon {
  display: none;
  width: 36px;
  height: 36px;
}

.sidebar-toggle {
  flex: 0 0 38px;
}

.nav-stack {
  display: grid;
  gap: 16px;
  padding: 12px 12px 16px;
}

.nav-search {
  display: grid;
  gap: 8px;
}

.nav-search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search-field > svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.nav-search input {
  width: 100%;
  min-height: 38px;
  padding: 8px 42px 8px 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.nav-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

.nav-search-clear {
  position: absolute;
  right: 4px;
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.nav-search-clear[hidden],
.nav-search-empty[hidden] {
  display: none;
}

.nav-search-empty {
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-tree-controls {
  display: flex;
  gap: 6px;
}

.nav-tree-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  gap: 5px;
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.nav-tree-control:hover:not(:disabled),
.nav-tree-control:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.nav-tree-control:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

.nav-tree-control:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.nav-tree-control svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.nav-tree-control span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-section,
.nav-subsections,
.nav-subgroup {
  display: grid;
}

.nav-section {
  gap: 8px;
}

.nav-subsections {
  gap: 12px;
}

.nav-subgroup {
  gap: 4px;
}

.nav-subgroup-links {
  display: grid;
  gap: 4px;
}

.nav-link-row {
  display: flex;
  align-items: center;
  min-width: 0;
  border-radius: 6px;
}

.nav-link-row .nav-link {
  min-width: 0;
  flex: 1 1 auto;
}

.nav-link-row .nav-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link-row.is-active {
  background: var(--nav-active-bg);
}

.nav-pin-form {
  display: flex;
  flex: 0 0 auto;
  margin-left: -38px;
  padding-right: 5px;
  opacity: 0;
  pointer-events: none;
  position: relative;
  transition: opacity 0.14s ease;
  z-index: 1;
}

.nav-link-row:hover .nav-pin-form,
.nav-link-row:focus-within .nav-pin-form {
  opacity: 1;
  pointer-events: auto;
}

.nav-pin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nav-pin-button:hover,
.nav-pin-button:focus-visible,
.nav-pin-button.is-pinned {
  color: var(--blue);
}

.nav-pin-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.nav-pin-button svg {
  width: 15px;
  height: 15px;
}

.nav-pinned-empty {
  margin: 0;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav-pinned-empty[hidden] {
  display: none;
}

.nav-pinned-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-pinned-edit {
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.nav-pin-reorder-form {
  display: none;
  gap: 2px;
}

.nav-section.is-editing .nav-pin-reorder-form {
  display: inline-flex;
}

.nav-pin-reorder-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.nav-pin-reorder-form button:disabled {
  color: var(--muted);
  cursor: default;
  opacity: .5;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--nav-heading);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-group-toggle svg {
  color: var(--blue);
}

.nav-group-toggle:hover {
  background: var(--hover-bg);
  color: var(--blue);
}

.nav-group-toggle.is-active {
  background: var(--nav-active-bg);
  box-shadow: inset 3px 0 0 var(--nav-active-border);
  color: var(--nav-active-text);
}

.nav-group-toggle span {
  flex: 1;
  text-align: left;
}

.nav-group-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.nav-section.is-collapsed .nav-subsections {
  display: none;
}

.nav-section.is-collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-subgroup-heading {
  margin: 0;
}

.nav-subgroup-toggle,
.nav-subgroup-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 6px 2px;
  padding: 7px 8px 6px;
  border-top: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  width: calc(100% - 12px);
  background: transparent;
  color: var(--nav-heading);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
}

.nav-subgroup-empty {
  cursor: default;
}

.nav-subgroup:first-child .nav-subgroup-toggle,
.nav-subgroup:first-child .nav-subgroup-empty {
  margin-top: 0;
  border-top: 0;
}

.nav-subgroup-toggle::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: var(--line);
  flex: 0 0 auto;
}

.nav-subgroup-toggle:hover {
  color: var(--blue);
}

.nav-subgroup-toggle.is-active {
  color: var(--nav-active-text);
}

.nav-subgroup-toggle.is-active::before {
  background: var(--nav-active-border);
}

.nav-subgroup-toggle span {
  flex: 1;
  min-width: 0;
}

.nav-subgroup-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.nav-subgroup.is-collapsed .nav-subgroup-links {
  display: none;
}

.nav-subgroup.is-collapsed .nav-subgroup-chevron {
  transform: rotate(-90deg);
}

.nav-stack a,
.quick-upload a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border-left: 3px solid transparent;
  border-radius: 6px;
  color: var(--nav-text);
  font-size: 13px;
  font-weight: 600;
}

.nav-stack button.nav-ferro-link {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--nav-text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.nav-stack button.nav-ferro-link:hover,
.nav-stack button.nav-ferro-link:focus-visible {
  background: var(--hover-bg);
  color: var(--blue);
}

.nav-stack a:hover,
.quick-upload a:hover {
  background: var(--hover-bg);
  color: var(--blue);
}

.nav-stack a.is-active,
.quick-upload a.is-active {
  background: var(--nav-active-bg);
  border-left-color: var(--nav-active-border);
  color: var(--nav-active-text);
  font-weight: 800;
}

.nav-stack a.is-active svg,
.quick-upload a.is-active svg {
  color: var(--nav-active-border);
}

.nav-group-toggle:focus-visible,
.nav-subgroup-toggle:focus-visible,
.nav-stack a:focus-visible,
.quick-upload a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.quick-upload {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.quick-upload p {
  margin: 10px 4px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.quick-upload-panel {
  padding: 0;
  overflow: hidden;
}

.quick-upload-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 800;
}

.quick-upload-details summary::-webkit-details-marker {
  display: none;
}

.quick-upload-details summary span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.quick-upload-details summary svg:last-child {
  color: var(--muted);
  transition: transform 0.16s ease;
}

.quick-upload-details[open] summary svg:last-child {
  transform: rotate(180deg);
}

.quick-upload-list {
  display: grid;
  gap: 4px;
  padding: 0 10px 12px;
}

.quick-upload-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.quick-upload-list a:hover {
  background: var(--hover-bg);
  color: var(--blue);
}

.quick-upload-list a:focus-visible,
.quick-upload-details summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-foot span:last-child {
  flex: 0 0 auto;
  font-weight: 700;
}

.sidebar-collapsed .brand-row {
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 12px 8px;
}

.sidebar-collapsed .brand {
  justify-content: center;
  flex: 0 0 auto;
  font-size: 0;
}

.sidebar-collapsed .brand-logo-wide,
.sidebar-collapsed .nav-group-toggle span,
.sidebar-collapsed .nav-group-chevron,
.sidebar-collapsed .nav-tree-controls,
.sidebar-collapsed .nav-subgroup-heading,
.sidebar-collapsed .sidebar-foot {
  display: none;
}

.sidebar-collapsed .brand-logo-icon {
  display: block;
}

.sidebar-collapsed .nav-stack {
  gap: 10px;
  padding: 10px 12px 14px;
}

.sidebar-collapsed .nav-search {
  display: none;
}

.sidebar-collapsed .nav-pin-form,
.sidebar-collapsed .nav-pinned-empty {
  display: none;
}

.sidebar-collapsed .nav-section,
.sidebar-collapsed .nav-subsections,
.sidebar-collapsed .nav-subgroup,
.sidebar-collapsed .nav-subgroup-links {
  gap: 4px;
}

.sidebar-collapsed .nav-subgroup.is-collapsed .nav-subgroup-links {
  display: grid;
}

.sidebar-collapsed .nav-group-toggle {
  justify-content: center;
  min-height: 36px;
  padding: 8px;
}

.sidebar-collapsed .nav-stack a,
.sidebar-collapsed .quick-upload a {
  justify-content: center;
  padding: 10px;
  font-size: 0;
}

.sidebar-collapsed .nav-group-toggle.is-active,
.sidebar-collapsed .nav-stack a.is-active,
.sidebar-collapsed .quick-upload a.is-active {
  box-shadow: inset 0 -3px 0 var(--nav-active-border);
  border-left-color: transparent;
}

.main-shell {
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
}

.top-field {
  display: grid;
  flex: 0 1 240px;
  min-width: 180px;
  gap: 2px;
}

.top-field span {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.top-field strong {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.language-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.language-form select {
  min-height: 38px;
  width: 112px;
  padding: 8px 9px;
  font-size: 13px;
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  flex: 0 0 38px;
}

.active-users-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 50px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.active-users-pill:hover,
.active-users-pill:focus-visible {
  border-color: var(--green);
  color: var(--green);
}

.feedback-updates-pill,
.personal-reminders-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 50px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.feedback-updates-pill.has-updates,
.personal-reminders-pill.has-due {
  border-color: var(--amber);
  background: var(--amber-bg);
  color: var(--amber);
}

.feedback-updates-pill:hover,
.feedback-updates-pill:focus-visible,
.personal-reminders-pill:hover,
.personal-reminders-pill:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.feedback-updates-count,
.personal-reminders-count {
  min-width: 1.2em;
  text-align: center;
}

.active-users-count {
  min-width: 1.2em;
  text-align: center;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 38px;
  max-width: 200px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

.user-pill:hover {
  border-color: var(--blue);
  color: var(--text);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.user-copy {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.user-copy strong,
.user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  font-size: 13px;
}

.user-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.content {
  padding: 22px;
}

.breadcrumbs {
  margin: 0 0 14px;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.breadcrumb-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 2px;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin: 0 4px 0 0;
  color: var(--line-strong);
  font-weight: 700;
}

.breadcrumb-link,
.breadcrumb-current {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 220px;
  overflow: hidden;
  padding: 3px 2px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-link:hover {
  color: var(--blue);
}

.breadcrumb-current {
  color: var(--text);
}

.breadcrumb-menu {
  position: relative;
}

.breadcrumb-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.breadcrumb-menu summary::-webkit-details-marker {
  display: none;
}

.breadcrumb-menu summary:hover,
.breadcrumb-menu[open] summary {
  border-color: var(--line);
  background: var(--hover-bg);
  color: var(--blue);
}

.breadcrumb-menu summary svg {
  width: 14px;
  height: 14px;
}

.breadcrumb-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 70;
  display: grid;
  min-width: 190px;
  max-width: min(280px, calc(100vw - 44px));
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.breadcrumb-item:last-child .breadcrumb-menu-list {
  right: 0;
  left: auto;
}

.breadcrumb-menu-list a {
  display: block;
  overflow: hidden;
  padding: 7px 8px;
  border-radius: 5px;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-menu-list a:hover {
  background: var(--hover-bg);
  color: var(--blue);
}

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

.page-head h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.help-panel {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.help-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.help-panel summary::-webkit-details-marker {
  display: none;
}

.help-panel summary span,
.help-panel summary small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.help-panel summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.help-panel svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.help-panel .help-panel-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.help-panel[open] > summary .help-panel-chevron {
  transform: rotate(180deg);
}

.help-content {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}

.help-content h2 {
  margin: 14px 0 6px;
  font-size: 14px;
}

.help-content p {
  margin: 6px 0 0;
  color: var(--muted);
}

.help-status-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 12px;
  margin: 8px 0 0;
}

.help-status-list dt {
  font-weight: 800;
}

.help-status-list dd {
  margin: 0;
  color: var(--muted);
}

.diagnostic-resolution-checklist {
  grid-column: 1 / -1;
}

.diagnostic-resolution-checklist ol {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.diagnostic-action-cell {
  min-width: 320px;
}

.diagnostic-action-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.diagnostic-action-card p {
  margin: 0;
  color: var(--muted);
}

.diagnostic-action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.copyable-evidence-request-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.copyable-evidence-request {
  width: 100%;
  min-height: 106px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px;
}

.ai-intake-next-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 10px;
}

.ai-intake-next-action .section-help {
  flex: 1 1 260px;
  margin: 0;
}

.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn {
  padding: 8px 14px;
}

.icon-btn {
  width: 38px;
  padding: 0;
}

.btn-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--on-strong);
}

.btn-primary:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: var(--on-strong);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn.is-success {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--green);
}

.btn-danger {
  border-color: var(--red);
  background: var(--red);
  color: var(--on-strong);
}

.btn-danger:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
  color: var(--on-strong);
}

.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.impersonation-banner {
  position: sticky;
  z-index: 1200;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 3px solid var(--red);
  background: var(--red-bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.impersonation-banner > div {
  display: grid;
  gap: 2px;
}

.impersonation-banner form {
  margin: 0;
}

.impersonation-audit-panel {
  margin-top: 18px;
}

.impersonation-start-panel {
  display: grid;
  gap: 18px;
}

@media (max-width: 720px) {
  .impersonation-banner {
    position: relative;
    align-items: stretch;
    flex-direction: column;
  }

  .impersonation-banner .btn {
    width: 100%;
  }
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.action-cell {
  text-align: center;
}

.table-actions {
  min-width: 220px;
}

.report-row-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.row-action-menu {
  display: inline-grid;
  gap: 0;
  justify-items: start;
}

.row-action-menu summary {
  list-style: none;
  cursor: pointer;
}

.row-action-menu summary::-webkit-details-marker {
  display: none;
}

.row-action-menu-panel,
.row-action-menu > form,
.row-action-menu-floating-panel {
  display: grid;
  gap: 8px;
  min-width: 150px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin-top: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.38);
  z-index: 900;
}

.row-action-menu-floating-panel {
  position: fixed;
}

.document-action-menu-panel {
  min-width: 190px;
}

.row-action-menu-panel form {
  display: grid;
  margin: 0;
}

.row-action-menu-panel .btn,
.row-action-menu > form .btn,
.row-action-menu-floating-panel .btn {
  width: 100%;
  justify-content: flex-start;
}

.row-action-menu-panel button.btn,
.row-action-menu > form button.btn,
.row-action-menu-floating-panel button.btn {
  text-align: left;
}

.document-action-menu {
  justify-items: center;
}

.document-action-menu .row-action-menu-panel {
  min-width: 190px;
}

.follow-up-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.follow-up-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.follow-up-state small {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.follow-up-menu {
  align-items: start;
}

.follow-up-menu-panel {
  min-width: 240px;
}

.follow-up-form {
  min-width: 220px;
}

.follow-up-form label {
  display: grid;
  gap: 5px;
  color: var(--form-label);
  font-size: 12px;
  font-weight: 800;
}

.follow-up-form select,
.follow-up-form input,
.follow-up-form textarea {
  width: 100%;
}

.follow-up-note textarea {
  min-height: 72px;
}

.task-create-panel {
  margin-bottom: 16px;
}

.task-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 16px;
}

.task-field-wide {
  grid-column: 1 / -1;
}

.task-board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.task-calendar-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.task-calendar-day {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.task-calendar-day.is-today {
  border-color: var(--accent);
}

.task-calendar-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.task-calendar-date h2 {
  margin: 0;
  font-size: 14px;
}

.task-calendar-subhead {
  margin: 12px 14px 8px;
  font-size: 13px;
}

.task-calendar-date span {
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--hover-bg);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.task-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.task-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.task-column-head h2 {
  margin: 0;
  font-size: 14px;
}

.task-column-head span {
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--hover-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.task-card-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
}

.task-column-scroll .task-card-list {
  max-height: min(68vh, 720px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.task-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: var(--surface-strong);
}

.task-card-overdue {
  border-left-color: var(--danger);
}

.task-card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.task-card-title a {
  min-width: 0;
  color: var(--text);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.task-card dl {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 4px 8px;
  margin: 0;
  font-size: 12px;
}

.task-card dt {
  color: var(--muted);
  font-weight: 800;
}

.task-card dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.reminder-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.reminder-card {
  border-left: 4px solid var(--blue);
}

.reminder-card-due,
.reminder-alert {
  border-left: 4px solid var(--red);
}

.global-reminder-alert {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--warning-border);
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: var(--warning-panel-bg);
  color: var(--warning-text);
}

.global-reminder-alert svg {
  width: 18px;
  height: 18px;
}

.global-reminder-alert a {
  margin-left: auto;
  font-weight: 900;
}

.reminder-channel-note {
  border-left: 4px solid var(--amber);
}

.reminder-meta {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 5px 10px;
  margin: 0;
}

.reminder-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.reminder-actions,
.reminder-snooze-form,
.tab-links {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.reminder-actions {
  justify-content: space-between;
}

.reminder-snooze-form label {
  min-width: 150px;
}

.audit-history ul,
.reminder-alert ul {
  margin-bottom: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 18px;
}

.dashboard-grid-summary-only {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-main,
.dashboard-rail {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

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

.kpi {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi svg {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.kpi span {
  min-height: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi strong {
  font-size: 24px;
  line-height: 1.1;
}

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

.kpi-link {
  color: var(--text);
  text-decoration: none;
}

.kpi-link:hover {
  border-color: var(--blue);
  color: var(--text);
}

.kpi-warning svg {
  color: var(--amber);
}

.executive-loading-panel {
  overflow: hidden;
}

.executive-loading-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.executive-loading-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.executive-loading-title h2 {
  margin: 0;
  font-size: 20px;
}

.executive-loading-title span,
.executive-loading-head p {
  color: var(--muted);
  font-size: 12px;
}

.executive-loading-head p {
  margin: 4px 0 0;
}

.executive-loading-head > a {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  font-size: 13px;
  font-weight: 800;
}

.executive-loading-head > a svg {
  width: 15px;
  height: 15px;
}

.executive-loading-cards {
  display: grid;
  /* auto-fit collapses at every width without needing a media-query entry, and it
     absorbs the fourth "Other commodities" card without leaving an orphan row. */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px 20px 4px;
}

.executive-loading-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.executive-loading-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.executive-loading-card-head svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.executive-loading-card-head h3 {
  min-width: 0;
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.executive-loading-card-head strong {
  margin-left: auto;
  font-size: 14px;
  white-space: nowrap;
}

.executive-loading-month {
  display: grid;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.executive-loading-month:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.executive-loading-month-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

a.executive-loading-month-link:hover {
  color: var(--blue);
}

.executive-loading-month-link small {
  color: var(--muted);
  font-weight: 800;
}

.executive-loading-month-link strong {
  margin-left: auto;
  font-size: 14px;
  white-space: nowrap;
}

.executive-loading-month-link svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.executive-loading-month-after {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

.executive-loading-month-after svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.executive-loading-note {
  margin: 0;
  padding: 0 20px 16px;
  color: var(--muted);
  font-size: 12px;
}

.executive-loading-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.executive-loading-tags a,
.executive-loading-tags span {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-radius: 4px;
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.executive-loading-tags .executive-loading-tag-after {
  border-color: color-mix(in srgb, var(--amber) 30%, var(--line));
  background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  color: var(--amber);
}

.executive-loading-empty {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 22px 20px;
}

.executive-loading-empty svg {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.executive-loading-empty h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.executive-loading-empty p {
  margin: 0;
  color: var(--muted);
}

.action-panel {
  overflow: hidden;
}

.action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
}

.action-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

.action-card:hover {
  border-color: var(--blue);
  color: var(--text);
}

.action-card svg {
  width: 24px;
  height: 24px;
  color: var(--blue);
}

.action-card span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.action-card strong,
.action-card small {
  overflow-wrap: anywhere;
}

.action-card strong {
  font-size: 13px;
}

.action-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.action-card em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 3;
  grid-row: 1;
  min-width: 34px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-style: normal;
  font-weight: 900;
}

.action-owner {
  color: var(--text) !important;
  font-weight: 600;
}

.action-card-actions {
  grid-column: 2 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-card-actions .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.action-high {
  border-color: var(--warning-border);
  background: var(--warning-panel-bg);
}

.action-high svg,
.action-high em {
  color: var(--red-dark);
}

.action-medium svg,
.action-medium em {
  color: var(--amber);
}

.action-clear svg,
.action-clear em {
  color: var(--green);
}

.report-workbench {
  display: grid;
  gap: 16px;
}

.report-workbench-actions {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.report-export-form {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.report-export-form .form-grid {
  max-width: 760px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.narrow-panel {
  max-width: 760px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
}

.missing-documents-report-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.missing-documents-report-heading small,
.missing-documents-rules .panel-head small {
  color: var(--muted);
  font-size: 12px;
}

.missing-documents-rules .panel-head > div {
  display: grid;
  gap: 3px;
}

.missing-documents-rules .definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.missing-documents-rules .definition-list > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.missing-documents-rules .definition-list > div:nth-child(even) {
  border-right: 0;
}

.missing-documents-rules .definition-list > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.missing-documents-rules .definition-list strong {
  font-size: 12px;
}

.missing-documents-rules .definition-list span {
  color: var(--muted);
  line-height: 1.45;
}

.missing-documents-table {
  min-width: 1120px;
  table-layout: fixed;
}

.missing-documents-lane-column {
  width: 12%;
}

.missing-documents-due-column,
.missing-documents-status-column,
.missing-documents-received-column {
  width: 6%;
}

.missing-documents-upload-column {
  width: 13%;
}

.missing-documents-detail-column {
  width: 19%;
}

.missing-documents-table .missing-documents-detail {
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 640px) {
  .missing-documents-report-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .missing-documents-rules .definition-list {
    grid-template-columns: 1fr;
  }

  .missing-documents-rules .definition-list > div,
  .missing-documents-rules .definition-list > div:nth-child(even) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .missing-documents-rules .definition-list > div:last-child {
    border-bottom: 0;
  }
}

.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 18px 18px;
}

.tabs {
  display: flex;
  gap: 22px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  display: flex;
  align-items: center;
  min-height: 54px;
  border-bottom: 2px solid transparent;
  color: var(--nav-text);
  font-weight: 700;
}

.tabs a.active {
  border-color: var(--blue);
  color: var(--blue);
}

.table-tools {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
}

.table-tools > label:not(.search) {
  display: grid;
  gap: 5px;
  min-width: 180px;
  color: var(--form-label);
  font-size: 12px;
  font-weight: 800;
}

.table-tools .btn {
  min-height: 40px;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.search {
  position: relative;
  flex: 1;
  min-width: min(100%, 260px);
}

.search svg {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--muted);
}

.search input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px 9px 40px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font: inherit;
}

.table-filter-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.table-tools + .table-filter-toolbar {
  border-top: 0;
  padding-top: 0;
}

/* Controls mounted inside the page filter row, beside Filter and Reset. */
.table-filter-mount {
  margin-left: auto;
}

.table-filter-toolbar-inline {
  align-self: flex-end;
  /* Must stay shrinkable: a fixed basis here pushes the control onto a second row on
     narrower desktops, which is the layout OPS rejected. */
  flex: 0 1 auto;
  min-width: 0;
  /* Flex line-breaking measures this item at its max-content width, and the count string is
     wide enough to push it onto a second row. Capping it keeps the control beside Filter and
     Reset on narrower desktops; the count wraps inside instead. */
  max-width: 260px;
  min-height: 40px;
  padding: 0;
  border-top: 0;
  background: transparent;
}

.table-filter-toolbar-inline .table-filter-compact-form {
  flex-wrap: wrap;
  justify-content: flex-end;
  width: auto;
  min-width: 0;
}

/* The standalone toolbar keeps the count on one line, but inline the count's nowrap width
   is what decides whether the whole control fits beside Filter and Reset. */
.table-filter-toolbar-inline .table-filter-count {
  white-space: normal;
}

.table-filter-toolbar-inline.has-expanded-filters .table-filter-compact-form {
  flex-wrap: wrap;
}

.table-filter-compact-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.table-filter-toggle[aria-expanded="true"],
.table-filter-toolbar.has-active-filters .table-filter-toggle {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.table-filter-global {
  position: relative;
  flex: 1;
  min-width: min(100%, 240px);
  max-width: 420px;
}

.table-filter-global svg {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--muted);
}

.table-filter-global input {
  width: 100%;
  min-height: 38px;
  padding-left: 40px;
}

.table-filter-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.table-filter-toolbar.has-active-filters .table-filter-count {
  color: var(--blue);
}

.table-column-filter-row th {
  padding: 6px 6px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.table-column-filter {
  display: block;
  min-width: 0;
}

.table-column-filter input {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 4px;
  font-size: 12px;
}

.column-preferences {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.column-preferences[hidden] {
  display: none;
}

.column-is-hidden {
  display: none;
}

.order-stage-captured {
  --order-stage-accent: var(--order-stage-captured-accent);
}

.order-stage-oc {
  --order-stage-accent: var(--order-stage-oc-accent);
}

.order-stage-cd1 {
  --order-stage-accent: var(--order-stage-cd1-accent);
}

.order-stage-boe {
  --order-stage-accent: var(--order-stage-boe-accent);
}

.order-stage-sadc {
  --order-stage-accent: var(--order-stage-sadc-accent);
}

.order-stage-ready {
  --order-stage-accent: var(--order-stage-ready-accent);
}

.order-stage-moving {
  --order-stage-accent: var(--order-stage-moving-accent);
}

.order-stage-complete {
  --order-stage-accent: var(--order-stage-complete-accent);
}

.order-stage-hold {
  --order-stage-accent: var(--order-stage-on-hold-accent);
}

.order-stage-cancelled {
  --order-stage-accent: var(--order-stage-cancelled-accent);
}

.orders-overview-colour-key {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
}

.orders-overview-colour-key-heading {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.orders-overview-colour-key-heading strong {
  font-size: 12px;
}

.orders-overview-colour-key-heading span {
  color: var(--muted);
  font-size: 11px;
}

.orders-overview-colour-key-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-width: 0;
}

.orders-overview-colour-key-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.orders-overview-colour-key-item i {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 1px solid color-mix(in srgb, var(--order-stage-accent) 58%, var(--line));
  border-radius: 3px;
  background: color-mix(in srgb, var(--order-stage-accent) 18%, var(--surface));
}

.orders-overview-parent-row {
  --orders-overview-row-background: color-mix(
    in srgb,
    var(--order-stage-accent, var(--order-stage-captured-accent)) var(--order-stage-parent-tint),
    var(--surface-2)
  );
  font-weight: 600;
  background: var(--orders-overview-row-background);
}

.orders-overview-parent-row > td {
  border-top: 1px solid var(--line-strong);
  border-bottom-color: var(--line-strong);
  background: var(--orders-overview-row-background);
}

.orders-overview-line-row {
  --orders-overview-row-background: color-mix(
    in srgb,
    var(--order-stage-accent, var(--order-stage-captured-accent)) var(--order-stage-line-tint),
    var(--surface)
  );
  background: var(--orders-overview-row-background);
}

.orders-overview-line-row > td {
  background: var(--orders-overview-row-background);
  font-weight: 400;
}

.orders-overview-parent-row.order-stage-captured {
  --orders-overview-row-background: var(--surface-2);
}

.orders-overview-line-row.order-stage-captured {
  --orders-overview-row-background: var(--surface);
}

.orders-overview-line-marker {
  display: block;
  width: 18px;
  height: 20px;
  margin-left: 5px;
  border-bottom: 2px solid color-mix(in srgb, var(--blue) 55%, var(--line));
  border-left: 2px solid color-mix(in srgb, var(--blue) 55%, var(--line));
  border-bottom-left-radius: 7px;
}

.orders-overview-line-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  white-space: nowrap;
}

.orders-overview-line-hierarchy,
.orders-overview-line-action-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.orders-overview-line-action-controls {
  margin-left: auto;
}

.orders-overview-part-label {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.orders-overview-docs-action {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 11px;
}

.orders-overview-loads-action {
  min-height: 30px;
  padding: 4px 8px;
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
  color: var(--blue);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.orders-overview-loads-action svg {
  width: 14px;
  height: 14px;
}

.orders-overview-docs-action svg {
  width: 14px;
  height: 14px;
}

.orders-overview-parent-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.orders-overview-action-menu .row-action-menu-panel {
  min-width: 230px;
}

.orders-overview-counts {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.orders-overview-counts strong {
  color: var(--text);
}

.orders-overview-filter-tools .table-filter-count {
  display: none;
}

.orders-overview-month-band th {
  padding: 9px 14px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--blue) 12%, var(--surface-2));
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.order-quick-action-card .modal-head .section-help {
  margin: 4px 0 0;
}

.order-quick-action-card textarea {
  width: 100%;
  resize: vertical;
}

.orders-overview-reference-expand {
  appearance: none;
  padding: 0;
  border: 0;
  color: var(--orders-overview-link);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.orders-overview-reference-expand:hover,
.orders-overview-reference-expand:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.orders-overview-expand[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.orders-overview-expand svg {
  transition: transform 120ms ease;
}

.orders-overview-table th[data-column-key="remarks"],
.orders-overview-table td[data-table-column-key="remarks"] {
  width: 360px;
  min-width: 280px;
  max-width: 360px;
  white-space: nowrap;
}

.orders-overview-remark {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

.orders-overview-remark:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.orders-overview-remark-popover {
  position: fixed;
  z-index: 10000;
  width: max-content;
  max-width: min(520px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.24);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
  pointer-events: none;
}

.orders-overview-remark-popover[hidden] {
  display: none;
}

.column-preferences details {
  width: 100%;
}

.column-preferences summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

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

.column-preference-bulk-actions {
  justify-content: flex-start;
  margin-top: 10px;
}

.column-preference-subhead {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--form-label);
}

.column-preference-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--form-label);
  font-size: 12px;
  font-weight: 700;
}

.column-order-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.column-order-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.column-order-list li.is-dragging {
  opacity: 0.55;
}

.column-order-list li.is-drop-target {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.column-drag-handle {
  display: inline-flex;
  color: var(--muted);
  cursor: grab;
}

.column-order-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--form-label);
  font-size: 12px;
  font-weight: 800;
}

.column-order-actions {
  display: inline-flex;
  gap: 4px;
}

.column-order-actions .icon-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
}

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

.table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  contain: inline-size paint;
  -webkit-overflow-scrolling: touch;
}

.table-wrap-sticky {
  position: relative;
  max-height: calc(100vh - var(--sticky-table-top) - 16px);
  overflow: auto;
  scroll-margin-top: var(--sticky-table-top);
}

.table-wrap-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--line-strong), 0 3px 8px rgba(15, 23, 42, 0.08);
}

.table-wrap-sticky .table-column-filter-row th {
  top: 42px;
  z-index: 3;
  background: var(--surface);
}

.orders-overview-wrap {
  max-height: calc(100vh - var(--sticky-table-top) - 32px);
  scrollbar-gutter: stable;
}

.orders-overview-wrap table {
  border-collapse: separate;
  border-spacing: 0;
}

.orders-overview-table th,
.orders-overview-table td {
  white-space: nowrap;
}

.orders-overview-table [data-column-fixed] {
  width: 350px;
  min-width: 350px;
  max-width: 350px;
}

.orders-overview-line-row [data-column-fixed] {
  background: var(--orders-overview-row-background);
}

.orders-overview-parent-row [data-column-fixed] {
  background: var(--orders-overview-row-background);
}

.orders-overview-line-row td[data-table-column-key="boe_mt"] {
  padding-left: 24px;
  color: var(--blue);
  font-weight: 750;
}

.orders-overview-table th:nth-child(5),
.orders-overview-table td:nth-child(5),
.orders-overview-table th:nth-child(6),
.orders-overview-table td:nth-child(6) {
  min-width: 150px;
  white-space: normal;
}

.table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  text-decoration: none;
}

.table-sort-link:hover,
.table-sort-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table-sort-link svg,
.order-detail-link svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.order-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.table-pagination p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-pagination > div {
  display: flex;
  gap: 8px;
}

.status.order-lifecycle-badge.new-order {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.status.order-lifecycle-badge.documentation,
.status.order-lifecycle-badge.scheduled,
.status.order-lifecycle-badge.on-hold {
  background: #dbeafe;
  color: #1e40af;
}

.status.order-lifecycle-badge.loaded-waiting-docs {
  background: #fef3c7;
  color: #92400e;
}

.status.order-lifecycle-badge.in-transit {
  background: #ede9fe;
  color: #5b21b6;
}

.status.order-lifecycle-badge.delivered {
  background: #dcfce7;
  color: #166534;
}

.status.order-lifecycle-badge.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.order-detail-grid {
  align-items: start;
}

.order-detail-section {
  min-width: 0;
  padding-bottom: 16px;
}

.document-tracker-filter-tools {
  grid-template-columns: minmax(18rem, 1fr) repeat(3, minmax(13rem, 0.5fr)) auto auto;
}

.document-tracker-wrap {
  max-height: min(72vh, 58rem);
}

.document-tracker-table {
  min-width: 4300px;
}

.document-tracker-table th,
.document-tracker-table td {
  vertical-align: top;
}

.document-tracker-table th:nth-child(1),
.document-tracker-table td:nth-child(1),
.document-tracker-table th:nth-child(2),
.document-tracker-table td:nth-child(2),
.document-tracker-table th:nth-child(3),
.document-tracker-table td:nth-child(3) {
  position: sticky;
  z-index: 3;
  background: var(--surface);
}

.document-tracker-table th:nth-child(1),
.document-tracker-table td:nth-child(1) {
  left: 0;
  min-width: 9rem;
}

.document-tracker-table th:nth-child(2),
.document-tracker-table td:nth-child(2) {
  left: 9rem;
  min-width: 11rem;
}

.document-tracker-table th:nth-child(3),
.document-tracker-table td:nth-child(3) {
  left: 20rem;
  min-width: 18rem;
  box-shadow: 1px 0 0 var(--line);
}

.document-tracker-table thead th:nth-child(-n + 3) {
  z-index: 6;
  background: var(--surface-2);
}

.document-tracker-overdue-row td {
  background-color: color-mix(in srgb, var(--red) 7%, var(--surface));
}

.document-checkpoint-cell {
  min-width: 12rem;
}

.document-checkpoint-cell small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.document-tracker-part {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.document-state.overdue,
.document-state.out_of_sequence {
  color: var(--red);
  font-weight: 700;
}

.document-state.received,
.document-state.sent {
  color: var(--green);
}

/* Regular MT-level tracker table; the audit table above remains intentionally wide. */
.document-chase-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.document-chase-filter-tools {
  grid-template-columns: minmax(18rem, 2fr) repeat(4, minmax(11rem, 1fr));
}

.document-chase-filter-tools .search {
  grid-column: span 2;
}

.document-tracker-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.orders-page-tabs {
  margin: -8px 0 18px;
  background: var(--surface);
}

.needs-action-page-head {
  align-items: end;
}

.needs-action-counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.needs-action-counters > a {
  display: grid;
  gap: 8px;
  min-height: 142px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.needs-action-counters > a:hover {
  border-color: var(--blue);
  text-decoration: none;
}

.needs-action-counters span {
  font-weight: 800;
}

.needs-action-counters strong {
  font-size: clamp(1.7rem, 2vw, 2.2rem);
  line-height: 1;
}

.needs-action-counters small,
.needs-action-counter-note,
.needs-action-as-of {
  color: var(--muted);
}

.needs-action-counter-note {
  margin: 0 0 18px;
  font-size: 0.82rem;
}

.needs-action-panel {
  min-width: 0;
}

.needs-action-filters {
  display: grid;
  grid-template-columns: minmax(19rem, 1.6fr) repeat(5, minmax(10rem, 0.7fr)) auto auto;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.needs-action-as-of {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}

.needs-action-table-wrap {
  max-height: min(72vh, 58rem);
}

.needs-action-table {
  width: 100%;
  min-width: 1960px;
  table-layout: fixed;
}

.needs-action-table th,
.needs-action-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
}

.needs-action-table > thead th:nth-child(1),
.needs-action-table > tbody > tr > :nth-child(1) { width: 10rem; }
.needs-action-table > thead th:nth-child(2),
.needs-action-table > tbody > tr > :nth-child(2) { width: 15rem; }
.needs-action-table > thead th:nth-child(3),
.needs-action-table > tbody > tr > :nth-child(3) { width: 9rem; }
.needs-action-table > thead th:nth-child(4),
.needs-action-table > tbody > tr > :nth-child(4) { width: 10rem; }
.needs-action-table > thead th:nth-child(5),
.needs-action-table > tbody > tr > :nth-child(5) { width: 12rem; }
.needs-action-table > thead th:nth-child(6),
.needs-action-table > tbody > tr > :nth-child(6) { width: 9rem; }
.needs-action-table > thead th:nth-child(7),
.needs-action-table > tbody > tr > :nth-child(7) { width: 23rem; }
.needs-action-table > thead th:nth-child(8),
.needs-action-table > tbody > tr > :nth-child(8) { width: 19rem; }
.needs-action-table > thead th:nth-child(9),
.needs-action-table > tbody > tr > :nth-child(9) { width: 19rem; }
.needs-action-table > thead th:nth-child(10),
.needs-action-table > tbody > tr > :nth-child(10) { width: 13rem; }
.needs-action-table > thead th:nth-child(11),
.needs-action-table > tbody > tr > :nth-child(11) { width: 12rem; }
.needs-action-table > thead th:nth-child(12),
.needs-action-table > tbody > tr > :nth-child(12) { width: 10rem; }

.needs-action-table > thead th:nth-child(-n + 2),
.needs-action-main-row > :nth-child(-n + 2) {
  position: sticky;
  z-index: 4;
  background: var(--surface);
}

.needs-action-table > thead th:nth-child(1),
.needs-action-main-row > :nth-child(1) {
  left: 0;
}

.needs-action-table > thead th:nth-child(2),
.needs-action-main-row > :nth-child(2) {
  left: 10rem;
  box-shadow: 1px 0 0 var(--line);
}

.needs-action-table > thead th:nth-child(-n + 2) {
  z-index: 7;
  background: var(--surface-2);
}

.needs-action-main-row.is-priority-0 > td,
.needs-action-main-row.is-priority-0 > th {
  background: color-mix(in srgb, var(--red) 5%, var(--surface));
}

.needs-action-main-row.is-priority-1 > td,
.needs-action-main-row.is-priority-1 > th {
  background: color-mix(in srgb, var(--amber) 5%, var(--surface));
}

.needs-action-mt-cell {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.needs-action-mt-cell .icon-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  flex: 0 0 26px;
}

.needs-action-trip-reference {
  line-height: 1.65;
}

.needs-action-detail-row > td {
  padding: 12px 16px 16px;
  background: var(--surface-2);
}

.needs-action-trip-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.needs-action-trip-table {
  width: 100%;
  min-width: 980px;
}

.needs-action-trip-table th,
.needs-action-trip-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.needs-action-link-list,
.needs-action-evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.needs-action-evidence-links {
  padding-top: 12px;
}

.needs-action-report-history {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.needs-action-report-history ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.needs-action-table .row-action-menu-panel {
  min-width: 240px;
}

@media (max-width: 760px) {
  .needs-action-counters {
    grid-template-columns: 1fr;
  }

  .needs-action-filters {
    grid-template-columns: 1fr;
  }

  .needs-action-as-of {
    flex-direction: column;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .needs-action-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .needs-action-filters .search {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1181px) and (max-width: 1600px) {
  .needs-action-filters {
    grid-template-columns: minmax(17rem, 1.4fr) repeat(3, minmax(9.5rem, 1fr));
  }
}

.document-tracker-controller-help {
  margin: -6px 0 0;
}

.document-tracker-queue-wrap {
  max-height: min(72vh, 58rem);
  min-width: 0;
}

.document-tracker-queue-table {
  min-width: 1780px;
}

.document-tracker-queue-table th,
.document-tracker-queue-table td {
  vertical-align: top;
}

.document-tracker-queue-table th:nth-child(1),
.document-tracker-queue-table td:nth-child(1),
.document-tracker-queue-table th:nth-child(2),
.document-tracker-queue-table td:nth-child(2) {
  position: sticky;
  z-index: 3;
  background: var(--surface);
}

.document-tracker-queue-table th:nth-child(1),
.document-tracker-queue-table td:nth-child(1) {
  left: 0;
  min-width: 9rem;
}

.document-tracker-queue-table th:nth-child(2),
.document-tracker-queue-table td:nth-child(2) {
  left: 9rem;
  min-width: 8rem;
  box-shadow: 1px 0 0 var(--line);
}

.document-tracker-queue-table thead th:nth-child(-n + 2) {
  z-index: 6;
  background: var(--surface-2);
}

.document-tracker-queue-table th:nth-child(3),
.document-tracker-queue-table td:nth-child(3) {
  min-width: 14rem;
}

.document-tracker-queue-table th:nth-child(7),
.document-tracker-queue-table td:nth-child(7),
.document-tracker-queue-table th:nth-child(10),
.document-tracker-queue-table td:nth-child(10) {
  min-width: 13rem;
}

.document-tracker-cell-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.document-tracker-follow-up-preview {
  display: -webkit-box;
  max-width: 18rem;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.document-tracker-attention {
  min-width: 10rem;
}

.document-tracker-attention .status {
  margin: 0 4px 4px 0;
}

.document-tracker-action-menu {
  justify-items: center;
}

.document-tracker-action-menu .row-action-menu-panel {
  min-width: 230px;
}

.document-tracker-queue-table tr.is-overdue td {
  background-color: color-mix(in srgb, var(--red) 6%, var(--surface));
}

.document-tracker-queue-table tr.is-review td,
.document-tracker-queue-table tr.is-completion-mismatch td {
  background-color: color-mix(in srgb, var(--amber) 7%, var(--surface));
}

.document-tracker-queue-table tr.is-on-hold td {
  background-color: color-mix(in srgb, var(--blue) 5%, var(--surface));
}

.document-tracker-queue-table tr.is-finished td {
  background-color: color-mix(in srgb, var(--green) 4%, var(--surface));
}

.document-tracker-filter-actions .btn {
  min-height: 42px;
}

@media (max-width: 1100px) {
  .document-tracker-filter-tools {
    grid-template-columns: 1fr 1fr;
  }

  .document-chase-filter-tools {
    grid-template-columns: 1fr 1fr;
  }

  .document-chase-filter-tools .search {
    grid-column: 1 / -1;
  }

  .document-tracker-filter-actions {
    align-items: stretch;
  }

  .document-tracker-filter-actions .btn {
    flex: 1;
  }
}

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

.document-chase-empty {
  display: grid;
  gap: 4px;
  min-height: 150px;
  place-content: center;
  text-align: center;
}

.document-chase-empty p {
  max-width: 38rem;
  margin: 0;
}

.order-detail-section > .panel-heading {
  padding-bottom: 8px;
}

.order-line-detail-list + .order-line-detail-list,
.order-note + .order-note {
  border-top: 1px solid var(--line);
}

.order-line-detail-list h3 {
  margin-top: 0;
}

.order-note {
  padding: 14px 18px;
}

.order-note p {
  margin: 8px 0 0;
}

.document-event-list {
  display: grid;
  gap: 6px;
  min-width: 240px;
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

:root[data-theme="dark"] .status.order-lifecycle-badge.documentation,
:root[data-theme="dark"] .status.order-lifecycle-badge.scheduled,
:root[data-theme="dark"] .status.order-lifecycle-badge.on-hold {
  background: #172554;
  color: #bfdbfe;
}

:root[data-theme="dark"] .status.order-lifecycle-badge.loaded-waiting-docs {
  background: #451a03;
  color: #fde68a;
}

:root[data-theme="dark"] .status.order-lifecycle-badge.in-transit {
  background: #2e1065;
  color: #ddd6fe;
}

:root[data-theme="dark"] .status.order-lifecycle-badge.delivered {
  background: #052e16;
  color: #bbf7d0;
}

:root[data-theme="dark"] .status.order-lifecycle-badge.cancelled {
  background: #450a0a;
  color: #fecaca;
}

:root .orders-overview-table .orders-overview-line-row .status.order-lifecycle-badge {
  background: color-mix(
    in srgb,
    var(--order-stage-accent, var(--order-stage-captured-accent)) 16%,
    var(--surface)
  );
  color: color-mix(
    in srgb,
    var(--order-stage-accent, var(--order-stage-captured-accent)) 60%,
    var(--text)
  );
}

.map-filter-disabled input {
  color: var(--muted);
  background: var(--surface-2);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  padding: 0 16px 16px;
}

.tracking-map-canvas {
  position: relative;
  display: grid;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--surface-2);
  background-size: 42px 42px;
}

.tracking-map-canvas.has-map-points {
  background:
    linear-gradient(rgba(20, 91, 214, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 91, 214, 0.12) 1px, transparent 1px),
    var(--surface-2);
  background-size: 42px 42px;
}

.map-empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  max-width: 560px;
  margin: auto;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.map-empty-state svg {
  width: 38px;
  height: 38px;
  color: var(--blue);
}

.map-empty-state strong {
  color: var(--text);
  font-size: 16px;
}

.map-point-layer {
  position: absolute;
  inset: 0;
}

.map-point {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--blue);
  color: var(--on-strong);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.22);
}

.map-point span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  display: none;
  min-width: 180px;
  max-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  box-shadow: var(--shadow);
}

.map-point:hover span,
.map-point:focus span {
  display: block;
}

.map-side-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.map-stat {
  display: grid;
  gap: 4px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.map-stat span,
.map-stat small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.map-stat strong {
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  background: var(--surface-2);
  color: var(--nav-heading);
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 13px;
}

.stock-section-total > td {
  border-top-color: var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: var(--stock-total-bg);
  font-weight: 800;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--neutral-bg);
  color: var(--code-text);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.status.matched,
.status.passed,
.status.promoted,
.status.active,
.status.accepted,
.status.clean,
.status.completed,
.status.done,
.status.high,
.status.in_transit,
.status.delivered,
.status.ready,
.status.committed,
.status.upload_created,
.status.received {
  background: var(--green-bg);
  color: var(--green);
}

.status.loaded,
.status.at_depot,
.status.open,
.status.todo,
.status.wip,
.status.in_progress,
.status.medium,
.status.normal,
.status.urgent,
.status.new,
.status.reviewing,
.status.awaiting_confirmation,
.status.warning,
.status.waiting,
.status.review_required,
.status.staged,
.status.missing,
.status.not_scanned,
.status.duplicate,
.status.pending,
.status.processing,
.status.validating,
.status.reading,
.status.matching,
.status.committing,
.status.review_needed,
.status.partial {
  background: var(--amber-bg);
  color: var(--amber);
}

.status.failed,
.status.delayed,
.status.error,
.status.blocker,
.status.blocked,
.status.auth_failed,
.status.malware_detected,
.status.not_configured,
.status.quarantined,
.status.rejected,
.status.reopened,
.status.retracted,
.status.scanner_unavailable,
.status.stale,
.status.sync_failed,
.status.exception {
  background: var(--red-bg);
  color: var(--red);
}

.status.resolved,
.status.dismissed,
.status.disabled,
.status.low,
.status.planned,
.status.on_hold,
.status.retained,
.status.superseded,
.status.cancelled,
.status.untested {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.status.order-status-badge.pending {
  background: #f3e8ff;
  color: #6b21a8;
}

.status.order-status-badge.open {
  background: #fef9c3;
  color: #854d0e;
}

.status.order-status-badge.complete {
  background: #dcfce7;
  color: #166534;
}

.status.order-status-badge.on_hold {
  background: #dbeafe;
  color: #1e40af;
}

.status.order-status-badge.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

:root[data-theme="dark"] .status.order-status-badge.pending {
  background: #3b0764;
  color: #e9d5ff;
}

:root[data-theme="dark"] .status.order-status-badge.open {
  background: #422006;
  color: #fef08a;
}

:root[data-theme="dark"] .status.order-status-badge.complete {
  background: #052e16;
  color: #bbf7d0;
}

:root[data-theme="dark"] .status.order-status-badge.on_hold {
  background: #172554;
  color: #bfdbfe;
}

:root[data-theme="dark"] .status.order-status-badge.cancelled {
  background: #450a0a;
  color: #fecaca;
}

.status.feedback-status-badge.new {
  background: var(--feedback-status-new-bg);
  color: var(--feedback-status-new-text);
}

.status.feedback-status-badge.reviewing {
  background: var(--feedback-status-reviewing-bg);
  color: var(--feedback-status-reviewing-text);
}

.status.feedback-status-badge.planned {
  background: var(--feedback-status-planned-bg);
  color: var(--feedback-status-planned-text);
}

.status.feedback-status-badge.in_progress {
  background: var(--feedback-status-in-progress-bg);
  color: var(--feedback-status-in-progress-text);
}

.status.feedback-status-badge.on_hold {
  background: var(--amber-bg);
  color: var(--amber);
}

.status.feedback-status-badge.blocked {
  background: var(--red-bg);
  color: var(--red);
}

.status.feedback-status-badge.awaiting_confirmation {
  background: var(--feedback-status-awaiting-bg);
  color: var(--feedback-status-awaiting-text);
}

.status.feedback-status-badge.done {
  background: var(--feedback-status-done-bg);
  color: var(--feedback-status-done-text);
}

.status.feedback-status-badge.reopened {
  background: var(--feedback-status-reopened-bg);
  color: var(--feedback-status-reopened-text);
}

.status.feedback-status-badge.rejected {
  background: var(--feedback-status-rejected-bg);
  color: var(--feedback-status-rejected-text);
}

.roadmap-table td small,
table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  white-space: normal;
}

.roadmap-actions {
  display: grid;
  gap: 6px;
  min-width: 132px;
}

.roadmap-actions .btn {
  justify-content: flex-start;
  white-space: nowrap;
}

.rail-panel {
  overflow: hidden;
}

.upload-list,
.status-list {
  display: grid;
}

.upload-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.upload-row:first-child {
  border-top: 0;
}

.upload-row svg {
  color: var(--green);
}

.upload-row span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.upload-row strong,
.upload-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-row small {
  color: var(--muted);
}

.status-list {
  padding: 10px 14px 14px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.mini-table th,
.mini-table td {
  padding: 9px 10px;
  font-size: 12px;
}

.stock-item-cell {
  display: grid;
  gap: 2px;
  min-width: 150px;
  white-space: normal;
}

.stock-item-cell strong {
  font-size: 12px;
}

.stock-item-cell small {
  color: var(--muted);
  font-size: 11px;
}

.positive {
  color: var(--green);
  font-weight: 800;
}

.negative {
  color: var(--red);
  font-weight: 800;
}

.neutral {
  color: var(--muted);
  font-weight: 800;
}

.stock-compare-tools {
  flex-wrap: wrap;
  align-items: end;
}

.stock-gap-tools {
  flex-wrap: wrap;
  align-items: end;
}

.stock-movement-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 14px;
}

.stock-movement-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.stock-movement-summary span,
.stock-gap-summary small {
  color: var(--muted);
  font-size: 11px;
}

.stock-movement-summary strong {
  font-size: 19px;
}

.stock-movement-exception-card {
  border-color: var(--warning-border) !important;
  background: var(--warning-panel-bg) !important;
}

.stock-movement-exception-row td,
.stock-gap-movement-exception {
  background: var(--warning-panel-bg);
}

.stock-control-note,
.stock-detail-description {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.stock-detail-panel {
  margin-top: 16px;
  overflow: hidden;
}

.stock-detail-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.stock-detail-panel > summary::-webkit-details-marker {
  display: none;
}

.stock-detail-panel > summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.stock-detail-panel > summary small {
  color: var(--muted);
  font-size: 11px;
}

.stock-detail-panel > summary svg {
  width: 17px;
  height: 17px;
}

.stock-detail-warning > summary {
  color: var(--red);
  background: var(--warning-panel-bg);
}

.dispatch-report-tools {
  flex-wrap: wrap;
  align-items: end;
}

.dispatch-report-tools > label:not(.search) {
  min-width: 150px;
}

.dispatch-search {
  min-width: min(100%, 320px);
}

.stock-gap-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 14px;
}

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

.stock-gap-summary-managed {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dispatch-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 0;
}

.loading-summary-controls {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.loading-summary-presets,
.loading-summary-actions,
.loading-summary-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.loading-summary-presets > span {
  margin-right: 4px;
  color: var(--form-label);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.loading-summary-presets .btn {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 12px;
}

.loading-summary-presets .btn.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--on-strong);
}

.loading-summary-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
}

.loading-summary-filters > label:not(.search) {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--form-label);
  font-size: 12px;
  font-weight: 800;
}

.loading-summary-filters input,
.loading-summary-filters select {
  width: 100%;
  min-width: 0;
}

.loading-summary-search {
  min-width: 0;
}

.loading-summary-actions {
  grid-column: span 2;
  align-self: end;
}

.loading-summary-actions .btn {
  min-height: 40px;
}

.loading-summary-source {
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.loading-summary-source span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.loading-summary-source svg {
  width: 16px;
  height: 16px;
  color: var(--green);
}

.loading-summary-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 16px 0 0;
}

.loading-summary-coverage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
}

.loading-summary-coverage > div {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.loading-summary-coverage > div + div {
  border-left: 1px solid var(--line);
}

.loading-summary-coverage span,
.loading-summary-coverage small {
  color: var(--muted);
}

.loading-summary-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.loading-summary-breakdown {
  min-width: 0;
}

.loading-summary-bars {
  display: grid;
  max-height: 430px;
  overflow-y: auto;
}

.loading-summary-bar-row {
  display: grid;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.loading-summary-bar-row:last-child {
  border-bottom: 0;
}

.loading-summary-bar-row:hover {
  background: var(--hover-bg);
}

.loading-summary-bar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.loading-summary-bar-label strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.loading-summary-bar-label em {
  color: var(--text);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.loading-summary-bar-row small {
  color: var(--muted);
}

.loading-summary-bar-track,
.loading-summary-inline-bar {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.loading-summary-bar-track > span,
.loading-summary-inline-bar > span {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--blue);
}

.loading-summary-inline-bar {
  width: min(180px, 100%);
  margin-top: 6px;
}

.loading-summary-table td:nth-child(4) {
  min-width: 190px;
}

.loading-summary-empty {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
  padding: 22px;
}

.loading-summary-empty > svg {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.loading-summary-empty h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.loading-summary-empty p {
  margin: 0 0 12px;
  color: var(--muted);
}

.preview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 14px;
}

.preview-actions form {
  display: inline-flex;
}

.preview-actions .preview-test-send {
  align-items: end;
  gap: 8px;
}

.preview-test-send label {
  display: grid;
  gap: 5px;
  min-width: 220px;
  color: var(--form-label);
  font-size: 12px;
  font-weight: 800;
}

.stock-gap-summary div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.stock-gap-summary span,
.muted {
  color: var(--muted);
}

.stock-gap-summary strong {
  font-size: 20px;
}

.stock-gap-summary small,
.stock-gap-movement-exception small,
.stock-gap-readiness-unknown {
  display: block;
  margin-top: 3px;
  white-space: normal;
}

.stock-gap-freshness small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.stock-gap-readiness-unknown {
  color: var(--amber);
  font-size: 10px;
  font-weight: 800;
}

.stock-gap-readiness-head th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
}

.stock-gap-table {
  --stock-gap-month-header-height: 43px;
  --stock-gap-readiness-header-height: 47px;
}

.stock-gap-table thead > tr:first-child > th {
  top: 0;
  z-index: 5;
}

.stock-gap-table thead > tr:first-child > th[colspan] {
  height: var(--stock-gap-month-header-height);
  line-height: 1.1;
}

.stock-gap-table .stock-gap-readiness-head th {
  top: var(--stock-gap-month-header-height);
  z-index: 5;
  height: var(--stock-gap-readiness-header-height);
  line-height: 1.1;
}

.stock-gap-table .table-column-filter-row th {
  top: calc(var(--stock-gap-month-header-height) + var(--stock-gap-readiness-header-height));
  z-index: 4;
}

.stock-gap-warning-panel {
  padding: 0 16px 14px;
}

.stock-gap-partial-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--amber);
  border-radius: 6px;
  background: var(--amber-bg);
}

.stock-gap-partial-banner .status {
  margin-left: 0;
}

.stock-gap-partial-banner p {
  margin: 4px 0 0;
}

@media (max-width: 760px) {
  .stock-gap-partial-banner {
    grid-template-columns: 1fr;
  }
}

.stock-gap-warning-panel details {
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  background: var(--warning-panel-bg);
}

.stock-gap-warning-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  color: var(--red);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.stock-gap-warning-panel summary::-webkit-details-marker {
  display: none;
}

.stock-gap-warning-panel summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stock-gap-warning-panel summary small {
  color: var(--warning-text);
  font-size: 12px;
  font-weight: 800;
}

.stock-gap-warning-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.stock-gap-warning-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--warning-line);
  border-radius: 6px;
  background: var(--surface);
}

.stock-gap-warning-line[hidden],
.stock-gap-warning-empty[hidden] {
  display: none;
}

.stock-gap-warning-line strong,
.stock-gap-warning-line span,
.stock-gap-warning-line p {
  display: block;
}

.stock-gap-warning-line span {
  margin-top: 2px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.stock-gap-warning-line p,
.stock-gap-warning-empty {
  margin: 4px 0 0;
  color: var(--warning-text);
}

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

.stock-gap-section td {
  background: var(--stock-section-bg);
  color: var(--nav-heading);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stock-gap-total td {
  background: var(--surface-2);
  font-weight: 900;
}

.stock-gap-grand-total td {
  background: color-mix(in srgb, var(--blue) 16%, var(--surface));
  border-top: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  color: var(--nav-heading);
  font-size: 13px;
}

.stock-gap-grand-total td:first-child {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stock-gap-management-cell {
  min-width: 360px;
  white-space: normal;
}

.stock-gap-row-form {
  display: grid;
  gap: 8px;
}

.stock-gap-form-grid {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(140px, 1fr);
  gap: 8px;
}

.stock-gap-row-form label {
  display: grid;
  gap: 4px;
  color: var(--form-label);
  font-size: 11px;
  font-weight: 800;
}

.stock-gap-row-form input,
.stock-gap-row-form select,
.stock-gap-row-form textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
}

.stock-gap-row-form textarea {
  min-height: 46px;
}

.stock-gap-notes-field {
  grid-column: 1 / -1;
}

.stock-gap-row-form .btn {
  justify-self: start;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.preview-table td {
  vertical-align: top;
}

.preview-list {
  display: grid;
  gap: 4px;
  min-width: 170px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-list li {
  display: grid;
  gap: 1px;
}

.preview-list span {
  color: var(--muted);
  font-size: 12px;
}

.preview-blockers li {
  color: var(--red);
  font-weight: 800;
}

.preview-ready {
  color: var(--green);
  font-weight: 800;
}

.stock-snapshot-panel {
  margin-top: 16px;
}

.dispatch-panel {
  margin-top: 16px;
}

.exception-panel {
  padding-bottom: 10px;
}

.exception-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 16px;
}

.exception-grid div {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0 10px;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.exception-grid div:first-child {
  border-left: 0;
}

.exception-grid svg {
  grid-row: span 3;
  width: 28px;
  height: 28px;
  color: var(--amber);
}

.exception-grid strong {
  font-size: 20px;
}

.exception-grid span {
  font-weight: 800;
}

.exception-grid small {
  color: var(--muted);
}

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

.attention-exceptions {
  min-width: 0;
  padding-top: 8px;
  scroll-margin-top: 88px;
}

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

.attention-section-head h2,
.attention-section-head p {
  margin: 0;
}

.attention-section-head p {
  margin-top: 4px;
  color: var(--muted);
}

.attention-summary .kpi {
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 10px 12px;
  box-shadow: none;
}

.attention-summary .kpi svg {
  width: 20px;
  height: 20px;
}

.attention-summary .kpi span {
  min-height: 0;
  font-size: 0.82rem;
}

.attention-summary .kpi strong {
  font-size: 20px;
}

.attention-triage-panel {
  box-shadow: none;
}

.attention-triage-panel .table-wrap {
  border-top: 1px solid var(--line);
}

.attention-worklist-panel {
  overflow: hidden;
}

.today-intake-lanes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.today-intake-lane {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.today-intake-lane-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.today-intake-lane-heading > svg {
  width: 34px;
  height: 34px;
  color: var(--blue);
}

.today-intake-lane h3 {
  margin: 0 0 8px;
}

.today-intake-lane .status {
  margin-left: 0;
}

.today-intake-lane p {
  margin: 16px 0 0;
  color: var(--muted);
}

.today-intake-sources {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.today-intake-sources ul {
  margin-bottom: 0;
  padding-left: 20px;
  overflow-wrap: anywhere;
}

.today-intake-closed {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-bg);
}

.today-intake-closed p {
  margin: 5px 0 0;
}

.today-intake-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .today-intake-lanes {
    grid-template-columns: 1fr;
  }

  .today-intake-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

.feedback-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.feedback-summary .kpi {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 10px 12px;
}

.feedback-summary .kpi svg {
  width: 20px;
  height: 20px;
}

.feedback-summary .kpi span {
  min-height: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.feedback-summary .kpi strong {
  font-size: 20px;
}

.review-triage-summary {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.document-overview-summary {
  padding-top: 0;
}

.document-overview-table td {
  min-width: 140px;
  white-space: normal;
}

.document-overview-table th:first-child,
.document-overview-table td:first-child {
  min-width: 260px;
}

.document-overview-primary,
.document-status-stack {
  display: grid;
  gap: 5px;
}

.document-overview-primary a,
.document-overview-primary span {
  font-weight: 800;
}

.document-overview-primary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.document-status-stack {
  justify-items: start;
}

.document-next-action {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

.triage-panel {
  margin-bottom: 16px;
}

.triage-table td {
  vertical-align: top;
  white-space: normal;
}

.triage-cause,
.triage-affected,
.triage-action {
  min-width: 160px;
}

.triage-action {
  max-width: 360px;
}

.bulk-selection-form {
  display: grid;
  gap: 12px;
}

.filtered-warning-action-form {
  display: block;
}

.filtered-warning-toolbar,
.selected-action-toolbar {
  border-bottom: 0;
}

.bulk-action-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.bulk-action-bar > strong {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
  white-space: nowrap;
}

.bulk-action-bar label {
  display: grid;
  gap: 5px;
  min-width: min(100%, 190px);
  color: var(--form-label);
  font-size: 12px;
  font-weight: 800;
}

.bulk-action-bar .bulk-note-field {
  flex: 1;
  min-width: min(100%, 280px);
}

.selection-cell {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.selection-cell input[type="checkbox"] {
  margin: 0 auto;
}

.staging-review-row {
  scroll-margin-top: calc(var(--sticky-table-top) + 20px);
}

.staging-review-row:focus {
  outline: none;
}

.staging-review-row:target > td,
.staging-review-row.is-focused > td,
.staging-review-row:focus > td {
  background: var(--hover-bg);
}

.staging-review-row:target > td:first-child,
.staging-review-row.is-focused > td:first-child,
.staging-review-row:focus > td:first-child {
  box-shadow: inset 4px 0 0 var(--blue);
}

.staging-review-pagination {
  margin-top: 12px;
}

.attention-table td {
  white-space: normal;
}

.attention-message,
.attention-source {
  display: grid;
  gap: 3px;
  min-width: 180px;
}

.attention-message strong {
  color: var(--text);
}

.attention-message small,
.attention-source small {
  color: var(--muted);
}

.attention-action,
.long-text {
  min-width: 220px;
  max-width: 520px;
  white-space: normal;
}

.attention-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
}

.feedback-detail-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.feedback-detail-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.feedback-roadmap-panel {
  overflow: hidden;
}

.feedback-roadmap-link {
  color: var(--blue);
  font-weight: 750;
}

.feedback-new-update {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--amber);
  font-weight: 800;
}

.feedback-new-update i {
  width: 14px;
  height: 14px;
}

.my-feedback-table {
  width: 100%;
  table-layout: fixed;
}

.my-feedback-table .my-feedback-col-feedback {
  width: 38%;
}

.my-feedback-table .my-feedback-col-type {
  width: 14%;
}

.my-feedback-table .my-feedback-col-status {
  width: 17%;
}

.my-feedback-table .my-feedback-col-roadmap-status {
  width: 18%;
}

.my-feedback-table .my-feedback-col-attachments {
  width: 13%;
}

.my-feedback-table th,
.my-feedback-table td {
  min-width: 0;
  padding: 10px 9px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.my-feedback-table .long-text {
  min-width: 0;
  max-width: none;
}

.my-feedback-cell-content {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.my-feedback-cell-content > a,
.my-feedback-cell-content strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.my-feedback-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.my-feedback-meta a {
  color: var(--blue);
  font-weight: 800;
}

.my-feedback-table .status {
  max-width: 100%;
  margin-left: 0;
  white-space: normal;
}

.my-feedback-attachment-cell {
  text-align: center;
}

.attention-update-panel {
  overflow: hidden;
}

.attention-update-panel .form-stack {
  padding: 16px;
}

.feedback-review-actions {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.feedback-roadmap-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.feedback-roadmap-body .long-text {
  min-width: 0;
  max-width: none;
}

.feedback-manual-text {
  color: var(--text);
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.compact-detail-list {
  margin: 0;
  padding: 0;
}

.feedback-confirmation-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.feedback-progress-panel {
  overflow: hidden;
}

.feedback-progress-list {
  border-top: 1px solid var(--line);
}

.feedback-progress-list li {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.feedback-progress-list li:last-child {
  border-bottom: 0;
}

.feedback-progress-list p {
  margin: 4px 0 0;
}

.feedback-progress-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.feedback-progress-meta time {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.feedback-status-guide {
  margin-top: 16px;
  overflow: hidden;
}

.feedback-status-guide-menu {
  position: relative;
  z-index: 30;
}

.feedback-status-guide-trigger {
  list-style: none;
  cursor: pointer;
}

.feedback-status-guide-trigger::-webkit-details-marker {
  display: none;
}

.feedback-status-guide-trigger:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.feedback-status-guide-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(760px, calc(100vw - 48px));
  max-height: min(72vh, 680px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feedback-status-guide-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.feedback-status-guide-popover-head h2,
.feedback-status-guide-popover-head p {
  margin: 0;
}

.feedback-status-guide-popover-head > small {
  flex: 0 0 auto;
  color: var(--muted);
}

.status-guide-disclosure {
  display: block;
}

.status-guide-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.status-guide-summary::-webkit-details-marker {
  display: none;
}

.status-guide-summary h2,
.status-guide-summary p {
  margin: 0;
}

.status-guide-summary-action {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-guide-summary-action i {
  width: 16px;
  height: 16px;
}

.status-guide-disclosure[open] .status-guide-summary {
  border-bottom: 1px solid var(--line);
}

.status-guide-disclosure[open] .status-guide-summary-action {
  color: var(--text);
}

.ai-extracted-pages > summary {
  cursor: pointer;
}

.ai-extracted-pages > summary h2 {
  display: inline;
}

.ai-extracted-pages[open] > summary {
  margin-bottom: 16px;
}

.status-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.status-guide-item {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-guide-item h3,
.status-guide-item p {
  margin: 0;
}

.status-guide-item h3 {
  font-size: 15px;
}

.status-guide-item small {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 640px) {
  .feedback-status-guide-popover {
    position: fixed;
    top: 76px;
    right: 16px;
    left: 16px;
    width: auto;
    max-height: calc(100vh - 96px);
  }

  .feedback-status-guide-popover-head {
    flex-direction: column;
  }

  .status-guide-summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Guided Open Orders review. Keep this workflow isolated from generic upload review styles. */
.guided-open-orders-review {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.guided-open-orders-review .panel-head > div,
.guided-open-orders-review .upload-progress-head > div,
.guided-review-group header > div {
  min-width: 0;
}

.guided-review-overview,
.guided-review-step-body {
  padding: 16px;
}

.guided-review-overview .upload-progress-head,
.guided-review-step .panel-head {
  padding: 0 0 16px;
}

.guided-review-step .panel-head {
  align-items: flex-start;
  margin: 16px 16px 0;
}

.guided-review-step .panel-head h2,
.guided-review-group h3,
.guided-review-fix h3 {
  margin: 0;
}

.guided-review-eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guided-review-metrics,
.guided-review-final-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.guided-review-metrics > div,
.guided-review-final-counts > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.guided-review-metrics span,
.guided-review-final-counts span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.guided-review-metrics strong,
.guided-review-final-counts strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.guided-review-next-action .panel-head {
  align-items: flex-start;
  margin: 16px 16px 0;
}

.guided-review-audit-details {
  display: grid;
  gap: 14px;
  padding: 12px;
}

.guided-review-audit-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.guided-review-audit-summary > div {
  min-width: 0;
  padding: 10px;
  border-radius: 5px;
  background: var(--surface-2);
}

.guided-review-audit-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.guided-review-audit-summary dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.guided-review-fix-list,
.guided-review-groups,
.guided-review-line-list {
  display: grid;
  gap: 12px;
}

.guided-review-fix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.guided-review-fix.is-completed,
.guided-review-group.is-completed,
.guided-review-line-item.is-completed {
  border-color: var(--green);
  background: var(--green-bg);
}

.guided-review-fix .status.completed {
  margin: 8px 0 0;
}

.guided-review-fix p,
.guided-review-group header p,
.guided-review-complete-message p {
  margin: 5px 0 0;
  color: var(--muted);
}

.guided-review-fix dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.guided-review-fix dl div {
  min-width: 0;
  padding: 10px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface);
}

.guided-review-fix dl div:last-child {
  border-left-color: var(--green);
}

.guided-review-fix dt,
.guided-review-group-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.guided-review-fix dd,
.guided-review-group-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.guided-review-safe-form,
.guided-review-group-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.guided-review-refresh-form {
  max-width: 52rem;
  margin-top: 16px;
}

.guided-review-refresh-form > label:not(.inline-check) {
  display: grid;
  gap: 6px;
}

.guided-review-group {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.guided-review-fix .guided-review-source-rows,
.guided-review-group header .guided-review-source-rows {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.guided-review-group header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.guided-review-group-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.guided-review-group-badges .status {
  margin-left: 0;
}

.guided-review-group-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.guided-review-group-facts > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 5px;
  background: var(--surface-2);
}

.guided-review-warning,
.guided-review-complete-message,
.guided-review-access-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  background: var(--warning-panel-bg);
  color: var(--text);
  font-weight: 700;
}

.guided-review-warning svg,
.guided-review-complete-message svg,
.guided-review-access-note svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--amber);
}

.guided-review-access-note {
  border-color: var(--blue-dark);
  background: var(--stock-section-bg);
}

.guided-review-access-note svg {
  color: var(--blue-dark);
}

.guided-review-access-note p,
.guided-review-warning p {
  margin: 4px 0 0;
  color: var(--text);
  font-weight: 600;
}

.guided-review-complete-message {
  border-color: var(--green);
  background: var(--green-bg);
}

.guided-review-complete-message svg {
  color: var(--green);
}

.guided-review-line-details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.guided-review-line-details summary {
  padding: 12px;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.guided-review-line-details summary:focus-visible {
  outline: 3px solid var(--blue-dark);
  outline-offset: 2px;
}

.guided-review-line-list {
  padding: 0 12px 12px;
}

.guided-review-line-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.guided-review-line-list > .guided-review-line-item {
  border-top: 1px solid var(--line);
}

.guided-review-line-list > .form-option-label.guided-review-line-item {
  display: flex;
}

.guided-review-line-list .guided-review-excel-row {
  color: var(--text);
  white-space: nowrap;
}

.guided-review-line-list span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.guided-review-line-list .status {
  justify-self: start;
  margin: 5px 0 0;
}

.guided-open-orders-review .status.completed,
.guided-open-orders-review .status.ready {
  color: #166534;
}

.guided-open-orders-review .status.reviewing,
.guided-open-orders-review .status.warning,
.guided-open-orders-review .status.pending,
.guided-open-orders-review .status.processing {
  color: #92400e;
}

.guided-open-orders-review .status.blocked {
  color: #991b1b;
}

:root[data-theme="dark"] .guided-open-orders-review .status.completed,
:root[data-theme="dark"] .guided-open-orders-review .status.ready {
  color: var(--green);
}

:root[data-theme="dark"] .guided-open-orders-review .status.reviewing,
:root[data-theme="dark"] .guided-open-orders-review .status.warning,
:root[data-theme="dark"] .guided-open-orders-review .status.pending,
:root[data-theme="dark"] .guided-open-orders-review .status.processing {
  color: var(--amber);
}

:root[data-theme="dark"] .guided-open-orders-review .status.blocked {
  color: var(--red);
}

.guided-review-group-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.guided-review-group-form legend {
  margin-bottom: 8px;
  color: var(--form-label);
  font-weight: 800;
}

.guided-review-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.guided-review-choice-grid .form-option-label {
  align-items: flex-start;
  min-width: 0;
}

.guided-review-choice-grid input {
  flex: 0 0 auto;
  width: auto;
  margin-top: 3px;
}

.guided-review-choice-grid small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.guided-review-actual-so {
  display: grid;
}

@supports selector(form:has(input:checked)) {
  .guided-review-group-form:not(:has(input[name="decision"][value="actual_so"]:checked)) .guided-review-actual-so {
    display: none;
  }
}

.guided-review-final-counts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.guided-open-orders-review button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.guided-review-advanced {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.guided-review-advanced summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.guided-review-advanced summary::-webkit-details-marker {
  display: none;
}

.guided-review-advanced summary:focus-visible {
  outline: 3px solid var(--blue-dark);
  outline-offset: 2px;
}

.guided-review-advanced summary svg {
  width: 18px;
  height: 18px;
}

.guided-review-advanced > div {
  padding: 0 16px 16px;
}

@media (max-width: 900px) {
  .guided-open-orders-review .upload-progress-steps,
  .guided-review-choice-grid {
    grid-template-columns: 1fr;
  }

  .guided-review-fix {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .guided-review-metrics,
  .guided-review-final-counts,
  .guided-review-audit-summary,
  .guided-review-group-facts,
  .guided-review-fix dl {
    grid-template-columns: 1fr;
  }

  .guided-review-group header,
  .guided-review-step .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .guided-review-group-badges {
    justify-content: flex-start;
  }

  .guided-review-group-form .btn,
  .guided-review-safe-form .btn,
  .guided-review-final .btn {
    width: 100%;
  }
}

.feedback-review-action-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.feedback-approval-options {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.feedback-approval-option {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-top: 2px;
  border-left: 4px solid var(--line-strong);
  padding-left: 12px;
}

.feedback-approval-option > *,
.feedback-approval-option .form-stack,
.feedback-approval-option label,
.feedback-approval-option-head > div {
  min-width: 0;
}

.feedback-approval-option label > input,
.feedback-approval-option label > select,
.feedback-approval-option label > textarea {
  width: 100%;
  max-width: 100%;
}

.feedback-approval-option + .feedback-approval-option {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.feedback-approval-option-link {
  border-left-color: var(--blue);
}

.feedback-approval-option-create {
  border-left-color: var(--green);
}

.feedback-approval-option-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.feedback-approval-option-head > i {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--blue);
}

.feedback-approval-option-create .feedback-approval-option-head > i {
  color: var(--green);
}

.feedback-approval-option-head h3,
.feedback-approval-option-head p {
  margin: 0;
}

.feedback-approval-option-head h3 {
  color: var(--text);
  font-size: 15px;
}

.feedback-approval-option-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.feedback-discussion {
  margin-top: 16px;
  overflow: hidden;
}

.feedback-comment-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feedback-comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.feedback-comment-meta strong {
  color: var(--text);
}

.feedback-comment-form {
  padding: 16px;
}

.attention-audit {
  margin-top: 16px;
}

.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.timeline li:first-child {
  border-top: 0;
}

.timeline span,
.timeline small {
  color: var(--muted);
}

.timeline p {
  margin: 2px 0 0;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
  font-style: normal;
  text-align: center;
}

.form-grid,
.form-stack {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attention-status-binding-form {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.form-grid label,
.form-stack label,
.form-grid .form-field,
.form-stack .form-field {
  display: grid;
  gap: 6px;
  color: var(--form-label);
  font-weight: 700;
}

.form-grid .form-field,
.form-stack .form-field {
  min-width: 0;
}

.form-grid .form-field > label,
.form-stack .form-field > label {
  display: block;
}

.form-grid .form-field > .form-option-label,
.form-stack .form-field > .form-option-label {
  display: flex;
}

.form-grid .form-field input,
.form-grid .form-field select,
.form-grid .form-field textarea,
.form-stack .form-field input,
.form-stack .form-field select,
.form-stack .form-field textarea {
  width: 100%;
}

.password-input-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.password-input-wrap input {
  padding-right: 46px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
  background: var(--hover-bg);
  color: var(--blue);
}

.password-visibility-toggle:focus-visible {
  outline: 3px solid rgba(20, 91, 214, 0.28);
  outline-offset: 1px;
}

.password-visibility-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.password-visibility-eye-off {
  display: none;
}

.password-visibility-toggle[aria-pressed="true"] .password-visibility-eye {
  display: none;
}

.password-visibility-toggle[aria-pressed="true"] .password-visibility-eye-off {
  display: block;
}

.form-grid .form-option-label,
.form-stack .form-option-label,
.form-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--form-label);
  font-weight: 700;
  cursor: pointer;
}

.form-option-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.field-help,
.section-help {
  color: var(--muted);
  font-weight: 600;
}

.field-help {
  font-size: 12px;
  line-height: 1.35;
}

.section-help {
  margin: 0 0 12px;
}

.masterdata-panel {
  max-width: 920px;
}

.contextual-notes-panel {
  display: grid;
  gap: 0;
}

.contextual-note-create,
.contextual-note-list {
  padding: 16px;
}

.contextual-note-create {
  border-bottom: 1px solid var(--line);
}

.contextual-note-list {
  display: grid;
  gap: 14px;
}

.contextual-note {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.contextual-note-archived {
  background: var(--surface-2);
}

.contextual-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contextual-note-head div,
.contextual-note-events {
  min-width: 0;
}

.contextual-note-head small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.contextual-note-events summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.contextual-note-empty {
  margin: 0;
}

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

.masterdata-form .errorlist,
.masterdata-form .form-actions,
.masterdata-duplicate-warning,
.masterdata-hidden-error,
.masterdata-field-wide,
.masterdata-option,
.access-edit-section {
  grid-column: 1 / -1;
}

.masterdata-duplicate-warning {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  background: var(--warning-panel-bg);
  color: var(--warning-text);
}

.masterdata-duplicate-warning strong,
.masterdata-duplicate-warning p,
.masterdata-duplicate-warning dl {
  margin: 0;
}

.masterdata-duplicate-warning span {
  font-weight: 800;
}

.masterdata-duplicate-warning dl {
  display: grid;
  gap: 6px;
}

.masterdata-duplicate-warning dl div {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.masterdata-duplicate-warning dt {
  color: var(--muted);
  font-weight: 800;
}

.masterdata-duplicate-warning dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.masterdata-duplicate-warning-copy {
  color: var(--warning-text);
  font-weight: 700;
}

.masterdata-duplicate-warning-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.access-edit-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin-top: 2px;
}

.access-edit-section h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.access-edit-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.access-edit-table th,
.access-edit-table td {
  white-space: normal;
  vertical-align: middle;
}

.access-edit-table thead th {
  border-top: 0;
}

.access-edit-table tbody th {
  width: 36%;
  color: var(--form-label);
  font-size: 13px;
}

.access-page-label,
.access-page-meta {
  display: block;
}

.access-page-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.access-edit-group-row th {
  width: auto;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.access-edit-table select {
  width: 100%;
  min-width: 180px;
}

.access-role-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.access-role-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.access-role-chip.inactive {
  color: var(--muted);
  text-decoration: line-through;
}

.access-role-checkbox-list {
  display: grid;
  gap: 8px;
}

.access-role-checkbox-list > div {
  display: grid;
  gap: 8px;
}

.access-role-checkbox-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--form-label);
  font-weight: 800;
}

.access-role-checkbox-list input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
}

.order-overview-wrap {
  max-height: calc(100vh - 280px);
}

.order-overview-wrap table {
  min-width: 3700px;
}

.order-overview-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.order-overview-form h2,
.order-overview-form .errorlist,
.order-overview-form .form-actions,
.order-overview-form .masterdata-field-wide {
  grid-column: 1 / -1;
}

.order-overview-form h2 {
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.order-overview-form h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.sales-order-group-form {
  display: grid;
  gap: 14px;
  max-width: 1440px;
}

.order-entry-page-head {
  max-width: 1440px;
}

.order-draft-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 1440px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.order-draft-notice svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--blue);
}

.order-draft-notice div {
  display: grid;
  gap: 2px;
}

.order-draft-notice span {
  color: var(--muted);
  font-size: 13px;
}

.order-entry-panel {
  overflow: hidden;
}

.order-entry-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.order-entry-panel-head > div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.order-entry-panel-head h2,
.order-entry-panel-head p {
  margin: 0;
}

.order-entry-panel-head h2 {
  color: var(--nav-heading);
  font-size: 16px;
}

.order-entry-panel-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.order-reference-preview {
  display: grid;
  flex: 0 1 360px;
  min-width: 240px;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.order-reference-preview span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.order-reference-preview strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.order-detail-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.order-field-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.order-field-section h3 {
  margin: 0;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--nav-heading);
  font-size: 12px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.order-field-table-wrap,
.order-main-field-wrap {
  width: 100%;
  min-width: 0;
}

.order-field-table {
  table-layout: fixed;
}

.order-field-table th,
.order-field-table td {
  padding: 6px 9px;
  white-space: normal;
}

.order-field-table tr:first-child > * {
  border-top: 0;
}

.order-field-table th {
  width: 34%;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  vertical-align: middle;
}

.order-field-table th label {
  display: inline;
  color: var(--form-label);
  font-size: 12px;
}

.order-field-table td {
  background: var(--surface);
}

.order-field-table input,
.order-field-table select,
.order-field-table textarea {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.order-field-table textarea,
.order-field-table textarea[rows="2"] {
  min-height: 54px;
}

.order-field-table td > small {
  display: block;
  margin-top: 3px;
  white-space: normal;
}

.order-field-table tr.has-error th,
.order-field-table tr.has-error td,
.suborder-edit-table td.has-error {
  background: var(--warning-panel-bg);
}

.order-main-field-wrap {
  max-width: 720px;
  padding: 14px;
}

.order-main-field-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  border-collapse: separate;
  border-spacing: 0;
}

.order-main-field-table th {
  width: 180px;
}

.order-part-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 42px;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-size: 12px;
  font-weight: 900;
}

.order-form-errors {
  padding: 10px 14px;
  border-bottom: 1px solid var(--warning-border);
  background: var(--warning-panel-bg);
  color: var(--warning-text);
}

.order-form-errors .errorlist {
  margin: 0;
}

.existing-order-table-wrap,
.suborder-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.existing-order-table,
.suborder-edit-table {
  min-width: 880px;
}

.existing-order-table th,
.existing-order-table td,
.suborder-edit-table th,
.suborder-edit-table td {
  padding: 8px 9px;
  vertical-align: middle;
}

.existing-order-table tbody th,
.suborder-edit-table tbody th {
  background: var(--surface);
}

.existing-order-actions,
.suborder-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.existing-order-actions .btn,
.suborder-row-actions .btn {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.existing-order-actions .btn svg,
.suborder-row-actions .btn svg {
  width: 14px;
  height: 14px;
}

.suborder-edit-table {
  table-layout: fixed;
}

.suborder-edit-table th:first-child {
  width: 90px;
}

.suborder-edit-table th:nth-child(4) {
  width: 150px;
}

.suborder-edit-table th:nth-child(5) {
  width: 180px;
}

.suborder-edit-table .suborder-actions-heading {
  width: 250px;
}

.suborder-edit-table input,
.suborder-edit-table select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.sales-order-group-form .errorlist {
  margin: 3px 0 0;
  padding: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  white-space: normal;
}

.suborder-edit-table td > .field-error,
.suborder-edit-table td > .errorlist {
  display: block;
  margin-top: 3px;
  white-space: normal;
}

.suborder-error-row td {
  padding: 7px 10px;
  background: var(--warning-panel-bg);
  color: var(--warning-text);
  white-space: normal;
}

.suborder-error-row .errorlist {
  margin: 0;
}

.suborder-empty-row td {
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

.suborder-empty-row strong,
.suborder-empty-row span {
  display: block;
}

.suborder-empty-row strong {
  margin-bottom: 2px;
  color: var(--text);
}

.suborder-remove-button {
  color: var(--red-dark);
}

.order-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--topbar-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

@media (max-width: 980px) {
  .order-detail-sections {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .order-entry-panel-head,
  .suborder-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .order-reference-preview {
    flex-basis: auto;
    min-width: 0;
  }

  .suborder-panel-head .btn {
    width: 100%;
  }

  .order-detail-sections,
  .order-main-field-wrap {
    padding: 10px;
  }

  .order-field-table th {
    width: 38%;
  }

  .existing-order-table-wrap,
  .suborder-table-wrap {
    overflow-x: visible;
  }

  .existing-order-table,
  .suborder-edit-table {
    display: block;
    min-width: 0;
  }

  .existing-order-table thead,
  .suborder-edit-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .existing-order-table tbody,
  .suborder-edit-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .existing-order-table tr,
  .suborder-edit-table tr {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }

  .existing-order-table th,
  .existing-order-table td,
  .suborder-edit-table th,
  .suborder-edit-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr);
    gap: 8px;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .existing-order-table th::before,
  .existing-order-table td::before,
  .suborder-edit-table th::before,
  .suborder-edit-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.35;
  }

  .existing-order-actions,
  .suborder-row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .suborder-edit-table td.suborder-row-actions {
    display: flex;
  }

  .suborder-edit-table td.suborder-row-actions::before {
    display: none;
  }

  .suborder-edit-table td > .field-error,
  .suborder-edit-table td > .errorlist {
    grid-column: 2;
  }

  .existing-order-actions .btn,
  .suborder-row-actions .btn {
    width: 100%;
  }

  .suborder-error-row td,
  .suborder-empty-row td {
    display: block;
  }

  .suborder-error-row td::before,
  .suborder-empty-row td::before {
    display: none;
  }

  .order-form-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }

  .order-form-actions .btn {
    width: 100%;
  }
}

.masterdata-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--form-label);
  font-weight: 700;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.required-marker {
  margin-left: 3px;
  color: var(--red);
  font-weight: 900;
}

.compact-icon-btn {
  width: 30px;
  min-height: 30px;
}

.field-clear-btn {
  min-height: 30px;
  padding: 5px 9px;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.field-clear-btn svg {
  width: 15px;
  height: 15px;
}

.order-status-help-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.order-status-help-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 25;
  display: none;
  width: min(340px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}

.order-status-help-wrap:hover .order-status-help-popover,
.order-status-help-wrap:focus-within .order-status-help-popover {
  display: grid;
  gap: 8px;
}

.order-status-help-row {
  display: grid;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.order-status-help-row strong {
  color: var(--form-label);
  font-size: 12px;
}

.muted-inline {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.schedule-builder {
  display: grid;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.schedule-builder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.schedule-builder h3,
.schedule-builder p {
  margin: 0;
}

.schedule-builder p,
.schedule-choice-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.schedule-preview {
  max-width: 560px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.schedule-builder.is-manual .schedule-preview {
  color: var(--muted);
}

.schedule-choice-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.schedule-choice-field legend {
  padding: 0;
  color: var(--form-label);
  font-weight: 850;
}

.schedule-choice-grid {
  display: grid;
  gap: 6px;
}

.schedule-choice-grid-hours {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.schedule-choice-grid-minutes {
  grid-template-columns: repeat(15, minmax(0, 1fr));
}

.schedule-choice-grid-weekdays {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.location-role-grid {
  grid-template-columns: repeat(var(--location-role-columns, 8), minmax(0, 1fr));
  gap: 4px;
}

.location-role-grid .schedule-choice,
.location-role-grid .schedule-choice span {
  min-height: 34px;
}

.location-role-grid .schedule-choice span {
  padding: 3px 4px;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.schedule-choice {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 38px;
  cursor: pointer;
}

.schedule-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.schedule-choice span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.schedule-choice input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--on-strong);
}

.schedule-choice input:focus-visible + span {
  outline: 3px solid rgba(20, 91, 214, 0.28);
  outline-offset: 2px;
}

.recipient-contact-pickers {
  display: grid;
  gap: 12px;
}

.recipient-contact-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.recipient-contact-picker legend {
  padding: 0;
  color: var(--form-label);
  font-weight: 850;
}

.recipient-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.recipient-contact-chip {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 42px;
  cursor: pointer;
}

.recipient-contact-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.recipient-contact-chip span {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.recipient-contact-chip input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--on-strong);
}

.recipient-contact-chip input:focus-visible + span {
  outline: 3px solid rgba(20, 91, 214, 0.28);
  outline-offset: 2px;
}

.masterdata-field input,
.masterdata-field select,
.masterdata-field textarea {
  width: 100%;
}

.masterdata-field small,
.masterdata-option-copy small {
  color: var(--muted);
  font-weight: 600;
}

.masterdata-option-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--form-label);
  font-weight: 700;
  cursor: pointer;
}

.masterdata-option-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.masterdata-option-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.feedback-file-field {
  display: grid;
  gap: 8px;
}

.file-capture-box {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 150px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.file-capture-box.is-dragover,
.file-capture-box:focus-visible {
  border-color: var(--blue);
  outline: 3px solid rgba(20, 91, 214, 0.18);
  outline-offset: 2px;
}

.file-capture-box > svg,
.file-capture-box > i {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.file-capture-box strong {
  font-size: 15px;
}

.file-capture-box small {
  max-width: 520px;
}

.file-capture-box input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.file-capture-list,
.attachment-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.file-capture-list[hidden] {
  display: none;
}

.file-capture-list li,
.attachment-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.attachment-list li {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.file-capture-list span,
.attachment-list a,
.attachment-list small {
  min-width: 0;
}

.file-capture-list span {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}

.attachment-list small {
  color: var(--muted);
  font-weight: 700;
}

.modal-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.portal-reminder-card {
  gap: 18px;
}

.portal-reminder-message {
  margin: 0;
  white-space: pre-line;
  color: var(--muted);
  line-height: 1.55;
}

.portal-reminder-actions,
.portal-reminder-snooze-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.portal-reminder-actions {
  justify-content: flex-end;
}

.portal-reminder-snooze-form select,
.portal-reminder-snooze-form input {
  min-height: 38px;
}

.portal-reminder-help {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

@media (max-width: 640px) {
  .document-chase-filter-tools {
    grid-template-columns: 1fr;
  }

  .document-chase-filter-tools .search {
    grid-column: auto;
  }

  .document-tracker-filter-actions,
  .document-tracker-filter-actions .btn {
    width: 100%;
  }

  .document-tracker-filter-actions {
    display: grid;
  }

  .portal-reminder-actions,
  .portal-reminder-snooze-form,
  .portal-reminder-actions > form,
  .portal-reminder-actions .btn,
  .portal-reminder-snooze-form label,
  .portal-reminder-snooze-form select,
  .portal-reminder-snooze-form input {
    width: 100%;
  }

  .portal-reminder-help {
    text-align: left;
  }
}

.feedback-image-preview-dialog {
  width: min(920px, calc(100vw - 32px));
}

.feedback-image-preview-card {
  gap: 14px;
}

.feedback-image-preview-frame {
  display: grid;
  place-items: center;
  min-height: 220px;
  max-height: min(68vh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.feedback-image-preview-frame img {
  display: block;
  max-width: 100%;
  max-height: min(64vh, 640px);
  object-fit: contain;
}

input,
select,
textarea {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.sa-date-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.form-grid .form-field .sa-date-control,
.form-stack .form-field .sa-date-control,
.form-grid label .sa-date-control,
.form-stack label .sa-date-control {
  width: 100%;
}

.sa-date-control .sa-date-display {
  flex: 1 1 auto;
  min-width: 0;
}

.sa-date-picker-button {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-height: 40px;
}

.sa-date-native {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

textarea[rows="2"] {
  min-height: 74px;
}

.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.inline-check input {
  flex: 0 0 auto;
  margin-top: 3px;
}

.field-error {
  color: var(--red);
  font-weight: 700;
}

.detail-list {
  padding: 18px;
}

.document-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.document-detail-grid > * {
  min-width: 0;
}

.document-detail-grid .full-span {
  grid-column: 1 / -1;
}

.stock-reserved-resolution {
  margin-bottom: 16px;
  border-color: var(--amber);
}

.stock-reserved-resolution-head {
  align-items: flex-start;
}

.stock-reserved-resolution-head .section-help {
  max-width: 76ch;
  margin: 5px 0 0;
}

.stock-reserved-resolution-metrics small {
  color: var(--muted);
  font-size: 12px;
}

.stock-reserved-resolution-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.technical-import-details-body {
  display: block;
  padding-top: 16px;
}

.staging-evidence-body {
  display: block;
  padding-top: 16px;
}

.staging-evidence-body > .section-help {
  max-width: 78ch;
}

.staging-outcomes {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.staging-outcomes h3 {
  margin: 0;
  font-size: 13px;
}

.staging-evidence-table td {
  vertical-align: top;
}

.staging-evidence-table td > strong,
.staging-evidence-table td > small {
  display: block;
}

.staging-evidence-table td > small {
  margin-top: 5px;
  color: var(--muted);
}

.staging-value-list {
  display: grid;
  grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
  gap: 5px 12px;
  margin: 0;
}

.staging-value-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.staging-value-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .help-panel.staging-evidence > summary {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .help-panel.staging-evidence > summary small {
    order: 3;
    width: 100%;
  }

  .staging-value-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .staging-value-list dd + dt {
    margin-top: 6px;
  }
}

@media (max-width: 640px) {
  .stock-reserved-resolution-head {
    align-items: stretch;
    flex-direction: column;
  }
}

.upload-progress-panel {
  display: grid;
  gap: 16px;
}

.upload-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.upload-progress-head h2 {
  margin: 0 0 6px;
}

.upload-progress-head .status {
  margin-top: 2px;
  margin-left: 0;
  white-space: nowrap;
}

.upload-progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-progress-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.upload-progress-step-marker {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--neutral-bg);
}

.upload-progress-steps strong {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 6px;
}

.upload-progress-steps .status {
  margin-left: 0;
}

.upload-progress-steps p,
.upload-progress-note {
  margin: 8px 0 0;
  color: var(--muted);
}

.upload-progress-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-progress-attempt {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.upload-progress-attempt > summary {
  cursor: pointer;
  font-weight: 700;
}

.upload-progress-events {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.upload-progress-events p {
  margin: 3px 0 0;
}

/* Historical opening-order reconstruction. */
.historical-rebuild-shell {
  display: grid;
  gap: 16px;
}

.historical-rebuild-control .panel-head,
.historical-rebuild-owner-gate .panel-head,
.historical-rebuild-start .panel-head,
.historical-rebuild-lines .panel-head,
.historical-rebuild-shell > .panel > .panel-head {
  align-items: flex-start;
}

.historical-rebuild-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.historical-rebuild-metrics > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.historical-rebuild-metrics span,
.historical-rebuild-order-card p {
  color: var(--muted);
}

.historical-rebuild-metrics strong {
  font-size: 24px;
}

.historical-rebuild-order-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.historical-rebuild-order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.historical-rebuild-card-title,
.historical-rebuild-ready {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.historical-rebuild-order-card p {
  margin: 5px 0 0;
}

.historical-rebuild-steps li.is-current {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--neutral-bg);
}

.historical-rebuild-steps li.is-complete {
  background: var(--success-bg);
}

@media (max-width: 760px) {
  .historical-rebuild-metrics,
  .historical-rebuild-steps {
    grid-template-columns: 1fr;
  }

  .historical-rebuild-order-card {
    align-items: stretch;
    flex-direction: column;
  }
}

.historical-rebuild-form,
.historical-rebuild-owner-gate form,
.historical-rebuild-start form,
.historical-rebuild-activation-form {
  padding: 0 16px 16px;
}

.historical-rebuild-actions,
.historical-rebuild-ready,
.historical-rebuild-review-note,
.historical-rebuild-adjustment {
  margin: 16px;
}

.historical-rebuild-evidence-row td {
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-soft);
}

.historical-rebuild-cross-check-form input[type="number"] {
  min-width: 110px;
}

.historical-rebuild-review-note {
  display: grid;
  gap: 6px;
}

.historical-rebuild-adjustment {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.historical-rebuild-adjustment summary {
  cursor: pointer;
  font-weight: 700;
}

.historical-rebuild-ready {
  padding: 12px;
  border: 1px solid var(--success);
  border-radius: 8px;
  background: var(--success-bg);
}

.detail-list dl {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px 18px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
}

.detected-values-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.detected-values-grid h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.value-list,
.issue-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.value-list li,
.issue-list li {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.value-list span,
.value-list small,
.issue-list small {
  color: var(--muted);
}

.inline-value-list {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.issue-list .status {
  vertical-align: middle;
}

.upload-audit-list {
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding-right: 4px;
}

.audit-change-list {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 4px 10px;
  margin: 4px 0;
}

.audit-change-list dt {
  color: var(--muted);
  font-weight: 800;
}

.audit-change-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.ai-suggestion-values {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 12px;
  margin: 8px 0 0;
}

.ai-suggestion-values dt {
  color: var(--muted);
  font-weight: 800;
}

.ai-suggestion-values dd {
  margin: 0;
}

.inline-review-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.inline-review-form label {
  display: grid;
  gap: 4px;
}

.inline-review-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-history {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.decision-history > strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.decision-history ul {
  display: grid;
  gap: 6px;
  list-style: none;
}

.decision-history li {
  border-left: 3px solid var(--border);
  display: grid;
  gap: 3px;
  padding-left: 10px;
}

.decision-history p {
  margin: 0;
}

.system-detail-list code {
  overflow-wrap: anywhere;
}

/* Director-ready account of the portal journey. */
.portal-journey-summary,
.portal-journey-intro,
.portal-journey-position,
.portal-journey-maintenance {
  margin-bottom: 16px;
}

.portal-journey-summary .panel-head,
.portal-journey-intro .panel-head,
.portal-journey-position .panel-head,
.portal-journey-maintenance .panel-head {
  align-items: flex-start;
}

.portal-journey-summary .panel-head p,
.portal-journey-intro .panel-head p,
.portal-journey-position .panel-head p,
.portal-journey-maintenance .panel-head p {
  max-width: 82ch;
}

.portal-journey-metrics,
.portal-journey-three-column {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.portal-journey-metrics > div,
.portal-journey-three-column > div {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.portal-journey-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.portal-journey-metrics strong {
  overflow-wrap: anywhere;
  font-size: clamp(21px, 2.1vw, 30px);
  line-height: 1.05;
}

.portal-journey-metrics small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.portal-journey-live-note {
  margin: 0;
  padding: 0 16px 16px;
}

.portal-journey-three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-journey-three-column h3,
.portal-journey-three-column p {
  margin: 0;
}

.portal-journey-three-column h3 {
  font-size: 15px;
}

.portal-journey-three-column p {
  color: var(--muted);
  line-height: 1.5;
}

.portal-journey-story {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.portal-journey-story-head {
  padding: 4px 2px;
}

.portal-journey-story-head h2,
.portal-journey-story-head p,
.portal-journey-chapter h3,
.portal-journey-chapter p {
  margin: 0;
}

.portal-journey-story-head p,
.portal-journey-chapter > div > p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.portal-journey-chapter {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
}

.portal-journey-chapter-marker {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 800;
}

.portal-journey-chapter ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 20px;
  line-height: 1.5;
}

.portal-journey-chapter li::marker {
  color: var(--primary);
}

.portal-journey-maintenance p {
  max-width: 82ch;
  margin: 0;
  padding: 0 16px 16px;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .portal-journey-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-journey-three-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portal-journey-metrics {
    grid-template-columns: 1fr;
  }

  .portal-journey-chapter {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.change-history-table .change-message {
  min-width: 240px;
  white-space: normal;
}

.change-history-table code,
.system-change-details code {
  overflow-wrap: anywhere;
  white-space: normal;
}

.system-change-details {
  min-width: 280px;
  white-space: normal;
}

.system-change-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

.system-change-details dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 10px 0 0;
}

.system-change-details dt {
  color: var(--muted);
  font-weight: 800;
}

.system-change-details dd {
  margin: 0;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-weight: 700;
}

.message.success {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--green);
}

.message.error {
  border-color: var(--red);
  background: var(--red-bg);
  color: var(--red);
}

.portal-assistant {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: grid;
  justify-items: end;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
}

.portal-assistant-toggle {
  display: inline-grid;
  place-items: center;
  width: 46px;
  min-height: 46px;
  padding: 0;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: var(--on-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0;
}

.portal-assistant-toggle:hover {
  background: var(--blue-dark);
  color: var(--on-strong);
}

.portal-assistant-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.portal-assistant-fab {
  position: relative;
  display: inline-grid;
}

.portal-assistant-dismiss {
  position: absolute;
  isolation: isolate;
  top: -7px;
  right: -7px;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.portal-assistant-dismiss svg {
  width: 12px;
  height: 12px;
}

.portal-assistant-dismiss:hover {
  border-color: var(--red);
  color: var(--red);
}

.portal-assistant-dismiss:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.portal-assistant.is-fab-hidden .portal-assistant-fab {
  display: none;
}

.portal-assistant-history-divider {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-assistant-history-day {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-assistant-history-item {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.portal-assistant-history-item .portal-assistant-message {
  margin: 6px 0 0;
}

.portal-assistant-history-search {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  max-width: 520px;
}

.portal-assistant-history-search input[type="search"] {
  flex: 1;
  min-width: 0;
}

.portal-assistant-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
}

.portal-assistant-rating-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.portal-assistant-rating-button svg {
  width: 15px;
  height: 15px;
}

.portal-assistant-rating-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.portal-assistant-rating-button.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--on-strong);
}

.portal-assistant-rating-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.portal-assistant-rating-comment-row {
  display: flex;
  flex: 1 1 100%;
  gap: 8px;
}

.portal-assistant-rating-comment-row input {
  flex: 1;
  min-width: 0;
}

.portal-assistant-rating-status {
  color: var(--muted);
  font-size: 0.82rem;
}

.portal-assistant-review-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.portal-assistant-review-filters label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.portal-assistant-review-facts {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 14px;
  padding: 14px;
  margin: 0;
}

.portal-assistant-review-facts dt {
  color: var(--muted);
}

.portal-assistant-review-facts dd {
  margin: 0;
}

.portal-assistant-panel {
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 32px));
  height: min(660px, calc(100dvh - 112px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.portal-assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.portal-assistant-head h2,
.portal-assistant-head p {
  margin: 0;
}

.portal-assistant-head h2 {
  font-size: 17px;
}

.portal-assistant-head p {
  color: var(--muted);
  font-size: 12px;
}

.portal-assistant-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.portal-assistant-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 0;
  padding: 24px 18px;
  overflow-y: auto;
  text-align: center;
}

.portal-assistant-empty[hidden] {
  display: none;
}

.portal-assistant-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--nav-active-bg);
  color: var(--blue);
}

.portal-assistant-empty-icon svg {
  width: 23px;
  height: 23px;
}

.portal-assistant-note {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
}

.portal-assistant-shortcuts {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
}

.portal-assistant-shortcuts summary {
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.portal-assistant-shortcuts[open] summary {
  border-bottom: 1px solid var(--line);
}

.portal-assistant-composer {
  display: grid;
  gap: 7px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.portal-assistant-form {
  display: grid;
  gap: 5px;
}

.portal-assistant-form > label {
  font-size: 13px;
  font-weight: 800;
}

.portal-assistant-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.portal-assistant-input-row textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 68px;
  max-height: 160px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
}

.portal-assistant-input-row textarea:focus-visible {
  border-color: var(--blue);
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.portal-assistant-input-row .btn {
  min-height: 44px;
  border-radius: 9px;
}

.portal-assistant-input-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.portal-assistant-status {
  margin: 0;
  min-height: 17px;
  color: var(--muted);
  font-size: 12px;
}

.portal-assistant-conversation {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.portal-assistant-conversation[hidden] {
  display: none;
}

.portal-assistant-message {
  display: grid;
  align-self: flex-start;
  gap: 5px;
  max-width: 90%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
}

.portal-assistant-message.is-user {
  align-self: flex-end;
  background: var(--nav-active-bg);
}

.portal-assistant-message.is-assistant {
  margin-right: 10%;
}

.portal-assistant-message strong {
  font-size: 12px;
}

.portal-assistant-message p {
  margin: 0;
  white-space: pre-wrap;
}

.portal-assistant-citations {
  display: grid;
  gap: 4px;
  margin: 2px 0 0;
  padding-left: 18px;
  font-size: 12px;
}

.portal-assistant-citations a {
  font-weight: 800;
}

.portal-assistant-citations span {
  color: var(--muted);
}

.portal-assistant-citations span.is-stale {
  color: var(--red);
  font-weight: 800;
}

.portal-assistant-boundary {
  margin: 0 10px 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.portal-assistant-boundary a {
  font-weight: 800;
}

.portal-assistant-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
}

.portal-assistant-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.portal-assistant-links a:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

code {
  display: inline-block;
  max-width: 480px;
  overflow: hidden;
  color: var(--code-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--login-bg);
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card.wide {
  width: min(100%, 560px);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.login-logo {
  width: 170px;
  max-width: 100%;
  height: auto;
  margin-bottom: 16px;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.landing-page {
  min-height: 100vh;
  background: #0b1118;
  color: #fff;
}

.landing-hero {
  position: relative;
  display: grid;
  /* Without an explicit minmax(0, ...) the single auto track is floored at the nav's
     min-content width, which overflows the padding box on a phone. */
  grid-template-columns: minmax(0, 1fr);
  min-height: 74vh;
  padding: 24px clamp(18px, 4vw, 64px) 72px;
  background:
    linear-gradient(90deg, rgba(6, 13, 22, 0.92) 0%, rgba(6, 13, 22, 0.72) 38%, rgba(6, 13, 22, 0.15) 100%),
    var(--hero-image) center / cover no-repeat;
}

.landing-nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  /* min-height, not height: below roughly 340px the brand and the button wrap onto two
     rows and a fixed height would clip the second one. */
  min-height: 54px;
}

.landing-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: 0;
}

.landing-brand img {
  width: 150px;
  height: auto;
  padding: 5px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
}

.landing-brand:hover {
  color: #fff;
}

.btn-light {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}

.btn-light:hover {
  border-color: var(--blue);
  background: var(--hover-bg);
  color: var(--blue);
}

.landing-page .btn-light {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(8px);
}

.landing-page .btn-light:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-large {
  min-height: 46px;
  padding: 11px 18px;
}

.landing-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  min-width: 0;
  max-width: 720px;
  padding: 54px 0 12px;
}

.landing-copy h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(40px, 5vw, 74px);
  line-height: 0.98;
  letter-spacing: 0;
}

.landing-copy p {
  max-width: 610px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.65;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.landing-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: #263241;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.landing-feature {
  min-height: 210px;
  padding: 34px clamp(20px, 4vw, 46px);
  background: #101923;
}

.landing-feature svg {
  width: 28px;
  height: 28px;
  color: #4f8cff;
}

.landing-feature h2 {
  margin: 18px 0 8px;
  font-size: 18px;
}

.landing-feature p {
  margin: 0;
  max-width: 420px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  line-height: 1.65;
}

.rescue-as-of {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.dashboard-opening-state {
  max-width: 760px;
  padding: clamp(24px, 4vw, 40px);
}

.dashboard-opening-state-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--neutral-bg);
  color: var(--blue);
}

.dashboard-opening-state-mark svg {
  width: 22px;
  height: 22px;
}

.dashboard-opening-state h2 {
  margin: 18px 0 8px;
  font-size: 20px;
}

.dashboard-opening-state p {
  max-width: 580px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

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

.dashboard-active-state {
  max-width: 880px;
  padding: clamp(22px, 3vw, 32px);
}

.dashboard-active-state-copy {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.dashboard-active-state h2 {
  margin: 2px 0 8px;
  font-size: 22px;
}

.dashboard-active-state p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-advanced-detail {
  margin-top: 14px;
}

.dashboard-advanced-detail:not([open]) {
  max-width: 880px;
}

.dashboard-advanced-detail > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px;
  color: var(--muted);
  cursor: pointer;
}

.dashboard-advanced-detail > summary span {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.dashboard-advanced-detail > summary strong {
  color: var(--text);
  font-weight: 700;
}

.dashboard-advanced-detail > summary svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  transition: transform 160ms ease;
}

.dashboard-advanced-detail[open] > summary svg {
  transform: rotate(180deg);
}

.dashboard-advanced-body {
  padding-top: 12px;
}

@media (max-width: 640px) {
  .dashboard-active-state-copy,
  .dashboard-advanced-detail > summary span {
    align-items: flex-start;
    flex-direction: column;
  }
}

.rescue-warning-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.rescue-warning-list p {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  background: var(--warning-panel-bg);
  color: var(--warning-text);
  font-size: 13px;
  line-height: 1.45;
}

.rescue-warning-list svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.rescue-metric-grid,
.rescue-control-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

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

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

.rescue-metric,
.rescue-control {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

a.rescue-metric:hover,
a.rescue-control:hover,
a.rescue-status-card:hover {
  border-color: var(--blue);
  color: var(--text);
}

.rescue-metric > span,
.rescue-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.rescue-metric strong,
.rescue-control strong {
  overflow-wrap: anywhere;
  font-size: clamp(21px, 2.1vw, 30px);
  line-height: 1.05;
}

.rescue-metric small,
.rescue-control small,
.rescue-status-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.rescue-metric-primary {
  border-top: 3px solid var(--blue);
  padding-top: 12px;
}

.rescue-control-critical {
  border-top: 3px solid var(--red);
  padding-top: 12px;
}

.rescue-status-panel,
.rescue-two-column {
  margin-bottom: 14px;
}

.rescue-status-panel .panel-head > div,
.rescue-freshness-panel .panel-head > div,
.rescue-change-panel .panel-head > div,
.rescue-attention-panel .panel-head > div {
  display: grid;
  gap: 3px;
}

.rescue-status-panel .panel-head p,
.rescue-freshness-panel .panel-head p,
.rescue-change-panel .panel-head p,
.rescue-attention-panel .panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.rescue-status-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(105px, 1fr));
}

.rescue-status-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.rescue-status-card:last-child {
  border-right: 0;
}

.rescue-status-card svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.rescue-status-card > span {
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
}

.rescue-status-card strong,
.rescue-status-card small {
  grid-column: 1 / -1;
}

.rescue-status-card strong {
  font-size: 21px;
}

.rescue-status-delayed svg,
.rescue-status-awaiting_pod svg {
  color: var(--amber);
}

.rescue-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rescue-freshness-list {
  display: grid;
}

.rescue-freshness-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(128px, auto);
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.rescue-freshness-row:last-child {
  border-bottom: 0;
}

a.rescue-freshness-row:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.rescue-freshness-row > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rescue-freshness-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rescue-freshness-row time {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.rescue-freshness-state {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.rescue-freshness-warning {
  background: var(--amber-bg);
  color: var(--amber);
}

.rescue-freshness-never,
.rescue-freshness-problem {
  background: var(--red-bg);
  color: var(--red-dark);
}

.rescue-change-source {
  display: grid;
  gap: 4px;
  padding: 14px 16px 8px;
}

.rescue-change-source > span,
.rescue-change-source small {
  color: var(--muted);
  font-size: 12px;
}

.rescue-change-list {
  display: grid;
  gap: 7px;
  margin: 4px 16px 16px;
  padding-left: 20px;
}

.rescue-table {
  min-width: 600px;
}

.rescue-table td {
  vertical-align: top;
}

.rescue-table td > a,
.rescue-table td:first-child {
  display: grid;
  gap: 2px;
}

.rescue-table td small {
  display: block;
  color: var(--muted);
}

.rescue-existing-detail {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.rescue-existing-detail > summary {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.rescue-existing-detail > summary::-webkit-details-marker {
  display: none;
}

.rescue-existing-detail > summary svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.rescue-existing-detail > summary small {
  color: var(--muted);
  font-weight: 400;
}

.rescue-existing-detail > .dashboard-grid {
  padding: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand {
    font-size: 0;
  }

  .brand-logo-wide {
    display: none;
  }

  .brand-logo-icon {
    display: block;
  }

  .nav-stack a,
  .quick-upload a {
    justify-content: center;
    padding: 10px;
    font-size: 0;
  }

  .nav-stack {
    gap: 10px;
    padding: 10px 12px 14px;
  }

  .nav-section,
  .nav-subsections,
  .nav-subgroup {
    gap: 4px;
  }

  .nav-group-toggle {
    justify-content: center;
    min-height: 36px;
    padding: 8px;
  }

  .nav-group-toggle span,
  .nav-group-chevron,
    .nav-subgroup-heading {
    display: none;
  }

  .quick-upload p,
  .sidebar-foot {
    display: none;
  }

  .user-copy {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .document-detail-grid {
    grid-template-columns: 1fr;
  }

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

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

  .attention-detail-grid {
    grid-template-columns: 1fr;
  }

  .map-layout {
    grid-template-columns: 1fr;
  }

  .map-side-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .loading-summary-filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .loading-summary-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .executive-loading-head {
    align-items: stretch;
    flex-direction: column;
  }

  .executive-loading-head > a {
    width: fit-content;
  }

  .loading-summary-filters,
  .loading-summary-kpis,
  .loading-summary-coverage,
  .loading-summary-breakdowns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loading-summary-breakdowns {
    grid-template-columns: 1fr;
  }

  .loading-summary-actions {
    grid-column: 1 / -1;
  }

  .app-shell {
    display: block;
  }

  .sidebar-collapsed .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: 100vh;
    overflow-y: visible;
  }

  .brand {
    height: 58px;
    justify-content: flex-start;
    flex: 1;
    font-size: 0;
  }

  .brand-row {
    justify-content: space-between;
    flex-direction: row;
    min-height: 58px;
    padding: 0 12px;
  }

  .sidebar-collapsed .brand-row {
    justify-content: space-between;
    flex-direction: row;
  }

  .sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .brand-logo-wide {
    display: block;
    width: 136px;
  }

  .brand-logo-icon {
    display: none;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .nav-stack {
    display: none;
    gap: 16px;
    max-height: calc(100vh - 58px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 12px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    scrollbar-gutter: stable;
  }

  .sidebar-collapsed .nav-search {
    display: grid;
  }

  .mobile-nav-open .nav-stack {
    display: grid;
  }

  .nav-section,
  .nav-subsections,
  .nav-subgroup {
    display: grid;
  }

  .nav-section {
    gap: 8px;
  }

  .nav-subsections {
    gap: 9px;
  }

  .nav-subgroup {
    gap: 3px;
  }

  .nav-group-toggle {
    display: flex;
    justify-content: flex-start;
    min-height: 34px;
    padding: 6px 8px;
  }

  .nav-group-toggle span,
  .nav-group-chevron {
    display: inline;
  }

  .nav-subgroup-heading {
    display: block;
  }

  .nav-subgroup-toggle {
    display: flex;
  }

  .nav-stack a {
    justify-content: flex-start;
    min-height: 40px;
    padding: 9px 10px;
    font-size: 13px;
    flex-direction: row;
    gap: 12px;
  }

  .sidebar-collapsed .nav-stack a {
    justify-content: flex-start;
    font-size: 13px;
  }

  .quick-upload,
  .sidebar-foot {
    display: none;
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
  }

  .top-field {
    display: none;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-left: 0;
  }

  .user-pill {
    max-width: none;
  }

  .content {
    padding: 14px;
  }

  .kpi-grid,
  .action-list,
  .attention-summary,
  .exception-grid,
  .executive-loading-strip {
    grid-template-columns: 1fr 1fr;
  }

  .feedback-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-board-grid {
    grid-template-columns: 1fr;
  }

  .task-column-scroll .task-card-list {
    max-height: min(60vh, 620px);
  }

  .reminder-actions,
  .reminder-snooze-form {
    align-items: stretch;
    flex-direction: column;
  }

  .reminder-snooze-form label {
    min-width: 0;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .help-panel summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .help-content {
    grid-template-columns: 1fr;
  }

  .column-preference-grid,
  .column-order-list,
  .order-overview-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-order-parent-fields .masterdata-field select {
    width: 100%;
    min-width: 0;
  }

  .schedule-builder-head {
    display: grid;
  }

  .schedule-preview {
    max-width: none;
  }

  .schedule-choice-grid-hours {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .schedule-choice-grid-minutes {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .location-role-grid {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 6px;
  }

  .location-role-grid .schedule-choice,
  .location-role-grid .schedule-choice span {
    min-height: 38px;
  }

  .location-role-grid .schedule-choice span {
    padding: 0;
    font-size: inherit;
    line-height: normal;
  }

  .tracking-map-canvas {
    min-height: 360px;
  }

  .map-side-panel {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    min-height: 68vh;
    padding-bottom: 52px;
    background:
      linear-gradient(180deg, rgba(6, 13, 22, 0.94) 0%, rgba(6, 13, 22, 0.76) 55%, rgba(6, 13, 22, 0.34) 100%),
      var(--hero-image) center / cover no-repeat;
  }

  .landing-brand {
    font-size: 20px;
  }

  .landing-brand img {
    width: 104px;
  }

  .landing-copy h1 {
    font-size: 42px;
  }

  .landing-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar .theme-toggle {
    display: none;
  }

  .portal-assistant {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 32px);
  }

  /* On a phone the panel is a bottom sheet rather than a floating card: it
     spans the width, sits above the home indicator, scrolls internally, and
     keeps the page behind it still. Heights use dvh because iOS counts the
     collapsing address bar in vh, which pushed the composer off screen. */
  body.has-assistant-sheet {
    overflow: hidden;
  }

  .portal-assistant.is-open {
    position: fixed;
    inset: 0;
    max-width: none;
    display: block;
    z-index: 950;
  }

  .portal-assistant.is-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
  }

  .portal-assistant.is-open .portal-assistant-fab {
    display: none;
  }

  .portal-assistant-panel {
    width: 100%;
  }

  .portal-assistant.is-open .portal-assistant-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 88vh;
    height: 88dvh;
    max-height: 88vh;
    max-height: 88dvh;
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
  }

  .portal-assistant.is-open .portal-assistant-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .portal-assistant.is-open .portal-assistant-head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
    transform: translateX(-50%);
  }

  .portal-assistant-body {
    flex: 1;
    min-height: 0;
    max-height: none;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .portal-assistant-composer {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* 16px keeps iOS from zooming the page when the field takes focus. */
  .portal-assistant-input-row textarea {
    min-height: 64px;
    font-size: 16px;
  }

  .portal-assistant-input-row .btn {
    min-height: 46px;
  }

  .portal-assistant-links a {
    min-height: 46px;
  }

  .portal-assistant-close-target,
  .portal-assistant-head .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .portal-assistant-dismiss {
    width: 30px;
    height: 30px;
    top: -9px;
    right: -9px;
  }

  /* The badge is small by design, so extend its touch area to the iOS minimum
     without changing how it looks. */
  .portal-assistant-dismiss::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }

  .portal-assistant-rating-button {
    width: 40px;
    height: 40px;
  }

  .portal-assistant-rating-comment-row input {
    min-height: 44px;
    font-size: 16px;
  }

  .breadcrumb-list {
    gap: 4px;
  }

  .breadcrumb-link,
  .breadcrumb-current {
    max-width: 148px;
  }

  .breadcrumb-menu-list {
    right: 0;
    left: auto;
  }

  .orders-overview-colour-key {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .orders-overview-colour-key-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    white-space: normal;
  }

  .orders-overview-colour-key-items {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

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

  .table-wrap-sticky {
    max-height: none;
    overflow: visible;
  }

  .orders-overview-wrap,
  .order-detail-section .table-wrap {
    overflow-x: auto;
  }

  /* Tracker tables opt out of card stacking, so their dedicated wrappers must retain
     horizontal scrolling when the generic mobile table wrapper becomes visible. */
  .document-tracker-wrap,
  .document-tracker-queue-wrap,
  .needs-action-table-wrap {
    max-height: min(72vh, 58rem);
    overflow: auto;
  }

  .table-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .table-wrap table.responsive-table {
    display: block;
    width: 100%;
  }

  .table-wrap table.responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .table-wrap table.responsive-table.has-visible-table-filters thead {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: 0;
  }

  .table-wrap table.responsive-table.has-visible-table-filters thead tr:not(.table-column-filter-row) {
    display: none;
  }

  .table-wrap table.responsive-table.has-visible-table-filters .table-column-filter-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }

  .table-wrap table.responsive-table.has-visible-table-filters .table-column-filter-row th {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .table-wrap table.responsive-table.has-visible-table-filters .table-column-filter-row th::before {
    display: none;
  }

  .table-wrap-sticky table.responsive-table thead th {
    position: static;
    box-shadow: none;
  }

  .table-wrap table.responsive-table tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .table-wrap table.responsive-table tr {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }

  .table-wrap table.responsive-table td,
  .table-wrap table.responsive-table th {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table-wrap table.responsive-table td::before,
  .table-wrap table.responsive-table th::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.35;
  }

  .table-wrap table.responsive-table td:not([data-label])::before,
  .table-wrap table.responsive-table th:not([data-label])::before {
    display: none;
  }

  .table-wrap table.responsive-table tr.responsive-table-full-row td,
  .table-wrap table.responsive-table tr.responsive-table-full-row th,
  .table-wrap table.responsive-table tr.responsive-table-empty-row td,
  .table-wrap table.responsive-table tr.responsive-table-empty-row th {
    grid-template-columns: 1fr;
  }

  .table-wrap table.responsive-table .empty {
    text-align: left;
  }

  .table-wrap table.responsive-table .status {
    width: fit-content;
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .loading-summary-filters,
  .loading-summary-kpis,
  .loading-summary-coverage {
    grid-template-columns: 1fr;
  }

  .loading-summary-actions,
  .loading-summary-source,
  .loading-summary-presets {
    align-items: stretch;
    flex-direction: column;
  }

  .loading-summary-actions .btn,
  .loading-summary-presets .btn {
    width: 100%;
  }

  .loading-summary-coverage > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .loading-summary-bar-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .kpi-grid,
  .action-list,
  .attention-summary,
  .exception-grid,
  .stock-movement-summary,
  .stock-gap-summary {
    grid-template-columns: 1fr;
  }

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

  .table-tools,
  .tabs {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .table-tools > label:not(.search),
  .table-tools .search,
  .table-tools .btn {
    width: 100%;
    min-width: 0;
  }

  .table-tools input,
  .table-tools select {
    width: 100%;
  }

  .table-filter-toolbar {
    padding: 8px 12px;
  }

  /* .table-tools stacks at this width, so the mounted controls become a full-width row
     under Filter and Reset rather than a right-aligned inline group. */
  .table-filter-toolbar-inline {
    align-self: stretch;
    justify-content: flex-start;
    min-width: 0;
    /* The desktop cap keeps the control beside Filter/Reset; stacked, it should fill the row. */
    max-width: none;
    padding: 0;
    width: 100%;
  }

  .table-filter-toolbar-inline .table-filter-compact-form {
    flex-wrap: wrap;
    width: 100%;
  }

  .table-filter-mount {
    margin-left: 0;
  }

  .table-filter-compact-form {
    align-items: center;
  }

  .table-filter-toggle {
    align-self: flex-start;
    flex: 0 0 40px;
  }

  .upload-progress-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-progress-steps {
    grid-template-columns: 1fr;
  }

  .table-filter-global {
    flex: 1 1 calc(100% - 56px);
    min-width: 0;
    max-width: none;
  }

  .table-filter-clear {
    width: 100%;
  }

  .table-filter-count {
    flex: 1 1 100%;
    white-space: normal;
  }

  .column-preference-grid,
  .column-order-list,
  .order-overview-form {
    grid-template-columns: 1fr;
  }

  .schedule-choice-grid-hours,
  .schedule-choice-grid-minutes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .detail-list dl {
    grid-template-columns: 1fr;
  }

  .long-text {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-actions .btn {
    max-width: 100%;
    white-space: normal;
  }

  .detected-values-grid {
    grid-template-columns: 1fr;
  }

  .system-change-details dl {
    grid-template-columns: 1fr;
  }

  .stock-gap-warning-panel summary,
  .stock-gap-warning-line {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .stock-gap-warning-panel summary {
    flex-direction: column;
  }

  .stock-gap-warning-actions {
    justify-content: stretch;
  }

  .stock-gap-management-cell {
    min-width: 0;
  }

  .stock-gap-form-grid {
    grid-template-columns: 1fr;
  }

  .stock-gap-row-form .btn {
    justify-self: stretch;
  }

  .masterdata-form {
    grid-template-columns: 1fr;
  }

  .access-edit-table {
    display: block;
  }

  .access-edit-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .access-edit-table tbody {
    display: grid;
    gap: 0;
  }

  .access-edit-table tr {
    display: grid;
    grid-template-columns: minmax(96px, 0.4fr) minmax(0, 1fr);
  }

  .access-edit-table th,
  .access-edit-table td {
    display: grid;
    align-items: center;
    min-width: 0;
    padding: 10px;
  }

  .access-edit-table tbody th {
    width: auto;
  }

  .access-edit-table select {
    min-width: 0;
  }
}

@media (max-width: 1180px) {
  .rescue-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rescue-status-grid {
    grid-template-columns: repeat(4, minmax(105px, 1fr));
  }

  .rescue-status-card:nth-child(4) {
    border-right: 0;
  }

  .rescue-status-card:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 860px) {
  .rescue-metric-grid,
  .rescue-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rescue-two-column {
    grid-template-columns: 1fr;
  }

  .rescue-freshness-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .rescue-freshness-row time {
    grid-column: 1 / -1;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .rescue-metric-grid,
  .rescue-control-grid,
  .rescue-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rescue-status-card,
  .rescue-status-card:nth-child(4) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .rescue-status-card:nth-child(2n),
  .rescue-status-card:last-child {
    border-right: 0;
  }

  .rescue-status-card:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .rescue-existing-detail > summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .rescue-existing-detail > summary small {
    grid-column: 1 / -1;
  }
}

/* Keep the everyday order workflow obvious without hiding established tools. */
.kiss-primary-nav {
  gap: 12px;
  padding-top: 12px;
}

.kiss-topbar {
  justify-content: space-between;
}

.kiss-everyday-section {
  gap: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.kiss-everyday-heading {
  margin: 0;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-collapsed .kiss-everyday-heading {
  display: none;
}

.kiss-primary-link {
  min-height: 40px;
  font-weight: 900;
}

.kiss-topbar-context {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.kiss-topbar-context strong,
.kiss-topbar-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kiss-topbar-context strong {
  font-size: 13px;
}

.kiss-topbar-context span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.utility-menu {
  position: relative;
}

.mobile-utility-menu {
  display: none;
}

.utility-menu > summary {
  list-style: none;
}

.utility-menu > summary::-webkit-details-marker {
  display: none;
}

.utility-menu-summary {
  min-width: min(260px, 34vw);
  cursor: pointer;
}

.utility-menu-summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.utility-menu-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  transition: transform .16s ease;
}

.utility-menu[open] .utility-menu-chevron {
  transform: rotate(180deg);
}

.utility-notice-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 3px var(--warning-panel-bg);
}

.utility-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  display: grid;
  width: min(360px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 88px));
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.utility-menu-section {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.utility-menu-section h2 {
  margin: 0;
  padding: 4px 8px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.utility-menu-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 40px;
  gap: 9px;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  text-decoration: none;
}

.utility-menu-item:hover,
.utility-menu-item:focus-visible {
  background: var(--nav-hover-bg);
  color: var(--text);
}

.utility-menu-item:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -1px;
}

.utility-menu-item > svg,
.utility-language-form label > svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.utility-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.utility-count.has-due {
  background: var(--warning-panel-bg);
  color: var(--warning-text);
}

.utility-language-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 8px;
}

.utility-language-form label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 750;
}

.utility-language-form select {
  width: auto;
  min-width: 118px;
  min-height: 34px;
}

.utility-signout {
  padding: 10px;
}

.open-orders-sync-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.open-orders-sync-actions label {
  display: contents;
}

.open-orders-sync-actions .btn {
  min-height: 44px;
}

.kiss-empty-state {
  display: grid;
  justify-items: center;
  min-height: 340px;
  padding: 56px 24px;
  text-align: center;
}

.kiss-empty-state > svg {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  color: var(--blue);
}

.kiss-empty-state h2,
.kiss-empty-state p {
  margin: 0;
}

.kiss-empty-state p {
  max-width: 620px;
  margin-top: 8px;
  color: var(--muted);
}

.kiss-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.orders-overview-table {
  min-width: 1080px;
}

.orders-overview-parent-actions .order-row-edit {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.order-more-details {
  overflow: hidden;
}

.order-more-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.order-more-details > summary::-webkit-details-marker {
  display: none;
}

.order-more-details > summary span {
  color: var(--nav-heading);
  font-weight: 800;
}

.order-more-details > summary small {
  color: var(--muted);
}

.order-more-details[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.order-additional-lines-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px 0;
}

.kiss-document-table {
  min-width: 720px;
}

@media (max-width: 640px) {
  .kiss-topbar .top-actions {
    gap: 8px;
  }

  .kiss-topbar .user-pill {
    width: auto;
  }

  .kiss-topbar-context {
    display: none;
  }

  .utility-menu {
    margin-left: auto;
  }

  .utility-menu-summary {
    min-width: 48px;
    padding: 6px;
  }

  .utility-menu-summary .user-copy,
  .utility-menu-summary .utility-menu-chevron {
    display: none;
  }

  .utility-menu-panel {
    position: fixed;
    top: 72px;
    right: 14px;
    max-height: calc(100vh - 86px);
  }

  .order-more-details > summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 860px) {
  .brand-row {
    gap: 8px;
  }

  .brand-row .brand {
    min-width: 0;
  }

  .desktop-utility-menu {
    display: none;
  }

  .mobile-utility-menu {
    display: block;
    margin-left: auto;
  }

  .mobile-utility-menu .utility-menu-summary {
    min-width: 44px;
    min-height: 44px;
    padding: 6px;
  }

  .mobile-utility-menu .user-copy,
  .mobile-utility-menu .utility-menu-chevron {
    display: none;
  }

  .mobile-utility-menu .utility-menu-panel {
    position: fixed;
    top: 66px;
    right: 14px;
    max-height: calc(100dvh - 80px);
  }

  .kiss-topbar {
    min-height: 0;
    padding: 8px 14px 10px;
  }

  .kiss-topbar .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .kiss-topbar .top-actions .btn {
    justify-content: center;
    min-width: 0;
  }

  .operational-overview-notice {
    padding: 12px;
  }

  .operational-overview-filters > summary {
    gap: 8px;
  }

  .operational-overview-filter-actions {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .open-orders-sync-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .open-orders-sync-actions .btn {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    font-size: 0.78rem;
  }
}

@media (max-width: 640px) {
  .operational-overview {
    padding-bottom: 68px;
  }
}

/* Executive operations cockpit */
.operational-overview {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  gap: 18px;
  overflow: clip;
}

.operational-overview-head {
  align-items: flex-end;
  gap: 24px;
  padding: 2px 2px 4px;
}

.operational-overview-head h1 {
  max-width: 760px;
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.operational-overview-head p:last-child {
  max-width: 720px;
  font-size: 0.9rem;
}

.operational-overview-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

.operational-overview .btn {
  min-width: 44px;
  min-height: 44px;
}

.operational-overview-as-of {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.operational-overview-filters {
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.operational-overview-filters > summary {
  min-height: 46px;
  padding: 10px 14px;
}

.operational-overview-filter-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  padding: 14px;
}

.operational-overview-filter-grid select,
.operational-overview-filter-grid input {
  min-height: 44px;
}

.operational-overview-filter-actions {
  min-height: 44px;
}

#operational-overview-results {
  gap: 20px;
  min-width: 0;
}

#operational-overview-results.htmx-swapping {
  opacity: 0.58;
  transition: opacity 120ms ease;
}

.operational-overview-active-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 1px 2px;
  scrollbar-width: thin;
}

.operational-overview-active-filters > span:first-child {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.operational-overview-active-filters a,
.operational-overview-active-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 999px;
  color: var(--blue-dark);
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
  font-size: 0.7rem;
  text-decoration: none;
}

.operational-overview-active-filters a:hover,
.operational-overview-active-filters a:focus-visible {
  border-color: var(--blue);
  background: var(--hover-bg);
}

.operational-overview-active-filters svg {
  width: 13px;
  height: 13px;
}

.operational-overview-position {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.operational-overview-position-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.operational-overview-position-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  letter-spacing: -0.03em;
}

.operational-overview-position-head > p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: right;
}

.operational-overview-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.operational-overview-kpi-grid.has-supply {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.operational-overview-kpi {
  position: relative;
  min-height: 124px;
  gap: 5px;
  padding: 15px 14px 13px;
  overflow: hidden;
  border-radius: 11px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 18px rgba(15, 23, 42, 0.035);
}

.operational-overview-kpi::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--blue);
  content: "";
}

.operational-overview-kpi.is-carryover::before,
.operational-overview-kpi.is-late::before,
.operational-overview-kpi.is-allocation::before {
  background: var(--amber);
}

.operational-overview-kpi.is-production::before {
  background: var(--red);
}

.operational-overview-kpi.is-throughput::before {
  background: var(--green);
}

.operational-overview-kpi > span {
  padding-top: 2px;
  font-size: 0.68rem;
  letter-spacing: 0.045em;
}

.operational-overview-kpi > strong {
  overflow: visible;
  font-size: clamp(1.35rem, 2.25vw, 1.92rem);
  letter-spacing: -0.035em;
  text-overflow: clip;
  white-space: nowrap;
}

.operational-overview-kpi > strong small {
  color: var(--muted);
  font-size: 0.56em;
  letter-spacing: 0;
}

.operational-overview-kpi > p,
.operational-overview-kpi > em {
  margin: 0;
  color: var(--muted);
  font-size: 0.69rem;
  font-style: normal;
  line-height: 1.25;
}

.operational-overview-kpi > em {
  color: var(--amber);
  font-weight: 750;
}

.operational-overview-kpi > a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  min-height: 44px;
  margin-top: auto;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 750;
  text-decoration: none;
}

.operational-overview-kpi > a svg {
  width: 12px;
  height: 12px;
}

.operational-overview-kpi.is-unavailable {
  background: color-mix(in srgb, var(--surface-2) 76%, var(--surface));
}

.operational-overview-kpi.is-unavailable::before {
  background: var(--line-strong);
}

.operational-overview-freshness {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-radius: 10px;
}

.operational-overview-freshness-item {
  min-height: 48px;
  padding: 9px 11px 9px 16px;
}

.operational-overview-freshness-item::before {
  width: 3px;
}

.operational-overview-freshness-item.is-due::before,
.operational-overview-freshness-item.is-stale::before {
  background: var(--amber);
}

.operational-overview-freshness-item.is-error::before {
  background: var(--red);
}

.operational-overview-freshness-item span {
  font-size: 0.62rem;
}

.operational-overview-freshness-item strong {
  font-size: 0.74rem;
}

.operational-overview-section {
  gap: 12px;
}

.operational-overview-section + .operational-overview-section {
  padding-top: 22px;
}

.operational-overview-section-head {
  align-items: flex-end;
}

.operational-overview-section-head h2 {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
}

.operational-overview-section-head p:last-child {
  max-width: 820px;
  font-size: 0.78rem;
}

.operational-overview-section-head > a {
  min-height: 44px;
}

.operational-overview-panel {
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 22px rgba(15, 23, 42, 0.035);
}

.operational-overview-schedule {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--blue) 20%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 4%, var(--surface));
}

.operational-overview-schedule.is-stale,
.operational-overview-schedule.is-due,
.operational-overview-schedule.is-missing {
  border-color: color-mix(in srgb, var(--amber) 32%, var(--line));
  background: color-mix(in srgb, var(--amber-bg) 48%, var(--surface));
}

.operational-overview-schedule-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.operational-overview-schedule-icon svg {
  width: 17px;
  height: 17px;
}

.operational-overview-schedule > div:nth-child(2) {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.operational-overview-schedule > div:nth-child(2) > span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.operational-overview-schedule strong {
  color: var(--text);
  font-size: 0.82rem;
}

.operational-overview-schedule p,
.operational-overview-schedule em {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
}

.operational-overview-schedule em {
  color: var(--amber);
  font-weight: 700;
}

.operational-overview-schedule > a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.operational-overview-schedule > a svg {
  width: 14px;
  height: 14px;
}

.operational-overview-status,
.operational-overview-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-bg);
  font-size: 0.64rem;
  font-weight: 800;
  white-space: nowrap;
}

.operational-overview-status.is-due,
.operational-overview-status.is-stale,
.operational-overview-status.is-historical,
.operational-overview-status.is-missing {
  color: var(--amber);
  background: var(--amber-bg);
}

.operational-overview-material-panel {
  overflow: hidden;
}

.operational-overview-material-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.operational-overview-material-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  font-size: 0.73rem;
}

.operational-overview-material-table th,
.operational-overview-material-table td {
  height: 40px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.operational-overview-material-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.operational-overview-material-table thead tr:first-child th {
  top: 0;
  height: 30px;
  padding-block: 5px;
  color: var(--blue-dark);
  background: color-mix(in srgb, var(--blue) 7%, var(--surface-2));
  text-align: center;
}

.operational-overview-material-table thead tr:nth-child(2) th {
  top: 30px;
}

.operational-overview-material-table thead th > small {
  display: block;
  font-size: 0.55rem;
}

.operational-overview-material-table thead th > a {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 44px;
  color: var(--blue);
  text-decoration: none;
}

.operational-overview-material-table thead th > a svg {
  width: 11px;
  height: 11px;
}

.operational-overview-material-table tbody th:first-child,
.operational-overview-material-table thead tr:first-child th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 210px;
  min-width: 210px;
  text-align: left;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

.operational-overview-material-table thead tr:first-child th:first-child {
  z-index: 4;
  background: var(--surface-2);
}

.operational-overview-material-table tbody:last-of-type tr:last-child > * {
  border-bottom: 0;
}

.operational-overview-material-total > * {
  background: color-mix(in srgb, var(--surface-2) 46%, var(--surface));
  font-weight: 700;
}

.operational-overview-material-total th:first-child {
  background: color-mix(in srgb, var(--surface-2) 46%, var(--surface));
}

.operational-overview-material-total:hover > *,
.operational-overview-material-detail:hover > * {
  background: var(--hover-bg);
}

.operational-overview-material-total:hover th:first-child,
.operational-overview-material-detail:hover th:first-child {
  background: var(--hover-bg);
}

.operational-overview-material-total button {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 0 7px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.operational-overview-material-total button svg {
  grid-row: span 2;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transition: transform 130ms ease;
}

.operational-overview-material-total button[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

/* Materials that carry no grade have no count line, so the chevron must not
   reserve a second, empty grid row. */
.operational-overview-material-total button.is-single-line svg {
  grid-row: span 1;
}

.operational-overview-material-total button small,
.operational-overview-material-detail th small {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 600;
}

.operational-overview-material-detail th {
  padding-left: 34px;
}

.operational-overview-material-detail th span,
.operational-overview-material-detail th small {
  display: block;
}

.operational-overview-material-table .is-emphasis {
  color: var(--text);
  font-weight: 850;
}

.operational-overview-material-table .is-risk {
  color: var(--red-dark);
  font-weight: 850;
}

.operational-overview-material-table .is-risk.is-neutral {
  color: var(--text);
  font-weight: 700;
}

.operational-overview-na {
  color: var(--muted);
}

.operational-overview-material-cards {
  display: none;
}

.operational-overview-source-note {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.67rem;
}

.operational-overview-source-note svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: var(--green);
}

.operational-overview-chart-panel {
  padding-top: 2px;
}

.operational-overview-chart-legend {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 11px 16px 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.operational-overview-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.operational-overview-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--blue);
}

.operational-overview-chart-legend i.is-late {
  background: var(--amber);
}

.operational-overview-chart-legend i.is-missing {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}

.operational-overview-month-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-height: 285px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 14px 16px 10px;
  scrollbar-width: thin;
}

.operational-overview-month-point {
  display: grid;
  grid-template-rows: 230px auto auto;
  gap: 3px;
  min-width: 0;
  text-align: center;
}

.operational-overview-month-bars {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  border-bottom: 1px solid var(--line-strong);
  background-image: linear-gradient(to top, transparent 24%, color-mix(in srgb, var(--line) 50%, transparent) 25%, transparent 26%, transparent 49%, color-mix(in srgb, var(--line) 50%, transparent) 50%, transparent 51%, transparent 74%, color-mix(in srgb, var(--line) 50%, transparent) 75%, transparent 76%);
}

.operational-overview-chart-column {
  display: flex;
  flex: 0 1 42px;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
}

.operational-overview-chart-column strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: clamp(0.53rem, 0.65vw, 0.64rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.operational-overview-chart-column span {
  display: block;
  width: 100%;
  min-height: 2px;
  max-height: calc(100% - 22px);
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 82%, white), var(--blue));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.operational-overview-chart-column.is-late span {
  background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 82%, white), var(--amber));
}

.operational-overview-month-label {
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 800;
}

.operational-overview-month-missing {
  color: var(--muted);
  font-size: 0.59rem;
  white-space: nowrap;
}

.operational-overview-chart-empty {
  grid-column: 1 / -1;
  align-self: center;
}

.operational-overview-chart-data {
  margin: 0 16px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.operational-overview-chart-data > summary {
  min-height: 44px;
  padding: 9px 11px;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 750;
  cursor: pointer;
}

.operational-overview-chart-data > div {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.operational-overview-chart-data table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.operational-overview-chart-data th,
.operational-overview-chart-data td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.operational-overview-chart-data th:first-child {
  text-align: left;
}

.operational-overview-period-evidence {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.operational-overview-period-evidence > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
  padding: 10px 13px;
}

.operational-overview-period-evidence > div + div {
  border-left: 1px solid var(--line);
}

.operational-overview-period-evidence span,
.operational-overview-period-evidence small {
  color: var(--muted);
  font-size: 0.65rem;
}

.operational-overview-period-evidence strong {
  grid-row: span 2;
  color: var(--text);
  font-size: 1.05rem;
}

.operational-overview-action-summary {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: thin;
}

.operational-overview-action-summary > a,
.operational-overview-action-summary > div {
  flex: 0 1 190px;
  min-width: 145px;
  min-height: 44px;
  padding: 8px 11px;
  border-radius: 9px;
}

.operational-overview-action-summary span {
  font-size: 0.69rem;
}

.operational-overview-action-summary strong {
  font-size: 1rem;
}

.operational-overview-action-panel {
  overflow: hidden;
}

.operational-overview-action-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.operational-overview-action-table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  color: var(--text);
  font-size: 0.71rem;
  table-layout: fixed;
}

.operational-overview-action-table thead th {
  height: 32px;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-align: left;
  text-transform: uppercase;
}

.operational-overview-action-table thead th:nth-child(1) { width: 92px; }
.operational-overview-action-table thead th:nth-child(2) { width: 210px; }
.operational-overview-action-table thead th:nth-child(3) { width: auto; }
.operational-overview-action-table thead th:nth-child(4) { width: 88px; text-align: right; }
.operational-overview-action-table thead th:nth-child(5) { width: 180px; }
.operational-overview-action-table thead th:nth-child(6) { width: 145px; }
.operational-overview-action-table thead th:nth-child(7) { width: 54px; }

.operational-overview-action-table tbody tr {
  height: 54px;
  border-left: 3px solid var(--line-strong);
}

.operational-overview-action-table tbody tr.is-rank-1 {
  border-left-color: var(--red);
}

.operational-overview-action-table tbody tr.is-rank-2,
.operational-overview-action-table tbody tr.is-rank-3 {
  border-left-color: var(--amber);
}

.operational-overview-action-table tbody tr.is-rank-4,
.operational-overview-action-table tbody tr.is-rank-5 {
  border-left-color: var(--purple);
}

.operational-overview-action-table tbody tr:hover {
  background: var(--hover-bg);
}

.operational-overview-action-table tbody th,
.operational-overview-action-table tbody td {
  height: 54px;
  padding: 6px 9px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-overview-action-table tbody tr:last-child > * {
  border-bottom: 0;
}

.operational-overview-action-table tbody th strong,
.operational-overview-action-table tbody th small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-overview-action-table tbody th strong {
  font-size: 0.76rem;
}

.operational-overview-action-table tbody th small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 600;
}

.operational-overview-action-table tbody td:nth-child(4) {
  text-align: right;
}

.operational-overview-action-table tbody td:nth-child(7) {
  padding: 5px;
  text-align: center;
}

.operational-overview-priority {
  min-width: 66px;
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 12%, var(--surface));
}

.operational-overview-priority.is-rank-1 {
  color: var(--red-dark);
  background: var(--red-bg);
}

.operational-overview-priority.is-rank-2,
.operational-overview-priority.is-rank-3 {
  color: var(--amber);
  background: var(--amber-bg);
}

.operational-overview-action-reason {
  color: var(--text);
}

.operational-overview-action-owner span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.operational-overview-action-owner a {
  display: block;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 600;
}

.operational-overview-evidence-link {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: var(--surface);
}

.operational-overview-evidence-link:hover,
.operational-overview-evidence-link:focus-visible {
  border-color: var(--blue);
  background: var(--hover-bg);
}

.operational-overview-evidence-link svg {
  width: 15px;
  height: 15px;
}

.operational-overview-customer-section {
  opacity: 0.96;
}

.operational-overview-customer-table {
  min-width: 860px;
  font-size: 0.72rem;
}

.operational-overview-customer-table th,
.operational-overview-customer-table td {
  padding: 9px 12px;
}

.operational-overview-customer-cards h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
}

@media (max-width: 1199px) {
  .operational-overview-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .operational-overview-kpi-grid.has-supply {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .operational-overview-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .operational-overview-freshness {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .operational-overview-freshness-item:nth-child(4) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .operational-overview-freshness-item:nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  .operational-overview {
    gap: 15px;
    overflow: visible;
  }

  .operational-overview-head {
    align-items: flex-start;
  }

  .operational-overview-head-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 6px;
  }

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

  .operational-overview-search,
  .operational-overview-custom-dates {
    grid-column: span 2;
  }

  .operational-overview-freshness {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .operational-overview-freshness-item {
    flex: 0 0 178px;
  }

  .operational-overview-freshness-item + .operational-overview-freshness-item,
  .operational-overview-freshness-item:nth-child(n) {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .operational-overview-schedule {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .operational-overview-schedule > a {
    grid-column: 2 / -1;
    min-height: 44px;
  }

  .operational-overview-action-table-wrap {
    overflow: visible;
  }

  .operational-overview-action-table {
    display: block;
    min-width: 0;
  }

  .operational-overview-action-table thead {
    display: none;
  }

  .operational-overview-action-table tbody {
    display: grid;
  }

  .operational-overview-action-table tbody tr {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 82px 44px;
    grid-template-rows: 38px 34px;
    height: 74px;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
  }

  .operational-overview-action-table tbody th,
  .operational-overview-action-table tbody td {
    display: block;
    width: auto;
    height: auto;
    min-width: 0;
    padding: 5px 7px;
    border: 0;
    font-size: 0.63rem;
  }

  .operational-overview-action-table tbody td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .operational-overview-action-table tbody th:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .operational-overview-action-table tbody td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    padding-top: 0;
  }

  .operational-overview-action-table tbody td:nth-child(4) {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
  }

  .operational-overview-action-table tbody td:nth-child(4)::after {
    display: block;
    color: var(--muted);
    font-size: 0.53rem;
    font-weight: 600;
    content: "MT open";
  }

  .operational-overview-action-table tbody td:nth-child(5) {
    grid-column: 1;
    grid-row: 2;
    padding-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operational-overview-action-table tbody td:nth-child(6) {
    grid-column: 3;
    grid-row: 2;
    padding-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The owner cell carries the linked-task accountability. Its row is a fixed
     74px card, so on mobile it keeps the controller and the tappable link and
     drops the task-owner name, which only desktop has room for. Three lines
     would push the link outside the row and clip it away entirely. */
  .operational-overview-action-table tbody td.operational-overview-action-owner {
    padding-block: 1px;
    white-space: normal;
    line-height: 1.1;
  }

  .operational-overview-action-table tbody .operational-overview-action-owner span {
    display: none;
  }

  .operational-overview-action-table tbody .operational-overview-action-owner a {
    font-size: 0.55rem;
  }

  .operational-overview-action-table tbody td:nth-child(7) {
    display: grid;
    grid-column: 4;
    grid-row: 1 / 3;
    place-items: center;
    padding: 0;
  }

  .operational-overview-priority {
    min-width: 0;
    width: 68px;
    padding-inline: 5px;
  }

  .operational-overview-action-reason {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operational-overview-period-evidence {
    grid-template-columns: 1fr;
  }

  .operational-overview-period-evidence > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .operational-overview-material-table-wrap {
    display: none;
  }

  .operational-overview-material-cards {
    display: grid;
  }

  .operational-overview-material-card {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .operational-overview-material-card:last-child {
    border-bottom: 0;
  }

  .operational-overview-material-card > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto 18px;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 9px 12px;
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }

  .operational-overview-material-card > summary::-webkit-details-marker {
    display: none;
  }

  .operational-overview-material-card > summary > span {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .operational-overview-material-card > summary > span:not(:first-child) {
    text-align: right;
  }

  .operational-overview-material-card > summary strong {
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .operational-overview-material-card > summary small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.58rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operational-overview-material-card > summary > svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
    transition: transform 130ms ease;
  }

  .operational-overview-material-card[open] > summary > svg {
    transform: rotate(180deg);
  }

  .operational-overview-material-card-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    padding: 1px;
    border-top: 1px solid var(--line);
    background: var(--line);
  }

  .operational-overview-material-card-metrics > div {
    display: grid;
    gap: 2px;
    padding: 9px 11px;
    background: var(--surface-2);
  }

  .operational-overview-material-card-metrics dt {
    color: var(--muted);
    font-size: 0.58rem;
  }

  .operational-overview-material-card-metrics dd {
    margin: 0;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 800;
  }

  .operational-overview-material-card-details {
    display: grid;
    border-top: 1px solid var(--line);
  }

  .operational-overview-material-card-details article {
    padding: 8px 12px 8px 22px;
    border-bottom: 1px solid var(--line);
  }

  .operational-overview-material-card-details article:last-child {
    border-bottom: 0;
  }

  .operational-overview-material-card-details header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text);
    font-size: 0.67rem;
  }

  .operational-overview-material-card-details p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.6rem;
  }
}

@media (max-width: 640px) {
  .operational-overview-head h1 {
    font-size: 1.65rem;
  }

  .operational-overview-head p:last-child,
  .operational-overview-as-of {
    display: none;
  }

  /* The heading and its action sat on one non-wrapping row, so on a phone the
     button was pushed past the screen edge and clipped over the title. */
  .operational-overview-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .operational-overview-head > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .operational-overview-head-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  /* Same non-wrapping row exists on every standard page head. */
  .page-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page-head > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .page-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .operational-overview-position-head,
  .operational-overview-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .operational-overview-position-head > p {
    text-align: left;
  }

  .operational-overview-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .operational-overview-kpi-grid.has-supply {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operational-overview-kpi {
    min-height: 112px;
    padding: 13px 11px 11px;
  }

  .operational-overview-kpi > strong {
    font-size: clamp(1.18rem, 6vw, 1.55rem);
  }

  .operational-overview-kpi > p,
  .operational-overview-kpi > em {
    font-size: 0.62rem;
  }

  .operational-overview-filter-grid {
    grid-template-columns: 1fr;
  }

  .operational-overview-search,
  .operational-overview-custom-dates,
  .operational-overview-toggle {
    grid-column: auto;
  }

  .operational-overview-filters > summary > small {
    padding-left: 0;
  }

  .operational-overview-schedule {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    padding: 9px 10px;
  }

  .operational-overview-schedule-icon {
    width: 30px;
    height: 30px;
  }

  .operational-overview-schedule p {
    line-height: 1.25;
  }

  .operational-overview-status {
    padding-inline: 6px;
  }

  .operational-overview-chart-legend {
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .operational-overview-month-chart {
    grid-template-columns: none;
    grid-auto-columns: 96px;
    grid-auto-flow: column;
    justify-content: start;
    min-height: 260px;
    padding-inline: 12px;
  }

  .operational-overview-month-point {
    grid-template-rows: 205px auto auto;
  }

  .operational-overview-chart-data {
    margin-inline: 10px;
  }

  .operational-overview-action-summary > a,
  .operational-overview-action-summary > div {
    flex-basis: 158px;
  }

  .operational-overview-customer-cards {
    padding: 8px;
  }

  .operational-overview-customer-cards article {
    padding: 11px;
  }
}

@media (max-width: 420px) {
  .operational-overview-head-actions .btn {
    width: 44px;
    min-width: 44px;
    overflow: hidden;
    padding-inline: 11px;
    white-space: nowrap;
  }

  .operational-overview-head-actions .btn svg {
    flex: 0 0 18px;
  }

  .operational-overview-material-card > summary {
    grid-template-columns: minmax(0, 1fr) auto 16px;
  }

  .operational-overview-material-card > summary > span:nth-child(3) {
    display: none;
  }

  .operational-overview-action-table tbody tr {
    grid-template-columns: 72px minmax(0, 1fr) 70px 44px;
  }

  .operational-overview-priority {
    width: 62px;
    font-size: 0.57rem;
  }
}

/* Mobile input and touch-target foundations.
   Scoped to 860px, the shell breakpoint app.js and base.html already use to switch the
   sidebar into its mobile menu, so this adds no new breakpoint to the ladder.
   Appended last on purpose: these deliberately override equal-specificity desktop
   defaults (.btn 38px, input 40px/14px) and so must win on source order. */
@media (max-width: 860px) {
  /* iOS Safari zooms the whole page when a control it focuses renders under 16px. */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* 44px minimum touch target. textarea is excluded on purpose: its own min-height is
     110px and a 44px override here would shrink it. */
  .btn,
  .icon-btn,
  input,
  select {
    min-height: 44px;
  }

  .icon-btn {
    width: 44px;
  }

  .sa-date-picker-button,
  .password-visibility-toggle {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .password-input-wrap input {
    padding-right: 52px;
  }

  /* Checkbox and radio keep their own box (the base input[type="checkbox"] rule outranks
     the min-height above) but move up to the 24px WCAG 2.5.8 floor. min-height is reset
     because the generic input rule would otherwise stretch a radio to 44px. */
  input[type="checkbox"],
  input[type="radio"] {
    width: 24px;
    height: 24px;
    min-height: 0;
  }

  /* Controls that set their own font-size outrank the bare-element rule above, so they
     would keep triggering the zoom. These are the six that do. */
  .nav-search input,
  .language-form select,
  .table-column-filter input,
  .stock-gap-row-form input,
  .stock-gap-row-form select,
  .stock-gap-row-form textarea,
  .order-field-table input,
  .order-field-table select,
  .order-field-table textarea,
  .suborder-edit-table input,
  .suborder-edit-table select {
    font-size: 16px;
  }

  /* Same story for the touch target: each of these sets a min-height under 44px at a
     higher specificity than the rule above. textarea is left out throughout -- shrinking
     one to 44px would be a regression, and its own height already clears the target. */
  .search input,
  .table-filter-global input,
  .table-column-filter input,
  .language-form select,
  .utility-language-form select,
  .stock-gap-row-form input,
  .stock-gap-row-form select,
  .order-field-table input,
  .order-field-table select,
  .suborder-edit-table input,
  .suborder-edit-table select,
  .portal-reminder-snooze-form input,
  .portal-reminder-snooze-form select {
    min-height: 44px;
  }

  /* The sidebar menu search needs handling as a unit: its clear button is absolutely
     positioned inside the field, so the blanket 44px .icon-btn box would spill out of a
     38px-tall input. Grow the field first, then the button fits with room to spare. */
  .nav-search input {
    min-height: 48px;
    padding-right: 52px;
  }

  .nav-search-clear {
    right: 2px;
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  /* .search input re-declares the font shorthand, which resets font-size back to the 14px
     body value at a specificity the bare-element rule cannot reach. This is the search box
     on every list page, so it matters more than most. */
  .search input {
    font-size: 16px;
  }

  /* Buttons whose container sets a shorter box than the base .btn. Same reasoning as the
     controls above: each of these outranks the .btn rule at the top of this block. */
  .action-card-actions .btn,
  .table-tools .btn,
  .loading-summary-presets .btn,
  .loading-summary-actions .btn,
  .stock-gap-row-form .btn,
  .existing-order-actions .btn,
  .suborder-row-actions .btn {
    min-height: 44px;
  }

  .column-order-actions .icon-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
}
