:root {
  --navy: #082F49;
  --navy-2: #0B3A59;
  --primary: #0EA5E9;
  --primary-dark: #0284C7;
  --teal: #0F766E;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-soft: #EEF7FB;
  --text: #0F172A;
  --muted: #64748B;
  --border: #D7E3EF;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --shadow: 0 18px 45px rgba(8, 47, 73, 0.10);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --app-bg: var(--bg);
  --surface-2: var(--surface-soft);
  --primary-soft: rgba(14, 165, 233, 0.12);
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --sidebar-bg: var(--navy);
  --input-bg: #FFFFFF;
  --table-head-bg: #F8FAFC;
}

* { box-sizing: border-box; }
html { direction: rtl; overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(14, 165, 233, 0.07), rgba(248, 250, 252, 0) 320px),
    var(--app-bg);
  color: var(--text);
  font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.hidden { display: none !important; }
img, svg, video, canvas, iframe { max-width: 100%; }
label, .input, .select, textarea.input { min-width: 0; }
.muted { color: var(--muted); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}
.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
}
.stack, .stack-sm { display: grid; gap: 14px; }
.stack-sm { gap: 8px; }
.full-width { width: 100%; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 70% 16%, rgba(14, 165, 233, 0.18), transparent 30%),
    linear-gradient(135deg, #E0F7FF 0%, #F8FAFC 52%, #ECFEFF 100%);
}
.login-card {
  width: min(100%, 460px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 10px; font-size: 34px; color: var(--navy); }

code {
  background: #E2E8F0;
  padding: 2px 8px;
  border-radius: 999px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}
.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--input-bg);
  font: inherit;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}
