:root {
  color-scheme: light;
  --ink: #3b3f43;
  --muted: #70767b;
  --line: #dfe5e2;
  --panel: #ffffff;
  --page: #f6f7f4;
  --brand: #2f7d4f;
  --brand-dark: #256640;
  --green: #2f7d4f;
  --accent: #2f80c9;
  --accent-soft: #edf5fb;
  --brand-soft: #eef7ef;
  --warn: #9a6a13;
  --danger: #a23a31;
  --ok: #2c7a4b;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --control-height: 42px;
  --shadow: 0 10px 24px rgba(36, 43, 48, 0.07);
  --soft-shadow: 0 3px 10px rgba(36, 43, 48, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f8f9f6 0%, var(--page) 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

body.auth-pending .app-shell,
body.auth-locked .app-shell {
  display: none;
}

.login-screen {
  align-items: center;
  background: linear-gradient(180deg, #f8f9f6 0%, var(--page) 100%);
  display: flex;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: fixed;
  z-index: 10000;
}

.app-data-boot-overlay {
  align-items: center;
  background: rgba(248, 249, 246, 0.92);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 9000;
}

.app-data-boot-overlay.hidden {
  display: none;
}

.app-data-boot-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  max-width: 520px;
  padding: 28px;
  width: 100%;
}

.app-data-boot-card h2 {
  margin: 0 0 8px;
}

.app-data-boot-card p:not(.eyebrow) {
  color: var(--muted);
  margin: 0;
}

.app-data-boot-overlay.error .app-data-boot-card {
  border-color: #e7c5bf;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-width: 440px;
  padding: 28px;
  width: 100%;
}

.login-card h1 {
  font-size: 24px;
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 20px;
}

.login-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.login-card input {
  border: 1px solid #ccd8d1;
  border-radius: var(--radius-sm);
  min-height: var(--control-height);
  padding: 9px 11px;
}

#productionMfaQrWrap {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-bottom: 14px;
}

#productionMfaQrWrap.hidden {
  display: none;
}

#productionMfaQrImage {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-width: 220px;
  padding: 10px;
  width: 100%;
}

.login-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.auth-user-chip {
  background: var(--brand-soft);
  border: 1px solid #c8ded2;
  border-radius: 999px;
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 13px;
  padding: 6px 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

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

.app-sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfa 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 20;
}

.sidebar-toggle {
  align-items: center;
  align-self: flex-end;
  background: #ffffff;
  border: 1px solid #c8ded2;
  border-radius: 999px;
  color: var(--brand);
  display: inline-flex;
  font-size: 22px;
  font-weight: 500;
  justify-content: center;
  line-height: 1;
  min-height: 28px;
  min-width: 28px;
  padding: 0;
}

.sidebar-toggle:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.sidebar-collapsed .app-sidebar {
  align-items: center;
  gap: 18px;
  padding: 18px 12px;
}

.sidebar-collapsed .brand-home {
  align-items: center;
  display: flex;
  justify-content: center;
}

.sidebar-collapsed .brand-home .eyebrow,
.sidebar-collapsed .brand-home span,
.sidebar-collapsed .tab-button {
  font-size: 0;
}

.sidebar-collapsed .brand-home h1 {
  font-size: 0;
}

.sidebar-collapsed .brand-home h1::first-letter {
  color: var(--brand);
  font-size: 30px;
}

.sidebar-collapsed .tab-nav {
  width: 100%;
}

.sidebar-collapsed .tab-button {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 46px;
  padding: 0;
}

.sidebar-collapsed .tab-button::first-letter {
  font-size: 18px;
}

.app-main-shell {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(210px, 0.75fr) minmax(180px, 0.42fr) minmax(320px, 1.35fr) auto;
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 12;
}

.brand-home {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  min-height: auto;
  padding: 0;
  text-align: left;
  width: 100%;
}

.brand-home:hover,
.brand-home:focus-visible {
  background: transparent;
  color: var(--brand);
  outline: none;
}

