:root {
  --ink: #e9eff7;
  --muted: #8a98ab;
  --line: #23303f;
  --page: #0a0f17;
  --panel: #121a26;
  --surface: #18212e;
  --navy: #0d1420;
  --blue: #0b84ff;
  --blue-strong: #2f97ff;
  --green: #25c069;
  --soft-blue: #16273c;
  --warn: #e0a72a;
  --danger: #ff6b5e;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(11, 132, 255, 0.08), transparent 60%),
    var(--page);
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

.boot-error {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #fff5f3;
}

.boot-error > div {
  width: min(680px, 100%);
  padding: 24px;
  border: 1px solid #ffd0cc;
  border-radius: 8px;
  background: var(--panel);
}

.boot-error span {
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.boot-error p {
  margin-top: 12px;
  color: var(--danger);
  overflow-wrap: anywhere;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #19324f 0%, #244766 100%);
}

.tracking-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--soft-blue);
}

.tracking-card {
  display: grid;
  width: min(520px, 100%);
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(25, 50, 79, 0.14);
}

.tracking-card > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tracking-status,
.tracking-coordinates {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tracking-actions {
  display: flex;
  gap: 10px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.register-card {
  width: min(480px, 100%);
}

.login-card > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h1 {
  font-size: 34px;
}

.login-card input {
  height: 46px;
}

.login-card button {
  height: 46px;
  font-size: 18px;
}

.login-card strong {
  min-height: 20px;
  color: var(--danger);
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 18px;
  color: #fff;
  background: var(--navy);
}

.brand {
  padding: 8px 4px 24px;
}

.brand span {
  display: block;
  color: #b9d7f5;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

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

.nav-btn {
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #eaf2ff;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  cursor: pointer;
}

.nav-btn.active {
  color: var(--navy);
  background: var(--panel);
}

.workspace {
  padding: 18px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
}

.topbar p,
.settings-panel p {
  margin-top: 5px;
  color: var(--muted);
}

.connection {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
}

body:not(.owner-mode) .owner-only {
  display: none !important;
}

body.dispatcher-mode .nav-btn:not([data-view="dispatcher"]):not([data-view="tracking"]) {
  display: none !important;
}

body.personal-mode .nav-btn:not([data-view="dashboard"]):not([data-view="tracking"]),
body.personal-mode #addWeekForDriver,
body.personal-mode #addOwnerBtn,
body.personal-mode #addCompanyBtn,
body.personal-mode .dispatcher-tools button,
body.personal-mode .topbar .order-search {
  display: none !important;
}

.readonly-driver-access {
  align-items: center;
  min-height: 48px;
}

.readonly-driver-access strong {
  font-size: 17px;
}

.readonly-driver-access span {
  color: var(--muted);
}

.driver-app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 16px 0;
  padding: 12px;
  border: 1px solid #cfe1ff;
  border-radius: 8px;
  background: var(--surface);
}

.driver-app-toolbar strong,
.driver-app-toolbar span {
  display: block;
}

.driver-app-toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.order-search {
  width: 250px;
  color: var(--muted);
  font-size: 12px;
}

.order-search input {
  height: 36px;
  margin-top: 4px;
  border-radius: 999px;
}

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

.status-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin: -6px 0 16px;
}

.status-metrics div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-metrics span {
  color: var(--muted);
  font-size: 13px;
}

.status-metrics strong {
  font-size: 18px;
}

.platform-grid {
  display: grid;
  gap: 14px;
}

.platform-card {
  padding: 18px;
}

.platform-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.platform-status-card,
.role-card,
.roadmap-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.platform-status-card {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.platform-status-card span,
.role-card span {
  color: var(--muted);
  font-weight: 800;
}

.platform-status-card strong {
  font-size: 28px;
}

.platform-status-card.ok {
  border-color: #c8ead5;
  background: #f3fbf6;
}

.platform-status-card.warn {
  border-color: #ffe7aa;
  background: #fffaf0;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.role-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.role-card strong {
  font-size: 18px;
}

.module-roadmap {
  display: grid;
  gap: 8px;
}

.roadmap-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.roadmap-item > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  background: var(--navy);
}

.roadmap-item div {
  display: grid;
  gap: 3px;
}

.audit-log {
  display: grid;
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.audit-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-row div {
  display: grid;
  gap: 3px;
}

.audit-row span,
.audit-row small {
  color: var(--muted);
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 15px 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.panel {
  overflow: hidden;
}

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

.panel-head.compact {
  padding: 12px 0;
  background: transparent;
  border-bottom: 0;
}

.driver-list {
  max-height: calc(100vh - 245px);
  overflow: auto;
}

.driver-search {
  width: 190px;
  height: 38px;
  margin-top: 0;
  font-size: 15px;
}

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

.driver-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
}

.driver-item.active {
  background: var(--soft-blue);
}

.driver-item strong,
.driver-item span {
  display: block;
}

.driver-item span,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--navy);
  background: var(--soft-blue);
  font-size: 12px;
  font-weight: 700;
}

.badge.status-pause,
.badge.status-paused {
  color: #7a4b00;
  background: #fff0cc;
}

.badge.status-inactive {
  color: #7a1d18;
  background: #ffe2df;
}

.driver-card {
  padding: 14px;
  max-height: calc(100vh - 245px);
  overflow: auto;
}

