:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #dfe7f1;
  --line-strong: #c7d4e2;
  --text: #182231;
  --ink: #0d1b2c;
  --muted: #66758a;
  --green: #3157c8;
  --green-2: #eef3ff;
  --accent: var(--green);
  --accent-soft: var(--green-2);
  --blue: #0784a8;
  --amber: #a15b00;
  --red: #b42335;
  --shadow: 0 18px 38px rgba(21, 39, 70, .12);
  --sidebar-bg: #ffffff;
  --sidebar-text: #172033;
  --sidebar-muted: #75849a;
  --header-bg: #0b1324;
  --header-text: #f8fbff;
  --header-muted: #9fb0c8;
  --field-h: 38px;
  --row-h: 42px;
  --radius: 7px;
}

.load-push-result {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 12000;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: min(520px, calc(100vw - 48px));
  padding: 16px 18px;
  border: 1px solid #b7e4d4;
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  background: #f2fbf7;
  color: #15372d;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.22);
  font-size: 14px;
  line-height: 1.45;
}

.load-push-result.error {
  border-color: #f3c2c9;
  border-left-color: #d72645;
  background: #fff5f6;
  color: #701a2b;
}

.load-push-result span { flex: 1; font-weight: 600; }
.load-push-result button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

body[data-accent="blue"] { --green: #2563b8; --green-2: #e8f0fb; --accent: #2563b8; --accent-soft: #e8f0fb; --blue: #2563b8; }
body[data-accent="teal"] { --green: #087f92; --green-2: #e9f8fb; --accent: #087f92; --accent-soft: #e9f8fb; --blue: #3157c8; }
body[data-accent="slate"] { --green: #475569; --green-2: #eef2f7; --accent: #475569; --accent-soft: #eef2f7; --blue: #087f92; }

body[data-theme="dark"] {
  --bg: #111820;
  --panel: #172033;
  --panel-2: #1f2b42;
  --line: #2b3a55;
  --line-strong: #3b4c68;
  --text: #e7edf3;
  --ink: #f4f7fa;
  --muted: #a7b4bf;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --shadow: 0 18px 44px rgba(0,0,0,.34);
  color-scheme: dark;
}

body[data-theme="dark"] .metric-card:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

body[data-theme="dark"] td {
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  body[data-theme="auto"] {
    --bg: #111820;
    --panel: #17212b;
    --panel-2: #202c38;
    --line: #2b3a47;
    --line-strong: #3b4c5b;
    --text: #e7edf3;
    --ink: #f4f7fa;
    --muted: #a7b4bf;
    --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
    --shadow: 0 18px 44px rgba(0,0,0,.34);
    color-scheme: dark;
  }

  body[data-theme="auto"] .metric-card:hover {
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  }

  body[data-theme="auto"] th,
  body[data-theme="auto"] .loads-filter-row th,
  body[data-theme="auto"] .table-wrap table th:last-child,
  body[data-theme="auto"] .table-wrap table td:last-child {
    background: var(--panel-2);
    color: var(--muted);
  }

  body[data-theme="auto"] td {
    color: var(--text);
  }

  body[data-theme="auto"] .hint-block,
  body[data-theme="auto"] .profit-grid div,
  body[data-theme="auto"] .preview-card {
    background: var(--panel-2);
  }

}

body[data-sidebar="graphite"] { --sidebar-bg: #151d2b; --sidebar-text: #f2f5f7; --sidebar-muted: #b9c2ca; }
body[data-sidebar="light"] { --sidebar-bg: #ffffff; --sidebar-text: #1b2a38; --sidebar-muted: #6d7a86; }
body[data-density="compact"] { --field-h: 32px; --row-h: 36px; font-size: 13px; }

* { box-sizing: border-box; }

body {
  height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(49,87,200,.05), transparent 240px),
    var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(49,87,200,.2), transparent 38%),
    linear-gradient(315deg, rgba(8,132,168,.18), transparent 34%),
    #0b1324;
}

.login-screen[hidden] {
  display: none;
}

[hidden],
.login-card[hidden],
#installForm[hidden],
#loginForm[hidden] {
  display: none !important;
}

.logged-out .app-shell {
  visibility: hidden;
  opacity: 0;
  filter: none;
  pointer-events: none;
  user-select: none;
}

.login-card {
  width: min(390px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(0,0,0,.28);
}

.login-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #0b1324;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

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

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

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.login-card input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-weight: 400;
}

.login-error {
  min-height: 18px;
  color: var(--red);
}

button, input, select, textarea { font: inherit; }

* {
  box-sizing: border-box;
}

.native-searchable-select {
  position: relative;
  display: grid;
  width: 100%;
}

.native-searchable-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.native-searchable-input {
  width: 100%;
  min-width: 0;
  padding-right: 34px !important;
}

.native-searchable-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 32px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.native-searchable-toggle::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.native-searchable-menu {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  display: none;
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.native-searchable-select.open .native-searchable-menu {
  display: grid;
}

.native-searchable-menu button {
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 6px 10px;
  cursor: pointer;
}

.native-searchable-menu button[hidden],
.native-searchable-empty[hidden] {
  display: none;
}

.native-searchable-menu button:hover,
.native-searchable-menu button.selected {
  background: rgba(20, 148, 136, 0.12);
}

.native-searchable-menu .native-searchable-add-option {
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
}

.native-searchable-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}
button { cursor: pointer; }

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 264px minmax(860px, 1fr);
  grid-template-rows: 58px minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "sidebar workspace";
  overflow: hidden;
}

.app-header {
  grid-area: header;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 22px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: var(--header-bg);
  color: var(--header-text);
}

.sidebar {
  grid-area: sidebar;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  box-shadow: 10px 0 26px rgba(21,39,70,.06);
}

.brand {
  width: 232px;
  min-height: 58px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: 184px;
  height: 54px;
  object-fit: contain;
  object-position: left center;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f6ee8, #08a0bd);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand strong { font-size: 19px; line-height: 1; letter-spacing: 0; }
.brand-copy > span { color: var(--header-muted); font-size: 11px; text-transform: uppercase; }

.sidebar-toggle {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  display: inline-grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
  color: var(--header-text);
}

.sidebar-toggle span {
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: .82;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,.1);
}

.header-spacer {
  flex: 1;
}

.user-name {
  color: var(--header-muted);
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
}

#nav {
  display: grid;
  gap: 5px;
  padding: 14px 12px;
  overflow: auto;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 0 10px;
  color: var(--sidebar-text);
  background: transparent;
  text-align: left;
}

.nav-item:hover {
  background: #f4f7fb;
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-icon {
  width: 28px;
  margin-right: 10px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  opacity: .85;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item i {
  width: 28px;
  margin-right: 10px;
  text-align: center;
  font-size: 20px;
  line-height: 1;
  opacity: .85;
}
.nav-item.active i,
.nav-item.active .nav-icon { opacity: 1; }
.nav-item small { color: var(--sidebar-muted); }

.subnav {
  display: grid;
  margin: -2px 0 6px;
}

.subnav button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--sidebar-muted);
  padding: 0 12px 0 44px;
  text-align: left;
  font-weight: 700;
  border-radius: 10px;
}

.subnav button:hover,
.subnav button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.workspace {
  grid-area: workspace;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  background: transparent;
}

.pagebar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
}

.pagebar h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
.pagebar p { margin: 5px 0 0; color: var(--muted); }

body[data-sidebar-collapsed="true"] .app-shell {
  grid-template-columns: 76px minmax(860px, 1fr);
}

body[data-sidebar-collapsed="true"] .brand {
  width: 46px;
}

body[data-sidebar-collapsed="true"] .brand-logo {
  width: 184px;
  max-width: none;
  flex: 0 0 184px;
}

body[data-sidebar-collapsed="true"] .sidebar .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

body[data-sidebar-collapsed="true"] .sidebar .nav-item b,
body[data-sidebar-collapsed="true"] .sidebar .nav-item small,
body[data-sidebar-collapsed="true"] .sidebar .subnav {
  display: none;
}

body[data-sidebar-collapsed="true"] .sidebar .nav-icon {
  margin-right: 0;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.hidden {
  display: none !important;
}

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

.backup-progress-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  color: #102033;
}

.backup-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.backup-progress-head strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.backup-progress-head span {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 13px;
}

.backup-progress-bar {
  height: 8px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.backup-progress-bar span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: backupProgressMove 1.1s ease-in-out infinite;
}

.backup-progress-overlay.done .backup-progress-bar span {
  width: 100%;
  animation: none;
}

.backup-progress-overlay.error .backup-progress-bar span {
  width: 100%;
  animation: none;
  background: #dc2626;
}

.backup-progress-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.backup-progress-steps li {
  position: relative;
  padding-left: 28px;
  color: #64748b;
  font-size: 14px;
}

.backup-progress-steps li::before {
  position: absolute;
  left: 0;
  top: 1px;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  content: "";
}

.backup-progress-steps li.complete {
  color: #0f766e;
}

.backup-progress-steps li.complete::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px #fff;
}

.backup-progress-steps li.active {
  color: #0f172a;
  font-weight: 700;
}

.backup-progress-steps li.active::before {
  border-color: var(--accent);
}

.backup-progress-steps li.failed {
  color: #b91c1c;
  font-weight: 700;
}

.backup-progress-steps li.failed::before {
  border-color: #dc2626;
  background: #dc2626;
}

.backup-progress-dialog pre {
  min-height: 0;
  margin: 16px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

@keyframes backupProgressMove {
  0% { transform: translateX(-105%); }
  55% { transform: translateX(85%); }
  100% { transform: translateX(220%); }
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.primary, .secondary, .danger, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--field-h);
  border-radius: 0px;
  padding: 8px 14px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #0784a8);
  color: #fff;
  box-shadow: none;
}