.brand-home:focus-visible h1 {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.topbar-home {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: grid;
  justify-items: start;
  min-height: auto;
  padding: 0;
  text-align: left;
}

.topbar-home:hover,
.topbar-home:focus-visible {
  background: transparent;
  color: var(--brand);
  outline: none;
}

.topbar-home:focus-visible h1 {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.company-selector {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 650;
  gap: 6px;
}

.company-selector select {
  min-height: 44px;
}

.brand-home span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2 {
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.16;
}

h2 {
  font-size: 19px;
  line-height: 1.25;
}

strong,
b {
  font-weight: 600;
}

.topbar-meta {
  align-items: flex-end;
  color: var(--muted);
  display: grid;
  gap: 6px;
  justify-items: end;
  white-space: nowrap;
}

.app-history-controls {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.history-button {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 650;
  min-height: 30px;
  padding: 5px 10px;
}

.history-button:disabled {
  color: #98a2b3;
  cursor: not-allowed;
  opacity: 0.6;
}

.topbar-meta span {
  background: var(--brand-soft);
  border: 1px solid #c8ded2;
  border-radius: 999px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
  padding: 6px 11px;
}

.topbar-meta .supabase-status-pill {
  align-items: center;
  background: #eef8f0;
  border: 1px solid #b7dbc2;
  border-radius: 999px;
  color: #256640;
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
  line-height: 1;
  padding: 5px 10px;
  position: relative;
}

.supabase-status-dot {
  background: #2f7d4f;
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.supabase-status-popover {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: var(--ink);
  display: none;
  font-size: 12px;
  gap: 8px;
  min-width: 240px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  white-space: normal;
  z-index: 25;
}

.supabase-status-pill:hover .supabase-status-popover,
.supabase-status-pill:focus .supabase-status-popover,
.supabase-status-pill:focus-within .supabase-status-popover {
  display: grid;
}

.supabase-status-popover span {
  align-items: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  display: grid;
  gap: 2px;
  padding: 0;
}

.supabase-status-popover strong {
  color: var(--muted);
  font-size: 11px;
}

.supabase-status-popover em {
  color: var(--ink);
  font-style: normal;
}

.supabase-error-banner {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0;
  position: sticky;
  top: 82px;
  z-index: 11;
}

.topbar-meta strong {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

main {
  padding: 28px;
}

.tab-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
  padding: 0;
}

.tab-button {
  background: transparent;
  border-color: transparent;
  border-radius: 12px;
  color: var(--muted);
  justify-content: flex-start;
  min-height: 46px;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  width: 100%;
}

.tab-button:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.tab-button.active {
  background: linear-gradient(135deg, var(--brand), #3c8c5f);
  box-shadow: 0 8px 18px rgba(47, 125, 79, 0.16);
  color: #ffffff;
}

.global-search-bar {
  position: relative;
  z-index: 13;
}

.global-search-bar label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 650;
  gap: 6px;
  max-width: none;
}

.global-search-results {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  left: 0;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 72px;
}

.global-search-empty {
  color: var(--muted);
  padding: 12px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 22px;
}

.tab-placeholder {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font: inherit;
}

button {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  min-height: var(--control-height);
  padding: 10px 16px;
  transition: background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

button:hover {
  background: var(--brand-dark);
  box-shadow: var(--soft-shadow);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #ffffff;
  border-color: #d7e1dc;
  color: var(--brand);
}

button.secondary:hover {
  background: var(--brand-soft);
  border-color: #c8ded2;
}

select,
input,
textarea {
  background: #ffffff;
  color: var(--ink);
  min-height: var(--control-height);
  padding: 8px 10px;
}

textarea {
  line-height: 1.4;
  min-height: 92px;
  resize: vertical;
}

input[type="date"] {
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8dc5a2;
  box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.12);
  outline: none;
}

:is(label, th, .badge, .tab-button, .history-button, .save-status, .sortable-heading, .topbar-meta span, .topbar-meta strong, .customer-browser-title strong, .customer-profile-tabs button, .customer-action-trigger, .compact-action-select) {
  font-weight: 600;
}

label {
  font-size: 14px;
  line-height: 1.25;
}

.page-header,
.section-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.app-card,
.metric-card,
.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid rgba(223, 229, 226, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.dashboard-hero {
  align-items: center;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  padding: 24px;
}

.dashboard-hero h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.dashboard-hero span {
  color: var(--muted);
  font-weight: 650;
}

.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.action-pill {
  border-radius: 999px;
  min-height: 42px;
}

.metrics {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.metrics article {
  padding: 18px 20px;
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  font-size: 28px;
  letter-spacing: 0;
}

.customer-center {
  display: block;
  align-items: start;
  gap: 20px;
  transition: grid-template-columns 0.2s ease;
}

.customer-center.customer-profile-mode {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.customer-center.customer-list-collapsed {
  grid-template-columns: 40px minmax(0, 1fr);
}

.customer-browser {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 720px;
  overflow: hidden;
}

.customer-list-mode .customer-browser {
  min-height: 0;
}

.customer-list-mode .customer-profile-panel {
  display: none;
}

.customer-list-toggle {
  background: #ffffff;
  border: 1px solid #c8ded2;
  border-radius: 999px;
  color: var(--brand);
  font-size: 22px;
  font-weight: 500;
  justify-self: stretch;
  line-height: 1;
  margin-bottom: 12px;
  min-height: 28px;
  min-width: 28px;
  padding: 0;
  width: 28px;
}

.customer-browser-title .customer-list-toggle {
  justify-self: auto;
  margin-bottom: 0;
  min-height: 28px;
  width: 28px;
}

.customer-list-toggle:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.customer-list-collapsed .customer-browser {
  min-height: 0;
}

.customer-list-collapsed .customer-browser-header {
  border-bottom: 0;
  padding: 8px 5px;
}

.customer-list-collapsed .customer-browser-title {
  justify-content: center;
  margin-bottom: 0;
}

.customer-list-collapsed .customer-browser-title strong {
  display: none;
}

.customer-list-collapsed .customer-browser-header label,
.customer-list-collapsed .customer-filter-grid,
.customer-list-collapsed .customer-list-wrap {
  display: none;
}

.customer-list-collapsed .customer-list-toggle {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 0;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.customer-profile-panel {
  min-width: 0;
}

.customer-browser-header {
  background: #fbfcfa;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.customer-list-mode .customer-browser-header {
  align-items: end;
  display: grid;
  gap: 10px 12px;
  grid-template-columns: minmax(260px, 1.55fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) minmax(140px, 0.6fr);
  padding: 16px 18px;
}

.customer-browser-title {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.customer-browser-title strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.customer-search-label {
  margin-bottom: 12px;
}

.customer-list-mode .customer-browser-title {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.customer-list-mode .customer-search-label {
  margin-bottom: 0;
}

.customer-list-mode .customer-filter-grid {
  display: contents;
}

.customer-list-mode .customer-browser-header label {
  min-width: 0;
}

.customer-list-mode .customer-browser-header input,
.customer-list-mode .customer-browser-header select {
  min-height: 38px;
}

.customer-filter-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.customer-balance-check {
  align-items: center;
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 8px 10px;
}

.customer-list-wrap {
  max-height: 620px;
  overflow: auto;
  padding: 8px;
}

.customer-list-mode .customer-list-wrap {
  max-height: calc(100vh - 245px);
  padding: 0;
}

.customer-list-table-wrap {
  max-height: inherit;
  overflow: auto;
}

.customer-list-table {
  border-collapse: collapse;
  width: 100%;
}

.customer-list-table th,
.customer-list-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  text-align: left;
  vertical-align: middle;
}

.customer-list-table th {
  background: #f1f5f2;
  color: #44505a;
  font-size: 13px;
  font-weight: 650;
  position: sticky;
  top: 0;
  text-transform: uppercase;
  z-index: 4;
}

.customer-list-table tbody tr {
  cursor: pointer;
}

.customer-list-table tbody tr:hover,
.customer-list-table .selected-row {
  background: #f2f7f3;
}

.customer-list-table td:nth-child(5),
.customer-list-table th:nth-child(5) {
  text-align: right;
}

.customer-list-table td:last-child,
.customer-list-table th:last-child {
  text-align: right;
}

.customer-action-menu {
  align-items: flex-end;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  min-width: 92px;
  position: relative;
}

.customer-action-trigger {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--green-700);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 650;
  gap: 4px;
  justify-content: flex-end;
  line-height: 1.2;
  padding: 4px 0;
}

.customer-action-trigger:hover {
  color: var(--green-600);
}

.customer-action-dropdown {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.12);
  display: none;
  min-width: 172px;
  overflow: hidden;
  text-align: left;
  z-index: 12;
}

.customer-action-menu.open .customer-action-dropdown {
  display: grid;
}

.customer-action-dropdown button {
  background: #ffffff;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  text-align: left;
}

.customer-action-dropdown button:hover {
  background: #f2f7f3;
  color: var(--green-700);
}

.customer-list-table .sortable-heading {
  text-transform: uppercase;
}

.sortable-heading-right {
  justify-content: flex-end;
  text-align: right;
  width: 100%;
}

.customer-list-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  min-height: auto;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.customer-list-card:hover,
.customer-list-card.active {
  background: #f2f7f3;
  border-color: #c8ded2;
}

.customer-list-main strong,
.customer-list-main small,
.customer-list-meta strong,
.customer-list-meta small {
  display: block;
}

.customer-list-main small,
.customer-list-meta small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.customer-list-meta {
  text-align: right;
}

.customer-list-meta .badge {
  margin-bottom: 5px;
}

.customer-list-empty {
  color: var(--muted);
  padding: 16px;
}

.customer-debug-line {
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  font-size: 12px;
  margin: 0;
  padding: 8px 14px;
}

.customer-compact-list {
  display: grid;
  gap: 0;
}

.customer-compact-row {
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  display: block;
  min-height: auto;
  padding: 14px 24px;
  text-align: left;
  width: 100%;
}

.customer-compact-row strong,
.customer-compact-row small {
  display: block;
}

.customer-compact-row strong {
  color: #3e4246;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.22;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-compact-row small {
  color: #45494d;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  margin-top: 2px;
}

.customer-compact-row:hover,
.customer-compact-row.selected-row {
  background: #f1f4f5;
}

.customer-profile-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 0;
  min-height: 720px;
  overflow: hidden;
}

.customer-hold-banner {
  background: #fff1f2;
  border-bottom: 1px solid #fecdd3;
  color: #991b1b;
  display: grid;
  gap: 4px;
  padding: 14px 24px;
}

.customer-hold-banner strong {
  font-size: 18px;
}

.customer-hold-banner span {
  font-weight: 650;
}

.customer-hold-banner.soft {
  background: #fbfcfa;
  border-color: var(--line);
  color: var(--ink);
}

.ar-card-grid,
.ar-summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.ar-card-grid article,
.ar-summary-grid article {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.ar-card-grid span,
.ar-summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.ar-card-grid strong,
.ar-summary-grid strong {
  font-size: 22px;
}

.customer-profile-top {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 0.9fr) minmax(360px, 1.4fr) minmax(180px, 0.6fr);
  padding: 22px 24px 16px;
}

.customer-title-block h2 {
  font-size: 28px;
  margin-bottom: 4px;
}

.customer-title-block p {
  color: var(--muted);
  font-weight: 650;
  margin: 0 0 10px;
}

.customer-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customer-header-details {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.customer-header-details div {
  min-width: 0;
}

.customer-header-details strong,
.customer-header-details span {
  display: block;
}

.customer-header-details strong {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.customer-header-details span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.customer-balance-box {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 190px;
  padding: 14px 16px;
  text-align: right;
}

.customer-balance-actions {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  min-width: 230px;
}

.customer-balance-box span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.customer-balance-box strong {
  color: var(--brand);
  font-size: 28px;
}

.customer-profile-actions {
  display: block;
  padding: 0;
}

.customer-inline-editor,
.customer-profile-order-modal {
  background: #fbfcfa;
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}

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

.section-title-row h3,
.customer-order-choice-grid h4,
.profile-special-order-panel h3 {
  margin: 0;
}

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

.customer-order-choice-grid article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.customer-order-choice-grid p {
  color: var(--muted);
  margin: 8px 0 14px;
}

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

.profile-special-order-editor {
  margin-top: 16px;
}

.profile-special-order-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.customer-action-menu-label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  width: 100%;
}

.customer-action-menu-label select {
  margin-top: 6px;
}

.customer-summary-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 18px 24px;
}

.customer-summary-cards article {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.customer-summary-cards span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 10px;
}

.customer-summary-cards strong {
  display: block;
  font-size: 24px;
}

.customer-profile-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 24px;
}

.customer-profile-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  min-height: 48px;
  padding: 12px 14px 9px;
}

.customer-profile-tabs button.active,
.customer-profile-tabs button:hover {
  background: transparent;
  border-bottom-color: var(--brand);
  color: var(--brand);
}

.route-more-actions-label {
  color: var(--muted);
  display: inline-flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  min-width: 210px;
}

.route-more-actions-label select {
  min-height: 42px;
}

.route-more-action-source {
  display: none !important;
}

.customer-transaction-list {
  display: grid;
  gap: 16px;
}

.customer-transaction-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.customer-transaction-heading h3 {
  margin: 0;
}

.customer-transaction-heading span {
  color: var(--muted);
  font-weight: 650;
}

.customer-transaction-filters {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.transaction-header-button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  padding: 0;
  text-align: left;
  text-transform: inherit;
}

.transaction-header-button:hover,
.transaction-header-button:focus-visible,
.transaction-header-button.active {
  color: var(--brand);
}

.customer-profile-tab-content {
  padding: 20px 24px 24px;
}

.customer-inline-invoice-preview {
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 18px;
  max-height: 720px;
  overflow: auto;
  padding: 16px;
}

.customer-inline-invoice-preview .invoice-document {
  margin: 0 auto;
  transform-origin: top center;
}

.clickable-payment-row {
  cursor: pointer;
}

.clickable-payment-row:hover {
  background: #f2f7f3;
}

.clickable-transaction-row {
  cursor: pointer;
}

.clickable-transaction-row:hover {
  background: #f2f7f3;
}

.payment-returned-row {
  background: #fff4f2;
  color: #7d241b;
}

.payment-returned-row:hover {
  background: #ffe7e3;
}

.payment-returned-row .text-link-button {
  color: #7d241b;
}

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

.customer-overview-grid div,
.customer-notes-box {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.customer-overview-grid strong,
.customer-overview-grid span {
  display: block;
}

.customer-overview-grid strong {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.customer-command-center {
  display: grid;
  gap: 14px;
}

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

.customer-command-tile {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(32, 49, 38, 0.06);
  color: var(--ink);
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.customer-command-tile.clickable {
  cursor: pointer;
}

.customer-command-tile.clickable:hover {
  background: var(--brand-soft);
  border-color: #b9d8bd;
  box-shadow: 0 12px 26px rgba(47, 125, 79, 0.12);
  color: var(--ink);
  transform: translateY(-1px);
}

.customer-command-tile.clickable:focus-visible {
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.16);
  color: var(--ink);
  outline: none;
}

.customer-command-tile.clickable:active {
  background: #e7f3e9;
  border-color: #a8cfaf;
  color: var(--ink);
  transform: translateY(0);
}

.customer-command-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.customer-command-tile strong {
  color: var(--brand);
  font-size: 24px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.customer-command-tile small,
.customer-command-tile em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.customer-command-tile.danger {
  background: #fff8f6;
  border-color: #efc9c1;
}

.customer-command-tile.danger strong {
  color: var(--danger);
}

.customer-command-tile.danger.clickable:hover,
.customer-command-tile.danger.clickable:focus-visible {
  background: #fff3f0;
  border-color: #e8b3aa;
  box-shadow: 0 12px 26px rgba(162, 58, 49, 0.1);
}

.customer-command-tile.ok {
  background: #f7fbf5;
  border-color: #cfe2c7;
}

.customer-command-tile.ok.clickable:hover,
.customer-command-tile.ok.clickable:focus-visible {
  background: var(--brand-soft);
  border-color: #b9d8bd;
}

.customer-command-tile.restricted {
  background: #f8f8f6;
  box-shadow: none;
}

.customer-command-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.customer-timeline {
  display: grid;
  gap: 10px;
}

.customer-timeline-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
}

.customer-timeline-row.danger {
  background: #fff5f4;
  border-color: #e8b5ae;
}

.customer-timeline-row span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 5px;
}

.customer-timeline-row p {
  color: var(--muted);
  margin: 5px 0 0;
}

.customer-timeline-empty {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 14px;
}

.customer-account-activity {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.customer-account-activity article {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.customer-account-activity strong {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.customer-account-activity span {
  line-height: 1.4;
}

.account-hold-row td {
  background: #fff8f7;
}

.past-due-row td {
  background: #fff8f6;
}

.order-customer-link {
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  min-height: auto;
  padding: 0;
  text-align: left;
}

.order-customer-link:hover {
  background: transparent;
  color: var(--danger);
  text-decoration: underline;
}

.past-due-badge {
  border: 0;
  display: inline-block;
  font-size: 11px;
  margin-top: 6px;
  min-height: auto;
  padding: 4px 7px;
}

.past-due-note {
  color: var(--danger);
  display: block;
  font-size: 12px;
  font-weight: 650;
  margin-top: 5px;
}

.hold-row-warning {
  color: #b91c1c;
  display: block;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  margin-top: 5px;
}

.aging-1-30-days td {
  background: #fff9ec;
}

.aging-31-60-days td {
  background: #fff6ed;
}

.aging-61-90-days td {
  background: #fff0dc;
}

.aging-90-days td {
  background: #fde8e6;
}

.statement-toolbar {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.statement-document {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #000000;
  min-height: 820px;
  padding: 24px;
  position: relative;
}

.statement-letterhead {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  margin-left: 38px;
}

.statement-brand-mark {
  align-items: center;
  background: #d3dd1f;
  border-radius: 50%;
  color: #566529;
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 800;
  height: 76px;
  justify-content: center;
  line-height: 1.15;
  width: 62px;
}

.statement-company-address {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  gap: 5px;
  line-height: 1.2;
}

.statement-company-address strong {
  font-weight: 800;
}

.statement-title {
  color: #4391c3;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: 0;
  margin: 30px 0 30px 38px;
}

.statement-recipient-summary {
  display: grid;
  grid-template-columns: 1fr 300px;
  margin: 0 38px 20px;
}

.statement-recipient-summary > div {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  gap: 6px;
  line-height: 1.15;
}

.statement-recipient-summary > div strong {
  font-weight: 500;
  letter-spacing: 0;
}

.statement-recipient-summary dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.statement-recipient-summary dl div {
  display: grid;
  gap: 10px;
  grid-template-columns: 150px 1fr;
}

.statement-recipient-summary dt {
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  text-transform: uppercase;
}

.statement-recipient-summary dd {
  font-size: 15px;
  margin: 0;
}

.statement-lines-table,
.statement-aging-table {
  border-collapse: collapse;
  font-size: 15px;
  margin: 0;
  width: 100%;
}

.statement-lines-table {
  margin-top: 18px;
}

.statement-lines-table th,
.statement-aging-table th {
  background: #dbe8f1;
  color: #4391c3;
  font-weight: 400;
  padding: 7px 10px;
  text-align: left;
  text-transform: uppercase;
}

.statement-lines-table td {
  padding: 6px 10px;
}

.statement-lines-table th:nth-child(3),
.statement-lines-table th:nth-child(4),
.statement-lines-table td:nth-child(3),
.statement-lines-table td:nth-child(4) {
  text-align: right;
}

.statement-aging-table {
  bottom: 24px;
  left: 24px;
  position: absolute;
  right: 24px;
  width: calc(100% - 48px);
}

.statement-aging-table th,
.statement-aging-table td {
  padding: 7px 10px;
  text-align: center;
}

.statement-workspace {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  margin: 28px;
  overflow: hidden;
}

.statement-page-header {
  align-items: center;
  background: linear-gradient(135deg, #fbfcfa 0%, #eef7f0 100%);
  border-bottom: 1px solid var(--line);
  padding: 28px;
}

.statement-page-header h2 {
  font-size: 30px;
  margin: 4px 0;
}

.statement-page-header span {
  color: var(--muted);
  font-weight: 650;
}

.statement-total-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  text-align: right;
}

.statement-total-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.statement-total-card strong {
  color: var(--green);
  display: block;
  font-size: 38px;
  margin-top: 8px;
}

.statement-setup-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  padding: 24px 28px 10px;
}

.statement-recipient-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 28px 18px;
}

.statement-recipient-table {
  margin: 0 28px 20px;
}

.statement-recipient-table input[type="text"] {
  width: 100%;
}

.statement-recipient-table td:first-child,
.statement-recipient-table th:first-child {
  width: 90px;
}

.statement-workspace-footer {
  align-items: center;
  background: #fbfcfa;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  padding: 18px 28px;
  position: sticky;
  bottom: 0;
}

.statement-workspace-footer #statementCancelButton {
  margin-right: auto;
}

.statement-preview-shell {
  background: #f6f8f5;
  border-top: 1px solid var(--line);
  padding: 28px;
}

.customer-statement-creator {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.customer-statement-header {
  border-bottom: 1px solid var(--line);
  padding: 22px;
}

.customer-statement-grid {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  padding: 20px 22px 8px;
}

.customer-statement-creator .statement-recipient-actions {
  padding-left: 22px;
  padding-right: 22px;
}

.customer-statement-creator .statement-preview-shell {
  border-top: 1px solid var(--line);
}

.mini-button {
  font-size: 13px;
  min-height: 34px;
  padding: 6px 9px;
}

.file-history-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.file-history-item {
  align-items: center;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px 10px;
}

.file-history-item strong,
.file-history-item small {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.file-history-item small {
  color: var(--muted);
  font-size: 12px;
}

.file-history-item span {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .file-history-item {
    grid-template-columns: 1fr;
  }

  .file-history-item span {
    justify-content: flex-start;
  }
}

.payment-action-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.muted-action-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.danger-button {
  background: #ffffff;
  border-color: #d9a7a0;
  color: #a83224;
}

.danger-button:hover {
  background: #fff5f4;
  border-color: var(--danger);
  color: var(--danger);
}

.work-area {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

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

.panel.full {
  margin-top: 20px;
}

.hidden {
  display: none;
}

.modal-backdrop {
  align-items: flex-start;
  background: rgba(47, 52, 55, 0.38);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  overflow: auto;
  padding: 36px 20px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

#invoiceDocumentModal {
  background: #f6f7f4;
  display: block;
  padding: 0;
}

#invoiceDocumentModal.hidden {
  display: none;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 42px rgba(36, 43, 48, 0.15);
  max-width: 1100px;
  width: min(1100px, 100%);
}

#customerArModal {
  align-items: center;
  z-index: 2100;
}

#customerArModal.order-sheet-child-modal {
  background: rgba(22, 31, 26, 0.48);
  z-index: 2600;
}

#customerArModal .ar-modal-card {
  max-height: min(86vh, 920px);
  max-width: 1040px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#customerArModalBody {
  overflow: auto;
  padding: 20px 22px 88px;
}

.modal-subtitle {
  color: var(--muted);
  margin: -4px 0 16px;
}

.icon-close-button {
  border-radius: 999px;
  min-height: 36px;
  min-width: 36px;
  padding: 0;
}

.customer-quick-summary {
  background: linear-gradient(180deg, #fbfdf9, #ffffff);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  margin-bottom: 16px;
  min-width: 0;
  padding: 18px;
}

.customer-quick-summary h3 {
  margin: 4px 0 2px;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.customer-quick-summary > div {
  min-width: 0;
}

.customer-quick-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.customer-quick-detail-grid article,
.customer-quick-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 14px;
  white-space: normal;
  word-break: break-word;
}

.customer-quick-detail-grid span,
.customer-quick-card h3 {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.customer-quick-detail-grid strong,
.customer-quick-card p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.customer-quick-card {
  margin-bottom: 16px;
}

.customer-quick-ar-summary {
  margin-top: 4px;
}

.customer-quick-footer {
  background: #ffffff;
  border-top: 1px solid var(--line);
  bottom: 0;
  justify-content: flex-end;
  margin: 0;
  padding: 14px 22px;
  position: sticky;
  z-index: 2;
}

@media (max-width: 820px) {
  .customer-quick-summary,
  .customer-quick-detail-grid {
    grid-template-columns: 1fr;
  }
}

.modal-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}

.payment-modal-card {
  padding-bottom: 18px;
}

.invoice-document-action-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
  max-width: none;
  padding-bottom: 32px;
  width: 100%;
}

#specialOrderOverlay {
  background: #f6f7f4;
  display: block;
  padding: 0;
}

#specialOrderOverlay.hidden {
  display: none;
}

#customerStatementOverlay {
  background: #f6f7f4;
  display: block;
  padding: 0;
}

#customerStatementOverlay.hidden {
  display: none;
}

.invoice-document-action-card .modal-heading {
  background: #ffffff;
  min-height: 92px;
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.invoice-document-action-card .modal-heading h2 {
  font-size: 30px;
  line-height: 1.12;
  margin: 0;
}

.invoice-document-actions {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0;
  bottom: 0;
  box-shadow: 0 -8px 18px rgba(36, 43, 48, 0.08);
  gap: 12px;
  left: 0;
  margin: 0;
  max-width: 1420px;
  padding: 14px 32px;
  position: fixed;
  right: 0;
  z-index: 4;
}

.invoice-document-modal-preview {
  background: #f6f7f4;
  border-top: 0;
  max-height: none;
  overflow: auto;
  padding: 24px 32px 120px;
}

.invoice-document-actions-bottom {
  max-width: none;
}

#invoiceDocumentActionStatus {
  margin: 0;
  padding: 0 32px;
}

#invoiceDocumentActionStatus:empty {
  display: none;
}

