:root {
  --mt-sidebar: #e7f2df;
  --mt-sidebar-hover: #eef7ea;
  --mt-sidebar-active: #dfeeda;
  --mt-sidebar-text: #405343;
  --mt-sidebar-text-strong: #173319;
  --mt-page-bg: #f7faf4;
  --mt-surface: #ffffff;
  --mt-surface-muted: #fbfdf8;
  --mt-border: #d7ead1;
  --mt-border-strong: #cfe3c7;
  --mt-text: #172317;
  --mt-muted: #5d6a5d;
  --mt-primary: #2f7d32;
  --mt-primary-rgb: 47, 125, 50;
  --mt-primary-hover: #256628;
  --mt-primary-soft: #eef7ea;
  --mt-primary-soft-strong: #d7ead1;
  --mt-primary-ring: rgba(var(--mt-primary-rgb), 0.24);
  --mt-success: #256628;
  --mt-success-rgb: 37, 102, 40;
  --mt-success-bg: #e7f4e5;
  --mt-warning: #92400e;
  --mt-warning-bg: #fef3c7;
  --mt-danger: #991b1b;
  --mt-danger-bg: #fee2e2;
  --mt-info: #2f6f35;
  --mt-info-bg: #eef7ea;
  --mt-neutral: #475467;
  --mt-neutral-bg: #eaecf0;
  --mt-shadow-sm: 0 1px 2px rgba(36, 75, 42, 0.05);
  --mt-shadow-md: 0 10px 30px rgba(36, 75, 42, 0.07);
  --mt-radius-sm: 10px;
  --mt-radius-md: 14px;
  --mt-radius-lg: 18px;
  --mt-radius-xl: 24px;

  --bg: var(--mt-page-bg);
  --panel: var(--mt-surface);
  --panel-strong: var(--mt-surface);
  --ink: var(--mt-text);
  --muted: var(--mt-muted);
  --line: var(--mt-border);
  --brand: var(--mt-primary);
  --brand-soft: var(--mt-primary-soft);
  --accent: var(--mt-primary);
  --danger: var(--mt-danger);
  --success: var(--mt-success);
  --shadow: var(--mt-shadow-md);
  --radius: var(--mt-radius-lg);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--mt-text);
  background: var(--mt-page-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--mt-primary);
}

.shell {
  max-width: none;
  margin: 0;
  padding: 0;
}

.panel,
.card,
.maintenance-panel {
  background: var(--mt-surface);
  border: 1px solid var(--mt-border);
  box-shadow: var(--mt-shadow-sm);
  backdrop-filter: none;
}

.panel {
  border-radius: 18px;
  padding: 16px;
}

.hero {
  border-radius: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.eyebrow {
  color: var(--mt-primary);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
#sectionHeader h2 {
  color: var(--mt-text);
  letter-spacing: -0.01em;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 1.3rem;
  color: var(--mt-text);
}

h3 {
  color: var(--mt-text);
}

.lede,
.muted,
.subtle,
pre,
.empty {
  color: var(--mt-muted);
}

.stack {
  display: grid;
  gap: 14px;
}

.page-header {
  display: grid;
  gap: 0;
}

.page-header .eyebrow,
.page-header-eyebrow {
  display: none;
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--mt-text);
}

.page-subtitle {
  max-width: 70ch;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}

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

.card-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.card-header h2,
.card-header h3,
.card-heading h2,
.card-heading h3 {
  margin: 0;
}

.card-description {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--mt-muted);
}

.card-actions,
.table-toolbar,
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions {
  justify-content: flex-end;
}

.button,
button {
  min-height: 0;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--mt-primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.button:hover,
button:hover {
  background: var(--mt-primary-hover);
  box-shadow: none;
}

.button.secondary,
button.secondary,
.button.tab-button,
button.tab-button,
.button.filter-button,
button.filter-button {
  background: var(--mt-surface);
  color: var(--mt-text);
  border-color: var(--mt-border);
  box-shadow: none;
}

.button.secondary:hover,
button.secondary:hover,
.button.tab-button:hover,
button.tab-button:hover,
.button.filter-button:hover,
button.filter-button:hover {
  background: var(--mt-surface-muted);
  border-color: var(--mt-border-strong);
}

.button.danger,
button.danger {
  background: linear-gradient(180deg, #b42318, #991b1b);
  border-color: #b42318;
}

.button.btn-danger-soft,
button.btn-danger-soft {
  background: #f8d7da;
  border: 1px solid #f1aeb5;
  color: #842029;
  box-shadow: none;
}

.button.btn-danger-soft:hover,
button.btn-danger-soft:hover {
  background: #f1b0b7;
  border-color: #ea868f;
  color: #842029;
  box-shadow: none;
}

.button.danger:hover,
button.danger:hover {
  background: linear-gradient(180deg, #991b1b, #7f1d1d);
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.16);
}

.button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--mt-primary-ring);
  outline-offset: 2px;
}

input,
select,
textarea {
  border-radius: 8px;
  border: 1px solid var(--mt-border);
  background: #ffffff;
  color: var(--mt-text);
  padding: 8px 10px;
  font-size: 13px;
  box-shadow: none;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

.textarea-one-line {
  min-height: 36px;
  height: 36px;
  resize: vertical;
}

label {
  color: var(--mt-text);
}

.banner {
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
}

.banner.info {
  background: var(--mt-info-bg);
  color: var(--mt-info);
  border-color: rgba(var(--mt-primary-rgb), 0.18);
}

.banner.success {
  background: var(--mt-success-bg);
  color: var(--mt-success);
  border-color: rgba(var(--mt-success-rgb), 0.16);
}

.banner.error {
  background: var(--mt-danger-bg);
  color: var(--mt-danger);
  border-color: rgba(153, 27, 27, 0.14);
}

.banner.warning {
  background: var(--mt-warning-bg);
  color: var(--mt-warning);
  border-color: rgba(146, 64, 14, 0.16);
}

.chip,
.status-pill,
.status-tag,
.issue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip,
.status-pill {
  background: var(--mt-primary-soft);
  color: var(--mt-primary);
  border-color: rgba(var(--mt-primary-rgb), 0.15);
}

.chip.neutral,
.status-pill.neutral,
.status-tag.excluded,
.issue-badge.houff_destination,
.issue-badge.missing_net_tons,
.issue-badge.source_identity_changed {
  background: var(--mt-neutral-bg);
  color: var(--mt-neutral);
  border-color: rgba(71, 84, 103, 0.14);
}

.status-pill.warn,
.status-tag.needs_invoice,
.issue-badge.missing_fsc,
.issue-badge.stale_fsc,
.issue-badge.missing_unloading_date,
.issue-badge.invalid_net_tons,
.issue-badge.missing_transload_rate,
.issue-badge.invalid_billing_snapshot,
.issue-badge.invalid_invoice_metadata,
.issue-badge.source_unloading_missing,
.issue-badge.source_unloading_date_changed,
.issue-badge.source_net_tons_changed {
  background: var(--mt-warning-bg);
  color: var(--mt-warning);
  border-color: rgba(146, 64, 14, 0.16);
}

.status-tag.invoiced_unpaid {
  background: var(--mt-info-bg);
  color: var(--mt-info);
  border-color: rgba(var(--mt-primary-rgb), 0.16);
}

.status-tag.paid {
  background: var(--mt-success-bg);
  color: var(--mt-success);
  border-color: rgba(var(--mt-success-rgb), 0.16);
}

.status-tag.needs_review,
.status-tag.not_paid,
.issue-badge.missing_rate,
.issue-badge.missing_carrier,
.issue-badge.missing_carrier_rate_type,
.issue-badge.missing_total_rate,
.issue-badge.missing_morton_number,
.issue-badge.duplicate_morton_number,
.issue-badge.duplicate_date_load,
.issue-badge.paid_not_invoiced {
  background: var(--mt-danger-bg);
  color: var(--mt-danger);
  border-color: rgba(153, 27, 27, 0.16);
}

.cards,
.summary-strip,
.tab-row {
  gap: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 14px;
}

.card {
  border-radius: var(--mt-radius-md);
  padding: 16px;
  min-height: 0;
}

.metric {
  color: var(--mt-text);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
  line-height: 1.05;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--mt-radius-md);
  border: 1px solid var(--mt-border);
  background: var(--mt-surface);
}

.table-toolbar {
  margin-bottom: 12px;
}

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

.table-wrap th,
.table-wrap td {
  border-bottom: 1px solid var(--mt-border);
}

td {
  font-size: 13px;
}

.table-wrap th {
  background: var(--mt-page-bg);
  color: #475569;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 10px;
}

.table-wrap td {
  padding: 9px 10px;
}

tbody tr:hover td {
  background: rgba(var(--mt-primary-rgb), 0.045);
}

tr:last-child td {
  border-bottom: 0;
}

pre {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--mt-border);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: grid;
  place-items: center;
  padding: 24px;
  backdrop-filter: blur(3px);
  z-index: 20;
}

.modal-panel {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: var(--mt-radius-xl);
  background: var(--mt-surface);
  border: 1px solid var(--mt-border);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  padding: 24px;
}

.login-shell,
#blockedView {
  max-width: 480px;
  margin: 8vh auto 0;
}

.login-brand {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.login-brand img {
  display: block;
  width: min(180px, 62vw);
  max-height: 76px;
  object-fit: contain;
}

.login-title {
  color: var(--mt-text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}

#appView.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
  align-items: stretch;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  background: var(--mt-sidebar);
  color: var(--mt-sidebar-text);
  border-right: 1px solid #bdd8ad;
  border-radius: 0;
  padding: 0;
  box-shadow: inset -1px 0 0 rgba(var(--mt-primary-rgb), 0.05);
  display: flex;
  flex-direction: column;
}

.app-main {
  min-width: 0;
  display: grid;
  gap: 0;
}

.app-panel {
  min-width: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 22px;
}

.sidebar-mark {
  width: 72px;
  height: 42px;
  flex: 0 0 72px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(191, 211, 191, 0.75);
  box-shadow: 0 1px 2px rgba(36, 75, 42, 0.07);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2px;
}

.sidebar-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.85);
  transform-origin: center;
}

.sidebar-title {
  color: var(--mt-sidebar-text-strong);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

.sidebar-subtitle {
  margin-top: 2px;
  color: #6b7a6d;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-subtitle:empty {
  display: none;
}

.sidebar-section {
  padding: 4px 8px 12px;
}

.app-sidebar .eyebrow {
  color: #6b7a6d;
}

.app-sidebar h2 {
  color: var(--mt-sidebar-text-strong);
  font-size: 12px;
}

.app-sidebar .muted {
  color: #5b6b60;
  font-size: 13px;
}

.sidebar-nav-title {
  display: none;
}

#navButtons.nav {
  display: grid;
  gap: 2px;
  margin-top: 0;
}

.nav-group-heading {
  margin: 10px 4px 4px;
  padding: 0 8px;
  color: #6b7a6d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#navButtons.nav button {
  position: relative;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  min-height: 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--mt-sidebar-text);
  border: 0;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
}

#navButtons.nav button:hover {
  background: var(--mt-sidebar-hover);
  color: var(--mt-sidebar-text-strong);
}

#navButtons.nav button.active {
  background: var(--mt-sidebar-active);
  color: var(--mt-sidebar-text-strong);
  box-shadow: inset 0 0 0 1px rgba(var(--mt-primary-rgb), 0.1);
}

#navButtons.nav button.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--mt-primary);
}

#sectionHeader .stack {
  gap: 6px;
}

#sectionHeader .eyebrow {
  display: none;
}

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

.row {
  justify-content: space-between;
}

#sectionHeader {
  padding: 20px 28px 10px;
}

#sectionBody {
  padding: 0 28px 24px;
}

.nav-subgroup-heading {
  margin: 10px 4px 4px;
  padding: 0 12px;
  color: #6b7a6d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#navButtons.nav button.nav-settings-entry {
  margin-top: 2px;
  font-weight: 600;
}

#navButtons.nav button.nav-back-button {
  margin-bottom: 8px;
}

#navButtons.nav button.nav-back-button::before {
  content: "<";
  margin-right: 8px;
  color: #6b7a6d;
}

#navButtons.nav button.nav-settings-child-button {
  padding-left: 28px;
  font-size: 12px;
  color: #5b6b60;
}

#navButtons.nav button.nav-settings-child-button:hover,
#navButtons.nav button.nav-settings-child-button.active {
  color: var(--mt-sidebar-text-strong);
}

#navButtons.nav button.nav-settings-child-button.active::before {
  left: 8px;
  top: 7px;
  bottom: 7px;
  width: 2px;
}

.app-sidebar.settings-mode {
  background: linear-gradient(180deg, var(--mt-sidebar) 0%, var(--mt-sidebar-hover) 100%);
}