.week-card {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.week-head {
  display: grid;
  grid-template-columns: 1fr repeat(4, auto);
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.week-head strong {
  display: block;
}

.week-head span {
  color: var(--muted);
  font-size: 13px;
}

.dispatcher-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.dispatcher-tools input,
.dispatcher-tools select {
  margin-top: 4px;
}

.loads-list {
  padding: 10px 12px 12px;
}

.week-browser {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 260px;
}

.week-picker {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 365px);
  min-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.week-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
}

.week-option span {
  color: var(--muted);
  font-size: 13px;
}

.week-option strong {
  font-size: 14px;
}

.week-option.active {
  border-color: #9ec5f3;
  background: var(--soft-blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.week-detail {
  min-width: 0;
}

.week-preview {
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.week-preview strong {
  display: block;
  font-size: 20px;
}

.week-preview span {
  display: block;
  margin-top: 6px;
  color: var(--blue);
  font-size: 16px;
  font-weight: 700;
}

.week-preview .preview-dispatcher {
  color: var(--ink);
  font-size: 14px;
}

.week-preview p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.week-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: 14px;
}

.week-preview-grid div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dde8f5;
  border-radius: 7px;
  background: var(--surface);
}

.week-preview-grid div span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.week-preview-grid div strong {
  margin: 0;
  font-size: 17px;
  text-align: right;
}

.preview-loads {
  max-height: 360px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.preview-loads table {
  min-width: 920px;
  font-size: 13px;
}

.preview-loads th,
.preview-loads td {
  padding: 7px 8px;
}

.edit-week-btn {
  margin-top: 12px;
}

.week-preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.week-preview-actions .edit-week-btn {
  margin-top: 0;
}

.screenshot-card {
  margin-bottom: 0;
}

.detail-head {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
}

.week-title-block strong {
  font-size: 22px;
}

.week-title-block .dispatcher-name {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.week-summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 8px;
}

.week-summary-strip div {
  min-height: 52px;
  padding: 7px 9px;
  border: 1px solid #dde8f5;
  border-radius: 6px;
  background: var(--panel);
}

.week-summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.week-summary-strip strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 17px;
}

.week-summary-strip .primary-stat {
  border-color: #a9cdf5;
  background: var(--soft-blue);
}

.week-summary-strip .primary-stat strong {
  font-size: 21px;
}

.week-summary-strip .deduction-stat {
  border-color: #f0c5c5;
  background: #fff6f6;
}

.week-summary-strip .deduction-stat strong {
  color: #b3261e;
}

.week-summary-strip .payout-stat {
  border-color: #b9dcbc;
  background: #f2fbf3;
}

.week-summary-strip .payout-stat strong {
  color: #176c2f;
}

.loads-screen-table table {
  min-width: 1180px;
}

.loads-screen-table th,
.loads-screen-table td {
  white-space: normal;
  vertical-align: top;
}

.loads-screen-table th:nth-child(1),
.loads-screen-table th:nth-child(2),
.loads-screen-table td:nth-child(1),
.loads-screen-table td:nth-child(2) {
  width: 64px;
  white-space: nowrap;
}

.loads-screen-table th:nth-child(6),
.loads-screen-table th:nth-child(7),
.loads-screen-table td:nth-child(6),
.loads-screen-table td:nth-child(7) {
  width: 105px;
  white-space: nowrap;
}

.empty-week {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
}

.week-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 18px;
  background: rgba(10, 20, 32, 0.58);
}

.driver-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 20, 32, 0.58);
}

.driver-modal-window {
  width: min(760px, 100%);
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.driver-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  color: #fff;
  background: var(--navy);
}

.driver-modal-top span {
  display: block;
  color: #b9d7f5;
  font-size: 13px;
}

.driver-modal-top strong {
  display: block;
  margin-top: 2px;
  font-size: 23px;
}

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

.driver-modal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

.week-modal-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1680px, 100%);
  height: calc(100vh - 36px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.week-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  color: #fff;
  background: var(--navy);
}

.week-modal-top span {
  display: block;
  color: #b9d7f5;
  font-size: 13px;
}

.week-modal-top strong {
  display: block;
  margin-top: 2px;
  font-size: 24px;
}