.invoice-workspace {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 1420px;
}

.special-order-overlay-workspace {
  margin: 0 auto;
  max-width: 1420px;
}

.special-order-overlay-workspace .form-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.special-order-overlay-workspace .table-wrap {
  max-height: none;
}

.customer-statement-overlay-workspace {
  margin: 0 auto;
  max-width: 1420px;
}

.customer-statement-overlay-workspace .statement-page-header {
  margin-bottom: 20px;
}

.invoice-editor-section {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.invoice-editor-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.invoice-editor-heading h3,
.invoice-editor-section h3 {
  margin: 0 0 4px;
}

.invoice-editor-heading p {
  color: var(--muted);
  font-weight: 650;
  margin: 0;
}

.invoice-editor-table-wrap {
  max-height: none;
}

.invoice-editor-table th,
.invoice-editor-table td {
  vertical-align: middle;
}

.invoice-editor-table select,
.invoice-editor-table input {
  min-width: 110px;
  width: 100%;
}

.invoice-editor-table td:nth-child(3),
.invoice-editor-table td:nth-child(4),
.invoice-editor-table td:nth-child(5) {
  width: 118px;
}

.invoice-discount-grid,
.invoice-notes-grid,
.invoice-pod-upload-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.invoice-discount-grid {
  align-items: end;
  grid-template-columns: minmax(170px, 230px) minmax(140px, 190px) minmax(190px, 240px);
  justify-content: end;
}

.invoice-notes-grid {
  grid-template-columns: 1fr 1fr;
}

.invoice-total-stack {
  align-self: end;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 10px 12px;
}

.invoice-total-stack span {
  font-size: 14px;
}

.invoice-total-stack strong {
  font-size: 17px;
}

.invoice-print-body {
  background: #ffffff;
  margin: 0;
  padding: 24px;
}

.document-action-strip {
  align-items: center;
  background: #f7fbf8;
  border: 1px solid #d7e3dc;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 800px;
  padding: 12px 14px;
}

.document-action-strip a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.invoice-pdf-render-host {
  background: #ffffff;
  left: -10000px;
  position: fixed;
  top: 0;
  width: 880px;
  z-index: -1;
}

.invoice-pdf-render-host .invoice-document {
  box-shadow: none;
  margin: 0;
}

.payment-detail-card {
  max-width: 920px;
  padding-bottom: 18px;
}

.payment-detail-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 18px;
}