.input:focus {
  outline: 3px solid rgba(14, 165, 233, 0.14);
  border-color: var(--primary);
}
.select { cursor: pointer; }
.textarea { min-height: 110px; resize: vertical; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: white;
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.24);
}
.btn-secondary {
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--border);
}
.btn-success { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.btn-warning { background: rgba(245, 158, 11, 0.14); color: #B45309; }
.btn-danger { background: rgba(220, 38, 38, 0.12); color: var(--danger); }
.small { padding: 9px 12px; font-size: 13px; }
@media (max-width: 680px) {
  .btn.small {
    min-height: 38px;
    padding: 9px 14px;
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(14, 165, 233, 0.14), transparent 34%),
    var(--sidebar-bg);
  color: white;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  box-shadow: 18px 0 45px rgba(8, 47, 73, 0.16);
}
.sidebar h2 { margin: 0 0 6px; font-size: 26px; }
.sidebar .muted { color: #A9C8D8; }
.sidebar .eyebrow { color: #7DD3FC; }
.sidebar .eyebrow::before { background: #5EEAD4; }
.nav-link {
  width: 100%;
  text-align: right;
  background: transparent;
  color: #C9DDEA;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.nav-link::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.45);
}
.nav-link.active,
.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(125, 211, 252, 0.26);
}
.nav-link.active::before { background: #5EEAD4; }

.main-content {
  min-width: 0;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--topbar-bg);
  border: 1px solid rgba(215, 227, 239, 0.92);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: 26px; color: var(--navy); }
.topbar-search {
  min-width: 260px;
  max-width: 340px;
  position: relative;
}
.topbar-search::before {
  content: "⌕";
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.topbar-search .input { padding-inline-start: 38px; }
.view { display: none; }
.view.active { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.stat-card,
.panel,
.dashboard-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(215, 227, 239, 0.95);
  min-width: 0;
}
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 126px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset-inline-end: -28px;
  bottom: -34px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.11);
}
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 800; }
.stat-card strong { font-size: 34px; color: var(--navy); line-height: 1; }
.accent-info { border-top: 4px solid var(--primary); }
.accent-success { border-top: 4px solid var(--success); }
.accent-warning { border-top: 4px solid var(--warning); }
.accent-teal { border-top: 4px solid var(--teal); }

.panel,
.dashboard-card { padding: 20px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head.wrap, .actions-row.wrap { flex-wrap: wrap; }
.panel-head h3 { margin: 0; color: var(--navy); }
.panel-head p { margin: 4px 0 0; }
.grid-2,
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 16px;
}
.dashboard-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.list { display: grid; gap: 12px; }
.list-item,
.empty-state {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid var(--border);
}
.list-item strong { color: var(--navy); }
.empty-state {
  min-height: 118px;
  align-content: center;
  color: var(--muted);
  text-align: center;
}
.live-preview {
  min-height: 190px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(8, 47, 73, 0.94), rgba(15, 118, 110, 0.86)),
    #0F172A;
  color: white;
  padding: 18px;
  display: grid;
  align-content: end;
  gap: 8px;
  overflow: hidden;
}
.live-preview strong { font-size: 28px; }
.live-preview span { color: #BAE6FD; }
.proof-preview {
  display: grid;
  gap: 10px;
}
.proof-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid var(--border);
}

.actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.actions-row.wrap > .input {
  width: auto;
  flex: 1 1 auto;
}
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  background: white;
}
th, td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 13px;
  background: #F8FAFC;
}
tr:hover td { background: #FBFDFF; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.badge { background: #F1F5F9; color: #475569; }
.badge.new { background: rgba(99, 102, 241, 0.12); color: #4338CA; }
.badge.assigned { background: rgba(20, 184, 166, 0.12); color: #0F766E; }
.badge.pending { background: rgba(245, 158, 11, 0.14); color: #B45309; }
.badge.transit { background: rgba(14, 165, 233, 0.13); color: var(--primary-dark); }
.badge.delivered { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.badge.failed,
.badge.cancelled { background: rgba(220, 38, 38, 0.12); color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.span-2 { grid-column: span 2; }
.order-vat-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F8FAFC;
  min-width: 0;
}
.order-vat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.order-vat-row strong {
  color: var(--navy);
  font-size: 14px;
}
.order-vat-row.order-vat-total {
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-weight: 800;
}
.order-vat-row.order-vat-total strong {
  font-size: 16px;
  color: var(--primary-dark);
}
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 30;
  transition: transform 0.25s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: #15803D; }
.toast.toast-error { background: #B91C1C; }
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 900;
}
.toast-text {
  overflow-wrap: anywhere;
}
.inline-status {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-status select { min-width: 140px; }

.proof-modal {
  border-radius: 16px !important;
  box-shadow: 0 24px 70px rgba(8, 47, 73, 0.28) !important;
}
.proof-modal-head h3 { color: var(--navy); }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid,
  .grid-2,
  .dashboard-grid.compact { grid-template-columns: minmax(0, 1fr); }
}
:root {
  --mobile-topbar-height: 80px;
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    right: 0;
    left: auto;
    top: var(--mobile-topbar-height);
    height: calc(100vh - var(--mobile-topbar-height));
    height: calc(100dvh - var(--mobile-topbar-height));
    width: min(82vw, 300px);
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 70;
    overflow-y: auto;
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    z-index: 65;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
  }
  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }
  .sidebar-toggle { display: inline-grid !important; position: relative; z-index: 80; }
  .topbar { position: relative; z-index: 80; }
  .stats-grid,
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: span 1; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-search { min-width: 0; max-width: none; }
  .actions-row { flex-wrap: wrap; }
  .order-inline-proof {
    grid-template-columns: minmax(0, 1fr);
  }
}
.sidebar-backdrop { display: none; }
@media (max-width: 860px) {
  .sidebar-backdrop { display: block; }
}
.sidebar-toggle { display: none; }

/* Phase UI-1 Rev2: closer to the supplied reference dashboard */
body {
  background:
    radial-gradient(circle at 84% 8%, rgba(14, 165, 233, 0.12), transparent 28%),
    linear-gradient(180deg, #F7FBFF 0%, #F8FAFC 46%, #F3F7FB 100%);
}
.app-shell { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  background:
    radial-gradient(circle at 30% 10%, rgba(14, 165, 233, 0.22), transparent 24%),
    linear-gradient(180deg, #06263C 0%, #05253B 52%, #031B2D 100%);
  padding: 28px 20px;
  box-shadow: 14px 0 36px rgba(3, 27, 45, 0.18);
}
.sidebar-top { display: grid; gap: 12px; }
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  margin-bottom: 8px;
}
.brand-drop {
  width: 48px;
  height: 58px;
  border-radius: 50% 50% 52% 52%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(160deg, #38BDF8, #0891B2);
  transform: rotate(10deg);
  box-shadow: 0 14px 26px rgba(14, 165, 233, 0.28);
}
.brand-logo-img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  padding: 5px;
  box-shadow: 0 14px 26px rgba(14, 165, 233, 0.18);
}
.brand-mark h2 {
  color: #67E8F9;
  font-size: 30px;
  line-height: 1;
}
.brand-mark span {
  display: block;
  color: #BAE6FD;
  font-weight: 800;
  margin-top: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  color: #E0F2FE;
  border-radius: 10px;
  font-size: 15px;
}
.nav-link::before {
  content: attr(data-icon);
  width: 22px;
  height: 22px;
  margin: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: #E0F2FE;
  background: transparent;
  font-size: 16px;
}
.nav-link.active,
.nav-link:hover {
  background: linear-gradient(135deg, #0F766E, #0891B2);
  border-color: rgba(125, 211, 252, 0.28);
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.2);
}
.support-card {
  margin-top: auto;
  padding: 16px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.13);
  color: #E0F2FE;
}
.support-card strong { display: block; font-size: 15px; }
.support-card span { display: block; margin-top: 4px; font-size: 13px; color: #BAE6FD; }

.main-content {
  padding: 0;
  gap: 0;
  background: #F6F9FC;
}
.topbar {
  border-radius: 0 0 18px 18px;
  min-height: 78px;
  padding: 14px 28px;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}
.topbar > div:first-of-type { margin-inline-end: auto; }
.topbar h1 { font-size: 24px; }
.topbar .muted { font-size: 13px; }
.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: var(--navy);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.icon-button.static { cursor: default; }
.date-pill,
.admin-pill {
  min-height: 42px;
  display: grid;
  align-content: center;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  border-radius: 10px;
  padding: 7px 13px;
  color: var(--navy);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}
.admin-pill strong { font-size: 13px; line-height: 1; }
.admin-pill span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.topbar-search .input {
  height: 42px;
  border-radius: 10px;
  background: #F8FAFC;
}
#dashboardView,
#ordersView,
#customersView,
#createOrderView,
#createCustomerView,
#usersView,
#liveView,
#auditView {
  padding: 26px 28px;
}

.stats-grid { gap: 14px; }
.stat-card {
  min-height: 148px;
  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, 0.78);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.07);
}
.stat-card::before {
  content: attr(data-stat-icon);
  position: absolute;
  inset-inline-end: 18px;
  top: 54px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 900;
  color: white;
}
.stat-card::after {
  width: 110px;
  height: 110px;
  opacity: 0.8;
}
.stat-card strong { font-size: 36px; }
.stat-card small,
.stat-link {
  color: #0369A1;
  font-weight: 800;
  font-size: 12px;
}
.stat-link {
  position: relative;
  z-index: 1;
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}
.stat-link::after {
  content: "›";
  display: inline-block;
  margin-right: 4px;
}
.stat-link:hover { text-decoration: underline; }
.stat-blue { background: linear-gradient(135deg, #EFF6FF, #FFFFFF); }
.stat-cyan { background: linear-gradient(135deg, #ECFEFF, #FFFFFF); }
.stat-amber { background: linear-gradient(135deg, #FFF7ED, #FFFFFF); }
.stat-green { background: linear-gradient(135deg, #ECFDF5, #FFFFFF); }
.stat-purple { background: linear-gradient(135deg, #F5F3FF, #FFFFFF); }
.stat-blue::before { background: #0EA5E9; }
.stat-cyan::before { background: #0891B2; }
.stat-amber::before { background: #F59E0B; }
.stat-green::before { background: #10B981; }
.stat-purple::before { background: #7C3AED; }

.panel,
.dashboard-card {
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}
.dashboard-grid { grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.9fr); }
.dashboard-grid.compact { grid-template-columns: 1fr 1fr 1fr; }
.list-item {
  grid-template-columns: 1fr auto;
  align-items: center;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid #E2E8F0;
  background: #FFFFFF;
  padding: 13px 10px;
}
.list-item:last-child { border-bottom: 0; }
.list-item .badge { justify-self: end; }
.live-summary-card {
  min-height: 220px;
  border-radius: 14px;
  border: 1px solid #DCEAF3;
  background: linear-gradient(135deg, #EFF6FF, #ECFEFF);
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 22px;
}
.live-summary-card strong {
  font-size: 48px;
  line-height: 1;
  color: var(--navy);
}
.live-summary-card > span {
  color: #0B3A59;
  font-weight: 900;
}
.live-summary-card p { margin: 0; }
.proof-thumb-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.proof-thumb {
  height: 78px;
  border-radius: 10px;
  display: grid;
  place-items: end center;
  padding: 8px;
  color: white;
  font-size: 12px;
  font-weight: 900;
  background: linear-gradient(135deg, #0EA5E9, #0F766E);
  box-shadow: inset 0 -30px 34px rgba(8, 47, 73, 0.35);
}
.empty-state {
  border-style: dashed;
  background: #F8FAFC;
}
.proof-real-row,
.driver-mini-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #FFFFFF;
  font-family: inherit;
  text-align: right;
}
.proof-real-row {
  cursor: pointer;
}
.proof-real-row:hover,
.driver-mini-row:hover {
  background: #F8FAFC;
}
.proof-real-row img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
}
.proof-type,
.driver-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #0EA5E9, #0F766E);
}
.proof-real-row b,
.driver-mini-row b {
  display: block;
  color: var(--navy);
}
.proof-real-row small,
.driver-mini-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.driver-mini-list,
.proof-preview {
  display: grid;
  gap: 10px;
}
.drivers-card {
  grid-column: 1 / -1;
}
.driver-search {
  max-width: 220px;
  height: 38px;
}
.real-order-row,
.ops-alert,
.quick-link {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #FFFFFF;
}
.real-order-row strong,
.ops-alert b {
  display: block;
  color: var(--navy);
}
.real-order-row small,
.ops-alert small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.ops-alert-list,
.quick-link-grid {
  display: grid;
  gap: 10px;
}
.ops-alert.warn { border-color: rgba(245, 158, 11, 0.36); background: #FFFBEB; }
.ops-alert.danger { border-color: rgba(220, 38, 38, 0.28); background: #FEF2F2; }
.ops-alert.info { border-color: rgba(14, 165, 233, 0.28); background: #EFF6FF; }
.quick-link {
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  color: var(--navy);
  text-align: right;
}
.quick-link::after {
  content: "›";
  color: var(--primary-dark);
  font-size: 20px;
  font-weight: 900;
}
.quick-link:hover {
  background: #F8FAFC;
  border-color: #BAE6FD;
}
.stat-red { background: linear-gradient(135deg, #FEF2F2, #FFFFFF); }
.stat-teal { background: linear-gradient(135deg, #ECFDF5, #FFFFFF); }
.stat-red::before { background: #DC2626; }
.stat-teal::before { background: #0F766E; }
.stat-orange::before { background: #EA580C; }
.stat-indigo::before { background: #4F46E5; }
.table-wrap { border-color: #E2E8F0; }
th { background: #F8FAFC; color: #334155; }
.badge { border-radius: 9px; }

#ordersView .panel-head .actions-row {
  align-items: stretch;
}
#ordersView .panel-head .actions-row .input {
  min-width: 150px;
}
@media (max-width: 680px) {
  #ordersView .panel-head .actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  #ordersView .panel-head .actions-row .input,
  #ordersView .panel-head .actions-row .btn {
    min-width: 0;
    width: 100%;
  }
  #ordersView table {
    min-width: 880px;
  }
  .orders-actions {
    min-width: 0;
  }
}
#ordersView .table-wrap {
  overflow-x: auto;
  border-radius: 14px;
}
#ordersView table {
  min-width: 1120px;
}
#ordersView td,
#ordersView th {
  vertical-align: top;
}
.driver-assign {
  margin-top: 8px;
}
.orders-actions,
.proof-status-stack,
.attention-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.orders-actions {
  flex-direction: column;
  align-items: stretch;
  min-width: 170px;
}
.orders-actions .inline-status,
.driver-assign .inline-status {
  width: 100%;
}
.orders-actions .input,
.driver-assign .input {
  min-width: 0;
}
.mini-proof,
.attention-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.mini-proof.ok {
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
}
.mini-proof.missing,
.attention-badge {
  color: #92400E;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}
.order-needs-attention {
  background: linear-gradient(90deg, rgba(255, 251, 235, 0.85), #FFFFFF 42%);
}
.orders-empty-cell {
  padding: 34px 18px;
  text-align: center;
  background: #F8FAFC;
}
.orders-empty-cell strong {
  display: block;
  color: var(--navy);
  margin-bottom: 6px;
}
.orders-empty-cell .orders-reset-filters-btn {
  margin-top: 12px;
}
.order-inline-proofs {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.order-inline-proof {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  padding: 9px 10px;
}
.order-inline-proof .k {
  color: var(--muted);
  font-weight: 900;
}
.order-inline-proof-value {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.order-inline-proof-value small {
  color: var(--muted);
  font-size: 11px;
}
.driver-management-panel {
  display: grid;
  gap: 18px;
}
.driver-toolbar .input {
  min-width: 190px;
}
.driver-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}
.driver-summary-card {
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFFFFF, #F8FAFC);
  padding: 14px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}
.driver-summary-card strong {
  display: block;
  color: var(--navy);
  font-size: 26px;
  line-height: 1;
  margin-bottom: 8px;
}
.driver-summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.drivers-polished-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.driver-polished-card,
.drivers-empty-state {
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  background: #FFFFFF;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
.driver-card-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.driver-avatar.large {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  font-size: 20px;
}
.driver-card-main h4 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 17px;
}
.driver-card-main p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.driver-card-badges,
.driver-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.driver-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid transparent;
}
.driver-chip.ok { color: #047857; background: #ECFDF5; border-color: #A7F3D0; }
.driver-chip.info { color: #075985; background: #EFF6FF; border-color: #BAE6FD; }
.driver-chip.warn { color: #92400E; background: #FFFBEB; border-color: #FDE68A; }
.driver-chip.danger { color: #991B1B; background: #FEF2F2; border-color: #FECACA; }
.driver-chip.muted-chip { color: #475569; background: #F1F5F9; border-color: #CBD5E1; }
.driver-card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.driver-card-stats span {
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 10px;
  min-width: 0;
}
.driver-card-stats b,
.driver-card-stats small {
  display: block;
  overflow-wrap: anywhere;
}
.driver-card-stats b {
  color: var(--navy);
  font-size: 15px;
}
.driver-card-stats small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.driver-recent-orders {
  display: grid;
  gap: 7px;
}
.driver-order-link {
  width: 100%;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  color: var(--text);
  font: inherit;
  text-align: right;
  padding: 9px 10px;
  cursor: pointer;
}
.driver-order-link span,
.driver-order-link small {
  display: block;
}
.driver-order-link span {
  font-weight: 900;
  color: var(--navy);
}
.driver-order-link small {
  margin-top: 3px;
  color: var(--muted);
}
.drivers-empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  text-align: center;
  color: var(--muted);
  border-style: dashed;
  background: #F8FAFC;
}
.drivers-empty-state strong {
  color: var(--navy);
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .dashboard-grid.compact { grid-template-columns: minmax(0, 1fr); }
  .driver-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .drivers-polished-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .main-content { padding: 0; }
  #dashboardView,
  #ordersView,
  #proofsView,
  #customersView,
  #createOrderView,
  #createCustomerView,
  #usersView,
  #liveView,
  #auditView { padding: 18px; }
  .driver-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .driver-card-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .driver-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .driver-toolbar .input {
    min-width: 0;
    width: 100%;
  }
  .driver-card-main {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .driver-card-stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .driver-card-actions .btn {
    width: 100%;
  }
}

/* ---------- Proofs view (UI-6.1: simplified, calm, accordion list) ---------- */
.proofs-filters {
  margin-bottom: 14px;
}
.proofs-filters .input {
  min-width: 160px;
}
.proofs-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.proofs-summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  text-align: center;
}
.proofs-summary-card strong {
  display: block;
  color: var(--navy);
  font-size: 20px;
  line-height: 1;
  margin-bottom: 4px;
}
.proofs-summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.proofs-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.driver-avatar.small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 13px;
  flex-shrink: 0;
}
.proof-type-chip {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.proof-type-chip.pickup { background: rgba(14, 165, 233, 0.12); color: var(--primary-dark); }
.proof-type-chip.delivery { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.proof-lightbox-inner {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
}
.proof-lightbox-inner img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  background: #0f172a;
}
.proof-lightbox-inner .proof-modal-close {
  position: absolute;
  top: -14px;
  left: -14px;
}

@media (max-width: 860px) {
  .proofs-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .proofs-summary-card { padding: 8px; }
  .proofs-summary-card strong { font-size: 17px; }
}

/* ---------- Proofs view (UI-6.2: hybrid driver cards + proof mini cards) ---------- */
.proofs-filters {
  padding: 10px;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: #F8FAFC;
}
.proofs-summary-grid {
  gap: 12px;
}
.proofs-summary-card {
  border-color: #DCEAF3;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFFFFF, #F8FAFC);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}
.proofs-summary-card strong {
  font-size: 24px;
}
.proofs-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.proof-driver-card {
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
  padding: 14px;
  min-width: 0;
}
.proof-driver-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid #EEF2F7;
}
.proof-driver-name {
  display: flex;
  gap: 10px;
  min-width: 0;
  align-items: center;
}
.proof-driver-name h4 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 16px;
  overflow-wrap: anywhere;
}
.proof-driver-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, auto));
  gap: 8px;
}
.proof-driver-metrics span {
  min-width: 0;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  padding: 8px 9px;
  text-align: center;
}
.proof-driver-metrics b,
.proof-driver-metrics small {
  display: block;
}
.proof-driver-metrics b {
  color: var(--navy);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.proof-driver-metrics small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  margin-top: 3px;
}
.proof-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.proof-mini-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: #FFFFFF;
  padding: 9px;
  min-width: 0;
}
.proof-mini-thumb {
  width: 74px;
  height: 74px;
  border: 0;
  border-radius: 12px;
  background: #E0F2FE;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
}
.proof-mini-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.proof-mini-thumb.no-photo {
  cursor: default;
  display: grid;
  place-items: center;
  color: #64748B;
  background: #F1F5F9;
  border: 1px dashed #CBD5E1;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}
.proof-mini-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.proof-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.proof-mini-top small,
.proof-mini-order,
.proof-mini-note {
  color: var(--muted);
  font-size: 11px;
}
.proof-mini-content strong {
  color: var(--navy);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.proof-mini-note {
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 7px;
  background: #FFFBEB;
  color: #92400E;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}
.proof-mini-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}
.proofs-show-all-btn {
  width: 100%;
  margin-top: 12px;
  border: 1px dashed #BAE6FD;
  border-radius: 12px;
  background: #F0F9FF;
  color: var(--primary-dark);
  font: inherit;
  font-weight: 900;
  padding: 10px;
  cursor: pointer;
}
.proofs-show-all-btn:hover {
  background: #E0F2FE;
}

@media (max-width: 980px) {
  .proofs-board,
  .proof-mini-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .proof-driver-card-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .proof-driver-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .proofs-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .proof-mini-card {
    grid-template-columns: 68px minmax(0, 1fr);
  }
  .proof-mini-thumb {
    width: 68px;
    height: 68px;
  }
}

/* ---------- Proofs view (UI-6.3: softer visual tone) ---------- */
#proofsView .panel {
  background:
    linear-gradient(180deg, rgba(240, 249, 255, 0.86), rgba(248, 250, 252, 0.98)),
    #F8FAFC;
  border-color: #DCEAF3;
}
#proofsView .panel-head {
  padding: 14px;
  border: 1px solid rgba(186, 230, 253, 0.65);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}
.proofs-filters {
  background: rgba(255, 255, 255, 0.76);
  border-color: #D7E8F2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.proofs-summary-card {
  background: linear-gradient(135deg, #FFFFFF, #EEF8FC);
  border-color: #CFE3EE;
  box-shadow: 0 12px 28px rgba(8, 47, 73, 0.08);
}
.proof-driver-card {
  background: linear-gradient(180deg, #FFFFFF, #FBFDFF);
  border-color: #CFE3EE;
  box-shadow: 0 16px 36px rgba(8, 47, 73, 0.11);
}
.proof-driver-card-head {
  margin: -14px -14px 0;
  padding: 14px;
  border-bottom-color: #DCEAF3;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.95), rgba(255, 255, 255, 0.86));
}
.proof-driver-metrics span {
  background: rgba(255, 255, 255, 0.86);
  border-color: #D7E8F2;
}
.proof-mini-grid {
  gap: 11px;
}
.proof-mini-card {
  background: #FDFEFF;
  border-color: #D7E8F2;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}
.proof-mini-thumb {
  border: 1px solid #D7E8F2;
  background: #EAF7FD;
}
.proof-mini-thumb.no-photo {
  background: #F8FAFC;
}
.proofs-show-all-btn {
  background: #EAF7FD;
  border-color: #A7D8EF;
}
.proofs-show-all-btn:hover {
  background: #DFF2FB;
}

/* ---------- Proofs view (UI-6.4: layout balance polish) ---------- */
#proofsView {
  padding-top: 16px;
}
#proofsView .panel {
  padding: 16px;
}
#proofsView .panel-head {
  padding: 10px 12px;
  margin-bottom: 10px;
}
#proofsView .panel-head h3 {
  margin-bottom: 3px;
}
#proofsView .panel-head p {
  margin: 0;
}
.proofs-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(145px, 0.8fr) minmax(170px, 1fr) minmax(145px, 0.8fr);
  gap: 8px;
  padding: 8px;
  margin-bottom: 10px;
}
.proofs-filters .input {
  width: 100%;
  min-width: 0;
  height: 38px;
}
.proofs-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 160px));
  justify-content: start;
  gap: 8px;
  margin-bottom: 12px;
}
.proofs-summary-card {
  padding: 9px 10px;
  text-align: right;
}
.proofs-summary-card strong {
  font-size: 20px;
  margin-bottom: 3px;
}
.proofs-summary-card span {
  font-size: 11px;
}
.proofs-board {
  gap: 12px;
}
.proof-driver-card {
  padding: 12px;
}
.proof-driver-card-head {
  margin: -12px -12px 0;
  padding: 11px 12px;
  gap: 10px;
}
.proof-driver-name h4 {
  font-size: 15px;
  margin-bottom: 4px;
}
.proof-driver-card .driver-avatar.small {
  width: 36px;
  height: 36px;
}
.proof-driver-metrics {
  gap: 6px;
}
.proof-driver-metrics span {
  padding: 6px 7px;
  border-radius: 10px;
}
.proof-driver-metrics b {
  font-size: 12px;
}
.proof-driver-metrics small {
  font-size: 9px;
}
.proof-mini-grid {
  gap: 8px;
  margin-top: 10px;
}
.proof-mini-card {
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 9px;
  padding: 8px;
  border-radius: 13px;
}
.proof-mini-thumb {
  width: 84px;
  height: 84px;
  border-radius: 11px;
}
.proof-mini-content {
  gap: 4px;
}
.proof-mini-top {
  align-items: flex-start;
}
.proof-mini-content strong {
  font-size: 14px;
}
.proof-type-chip {
  padding: 3px 8px;
  font-size: 10px;
}
.proof-mini-actions {
  gap: 6px;
}
.proof-mini-actions .btn.small {
  padding: 6px 9px;
  font-size: 12px;
  min-height: 0;
}
.proofs-show-all-btn {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

@media (max-width: 980px) {
  .proofs-filters {
    grid-template-columns: 1fr 1fr;
  }
  .proofs-filters #proofsSearch {
    grid-column: 1 / -1;
  }
  .proofs-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  #proofsView .panel {
    padding: 12px;
  }
  .proofs-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .proofs-filters #proofsSearch {
    grid-column: auto;
  }
  .proofs-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .proof-mini-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }
  .proof-mini-thumb {
    width: 78px;
    height: 78px;
  }
  .proof-mini-actions {
    justify-content: stretch;
  }
  .proof-mini-actions .btn.small {
    flex: 1 1 auto;
  }
}

/* ---------- Proofs view (UI-6.5: header gap + filter text fix) ---------- */
body:has(#proofsView.active) .main-content {
  gap: 10px;
}
body:has(#proofsView.active) .topbar {
  padding: 8px 12px;
  min-height: 0;
  gap: 10px;
}
body:has(#proofsView.active) .topbar h1 {
  font-size: 19px;
}
body:has(#proofsView.active) .topbar .muted {
  display: none;
}
body:has(#proofsView.active) .topbar-search {
  min-width: 190px;
  max-width: 240px;
}
body:has(#proofsView.active) .topbar-search .input {
  height: 34px;
  padding-block: 7px;
  font-size: 12px;
}
body:has(#proofsView.active) .date-pill,
body:has(#proofsView.active) .admin-pill {
  padding: 6px 9px;
  font-size: 12px;
}
body:has(#proofsView.active) #refreshBtn {
  padding: 8px 11px;
  font-size: 12px;
}
#proofsView {
  padding-top: 6px;
}
#proofsView.view.active {
  gap: 10px;
}
#proofsView .panel {
  padding-top: 12px;
}
#proofsView .panel-head {
  margin-bottom: 8px;
}
.proofs-filters {
  align-items: center;
}
.proofs-filters .select,
.proofs-filters select.input {
  min-width: 148px;
  width: 100%;
  height: 40px;
  padding-inline-start: 12px;
  padding-inline-end: 34px;
  color: var(--text);
  background-color: #FFFFFF;
  line-height: 1.25;
  text-overflow: clip;
  white-space: nowrap;
}
.proofs-filters #proofsTypeFilter {
  min-width: 170px;
}
.proofs-filters #proofsDriverFilter {
  min-width: 185px;
}
.proofs-filters #proofsPhotoFilter {
  min-width: 165px;
}
.proofs-filters option {
  color: var(--text);
  background: #FFFFFF;
}
.proofs-summary-grid {
  margin-top: 0;
}

@media (max-width: 860px) {
  body:has(#proofsView.active) .topbar {
    align-items: stretch;
  }
  body:has(#proofsView.active) .topbar-search {
    max-width: none;
    min-width: 0;
  }
  .proofs-filters .select,
  .proofs-filters select.input {
    min-width: 0;
  }
}

/* ---------- Proofs view (UI-6.9: date/stat formatting) ---------- */
#proofsView .proof-driver-metrics span {
  display: grid;
  align-content: center;
  gap: 3px;
}
#proofsView .proof-driver-metrics b {
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
#proofsView .proof-driver-metrics .latest-proof-metric {
  min-width: 136px;
}
#proofsView .proof-driver-metrics .latest-proof-metric b {
  font-size: 11px;
  direction: rtl;
}
#proofsView .proof-driver-metrics small {
  line-height: 1.2;
}

/* ---------- Proofs view (UI-6.8: select text visibility fix) ---------- */
#proofsView .proofs-filters {
  grid-template-columns: minmax(300px, 1.6fr) minmax(210px, 0.9fr) minmax(240px, 1fr) minmax(210px, 0.9fr);
}
#proofsView .proofs-filters select.input,
#proofsView .proofs-filters .select {
  appearance: none;
  -webkit-appearance: none;
  direction: rtl;
  text-align: right;
  min-width: 0;
  height: 44px;
  line-height: 1.35;
  font-size: 14px;
  padding-top: 9px;
  padding-bottom: 9px;
  padding-right: 14px;
  padding-left: 42px;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23082F49' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 14px 14px;
}
#proofsView .proofs-filters #proofsTypeFilter,
#proofsView .proofs-filters #proofsPhotoFilter {
  min-width: 210px;
}
#proofsView .proofs-filters #proofsDriverFilter {
  min-width: 240px;
}