.week-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.match-nav span {
  min-width: 42px;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.match-nav .secondary {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.week-modal-actions .edit-week-btn {
  margin-top: 0;
}

.week-modal .screenshot-card {
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.week-modal .loads-screen-table {
  overflow-x: auto;
}

.week-modal .loads-screen-table table {
  min-width: 0;
  table-layout: fixed;
}

.week-modal .loads-screen-table th,
.week-modal .loads-screen-table td {
  height: auto;
  min-height: 34px;
  padding: 7px 8px;
  font-size: 13px;
  line-height: 1.25;
}

.week-modal .loads-screen-table th:nth-child(1),
.week-modal .loads-screen-table td:nth-child(1),
.week-modal .loads-screen-table th:nth-child(2),
.week-modal .loads-screen-table td:nth-child(2) {
  width: 62px;
}

.week-modal .loads-screen-table th:nth-child(3),
.week-modal .loads-screen-table td:nth-child(3) {
  width: 19%;
}

.week-modal .loads-screen-table th:nth-child(4),
.week-modal .loads-screen-table td:nth-child(4) {
  width: 17%;
}

.week-modal .loads-screen-table th:nth-child(5),
.week-modal .loads-screen-table td:nth-child(5) {
  width: 15%;
}

.inline-order-input {
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}

.week-modal .loads-screen-table th:nth-child(6),
.week-modal .loads-screen-table td:nth-child(6),
.week-modal .loads-screen-table th:nth-child(7),
.week-modal .loads-screen-table td:nth-child(7) {
  width: 92px;
}

.week-modal .loads-screen-table th:nth-child(8),
.week-modal .loads-screen-table td:nth-child(8),
.week-modal .loads-screen-table th:nth-child(9),
.week-modal .loads-screen-table td:nth-child(9) {
  width: 86px;
}

.week-modal .loads-screen-table th:nth-child(10),
.week-modal .loads-screen-table td:nth-child(10) {
  width: 9%;
}

.week-modal .loads-screen-table th:nth-child(11),
.week-modal .loads-screen-table td:nth-child(11) {
  width: 92px;
}

.week-modal .loads-screen-table th:nth-child(12),
.week-modal .loads-screen-table td:nth-child(12) {
  width: 108px;
}

.week-modal .matched-load td {
  background: #fff6d8;
  box-shadow: inset 0 2px 0 #f0b429, inset 0 -2px 0 #f0b429;
}

.compact-btn {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
  white-space: nowrap;
}

.load-status-select {
  min-width: 112px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
}

.load-status-row,
.dispatcher-status-summary strong {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.load-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #243247;
  background: #e9eef6;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.load-status-pill.status-picked_up {
  color: #164d73;
  background: var(--soft-blue);
}

.load-status-pill.status-delivered {
  color: #176c2f;
  background: #dff7e4;
}

.load-status-pill.status-invoiced {
  color: #5d3b00;
  background: #fff1c7;
}

.load-status-pill.status-paid {
  color: #0f6b57;
  background: #d9f7ee;
}

.load-status-pill.status-issue {
  color: #9f1d14;
  background: #ffe1df;
}

.receipt-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 104px;
}

.receipt-cell span,
.receipt-status {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.receipt-cell .compact-btn,
td > .editor-receipt-btn {
  width: 100%;
  justify-content: center;
}

.loads-table th:nth-child(11),
.loads-table td:nth-child(11) {
  min-width: 122px;
}

.loads-table th:nth-child(12),
.loads-table td:nth-child(12) {
  min-width: 118px;
  vertical-align: top;
}

.driver-load-actions {
  display: grid;
  gap: 5px;
  min-width: 112px;
  margin-top: 6px;
}

.driver-load-actions .compact-btn {
  width: 100%;
  justify-content: center;
}

.driver-status-btn.active {
  border-color: #9ec5fe;
  color: var(--navy);
  background: var(--soft-blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.receipt-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.receipt-window {
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.receipt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--nav);
  color: #fff;
}

.receipt-top span {
  display: block;
  color: #bfd3ef;
  font-weight: 700;
}

.receipt-top strong {
  display: block;
  font-size: 28px;
}

.receipt-load-summary,
.receipt-print-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 22px;
}

.receipt-load-summary div,
.receipt-print-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}

.receipt-load-summary span,
.receipt-print-grid span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.receipt-load-summary strong,
.receipt-print-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.receipt-upload-grid,
.receipt-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 22px 16px;
}

.receipt-upload-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.receipt-image,
.receipt-empty {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
}

.receipt-image figcaption {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.receipt-image img {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  background: var(--panel);
}

.receipt-empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.receipt-notes {
  display: grid;
  gap: 8px;
  padding: 0 22px 16px;
  color: var(--muted);
  font-weight: 800;
}

.receipt-actions {
  display: flex;
  gap: 10px;
  padding: 0 22px 18px;
}

.receipt-status-line {
  min-height: 24px;
  padding: 0 22px 18px;
  color: var(--muted);
  font-weight: 700;
}

.receipt-print-shell {
  display: none;
}

.receipt-print {
  background: var(--panel);
  color: #111827;
}

.receipt-print-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  background: var(--nav);
  color: #fff;
}

.receipt-print-head span {
  display: block;
  color: #bfd3ef;
  font-weight: 800;
}

.receipt-print-head strong {
  display: block;
  font-size: 26px;
}

.receipt-print-notes {
  margin: 0 22px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
}

@media print {
  @page {
    size: landscape;
    margin: 0.12in;
  }

  html,
  body {
    width: 100%;
    min-height: 0;
    background: var(--panel);
  }

  body.printing-week > *:not(.week-modal),
  body.printing-receipt > *:not(.receipt-print-shell),
  body:not(.printing-week):not(.printing-receipt) > *:not(.week-modal) {
    display: none !important;
  }

  body.printing-receipt .receipt-print-shell {
    display: block !important;
  }

  .week-modal {
    position: static;
    inset: auto;
    display: block;
    padding: 0;
    background: var(--panel);
    overflow: hidden;
  }

  .week-modal-window {
    display: block;
    width: 100%;
    height: auto;
    max-height: 7.2in;
    margin: 0;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
    zoom: var(--week-print-zoom, 0.92);
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .week-modal-top {
    padding: 4px 7px;
    color: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-after: avoid;
    page-break-after: avoid;
  }

  .week-modal-top strong {
    font-size: 15px;
  }

  .week-modal-top span {
    font-size: 8px;
  }

  .week-modal-actions,
  .match-nav,
  .week-modal .compact-btn {
    display: none;
  }

  .week-modal .detail-head {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 5px;
    padding: 4px;
    break-after: avoid;
    page-break-after: avoid;
  }

  .week-modal .week-title-block strong {
    font-size: 15px;
  }

  .week-modal .week-title-block span,
  .week-modal .week-title-block .dispatcher-name {
    margin-top: 3px;
    font-size: 8px;
    line-height: 1.08;
  }

  .week-modal .week-summary-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
  }

  .week-modal .week-summary-strip div {
    min-height: 25px;
    padding: 2px 4px;
    border-radius: 3px;
  }

  .week-modal .week-summary-strip span {
    font-size: 6.5px;
    line-height: 1;
  }

  .week-modal .week-summary-strip strong {
    margin-top: 1px;
    font-size: 9px;
    line-height: 1.05;
  }

  .week-modal .week-summary-strip .primary-stat strong {
    font-size: 10px;
  }

  .week-modal .screenshot-card,
  .week-modal .loads-screen-table {
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .week-modal .loads-screen-table table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .week-modal .loads-screen-table th,
  .week-modal .loads-screen-table td {
    min-height: 0;
    padding: 1px 2px;
    font-size: var(--week-print-font, 7.6px);
    line-height: 1.03;
    border-width: 0.5px;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow-wrap: anywhere;
  }

  .inline-order-input {
    height: auto;
    margin: 0;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 700;
  }

  .receipt-print-shell {
    width: 100%;
  }

  .receipt-print-head {
    padding: 8px 10px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .receipt-print-head strong {
    font-size: 18px;
  }

  .receipt-print-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 10px;
  }

  .receipt-print-grid div {
    padding: 5px 6px;
  }

  .receipt-print-grid span {
    font-size: 8px;
  }

  .receipt-print-grid strong {
    font-size: 11px;
  }

  .receipt-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 10px 8px;
    page-break-inside: avoid;
  }

  .receipt-image,
  .receipt-empty {
    padding: 6px;
    page-break-inside: avoid;
  }

  .receipt-image figcaption {
    margin-bottom: 5px;
    font-size: 10px;
  }

  .receipt-image img {
    max-height: 5.7in;
  }

  .receipt-print-notes {
    margin: 0 10px 8px;
    padding: 6px 8px;
    font-size: 10px;
  }
}

.load-line {
  display: grid;
  grid-template-columns: 70px 70px 1.4fr 1fr 0.9fr 95px 95px;
  gap: 10px;
  min-height: 34px;
  align-items: center;
  border-bottom: 1px solid #edf1f5;
  font-size: 13px;
}

.load-line:last-child {
  border-bottom: 0;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #fff;
  background: var(--navy);
}

td.num {
  text-align: right;
}

.payroll-details summary {
  cursor: pointer;
  font-weight: 800;
}

.payroll-driver-list {
  display: grid;
  gap: 6px;
  min-width: 360px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.payroll-driver-list div {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 150px;
  gap: 10px;
  align-items: center;
}

.payroll-driver-list strong {
  text-align: right;
}

.payroll-driver-list small {
  color: var(--muted);
}

.salary-week-picker {
  width: 220px;
  color: var(--muted);
  font-size: 12px;
}

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

.salary-actions button {
  min-height: 36px;
  white-space: nowrap;
}

.salary-week-picker select {
  height: 36px;
  margin-top: 4px;
}

.salary-group-panel {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px 22px;
  background: var(--surface);
}

.salary-group-panel strong {
  display: block;
  font-size: 18px;
}

.salary-group-panel span {
  color: var(--muted);
  font-weight: 700;
}

.salary-group-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.salary-group-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.salary-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.salary-group-chip {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.salary-group-open {
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.salary-group-open strong {
  font-size: 14px;
}

.salary-group-open span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.muted-note {
  color: var(--muted);
  font-weight: 700;
}

.link-cell {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--nav);
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.salary-group-modal {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.salary-group-window {
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.salary-group-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--nav);
  color: #fff;
}

.salary-group-top span {
  display: block;
  color: #bfd3ef;
  font-weight: 800;
}

.salary-group-top strong {
  display: block;
  font-size: 28px;
}

.salary-group-total {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 22px;
}

.salary-group-total div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}

.salary-group-total span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.salary-group-total strong {
  display: block;
  margin-top: 3px;
  font-size: 24px;
}

.negative-row td {
  color: var(--danger);
  background: #fff7f7;
}

.hidden {
  display: none !important;
}

.iman-lock {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 520px;
}

.iman-lock label {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.iman-lock input {
  height: 42px;
  margin-top: 5px;
}

.iman-lock span {
  color: var(--danger);
  font-weight: 700;
}

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

.iman-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.iman-head-actions .driver-search {
  width: 220px;
}

.iman-repair-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.iman-repair-form span {
  min-height: 38px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.iman-split {
  grid-template-columns: 360px minmax(0, 1fr);
}

.iman-driver-list {
  max-height: calc(100vh - 430px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.iman-driver-card {
  min-width: 0;
}

.iman-driver-head {
  grid-template-columns: minmax(220px, 1.4fr) repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.iman-week-grid {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 500px);
  overflow: auto;
  padding-right: 4px;
}

.iman-section {
  margin-bottom: 14px;
}

.iman-section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 10px;
}

.iman-section-head h3 {
  margin: 0;
  font-size: 18px;
}

.iman-section-head .driver-search {
  width: 280px;
}

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

.iman-month-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.iman-month-card strong {
  font-size: 16px;
}

.iman-month-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.iman-week-card {
  margin: 0;
}

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

.iman-metrics div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.iman-metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.iman-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.form-panel {
  padding-bottom: 16px;
}

.dispatcher-desk {
  display: grid;
  gap: 14px;
}

.dispatcher-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.dispatcher-tab {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.dispatcher-tab.active {
  border-color: #9ec5fe;
  background: var(--soft-blue);
  color: var(--navy);
}

.dispatcher-panel {
  overflow: hidden;
}

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

.dispatcher-actions label {
  min-width: 170px;
}

.dispatcher-driver-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 520px;
}

.dispatcher-driver-grid .driver-list {
  border-right: 1px solid var(--line);
}

.dispatcher-driver-grid .driver-card {
  min-width: 0;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.inline-check input {
  width: auto;
  height: auto;
  margin: 0;
}

.dispatcher-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding: 0 16px 14px;
}

.dispatcher-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.dispatcher-summary span,
.dispatcher-summary strong {
  display: block;
}

.dispatcher-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dispatcher-summary strong {
  margin-top: 3px;
  font-size: 22px;
}

.dispatcher-status-summary,
.dispatcher-action-center {
  grid-column: span 2;
}

.dispatcher-action-center section {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.dispatcher-action-card {
  min-height: 58px;
  padding: 8px;
  border: 1px solid #dbe6f4;
  border-radius: 7px;
  background: var(--panel);
}

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

.dispatcher-action-card.warn {
  border-color: #ffe4a3;
  background: #fff8df;
}

.dispatcher-action-card.danger {
  border-color: #ffc7c2;
  background: #fff3f1;
}

.dispatcher-action-card.danger strong {
  color: var(--danger);
}

.dispatcher-action-card.info {
  border-color: #cfe1ff;
  background: var(--surface);
}

.check-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.check-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #7a4200;
  background: #fff0c2;
  font-size: 12px;
  font-weight: 900;
}

.check-badge.ok {
  color: #166534;
  background: #dcfce7;
}

.quick-load-form,
.task-form {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.quick-load-form {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  align-items: end;
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid #cfe1ff;
  border-radius: 8px;
  background: var(--surface);
}

.quick-load-form .wide {
  grid-column: span 2;
}

.quick-load-form label {
  min-width: 0;
}

.quick-load-form input {
  min-width: 0;
}

.quick-load-submit {
  min-height: 42px;
}

.dispatcher-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-load-board {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.quick-load-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-status-filter {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.quick-status-filter.active {
  border-color: #9ec5fe;
  background: var(--soft-blue);
  color: var(--navy);
}

.quick-status-filter b {
  margin-left: 5px;
}

.quick-load-list {
  display: grid;
  gap: 10px;
}

.quick-load-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid #2f80ed;
  border-radius: 8px;
  background: var(--panel);
}

.quick-load-card.status-picked_up {
  border-left-color: #f59e0b;
}

.quick-load-card.status-delivered,
.quick-load-card.status-paid {
  border-left-color: #16a34a;
}

.quick-load-card.status-issue {
  border-left-color: var(--danger);
}

.quick-load-main,
.quick-load-route,
.quick-load-actions {
  display: grid;
  gap: 10px;
  align-items: center;
}

.quick-load-main {
  grid-template-columns: minmax(240px, 1fr) auto auto;
}

.quick-load-main strong,
.quick-load-money strong {
  display: block;
  font-size: 20px;
}

.quick-load-main small,
.quick-load-id,
.quick-load-money span,
.quick-load-route span {
  color: var(--muted);
  font-weight: 800;
}

.quick-load-route {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.quick-load-route div {
  min-width: 0;
}

.quick-load-route strong {
  display: block;
  overflow-wrap: anywhere;
}

.quick-load-actions {
  grid-template-columns: 1fr auto auto;
}

.quick-empty-loads {
  padding: 18px;
}

.quick-load-form span,
.task-form + .task-list {
  color: var(--muted);
  font-weight: 800;
}

.task-form {
  grid-template-columns: 130px 170px minmax(240px, 1fr) 150px auto;
  align-items: end;
}

.task-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.task-row {
  display: grid;
  grid-template-columns: 120px 160px minmax(220px, 1fr) 150px 120px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.task-row.done {
  opacity: 0.65;
  background: var(--surface);
}

.task-row strong,
.task-row span,
.task-row small {
  display: block;
}

.week-draft-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px;
  border: 1px solid #f4d28c;
  border-radius: 8px;
  background: #fff8e6;
  color: #7a4b00;
  font-weight: 800;
}

.load-row-warning {
  background: #fff9e6;
}

.load-row-warning input {
  border-color: #e7b84e;
}

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

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
}

.primary,
.secondary,
.danger {
  height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  color: #fff;
  border: 1px solid var(--green);
  background: var(--green);
}

.secondary {
  color: var(--navy);
  border: 1px solid var(--line);
  background: var(--panel);
}

.danger {
  color: var(--danger);
  border: 1px solid #ffd0cc;
  background: #fff5f3;
}

.loads-editor {
  padding: 0 16px;
}

.loads-table {
  min-width: 1280px;
}

.settings-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.settings-divider {
  height: 1px;
  background: var(--line);
}

.fleet-panel {
  display: grid;
  gap: 12px;
}

.fleet-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fleet-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding: 0 16px;
}

.fleet-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.fleet-summary span,
.fleet-summary strong {
  display: block;
}

.fleet-summary span {
  color: var(--muted);
  font-size: 13px;
}

.fleet-summary strong {
  margin-top: 4px;
  font-size: 22px;
}

.fleet-grid {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.fleet-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.55fr) minmax(130px, 0.7fr) minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.fleet-driver-card,
.fleet-service-card,
.fleet-result-card,
.source-cell {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.fleet-driver-card {
  grid-template-columns: 1fr 1fr;
}

.fleet-driver-card .wide {
  grid-column: 1 / -1;
}

.fleet-service-card {
  grid-template-columns: 1.15fr repeat(3, minmax(92px, 1fr));
  align-items: start;
}

.fleet-row label span,
.fleet-result-card span,
.source-cell span {
  display: block;
  min-height: 28px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 800;
}

.fleet-row input {
  height: 34px;
  margin: 0;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  min-width: 0;
}

.fleet-row .num-input,
.fleet-result-card strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fleet-result-card {
  grid-template-columns: 1fr 1fr;
  align-content: start;
  padding: 8px;
  border-radius: 7px;
  background: var(--surface);
}

.fleet-result-card div {
  display: grid;
  align-content: start;
}

.fleet-result-card strong {
  display: block;
  font-size: 18px;
}

.fleet-result-card .maintenance-status {
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 30px;
}

.fleet-row .delete-fleet-row {
  width: 42px;
  height: 100%;
  min-height: 42px;
  padding: 0;
  font-size: 18px;
}

.source-cell {
  display: grid;
  align-content: start;
}

.source-cell input,
.source-cell button {
  width: 100%;
}

.source-cell strong {
  font-size: 18px;
  text-align: right;
}

.source-cell small {
  color: var(--muted);
  font-size: 12px;
}

.fleet-notes-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 20, 32, 0.58);
}

.fleet-notes-window {
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.fleet-notes-body {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: 16px;
}

.fleet-notes-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.fleet-notes-summary div {
  padding: 12px;
  border: 1px solid #d9e5f4;
  border-radius: 8px;
  background: var(--surface);
}

.fleet-notes-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.fleet-notes-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.fleet-general-note {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.fleet-general-note textarea {
  min-height: 78px;
  resize: vertical;
}

.fleet-history-head,
.fleet-notes-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fleet-history-table {
  display: grid;
  gap: 6px;
  overflow: auto;
}

.fleet-history-header,
.fleet-history-row {
  display: grid;
  grid-template-columns: 120px 110px minmax(190px, 1fr) minmax(150px, 0.8fr) 110px minmax(160px, 1fr) 42px;
  gap: 8px;
  align-items: center;
  min-width: 930px;
}

.fleet-history-header {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: var(--navy);
  border-radius: 7px;
  padding: 8px;
}

.fleet-history-row {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.fleet-history-row input {
  height: 34px;
  margin: 0;
  font-size: 13px;
}

.fleet-history-row .delete-repair-history-row {
  width: 42px;
  min-width: 42px;
  height: 34px;
  padding: 0;
}

.maintenance-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-overdue {
  color: #9f1d14;
  background: #ffe8e5;
}

.status-duenow,
.status-soon {
  color: #8a5a00;
  background: #fff3cf;
}

.status-ok {
  color: #166534;
  background: #dcfce7;
}

.danger-soft {
  background: #fff5f3 !important;
}

.warn-soft {
  background: #fff9e6 !important;
}

.ok-soft {
  background: #effaf1 !important;
}

.danger-text {
  color: var(--danger);
  font-weight: 900;
}

.source-cell {
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.source-cell span,
.source-cell code {
  display: block;
}

.source-cell code {
  margin-top: 4px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.fleet-formula-note {
  padding: 0 16px;
}

.tracking-panel {
  display: grid;
  gap: 12px;
}

.tracking-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.4fr);
  gap: 12px;
  padding: 0 16px 16px;
}

.tracking-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.location-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.location-card.active {
  border-color: #79b7ff;
  background: var(--soft-blue);
  box-shadow: inset 4px 0 0 var(--blue);
}

.location-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.location-card strong,
.location-card span,
.location-card small {
  display: block;
}

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

.tracking-link-row {
  display: flex;
  gap: 8px;
}

.tracking-link-row input {
  height: 34px;
  min-width: 0;
  flex: 1;
  margin: 0;
  font-size: 12px;
}

.tracking-link-row button {
  height: 34px;
  padding: 0 10px;
}

.tracking-map-card {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  gap: 10px;
  min-height: 540px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tracking-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.map-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-controls button,
.map-controls a {
  min-width: 40px;
  height: 34px;
  padding: 0 10px;
}

.live-map {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #dbe7ef;
  cursor: grab;
  touch-action: none;
}

.live-map.dragging {
  cursor: grabbing;
}

.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  -webkit-user-drag: none;
}

.map-marker {
  --marker-color: var(--green);
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -100%);
  min-width: 44px;
  padding: 6px 8px;
  border: 2px solid #fff;
  border-radius: 8px;
  color: #fff;
  background: var(--marker-color);
  box-shadow: 0 8px 18px rgba(25, 50, 79, 0.3);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
}

.map-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--marker-color);
}

.map-marker.location-old {
  --marker-color: #b7791f;
}

.map-marker.location-offline {
  --marker-color: #64748b;
}

.map-marker.service-marker {
  --marker-color: #2563eb;
  border-radius: 999px 999px 999px 4px;
}

.map-marker.active {
  outline: 3px solid #7cc4ff;
  outline-offset: 2px;
}

.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.location-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.location-online {
  color: #166534;
  background: #dcfce7;
}

.location-old {
  color: #8a5a00;
  background: #fff3cf;
}

.location-offline {
  color: #687385;
  background: #eef2f6;
}

@media (max-width: 1250px) {
  .fleet-row {
    grid-template-columns: 1fr;
  }

  .fleet-row .delete-fleet-row {
    width: 100%;
    height: 38px;
  }

  .tracking-layout {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
  }

  .split,
  .metrics,
  .form-grid,
  .dispatcher-summary,
  .quick-load-form,
  .task-form,
  .week-browser,
  .week-preview-grid,
  .iman-repair-form,
  .driver-form-grid {
    grid-template-columns: 1fr;
  }

  .driver-app-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .driver-app-toolbar button {
    width: 100%;
  }
}

.driver-inspection {
  display: grid;
  gap: 12px;
  padding: 0 22px 8px;
}

.insp-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.insp-section h4 {
  margin: 0;
  font-size: 15px;
}

.insp-notes {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.insp-car {
  position: relative;
  width: 170px;
}

.insp-car svg {
  display: block;
  width: 100%;
}

.insp-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.insp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.insp-photo {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.insp-photo img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 13, 23, 0.9);
  cursor: zoom-out;
}

.photo-lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

/* ====================== DARK PREMIUM THEME ====================== */

input,
select,
textarea {
  background: #0e1622;
  color: var(--ink);
  border-color: var(--line);
}
input::placeholder,
textarea::placeholder {
  color: #5d6b7e;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 132, 255, 0.18);
}
select option {
  background: #0e1622;
  color: var(--ink);
}
label {
  color: var(--muted);
}

.sidebar {
  background: linear-gradient(180deg, #0e1722 0%, #090d14 100%);
  border-right: 1px solid var(--line);
}
.brand strong {
  color: #fff;
}
.brand span {
  color: var(--blue-strong);
}
.nav-btn {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: #c4d0df;
  font-weight: 700;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-btn.active {
  background: linear-gradient(135deg, var(--blue) 0%, #0a6fe0 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(11, 132, 255, 0.35);
}

.connection {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}
#roleBadge {
  color: var(--blue-strong);
  border-color: rgba(11, 132, 255, 0.3);
}

.panel {
  box-shadow: var(--shadow);
}
.panel-head {
  background: linear-gradient(180deg, rgba(11, 132, 255, 0.1), rgba(11, 132, 255, 0.015));
  border-bottom: 1px solid var(--line);
}
.panel-head.compact {
  background: transparent;
}

.metric,
.status-metrics div {
  background: linear-gradient(180deg, var(--panel), #0f1722);
}
.metric strong,
.status-metrics strong {
  color: #fff;
}

.primary {
  border: 0;
  background: linear-gradient(135deg, var(--green) 0%, #15a34a 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(34, 192, 105, 0.25);
}
.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: #cdd9e8;
  font-weight: 700;
}
.secondary:hover {
  border-color: var(--blue);
  color: #fff;
}
.danger {
  background: rgba(255, 107, 94, 0.12);
  border-color: rgba(255, 107, 94, 0.4);
  color: #ff8a7e;
}

table {
  border-color: var(--line);
}
th {
  background: #0f1925;
  color: #cfe0f4;
  border-color: var(--line);
  font-weight: 800;
}
td {
  border-color: var(--line);
}
tbody tr:hover td {
  background: rgba(11, 132, 255, 0.06);
}

.driver-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.driver-item.active {
  background: var(--soft-blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #243140;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: #2e3e52;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.badge {
  background: rgba(11, 132, 255, 0.15);
  color: #7db9ff;
}
.badge.status-pause,
.badge.status-paused {
  background: rgba(224, 167, 42, 0.16);
  color: #f0c14b;
}
.badge.status-inactive {
  background: rgba(255, 107, 94, 0.16);
  color: #ff8a7e;
}

.load-status-pill {
  background: #1c2735;
  color: #c0cde0;
}
.load-status-pill.status-picked_up {
  background: rgba(11, 132, 255, 0.18);
  color: #6fb4ff;
}
.load-status-pill.status-delivered {
  background: rgba(37, 192, 105, 0.18);
  color: #4ddd8e;
}
.load-status-pill.status-invoiced {
  background: rgba(224, 167, 42, 0.18);
  color: #f0c14b;
}
.load-status-pill.status-paid {
  background: rgba(16, 185, 129, 0.18);
  color: #34e0b0;
}
.load-status-pill.status-issue {
  background: rgba(255, 107, 94, 0.18);
  color: #ff8a7e;
}

.maintenance-status.status-ok,
.status-ok {
  background: rgba(37, 192, 105, 0.16);
  color: #4ddd8e;
}
.status-overdue {
  background: rgba(255, 107, 94, 0.16);
  color: #ff8a7e;
}
.status-duenow,
.status-soon {
  background: rgba(224, 167, 42, 0.16);
  color: #f0c14b;
}

.location-online {
  background: rgba(37, 192, 105, 0.16);
  color: #4ddd8e;
}
.location-old {
  background: rgba(224, 167, 42, 0.16);
  color: #f0c14b;
}
.location-offline {
  background: #1c2735;
  color: var(--muted);
}

.check-badge {
  background: rgba(224, 167, 42, 0.16);
  color: #f0c14b;
}
.check-badge.ok {
  background: rgba(37, 192, 105, 0.16);
  color: #4ddd8e;
}

.danger-soft {
  background: rgba(255, 107, 94, 0.1) !important;
}
.warn-soft {
  background: rgba(224, 167, 42, 0.1) !important;
}
.ok-soft {
  background: rgba(37, 192, 105, 0.1) !important;
}
.negative-row td {
  background: rgba(255, 107, 94, 0.08);
  color: #ff8a7e;
}

.week-summary-strip .primary-stat {
  background: rgba(11, 132, 255, 0.12);
  border-color: rgba(11, 132, 255, 0.3);
}
.week-summary-strip .deduction-stat {
  background: rgba(255, 107, 94, 0.1);
  border-color: rgba(255, 107, 94, 0.3);
}
.week-summary-strip .deduction-stat strong {
  color: #ff8a7e;
}
.week-summary-strip .payout-stat {
  background: rgba(37, 192, 105, 0.1);
  border-color: rgba(37, 192, 105, 0.3);
}
.week-summary-strip .payout-stat strong {
  color: #4ddd8e;
}

.platform-status-card.ok {
  background: rgba(37, 192, 105, 0.1);
  border-color: rgba(37, 192, 105, 0.3);
}
.platform-status-card.warn {
  background: rgba(224, 167, 42, 0.1);
  border-color: rgba(224, 167, 42, 0.3);
}
.dispatcher-action-card.warn {
  background: rgba(224, 167, 42, 0.1);
  border-color: rgba(224, 167, 42, 0.3);
}
.dispatcher-action-card.danger {
  background: rgba(255, 107, 94, 0.1);
  border-color: rgba(255, 107, 94, 0.3);
}
.dispatcher-action-card.info {
  background: rgba(11, 132, 255, 0.1);
  border-color: rgba(11, 132, 255, 0.3);
}

.dispatcher-tab,
.quick-status-filter {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.dispatcher-tab.active,
.quick-status-filter.active {
  background: rgba(11, 132, 255, 0.15);
  color: #fff;
  border-color: var(--blue);
}

.login-card,
.tracking-card {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.login-card h1,
.tracking-card h1 {
  color: #fff;
}

.live-map {
  background: #0e1722;
}
.inline-check {
  background: var(--surface);
  border-color: var(--line);
}
.load-status-select {
  background: #0e1622;
  border-color: var(--line);
  color: var(--ink);
}
.week-option.active {
  background: var(--soft-blue);
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}
.insp-section {
  background: var(--surface);
  border-color: var(--line);
}

/* Keep printed documents (receipts / week sheets) on white paper, not dark theme */
@media print {
  html,
  body {
    background: #fff !important;
    color: #111827 !important;
  }
  .week-modal-window,
  .week-modal .screenshot-card,
  .week-modal .loads-screen-table table,
  .week-modal .loads-screen-table th,
  .week-modal .loads-screen-table td,
  .week-preview,
  .week-summary-strip div,
  .receipt-print,
  .receipt-print-shell,
  .receipt-print-grid div,
  .receipt-image,
  .receipt-empty,
  .receipt-print-notes {
    background: #fff !important;
    color: #111827 !important;
    border-color: #d9e1ea !important;
  }
  .week-modal-top,
  .receipt-print-head,
  .week-modal .loads-screen-table th {
    background: #19324f !important;
    color: #fff !important;
  }
  .week-summary-strip span,
  .week-preview span,
  .receipt-print-grid span {
    color: #687385 !important;
  }
}

.load-edit-window {
  width: min(820px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

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

.load-edit-grid .wide {
  grid-column: 1 / -1;
}

.load-edit-modal .driver-modal-actions {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.receipt-print-section {
  margin: 14px 22px 4px;
  font-size: 15px;
  font-weight: 900;
}

@media print {
  .receipt-print-section {
    color: #111827 !important;
  }
  /* Fit all receipt photos onto a SINGLE page */
  .receipt-print {
    page-break-inside: avoid;
  }
  .receipt-print .receipt-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 14px;
    page-break-inside: avoid;
  }
  .receipt-print .receipt-image {
    padding: 4px;
    page-break-inside: avoid;
    border: 1px solid #d9e1ea !important;
  }
  .receipt-print .receipt-image img {
    max-height: 3in;
    width: 100%;
    object-fit: contain;
  }
}

/* =====================================================================
   MEGA-DETAIL POLISH LAYER
   Subtle micro-interactions, depth and motion. Nothing crude — short
   durations, tiny offsets, soft shadows. Honors reduced-motion + print.
   ===================================================================== */

:root {
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.14s;
  --t-base: 0.22s;
  --ring: 0 0 0 3px rgba(11, 132, 255, 0.28);
  --lift: 0 14px 34px rgba(0, 0, 0, 0.42);
}

::selection {
  background: rgba(11, 132, 255, 0.32);
  color: #fff;
}

/* --- Interactive transitions ------------------------------------------ */
.primary,
.secondary,
.danger,
.nav-btn,
.dispatcher-tab,
.quick-status-filter,
.driver-item,
.metric,
.status-metrics div,
.connection,
.badge,
.load-status-pill,
input,
select,
textarea {
  transition:
    transform var(--t-fast) var(--ease),
    box-shadow var(--t-base) var(--ease),
    background var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease),
    color var(--t-base) var(--ease);
}

/* --- Buttons: hover lift + crisp press -------------------------------- */
.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(34, 192, 105, 0.34);
}
.primary:active,
.secondary:active,
.danger:active,
.nav-btn:active,
.dispatcher-tab:active {
  transform: translateY(1px) scale(0.99);
}
.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}
.danger:hover {
  transform: translateY(-1px);
  background: rgba(255, 107, 94, 0.18);
}

/* --- Premium focus ring for keyboard users --------------------------- */
.primary:focus-visible,
.secondary:focus-visible,
.danger:focus-visible,
.nav-btn:focus-visible,
.dispatcher-tab:focus-visible,
.driver-item:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* --- Sidebar nav: animated accent indicator -------------------------- */
.nav-btn {
  position: relative;
  overflow: hidden;
}
.nav-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue-strong);
  transform: translateY(-50%);
  transition: height var(--t-base) var(--ease);
}
.nav-btn:hover::before {
  height: 18px;
}
.nav-btn.active::before {
  height: 0;
}
.nav-btn:hover {
  transform: translateX(2px);
}

/* --- Metric cards: top accent + hover glow --------------------------- */
.metric {
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  opacity: 0.5;
  transition: opacity var(--t-base) var(--ease);
}
.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--lift);
  border-color: rgba(11, 132, 255, 0.32);
}
.metric:hover::before {
  opacity: 1;
}
.metric strong {
  letter-spacing: -0.01em;
}
.status-metrics div:hover {
  transform: translateY(-1px);
  border-color: rgba(11, 132, 255, 0.28);
}

/* --- Driver list rows ------------------------------------------------- */
.driver-item:hover {
  transform: translateX(2px);
}

/* --- Table rows: smoother hover -------------------------------------- */
tbody tr {
  transition: background var(--t-fast) var(--ease);
}

/* --- Badges / pills: refined typography ------------------------------ */
.badge,
.load-status-pill,
.check-badge,
.location-online,
.location-old,
.location-offline {
  letter-spacing: 0.02em;
}

/* --- View entrance: gentle fade + rise ------------------------------- */
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.view.active {
  animation: viewIn var(--t-base) var(--ease);
}

/* --- Panels appear with a soft fade --------------------------------- */
@keyframes panelIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.dispatcher-panel:not(.hidden) {
  animation: panelIn var(--t-base) var(--ease);
}

/* --- Modal windows: subtle pop-in ----------------------------------- */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.driver-modal-window,
.load-edit-window,
.week-modal-window {
  animation: modalIn var(--t-base) var(--ease);
}

/* --- Accessibility + print: kill motion ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
@media print {
  .view.active,
  .dispatcher-panel:not(.hidden),
  .driver-modal-window,
  .load-edit-window,
  .week-modal-window {
    animation: none !important;
  }
}

/* ---- Multi-vehicle (VIN) editor ---- */
.vehicles-field {
  display: grid;
  gap: 8px;
}
.vehicles-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.vehicles-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.vehicles-list {
  display: grid;
  gap: 8px;
}
.vehicle-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.vehicle-row .veh-name,
.vehicle-row .veh-vin {
  margin-top: 0;
}
.vehicle-row .veh-vin {
  text-transform: uppercase;
}
.veh-remove {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--danger);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.veh-remove:hover {
  border-color: var(--danger);
}

/* ---- Bill of Lading (BOL) PDF ---- */
.bol-print {
  color: #111827;
  background: #fff;
}
.bol-stops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 10px 22px 0;
}
.bol-stop h3 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #19324f;
}
.bol-stop p {
  margin: 2px 0;
  font-size: 13px;
  color: #111827;
}
.bol-stop-addr {
  font-weight: 700;
}
.bol-stop-notes {
  color: #687385 !important;
}
.bol-vehicles {
  width: calc(100% - 44px);
  margin: 6px 22px 0;
  border-collapse: collapse;
}
.bol-vehicles th,
.bol-vehicles td {
  border: 1px solid #d9e1ea;
  padding: 6px 9px;
  font-size: 12px;
  text-align: left;
  color: #111827;
}
.bol-vehicles th {
  background: #eef2f7;
  font-weight: 800;
}
.bol-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  padding: 24px 22px 8px;
}
.bol-sign {
  display: grid;
  gap: 6px;
}
.bol-sign-line {
  height: 30px;
  border-bottom: 1px solid #111827;
}
.bol-sign span {
  font-size: 11px;
  color: #687385;
}

@media print {
  .bol-print,
  .bol-stops,
  .bol-stop,
  .bol-vehicles,
  .bol-vehicles td,
  .bol-signatures,
  .bol-sign {
    background: #fff !important;
    color: #111827 !important;
  }
  .bol-vehicles th {
    background: #eef2f7 !important;
    color: #111827 !important;
  }
  .bol-stop h3 {
    color: #19324f !important;
  }
  .bol-signatures {
    page-break-inside: avoid;
  }
}

@media print {
  .bol-print .receipt-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 22px;
  }
  .bol-print .receipt-image {
    padding: 4px;
    page-break-inside: avoid;
    border: 1px solid #d9e1ea !important;
    background: #fff !important;
  }
  .bol-print .receipt-image img {
    max-height: 2.7in;
    width: 100%;
    object-fit: contain;
  }
  .bol-print .receipt-print-section {
    color: #111827 !important;
  }
}

.bol-sign-mark {
  height: 46px;
  border-bottom: 1px solid #111827;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.bol-sign-svg {
  width: 100%;
  height: 46px;
}
@media print {
  .bol-sign-mark { border-bottom: 1px solid #111827 !important; }
}

/* ============================================================
   CLEANER + MOBILE-FRIENDLY PORTAL
   ============================================================ */

/* Sidebar nav grouped into sections */
.nav-section {
  display: block;
  margin: 16px 6px 6px;
  color: #5b6a80;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.nav-section:first-child {
  margin-top: 2px;
}

/* Cleaner (calmer, not bigger): softer metric cards, lighter panel heads */
.metric::before {
  opacity: 0.28;
}
.metric:hover::before {
  opacity: 0.7;
}
.panel-head {
  background: linear-gradient(180deg, rgba(11, 132, 255, 0.06), transparent);
}

/* Keep metrics at 2 columns on narrower screens (not 1 tall column) */
@media (max-width: 1050px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Phone layout: sidebar becomes a compact horizontal nav strip on top */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    padding: 2px 2px 10px;
  }
  .brand strong {
    font-size: 18px;
  }
  .nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-section {
    display: none;
  }
  .nav-btn {
    flex: 0 0 auto;
    height: 40px;
    white-space: nowrap;
  }
  .nav-btn:hover {
    transform: none;
  }
  .workspace {
    padding: 12px;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
  }
  .topbar-tools {
    flex-wrap: wrap;
    gap: 8px;
  }
  .order-search,
  .order-search input,
  .driver-search {
    width: 100%;
  }
  h1 {
    font-size: 22px;
  }
  .status-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* Tables: always horizontally scrollable on phone */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Full-screen modals on phone */
  .driver-modal,
  .receipt-modal {
    padding: 0;
  }
  .driver-modal-window,
  .load-edit-window,
  .week-modal-window,
  .receipt-window {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh;
    border-radius: 0;
  }
  .load-edit-grid {
    grid-template-columns: 1fr;
  }
  /* Loads board cards: actions stay tidy */
  .quick-load-actions {
    gap: 6px;
  }
  .dispatcher-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Very small phones: metrics single-but-compact */
@media (max-width: 460px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .status-metrics {
    grid-template-columns: 1fr 1fr;
  }
}

/* Loads card: "⋯ Ещё" dropdown to keep cards tidy */
.load-more {
  position: relative;
  display: inline-block;
}
.load-more > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.load-more > summary::-webkit-details-marker {
  display: none;
}
.load-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 6px;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.load-more-menu .compact-btn {
  width: 100%;
  text-align: left;
}
@media (max-width: 820px) {
  .load-more-menu {
    right: auto;
    left: 0;
  }
}

/* Add Load — choose screen (paste from Super Dispatch / fill manually) */
.add-load-choose {
  display: grid;
  gap: 16px;
  padding: 20px 22px 24px;
}
.add-load-paste {
  display: grid;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 18px;
  background: var(--surface);
}
.add-load-paste strong {
  font-size: 16px;
}
.add-load-paste textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  padding: 12px;
  line-height: 1.4;
}
.add-load-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.add-load-or::before,
.add-load-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.add-load-manual {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

.quick-load-more-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(11, 132, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* Inbound email loads ("📥 С почты") */
.email-inbox {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.email-inbox-head {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}
.email-inbox-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(11, 132, 255, 0.3);
  border-radius: 12px;
  background: rgba(11, 132, 255, 0.06);
}
.email-inbox-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.email-inbox-info strong {
  font-size: 15px;
}
.email-inbox-info small {
  color: var(--muted);
  font-size: 12.5px;
}
.email-inbox-info .email-from {
  color: #6b7886;
  font-size: 11.5px;
}
.email-inbox-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Резервные копии */
.backups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--card, #fff);
  flex-wrap: wrap;
}
.backup-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.backup-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .backup-row { flex-direction: column; align-items: stretch; }
  .backup-actions { justify-content: flex-end; }
}

/* Документы трака */
.docs-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.docs-window {
  background: var(--card, #fff);
  border-radius: 14px;
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.docs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.docs-head h2 { margin: 0; font-size: 18px; }
.docs-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  flex-wrap: wrap;
}
.doc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.doc-view {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef2f7;
  text-decoration: none;
  color: #1f2937;
  font-size: 13px;
}
.doc-exp { font-size: 12px; font-weight: 600; }
.doc-exp-ok { color: #15803d; }
.doc-exp-warn { color: #b45309; }
.doc-exp-bad { color: #b91c1c; }
.docs-divider { height: 1px; background: var(--border, #e2e8f0); margin: 16px 0; }
.docs-add h3 { margin: 0 0 10px; font-size: 15px; }
.docs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.docs-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.docs-grid .docs-wide { grid-column: 1 / -1; }
.docs-actions-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
@media (max-width: 560px) {
  .docs-grid { grid-template-columns: 1fr; }
  .doc-row { flex-direction: column; align-items: stretch; }
  .doc-actions { justify-content: flex-end; }
}