.payment-detail-summary article {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.payment-detail-summary span,
.payment-detail-notes span {
  color: var(--muted);
  display: block;
  font-weight: 650;
}

.payment-detail-summary strong {
  display: block;
  font-size: 18px;
  margin-top: 5px;
}

.payment-detail-notes {
  margin: 0 18px 16px;
  padding: 14px;
}

.payment-detail-card h3 {
  margin: 0;
  padding: 0 18px 10px;
}

.payment-form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  padding: 16px 18px 8px;
}

.payment-mode-row,
.payment-summary {
  padding: 8px 18px;
}

.payment-summary {
  color: var(--muted);
  font-weight: 650;
}

.deposit-proof-panel {
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 18px;
  padding: 12px 14px;
}

.deposit-proof-card {
  align-items: center;
  display: flex;
  gap: 12px;
}

.deposit-proof-card img {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 72px;
  object-fit: cover;
  width: 96px;
}

.deposit-proof-card div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.deposit-proof-card span {
  color: var(--muted);
  font-size: 12px;
}

.security-plan h2 {
  margin: 22px 0 12px;
}

.security-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.security-grid article {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.security-grid strong,
.security-grid span {
  display: block;
}

.security-grid strong {
  margin-bottom: 8px;
}

.security-grid span,
.security-copy,
.security-list {
  color: var(--muted);
  line-height: 1.5;
}

.security-list {
  margin: 0;
  padding-left: 22px;
}

.security-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.security-chip-list span {
  background: var(--brand-soft);
  border: 1px solid #c8ded2;
  border-radius: 999px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
  padding: 7px 10px;
}

.permission-warning {
  margin: 10px 28px 0;
}

.roles-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  margin-top: 16px;
}

.role-list-wrap {
  max-height: 640px;
}