.secondary { 
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.primary:hover,
.primary:focus-visible {
  filter: saturate(1.08) brightness(.96);
}
.secondary:hover,
.secondary:focus-visible,
.ghost:hover,
.ghost:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}
.primary:focus-visible,
.secondary:focus-visible,
.danger:focus-visible,
.ghost:focus-visible,
.grid-link:focus-visible,
.icon-action:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 58%, transparent);
  outline-offset: 2px;
}
.primary:disabled,
.secondary:disabled,
.danger:disabled,
.ghost:disabled {
  opacity: .52;
  cursor: not-allowed;
}

.danger-action {
  border-color: rgba(196, 57, 48, 0.35);
  color: var(--red);
}

.danger-action:hover {
  background: rgba(196, 57, 48, 0.08);
}
.ghost { 
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.icon { border: 0; background: transparent; color: inherit; font-weight: 700; }

.grid-link,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  max-width: 100%;
  border-radius: 8px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.icon-action,
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 9px;
  line-height: 1;
}

.actions,
.row-actions,
.partner-tab-actions,
.vendor-balance-actions {
  white-space: nowrap;
}

.actions > *,
.row-actions > *,
.partner-tab-actions > *,
.vendor-balance-actions > * {
  margin-inline: 2px;
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 800;
}

.user-avatar::before {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  transform: translateY(-5px);
}

.user-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 30;
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.user-menu-panel.open {
  display: block;
}

.user-menu-head {
  display: grid;
  gap: 3px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.user-menu-head span {
  color: var(--muted);
  font-size: 12px;
}

.user-menu-panel button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.user-menu-panel .user-menu-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.user-menu-panel .user-menu-link:hover,
.user-menu-panel .user-menu-link:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

.user-menu-panel button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.kpi {
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 15px;
  box-shadow: 0 8px 18px rgba(21,39,70,.05);
}

.kpi span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.kpi strong { display: block; margin-top: 8px; font-size: 24px; }

.board {
  height: 100%;
  min-height: 0;
  padding: 12px 28px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.toolbar .segments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fuel-transaction-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -2px 0 10px;
}

.segment {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 6px 11px;
}

.segment.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }

.table-wrap {
  min-height: 0;
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: 0 10px 24px rgba(21,39,70,.06);
}

.table-panel {
  min-height: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.board > .table-panel,
.board > .standard-page-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 168px);
}

.table-panel > .table-wrap {
  flex: 0 0 auto;
}

.board > .table-panel > .table-wrap,
.board > .standard-page-grid > .table-wrap {
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: visible;
}

.table-panel > .table-pager {
  margin-top: 0;
  flex: 0 0 auto;
  padding: 12px 4px;
}

.board > .table-panel > .table-pager,
.board > .standard-page-grid > .table-pager {
  position: static;
  flex: 1 1 auto;
  align-items: flex-end;
  margin-top: 0;
  padding: 16px 4px 0;
}

.table-pager {
  position: static;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 8px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
}

.table-pager .pager-nav,
.table-pager .pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-pager .pager-size {
  margin-left: auto;
}

.table-pager .pager-size span,
.table-pager .pager-size b {
  font-weight: 600;
}

.table-pager button {
  min-width: 30px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
}