.app-sidebar.settings-mode .sidebar-subtitle {
  color: #5b6b60;
}

.app-sidebar.settings-mode .nav-group-heading,
.app-sidebar.settings-mode .nav-subgroup-heading {
  color: #6b7a6d;
}

.admin-dashboard-page {
  gap: 14px;
}

.admin-dashboard-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.admin-dashboard-summary-card,
.admin-dashboard-actions-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.admin-dashboard-summary-card h3 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.admin-dashboard-summary-card .metric {
  font-size: 22px;
}

.admin-dashboard-summary-card .muted {
  font-size: 11px;
  color: #94a3b8;
}

.admin-dashboard-actions-header {
  margin-bottom: 10px;
  align-items: center;
}

.admin-dashboard-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-dashboard-action-row button {
  min-height: 34px;
  padding: 7px 12px;
}

.settings-page {
  gap: 14px;
}

.settings-page-banner {
  padding: 10px 12px;
  font-size: 13px;
}

.settings-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.settings-summary-card,
.settings-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.settings-summary-card h3,
.settings-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.settings-summary-card .metric {
  font-size: 22px;
}

.settings-summary-card .muted {
  font-size: 11px;
  color: #94a3b8;
}

.settings-page-split {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.settings-card-stack,
.settings-status-grid {
  gap: 10px;
}

.settings-card-header {
  margin-bottom: 10px;
  align-items: center;
}

.settings-card-actions,
.settings-maintenance-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-review-grid {
  display: grid;
  gap: 8px 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-review-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-review-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.settings-review-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

.settings-readonly-control {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #f8fafc;
  color: var(--mt-text);
  box-sizing: border-box;
}

input.settings-readonly-control[readonly] {
  cursor: text;
}

.settings-readonly-control-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.settings-readonly-flag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.settings-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.settings-status-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #f8fafc;
}

.settings-status-header,
.settings-maintenance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-status-header h4,
.settings-maintenance-summary h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--mt-text);
}

.settings-status-meta {
  font-size: 11px;
  color: #64748b;
}

.settings-status-message {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--mt-text);
}

.chip.settings-chip-success {
  background: var(--mt-success-bg);
  color: var(--mt-success);
  border-color: rgba(22, 101, 52, 0.16);
}

.chip.settings-chip-warning {
  background: var(--mt-warning-bg);
  color: var(--mt-warning);
  border-color: rgba(146, 64, 14, 0.16);
}

.chip.settings-chip-danger {
  background: var(--mt-danger-bg);
  color: var(--mt-danger);
  border-color: rgba(153, 27, 27, 0.16);
}

.settings-json-details summary,
.settings-maintenance-panel summary {
  cursor: pointer;
}

.settings-json-details summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--mt-primary);
}