.permission-checklist {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.permission-all-check {
  background: var(--brand-soft);
  border: 1px solid #c8ded2;
  border-radius: 6px;
  font-weight: 650;
  margin-bottom: 14px;
  padding: 10px;
}

.permission-group {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.permission-group h2 {
  font-size: 16px;
  margin-bottom: 10px;
}

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

.employee-access-admin {
  display: grid;
  gap: 16px;
}

.employee-access-admin h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

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

.employee-permission-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 10px;
}

.employee-permission-row strong,
.employee-permission-row span {
  display: block;
}

.employee-permission-row strong {
  font-size: 14px;
}

.employee-permission-row span {
  color: var(--muted);
  font-size: 12px;
}

.employee-override-form-overlay {
  align-items: center;
  background: rgba(24, 32, 38, 0.48);
  justify-content: center;
  z-index: 2300;
}

.employee-override-form-card {
  border: 1px solid rgba(47, 125, 79, 0.16);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(24, 32, 38, 0.24);
  max-height: calc(100vh - 56px);
  max-width: 980px;
  overflow: auto;
  width: min(980px, 100%);
}

.employee-override-form-card > .form-grid,
.employee-override-form-card > label,
.employee-override-form-card > .permission-checklist,
.employee-override-form-card > .save-row {
  margin: 16px 20px;
}

.security-section-heading-row {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.security-section-heading-row h2,
.security-section-heading-row p {
  margin-bottom: 8px;
}

.collection-edit-panel {
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 220px 220px minmax(260px, 1fr) auto;
  margin: 14px 0;
  padding: 14px;
}

.collection-note-label textarea {
  resize: vertical;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}

.panel-heading p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.panel-collapse-button {
  background: var(--brand-soft);
  border: 1px solid #c8ded2;
  border-radius: var(--radius-sm);
  color: var(--brand);
  font-size: 16px;
  min-height: 34px;
  min-width: 38px;
  padding: 4px 9px;
}

.panel.collapsed > :not(.panel-heading) {
  display: none !important;
}

.settings-section {
  overflow: hidden;
}

.settings-section-heading {
  align-items: center;
  background: #ffffff;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 20px;
  font-weight: 650;
  gap: 10px;
  justify-content: flex-start;
  min-height: 58px;
  padding: 16px 18px;
  text-align: left;
  width: 100%;
}

.settings-section-heading:hover {
  background: #f8faf6;
  color: var(--brand);
}

.settings-arrow {
  color: var(--brand);
  display: inline-block;
  width: 22px;
}

.settings-workspace-card {
  min-height: 100vh;
}

.settings-workspace-heading {
  flex-shrink: 0;
}

.settings-workspace-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.settings-workspace-body > .settings-section-body {
  display: block;
}

.settings-workspace-body > .settings-section-body > .order-content {
  padding-bottom: 28px;
}

.settings-filters {
  background: #f8faf6;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  padding: 14px 16px;
}

.table-wrap {
  border: 1px solid #e5ebe7;
  border-radius: var(--radius-md);
  max-height: 720px;
  overflow: auto;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-wrap thead th {
  cursor: pointer;
  user-select: none;
}

.table-wrap thead th:not(:has(button, input, select, textarea, a))::after {
  color: var(--muted);
  content: "  ↕";
  font-size: 12px;
}

.table-wrap thead th.sorted-asc:not(:has(button, input, select, textarea, a))::after {
  color: var(--brand);
  content: "  ↑";
}

.table-wrap thead th.sorted-desc:not(:has(button, input, select, textarea, a))::after {
  color: var(--brand);
  content: "  ↓";
}

.sortable-heading {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  text-align: left;
  width: 100%;
}

.sortable-heading::after {
  content: "  ↕";
  color: var(--muted);
  font-size: 12px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f4f8f5;
}

.order-content {
  padding: 22px;
}

.choice-row,
.save-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.payment-choice-card {
  align-items: flex-start;
  background: linear-gradient(135deg, #fbfcfa 0%, #eef7f0 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: space-between;
  min-height: 220px;
  padding: 20px;
  text-align: left;
}

.payment-choice-card h3 {
  color: var(--ink);
  margin: 6px 0;
}

.payment-choice-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.payment-choice-card span {
  color: var(--brand);
  font-weight: 800;
}

.payment-choice-card:hover {
  border-color: var(--brand);
  box-shadow: 0 16px 38px rgba(31, 114, 71, 0.12);
  transform: translateY(-1px);
}

.payment-workspace-page {
  align-items: stretch;
  background: #f4f5f7;
  justify-content: stretch;
  padding: 0;
  z-index: 2000;
}

.payment-workspace-page .payment-modal-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  min-height: 100vh;
  width: 100%;
}

.payment-workspace-page .modal-heading {
  background: #f4f5f7;
  border-bottom: 1px solid #d6d9de;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.payment-workspace-page .payment-form-grid,
.payment-workspace-page .form-grid,
.payment-workspace-page .payment-summary,
.payment-workspace-page .deposit-proof-panel,
.payment-workspace-page .notice,
.payment-workspace-page .table-wrap,
.payment-workspace-page .save-row {
  margin-left: 24px;
  margin-right: 24px;
}

.payment-workspace-page .payment-form-grid,
.payment-workspace-page .form-grid {
  padding-top: 20px;
}

.payment-workspace-page .table-wrap {
  background: #ffffff;
}

.inventory-overlay-card {
  padding-bottom: 32px;
}

.inventory-adjust-form {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  margin: 24px;
  overflow: hidden;
}

.inventory-adjust-section {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 18px;
}

.inventory-adjust-section:last-child {
  border-bottom: 0;
}

.inventory-adjust-section h3 {
  color: #44505a;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.inventory-adjust-row,
.inventory-adjust-notes-row {
  display: grid;
  gap: 14px;
}

.inventory-adjust-primary-row {
  grid-template-columns: minmax(300px, 1.4fr) minmax(210px, 0.8fr) minmax(150px, 0.55fr);
}

.inventory-adjust-secondary-row {
  grid-template-columns: minmax(320px, 1.2fr) minmax(260px, 0.8fr);
}

.inventory-adjust-notes-row {
  align-items: end;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.65fr);
}

.inventory-override-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
}

.inventory-override-card input {
  flex: 0 0 auto;
  width: auto;
}

.inventory-override-card span {
  display: grid;
  gap: 2px;
}

.inventory-override-card strong {
  color: #2f363b;
  font-size: 15px;
  font-weight: 600;
}

.inventory-override-card small {
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 900px) {
  .inventory-adjust-primary-row,
  .inventory-adjust-secondary-row,
  .inventory-adjust-notes-row {
    grid-template-columns: 1fr;
  }
}

.inventory-overlay-body {
  margin: 24px;
}

.inventory-overlay-body .panel {
  border-radius: 8px;
  box-shadow: none;
}

#receiveInventoryItemsBody select {
  min-width: 220px;
  width: 100%;
}

#receiveInventoryItemsBody input {
  width: 100%;
}

.inventory-launch-panel {
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.delivery-launch-panel {
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.inventory-launch-panel:hover,
.inventory-launch-panel:focus-visible,
.delivery-launch-panel:hover,
.delivery-launch-panel:focus-visible {
  border-color: #c8ded2;
  box-shadow: 0 12px 28px rgba(36, 43, 48, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.inventory-launch-panel .panel-heading,
.delivery-launch-panel .panel-heading {
  cursor: pointer;
}

.inventory-launch-arrow {
  align-items: center;
  background: var(--brand-soft);
  border: 1px solid #c8ded2;
  border-radius: 6px;
  color: var(--brand);
  display: inline-flex;
  font-size: 14px;
  justify-content: center;
  min-height: 34px;
  min-width: 38px;
}

.delivery-overlay-card {
  padding-bottom: 32px;
}

.mark-delivered-card {
  max-width: 560px;
}

.mark-delivered-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.mark-delivered-body label {
  display: grid;
  gap: 8px;
}

.mark-delivered-route {
  color: #44505a;
  font-weight: 600;
  margin: 0;
}

.delivery-overlay-section {
  display: grid;
  gap: 18px;
  margin: 24px;
}

.delivery-overlay-section .table-wrap {
  margin-left: 0;
  margin-right: 0;
}

.delivery-overlay-section > .form-grid {
  margin-left: 0;
  margin-right: 0;
  padding-top: 0;
}

.delivery-overlay-section > .save-row {
  margin-left: 0;
  margin-right: 0;
}

.delivery-exception-form {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  overflow: hidden;
}

.delivery-exception-group {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 18px;
}

.delivery-exception-group:last-child {
  border-bottom: 0;
}

.delivery-exception-group h3 {
  color: #44505a;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.delivery-exception-row {
  display: grid;
  gap: 14px;
}

.delivery-exception-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.delivery-exception-row.four {
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(120px, 0.7fr));
}

.delivery-exception-row.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.action-workspace-page {
  background: #f4f5f7;
  border: 0;
  border-radius: 0;
  bottom: 0;
  box-shadow: none;
  left: 0;
  margin: 0;
  overflow: auto;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 2000;
}

.action-workspace-page.panel.full {
  margin-top: 0;
}

.action-workspace-page > .panel-heading {
  background: #f4f5f7;
  border-bottom: 1px solid #d6d9de;
  cursor: default;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.action-workspace-page .order-content {
  padding: 24px;
}

@media (max-width: 780px) {
  .payment-choice-grid {
    grid-template-columns: 1fr;
  }
}

.route-week-picker {
  display: grid;
  gap: 14px;
}

.route-week-picker.hidden {
  display: none;
}

.weekly-route-board {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weekly-route-day {
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.weekly-route-day h3 {
  color: var(--ink);
  font-size: 16px;
  margin: 0 0 12px;
}

.weekly-route-buttons {
  display: grid;
  gap: 8px;
}

.route-card-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 72px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.route-card-button:hover {
  background: #f2f7f3;
  border-color: #c8ded2;
  color: var(--brand);
}

.route-card-button strong {
  color: var(--brand);
  font-size: 18px;
}

.route-card-button span,
.route-card-button small,
.muted-text {
  color: var(--muted);
  font-weight: 650;
}

.route-card-button small {
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  margin-bottom: 18px;
}

.inline-check {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-check input {
  min-height: auto;
}

.csv-upload {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--brand);
  cursor: pointer;
  display: inline-flex;
  min-height: 44px;
  padding: 10px 14px;
}

.csv-upload input {
  display: none;
}

label {
  color: var(--muted);
  display: grid;
  font-weight: 650;
  gap: 7px;
}

.notice {
  background: #f2f7f3;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  line-height: 1.45;
  margin-top: 14px;
  padding: 12px 14px;
}

.notice.warning {
  background: #fff9ec;
  border-color: #ead49a;
  color: var(--warn);
  margin: 0 0 16px;
}

.notice.editing {
  background: #f1fbf3;
  border-color: #b8dfc4;
  color: var(--ok);
  font-weight: 650;
  margin: 0 0 16px;
}

.editing-mode .entry-table {
  border: 2px solid #7fc69b;
}

.order-status-bar {
  align-items: center;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.order-status-bar.locked {
  background: #fef3f2;
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 700;
}

.mode-label {
  background: #ffffff;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 20px;
  letter-spacing: 0;
  padding: 8px 12px;
}

.locked-mode .entry-table {
  border: 2px solid var(--danger);
}

.stock-near {
  background: #fffaeb;
}

.stock-over {
  background: #fef3f2;
}

.stock-near .quantity-input {
  border-color: #f79009;
}

.stock-over .quantity-input {
  border-color: var(--danger);
  color: var(--danger);
}

.schedule-grid,
.schedule-editor {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.schedule-editor {
  margin-bottom: 16px;
}

.schedule-day {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.schedule-day strong,
.schedule-day span {
  display: block;
}

.schedule-day span {
  color: var(--muted);
  margin-top: 6px;
}

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

.report-stack h2 {
  margin-top: 8px;
}

.report-library-panel {
  display: grid;
  gap: 14px;
}

.report-library-header {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 24px;
}

.report-library-header h2 {
  margin: 4px 0 6px;
}

.report-library-header span {
  color: var(--muted);
}

.report-category-list {
  display: grid;
  gap: 8px;
}

.report-category-card {
  background: #ffffff;
  border: 1px solid #d8dde3;
  border-radius: 8px;
  overflow: hidden;
}

.report-category-heading {
  align-items: center;
  background: #ffffff;
  border: 0;
  color: var(--ink);
  display: flex;
  font-size: 20px;
  gap: 12px;
  justify-content: flex-start;
  min-height: 58px;
  padding: 0 24px;
  text-align: left;
  width: 100%;
}

.report-category-heading:hover {
  background: #f7faf8;
}

.report-category-arrow {
  color: #4d5761;
  font-size: 28px;
  line-height: 1;
  width: 18px;
}

.report-category-body {
  column-gap: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 34px 12px;
}

.report-category-body[hidden] {
  display: none;
}

.report-list-row {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #d8dde3;
  border-radius: 0;
  color: #363b42;
  display: flex;
  justify-content: space-between;
  min-height: 43px;
}

.report-list-row:hover {
  background: #f7faf8;
}

.report-open-button {
  background: transparent;
  border: 0;
  color: #363b42;
  cursor: pointer;
  flex: 1;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  min-width: 0;
  min-height: 43px;
  padding: 0 8px;
  position: relative;
  text-align: left;
  z-index: 1;
}

.report-open-button:hover {
  color: var(--brand);
}

.clickable-report-row {
  cursor: pointer;
}

.clickable-report-row:hover {
  background: #f7faf8;
}

.clickable-report-row:focus {
  outline: 2px solid #2e7d59;
  outline-offset: -2px;
}

.route-load-pack-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: grid;
  font: inherit;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 42px;
  padding: 0;
  text-align: left;
  width: 100%;
}

.route-load-pack-button:hover {
  background: #f7faf8;
}

.route-load-pack-button:focus {
  outline: 2px solid #2e7d59;
  outline-offset: -2px;
}

.report-row-tools {
  align-items: center;
  color: #68707a;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 18px;
  margin-left: 16px;
  position: relative;
  z-index: 3;
}

.report-star {
  background: transparent;
  border: 0;
  color: #68707a;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 6px 8px;
  position: relative;
  z-index: 4;
}

.report-star.active {
  color: #25801f;
}

.report-star:hover {
  color: var(--green-700);
}

.report-empty-row {
  color: var(--muted);
  font-size: 15px;
  padding: 12px 8px;
}

.report-workspace-card {
  background: #f4f5f7;
}

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

.report-workspace-body {
  padding: 28px;
}

.report-workspace-body > .panel {
  background: #ffffff;
  margin: 0 auto;
  max-width: 1280px;
}

.report-workspace-body > .panel > .panel-heading {
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}

.report-workspace-body > .panel > .order-content {
  padding: 24px;
}

.report-workspace-body > .focused-report-panel > .panel-heading {
  display: none;
}

.report-focus-hidden {
  display: none !important;
}

.report-workspace-body .panel-collapse-button {
  display: none;
}

.price-input {
  max-width: 110px;
  min-height: 34px;
  text-align: right;
}

.print-rate {
  display: none;
}

.invoice-document {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #111827;
  margin-bottom: 16px;
  min-height: 1035px;
  overflow: hidden;
  padding: 36px 38px;
  width: 800px;
}

.invoice-top,
.invoice-info-grid,
.invoice-bottom {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 1fr;
}

.receiving-box {
  border: 1px solid #111827;
  display: grid;
  gap: 14px;
  max-width: 330px;
  padding: 14px;
}

.receiving-box strong {
  font-size: 13px;
}

.company-box {
  display: grid;
  gap: 3px;
  justify-content: end;
  text-align: right;
}

.company-box strong {
  font-size: 20px;
}

.invoice-title {
  font-size: 40px;
  margin: 28px 0 20px;
  text-align: right;
}

.bill-to {
  display: grid;
  gap: 4px;
  min-height: 110px;
}

.bill-to strong {
  color: var(--muted);
  font-size: 13px;
}

.invoice-detail-table {
  justify-self: end;
  max-width: 320px;
}

.invoice-center {
  display: grid;
  gap: 16px;
}

.invoice-center-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.invoice-center-metrics article {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 6px;
  padding: 16px;
}

.invoice-center-metrics span {
  color: var(--muted);
  font-weight: 650;
}

.invoice-center-metrics strong {
  font-size: 24px;
}

.invoice-center-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr repeat(3, minmax(150px, 1fr));
}

.invoice-center-actions {
  justify-content: flex-end;
}

.invoice-center-table tbody tr {
  cursor: pointer;
}

.invoice-center-table tbody tr:hover,
.invoice-center-table .selected-row {
  background: #f2f7f3;
}

.text-link-button {
  background: transparent;
  border: 0;
  color: var(--brand);
  cursor: pointer;
  font-weight: 650;
  min-height: auto;
  padding: 0;
  text-align: left;
}

.text-link-button:hover,
.text-link-button:focus-visible {
  background: transparent;
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.invoice-detail-table th,
.invoice-detail-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.invoice-detail-table th {
  background: #f2f7f3;
  width: 120px;
}

.invoice-route-line {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 18px 0;
  padding: 10px 0;
}

.invoice-activity-table th {
  background: #edf5f1;
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
}

.invoice-activity-table th,
.invoice-activity-table td {
  border-color: var(--line);
}

.invoice-activity-table td:nth-child(2) {
  text-align: center;
}

.invoice-activity-table td:nth-child(3),
.invoice-activity-table td:nth-child(4) {
  text-align: right;
}

.invoice-activity-table td span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.balance-due-box {
  align-items: center;
  background: #ffffff;
  border-top: 1px solid #d9dde5;
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  margin-left: auto;
  margin-top: 0;
  max-width: 390px;
  padding: 18px 0 0;
}

.balance-due-box span {
  font-size: 16px;
  font-weight: 700;
}

.balance-due-box strong {
  font-size: 30px;
}

.invoice-bottom {
  align-items: start;
  margin-top: 92px;
}

.invoice-notes {
  margin-top: 18px;
}

.sheet-wrap {
  margin-bottom: 16px;
  max-height: 68vh;
  overflow: auto;
  position: relative;
}

.sheet-export-row {
  padding: 12px 16px 0;
}

.release-signoff-grid {
  display: grid;
  gap: 14px 28px;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  padding: 18px 4px 4px;
}

.release-signoff-grid label {
  color: var(--text);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
}

.release-signoff-grid span {
  border-bottom: 1px solid var(--border-strong);
  min-height: 18px;
}

.entry-table {
  table-layout: fixed;
}

.entry-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.entry-table th {
  padding: 10px 8px;
  text-align: center;
}

.entry-table .product-order-header {
  font-size: 13px;
  line-height: 1.15;
  vertical-align: middle;
}

.entry-table .product-order-header small {
  bottom: 7px;
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 650;
  left: 0;
  line-height: 1.2;
  margin: 0;
  position: absolute;
  right: 0;
  text-align: center;
  text-transform: none;
}

.entry-table td {
  padding: 10px 8px;
}

.entry-table .standard-product-header,
.entry-table .standard-product-cell {
  min-width: 78px;
  width: 78px;
}

.entry-table .standard-product-header {
  height: 88px;
  padding-bottom: 26px;
}

.entry-table .rotate-product-header,
.entry-table .compact-product-cell {
  min-width: 54px;
  width: 54px;
}

.entry-table .rotate-product-header {
  height: 154px;
  padding: 14px 4px 26px;
  vertical-align: middle;
}

.entry-table .rotate-product-header .product-header-label {
  display: inline-block;
  letter-spacing: 0;
  line-height: 1;
  max-height: 112px;
  overflow-wrap: anywhere;
  transform: rotate(180deg);
  white-space: normal;
  writing-mode: vertical-rl;
}

.entry-table .rotate-product-header small {
  font-size: 10px;
  line-height: 1.05;
}

.entry-table .customer-total-header,
.entry-table .customer-total-cell {
  background: #f8faf6;
  font-weight: 650;
  min-width: 64px;
  text-align: center;
  width: 64px;
}

.entry-table th:first-child,
.entry-table td:first-child {
  left: 0;
  position: sticky;
  min-width: 190px;
  width: 190px;
  z-index: 4;
}

.entry-table th:first-child {
  background: #f2f7f3;
  text-align: left;
}

.entry-table td:first-child {
  background: #ffffff;
}

.quantity-input {
  font-size: 14px;
  min-height: 36px;
  text-align: right;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-input[type="number"] {
  appearance: textfield;
}

.standard-product-cell .quantity-input {
  max-width: 64px;
  width: 64px;
}

.compact-product-cell .quantity-input {
  max-width: 46px;
  padding: 6px 4px;
  width: 46px;
}

.notes-input {
  min-width: 180px;
}

.save-status {
  color: var(--ok);
  font-weight: 650;
}

.total-row td {
  background: #f2f7f3;
  font-weight: 650;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  min-width: 100%;
  width: 100%;
}

td input[type="number"],
.quantity-input,
.price-input,
.special-quantity-input {
  text-align: right;
}

th,
td {
  border-bottom: 1px solid #e6ebe8;
  padding: 13px 15px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f1f5f2;
  color: #44505a;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f7faf8;
}

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

.business-feed-grid section {
  background: #fbfcfa;
  border: 1px solid #e6ebe8;
  border-radius: 12px;
  overflow: hidden;
}

.business-feed-grid h2 {
  font-size: 16px;
  padding: 14px 16px 0;
}

.employee-dashboard {
  display: grid;
  gap: 24px;
}

.employee-dashboard.hidden,
.employee-work-section.hidden,
.delivery-sequence-panel.hidden {
  display: none;
}

.employee-card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.employee-work-card {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 142px;
  padding: 24px;
  text-align: left;
  box-shadow: var(--soft-shadow);
}

.employee-work-card strong {
  color: var(--brand);
  font-size: 23px;
}

.employee-work-card span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.employee-work-card:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.employee-work-section {
  padding: 22px;
}

.button-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-action-select {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  min-width: 150px;
  padding: 7px 34px 7px 12px;
}

.invoice-action-cell {
  min-width: 132px;
  white-space: nowrap;
  width: 132px;
}

.invoice-action-cell .compact-action-select {
  max-width: 132px;
  min-width: 132px;
  width: 132px;
}

.invoice-row-action {
  cursor: pointer;
}

.delivery-sequence-panel,
.special-order-panel {
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 18px;
  padding: 18px;
}

.delivery-sequence-list {
  display: grid;
  gap: 10px;
}

.delivery-sequence-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px 1fr 90px;
  padding: 10px 12px;
}

.delivery-sequence-row.dragging,
#deliverySheetBody tr.dragging {
  background: var(--brand-soft);
  opacity: 0.55;
}

.delivery-sequence-row[draggable="true"],
#deliverySheetBody tr[draggable="true"] {
  cursor: grab;
}

.drag-handle {
  align-items: center;
  color: var(--green);
  cursor: grab;
  display: inline-flex;
  font-size: 20px;
  font-weight: 650;
  justify-content: center;
  letter-spacing: -3px;
  min-height: 34px;
  min-width: 24px;
  touch-action: none;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle-col,
.drag-handle-cell {
  text-align: center;
  width: 42px;
}

.delivery-sequence-message {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  margin: 0 0 12px;
}

.customer-order-start {
  display: grid;
  gap: 16px;
}

.customer-order-start input[list] {
  width: 100%;
}

.special-quantity-input {
  max-width: 120px;
}

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  font-weight: 650;
  padding: 4px 9px;
}

.badge.ok {
  background: #ecfdf3;
  color: var(--ok);
}

.badge.warn {
  background: #fffaeb;
  color: var(--warn);
}

.badge.danger {
  background: #fef3f2;
  color: var(--danger);
}

.fleet-module {
  display: grid;
  gap: 18px;
}

.fleet-topbar,
.fleet-profile-summary {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.fleet-topbar h2,
.fleet-profile-summary h2 {
  margin: 2px 0 0;
}

.fleet-dashboard-tiles {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.fleet-tile {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  text-align: left;
}

.fleet-tile:hover,
.fleet-tile.active {
  background: var(--brand-soft);
  border-color: #b9dcc5;
  box-shadow: 0 10px 22px rgba(47, 125, 79, 0.11);
  color: var(--ink);
  transform: translateY(-1px);
}

.fleet-tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.fleet-tile strong {
  color: var(--brand);
  font-size: 34px;
  line-height: 1;
}

.fleet-tile small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.fleet-tile.active {
  border-color: #8fc7a3;
  box-shadow: 0 12px 26px rgba(47, 125, 79, 0.16);
}

.fleet-tile:hover span,
.fleet-tile.active span {
  color: var(--brand-dark);
}

.fleet-tile:hover strong,
.fleet-tile.active strong {
  color: var(--brand);
}

.fleet-tile:hover small,
.fleet-tile.active small {
  color: var(--ink);
}

.employee-compliance-module {
  display: grid;
  gap: 18px;
}

.employee-compliance-tiles {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.compliance-overlay-card {
  min-height: 100vh;
}

.compliance-form-card {
  max-width: 880px;
  width: min(880px, 100%);
}

.employee-profile-child-overlay {
  align-items: center;
  background: rgba(24, 32, 38, 0.5);
  justify-content: center;
  padding: 32px;
  z-index: 2200;
}

.employee-profile-child-card {
  border: 1px solid rgba(47, 125, 79, 0.16);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(24, 32, 38, 0.26);
  max-height: calc(100vh - 64px);
  overflow: auto;
}

.employee-profile-child-card > label,
.employee-profile-child-card > .form-grid,
.employee-profile-child-card > .save-row {
  margin: 16px 20px;
}

.employee-file-upload-box {
  background: #f7fbf8;
  border: 1px dashed rgba(47, 125, 79, 0.32);
  border-radius: 14px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  padding: 14px;
}

.employee-file-upload-box input {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 42px;
  padding: 8px;
}

.employee-file-upload-box span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.employee-file-upload-box small,
.employee-profile-child-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.portal-access-panel {
  display: grid;
  gap: 18px;
}

.user-access-management {
  display: grid;
  gap: 16px;
}

.security-internal-tabs {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
  padding-bottom: 12px;
}

.security-role-tab-panel {
  background: #fff;
  border: 1px solid rgba(47, 125, 79, 0.12);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(24, 32, 38, 0.06);
  display: grid;
  gap: 16px;
  padding: 18px;
}

.security-role-tab-panel.hidden {
  display: none;
}

.security-role-tab-panel > h2 {
  font-size: 20px;
  margin: 0;
}

.security-action-row {
  background: #f8fbf8;
  border: 1px solid rgba(47, 125, 79, 0.12);
  border-radius: 12px;
  margin: 0;
  padding: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.portal-company-access-list {
  background: #f8fbf8;
  border: 1px solid rgba(47, 125, 79, 0.14);
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 16px;
}

.portal-company-access-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  gap: 12px;
  padding: 12px;
}

.portal-company-access-card input {
  accent-color: var(--green);
}

.portal-company-access-card span {
  display: grid;
  gap: 2px;
}

.portal-company-access-card small {
  color: var(--muted);
}

.compliance-overlay-card > label,
.compliance-overlay-card > .form-grid,
.compliance-overlay-card > .save-row,
.compliance-overlay-card > .order-content,
.compliance-overlay-card > .notice {
  margin: 16px 20px;
}

.compliance-missing-row td {
  background: #fff9ec;
}

.document-template-group {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.document-template-category-header {
  align-items: center;
  background: linear-gradient(180deg, #f8fbf8 0%, #f1f7f2 100%);
  border: 1px solid #d7e6dc;
  border-radius: 14px;
  color: var(--ink);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 58px;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}

.document-template-category-header:hover,
.document-template-category-header:focus-visible {
  background: var(--brand-soft);
  border-color: rgba(47, 125, 79, 0.38);
  box-shadow: 0 8px 22px rgba(36, 43, 48, 0.06);
}

.document-template-category-title {
  font-weight: 800;
}

.document-template-category-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.document-template-category-chevron {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7e1dc;
  border-radius: 999px;
  color: var(--brand);
  display: inline-flex;
  font-size: 22px;
  height: 30px;
  justify-content: center;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
  width: 30px;
}

.document-template-group.expanded .document-template-category-chevron {
  transform: rotate(90deg);
}

.document-template-category-content {
  overflow: hidden;
}

.document-template-category-content .table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}

body.document-template-modal-open {
  overflow: hidden;
}

.document-template-form-overlay {
  align-items: center;
  background: rgba(24, 32, 38, 0.54);
  justify-content: center;
  padding: 32px;
  z-index: 2200;
}

.document-template-form-card {
  background: #ffffff;
  border: 1px solid rgba(47, 125, 79, 0.16);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(24, 32, 38, 0.3);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 64px);
  max-width: 1040px;
  overflow: hidden;
  padding: 0;
  width: min(1040px, 100%);
}

.document-template-form-header {
  align-items: flex-start;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 24px 28px 20px;
}

.document-template-form-header h2 {
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 4px 0 0;
}

.document-template-form-header p:not(.eyebrow) {
  color: var(--muted);
  margin: 7px 0 0;
  max-width: 600px;
}

.document-template-close-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7e1dc;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 22px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0;
  width: 38px;
}

.document-template-close-button:hover,
.document-template-close-button:focus-visible {
  background: var(--brand-soft);
  border-color: rgba(47, 125, 79, 0.35);
  color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.12);
}

.document-template-form-body {
  background: #fbfcfa;
  display: grid;
  gap: 16px;
  overflow: auto;
  padding: 22px 28px;
}

.document-template-form-section {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(36, 43, 48, 0.04);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.document-template-form-section h3 {
  color: var(--ink);
  font-size: 0.96rem;
  letter-spacing: 0;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1ee;
}

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

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

.document-template-field-grid.compact {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.document-template-wide-field {
  grid-column: span 2;
}

.document-template-field-grid label,
.document-template-full-field {
  color: var(--muted);
  display: grid;
  font-size: 0.84rem;
  font-weight: 700;
  gap: 8px;
  min-width: 0;
}

.document-template-field-grid input,
.document-template-field-grid select,
.document-template-full-field textarea {
  border-color: #d7e1dc;
  border-radius: 10px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.document-template-field-grid input:focus,
.document-template-field-grid select:focus,
.document-template-full-field textarea:focus {
  border-color: #79b78d;
  box-shadow: 0 0 0 4px rgba(47, 125, 79, 0.13);
}

.document-template-full-field textarea {
  min-height: 108px;
  resize: vertical;
}

.document-template-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.document-template-toggle-card {
  align-items: center;
  background: #f8faf9;
  border: 1px solid #d7e1dc;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 64px;
  padding: 14px;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.document-template-toggle-card input {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.document-template-card-check {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd8d2;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 24px;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.document-template-card-check::after {
  color: #ffffff;
  content: "✓";
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
}

.document-template-card-label {
  color: var(--ink);
  font-weight: 700;
}

.document-template-toggle-card:hover {
  background: #f2f8f4;
  border-color: rgba(47, 125, 79, 0.34);
  box-shadow: 0 8px 22px rgba(36, 43, 48, 0.06);
  transform: translateY(-1px);
}

.document-template-toggle-card:focus-within {
  border-color: #79b78d;
  box-shadow: 0 0 0 4px rgba(47, 125, 79, 0.13);
}

.document-template-toggle-card:has(input:checked) {
  background: var(--brand-soft);
  border-color: rgba(47, 125, 79, 0.68);
  box-shadow: 0 10px 24px rgba(47, 125, 79, 0.13);
}

.document-template-toggle-card:has(input:checked) .document-template-card-check {
  background: var(--brand);
  border-color: var(--brand);
}

.document-template-toggle-card:has(input:checked) .document-template-card-check::after {
  opacity: 1;
}

.document-template-form-footer {
  align-items: center;
  background: #ffffff;
  border-top: 1px solid var(--line);
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 28px;
  position: sticky;
}

.document-template-footer-helper {
  color: var(--muted);
  font-size: 0.9rem;
  margin-right: auto;
}

.document-template-form-footer .save-status {
  color: var(--danger);
}

.muted-row td {
  color: var(--muted);
  opacity: 0.82;
}

.fleet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fleet-tab-button {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--muted);
}

.fleet-tab-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.compact-tabs {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.fleet-filter-row {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.fleet-filter-row .notice.compact {
  align-self: stretch;
  display: flex;
  font-size: 13px;
  margin: 0;
  padding: 10px 12px;
}

.fleet-table-wrap td,
.fleet-table-wrap th {
  vertical-align: middle;
}

.small-button {
  min-height: 34px;
  padding: 7px 10px;
}

.fleet-overlay-card {
  max-width: 1180px;
}

.fleet-overlay-card > label,
.fleet-overlay-card > .form-grid,
.fleet-overlay-card > .save-row,
.fleet-overlay-card > .order-content {
  margin: 18px 22px 0;
}

.fleet-alert-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.overlay-footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

@media (max-width: 1100px) {
  .fleet-dashboard-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 700px) {
  .document-template-form-overlay {
    align-items: stretch;
    padding: 14px;
  }

  .document-template-form-card {
    max-height: calc(100vh - 28px);
  }

  .document-template-form-header,
  .document-template-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .document-template-wide-field {
    grid-column: auto;
  }

  .document-template-form-footer .save-status {
    margin-right: 0;
  }

  .document-template-category-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .document-template-category-meta {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: normal;
  }

  .fleet-dashboard-tiles,
  .fleet-filter-row {
    grid-template-columns: 1fr;
  }

  .fleet-topbar,
  .fleet-profile-summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .delivery-exception-row.three,
  .delivery-exception-row.four,
  .delivery-exception-row.five {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    height: auto;
    position: static;
  }

  .tab-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .tab-button {
    width: auto;
  }

  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .dashboard-hero,
  .employee-card-grid,
  .business-feed-grid,
  .work-area,
  .customer-center,
  .form-grid,
  .security-grid,
  .roles-layout,
  .permission-grid,
  .collection-edit-panel,
  .weekly-route-board,
  .invoice-center-filters,
  .invoice-center-metrics,
  .schedule-grid,
  .schedule-editor,
  .document-template-field-grid,
  .document-template-type-grid,
  .settings-filters {
    grid-template-columns: 1fr;
  }

  .document-template-wide-field {
    grid-column: auto;
  }

  .customer-detail-grid,
  .customer-summary-cards,
  .customer-overview-grid,
  .customer-command-grid,
  .customer-account-activity,
  .customer-order-choice-grid,
	  .compact-form-grid,
	  .statement-header,
	  .statement-page-header,
	  .statement-setup-grid,
	  .customer-statement-grid,
  .customer-transaction-filters,
    .employee-compliance-tiles,
    .invoice-workspace,
    .invoice-discount-grid,
    .invoice-notes-grid,
    .invoice-pod-upload-row {
	    grid-template-columns: 1fr;
	  }

	  .statement-workspace {
	    margin: 16px;
	  }

	  .statement-total-card,
	  .statement-workspace-footer {
	    text-align: left;
	  }

	  .statement-workspace-footer {
	    align-items: stretch;
	    flex-direction: column;
	  }

	  .statement-workspace-footer #statementCancelButton {
	    margin-right: 0;
	  }

  .customer-browser,
  .customer-profile-card {
    min-height: auto;
  }

  .customer-list-mode .customer-browser-header {
    grid-template-columns: 1fr;
  }

  .customer-list-mode .customer-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .delivery-sequence-row {
    grid-template-columns: 1fr;
  }

  .customer-profile-top {
    grid-template-columns: 1fr;
  }

  .customer-balance-box {
    text-align: left;
    width: 100%;
  }

  .customer-balance-actions {
    width: 100%;
  }

  main,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media print {
  .actions,
  #orderWorkflow,
  #releaseSheetPanel.hidden,
  #deliverySheetPanel.hidden,
  #invoicePanel.hidden,
  .metrics,
  #weeklySchedulePanel,
  #cutoffSetupPanel,
  #reportsPanel,
  #financeReportsPanel,
  .work-area,
  main > .panel.full:last-child,
  .invoice-center,
  #invoiceList,
  #invoicePanel .form-grid,
  #invoicePanel .inline-check,
  #paymentWarning,
  #invoicePanel .save-row,
  select,
  input,
  button {
    display: none;
  }

  .no-print {
    display: none !important;
  }

  body.print-release main > section:not(#releaseSheetPanel),
  body.print-delivery main > section:not(#deliverySheetPanel) {
    display: none;
  }

  body.print-release #releaseSheetPanel,
  body.print-delivery #deliverySheetPanel {
    display: block;
  }

  body.print-release #releaseSheetPanel .sheet-export-row,
  body.print-delivery #deliverySheetPanel .sheet-export-row {
    display: none;
  }

  body {
    background: #ffffff;
  }

  .panel,
  .metrics article {
    border-color: #000000;
  }

  #invoicePanel,
  .invoice-document {
    border: 0;
    margin: 0;
    padding: 0;
  }

  #invoicePanel {
    display: block;
  }

  .invoice-activity-table .price-input {
    display: none;
  }

  .print-rate {
    display: inline;
  }
}