.table-pager button:not(:disabled):hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.table-pager button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.table-pager button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.pager-ellipsis {
  min-width: 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

th, td {
  height: var(--row-h);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  font-weight: 400;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f8fafd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap th:first-child,
.table-wrap td:first-child {
  padding-left: 14px;
}

.table-wrap th:last-child,
.table-wrap td:last-child {
  padding-right: 14px;
}

.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.table-wrap td:not(.actions):not(.row-actions),
.table-wrap th:not(.actions-col) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap td.right,
.table-wrap th.right,
td.right,
th.right {
  text-align: right;
}

.table-wrap .empty-row td,
.empty-cell {
  height: 72px;
  color: var(--muted);
  text-align: center;
  font-weight: 400;
  background: var(--panel) !important;
}

.table-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.table-pager b {
  font-weight: 400;
}

.pager-nav,
.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table-pager button,
.pager-nav button,
.pager-size button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 500;
  line-height: 1;
}

.table-pager button.active,
.pager-nav button.active,
.pager-size button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.table-pager button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

tbody tr:hover { background: #f6f8ff; }
body[data-theme="dark"] tbody tr:hover,
body[data-theme="dark-auto"] tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

td.actions {
  display: table-cell;
  width: 1%;
  min-width: 72px;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
  z-index: 10;
  overflow: visible;
}

td.actions button {
  position: relative;
  z-index: 11;
  min-height: 32px;
  padding: 0 6px;
  margin-right: 4px;
  vertical-align: middle;
}

td.actions button:last-child {
  margin-right: 0;
}

/* Keep the compact edit action consistent in every data table; theme.css supplies its configured color. */
td.actions .icon-action.edit {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  margin-right: 4px;
  border: 1px solid var(--accent) !important;
  border-radius: 0px;
  background: var(--panel) !important;
  color: var(--accent) !important;
}

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

.table-wrap table.has-actions-column th:last-child,
.table-wrap table.has-actions-column td:last-child,
.table-wrap table th.actions-col,
.table-wrap table td.actions,
.table-wrap table td.row-actions {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--panel);
  box-shadow: -1px 0 0 var(--line);
}

.table-wrap table.has-actions-column th:last-child,
.table-wrap table th.actions-col {
  z-index: 5;
  background: var(--panel-2);
}

.table-wrap table.has-actions-column tbody tr:hover td:last-child,
.table-wrap table tbody tr:hover td.actions,
.table-wrap table tbody tr:hover td.row-actions {
  background: #f6f8ff;
}

body[data-theme="dark"] .table-wrap table.has-actions-column tbody tr:hover td:last-child,
body[data-theme="dark"] .table-wrap table tbody tr:hover td.actions,
body[data-theme="dark"] .table-wrap table tbody tr:hover td.row-actions,
body[data-theme="dark-auto"] .table-wrap table.has-actions-column tbody tr:hover td:last-child,
body[data-theme="dark-auto"] .table-wrap table tbody tr:hover td.actions,
body[data-theme="dark-auto"] .table-wrap table tbody tr:hover td.row-actions {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.table-wrap table th:nth-last-child(2),
.table-wrap table td:nth-last-child(2) {
  width: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 9px;
  padding: 3px 9px;
  background: #eef2f7;
  color: #40505d;
  font-size: 12px;
  font-weight: 600;
}

.chip.new, .chip.available, .chip.draft, .chip.low { color: var(--accent); background: var(--accent-soft); }
.chip.dispatched, .chip.in-transit, .chip.ready, .chip.scheduled, .chip.applicant, .chip.expiring-soon, .chip.medium, .chip.review, .chip.open { color: var(--amber); background: #fff5df; }
.chip.delivered, .chip.paid, .chip.approved, .chip.active, .chip.hired, .chip.complete, .chip.resolved { color: var(--accent); background: var(--accent-soft); }
.chip.canceled, .chip.overdue, .chip.hold, .chip.expired, .chip.missing, .chip.high, .chip.critical { color: var(--red); background: #fff0ee; }

body[data-theme="dark"] .chip,
body[data-theme="dark-auto"] .chip {
  background: var(--panel-2);
  color: var(--text);
}

body[data-theme="dark"] .chip.new,
body[data-theme="dark"] .chip.available,
body[data-theme="dark"] .chip.draft,
body[data-theme="dark"] .chip.low,
body[data-theme="dark-auto"] .chip.new,
body[data-theme="dark-auto"] .chip.available,
body[data-theme="dark-auto"] .chip.draft,
body[data-theme="dark-auto"] .chip.low {
  background: rgba(40, 104, 199, .18);
  color: #8db7f4;
}

body[data-theme="dark"] .chip.dispatched,
body[data-theme="dark"] .chip.in-transit,
body[data-theme="dark"] .chip.ready,
body[data-theme="dark"] .chip.scheduled,
body[data-theme="dark"] .chip.applicant,
body[data-theme="dark"] .chip.expiring-soon,
body[data-theme="dark"] .chip.medium,
body[data-theme="dark"] .chip.review,
body[data-theme="dark"] .chip.open,
body[data-theme="dark-auto"] .chip.dispatched,
body[data-theme="dark-auto"] .chip.in-transit,
body[data-theme="dark-auto"] .chip.ready,
body[data-theme="dark-auto"] .chip.scheduled,
body[data-theme="dark-auto"] .chip.applicant,
body[data-theme="dark-auto"] .chip.expiring-soon,
body[data-theme="dark-auto"] .chip.medium,
body[data-theme="dark-auto"] .chip.review,
body[data-theme="dark-auto"] .chip.open {
  background: rgba(184, 121, 9, .2);
  color: #f4c35f;
}

body[data-theme="dark"] .chip.delivered,
body[data-theme="dark"] .chip.paid,
body[data-theme="dark"] .chip.approved,
body[data-theme="dark"] .chip.active,
body[data-theme="dark"] .chip.hired,
body[data-theme="dark"] .chip.complete,
body[data-theme="dark"] .chip.resolved,
body[data-theme="dark-auto"] .chip.delivered,
body[data-theme="dark-auto"] .chip.paid,
body[data-theme="dark-auto"] .chip.approved,
body[data-theme="dark-auto"] .chip.active,
body[data-theme="dark-auto"] .chip.hired,
body[data-theme="dark-auto"] .chip.complete,
body[data-theme="dark-auto"] .chip.resolved {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: #8ee0b2;
}

body[data-theme="dark"] .chip.canceled,
body[data-theme="dark"] .chip.overdue,
body[data-theme="dark"] .chip.hold,
body[data-theme="dark"] .chip.expired,
body[data-theme="dark"] .chip.missing,
body[data-theme="dark"] .chip.high,
body[data-theme="dark"] .chip.critical,
body[data-theme="dark-auto"] .chip.canceled,
body[data-theme="dark-auto"] .chip.overdue,
body[data-theme="dark-auto"] .chip.hold,
body[data-theme="dark-auto"] .chip.expired,
body[data-theme="dark-auto"] .chip.missing,
body[data-theme="dark-auto"] .chip.high,
body[data-theme="dark-auto"] .chip.critical {
  background: rgba(194, 65, 53, .2);
  color: #ff9388;
}

.filtered-by {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: #6c7b86;
  font-size: 12px;
}

.filtered-by span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.muted-primary {
  background: color-mix(in srgb, var(--accent) 42%, #fff);
  color: #fff;
  border-color: color-mix(in srgb, var(--accent) 42%, #fff);
}

.email-sent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #60717d;
  font-size: 12px;
}

.email-sent span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  position: relative;
}

.email-sent span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 4px;
  height: 2px;
  border-left: 1px solid #fff;
  border-bottom: 1px solid #fff;
  transform: rotate(-45deg);
}

.radio-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.add-line-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 26px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.danger-icon-link {
  color: #e11d48;
}

.required-mark {
  color: var(--danger);
}

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

.section-heading h3 {
  margin: 0;
}

.section-heading p {
  max-width: 680px;
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.checkbox-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  text-transform: none;
  color: var(--text);
}

.checkbox-field input {
  width: auto;
}

.hint-block {
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  line-height: 1.5;
}

.system-preview {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 150px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.preview-sidebar {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 18px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.preview-sidebar strong {
  font-size: 22px;
}

.preview-sidebar span {
  color: var(--sidebar-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.preview-surface {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.preview-card {
  min-width: 170px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.preview-card small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
}

.preview-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.grid-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  min-height: 28px;
  border-radius: 4px;
  padding: 2px 6px;
  text-decoration: none;
  font-weight: 700;
}

button[data-export-drivers-excel], button[data-export-equipment-excel], button[data-export-fuel-excel] {
  text-decoration: underline;
  font-weight: 400;
}

.payments-tool-buttons-bar:has([data-export-drivers-excel]),
.payments-tool-buttons-bar:has([data-export-equipment-excel]),
.payments-tool-buttons-bar:has([data-export-fuel-excel]) {
  display: inline-flex;
  margin: 0 0 8px 125px;
  position: relative;
  z-index: 2;
  vertical-align: top;
}

.fuel-transaction-actions:has([data-export-fuel-excel]) {
  margin: 0 0 8px 125px;
  position: relative;
  z-index: 2;
}

.grid-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.pagebar p:empty {
  display: none;
}

body.partners-mode .pagebar > div:first-child {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  justify-content: start;
  column-gap: 8px;
}

.pagebar > div:first-child:has(.partner-title-exports) {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  justify-content: start;
  column-gap: 4px;
}

.pagebar > div:first-child:has(.partner-title-exports) > p {
  grid-column: 1 / -1;
}

body.partners-mode .pagebar > div:first-child > p {
  grid-column: 1 / -1;
}

.warning-cell {
  color: #c87550;
  font-size: 12px;
}

.top-actions {
  position: relative;
}

.money-total {
  text-align: right;
  font-weight: 700;
}

.money-bar {
  height: 6px;
  display: flex;
  overflow: hidden;
  background: #edf2f3;
}

.money-bar span {
  display: block;
}

.money-active { background: #29aa5a; }
.money-delivered { background: #f3a22d; }
.money-canceled { background: #ff4b40; }

.money-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.attachments-cell {
  width: 130px;
  white-space: nowrap;
  text-align: center;
}

.notes-cell {
  width: 250px;
  max-width: 250px;
  white-space: normal;
  line-height: 1.25;
}

.attachment-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.attachment-link.attachment-icon-only {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 0 2px;
  color: var(--accent);
  text-decoration: none;
  vertical-align: middle;
}

.attachment-link.attachment-icon-only svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
}

.attachment-extra {
  display: inline-flex;
  align-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.sort-mark::before,
.sort-mark::after {
  content: "";
  display: block;
  margin: 0 auto;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.sort-mark::before {
  border-bottom: 5px solid #9aa1a7;
  margin-bottom: 2px;
}

.sort-mark::after {
  border-top: 5px solid #9aa1a7;
}

.sort-mark {
  display: inline-grid;
  width: 10px;
  margin-left: 5px;
  vertical-align: middle;
}

.rate-cell {
  font-weight: 400;
  font-size: 14px;
}

.draft-action-menu > div {
  min-width: 96px;
}

.draft-action-menu > div button.danger {
  color: #e2483e;
}

.review-pdf-pages {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.review-pdf-page-shell {
  position: relative;
  display: grid;
  justify-items: center;
}

.review-pdf-page {
  display: block;
  max-width: none;
  height: auto;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 32, 51, .14);
}

.review-pdf-page-badge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  min-width: 112px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(28, 32, 38, .72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.review-main-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid #d9e0e7;
  margin-bottom: 24px;
}

.review-main-grid .full {
  grid-column: 1 / -1;
}

.review-reset {
  float: right;
  border: 0;
  background: transparent;
  color: #1882e4;
  padding: 0;
}

.review-stops {
  display: grid;
  gap: 24px;
}

.review-stop-card {
  border: 1px solid #cbd5df;
  background: #fff;
}

.review-stop-card h4 {
  margin: 0;
  padding: 13px 22px;
  background: #f6f8fa;
  border-bottom: 1px solid #cbd5df;
}

.review-radio-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 22px;
  padding: 26px 16px 12px;
}

.review-radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.review-radio-row input[type="radio"] {
  width: 19px;
  height: 19px;
  accent-color: #50bf77;
}

.review-stop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px 16px;
  padding: 12px 16px 24px;
}

.review-stop-grid .full {
  grid-column: 1 / -1;
}

.notes-cell {
  width: 250px;
  max-width: 250px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.25;
}

.attachments-cell {
  max-width: 140px;
  color: var(--accent);
  white-space: nowrap;
}

.attachment-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.action-link,
.action-caret,
.clear-filters {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.action-link {
  text-decoration: underline;
}

.row-action-select {
  width: 118px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  padding: 0 6px;
}

.grid-action-menu {
  margin-left: 6px;
  vertical-align: middle;
}

.grid-action-menu summary {
  display: inline-flex;
  width: 22px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.grid-action-menu summary::after {
  margin-left: 0;
}

.grid-action-menu > div {
  min-width: 132px;
}

.action-caret {
  color: #55616b;
  font-size: 12px;
}

.clear-filters {
  color: #7a8289;
  font-weight: 400;
}

.empty-loads {
  height: 120px;
  color: var(--muted);
  text-align: center;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.card h3 { margin: 0 0 8px; }
.card p { margin: 4px 0; color: var(--muted); }

.dashboard-shell {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 14px;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  text-align: left;
}

.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.metric-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.emails-report {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel);
}

.emails-search {
  width: min(265px, 100%);
  position: relative;
}

.emails-search span {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid #94a3b8;
  border-radius: 999px;
  transform: translateY(-50%);
  pointer-events: none;
}

.emails-search span::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  background: #94a3b8;
  transform: rotate(45deg);
}

.emails-search input {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}

.email-status-dot {
  display: inline-flex;
  width: 16px;
  height: 16px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--accent);
  position: relative;
  vertical-align: -3px;
}

.email-status-dot::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 6px;
  height: 3px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.email-status-dot.read {
  background: #22c55e;
}

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: #d7dde2;
}

.status-dot.ok {
  background: var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 12px;
}

.dashboard-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
}

.dashboard-panel h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.bar-row span {
  color: var(--muted);
}

.bar-row div {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

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

.panel-head h3 {
  margin: 0;
}

.pending-panel {
  padding-bottom: 0;
}

.drawer, .modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 31, 40, .45);
}

.drawer.open, .modal.open { display: flex; }

.drawer { z-index: 20000; }

.modal { z-index: 25000; }

.drawer {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.drawer article {
  width: min(1320px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.drawer header, .modal header, .drawer footer, .modal footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.drawer header {
  min-height: 40px;
  padding: 8px 14px;
}

.drawer header h2 {
  font-size: 18px;
}

.drawer header p {
  margin-top: 2px;
  font-size: 12px;
}

.drawer footer, .modal footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.drawer footer button,
.modal footer button {
  min-height: 36px;
  position: relative;
  z-index: 21;
  cursor: pointer;
  pointer-events: auto;
}

.drawer footer .secondary {
  min-width: 82px;
  background: color-mix(in srgb, var(--muted) 18%, var(--panel));
}

.drawer h2, .modal h2 { margin: 0; }
.drawer p { margin: 4px 0 0; color: var(--muted); }
#drawerBody { overflow: auto; padding: 14px; }

.route-card {
  width: 180px;
  min-width: 180px;
  min-height: 84px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 6px rgba(31, 41, 51, .18);
  padding: 8px 10px;
  background: var(--panel);
  text-align: left;
  color: inherit;
  font: inherit;
}

button.route-card {
  cursor: pointer;
}

button.route-card:hover,
button.route-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.route-card small,
.route-card span {
  display: block;
  color: var(--muted);
  min-height: 16px;
  white-space: nowrap;
}

.route-card strong {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 0;
  color: var(--text);
  font-size: 17px;
}

.route-pin {
  width: 10px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 8px 8px 8px 0;
  background: #2f80ed;
  transform: rotate(-45deg);
}

.route-pin.driver { background: #e54364; }
.route-pin.pickup { background: #22b14c; }
.route-pin.delivery { background: #2f80ed; }

.route-leg {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 42px;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.route-leg small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.inline-save,
.inline-cancel {
  width: 30px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.inline-save {
  background: var(--accent);
  color: white;
}

.inline-cancel {
  background: transparent;
  color: var(--muted);
}

.distance-editor {
  display: grid;
  grid-template-columns: minmax(120px, 180px) auto;
  gap: 12px;
  align-items: end;
  max-width: 520px;
}

.distance-editor .full {
  grid-column: 1 / -1;
}

.distance-override {
  min-height: 38px;
  align-items: center;
}

.important-note-marker {
  position: relative;
  display: inline-block;
  width: 0;
  height: 0;
  margin-top: 3px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 17px solid var(--warning);
}

.important-note-marker::after {
  content: "!";
  position: absolute;
  left: -2px;
  top: 4px;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.note-action {
  min-width: 112px;
  height: 34px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.note-action:hover {
  background: color-mix(in srgb, var(--accent) 86%, #000);
}

.total-row td {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.workflow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.workflow-step {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--panel);
}

.workflow-step.done { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.workflow-step.current { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 44%, var(--line)); }

.docs-inbox-table table,
.docs-required-table table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.docs-inbox-table th,
.docs-inbox-table td,
.docs-required-table th,
.docs-required-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-inbox-table th:first-child,
.docs-inbox-table td:first-child {
  width: 720px;
  max-width: 720px;
}

.docs-inbox-table th:nth-child(2),
.docs-inbox-table td:nth-child(2) {
  width: 90px;
}

.docs-inbox-table th:nth-child(3),
.docs-inbox-table td:nth-child(3),
.docs-inbox-table th:nth-child(4),
.docs-inbox-table td:nth-child(4) {
  width: 150px;
  max-width: 150px;
}

.docs-inbox-table th:nth-child(5),
.docs-inbox-table td:nth-child(5) {
  width: 150px;
  max-width: 150px;
}

.docs-inbox-table th:nth-child(6),
.docs-inbox-table td:nth-child(6),
.docs-inbox-table th:nth-child(7),
.docs-inbox-table td:nth-child(7),
.docs-inbox-table th:nth-child(8),
.docs-inbox-table td:nth-child(8) {
  width: 100px;
}

.docs-inbox-table th:last-child,
.docs-inbox-table td:last-child {
  width: 128px;
  min-width: 128px;
}

.docs-required-table th:first-child,
.docs-required-table td:first-child {
  width: 160px;
}

.docs-required-table th:nth-child(2),
.docs-required-table td:nth-child(2),
.docs-required-table th:nth-child(4),
.docs-required-table td:nth-child(4),
.docs-required-table th:last-child,
.docs-required-table td:last-child {
  width: 170px;
}

.docs-required-table th:nth-child(3),
.docs-required-table td:nth-child(3) {
  width: 520px;
  max-width: 520px;
}

.print-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.print-sheet h3 { margin-top: 0; }

.print-sheet .data-table {
  margin-top: 10px;
}

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

.audit-row {
  display: grid;
  grid-template-columns: 150px 120px 1fr;
  gap: 10px;
}

.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.route-card.missing-position {
  border-style: dashed;
  background: var(--panel-2);
}

.route-card.missing-position strong {
  color: var(--amber);
}

.detail span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.detail strong { display: block; margin-top: 6px; font-size: 18px; }

.timeline {
  display: grid;
  gap: 8px;
}

.timeline div {
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  background: var(--panel-2);
}

.modal {
  align-items: center;
  justify-content: center;
}

.modal form {
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 50px);
  min-height: 0;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal form.confirm-modal-form {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.modal form.confirm-modal-form #modalBody {
  padding: 20px 22px;
  overflow: visible;
}

.confirm-action {
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.45;
}

.confirm-action p {
  margin: 0;
}

.confirm-action p + p {
  color: var(--muted);
  font-size: 13px;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) {
  width: min(500px, calc(100vw - 32px));
  border-radius: 4px;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) header {
  min-height: 70px;
  padding: 16px 22px;
  background: #fff;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) header h2 {
  color: #f59e0b;
  font-size: 23px;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) #modalBody {
  padding: 12px 22px 14px;
  font-size: 14px;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) footer {
  min-height: 58px;
  padding: 10px 22px 16px;
  border-top: 0;
  background: #fff;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) footer button {
  min-width: 68px;
  min-height: 34px;
  border-radius: 3px;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) footer .secondary {
  border-color: #1f2937;
  background: #1f2937;
  color: #fff;
}

.modal form.confirm-modal-form:has(.settlement-change-warning) footer .primary {
  border-color: #f59e0b;
  background: #f59e0b;
  color: #fff;
}

.modal footer button[type="submit"].disabled,
.modal footer button[type="submit"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.field.field-missing input,
.field.field-missing select,
.field.field-missing textarea {
  border-color: #d5483f;
  box-shadow: 0 0 0 3px rgba(213, 72, 63, .14);
  background: color-mix(in srgb, var(--red) 6%, var(--panel));
}

.field.field-missing {
  color: #b63b34;
}

.searchable-field input[data-searchable-input] {
  padding-right: 30px;
}

.searchable-field {
  position: relative;
}

#modalBody {
  min-height: 0;
  position: relative;
  z-index: 1;
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 12px;
}

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

.primary.small,
.secondary.small {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 12px;
}

.stop-section {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
}

.stop-section h3 {
  margin: 0 0 12px;
}

.stop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}@media (max-width: 1200px) {
  .form-grid,
  .stop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}
@media (max-width: 760px) {
  .form-grid,
  .stop-grid {
    grid-template-columns: 1fr;
  }

  .table-pager {
    align-items: stretch;
    flex-direction: column;
  }

  .table-pager .pager-size {
    margin-left: 0;
  }

}

label.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  position: relative;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--field-h);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.field textarea { min-height: 88px; resize: vertical; }
.field.full { grid-column: 1 / -1; }

.settlement-line-header {
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.settlement-line-filters {
  display: grid;
  grid-template-columns: 135px 135px minmax(190px, 250px) auto auto;
  align-items: end;
  gap: 8px;
  margin-left: auto;
  max-width: 760px;
}

.settlement-line-filters .primary {
  min-height: var(--field-h);
  white-space: nowrap;
}

.table-sort-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
}

.table-sort-button.active {
  color: var(--accent);
}

@media (max-width: 760px) {
  .settlement-line-header {
    align-items: stretch;
    flex-direction: column;
  }

  .settlement-line-filters {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
}

.input-affix {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--field-h);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.input-affix:focus-within {
  border-color: color-mix(in srgb, var(--accent) 78%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent);
}

.input-affix-mark {
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-weight: 700;
}

.input-affix-mark.suffix {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.input-action .secondary {
  min-height: 38px;
}

.miles-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-transform: none;
}

.zip-suggestions {
  position: absolute;
  left: 0;
  top: calc(100% + 2px);
  z-index: 12;
  width: min(280px, 100%);
  border: 1px solid #8fc9f8;
  background: var(--panel);
  border-radius: 3px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 6px 16px rgba(21, 45, 70, .14);
}

.zip-suggestions button {
  display: block;
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  text-transform: none;
}

.zip-suggestions button + button {
  border-top: 1px solid rgba(255, 255, 255, .35);
}

.zip-suggestions button:hover {
  background: color-mix(in srgb, var(--accent) 84%, #000);
}

.checkbox-field {
  min-height: 38px;
  display: flex !important;
  align-items: center;
  gap: 9px;
  color: var(--text) !important;
  text-transform: none !important;
  font-size: 14px !important;
  white-space: nowrap;
}

.checkbox-field input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.tabs-row {
  display: flex;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.tabs-row button {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.tabs-row button.active {
  color: var(--accent);
  background: var(--panel);
  border-top: 2px solid var(--accent);
}

.info-strip {
  border: 1px solid #9d78c9;
  background: #fbf4ff;
  color: #40505d;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.scheduled-editor {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, .8fr);
  gap: 24px;
}

.scheduled-full {
  display: grid;
  grid-template-columns: minmax(560px, 1.1fr) minmax(420px, .8fr);
  gap: 54px;
}

.radio-row.stacked {
  display: grid;
  gap: 8px;
}

.preview-text {
  margin-top: 16px;
  color: #40505d;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
}

.danger-link {
  border: 0;
  background: transparent;
  color: #d83b4a;
  padding: 0;
  font-weight: 700;
}

.row-actions {
  width: 150px;
  text-align: right;
  white-space: nowrap;
}

.row-actions button + button {
  margin-left: 12px;
}

.icon-action {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--accent);
  padding: 0;
  vertical-align: middle;
  cursor: pointer;
}

.icon-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action:hover {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: var(--accent-soft);
}

.icon-action.delete {
  color: var(--red);
}

.icon-action.delete:hover {
  border-color: color-mix(in srgb, var(--red) 40%, var(--line));
  background: color-mix(in srgb, var(--red) 9%, var(--panel));
}

/* Settlement payments use direct edit/delete icons without a framed button or action menu. */
.table-wrap td.settlement-payment-inline-actions .icon-action {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
}

.table-wrap td.settlement-payment-inline-actions .icon-action svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.35;
}

.table-wrap td.settlement-payment-inline-actions .icon-action:hover {
  border: 0 !important;
  background: var(--accent-soft) !important;
}

.table-wrap td.settlement-payment-inline-actions .icon-action.delete:hover {
  background: color-mix(in srgb, var(--red) 9%, transparent) !important;
}

.icon-action:disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.radio-row input {
  accent-color: var(--accent);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40000;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 260px;
  max-width: 420px;
  padding: 16px 16px 16px 18px;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  background: #17242f;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
  font-weight: 600;
  line-height: 1.35;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.toast-message {
  flex: 1;
}

.toast-close {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: grid;
  place-items: center;
  border: 2px solid #1596a3;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  appearance: none;
}

.toast-close:hover {
  border-color: #22c7d6;
  background: rgba(34, 199, 214, 0.12);
}

.toast-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 199, 214, 0.22);
}

.toast.error {
  border-left-color: #d5483f;
}

.toast.success {
  border-left-color: var(--accent);
}@media (max-width: 1120px) {
  .app-shell,
  body[data-sidebar-collapsed="true"] .app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .nav-item b { display: none; }
  .brand { width: 132px; }
  .brand strong { font-size: 15px; }
  .nav-item { grid-template-columns: 1fr; place-items: center; padding: 0; }
  .nav-item i,
  .nav-icon { margin-right: 0; }
  .nav-icon svg { width: 22px; height: 22px; }
  .nav-item small { display: none; }
  .subnav { display: none; }
  .table-pager { flex-wrap: wrap; }
  .table-pager .pager-size {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }
  .pagebar { align-items: flex-start; flex-direction: column; }
  .kpis { grid-template-columns: repeat(2, minmax(160px, 1fr)); }

}

.app-busy-indicator {
  position: fixed;
  z-index: 10050;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease, visibility 120ms ease;
}

.app-busy-indicator.show {
  opacity: 1;
  visibility: visible;
}

.app-busy-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(15, 143, 106, 0.2);
  border-top-color: var(--primary, #0f8f6a);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.16);
  animation: app-busy-spin 0.75s linear infinite;
}

@keyframes app-busy-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .app-busy-spinner { animation-duration: 1.5s; }
}

.account-sub-toggle {
  align-items: center;
  display: flex;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  cursor: pointer;
}

.account-sub-toggle input {
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.account-sub-toggle > span {
  display: grid;
  gap: 3px;
}

.account-sub-toggle small {
  color: var(--muted);
  font-size: 11px;
}

.account-parent-control {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.account-parent-field {
  display: block;
  width: 100%;
}

.account-tree-indent {
  display: inline-block;
  width: 18px;
}

.link-button {
  appearance: none;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

/* VirtuTMS professional form system */
:root {
  --input-bg: #fbfcff;
  --input-bg-hover: #ffffff;
  --input-border: #cfd9e7;
  --input-border-strong: #aebcd0;
  --input-label: #4b5d75;
  --input-placeholder: #95a3b7;
  --input-focus: #3157c8;
  --input-radius: 12px;
}

body[data-theme="dark"],
body[data-theme="auto"] {
  --input-bg: #121b2d;
  --input-bg-hover: #172238;
  --input-border: #35445d;
  --input-border-strong: #4c5f7c;
  --input-label: #bac6d8;
  --input-placeholder: #718198;
}

.modal form,
.drawer article {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(11, 19, 36, .24);
}

.modal header,
.drawer header {
  min-height: 62px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(49, 87, 200, .045), transparent),
    var(--panel);
}

.modal footer,
.drawer footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

#modalBody,
#drawerBody {
  padding: 20px;
}

.input-affix {
  overflow: hidden;
}

.input-affix-mark {
  min-width: 36px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
  color: var(--accent);
}

.field.field-missing input,
.field.field-missing select,
.field.field-missing textarea {
  border-color: color-mix(in srgb, var(--red) 70%, var(--input-border));
  border-left-color: var(--red);
  background: color-mix(in srgb, var(--red) 5%, var(--input-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 14%, transparent);
}

.login-card input {
  min-height: 44px;
  border-left: 4px solid color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 13px;
  background: var(--input-bg);
}

.login-card input:focus {
  outline: 0;
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  border-left-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* VirtuTMS compact professional refinement */
:root {
  --field-h: 32px;
  --row-h: 36px;
  --input-bg: #ffffff;
  --input-bg-hover: #ffffff;
  --input-border: #c9d4e2;
  --input-border-strong: #94a3b8;
  --input-label: #34445a;
  --input-radius: 7px;
}

body,
button,
input,
select,
textarea {
  font-size: 13px;
}

.pagebar {
  min-height: 58px;
  padding: 10px 28px;
  position: relative;
  z-index: 90;
}

.pagebar h1 {
  font-size: 22px;
}

.kpis {
  padding: 10px 28px 8px;
}

.kpi {
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 8px;
}

.kpi strong {
  margin-top: 5px;
  font-size: 20px;
}

.board {
  padding: 8px 28px 20px;
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 32px;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
}

.vendor-balances-title-tools { display:inline-flex; align-items:center; gap:6px; margin-left:12px; font-size:13px; vertical-align:middle; }
.vendor-balances-title-tools .checkbox-inline { margin-left:12px; }
.accounting-expense-title-tools { display:inline-flex; align-items:center; gap:6px; margin-left:12px; font-size:13px; vertical-align:middle; }
.accounting-payment-title-tools { display:inline-flex; align-items:center; gap:6px; margin-left:12px; font-size:13px; vertical-align:middle; }
.accounting-factoring-title-tools { display:inline-flex; align-items:center; gap:6px; margin-left:12px; font-size:13px; vertical-align:middle; }
.accounting-adjustments-title-tools { display:inline-flex; align-items:center; gap:6px; margin-left:12px; font-size:13px; vertical-align:middle; }

.primary {
  background: #087f92;
}

.primary:hover,
.primary:focus-visible {
  filter: none;
  background: #066f80;
}

.input-affix-mark {
  min-width: 31px;
  background: #eef6f8;
  color: #087f92;
}

.money-bar {
  height: 5px;
}

th,
td {
  height: 36px;
  padding: 7px 10px;
}

.table-wrap {
  border-radius: 8px;
}

.modal form {
  border-radius: 14px;
}

.modal header,
.drawer header {
  min-height: 54px;
  padding: 12px 20px;
}

.modal footer,
.drawer footer {
  padding: 10px 20px;
}

#modalBody,
#drawerBody {
  padding: 16px 20px;
}

/* Vue-inspired UI system */
:root {
  --vue-green: #42b883;
  --vue-green-dark: #33a06f;
  --vue-ink: #213547;
  --vue-slate: #35495e;
  --vue-bg: #f8fafc;
  --vue-soft: #f6f6f7;
  --vue-line: #e2e8f0;
  --vue-line-strong: #cbd5e1;
  --vue-muted: #64748b;
  --accent: var(--vue-green);
  --accent-soft: #ecfdf5;
  --bg: var(--vue-bg);
  --panel: #ffffff;
  --panel-2: var(--vue-soft);
  --line: var(--vue-line);
  --line-strong: var(--vue-line-strong);
  --text: var(--vue-ink);
  --ink: var(--vue-ink);
  --muted: var(--vue-muted);
  --sidebar-bg: #101827;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #a7b1c2;
  --header-bg: #ffffff;
  --header-text: var(--vue-ink);
  --header-muted: var(--vue-muted);
  --field-h: 30px;
  --row-h: 34px;
  --radius: 6px;
  --input-bg: #ffffff;
  --input-bg-hover: #ffffff;
  --input-border: #cbd5e1;
  --input-border-strong: #94a3b8;
  --input-label: #334155;
  --input-placeholder: #94a3b8;
  --input-focus: var(--vue-green);
  --input-radius: 6px;
  --shadow: none;
}

body {
  background: var(--vue-bg) !important;
  color: var(--vue-ink);
}

.app-shell {
  grid-template-columns: 264px minmax(820px, 1fr);
  grid-template-rows: 56px minmax(0, 1fr);
}

.app-header {
  border-bottom: 1px solid var(--vue-line);
  background: #ffffff;
  color: var(--vue-ink);
}

.brand-mark {
  border-radius: 8px;
  background: var(--vue-green);
}

.brand strong {
  color: var(--vue-ink);
  font-size: 18px;
}

.brand-copy > span,
.user-name {
  color: var(--vue-muted);
}

.sidebar-toggle {
  color: var(--vue-ink);
}

.sidebar-toggle:hover {
  background: var(--vue-soft);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-color: var(--vue-line);
  border-radius: 8px;
  background: var(--vue-soft);
  color: var(--vue-ink);
}

.user-avatar::before {
  display: none;
}

.app-header {
  position: relative;
  z-index: 9000;
  overflow: visible;
}

.user-menu {
  position: relative;
  z-index: 9010;
}

.user-menu-panel {
  top: calc(100% + 8px);
  right: 0;
  z-index: 9020;
  width: 218px;
  border-radius: 6px;
  border: 1px solid var(--vue-line);
  background: #ffffff;
  overflow: hidden;
}

.user-menu-head {
  display: none;
}

.user-menu-panel button {
  min-height: 39px;
  padding: 0 14px;
  border-bottom: 1px solid var(--vue-line);
  background: #ffffff;
  color: var(--vue-ink);
  font-weight: 500;
}

.user-menu-panel button:last-child {
  border-bottom: 0;
}

.user-menu-panel button:hover {
  background: var(--vue-soft);
  color: var(--vue-ink);
}

.nav-item {
  min-height: 39px;
  border-radius: 8px;
}

.nav-item:hover {
  background: rgba(66, 184, 131, .12);
  color: #ffffff;
}

.subnav button:hover,
.subnav button.active {
  background: rgba(66, 184, 131, .14);
  color: #ffffff;
}

.pagebar p {
  color: var(--vue-muted);
}

.secondary,
.ghost {
  background: #ffffff;
  border-color: var(--vue-line-strong);
  color: var(--vue-ink);
}

.secondary:hover,
.ghost:hover {
  background: var(--accent-soft);
  border-color: var(--vue-green);
  color: var(--vue-green-dark);
}

.input-affix-mark {
  min-width: 30px;
  background: #f0fdf4;
  color: var(--vue-green-dark);
}

.money-active {
  background: var(--vue-green);
}

.table-wrap {
  border-color: var(--vue-line);
  border-radius: 6px;
}

th {
  height: 32px;
  background: #f6f6f7;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
}

td {
  height: 34px;
}

tbody tr:hover,
.table-wrap table.has-actions-column tbody tr:hover td:last-child,
.table-wrap table tbody tr:hover td.actions,
.table-wrap table tbody tr:hover td.row-actions {
  background: #f0fdf4;
}

.chip {
  min-height: 21px;
  border-radius: 5px;
  padding: 2px 7px;
}

.chip.new,
.chip.available,
.chip.draft,
.chip.low,
.chip.delivered,
.chip.paid,
.chip.approved,
.chip.active,
.chip.hired,
.chip.complete,
.chip.resolved {
  color: #166534;
  background: #dcfce7;
}

.modal header,
.drawer header {
  min-height: 52px;
  padding: 12px 20px;
  background: #ffffff;
}

.modal footer,
.drawer footer {
  padding: 10px 20px;
  background: #f6f6f7;
}

.radio-row {
  gap: 12px;
  margin-bottom: 8px;
}

.radio-row label,
.checkbox-field {
  min-height: 24px;
  font-size: 13px !important;
}

label.field,
label[data-ui-field] {
  display: grid;
  gap: 3px;
  min-width: 0;
}

/* System-accent clean controls */
:root {
  --vue-green: var(--accent);
  --vue-green-dark: color-mix(in srgb, var(--accent) 84%, #111827);
  --vue-accent-soft: var(--accent-soft);
  --vue-bg: #f7f9fb;
  --vue-soft: #f3f6f8;
  --vue-panel: #ffffff;
  --vue-line: #dde5ee;
  --vue-line-strong: #c5d0dd;
  --vue-ink: #172233;
}

body[data-accent="teal"] {
  --green: #0f8a83;
  --green-2: #e7f6f4;
  --accent: #0f8a83;
  --accent-soft: #e7f6f4;
  --blue: #0f8a83;
}

body[data-accent="slate"] {
  --green: #435366;
  --green-2: #eef2f7;
  --accent: #435366;
  --accent-soft: #eef2f7;
  --blue: #435366;
}

body {
  background: #f5f7fa;
}

body,
.app-shell,
.board,
.modal form,
.drawer form {
  color: #172233;
}

.nav-item.active,
.nav-item[aria-current="page"],
.side-nav .active {
  background: color-mix(in srgb, var(--accent) 18%, #ffffff) !important;
  color: var(--accent) !important;
  box-shadow: inset 3px 0 0 var(--accent) !important;
}

tbody tr:hover,
.table-wrap table.has-actions-column tbody tr:hover td:last-child,
.table-wrap table tbody tr:hover td.actions,
.table-wrap table tbody tr:hover td.row-actions {
  background: color-mix(in srgb, var(--accent) 7%, #ffffff) !important;
}

input[type="date"],
input[type="time"] {
  color-scheme: light;
}

.checkbox-field,
.radio-row label,
.review-radio-row label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 22px !important;
  padding: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
}

select option {
  min-height: 25px;
  padding: 5px 10px;
  border-bottom: 1px solid #edf1f5;
  background: #ffffff;
  color: #263241;
}

select option:checked {
  background: var(--accent);
  color: #ffffff;
}

/* Consistent clickable combobox chevrons */
.native-searchable-select {
  position: relative;
}

.native-searchable-input {
  padding-right: 34px !important;
}

.native-searchable-toggle {
  position: absolute !important;
  top: 1px !important;
  right: 1px !important;
  bottom: 1px !important;
}

/* Professional login and password reset */
.login-screen {
  place-items: center !important;
  padding: 24px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 14% 82%, rgba(31,123,255,.24), transparent 31%),
    radial-gradient(circle at 88% 18%, rgba(32,208,112,.20), transparent 31%),
    linear-gradient(135deg, #03101f 0%, #07172b 45%, #05111f 100%) !important;
}

/* Subtle branded watermark / glow — login only */
.login-screen::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: 50%;
  right: -110px;
  width: min(720px, 60vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  background: url("icons/voci_tms_logo.png") center / contain no-repeat;
  opacity: .055;
  filter: saturate(.8);
  pointer-events: none;
}

.login-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -8%;
  bottom: -28%;
  width: min(820px, 70vw);
  height: min(520px, 52vw);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(28,221,119,.22), transparent 52%),
    repeating-radial-gradient(circle at 70% 45%, rgba(36,232,130,.35) 0 1px, transparent 1.6px 13px);
  opacity: .48;
  transform: rotate(-8deg);
  filter: blur(.2px);
  pointer-events: none;
}

.login-card {
  position: relative !important;
  width: min(500px, calc(100vw - 32px)) !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 15px !important;
  align-content: start !important;
  padding: 38px 42px 32px !important;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 24px !important;
  background:
    linear-gradient(180deg, rgba(15,29,53,.86), rgba(5,15,30,.88)) !important;
  color: #f7fbff !important;
  box-shadow:
    0 30px 90px rgba(0,0,0,.46),
    0 0 0 1px rgba(255,255,255,.025) inset,
    0 0 60px rgba(31,123,255,.07) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,.11), transparent 24%, transparent 72%, rgba(32,208,112,.08));
  opacity: .8;
}

.login-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 0 0 12px;
  text-align: left;
}

.login-head > div:last-child {
  min-width: 0;
}

.login-mark {
  flex: 0 0 auto;
  width: 58px !important;
  height: 58px !important;
  border: 0 !important;
  border-radius: 17px !important;
  background:
    url("icons/icon-192.png") center / contain no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  box-shadow: 0 10px 28px rgba(31,123,255,.16) !important;
}

.login-card h1 {
  margin: 0 !important;
  color: #ffffff !important;
  font-size: 29px !important;
  line-height: 1.08 !important;
  font-weight: 750 !important;
  letter-spacing: -.35px !important;
}

.login-card p {
  margin: 6px 0 0 !important;
  color: rgba(224,233,245,.68) !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
}

.login-card label {
  position: relative;
  z-index: 1;
  display: grid !important;
  gap: 8px !important;
  color: rgba(245,249,255,.90) !important;
  font-size: 12.5px !important;
  font-weight: 650 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.login-card input {
  width: 100%;
  height: 50px !important;
  min-height: 50px !important;
  padding: 0 15px !important;
  border: 1px solid rgba(181,201,226,.26) !important;
  border-left: 1px solid rgba(181,201,226,.26) !important;
  border-radius: 13px !important;
  outline: 0 !important;
  background: rgba(3,11,24,.48) !important;
  color: #f8fbff !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.018) !important;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.login-card input::placeholder {
  color: rgba(211,222,237,.38);
}

.login-card input:hover {
  border-color: rgba(181,201,226,.38) !important;
}

.login-card input:focus {
  border-color: rgba(47,137,255,.78) !important;
  border-left-color: rgba(47,137,255,.78) !important;
  outline: 0 !important;
  background: rgba(3,11,24,.60) !important;
  box-shadow:
    0 0 0 4px rgba(31,123,255,.12),
    inset 0 0 0 1px rgba(255,255,255,.025) !important;
}

.login-actions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 4px;
}

.login-reset-link,
.login-restore-link {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #38df82 !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.login-reset-link:hover,
.login-restore-link:hover {
  color: #69eea1 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-restore-link {
  justify-self: center;
  margin-top: -2px;
}

.login-reset-link:disabled,
.login-restore-link:disabled {
  color: rgba(220,230,242,.42) !important;
  cursor: wait;
}

button.login-submit,
.login-card button.login-submit {
  position: relative !important;
  z-index: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  margin: 2px 0 0 !important;
  padding: 0 48px 0 18px !important;
  border: 0 !important;
  border-radius: 13px !important;
  background: linear-gradient(135deg, #24d676 0%, #12b963 100%) !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  text-align: center !important;
  text-indent: 0 !important;
  overflow: hidden !important;
  transform: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  box-shadow: 0 15px 34px rgba(18,185,99,.22) !important;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

button.login-submit::after,
.login-card button.login-submit::after {
  content: "→";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: #12b963;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
}

button.login-submit:hover,
button.login-submit:focus-visible,
.login-card button.login-submit:hover,
.login-card button.login-submit:focus-visible {
  background: linear-gradient(135deg, #28dd7c 0%, #10ad5b 100%) !important;
  color: #ffffff !important;
  filter: none !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 20px 42px rgba(18,185,99,.28) !important;
}

.login-error {
  position: relative;
  z-index: 1;
  min-height: 18px !important;
  color: #ff8d83 !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

.login-error.success {
  color: #67e8a0 !important;
}

.login-error.session-ended {
  min-height: 0 !important;
  padding: 10px 12px;
  border: 1px solid rgba(255,141,131,.32);
  border-left: 4px solid #ff776a;
  border-radius: 9px;
  background: rgba(185,28,28,.13);
  color: #ffb2aa !important;
  line-height: 1.55;
  white-space: pre-line;
}

.login-footnote {
  position: relative;
  z-index: 1;
  margin: 4px 0 0 !important;
  padding-top: 15px;
  border-top: 1px solid rgba(255,255,255,.09);
  color: rgba(214,225,239,.55) !important;
  font-size: 11.5px !important;
  line-height: 1.5;
}

@media (max-width: 620px) {
  .login-screen {
    padding: 16px;
  }

  .login-screen::before {
    right: -190px;
    width: 620px;
    opacity: .04;
  }

  .login-card {
    width: min(100%, 460px) !important;
    padding: 28px 22px 24px !important;
    border-radius: 20px !important;
  }

  .login-head {
    justify-content: flex-start;
  }

  .login-mark {
    width: 52px !important;
    height: 52px !important;
  }

  .login-card h1 {
    font-size: 25px !important;
  }

  .login-card input {
    height: 48px !important;
    min-height: 48px !important;
  }
}

.internal-document-preview-layer {
  position: fixed;
  z-index: 38000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .38);
}

.internal-document-preview {
  width: min(1100px, 100%);
  height: min(820px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 10px;
  background: var(--panel, #fff);
  box-shadow: 0 28px 80px rgba(15, 23, 42, .38);
}

.internal-document-preview > header {
  min-height: 58px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line, #d9e1e8);
}

.internal-document-preview > header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.internal-document-preview > header a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  text-decoration: none;
}

.internal-document-preview > iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

@media (max-width: 640px) {
  .internal-document-preview-layer {
    padding: 8px;
  }

  .internal-document-preview {
    height: calc(100vh - 16px);
  }
}


/* Modal comboboxes: same clean single-border control used by Loads filters */
.modal .native-searchable-select {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: var(--field-h) !important;
  overflow: visible !important;
}

.modal .native-searchable-source {
  position: absolute !important;
  inset: 0 auto auto 0 !important;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  appearance: none !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.modal .native-searchable-select.open {
  z-index: 69999 !important;
}

.modal .native-searchable-input {
  width: 100% !important;
  height: var(--field-h) !important;
  min-height: var(--field-h) !important;
  padding: 0 32px 0 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  outline: 0 !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  box-shadow: none !important;
  font-weight: 600 !important;
  line-height: var(--field-h) !important;
}

.modal .native-searchable-input:hover,
.modal .native-searchable-input:focus {
  border-color: var(--brand) !important;
  outline: 1px solid var(--brand) !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

.modal .native-searchable-toggle {
  top: 1px !important;
  right: 1px !important;
  bottom: 1px !important;
  width: 30px !important;
  min-width: 30px !important;
  border: 0 !important;
  border-left: 0 !important;
  border-radius: 0 5px 5px 0 !important;
  background: var(--panel) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}

.modal .native-searchable-select.open .native-searchable-toggle {
  color: var(--brand) !important;
}

.modal .native-searchable-toggle::after {
  width: 8px !important;
  height: 8px !important;
  border-right-width: 1.8px !important;
  border-bottom-width: 1.8px !important;
}

.modal .native-searchable-select.open .native-searchable-menu {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 90000 !important;
  display: grid !important;
  overflow-y: auto !important;
  border: 1px solid var(--line) !important;
  border-radius: 4px !important;
  background: var(--panel) !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .12) !important;
}

.modal .native-searchable-menu button {
  min-height: 27px !important;
  padding: 5px 10px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

.modal .native-searchable-menu button:last-child {
  border-bottom: 0 !important;
}

.modal .native-searchable-menu button:hover,
.modal .native-searchable-menu button.selected {
  background: rgba(20, 148, 136, 0.12) !important;
  color: var(--brand-dark) !important;
}

.modal .field:has(.native-searchable-select.open) {
  z-index: 69998 !important;
}

/* Global flat button system: rectangular, clean, no shadows. */
button,
.btn,
[role="button"],
input[type="button"],
input[type="submit"],
input[type="reset"] {
  font-weight: 400 !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  background-image: none !important;
  letter-spacing: 0 !important;
  transform: none !important;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, opacity .12s ease !important;
}

button:hover,
.btn:hover,
[role="button"]:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  box-shadow: none !important;
  transform: none !important;
}

button:active,
.btn:active,
[role="button"]:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active {
  box-shadow: none !important;
  transform: none !important;
}

button:focus,
button:focus-visible,
.btn:focus,
.btn:focus-visible,
[role="button"]:focus,
[role="button"]:focus-visible,
input[type="button"]:focus,
input[type="button"]:focus-visible,
input[type="submit"]:focus,
input[type="submit"]:focus-visible,
input[type="reset"]:focus,
input[type="reset"]:focus-visible {
  box-shadow: none !important;
  outline: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line-strong)) !important;
  outline-offset: 1px !important;
}

/* Global overlay order: account menu stays above page toolbars, below drawers and modals. */
.app-shell > .app-header {
  z-index: 19000 !important;
  overflow: visible !important;
}

.app-header .user-menu {
  z-index: 19010 !important;
}

.app-header .user-menu-panel {
  z-index: 19020 !important;
}

/* Professional polish layer for shared data, form, and action controls. */
.table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap th,
.table-wrap td {
  padding: 10px 12px;
  vertical-align: middle;
  font-weight: 400;
}

.table-wrap th {
  font-weight: 700;
}

.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.table-wrap td:not(.actions):not(.row-actions),
.table-wrap th:not(.actions-col) {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap .empty-row td,
.table-wrap .empty-cell {
  height: 72px;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

.primary,
.secondary,
.danger,
.ghost,
.grid-link,
.link-button,
.table-pager button,
.pager-nav button,
.pager-size button,
.actions button,
.row-actions button,
td.actions button,
.icon-action,
.icon-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 32px;
  border-radius: 8px !important;
  box-shadow: none !important;
  background-image: none !important;
  line-height: 1.2;
  white-space: nowrap;
}

.primary,
.secondary,
.danger,
.ghost {
  font-weight: 600 !important;
}

.grid-link,
.link-button,
.actions button,
.row-actions button,
td.actions button,
.table-pager button {
  font-weight: 500 !important;
}

.icon-action,
.icon-button {
  width: 32px;
  min-width: 32px;
  padding: 0 !important;
}

.actions,
.row-actions,
td.actions {
  gap: 6px;
  white-space: nowrap;
}

.table-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
}

.table-pager b {
  font-weight: 400 !important;
}

/* Row action dropdowns must stay compact and vertical in every module. */
.table-wrap td.actions .grid-action-menu,
.table-wrap td.row-actions .grid-action-menu,
.table-wrap td.actions .equipment-action-menu,
.table-wrap td.row-actions .equipment-action-menu,
.load-action-menu {
  position: relative;
  display: inline-block !important;
  margin-inline: 2px !important;
  vertical-align: middle;
}

.table-wrap td.actions .grid-action-menu > div,
.table-wrap td.row-actions .grid-action-menu > div,
.table-wrap td.actions .equipment-action-menu > div,
.table-wrap td.row-actions .equipment-action-menu > div,
.load-action-menu > div {
  width: max-content !important;
  min-width: 150px !important;
  max-width: min(220px, calc(100vw - 24px)) !important;
  padding: 6px !important;
  overflow: hidden !important;
  border-radius: 8px !important;
}

.table-wrap td.actions .grid-action-menu > div button,
.table-wrap td.row-actions .grid-action-menu > div button,
.table-wrap td.actions .equipment-action-menu > div button,
.table-wrap td.row-actions .equipment-action-menu > div button,
.load-action-menu > div button {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 36px !important;
  justify-content: flex-start !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  text-align: left !important;
  white-space: nowrap !important;
}

.table-wrap td.actions .grid-action-menu > div button + button,
.table-wrap td.row-actions .grid-action-menu > div button + button,
.table-wrap td.actions .equipment-action-menu > div button + button,
.table-wrap td.row-actions .equipment-action-menu > div button + button,
.load-action-menu > div button + button {
  margin-top: 3px !important;
}

.table-wrap td.actions .grid-action-menu > div button:hover,
.table-wrap td.row-actions .grid-action-menu > div button:hover,
.table-wrap td.actions .equipment-action-menu > div button:hover,
.table-wrap td.row-actions .equipment-action-menu > div button:hover,
.load-action-menu > div button:hover {
  background: var(--panel-2) !important;
}

.table-wrap td.actions .grid-action-menu > div button.danger,
.table-wrap td.row-actions .grid-action-menu > div button.danger,
.table-wrap td.actions .equipment-action-menu > div button.danger,
.table-wrap td.row-actions .equipment-action-menu > div button.danger,
.load-action-menu > div button.danger {
  background: transparent !important;
  color: var(--red) !important;
}

.table-wrap td.actions .grid-action-menu > div button.danger:hover,
.table-wrap td.row-actions .grid-action-menu > div button.danger:hover,
.table-wrap td.actions .equipment-action-menu > div button.danger:hover,
.table-wrap td.row-actions .equipment-action-menu > div button.danger:hover,
.load-action-menu > div button.danger:hover {
  background: rgba(196, 57, 48, 0.08) !important;
  color: var(--red) !important;
}

.table-wrap td.actions .grid-action-menu > div button.danger:disabled,
.table-wrap td.row-actions .grid-action-menu > div button.danger:disabled,
.table-wrap td.actions .equipment-action-menu > div button.danger:disabled,
.table-wrap td.row-actions .equipment-action-menu > div button.danger:disabled,
.load-action-menu > div button.danger:disabled {
  background: var(--panel-2) !important;
  color: var(--muted) !important;
  opacity: .55 !important;
}

.table-wrap td.actions:has(.grid-action-menu[open]),
.table-wrap td.row-actions:has(.grid-action-menu[open]),
.table-wrap td.actions:has(.equipment-action-menu[open]),
.table-wrap td.row-actions:has(.equipment-action-menu[open]) {
  z-index: 160 !important;
  overflow: visible !important;
}

@media (max-width: 900px) {
  .table-panel,
  .standard-page-grid {
    max-width: 100%;
    min-width: 0;
  }

  .table-wrap {
    max-width: 100% !important;
  }

  .table-wrap table {
    min-width: 680px;
  }

  .table-wrap td:not(.actions):not(.row-actions),
  .table-wrap th:not(.actions-col) {
    max-width: 220px;
  }

  .table-pager {
    align-items: stretch;
    flex-direction: column;
  }

  .table-pager .pager-nav,
  .table-pager .pager-size {
    max-width: 100%;
    overflow-x: auto;
  }
}




/* ===== FINAL LOGIN OVERRIDE: protects login styling from later theme/module CSS ===== */
body.logged-out .login-screen {
  place-items: center !important;
  padding: 24px !important;
  overflow: hidden !important;
  isolation: isolate !important;
  background:
    radial-gradient(circle at 14% 82%, rgba(31,123,255,.24), transparent 31%),
    radial-gradient(circle at 88% 18%, rgba(32,208,112,.20), transparent 31%),
    linear-gradient(135deg, #03101f 0%, #07172b 45%, #05111f 100%) !important;
}

body.logged-out .login-screen .login-card {
  position: relative !important;
  width: min(500px, calc(100vw - 32px)) !important;
  display: grid !important;
  grid-template-columns: minmax(0,1fr) !important;
  gap: 15px !important;
  align-content: start !important;
  padding: 38px 42px 32px !important;
  overflow: hidden !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 24px !important;
  background:
    linear-gradient(180deg, rgba(15,29,53,.88), rgba(5,15,30,.92)) !important;
  color: #f7fbff !important;
  box-shadow:
    0 30px 90px rgba(0,0,0,.46),
    0 0 0 1px rgba(255,255,255,.025) inset,
    0 0 60px rgba(31,123,255,.07) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}

body.logged-out .login-screen .login-card::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  border-radius: inherit !important;
  pointer-events: none !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.11), transparent 24%, transparent 72%, rgba(32,208,112,.08)) !important;
  opacity: .8 !important;
}

body.logged-out .login-screen .login-head {
  position: relative !important;
  z-index: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 15px !important;
  margin: 0 0 12px !important;
}

body.logged-out .login-screen .login-mark {
  flex: 0 0 auto !important;
  width: 58px !important;
  height: 58px !important;
  border: 0 !important;
  border-radius: 17px !important;
  background: url("icons/icon-192.png") center / contain no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  box-shadow: 0 10px 28px rgba(31,123,255,.16) !important;
}

body.logged-out .login-screen .login-card h1 {
  margin: 0 !important;
  color: #fff !important;
  font-size: 29px !important;
  line-height: 1.08 !important;
  font-weight: 750 !important;
  letter-spacing: -.35px !important;
}

body.logged-out .login-screen .login-card p {
  margin: 6px 0 0 !important;
  color: rgba(224,233,245,.68) !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
}

body.logged-out .login-screen .login-card label {
  position: relative !important;
  z-index: 1 !important;
  display: grid !important;
  gap: 8px !important;
  color: rgba(245,249,255,.90) !important;
  font-size: 12.5px !important;
  font-weight: 650 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

body.logged-out .login-screen .login-card input {
  width: 100% !important;
  height: 50px !important;
  min-height: 50px !important;
  padding: 0 15px !important;
  border: 1px solid rgba(181,201,226,.26) !important;
  border-radius: 13px !important;
  outline: 0 !important;
  background: rgba(3,11,24,.48) !important;
  color: #f8fbff !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.018) !important;
}

body.logged-out .login-screen .login-card input::placeholder {
  color: #aabbd0 !important;
  -webkit-text-fill-color: #aabbd0 !important;
  opacity: 1 !important;
}

/* Login stays dark independently of the signed-in application's theme. */
body.logged-out .login-screen .login-card input {
  color: #f8fbff !important;
  -webkit-text-fill-color: #f8fbff !important;
  caret-color: #f8fbff !important;
  color-scheme: dark;
}

body.logged-out .login-screen .login-card input:autofill,
body.logged-out .login-screen .login-card input:-webkit-autofill {
  color: #f8fbff !important;
  -webkit-text-fill-color: #f8fbff !important;
  caret-color: #f8fbff !important;
  background-color: #081426 !important;
  box-shadow: inset 0 0 0 1000px #081426 !important;
}

body.logged-out .login-screen .login-card input:focus {
  border-color: rgba(47,137,255,.78) !important;
  outline: 0 !important;
  background: rgba(3,11,24,.60) !important;
  box-shadow:
    0 0 0 4px rgba(31,123,255,.12),
    inset 0 0 0 1px rgba(255,255,255,.025) !important;
}

body.logged-out .login-screen .login-actions {
  position: relative !important;
  z-index: 1 !important;
  display: flex !important;
  justify-content: flex-end !important;
  margin: -2px 0 4px !important;
}

body.logged-out .login-screen .login-reset-link,
body.logged-out .login-screen .login-restore-link {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #38df82 !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

body.logged-out .login-screen button.login-submit,
body.logged-out .login-screen .login-card button.login-submit {
  position: relative !important;
  z-index: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  margin: 2px 0 0 !important;
  padding: 0 48px 0 18px !important;
  border: 0 !important;
  border-radius: 13px !important;
  background: linear-gradient(135deg, #24d676 0%, #12b963 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  box-shadow: 0 15px 34px rgba(18,185,99,.22) !important;
}

body.logged-out .login-screen button.login-submit::after,
body.logged-out .login-screen .login-card button.login-submit::after {
  content: "→" !important;
  position: absolute !important;
  right: 11px !important;
  top: 50% !important;
  width: 31px !important;
  height: 31px !important;
  display: grid !important;
  place-items: center !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.94) !important;
  color: #12b963 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
}

body.logged-out .login-screen .login-footnote {
  position: relative !important;
  z-index: 1 !important;
  margin: 4px 0 0 !important;
  padding-top: 15px !important;
  border-top: 1px solid rgba(255,255,255,.09) !important;
  color: rgba(214,225,239,.55) !important;
  font-size: 11.5px !important;
  line-height: 1.5 !important;
}

@media (max-width: 620px) {
  body.logged-out .login-screen .login-card {
    width: min(100%, 460px) !important;
    padding: 28px 22px 24px !important;
    border-radius: 20px !important;
  }

  body.logged-out .login-screen .login-head {
    justify-content: flex-start !important;
  }

  body.logged-out .login-screen .login-mark {
    width: 52px !important;
    height: 52px !important;
  }

  body.logged-out .login-screen .login-card h1 {
    font-size: 25px !important;
  }
}
/* PWA install/update surfaces shared by the desktop application. */
.pwa-update-notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid #b9dace;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .2);
  color: #142033;
}
.pwa-update-notice[hidden] { display: none !important; }
.pwa-update-notice span { display: grid; gap: 2px; }
.pwa-update-notice small { color: #5b6879; }
.pwa-dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .5);
}
.pwa-dialog {
  width: min(440px, 100%);
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
}
.pwa-dialog header,.pwa-dialog footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.pwa-dialog header { border-bottom: 1px solid #dbe3ec; }
.pwa-dialog footer { justify-content: flex-end; border-top: 1px solid #dbe3ec; }
.pwa-dialog h2,.pwa-dialog p { margin: 0; }
.pwa-dialog > div { display: grid; gap: 10px; padding: 18px; }

/* Keep column labels visible in every scrollable application table. */
@media screen {
  :is(.table-wrap, .table-scroll) {
    position: relative;
  }

  .board > .table-panel {
    min-height: 0;
    overflow: hidden;
  }

  .board > .table-panel > .table-wrap {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: auto !important;
    overflow-y: auto !important;
  }

  :is(#modalBody, #drawerBody) :is(.table-wrap, .table-scroll) {
    max-height: none;
    overflow: visible !important;
  }

  :is(.table-wrap, .table-scroll) table > thead > tr > th {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    border-bottom: 1px solid var(--line-strong, var(--line)) !important;
    background: var(--panel-2, #f8fafd) !important;
    color: var(--muted) !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .05);
  }

  :is(.table-wrap, .table-scroll) table > thead > tr > th.actions-col,
  :is(.table-wrap, .table-scroll) table > thead > tr > th:last-child {
    z-index: 31 !important;
  }

  /* Main grids fill the space above a compact pager, matching the Loads page. */
  #board.board {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .board > .table-panel.standard-page-grid {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto;
    flex: 1 1 0% !important;
    align-self: stretch;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .board > .table-panel.standard-page-grid > .table-wrap {
    width: 100%;
    height: 100%;
    min-height: 0 !important;
  }

  .board > .table-panel.standard-page-grid > .table-pager {
    flex: 0 0 auto !important;
    align-items: center !important;
    padding: 14px 4px 2px !important;
  }

  .board > .table-panel.standard-page-grid > .table-wrap tbody > tr > td {
    vertical-align: middle !important;
  }

  /* Compact, shared pagination treatment for every paginated grid. */
  .table-pager {
    gap: 10px !important;
    border-top: 0 !important;
    color: var(--muted) !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1.2;
  }

  .table-pager > span,
  .table-pager .pager-size > span,
  .table-pager .pager-size > b {
    color: var(--muted) !important;
    font-size: 11px !important;
    font-weight: 400 !important;
  }

  .table-pager .pager-nav,
  .table-pager .pager-size {
    gap: 4px !important;
  }

  .table-pager button,
  .table-pager .pager-nav button,
  .table-pager .pager-size button {
    width: auto !important;
    min-width: 27px !important;
    height: 27px !important;
    min-height: 27px !important;
    padding: 0 7px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
  }

  .table-pager button.active,
  .table-pager .pager-nav button.active,
  .table-pager .pager-size button.active {
    border-color: var(--accent) !important;
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
  }

  .table-pager .pager-ellipsis {
    min-width: 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }
  