.settings-json-block {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #ffffff;
  color: var(--mt-text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.settings-json-block-large {
  background: #f8fafc;
}

.settings-maintenance-panel summary {
  padding: 14px 16px;
}

.settings-maintenance-summary .muted {
  font-size: 12px;
}

.settings-maintenance-body {
  gap: 12px;
  padding: 14px;
}

.audit-page {
  gap: 14px;
}

.audit-page-banner {
  padding: 10px 12px;
  font-size: 13px;
}

.audit-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.audit-summary-card,
.audit-filters-card,
.audit-table-card,
.audit-detail-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.audit-summary-card h3,
.audit-filters-card h3,
.audit-table-card h3,
.audit-detail-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.audit-summary-card .metric {
  font-size: 22px;
}

.audit-summary-card .muted {
  font-size: 11px;
  color: #94a3b8;
}

.audit-filters-stack,
.audit-detail-stack {
  gap: 8px;
}

.audit-filters-header,
.audit-table-header,
.audit-detail-header {
  margin-bottom: 10px;
  align-items: center;
}

.audit-filters-header-actions,
.audit-table-summary,
.audit-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-filters-header-actions,
.audit-detail-header-actions {
  justify-content: flex-end;
}

.audit-filter-grid {
  gap: 8px 10px;
  grid-template-columns:
    132px
    132px
    minmax(152px, 1fr)
    minmax(160px, 1fr)
    minmax(138px, 0.9fr)
    92px;
  align-items: end;
}

.audit-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.audit-filter-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.audit-filter-field input,
.audit-filter-field select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.audit-filter-field select {
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 48%,
    calc(100% - 9px) 48%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.audit-filter-search {
  grid-column: 1 / span 4;
}

.audit-filter-actions {
  justify-content: flex-end;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.audit-filter-actions .actions button {
  min-height: 34px;
  padding: 7px 12px;
}

.audit-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.audit-pagination-meta,
.audit-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-pagination-meta {
  font-size: 12px;
  color: var(--mt-muted);
}

.audit-pagination-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.audit-pagination-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.audit-pagination-button[disabled]:hover {
  background: var(--mt-surface);
  border-color: var(--mt-border);
  color: var(--mt-text);
}

.table-wrap.table-admin-wide.table-audit table {
  min-width: 1240px;
}

.table-wrap.table-audit th,
.table-wrap.table-audit td {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
}

.table-wrap.table-audit th {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.table-wrap.table-audit td:nth-child(1),
.table-wrap.table-audit td:nth-child(3),
.table-wrap.table-audit td:nth-child(4),
.table-wrap.table-audit td:nth-child(5),
.table-wrap.table-audit td:nth-child(7),
.table-wrap.table-audit td:nth-child(8) {
  white-space: nowrap;
}

.audit-row-selected td {
  background: rgba(217, 236, 239, 0.42);
}

.audit-user-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.audit-user-meta,
.audit-empty-value {
  color: var(--mt-muted);
}

.audit-user-meta {
  font-size: 11px;
}

.audit-summary-cell {
  max-width: 440px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.audit-table-badge {
  min-height: 22px;
}

.audit-empty-state {
  padding: 20px 10px;
}

.audit-detail-grid {
  display: grid;
  gap: 8px 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audit-detail-item {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
  min-width: 0;
}

.audit-detail-item-wide {
  grid-column: 1 / -1;
}

.audit-detail-label,
.audit-json-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

.audit-detail-value {
  font-size: 12px;
  color: var(--mt-text);
  overflow-wrap: anywhere;
}

.audit-json-section,
.audit-json-details {
  display: grid;
  gap: 6px;
}

.audit-json-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--mt-primary);
}

.audit-json-block {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #f8fafc;
  color: var(--mt-text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.integrity-page {
  gap: 14px;
}

.integrity-page-banner {
  padding: 10px 12px;
  font-size: 13px;
}

.integrity-header-card,
.integrity-group-card,
.integrity-summary-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.integrity-header,
.integrity-group-header {
  margin-bottom: 10px;
  align-items: center;
}

.integrity-header-actions,
.integrity-group-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.integrity-header-actions {
  justify-content: flex-end;
}

.integrity-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.integrity-summary-card h3,
.integrity-group-card h3,
.integrity-header-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.integrity-summary-card .metric {
  font-size: 22px;
}

.integrity-summary-card .muted {
  font-size: 11px;
  color: #94a3b8;
}

.integrity-groups-stack {
  display: grid;
  gap: 14px;
}

.integrity-empty-state {
  padding: 20px 10px;
}

.integrity-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.integrity-pagination-meta,
.integrity-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.integrity-pagination-meta {
  font-size: 12px;
  color: var(--mt-muted);
}

.integrity-pagination-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.integrity-pagination-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.integrity-pagination-button[disabled]:hover {
  background: var(--mt-surface);
  border-color: var(--mt-border);
  color: var(--mt-text);
}

.table-wrap.table-admin-wide.table-integrity table {
  min-width: 1100px;
}

.table-wrap.table-integrity th,
.table-wrap.table-integrity td {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
  vertical-align: top;
}

.table-wrap.table-integrity th {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.table-wrap.table-integrity td:nth-child(1),
.table-wrap.table-integrity td:nth-child(3),
.table-wrap.table-integrity td:nth-child(5) {
  white-space: nowrap;
}

.integrity-summary-cell {
  max-width: 420px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.integrity-issue-cell {
  display: grid;
  gap: 4px;
}

.integrity-issue-code,
.integrity-empty-value {
  color: var(--mt-muted);
  font-size: 11px;
}

.integrity-severity-badge {
  min-height: 22px;
}

.chip.integrity-severity-critical {
  background: var(--mt-danger-bg);
  color: var(--mt-danger);
  border-color: rgba(153, 27, 27, 0.16);
}

.chip.integrity-severity-warning {
  background: var(--mt-warning-bg);
  color: var(--mt-warning);
  border-color: rgba(146, 64, 14, 0.16);
}

.chip.integrity-severity-info {
  background: var(--mt-info-bg);
  color: var(--mt-info);
  border-color: rgba(var(--mt-primary-rgb), 0.16);
}

.integrity-details-cell {
  min-width: 260px;
}

.integrity-issue-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--mt-primary);
}

.integrity-issue-details-body {
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

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

.integrity-json-block {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #f8fafc;
  color: var(--mt-text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.section-block-tight {
  gap: 14px;
}

.kpi-card {
  padding: 16px;
}

.kpi-card h3 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.kpi-card .muted {
  font-size: 11px;
  color: #94a3b8;
}

.summary-strip .card,
.cards .card {
  box-shadow: none;
}

.restricted-card {
  min-height: 0;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.88);
}

.summary-strip .card {
  padding: 16px;
}

.summary-strip .metric {
  font-size: 24px;
}

.split {
  align-items: start;
}

.tab-button.active,
.filter-button.active {
  background: linear-gradient(180deg, var(--mt-primary), var(--mt-primary-hover));
  color: #ffffff;
  border-color: transparent;
}

.maintenance-panel {
  border-radius: var(--mt-radius-lg);
  overflow: hidden;
}

.maintenance-panel summary {
  background: #f8fafc;
}

.maintenance-panel-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.compact-results th,
.compact-results td {
  font-size: 13px;
}

.login-form,
.delivery-form,
.filters-grid {
  display: grid;
  gap: 14px;
}

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

.delivery-filters-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.delivery-filters-grid .filter-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.delivery-filters-grid select {
  border-width: 2px;
  box-shadow: inset 0 0 0 1px rgba(var(--mt-primary-rgb), 0.06);
  cursor: pointer;
}

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

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

.railcar-unloading-entry-form.delivery-form {
  grid-template-columns:
    minmax(150px, 0.9fr)
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(120px, 0.8fr)
    minmax(220px, 1.4fr);
  gap: 10px 12px;
  align-items: end;
}

.railcar-unloading-entry-form.delivery-form .span-2 {
  grid-column: 1 / -1;
}

.railcar-unloading-form-actions {
  justify-content: flex-end;
}

.railcar-arrival-unload-form {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(180px, 220px) minmax(120px, 160px);
  gap: 10px 12px;
  justify-content: flex-start;
}

.railcar-arrival-unload-form label,
.railcar-arrival-unload-form input {
  min-width: 0;
}

.railcar-arrival-unload-form input {
  box-sizing: border-box;
  width: 100%;
}

#manualRailcarUnloadingModal .modal-panel,
#railcarArrivalUnloadModal .modal-panel {
  width: min(680px, calc(100vw - 32px));
  padding: 18px;
}

.railcar-arrival-unload-header,
.railcar-arrival-unload-actions {
  grid-column: 1 / -1;
}

.railcar-arrival-unload-notes {
  grid-column: 1 / -1;
  justify-self: stretch;
  width: 100%;
}

.railcar-arrival-unload-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.cargill-reconciliation-fields {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 8px;
  background: #f8fafc;
}

.cargill-reconciliation-title {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cargill-reconciliation-help {
  margin: 0;
  font-size: 12px;
}

.cargill-reconciliation-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cargill-reconciliation-grid .span-2 {
  grid-column: 1 / -1;
}

.operations-entry-form > .cargill-reconciliation-fields,
.deliveries-edit-form > .cargill-reconciliation-fields {
  grid-column: 1 / -1;
}

.outbound-reconciliation-filter-bar,
.inbound-reconciliation-filter-bar,
.handling-reconciliation-filter-bar {
  align-items: end;
}

.handling-reconciliation-week-row {
  display: flex;
  align-items: end;
}

.handling-reconciliation-week-field {
  width: min(360px, 100%);
}

.handling-reconciliation-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.handling-reconciliation-toolbar-left,
.handling-reconciliation-toggle {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.handling-reconciliation-toolbar-right {
  margin-left: auto;
}

.handling-reconciliation-refresh-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin: 14px 0 10px;
}

.handling-reconciliation-toolbar .table-pagination {
  margin: 0;
}

.handling-reconciliation-source-link {
  margin-top: 4px;
}

.handling-reconciliation-missing-source {
  white-space: nowrap;
}

.handling-reconciliation-status-cell {
  align-items: flex-start;
}

.handling-reconciliation-direction {
  border-color: rgba(71, 85, 105, 0.24);
  background: #f1f5f9;
  color: #334155;
}

.outbound-reconciliation-table td,
.inbound-reconciliation-table td,
.handling-reconciliation-table td {
  vertical-align: top;
}

.handling-preview-card > .handling-summary-strip + .banner {
  margin-top: 12px;
}

.handling-preview-card > .banner + .handling-movement-table-shell {
  margin-top: 12px;
}

.handling-preview-card > .handling-movement-table-shell + .actions {
  margin-top: 16px;
}

.handling-import-preview-table th,
.handling-import-preview-table td {
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 1.45;
  vertical-align: middle;
}

.outbound-reconciliation-status,
.inbound-reconciliation-status {
  white-space: nowrap;
}

.outbound-reconciliation-status-matched,
.outbound-reconciliation-status-matched_with_tolerance,
.outbound-reconciliation-summary-success,
.handling-reconciliation-summary-success,
.inbound-reconciliation-status-matched,
.inbound-reconciliation-status-matched_with_tolerance,
.inbound-reconciliation-summary-success {
  border-color: rgba(22, 163, 74, 0.28);
  background: #dcfce7;
  color: #166534;
}

.outbound-reconciliation-status-missing_from_cargill,
.outbound-reconciliation-status-unexpected_from_cargill,
.outbound-reconciliation-status-quantity_mismatch,
.outbound-reconciliation-status-date_mismatch,
.outbound-reconciliation-status-rate_mismatch,
.outbound-reconciliation-status-duplicate_match,
.outbound-reconciliation-status-missing_key,
.outbound-reconciliation-status-needs_review,
.outbound-reconciliation-summary-error,
.handling-reconciliation-summary-error,
.inbound-reconciliation-status-missing_from_cargill,
.inbound-reconciliation-status-unexpected_from_cargill,
.inbound-reconciliation-status-quantity_mismatch,
.inbound-reconciliation-status-date_mismatch,
.inbound-reconciliation-status-rate_mismatch,
.inbound-reconciliation-status-duplicate_match,
.inbound-reconciliation-status-missing_key,
.inbound-reconciliation-status-needs_review,
.inbound-reconciliation-summary-error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fee2e2;
  color: #991b1b;
}

.outbound-reconciliation-summary-warning,
.handling-reconciliation-summary-warning,
.inbound-reconciliation-summary-warning {
  border-color: rgba(217, 119, 6, 0.24);
  background: #fffbeb;
}

.inventory-adjustment-form {
  display: grid;
  grid-template-columns: minmax(140px, 0.75fr) minmax(130px, 0.7fr) minmax(170px, 1fr) minmax(170px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.inventory-adjustment-form label {
  min-width: 0;
}

.inventory-adjustment-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}

.inventory-adjustment-actions .actions {
  flex-wrap: nowrap;
}

.inventory-adjustment-actions button {
  white-space: nowrap;
}

.delivery-form .span-2,
.filters-grid .span-2,
.form-grid .span-2 {
  grid-column: span 2;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

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

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.checkbox-line input {
  width: auto;
  margin: 0;
}

.section-block {
  display: grid;
  gap: 18px;
}

.split {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: start;
}

.split.table-priority {
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.72fr);
}

.tab-row,
.summary-strip,
.issue-list,
.detail-grid {
  display: grid;
  gap: 12px;
}

.tab-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: stretch;
}

.summary-strip .card {
  min-height: 0;
  padding: 16px;
}

.summary-strip .metric {
  font-size: 24px;
}

.inventory-page > .inventory-summary-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1200px) {
  .inventory-page > .inventory-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .inventory-page > .inventory-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.issue-list {
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
  align-items: start;
}

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

.detail-grid .span-2 {
  grid-column: span 2;
}

.detail-block {
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-lg);
  padding: 16px;
  background: var(--mt-surface);
}

.detail-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--mt-muted);
}

.subtle {
  font-size: 13px;
}

.operations-entry-card {
  border-color: rgba(var(--mt-primary-rgb), 0.16);
  background:
    linear-gradient(180deg, rgba(239, 248, 236, 0.92), rgba(255, 255, 255, 0.98) 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 10px 24px rgba(15, 23, 42, 0.05);
}

.operations-entry-header {
  margin-bottom: 14px;
}

.operations-entry-heading {
  gap: 2px;
}

.operations-entry-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mt-primary);
}

.operations-entry-heading h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--mt-text);
}

.operations-entry-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.operations-entry-form {
  gap: 10px 12px;
  grid-template-columns:
    118px
    112px
    160px
    minmax(140px, 0.55fr)
    112px
    112px
    112px
    minmax(180px, 1.45fr);
  align-items: end;
}

.operations-entry-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.operations-entry-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.operations-entry-field input,
.operations-entry-field select,
.operations-entry-field textarea {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 38px;
  background: rgba(255, 255, 255, 0.96);
}

.operations-entry-field textarea {
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  overflow-y: auto;
  resize: none;
}

.operations-entry-footer {
  grid-column: 1 / -1;
}

.operations-entry-footer {
  padding-top: 2px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.operations-entry-note {
  font-size: 12px;
  color: var(--mt-muted);
}

.operations-entry-actions {
  justify-content: flex-end;
}

.delivery-entry-day-card {
  gap: 12px;
  padding: 14px 16px 16px;
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: none;
}

.delivery-entry-day-header {
  margin-bottom: 0;
  align-items: center;
}

.delivery-entry-day-header h3 {
  font-size: 15px;
}

.users-admin-page {
  gap: 14px;
}

.users-admin-layout {
  display: grid;
  gap: 14px;
}

.users-table-card,
.users-form-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.users-table-header,
.users-form-header {
  margin-bottom: 10px;
  align-items: center;
}

.users-table-summary,
.users-form-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.users-form-header-actions {
  justify-content: flex-end;
}

.users-empty-state {
  padding: 20px 10px;
}

.table-wrap.table-admin-wide.table-users table {
  min-width: 980px;
}

.table-wrap.table-users th,
.table-wrap.table-users td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.table-wrap.table-users td:nth-child(1),
.table-wrap.table-users td:nth-child(3),
.table-wrap.table-users td:nth-child(5),
.table-wrap.table-users td:nth-child(6),
.table-wrap.table-users td:nth-child(7) {
  white-space: nowrap;
}

.users-empty-value {
  color: var(--mt-muted);
}

.users-role-badge,
.users-status-badge {
  min-height: 22px;
}

.users-role-admin {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.18);
}

.users-role-ar {
  background: var(--mt-warning-bg);
  color: var(--mt-warning);
  border-color: rgba(146, 64, 14, 0.16);
}

.users-role-driver {
  background: rgba(var(--mt-primary-rgb), 0.1);
  color: var(--mt-primary);
  border-color: rgba(var(--mt-primary-rgb), 0.16);
}

.users-status-active {
  background: var(--mt-success-bg);
  color: var(--mt-success);
  border-color: rgba(22, 101, 52, 0.16);
}

.users-form-stack {
  gap: 8px;
}

.users-form-heading {
  gap: 2px;
}

.users-form-grid {
  gap: 8px 10px;
  grid-template-columns:
    minmax(118px, 0.88fr)
    minmax(138px, 1fr)
    minmax(98px, 0.68fr)
    minmax(178px, 1.2fr)
    minmax(138px, 0.92fr)
    minmax(138px, 0.92fr);
  align-items: end;
}

.users-form-grid .span-2 {
  grid-column: 1 / -1;
}

.users-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.users-form-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.users-form-field input,
.users-form-field select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.users-form-field select {
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 48%,
    calc(100% - 9px) 48%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.users-form-card .actions button,
.users-form-card .actions .button {
  min-height: 34px;
  padding: 7px 12px;
}

.users-form-toggle {
  min-height: 36px;
  padding-top: 2px;
}

.users-form-actions {
  justify-content: flex-end;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.rates-admin-page {
  gap: 14px;
}

.rates-form-card,
.rates-import-card,
.rates-table-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.rates-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: start;
}

.rates-form-stack {
  gap: 8px;
}

.rates-form-header,
.rates-table-header {
  margin-bottom: 10px;
  align-items: center;
}

.rates-form-heading {
  gap: 2px;
}

.rates-form-header-actions,
.rates-table-header-actions,
.rates-table-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rates-table-header-actions {
  justify-content: flex-end;
}

.rates-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rates-filter-row .filter-button {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.rates-form-grid {
  gap: 8px 10px;
  grid-template-columns:
    minmax(190px, 1.55fr)
    minmax(132px, 1fr)
    minmax(82px, 0.52fr)
    minmax(132px, 0.95fr)
    minmax(92px, 0.72fr)
    minmax(112px, 0.88fr)
    minmax(104px, 0.82fr)
    minmax(112px, 0.88fr)
    minmax(128px, 1fr);
  align-items: end;
}

.rates-setup-grid .rates-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.carrier-form-grid.rates-form-grid {
  grid-template-columns:
    minmax(170px, 1fr)
    minmax(120px, 0.62fr)
    max-content
    minmax(150px, 0.72fr)
    auto;
  gap: 8px 10px;
  align-items: end;
}

.carrier-active-toggle {
  min-height: 34px;
  align-self: end;
  white-space: nowrap;
}

.carrier-notes-field textarea {
  min-height: 34px;
  height: 34px;
}

.carrier-form-actions {
  align-self: end;
  justify-content: flex-end;
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.carrier-form-actions .actions {
  flex-wrap: nowrap;
}

.carrier-form-actions button {
  white-space: nowrap;
}

.rates-form-grid .span-2 {
  grid-column: 1 / -1;
}

.carrier-form-grid.rates-form-grid .span-2 {
  grid-column: auto;
}

.rates-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.rates-form-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.rates-form-field input,
.rates-form-field select,
.rates-form-field textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.rates-form-notes textarea {
  min-height: 34px;
  resize: vertical;
}

.rates-form-toggle {
  min-height: 34px;
  padding-top: 1px;
}

.rates-form-actions {
  justify-content: flex-end;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.carrier-form-actions {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.rates-form-card .actions button,
.rates-form-card .actions .button {
  min-height: 34px;
  padding: 7px 12px;
}

.rates-import-stack {
  gap: 12px;
}

.rates-import-actions {
  display: grid;
  gap: 10px;
}

.rates-import-actions .button,
.rates-import-actions button,
.rates-import-file-field input {
  width: 100%;
}

.rates-import-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rates-import-preview-table th,
.rates-import-preview-table td {
  padding: 7px 8px;
  font-size: 11px;
}

.table-wrap.table-admin-wide.table-rates table {
  min-width: 1180px;
}

.table-wrap.table-rates th,
.table-wrap.table-rates td {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
}

.table-wrap.table-rates th {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.table-wrap.table-rates td:nth-child(3),
.table-wrap.table-rates td:nth-child(4),
.table-wrap.table-rates td:nth-child(5),
.table-wrap.table-rates td:nth-child(6),
.table-wrap.table-rates td:nth-child(7),
.table-wrap.table-rates td:nth-child(8),
.table-wrap.table-rates td:nth-child(10) {
  white-space: nowrap;
}

.rates-status-badge {
  min-height: 22px;
}

.rates-status-active {
  background: var(--mt-success-bg);
  color: var(--mt-success);
  border-color: rgba(22, 101, 52, 0.16);
}

.rates-status-error {
  background: var(--mt-danger-bg);
  color: var(--mt-danger);
  border-color: rgba(153, 27, 27, 0.16);
}

.transload-status-pending {
  background: var(--mt-info-bg);
  color: var(--mt-info);
  border-color: rgba(3, 105, 161, 0.16);
}

.rates-empty-value {
  color: var(--mt-muted);
}

.rates-empty-state {
  padding: 20px 10px;
}

.rates-cell-stack {
  display: grid;
  gap: 6px;
}

.google-sheets-page {
  gap: 14px;
}

.google-sheets-summary-strip,
.google-sheets-history-strip {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.google-sheets-summary-card,
.google-sheets-panel-card,
.google-sheets-tool-card,
.google-sheets-results-card,
.google-sheets-result-card,
.google-sheets-detail-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.google-sheets-summary-card .metric,
.google-sheets-result-metric-card .metric {
  font-size: 22px;
}

.google-sheets-overview-split,
.google-sheets-tools-split,
.google-sheets-result-detail-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.google-sheets-panel-stack,
.google-sheets-tool-stack,
.google-sheets-results-stack,
.google-sheets-result-stack,
.google-sheets-detail-stack {
  gap: 8px;
}

.google-sheets-panel-header,
.google-sheets-results-header {
  margin-bottom: 8px;
  align-items: center;
}

.google-sheets-panel-actions,
.google-sheets-results-header-actions,
.google-sheets-maintenance-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.google-sheets-results-header-actions,
.google-sheets-maintenance-badges {
  justify-content: flex-end;
}

.google-sheets-panel-actions button,
.google-sheets-tool-form .actions button {
  min-height: 34px;
  padding: 7px 12px;
}

.google-sheets-panel-banner,
.google-sheets-results-note {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.google-sheets-results-note {
  color: var(--mt-muted);
  background: var(--mt-surface-muted);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.google-sheets-meta-grid {
  display: grid;
  gap: 8px 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.google-sheets-meta-item {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
  min-width: 0;
}

.google-sheets-meta-item strong {
  font-size: 12px;
  color: var(--mt-text);
  overflow-wrap: anywhere;
}

.google-sheets-meta-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

.google-sheets-meta-item-wide {
  grid-column: span 2;
}

.google-sheets-maintenance-panel summary {
  padding: 14px 16px;
}

.google-sheets-maintenance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.google-sheets-maintenance-summary .muted {
  font-size: 12px;
}

.google-sheets-maintenance-body {
  gap: 14px;
  padding: 14px;
}

.google-sheets-tab-grid {
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.google-sheets-tab-grid .checkbox-row {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 500;
}

.google-sheets-tool-form {
  gap: 10px;
}

.google-sheets-tool-form .actions {
  justify-content: flex-end;
}

.google-sheets-compact-table table {
  min-width: 360px;
}

.google-sheets-result-strip {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.google-sheets-result-metric-card {
  padding: 10px 12px;
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.18);
}

.google-sheets-result-metric-card h3 {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.google-sheets-log-block {
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  max-height: 260px;
  overflow: auto;
}

.fsc-admin-page {
  gap: 14px;
}

.fsc-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.fsc-summary-card,
.fsc-form-card,
.fsc-table-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.fsc-summary-card .metric {
  font-size: 22px;
}

.fsc-form-stack {
  gap: 8px;
}

.fsc-form-header,
.fsc-table-header {
  margin-bottom: 10px;
  align-items: center;
}

.fsc-form-heading {
  gap: 2px;
}

.fsc-form-header-actions,
.fsc-table-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fsc-table-summary {
  justify-content: flex-end;
}

.fsc-form-grid {
  gap: 8px 10px;
  grid-template-columns:
    minmax(150px, 1fr)
    minmax(110px, 0.78fr)
    minmax(96px, 0.72fr)
    minmax(126px, 0.88fr)
    minmax(180px, 1.28fr);
  align-items: end;
}

.fsc-form-grid .span-2 {
  grid-column: 1 / -1;
}

.fsc-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.fsc-form-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.fsc-form-field input,
.fsc-form-field textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.fsc-form-notes textarea {
  min-height: 34px;
  resize: vertical;
}

.fsc-form-actions {
  justify-content: flex-end;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.fsc-form-card .actions button,
.fsc-form-card .actions .button {
  min-height: 34px;
  padding: 7px 12px;
}

.table-wrap.table-admin-wide.table-fsc table {
  min-width: 920px;
}

.table-wrap.table-fsc th,
.table-wrap.table-fsc td {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
}

.table-wrap.table-fsc th {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.table-wrap.table-fsc td:nth-child(1),
.table-wrap.table-fsc td:nth-child(2),
.table-wrap.table-fsc td:nth-child(3),
.table-wrap.table-fsc td:nth-child(4),
.table-wrap.table-fsc td:nth-child(6) {
  white-space: nowrap;
}

.fsc-status-badge,
.fsc-source-badge {
  min-height: 22px;
}

.fsc-status-current {
  background: var(--mt-info-bg);
  color: var(--mt-info);
  border-color: rgba(var(--mt-primary-rgb), 0.16);
}

.fsc-source-badge {
  background: rgba(var(--mt-primary-rgb), 0.09);
  color: var(--mt-primary);
  border-color: rgba(var(--mt-primary-rgb), 0.14);
}

.fsc-empty-value {
  color: var(--mt-muted);
}

.fsc-empty-state {
  padding: 20px 10px;
}

.fuel-prices-page {
  gap: 14px;
}

.fuel-prices-summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.fuel-prices-summary-card,
.fuel-prices-import-card,
.fuel-prices-table-card,
.fuel-prices-settings-card,
.fuel-prices-preview-card {
  padding: 12px 14px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.fuel-prices-summary-card .metric {
  font-size: 22px;
}

.fuel-prices-import-header,
.fuel-prices-table-header,
.fuel-prices-settings-header,
.fuel-prices-preview-header {
  margin-bottom: 10px;
  align-items: center;
}

.fuel-prices-import-heading,
.fuel-prices-settings-header .card-heading,
.fuel-prices-preview-header .card-heading {
  gap: 2px;
}

.fuel-prices-import-actions,
.fuel-prices-table-summary,
.fuel-prices-settings-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fuel-prices-settings-header-actions {
  justify-content: flex-end;
}

.fuel-prices-table-summary {
  justify-content: flex-end;
}

.fuel-prices-import-meta {
  display: grid;
  gap: 6px 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  font-size: 12px;
  color: var(--mt-muted);
}

.fuel-prices-tools-stack {
  gap: 14px;
}

.fuel-prices-settings-stack,
.fuel-prices-preview-stack {
  gap: 8px;
}

.fuel-prices-settings-card.is-locked {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
  border-color: rgba(148, 163, 184, 0.3);
}

.fuel-prices-settings-lock-badge.locked {
  background: var(--mt-neutral-bg);
  color: var(--mt-neutral);
  border-color: rgba(71, 84, 103, 0.16);
}

.fuel-prices-settings-lock-badge.unlocked {
  background: rgba(var(--mt-primary-rgb), 0.09);
  color: var(--mt-primary);
  border-color: rgba(var(--mt-primary-rgb), 0.16);
}

.fuel-prices-settings-grid {
  gap: 8px 10px;
  grid-template-columns:
    minmax(110px, 0.78fr)
    minmax(86px, 0.58fr)
    minmax(118px, 0.78fr)
    minmax(120px, 0.78fr)
    minmax(120px, 0.78fr)
    minmax(128px, 0.84fr)
    minmax(120px, 0.78fr)
    auto;
  align-items: end;
}

.fuel-prices-settings-grid .span-2 {
  grid-column: 1 / -1;
}

.fuel-prices-setting-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.fuel-prices-setting-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.fuel-prices-setting-field input,
.fuel-prices-setting-field textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.fuel-prices-settings-card.is-locked .fuel-prices-setting-field input[disabled] {
  background: #f8fafc;
  color: var(--mt-text);
  border-color: rgba(148, 163, 184, 0.38);
  opacity: 1;
  cursor: not-allowed;
}

.fuel-prices-settings-actions,
.fuel-prices-preview-actions {
  justify-content: flex-end;
}

.fuel-prices-settings-actions {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
  align-self: end;
}

.fuel-prices-settings-toggle,
.fuel-prices-settings-grid .actions button[disabled] {
  min-height: 34px;
  padding: 7px 12px;
}

.fuel-prices-settings-grid .actions button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.fuel-prices-preview-grid {
  gap: 8px 10px;
  grid-template-columns: minmax(160px, 220px) max-content;
  align-items: end;
  justify-content: start;
}

.fuel-prices-preview-actions {
  align-self: end;
  justify-content: flex-start;
}

.fuel-prices-preview-actions .actions {
  flex-wrap: nowrap;
}

.fuel-prices-preview-grid .actions button,
.fuel-prices-settings-grid .actions button,
.fuel-prices-import-actions button,
.fuel-price-create-button {
  min-height: 34px;
  padding: 7px 12px;
}

.fuel-prices-preview-card .banner {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.table-wrap.table-admin-xl.table-fuel-prices table {
  min-width: 1180px;
}

.table-wrap.table-delivery-entry th,
.table-wrap.table-delivery-entry td {
  font-size: 12px;
}

.table-wrap.table-delivery-entry td:nth-child(1),
.table-wrap.table-delivery-entry td:nth-child(2),
.table-wrap.table-delivery-entry td:nth-child(5),
.table-wrap.table-delivery-entry td:nth-child(6),
.table-wrap.table-delivery-entry td:nth-child(7) {
  white-space: nowrap;
}

.deliveries-page {
  gap: 14px;
}

.completed-deliveries-tabs {
  margin-bottom: 2px;
}

.deliveries-filter-card {
  padding: 12px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.deliveries-filter-bar {
  display: grid;
  gap: 10px 12px;
  align-items: end;
  grid-template-columns:
    124px
    124px
    minmax(180px, 1fr)
    160px
    104px
    auto;
}

.freight-invoiced-filter-bar {
  gap: 10px 8px;
  grid-template-columns:
    124px
    124px
    minmax(120px, 1fr)
    minmax(128px, 144px)
    104px
    104px
    max-content;
}

.freight-invoiced-filter-bar .deliveries-filter-actions {
  flex-wrap: nowrap;
}

.completed-deliveries-filter-bar {
  gap: 10px 8px;
  grid-template-columns:
    104px
    104px
    minmax(112px, 1fr)
    minmax(68px, 78px)
    minmax(136px, 168px)
    92px
    max-content;
}

.completed-deliveries-filter-bar .deliveries-filter-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.completed-deliveries-filter-bar .deliveries-filter-actions button {
  min-height: 36px;
  padding: 7px 10px;
}

.inventory-ledger-filter-bar {
  grid-template-columns: 124px 124px minmax(120px, 150px) max-content;
}

.inventory-ledger-filter-bar .deliveries-filter-actions {
  justify-content: flex-start;
}

.railcar-unloading-filter-bar {
  grid-template-columns: 124px 124px minmax(150px, 220px) max-content;
}

.railcar-unloading-filter-bar .deliveries-filter-actions {
  justify-content: flex-start;
}

.deliveries-filter-bar-operator {
  grid-template-columns: minmax(220px, 280px) 124px auto;
}

.deliveries-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.deliveries-filter-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.deliveries-filter-field input,
.deliveries-filter-field select {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.transload-invoiced-filter-bar {
  grid-template-columns:
    124px
    124px
    160px
    160px
    160px
    max-content;
}

.transload-invoiced-filter-bar .deliveries-filter-actions {
  justify-content: flex-start;
}

.deliveries-filter-limit {
  max-width: 104px;
}

.deliveries-filter-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: max-content;
}

.deliveries-table-shell {
  border-radius: 12px;
  box-shadow: none;
}

.weekly-report-controls {
  grid-template-columns: minmax(240px, 320px) auto;
}

.weekly-report-print-area {
  display: grid;
  gap: 10px;
}

.weekly-report-heading {
  display: grid;
  gap: 2px;
}

.weekly-report-heading h3,
.weekly-report-heading p {
  margin: 0;
}

.weekly-report-heading p {
  color: var(--mt-muted);
  font-size: 13px;
}

.table-wrap.table-deliveries th,
.table-wrap.table-deliveries td {
  font-size: 12px;
}

.table-wrap.table-deliveries th {
  padding: 8px 9px;
}

.table-wrap.table-deliveries td {
  padding: 8px 9px;
}

.table-wrap.table-deliveries td:nth-child(1),
.table-wrap.table-deliveries td:nth-child(2),
.table-wrap.table-deliveries td:nth-child(3),
.table-wrap.table-deliveries td:nth-child(6),
.table-wrap.table-deliveries td:nth-child(7),
.table-wrap.table-deliveries td:nth-child(8),
.table-wrap.table-deliveries td:nth-child(10) {
  white-space: nowrap;
}

.table-wrap.table-deliveries th:last-child {
  width: 1%;
  white-space: nowrap;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}

.table-pagination-top {
  padding-bottom: 8px;
}

.table-pagination-summary,
.table-pagination-status {
  font-size: 12px;
  color: var(--mt-muted);
}

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

.table-wrap th.sortable-column {
  padding: 0;
}

.sort-header-button,
.sort-header-button:hover {
  width: 100%;
  min-height: 0;
  padding: 8px 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #475569;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.sort-header-button:hover {
  background: rgba(248, 250, 252, 0.92);
  color: var(--mt-text);
}

.sort-header-label {
  min-width: 0;
  text-align: left;
}

.sort-indicator {
  flex: 0 0 auto;
  color: #98a2b3;
  font-size: 10px;
  line-height: 1;
}

.sortable-column.is-sorted .sort-header-button {
  color: var(--mt-text);
}

.sortable-column.is-sorted .sort-indicator {
  color: var(--mt-primary);
}

.row-action-cell {
  width: 1%;
  white-space: nowrap;
}

.row-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.row-icon-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--mt-border);
  background: var(--mt-surface);
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.row-icon-button:hover {
  background: var(--mt-surface-muted);
  border-color: var(--mt-border-strong);
  color: var(--mt-text);
}

.row-icon-button span {
  pointer-events: none;
}

.row-icon-button-danger {
  color: #b42318;
}

.row-icon-button-danger:hover {
  border-color: rgba(180, 35, 24, 0.3);
  color: #991b1b;
  background: #fef2f2;
}

.row-icon-button:disabled,
.row-icon-button:disabled:hover {
  cursor: not-allowed;
  opacity: 0.5;
  background: var(--mt-surface);
  border-color: var(--mt-border);
  color: #98a2b3;
}

.row-text-button {
  min-height: 28px;
  max-width: 150px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--mt-border);
  background: var(--mt-surface);
  color: #475569;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.row-text-button:hover {
  background: var(--mt-surface-muted);
  border-color: var(--mt-border-strong);
  color: var(--mt-text);
}

.deliveries-edit-card {
  border-color: rgba(var(--mt-primary-rgb), 0.16);
  background: linear-gradient(180deg, rgba(248, 251, 246, 0.98), rgba(255, 255, 255, 0.98));
  padding: 14px;
}

.deliveries-edit-header {
  margin-bottom: 14px;
}

.deliveries-edit-heading h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--mt-text);
}

.deliveries-edit-lock {
  align-self: flex-start;
}

.deliveries-edit-form {
  gap: 10px 12px;
  grid-template-columns:
    118px
    112px
    160px
    minmax(140px, 0.55fr)
    112px
    112px
    112px
    122px
    minmax(180px, 1.45fr);
  align-items: end;
}

.deliveries-edit-form .operations-entry-comments {
  min-width: 180px;
}

.deliveries-edit-form .deliveries-edit-footer {
  grid-column: 1 / -1;
}

.freight-detail-modal.delivery-edit-modal .modal-panel {
  width: min(1040px, calc(100vw - 32px));
  box-sizing: border-box;
  overflow-x: hidden;
}

.delivery-edit-modal .deliveries-edit-card {
  border: 0;
  box-shadow: none;
  padding: 0;
}

.delivery-edit-modal .deliveries-edit-form {
  grid-template-columns:
    minmax(140px, 150px)
    minmax(120px, 145px)
    minmax(120px, 150px)
    minmax(72px, 90px)
    minmax(130px, 150px)
    minmax(112px, 125px)
    minmax(0, 1fr);
  gap: 14px 16px;
  align-items: start;
}

.delivery-edit-modal .operations-entry-field,
.delivery-edit-modal .operations-entry-comments {
  min-width: 0;
}

.delivery-edit-modal .operations-entry-field select,
.delivery-edit-modal .operations-entry-field input,
.delivery-edit-modal .operations-entry-comments textarea {
  max-width: 100%;
  min-width: 0;
}

.delivery-edit-modal .operations-entry-field select {
  overflow: hidden;
  text-overflow: ellipsis;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(1) {
  grid-column: 1;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(2) {
  grid-column: 2;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(3) {
  grid-column: 3 / span 2;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(4) {
  grid-column: 5 / -1;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(5) {
  grid-column: 1;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(6) {
  grid-column: 2;
}

.delivery-edit-modal .deliveries-edit-form > label:nth-of-type(7) {
  grid-column: 3;
}

.delivery-edit-modal .deliveries-edit-form .operations-entry-comments {
  grid-column: 4 / -1;
}

.delivery-edit-modal .deliveries-edit-form .deliveries-edit-footer {
  grid-column: 1 / -1;
}

.delivery-edit-modal .deliveries-edit-footer {
  display: grid;
  gap: 12px;
  align-items: start;
}

.delivery-edit-modal .operations-entry-actions {
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .delivery-edit-modal .deliveries-edit-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .delivery-edit-modal .deliveries-edit-form > label:nth-of-type(n) {
    grid-column: auto;
  }

  .delivery-edit-modal .deliveries-edit-form .operations-entry-comments,
  .delivery-edit-modal .deliveries-edit-form .deliveries-edit-footer {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .freight-detail-modal.delivery-edit-modal .modal-panel {
    width: min(100%, calc(100vw - 24px));
    padding: 18px;
  }

  .delivery-edit-modal .deliveries-edit-form {
    grid-template-columns: 1fr;
  }

  .delivery-edit-modal .deliveries-edit-form > label:nth-of-type(n) {
    grid-column: 1;
  }
}

.rate-lookup-page {
  gap: 14px;
}

.rate-lookup-filter-card {
  padding: 12px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.rate-lookup-filter-bar {
  display: grid;
  gap: 10px 12px;
  align-items: end;
  grid-template-columns:
    minmax(260px, 1fr)
    160px
    150px
    104px
    auto;
}

.rate-lookup-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.rate-lookup-filter-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.rate-lookup-filter-field input,
.rate-lookup-filter-field select {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.rate-lookup-filter-limit {
  max-width: 104px;
}

.rate-lookup-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: max-content;
}

.table-wrap.table-rate-lookup th,
.table-wrap.table-rate-lookup td {
  font-size: 12px;
}

.table-wrap.table-rate-lookup th {
  padding: 8px 9px;
}

.table-wrap.table-rate-lookup td {
  padding: 8px 9px;
}

.rate-type-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rate-type-chip {
  padding: 5px 8px;
  font-size: 11px;
}

.freight-page {
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.freight-page .card,
.freight-page .summary-strip,
.freight-page .table-wrap {
  min-width: 0;
  max-width: 100%;
}

.freight-review-widget {
  padding: 14px;
  border-color: rgba(220, 38, 38, 0.32);
  background: #fff5f5;
  box-shadow: none;
}

.freight-review-widget-success {
  border-color: rgba(22, 163, 74, 0.28);
  background: #f0fdf4;
}

.freight-review-widget-success .metric,
.freight-review-widget-success .freight-review-widget-actions {
  color: #15803d;
}

.freight-review-widget-header,
.freight-ar-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.freight-review-widget h3,
.freight-ar-section h3 {
  margin: 0;
}

.freight-review-widget .metric {
  color: #b91c1c;
  font-size: 28px;
  line-height: 1.05;
}

.freight-review-widget-actions,
.freight-ar-metrics,
.freight-paid-filter-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.freight-review-widget-actions {
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
}

.freight-ar-section {
  padding: 14px;
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: none;
  min-width: 0;
  overflow: hidden;
}

.freight-ar-action-form {
  margin: 10px 0 12px;
}

.freight-payment-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 10px 0 12px;
}

.freight-payment-panel {
  min-width: 0;
}

.freight-payment-record-panel {
  justify-self: end;
  width: fit-content;
  max-width: 100%;
  border-left: 1px solid rgba(148, 163, 184, 0.32);
  padding-left: 16px;
}

.freight-payment-panel-title {
  margin-bottom: 7px;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.freight-payment-filter-form {
  display: grid;
  grid-template-columns: minmax(128px, 144px) minmax(128px, 144px) minmax(104px, 124px) minmax(104px, 124px);
  gap: 6px 8px;
  align-items: end;
  justify-content: start;
  min-width: 0;
}

.freight-payment-filter-form label {
  min-width: 0;
}

.freight-payment-filter-form input,
.freight-payment-action-form.freight-bulk-form input,
.freight-payment-action-form.freight-bulk-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.freight-payment-filter-actions {
  display: flex;
  grid-column: 3 / 5;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
}

.freight-payment-filter-actions button,
.freight-payment-action-form button {
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12px;
}

.freight-payment-action-form.freight-ar-action-form {
  margin: 0;
}

.freight-payment-action-form.freight-action-compact-form {
  width: max-content;
  max-width: 100%;
  grid-template-columns: minmax(112px, 128px) minmax(130px, 176px) max-content;
  gap: 7px 8px;
  align-items: end;
  justify-content: end;
}

.freight-payment-action-form.freight-action-compact-form .freight-payment-paid-date-field {
  grid-column: 1;
}

.freight-payment-action-form.freight-action-compact-form .freight-payment-reference-field {
  grid-column: 2;
}

.freight-payment-action-form.freight-action-compact-form .freight-bulk-notes-field {
  grid-column: 1 / 3;
}

.freight-payment-action-form.freight-action-compact-form textarea.textarea-one-line {
  height: 32px;
  resize: none;
}

.freight-payment-action-form.freight-action-compact-form .freight-bulk-footer {
  grid-column: 3;
  align-self: end;
  justify-content: flex-start;
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.freight-payment-action-form.freight-action-compact-form .actions {
  flex-wrap: nowrap;
}

.freight-total-chip {
  background: #ecfdf5;
  border-color: rgba(5, 150, 105, 0.24);
  color: #047857;
}

.freight-empty-compact {
  padding: 14px;
}

.freight-table-compact {
  margin-top: 10px;
}

.freight-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.freight-edit-card {
  padding: 14px;
  box-shadow: none;
}

.freight-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.freight-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.freight-edit-form input,
.freight-edit-form select,
.freight-edit-form textarea {
  min-height: 36px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--mt-text);
}

.payment-application-force-match-actions {
  gap: 12px;
  margin: 12px 0 16px;
}

.freight-status-tabs {
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
}

.freight-status-tabs .tab-button {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.freight-filter-card {
  padding: 12px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.freight-filter-bar {
  display: grid;
  gap: 10px 12px;
  align-items: end;
  grid-template-columns:
    124px
    124px
    minmax(180px, 1fr)
    160px
    132px
    104px
    auto;
}

.freight-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.freight-filter-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.freight-filter-field input,
.freight-filter-field select {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.freight-filter-limit {
  max-width: 104px;
}

.freight-review-toggle {
  min-height: 36px;
  align-self: center;
}

.freight-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: max-content;
}

.freight-bulk-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.freight-bulk-card {
  padding: 12px;
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: none;
}

.freight-bulk-header {
  margin-bottom: 4px;
}

.freight-bulk-form {
  gap: 8px 10px;
  grid-template-columns: 146px 166px minmax(180px, 1fr);
  align-items: end;
}

.freight-bulk-form label {
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.freight-bulk-form input,
.freight-bulk-form textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--mt-text);
}

.freight-bulk-count {
  align-self: flex-start;
  font-size: 11px;
  padding: 6px 10px;
}

.freight-bulk-footer {
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 2px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.freight-action-compact-form {
  grid-template-columns: 146px 166px clamp(92px, 12vw, 170px) max-content;
}

.freight-action-compact-form .freight-bulk-footer {
  grid-column: auto;
  justify-content: flex-start;
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.freight-action-compact-form .actions {
  flex-wrap: nowrap;
}

.freight-action-compact-form button {
  white-space: nowrap;
}

.freight-summary-strip {
  gap: 10px;
}

.freight-summary-strip .card {
  padding: 14px;
}

.freight-summary-strip h3 {
  font-size: 11px;
  font-weight: 600;
}

.freight-summary-strip .metric {
  font-size: 22px;
}

.freight-ar-summary-card-action {
  cursor: pointer;
}

.freight-ar-summary-card-action:hover {
  border-color: rgba(var(--mt-primary-rgb), 0.28);
  box-shadow: var(--mt-shadow-sm);
}

.freight-ar-summary-card-error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fff1f2;
}

.freight-ar-summary-card-error .metric {
  color: #b91c1c;
}

.freight-ar-summary-card-success {
  border-color: rgba(22, 163, 74, 0.28);
  background: #f0fdf4;
}

.freight-ar-summary-card-success .metric {
  color: #15803d;
}

.freight-table-shell {
  border-radius: 12px;
  box-shadow: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.table-wrap.table-freight th,
.table-wrap.table-freight td {
  font-size: 11px;
  line-height: 1.25;
}

.table-wrap.table-freight th {
  padding: 7px 6px;
}

.table-wrap.table-freight td {
  padding: 7px 6px;
}

.table-wrap.table-freight .sort-header-button,
.table-wrap.table-freight .sort-header-button:hover {
  display: flex;
  align-items: center;
  padding: 7px 5px;
  gap: 3px;
  line-height: 1.25;
  min-height: 28px;
}

.table-wrap.table-freight .status-tag {
  padding: 5px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.table-wrap.table-freight .issue-list {
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(108px, max-content));
}

.table-wrap.table-freight .issue-badge {
  padding: 5px 8px;
  font-size: 11px;
}

.table-wrap.table-freight table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
}

.freight-review-table,
.transload-review-table {
  min-width: 780px;
}

.freight-payment-table,
.transload-invoice-table,
.transload-payment-table {
  min-width: 900px;
}

.freight-invoice-table,
.freight-invoiced-table,
.transload-invoiced-table {
  min-width: 1040px;
}

.table-wrap.table-freight th {
  overflow-wrap: normal;
  vertical-align: middle;
  word-break: normal;
  white-space: nowrap;
}

.table-wrap.table-freight th:not(.sortable-column) {
  line-height: 1.25;
}

.table-wrap.table-freight td {
  overflow-wrap: normal;
  word-break: normal;
}

.table-wrap.table-freight .row-action-cell {
  width: 1%;
  min-width: 72px;
  white-space: nowrap;
}

.table-wrap.table-freight .row-action-buttons {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
}

.table-wrap.table-freight .row-text-button {
  max-width: 128px;
  min-width: 0;
  padding: 4px 5px;
  overflow-wrap: normal;
  word-break: normal;
}

.table-wrap.table-freight .issue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.table-wrap.table-freight .issue-badge {
  max-width: 100%;
  justify-content: flex-start;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.freight-review-table th:nth-child(1),
.freight-review-table td:nth-child(1),
.freight-invoice-table th:nth-child(2),
.freight-invoice-table td:nth-child(2),
.freight-payment-table th:nth-child(2),
.freight-payment-table td:nth-child(2),
.freight-payment-table th:nth-child(4),
.freight-payment-table td:nth-child(4),
.freight-invoiced-table th:nth-child(1),
.freight-invoiced-table td:nth-child(1),
.freight-invoiced-table th:nth-child(5),
.freight-invoiced-table td:nth-child(5),
.freight-invoiced-table th:nth-child(10),
.freight-invoiced-table td:nth-child(10),
.transload-review-table th:nth-child(1),
.transload-review-table td:nth-child(1),
.transload-invoice-table th:nth-child(2),
.transload-invoice-table td:nth-child(2),
.transload-payment-table th:nth-child(2),
.transload-payment-table td:nth-child(2),
.transload-payment-table th:nth-child(4),
.transload-payment-table td:nth-child(4),
.transload-invoiced-table th:nth-child(2),
.transload-invoiced-table td:nth-child(2),
.transload-invoiced-table th:nth-child(9),
.transload-invoiced-table td:nth-child(9) {
  width: 1%;
  min-width: 72px;
  overflow-wrap: normal;
  white-space: nowrap;
}

.freight-invoice-table th:nth-child(1),
.freight-invoice-table td:nth-child(1),
.freight-payment-table th:nth-child(1),
.freight-payment-table td:nth-child(1),
.transload-invoice-table th:nth-child(1),
.transload-invoice-table td:nth-child(1),
.transload-payment-table th:nth-child(1),
.transload-payment-table td:nth-child(1) {
  width: 32px;
  min-width: 32px;
  overflow-wrap: normal;
  white-space: nowrap;
}

.freight-review-table th:nth-child(2),
.freight-review-table td:nth-child(2),
.freight-invoice-table th:nth-child(3),
.freight-invoice-table td:nth-child(3),
.freight-payment-table th:nth-child(3),
.freight-payment-table td:nth-child(3),
.freight-payment-table th:nth-child(5),
.freight-payment-table td:nth-child(5),
.freight-invoiced-table th:nth-child(2),
.freight-invoiced-table td:nth-child(2),
.transload-invoice-table th:nth-child(3),
.transload-invoice-table td:nth-child(3),
.transload-payment-table th:nth-child(5),
.transload-payment-table td:nth-child(5),
.transload-invoiced-table th:nth-child(3),
.transload-invoiced-table td:nth-child(3) {
  width: 1%;
  min-width: 58px;
  white-space: nowrap;
}

.freight-invoice-table th:nth-child(4),
.freight-invoice-table td:nth-child(4),
.transload-review-table th:nth-child(3),
.transload-review-table td:nth-child(3),
.transload-invoice-table th:nth-child(4),
.transload-invoice-table td:nth-child(4),
.transload-payment-table th:nth-child(6),
.transload-payment-table td:nth-child(6),
.transload-invoiced-table th:nth-child(4),
.transload-invoiced-table td:nth-child(4) {
  width: 1%;
  min-width: 68px;
  white-space: nowrap;
}

.freight-review-table th:nth-child(3),
.freight-review-table td:nth-child(3),
.freight-invoice-table th:nth-child(5),
.freight-invoice-table td:nth-child(5),
.freight-payment-table th:nth-child(6),
.freight-payment-table td:nth-child(6),
.freight-invoiced-table th:nth-child(6),
.freight-invoiced-table td:nth-child(6) {
  width: 10%;
  min-width: 92px;
  white-space: normal;
}

.freight-review-table th:nth-child(4),
.freight-review-table td:nth-child(4),
.freight-invoice-table th:nth-child(6),
.freight-invoice-table td:nth-child(6),
.freight-payment-table th:nth-child(7),
.freight-payment-table td:nth-child(7),
.freight-invoiced-table th:nth-child(7),
.freight-invoiced-table td:nth-child(7) {
  width: 13%;
  min-width: 110px;
  white-space: normal;
}

.freight-invoice-table th:nth-child(7),
.freight-invoice-table td:nth-child(7),
.freight-payment-table th:nth-child(8),
.freight-payment-table td:nth-child(8),
.transload-review-table th:nth-child(4),
.transload-review-table td:nth-child(4),
.transload-invoice-table th:nth-child(5),
.transload-invoice-table td:nth-child(5),
.transload-payment-table th:nth-child(7),
.transload-payment-table td:nth-child(7),
.transload-invoiced-table th:nth-child(5),
.transload-invoiced-table td:nth-child(5) {
  width: 1%;
  min-width: 58px;
  white-space: nowrap;
}

.freight-invoice-table th:nth-child(8),
.freight-invoice-table td:nth-child(8),
.freight-invoice-table th:nth-child(10),
.freight-invoice-table td:nth-child(10),
.freight-payment-table th:nth-child(9),
.freight-payment-table td:nth-child(9),
.freight-invoiced-table th:nth-child(8),
.freight-invoiced-table td:nth-child(8),
.transload-review-table th:nth-child(5),
.transload-review-table td:nth-child(5),
.transload-review-table th:nth-child(6),
.transload-review-table td:nth-child(6),
.transload-invoice-table th:nth-child(6),
.transload-invoice-table td:nth-child(6),
.transload-invoice-table th:nth-child(7),
.transload-invoice-table td:nth-child(7),
.transload-payment-table th:nth-child(8),
.transload-payment-table td:nth-child(8),
.transload-invoiced-table th:nth-child(6),
.transload-invoiced-table td:nth-child(6),
.transload-invoiced-table th:nth-child(7),
.transload-invoiced-table td:nth-child(7) {
  width: 1%;
  min-width: 72px;
  white-space: nowrap;
}

.freight-invoice-table th:nth-child(9),
.freight-invoice-table td:nth-child(9) {
  width: 1%;
  min-width: 58px;
  white-space: nowrap;
}

.freight-invoiced-table th:nth-child(9),
.freight-invoiced-table td:nth-child(9),
.transload-invoiced-table th:nth-child(8),
.transload-invoiced-table td:nth-child(8) {
  width: 1%;
  min-width: 74px;
  white-space: nowrap;
}

.freight-review-table th:nth-child(7),
.freight-review-table td:nth-child(7),
.freight-invoice-table th:nth-child(12),
.freight-invoice-table td:nth-child(12),
.freight-payment-table th:nth-child(10),
.freight-payment-table td:nth-child(10),
.freight-invoiced-table th:nth-child(11),
.freight-invoiced-table td:nth-child(11),
.transload-review-table th:nth-child(7),
.transload-review-table td:nth-child(7),
.transload-invoice-table th:nth-child(8),
.transload-invoice-table td:nth-child(8),
.transload-payment-table th:nth-child(9),
.transload-payment-table td:nth-child(9),
.transload-invoiced-table th:nth-child(10),
.transload-invoiced-table td:nth-child(10) {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.freight-review-table td:nth-child(7),
.freight-invoice-table td:nth-child(12),
.freight-payment-table td:nth-child(10),
.freight-invoiced-table td:nth-child(11),
.transload-review-table td:nth-child(7),
.transload-invoice-table td:nth-child(8),
.transload-payment-table td:nth-child(9),
.transload-invoiced-table td:nth-child(10) {
  overflow-wrap: anywhere;
}

.freight-invoiced-table th:nth-child(12),
.freight-invoiced-table td:nth-child(12),
.transload-review-table th:nth-child(8),
.transload-review-table td:nth-child(8),
.transload-invoice-table th:nth-child(9),
.transload-invoice-table td:nth-child(9),
.transload-invoiced-table th:nth-child(11),
.transload-invoiced-table td:nth-child(11) {
  width: 1%;
  min-width: 72px;
  white-space: nowrap;
}

.table-wrap.table-freight .transload-review-table,
.table-wrap.table-freight .transload-invoice-table,
.table-wrap.table-freight .transload-payment-table,
.table-wrap.table-freight .transload-invoiced-table {
  table-layout: fixed;
}

.transload-review-table {
  min-width: 760px;
}

.transload-invoice-table,
.transload-payment-table {
  min-width: 820px;
}

.transload-invoiced-table {
  min-width: 960px;
}

.transload-review-table th:nth-child(1),
.transload-review-table td:nth-child(1),
.transload-invoice-table th:nth-child(2),
.transload-invoice-table td:nth-child(2),
.transload-payment-table th:nth-child(2),
.transload-payment-table td:nth-child(2),
.transload-invoiced-table th:nth-child(2),
.transload-invoiced-table td:nth-child(2),
.transload-invoiced-table th:nth-child(9),
.transload-invoiced-table td:nth-child(9) {
  width: 104px;
  min-width: 104px;
}

.transload-invoice-table th:nth-child(1),
.transload-invoice-table td:nth-child(1),
.transload-payment-table th:nth-child(1),
.transload-payment-table td:nth-child(1) {
  width: 36px;
  min-width: 36px;
}

.transload-invoiced-table th:nth-child(1),
.transload-invoiced-table td:nth-child(1),
.transload-invoice-table th:nth-child(3),
.transload-invoice-table td:nth-child(3),
.transload-payment-table th:nth-child(3),
.transload-payment-table td:nth-child(3),
.transload-payment-table th:nth-child(5),
.transload-payment-table td:nth-child(5),
.transload-invoiced-table th:nth-child(3),
.transload-invoiced-table td:nth-child(3) {
  width: 94px;
  min-width: 94px;
}

.transload-review-table th:nth-child(3),
.transload-review-table td:nth-child(3),
.transload-invoice-table th:nth-child(4),
.transload-invoice-table td:nth-child(4),
.transload-payment-table th:nth-child(6),
.transload-payment-table td:nth-child(6),
.transload-invoiced-table th:nth-child(4),
.transload-invoiced-table td:nth-child(4) {
  width: 90px;
  min-width: 90px;
}

.transload-review-table th:nth-child(4),
.transload-review-table td:nth-child(4),
.transload-invoice-table th:nth-child(5),
.transload-invoice-table td:nth-child(5),
.transload-payment-table th:nth-child(7),
.transload-payment-table td:nth-child(7),
.transload-invoiced-table th:nth-child(5),
.transload-invoiced-table td:nth-child(5) {
  width: 74px;
  min-width: 74px;
}

.transload-review-table th:nth-child(5),
.transload-review-table td:nth-child(5),
.transload-invoice-table th:nth-child(6),
.transload-invoice-table td:nth-child(6),
.transload-invoiced-table th:nth-child(6),
.transload-invoiced-table td:nth-child(6) {
  width: 92px;
  min-width: 92px;
}

.transload-review-table th:nth-child(6),
.transload-review-table td:nth-child(6),
.transload-invoice-table th:nth-child(7),
.transload-invoice-table td:nth-child(7),
.transload-payment-table th:nth-child(8),
.transload-payment-table td:nth-child(8),
.transload-invoiced-table th:nth-child(7),
.transload-invoiced-table td:nth-child(7) {
  width: 90px;
  min-width: 90px;
}

.transload-invoiced-table th:nth-child(8),
.transload-invoiced-table td:nth-child(8) {
  width: 88px;
  min-width: 88px;
}

.transload-review-table th:nth-child(7),
.transload-review-table td:nth-child(7),
.transload-invoice-table th:nth-child(8),
.transload-invoice-table td:nth-child(8),
.transload-payment-table th:nth-child(9),
.transload-payment-table td:nth-child(9),
.transload-invoiced-table th:nth-child(10),
.transload-invoiced-table td:nth-child(10) {
  width: auto;
  min-width: 140px;
}

.transload-review-table th:nth-child(8),
.transload-review-table td:nth-child(8),
.transload-invoice-table th:nth-child(9),
.transload-invoice-table td:nth-child(9),
.transload-invoiced-table th:nth-child(11),
.transload-invoiced-table td:nth-child(11) {
  width: 78px;
  min-width: 78px;
}

.freight-invoice-table {
  min-width: 1120px;
}

.freight-invoice-table th:nth-child(7),
.freight-invoice-table td:nth-child(7) {
  width: 13%;
  min-width: 110px;
  white-space: normal;
}

.freight-invoice-table th:nth-child(9),
.freight-invoice-table td:nth-child(9),
.freight-invoice-table th:nth-child(11),
.freight-invoice-table td:nth-child(11) {
  width: 1%;
  min-width: 72px;
  white-space: nowrap;
}

.freight-invoice-table th:nth-child(12),
.freight-invoice-table td:nth-child(12) {
  width: 1%;
  min-width: 78px;
  overflow-wrap: normal;
  white-space: nowrap;
}

.freight-invoice-table th:nth-child(13),
.freight-invoice-table td:nth-child(13) {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.freight-invoice-table td:nth-child(13) {
  overflow-wrap: anywhere;
}

.transload-payment-table {
  table-layout: fixed;
  width: max(100%, 920px);
  min-width: 920px;
}

.transload-payment-table th:nth-child(1),
.transload-payment-table td:nth-child(1) {
  width: 36px;
  min-width: 36px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(2),
.transload-payment-table td:nth-child(2) {
  width: 96px;
  min-width: 96px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(3),
.transload-payment-table td:nth-child(3) {
  width: 132px;
  min-width: 132px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(4),
.transload-payment-table td:nth-child(4) {
  width: 112px;
  min-width: 112px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(5),
.transload-payment-table td:nth-child(5) {
  width: 124px;
  min-width: 124px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(6),
.transload-payment-table td:nth-child(6) {
  width: 78px;
  min-width: 78px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(7),
.transload-payment-table td:nth-child(7) {
  width: 92px;
  min-width: 92px;
  white-space: nowrap;
}

.transload-payment-table th:nth-child(8),
.transload-payment-table td:nth-child(8) {
  min-width: 250px;
}

.transload-payment-table th:nth-child(8) {
  white-space: nowrap;
}

.transload-payment-table td:nth-child(8) {
  overflow-wrap: anywhere;
  white-space: normal;
}

.freight-detail-modal .modal-panel {
  width: min(1040px, 100%);
  padding: 20px;
}

.freight-detail-header {
  gap: 12px;
  align-items: flex-start;
}

.freight-detail-summary {
  min-width: 0;
}

.freight-detail-summary h2 {
  margin: 0;
  font-size: 20px;
}

.freight-detail-summary .muted {
  margin-top: 4px;
}

.handling-page {
  gap: 14px;
}

.handling-summary-strip {
  gap: 10px;
}

.handling-summary-strip .card {
  padding: 14px;
}

.handling-summary-strip h3 {
  font-size: 11px;
  font-weight: 600;
}

.handling-summary-strip .metric {
  font-size: 22px;
}

.handling-kpi-note {
  font-size: 11px;
  color: #94a3b8;
}

.handling-filter-card {
  padding: 12px 14px;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.handling-filter-bar {
  display: grid;
  gap: 10px 12px;
  align-items: end;
  grid-template-columns:
    minmax(180px, 1fr)
    minmax(180px, 1fr)
    138px
    138px
    128px
    auto;
}

.handling-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-weight: 500;
  color: var(--mt-text);
}

.handling-filter-field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.handling-filter-field input,
.handling-filter-field select {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.handling-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: max-content;
}

.handling-form-stack {
  gap: 12px;
}

.handling-form-mode {
  align-self: flex-start;
}

.handling-bulk-card {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  margin-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.handling-bulk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.handling-bulk-header h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--mt-text);
}

.handling-bulk-form {
  display: grid;
  gap: 8px 10px;
  align-items: end;
  grid-template-columns: 152px auto;
}

.handling-bulk-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.handling-bulk-field input {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.handling-bulk-count {
  font-size: 11px;
  padding: 6px 10px;
}

.handling-bulk-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
}

.handling-table-shell {
  border-radius: 12px;
  box-shadow: none;
}

.table-wrap.table-handling th,
.table-wrap.table-handling td {
  font-size: 12px;
}

.table-wrap.table-handling th {
  padding: 8px 9px;
}

.table-wrap.table-handling td {
  padding: 8px 9px;
}

.handling-select-head,
.handling-select-cell,
.handling-cell-date,
.handling-cell-railcar,
.handling-cell-tons,
.handling-cell-payment,
.handling-cell-paid-date,
.handling-cell-invoice {
  white-space: nowrap;
}

.handling-select-head,
.handling-select-cell {
  width: 1%;
  text-align: center;
}

.handling-select-head input,
.handling-select-cell input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.handling-row-selected td {
  background: rgba(var(--mt-primary-rgb), 0.045);
}

.handling-empty-value {
  color: #98a2b3;
}

.table-wrap.table-handling th:last-child {
  width: 1%;
  white-space: nowrap;
}

.handling-form-card {
  padding: 14px;
  border-color: rgba(var(--mt-primary-rgb), 0.16);
  background: linear-gradient(180deg, rgba(248, 251, 246, 0.98), rgba(255, 255, 255, 0.98));
}

.handling-form-header {
  margin-bottom: 2px;
}

.handling-form-grid {
  gap: 8px 8px;
  grid-template-columns:
    124px
    164px
    106px
    124px
    164px
    minmax(140px, 0.9fr)
    auto;
  align-items: end;
}

.handling-form-field {
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #64748b;
}

.handling-form-field input,
.handling-form-field textarea {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--mt-text);
}

.handling-form-notes textarea {
  min-height: 36px;
  height: 36px;
  resize: vertical;
}

.handling-form-actions {
  justify-content: flex-end;
  align-self: end;
  min-width: 0;
}

.handling-form-actions .actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.transload-rate-form-grid {
  grid-template-columns: 150px 150px minmax(120px, 220px) auto;
  align-items: end;
  justify-content: start;
}

.transload-rate-form-notes textarea {
  min-height: 36px;
  resize: vertical;
}

.transload-rate-form-actions {
  justify-content: flex-start;
}

.transload-rate-form-actions .actions {
  flex-wrap: nowrap;
}

.empty,
.empty-state,
.loading-state,
.admin-section-card {
  padding: 28px 8px;
  text-align: center;
}

.empty-state,
.loading-state {
  border: 1px dashed var(--mt-border-strong);
  border-radius: var(--mt-radius-md);
  background: var(--mt-surface-muted);
}

.table-wrap.table-deliveries table {
  min-width: 1100px;
}

.table-wrap.table-handling table {
  min-width: 980px;
}

.table-wrap.table-admin-wide table {
  min-width: 1120px;
}

.table-wrap.table-transload-rates table,
.table-wrap.table-handling-rates table {
  min-width: 860px;
}

.table-wrap.table-admin-xl table {
  min-width: 1360px;
}

.table-wrap.table-fuel-prices table {
  min-width: 1180px;
}

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

.table-wrap.table-fuel-prices th {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.table-wrap.table-fuel-prices td:nth-child(1),
.table-wrap.table-fuel-prices td:nth-child(2),
.table-wrap.table-fuel-prices td:nth-child(3),
.table-wrap.table-fuel-prices td:nth-child(4),
.table-wrap.table-fuel-prices td:nth-child(7) {
  white-space: nowrap;
}

.table-wrap.table-fuel-prices td:nth-child(6) {
  max-width: 140px;
  overflow-wrap: anywhere;
}

.table-wrap.table-fuel-prices td:nth-child(8) {
  min-width: 240px;
}

.table-wrap.table-fuel-prices td:nth-child(9) {
  min-width: 170px;
}

.table-wrap.table-fuel-prices td:nth-child(10) {
  width: 1%;
  white-space: nowrap;
}

.fuel-price-preview-badge,
.fuel-price-source-badge,
.fuel-price-status-badge {
  min-height: 22px;
}

.fuel-price-empty-value {
  color: var(--mt-muted);
}

.fuel-price-draft-fields {
  display: grid;
  gap: 8px;
}

.fuel-price-draft-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--mt-text);
}

.fuel-price-draft-field > span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.fuel-price-draft-field input,
.fuel-price-draft-field textarea {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.fuel-price-draft-notes textarea {
  min-height: 32px;
  resize: vertical;
}

.fuel-price-status-card {
  display: grid;
  gap: 6px;
}

.fuel-price-status-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--mt-text);
}

.fuel-price-status-detail {
  font-size: 12px;
  color: var(--mt-muted);
}

.fuel-price-create-button {
  white-space: nowrap;
}

.fuel-prices-empty-state {
  padding: 20px 10px;
}

tr.inactive-row td {
  background: rgba(95, 103, 109, 0.04);
}

select.select-menu {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-color: rgba(255, 255, 255, 0.96);
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 9px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

select.select-menu:disabled {
  color: #98a2b3;
  background-color: #f8fafc;
}

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

  .audit-filter-search {
    grid-column: 1 / -1;
  }

  .integrity-pagination-bar {
    align-items: flex-start;
  }

  .audit-pagination-bar {
    align-items: flex-start;
  }

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

  .google-sheets-overview-split,
  .google-sheets-tools-split,
  .google-sheets-result-detail-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .google-sheets-meta-item-wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .google-sheets-maintenance-summary {
    align-items: flex-start;
  }

  .google-sheets-panel-actions,
  .google-sheets-results-header-actions,
  .google-sheets-maintenance-badges {
    justify-content: flex-start;
  }
}

@media (max-width: 1180px) {
  #appView.app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 1480px) {
  .operations-entry-form,
  .deliveries-edit-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) {
  .deliveries-filter-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .freight-invoiced-filter-bar {
    grid-template-columns:
      minmax(108px, 116px)
      minmax(108px, 116px)
      minmax(96px, 1fr)
      minmax(108px, 128px)
      96px
      96px
      max-content;
  }

  .inventory-ledger-filter-bar {
    grid-template-columns: 124px 124px minmax(120px, 150px) max-content;
  }

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

  .freight-payment-filter-form {
    grid-template-columns: minmax(128px, 144px) minmax(128px, 144px) minmax(104px, 124px) minmax(104px, 124px);
  }

  .rate-lookup-filter-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .handling-filter-bar,
  .handling-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .handling-bulk-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .users-admin-layout {
    gap: 12px;
  }

  .users-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .railcar-unloading-entry-form.delivery-form,
  .carrier-form-grid.rates-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .railcar-unloading-entry-form.delivery-form .span-2,
  .carrier-form-grid.rates-form-grid .span-2,
  .carrier-notes-field,
  .carrier-form-actions {
    grid-column: 1 / -1;
  }

  .carrier-form-actions {
    justify-content: flex-start;
  }

  .rates-setup-grid {
    grid-template-columns: 1fr;
  }

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

  .fsc-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .deliveries-filter-bar-operator {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deliveries-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .freight-review-toggle,
  .freight-filter-actions,
  .rate-lookup-filter-actions {
    grid-column: 1 / -1;
  }

  .handling-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .freight-filter-actions {
    justify-content: flex-end;
  }

  .rate-lookup-filter-actions {
    justify-content: flex-end;
  }

  .rates-table-header-actions {
    justify-content: flex-start;
  }

}

@media (max-width: 980px) {
  #appView.app-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .app-sidebar {
    position: static;
    min-height: 0;
  }

  #sectionHeader,
  #sectionBody {
    padding-left: 18px;
    padding-right: 18px;
  }

  .split,
  .split.table-priority,
  .delivery-form,
  .filters-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .deliveries-filter-bar,
  .deliveries-filter-bar-operator {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .freight-payment-top-grid {
    grid-template-columns: 1fr;
  }

  .freight-payment-record-panel {
    justify-self: stretch;
    width: auto;
    max-width: none;
    border-left: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.32);
    padding-left: 0;
    padding-top: 12px;
  }

  .freight-payment-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .freight-payment-filter-actions {
    grid-column: 1 / -1;
  }

  .rate-lookup-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .handling-filter-bar,
  .handling-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deliveries-edit-form,
  .freight-bulk-form,
  .handling-bulk-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .rates-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .fuel-prices-settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .users-form-grid .span-2 {
    grid-column: span 1;
  }

  .rates-form-grid .span-2 {
    grid-column: span 3;
  }

  .fsc-form-grid .span-2 {
    grid-column: span 2;
  }

  .fuel-prices-settings-grid .span-2 {
    grid-column: span 3;
  }

  .fuel-prices-preview-grid {
    grid-template-columns: minmax(160px, 220px) auto;
  }

  .handling-form-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .handling-form-actions .actions {
    flex-wrap: wrap;
  }

  .table-pagination {
    justify-content: flex-end;
  }

  .deliveries-filter-limit {
    max-width: none;
  }

  .freight-filter-limit {
    max-width: none;
  }

  .rate-lookup-filter-limit {
    max-width: none;
  }

  .delivery-form .span-2,
  .filters-grid .span-2,
  .detail-grid .span-2 {
    grid-column: span 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .cargill-reconciliation-grid {
    grid-template-columns: 1fr;
  }

  .inventory-adjustment-actions {
    justify-content: flex-start;
  }

  .form-grid .span-2 {
    grid-column: span 1;
  }

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

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

  .settings-review-field-wide {
    grid-column: span 2;
  }

  .audit-filter-search,
  .audit-detail-item-wide {
    grid-column: span 2;
  }

  .integrity-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .toolbar {
    width: 100%;
  }

  .toolbar > * {
    width: 100%;
  }

  .button,
  button,
  .button.secondary,
  button.secondary {
    justify-content: center;
  }

  .operations-entry-form {
    grid-template-columns: 1fr;
  }

  .users-form-grid {
    grid-template-columns: 1fr;
  }

  .rates-form-grid {
    grid-template-columns: 1fr;
  }

  .rates-setup-grid .rates-form-grid {
    grid-template-columns: 1fr;
  }

  .railcar-unloading-entry-form.delivery-form,
  .railcar-arrival-unload-form,
  .carrier-form-grid.rates-form-grid {
    grid-template-columns: 1fr;
  }

  .railcar-unloading-entry-form.delivery-form .span-2,
  .carrier-form-grid.rates-form-grid .span-2 {
    grid-column: 1 / -1;
  }

  .railcar-unloading-form-actions,
  .carrier-form-actions {
    justify-content: stretch;
  }

  .railcar-unloading-form-actions .actions,
  .carrier-form-actions .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .railcar-unloading-form-actions button,
  .carrier-form-actions button {
    flex: 1 1 140px;
  }

  .transload-rate-form-grid {
    grid-template-columns: 1fr;
  }

  .fsc-form-grid {
    grid-template-columns: 1fr;
  }

  .fuel-prices-settings-grid,
  .fuel-prices-preview-grid {
    grid-template-columns: 1fr;
  }

  .inventory-adjustment-form {
    grid-template-columns: 1fr;
  }

  .inventory-adjustment-actions,
  .inventory-adjustment-actions .actions,
  .inventory-adjustment-actions button {
    width: 100%;
  }

  .deliveries-filter-bar,
  .deliveries-filter-bar-operator {
    grid-template-columns: 1fr;
  }

  .freight-status-tabs,
  .freight-filter-bar,
  .freight-payment-filter-form,
  .rate-lookup-filter-bar {
    grid-template-columns: 1fr;
  }

  .freight-payment-action-form.freight-action-compact-form {
    grid-template-columns: 1fr;
  }

  .freight-payment-action-form.freight-action-compact-form .freight-payment-paid-date-field,
  .freight-payment-action-form.freight-action-compact-form .freight-payment-reference-field,
  .freight-payment-action-form.freight-action-compact-form .freight-bulk-notes-field {
    grid-column: 1 / -1;
  }

  .freight-payment-action-form.freight-action-compact-form .freight-bulk-footer,
  .freight-payment-action-form.freight-action-compact-form .actions,
  .freight-payment-action-form.freight-action-compact-form button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .handling-filter-bar,
  .handling-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-review-grid,
  .settings-review-grid-compact,
  .settings-status-grid {
    grid-template-columns: 1fr;
  }

  .audit-filter-grid,
  .audit-detail-grid {
    grid-template-columns: 1fr;
  }

  .integrity-pagination-bar,
  .integrity-pagination-meta,
  .integrity-pagination-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .integrity-pagination-actions > * {
    width: 100%;
  }

  .audit-pagination-bar,
  .audit-pagination-meta,
  .audit-pagination-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .audit-pagination-actions > * {
    width: 100%;
  }

  .integrity-header-actions,
  .integrity-group-summary {
    justify-content: flex-start;
  }

  .settings-review-field-wide {
    grid-column: auto;
  }

  .audit-filter-search,
  .audit-detail-item-wide {
    grid-column: auto;
  }

  .deliveries-edit-form,
  .freight-bulk-form,
  .handling-bulk-form {
    grid-template-columns: 1fr;
  }

  .operations-entry-footer {
    align-items: flex-start;
  }

  .operations-entry-actions {
    width: 100%;
  }

  .deliveries-filter-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .completed-deliveries-filter-bar .deliveries-filter-actions {
    flex-wrap: wrap;
  }

  .deliveries-filter-actions > * {
    flex: 1 1 140px;
  }

  .freight-filter-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .freight-filter-actions > * {
    flex: 1 1 140px;
  }

  .handling-filter-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .handling-filter-actions > * {
    flex: 1 1 140px;
  }

  .handling-form-actions .actions {
    width: 100%;
  }

  .handling-form-actions .actions > * {
    flex: 1 1 140px;
  }

  .table-pagination {
    justify-content: stretch;
  }

  .table-pagination-actions {
    width: 100%;
  }

  .table-pagination-actions > * {
    flex: 1 1 140px;
  }

  .handling-bulk-actions {
    justify-content: stretch;
  }

  .handling-bulk-actions > * {
    flex: 1 1 140px;
  }
}

.payment-remittance-preview-card {
  display: grid;
  gap: 16px;
}

.payment-remittance-header-table {
  max-width: 760px;
}

.payment-remittance-header-table th {
  width: 220px;
}

.payment-remittance-summary-strip {
  align-items: stretch;
}

.payment-remittance-table-shell table {
  min-width: 1220px;
}

.payment-remittance-history-table-shell table {
  min-width: 1040px;
}

.nav-subgroup-heading {
  margin-top: 8px;
  padding-left: 18px;
}

.payment-remittance-next-actions,
.payment-application-selected {
  display: grid;
  gap: 14px;
}

.payment-remittance-page-actions {
  justify-content: flex-start;
}

.payment-application-worksheet,
.payment-application-section {
  display: grid;
  gap: 14px;
}

.payment-application-summary-actions {
  max-width: 1040px;
}

.payment-application-summary-actions > h3 {
  margin: 0;
}

.payment-application-document-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--mt-surface);
}

.payment-application-document-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.payment-application-document-item .label {
  color: var(--mt-muted);
  font-size: 12px;
  font-weight: 600;
}

.payment-application-document-item span:last-child {
  overflow-wrap: anywhere;
}

.payment-application-action-panel {
  display: grid;
  grid-template-columns: minmax(320px, 400px) max-content max-content;
  gap: 12px;
  align-items: start;
  justify-content: start;
}

.payment-application-action-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--mt-surface);
  align-content: start;
}

.payment-application-action-group h3 {
  margin: 0;
}

.payment-application-action-group p {
  margin: 0;
}

.payment-application-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.payment-application-actions label {
  min-width: 0;
}

.payment-application-actions button,
.payment-application-manual-action button,
.payment-application-export-actions button {
  justify-self: start;
}

.payment-application-actions button {
  grid-column: 1 / -1;
}

.payment-application-manual-action,
.payment-application-export-action {
  width: max-content;
  max-width: 100%;
  min-width: 280px;
  height: auto;
  min-height: 0;
  align-self: start;
  justify-self: start;
  padding: 16px 18px;
}

.payment-application-manual-action button {
  width: auto;
  justify-self: start;
}

.payment-application-manual-action .muted {
  margin-bottom: 2px;
}

.payment-application-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.payment-application-export-actions button {
  min-width: 128px;
}

@media (max-width: 980px) {
  .payment-application-action-panel {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .payment-application-action-group:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .payment-application-action-panel,
  .payment-application-actions {
    grid-template-columns: 1fr;
  }
}

.payment-application-summary-table-shell table {
  min-width: 920px;
}

.payment-application-line-table-shell table {
  min-width: 1480px;
}

.payment-remittance-candidate {
  min-width: 190px;
}

.payment-remittance-candidate + .payment-remittance-candidate {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.payment-remittance-line-warnings {
  margin-top: 6px;
}

@media print {
  @page {
    size: landscape;
    margin: 0.35in;
  }

  body.printing-payment-application {
    background: #ffffff;
  }

  body.printing-payment-application .app-sidebar,
  body.printing-payment-application #sectionHeader,
  body.printing-payment-application .payment-remittance-page-actions,
  body.printing-payment-application .payment-application-summary-actions,
  body.printing-payment-application .modal-backdrop,
  body.printing-payment-application .banner,
  body.printing-payment-application button {
    display: none !important;
  }

  body.printing-payment-application #appView.app-shell,
  body.printing-payment-application .app-main,
  body.printing-payment-application #sectionBody,
  body.printing-payment-application .section-block,
  body.printing-payment-application .payment-remittances-page,
  body.printing-payment-application .payment-application-selected,
  body.printing-payment-application .payment-application-worksheet,
  body.printing-payment-application .payment-application-section {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: #ffffff;
    border: 0;
    box-shadow: none;
  }

  body.printing-payment-application .payment-application-worksheet {
    color: #111827;
  }

  body.printing-payment-application .payment-application-worksheet > .card-header {
    margin-bottom: 8px;
  }

  body.printing-payment-application .payment-application-worksheet h3 {
    color: #111827;
    break-after: avoid;
    page-break-after: avoid;
  }

  body.printing-payment-application .payment-application-document-strip,
  body.printing-payment-application .summary-strip {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-payment-application .payment-application-document-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 8px;
    background: #ffffff;
    border-color: #d1d5db;
  }

  body.printing-payment-application .summary-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }

  body.printing-payment-application .card,
  body.printing-payment-application .kpi-card {
    background: #ffffff;
    border: 1px solid #d1d5db;
    box-shadow: none;
  }

  body.printing-payment-application .kpi-card {
    padding: 7px;
  }

  body.printing-payment-application .kpi-card h3,
  body.printing-payment-application .payment-application-document-item .label,
  body.printing-payment-application .muted {
    color: #374151;
  }

  body.printing-payment-application .kpi-card .metric {
    color: #111827;
    font-size: 14px;
  }

  body.printing-payment-application .payment-application-summary-table-shell,
  body.printing-payment-application .payment-application-line-table-shell {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 12px;
  }

  body.printing-payment-application .payment-application-summary-table-shell table,
  body.printing-payment-application .payment-application-line-table-shell table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: collapse;
  }

  body.printing-payment-application .payment-application-summary-table-shell th,
  body.printing-payment-application .payment-application-summary-table-shell td,
  body.printing-payment-application .payment-application-line-table-shell th,
  body.printing-payment-application .payment-application-line-table-shell td {
    padding: 4px 5px;
    border: 1px solid #d1d5db;
    color: #111827;
    font-size: 8.5px;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.printing-payment-application .payment-application-summary-table-shell th,
  body.printing-payment-application .payment-application-line-table-shell th {
    background: #f3f4f6;
  }

  body.printing-payment-application .payment-application-line-table-shell th:last-child,
  body.printing-payment-application .payment-application-line-table-shell td:last-child {
    display: none;
  }

  body.printing-payment-application tr,
  body.printing-payment-application .card-header {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-weekly-report {
    background: #ffffff;
  }

  body.printing-weekly-report .app-sidebar,
  body.printing-weekly-report #sectionHeader,
  body.printing-weekly-report .no-print,
  body.printing-weekly-report .completed-deliveries-tabs {
    display: none !important;
  }

  body.printing-weekly-report #appView.app-shell,
  body.printing-weekly-report .app-main,
  body.printing-weekly-report #sectionBody,
  body.printing-weekly-report .section-block,
  body.printing-weekly-report .weekly-report-page {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: #ffffff;
    box-shadow: none;
    border: 0;
  }

  body.printing-weekly-report .weekly-report-print-area {
    display: block;
    width: 100%;
    color: #111827;
  }

  body.printing-weekly-report .weekly-report-heading {
    margin-bottom: 10px;
  }

  body.printing-weekly-report .weekly-report-heading h3 {
    margin: 0 0 2px;
    font-size: 16px;
  }

  body.printing-weekly-report .weekly-report-heading p {
    margin: 0;
    color: #374151;
    font-size: 11px;
  }

  body.printing-weekly-report .weekly-report-table-shell {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.printing-weekly-report .weekly-report-table-shell table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: collapse;
  }

  body.printing-weekly-report .weekly-report-table-shell th,
  body.printing-weekly-report .weekly-report-table-shell td {
    padding: 4px 5px;
    border: 1px solid #d1d5db;
    font-size: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.printing-weekly-report .weekly-report-table-shell th {
    background: #f3f4f6;
    color: #111827;
  }

  body.printing-weekly-report .weekly-report-table-shell tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