@media (max-width: 1180px) {
  #proofsView .proofs-filters {
    grid-template-columns: 1fr 1fr;
  }
  #proofsView .proofs-filters #proofsSearch {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  #proofsView .proofs-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  #proofsView .proofs-filters #proofsSearch {
    grid-column: auto;
  }
  #proofsView .proofs-filters select.input,
  #proofsView .proofs-filters .select,
  #proofsView .proofs-filters #proofsTypeFilter,
  #proofsView .proofs-filters #proofsDriverFilter,
  #proofsView .proofs-filters #proofsPhotoFilter {
    width: 100%;
    min-width: 0;
  }
}

/* ---------- Customers view (UI-8: management polish) ---------- */
#customersView .panel-head .actions-row {
  align-items: stretch;
}
#customersView .panel-head .actions-row .input {
  min-width: 165px;
}
#customersView #customersSearch {
  min-width: 260px;
}
.customer-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.customer-summary-card {
  border: 1px solid #DCEAF3;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFFFFF, #F8FAFC);
  padding: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}
.customer-summary-card strong {
  display: block;
  color: var(--navy);
  font-size: 24px;
  line-height: 1;
  margin-bottom: 6px;
}
.customer-summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.customers-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.85fr);
  gap: 14px;
  align-items: start;
}
.customers-table-wrap {
  margin: 0;
}
#customersView tbody tr.selected-row {
  background: #F0F9FF;
  box-shadow: inset 4px 0 0 #0EA5E9;
}
.customer-details-panel {
  position: sticky;
  top: 18px;
  border: 1px solid #DCEAF3;
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  padding: 16px;
  min-height: 280px;
}
.customer-panel-empty {
  min-height: 220px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #CBD5E1;
  border-radius: 14px;
  background: #F8FAFC;
  padding: 18px;
}
.customer-panel-empty strong {
  color: var(--navy);
  font-size: 17px;
}
.customer-panel-empty.small {
  min-height: 0;
  display: block;
  padding: 12px;
}
.customer-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.customer-panel-kicker {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}
.customer-panel-head h4 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 20px;
}
.customer-panel-head p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.customer-panel-alerts,
.customer-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.customer-panel-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.customer-panel-stats span {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  padding: 10px;
}
.customer-panel-stats b,
.customer-panel-stats small {
  display: block;
}
.customer-panel-stats b {
  color: var(--navy);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.customer-panel-stats small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  margin-top: 3px;
}
.customer-panel-details {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.customer-panel-details .proof-row {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #F8FAFC;
  padding: 9px 10px;
}
.customer-panel-details .k {
  color: var(--muted);
  font-weight: 900;
}
.customer-panel-details .v {
  color: var(--text);
  overflow-wrap: anywhere;
}
.customer-panel-orders {
  margin-top: 14px;
}
.customer-panel-section-title {
  color: var(--navy);
  font-weight: 900;
  margin-bottom: 8px;
}
.customer-panel-order {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid #E2E8F0;
  border-radius: 13px;
  background: #FFFFFF;
  padding: 10px;
  margin-bottom: 8px;
}
.customer-panel-order strong,
.customer-panel-order span {
  display: block;
}
.customer-panel-order strong {
  color: var(--navy);
}
.customer-panel-order span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.customer-panel-order-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.customers-single-row td {
  padding: 10px 14px;
  border-bottom: 1px dashed #DCEAF3;
  background: #F8FAFC;
}
.customer-location,
.customer-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid transparent;
  white-space: nowrap;
}
.customer-location.ok,
.customer-chip.info {
  color: #075985;
  background: #EFF6FF;
  border-color: #BAE6FD;
}
.customer-location.warn,
.customer-chip.warn {
  color: #92400E;
  background: #FFFBEB;
  border-color: #FDE68A;
}
.customer-chip.danger {
  color: #991B1B;
  background: #FEF2F2;
  border-color: #FECACA;
}
.customer-chip.muted-chip {
  color: #475569;
  background: #F1F5F9;
  border-color: #CBD5E1;
}
@media (max-width: 1100px) {
  .customer-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .customers-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-details-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  #customersView .panel-head .actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-panel-stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-panel-details .proof-row,
  .customer-panel-order {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-panel-order-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 8px;
  }
  .customer-panel-actions {
    flex-direction: column;
  }
  .customer-panel-actions .btn {
    width: 100%;
    text-align: center;
  }
  #customersView #customersSearch,
  #customersView .panel-head .actions-row .input {
    min-width: 0;
    width: 100%;
  }
}

/* Client MVP: barcode/QR lookup result card — light mode only, matches panel style. */
.lookup-result {
  margin-top: 16px;
}
.lookup-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}
.lookup-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #0f172a;
}
