/* ==========================================================================
   TRANSPORT BILL MANAGEMENT & COMPANY OWN FLEET LEDGER STYLES
   Designed with ultra-premium glassmorphism, exact header color palette,
   and seamless responsiveness matching the Labour Bill page architecture.
   ========================================================================== */

/* Main Page Container - Full Width Live Workspace */
.transport-page-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  max-height: calc(100vh - 54px);
  overflow: hidden;
  background: #f1f5f9;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
}

html.dark .transport-page-wrapper,
[data-theme="dark"] .transport-page-wrapper {
  background: #0c1017 !important;
  color: #F3F5F7 !important;
}

/* ==========================================================================
   Horizontal Top Control Panel: Ultra-Premium Glassmorphism Toolbar
   ========================================================================== */
.transport-control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  min-height: 56px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
  z-index: 25;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

html.dark .transport-control-panel,
[data-theme="dark"] .transport-control-panel {
  background: rgba(15, 23, 42, 0.88) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

/* LEFT: Brand Icon, Title & Badges, Fleet & Period Pickers */
.transport-cp-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.transport-cp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transport-cp-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid rgba(59, 130, 246, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
  transition: transform 0.2s ease;
}

.transport-cp-icon:hover {
  transform: scale(1.05);
}

html.dark .transport-cp-icon,
[data-theme="dark"] .transport-cp-icon {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0.1) 100%) !important;
  border-color: rgba(96, 165, 250, 0.3) !important;
  color: #60a5fa !important;
}

.transport-cp-title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.transport-cp-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

html.dark .transport-cp-title,
[data-theme="dark"] .transport-cp-title {
  color: #F3F5F7 !important;
}

.transport-cp-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tb-studio-badge {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.22);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  line-height: 1.3;
  letter-spacing: 0.1px;
}

html.dark .tb-studio-badge,
[data-theme="dark"] .tb-studio-badge {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}

.tb-studio-chip {
  background: rgba(5, 150, 105, 0.08);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.22);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  line-height: 1.3;
  letter-spacing: 0.1px;
}

html.dark .tb-studio-chip,
[data-theme="dark"] .tb-studio-chip {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Vehicle Fleet Selector in Topbar */
.transport-vehicle-box {
  display: inline-flex;
  align-items: center;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 6px;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.transport-vehicle-box:hover {
  border-color: #2563eb;
  background: #ffffff;
}

html.dark .transport-vehicle-box,
[data-theme="dark"] .transport-vehicle-box {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.transport-vehicle-icon {
  color: #2563eb;
  font-size: 12px;
}

/* Period Selector Box */
.transport-period-box {
  display: inline-flex;
  align-items: center;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 4px;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.transport-period-box:hover {
  border-color: #94a3b8;
  background: #ffffff;
}

html.dark .transport-period-box,
[data-theme="dark"] .transport-period-box {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.transport-glass-select,
.transport-glass-input {
  height: 30px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  outline: none;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.transport-glass-select:hover,
.transport-glass-input:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.transport-glass-select:focus,
.transport-glass-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

html.dark .transport-glass-select,
html.dark .transport-glass-input,
[data-theme="dark"] .transport-glass-select,
[data-theme="dark"] .transport-glass-input {
  background: #171f2e !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
}

html.dark .transport-glass-select:hover,
html.dark .transport-glass-input:hover,
[data-theme="dark"] .transport-glass-select:hover,
[data-theme="dark"] .transport-glass-input:hover {
  border-color: #60a5fa !important;
  background: #1e293b !important;
}

.transport-range-sep {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  padding: 0 2px;
  user-select: none;
}

/* RIGHT: Tools & Action Buttons */
.transport-cp-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transport-icon-tools-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.transport-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.transport-icon-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #94a3b8;
}

html.dark .transport-icon-btn,
[data-theme="dark"] .transport-icon-btn {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

html.dark .transport-icon-btn:hover,
[data-theme="dark"] .transport-icon-btn:hover {
  background: #334155 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Transport Header Sync Button Animation */
.transport-icon-btn.btn-sync-icon:hover i {
  animation: tbSyncHoverRotate 0.6s ease forwards;
}

.transport-icon-btn.syncing i,
.transport-icon-btn.btn-sync-icon.syncing i {
  animation: tbSpinSync 1s linear infinite !important;
}

@keyframes tbSyncHoverRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(180deg); }
}

@keyframes tbSpinSync {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.transport-badge-counter {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: 1.5px solid #ffffff;
}

/* Density / Font Size Adjuster */
.transport-density-control {
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
  height: 30px;
}

html.dark .transport-density-control,
[data-theme="dark"] .transport-density-control {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.transport-size-btn {
  background: transparent;
  border: none;
  width: 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.1s ease;
}

.transport-size-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html.dark .transport-size-btn:hover,
[data-theme="dark"] .transport-size-btn:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

.transport-size-val {
  font-size: 10.5px;
  font-weight: 700;
  color: #334155;
  padding: 0 6px;
  user-select: none;
}

html.dark .transport-size-val,
[data-theme="dark"] .transport-size-val {
  color: #e2e8f0 !important;
}

.transport-toolbar-divider {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 2px;
}

html.dark .transport-toolbar-divider,
[data-theme="dark"] .transport-toolbar-divider {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* Action Buttons (Save, Excel, PDF, Print) */
.transport-action-buttons-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.transport-action-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-action-save {
  background: #3b82f6;
  color: #ffffff;
  border-color: #2563eb;
}
.btn-action-save:hover {
  background: #2563eb;
}

.btn-action-excel {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}
.btn-action-excel:hover {
  background: #059669;
}

.btn-action-pdf {
  background: #f43f5e;
  color: #ffffff;
  border-color: #e11d48;
}
.btn-action-pdf:hover {
  background: #e11d48;
}

.btn-action-print {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.btn-action-print:hover {
  background: #1e293b;
}

html.dark .btn-action-print,
[data-theme="dark"] .btn-action-print {
  background: #334155 !important;
  color: #ffffff !important;
  border-color: #475569 !important;
}

/* ==========================================================================
   MAIN LIVE TABLE WORKSPACE & BANNER
   ========================================================================== */
.transport-table-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 16px;
  box-sizing: border-box;
  gap: 10px;
}

/* Company Header & KPI Stats Banner */
.tb-editor-banner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px -1px rgba(15, 23, 42, 0.05);
  flex-shrink: 0;
}

html.dark .tb-editor-banner,
[data-theme="dark"] .tb-editor-banner {
  background: #131926 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.tb-banner-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tb-banner-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.tb-banner-company {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

html.dark .tb-banner-company,
[data-theme="dark"] .tb-banner-company {
  color: #f8fafc !important;
}

.tb-banner-addr {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.tb-banner-duration {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  margin-top: 3px;
}

.tb-banner-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tb-stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 95px;
}

html.dark .tb-stat-box,
[data-theme="dark"] .tb-stat-box {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.tb-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.tb-stat-num {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 2px;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

html.dark .tb-stat-num,
[data-theme="dark"] .tb-stat-num {
  color: #f8fafc !important;
}

.tb-stat-num.blue {
  color: #2563eb;
}
.tb-stat-num.green {
  color: #059669;
}
.tb-stat-num.amber {
  color: #d97706;
}

/* Marked Row Floating Bar */
.tb-marked-row-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  animation: fadeInDown 0.2s ease;
}

.tb-marked-row-bar.show {
  display: flex;
}

.tb-marked-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.tb-marked-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-marked-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.tb-marked-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tb-marked-btn-del {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.tb-marked-btn-del:hover {
  background: #ef4444;
  color: #ffffff;
}

/* ==========================================================================
   CONTINUOUS INTERACTIVE DATA TABLE (PIXEL-PERFECT COLUMN TINTS)
   ========================================================================== */
.transport-table-wrap {
  flex: 1;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  position: relative;
}

html.dark .transport-table-wrap,
[data-theme="dark"] .transport-table-wrap {
  background: #111827 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.transport-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  table-layout: auto;
}

/* Sticky Headers with Multi-line Wrapping & Column Resizer */
.transport-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.transport-table thead th {
  padding: 6px 4px;
  font-weight: 700;
  text-align: center;
  border-right: 1px solid #94a3b8;
  border-bottom: 2px solid #475569;
  letter-spacing: 0.2px;
  font-size: 10px;
  text-transform: uppercase;
  user-select: none;
  white-space: normal !important;
  line-height: 1.25 !important;
  word-break: break-word !important;
  vertical-align: middle;
  position: relative;
}

/* Interactive Column Resizer Handle */
.tb-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  bottom: 0;
  cursor: col-resize;
  user-select: none;
  z-index: 5;
  transition: background-color 0.15s ease;
}

.tb-col-resizer:hover,
.tb-col-resizer.is-resizing {
  background: #2563eb !important;
  opacity: 0.85;
}

/* Interactive Row Resizer Handle */
.tb-row-resizer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  cursor: row-resize;
  user-select: none;
  z-index: 4;
}

.tb-row-resizer:hover,
.tb-row-resizer.is-resizing {
  background: #2563eb !important;
  opacity: 0.7;
}

/* 2-line text clamp with ellipsis */
.tb-cell-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  max-height: 2.6em;
  word-break: break-word;
}

/* Prominent Vehicle & Driver Card for Single Vehicle View */
.tb-banner-vehicle-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  padding: 6px 14px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .tb-banner-vehicle-card,
[data-theme="dark"] .tb-banner-vehicle-card {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.35) 0%, rgba(6, 78, 59, 0.18) 100%) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
}

.tb-veh-chip-badge {
  font-size: 13px;
  font-weight: 800;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

html.dark .tb-veh-chip-badge,
[data-theme="dark"] .tb-veh-chip-badge {
  color: #6ee7b7 !important;
}

.tb-veh-driver-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
  padding-left: 10px;
}

html.dark .tb-veh-driver-info,
[data-theme="dark"] .tb-veh-driver-info {
  border-left-color: rgba(255, 255, 255, 0.15) !important;
}

.tb-driver-name {
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 5px;
}

html.dark .tb-driver-name,
[data-theme="dark"] .tb-driver-name {
  color: #f1f5f9 !important;
}

.tb-driver-phone {
  color: #059669;
  font-weight: 600;
  font-family: 'JetBrains Mono', Consolas, monospace;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

/* EXACT USER SCREENSHOT COLOR SCHEME FOR HEADERS */
/* Neutral group: SL, DATE, TRUCK NO, PARTY NAME, ADDRESS */
.transport-table thead th.th-neutral {
  background: #f8fafc;
  color: #1e293b;
}

/* Approved Location: Soft Cyan/Blue */
.transport-table thead th.th-approved-loc {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-left: 1px solid #bae6fd;
  border-right: 1px solid #bae6fd;
}

.transport-table td.td-approved-loc {
  background: rgba(224, 242, 254, 0.35);
  font-weight: 600;
  color: #0369a1;
}

html.dark .transport-table thead th.th-approved-loc,
[data-theme="dark"] .transport-table thead th.th-approved-loc {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
}

html.dark .transport-table td.td-approved-loc,
[data-theme="dark"] .transport-table td.td-approved-loc {
  background: rgba(12, 74, 110, 0.25);
  color: #7dd3fc;
}

/* Soft Green: QTY */
.transport-table thead th.th-qty {
  background: #d4edda !important;
  color: #155724 !important;
  border-left: 2px solid #28a745;
  border-right: 2px solid #28a745;
}

/* Light Blue: KM OPENING, KM CLOSING, TOTAL KM, DIESEL */
.transport-table thead th.th-km-group {
  background: #cfe2ff !important;
  color: #084298 !important;
  border-right: 1px solid #9ec5fe;
}
.transport-table thead th.th-km-group.th-last {
  border-right: 2px solid #0d6efd;
}

/* Neutral Grey: DIESEL PRICE, DRIVER COMMISSION, HELPER COMMISSION, POLICE, M.COST, SUBSCRIPTION, FOODING, MOBILE BILL */
.transport-table thead th.th-expenses-group {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border-right: 1px solid #cbd5e1;
}

/* Soft Yellow/Gold: TOTAL EXPENSIVE */
.transport-table thead th.th-total-expenses {
  background: #fff3cd !important;
  color: #856404 !important;
  border-left: 2px solid #ffc107;
  border-right: 1px solid #ffeeba;
}

/* Soft Yellow/Gold: TRUCK FAIR */
.transport-table thead th.th-truck-fare {
  background: #fff3cd !important;
  color: #856404 !important;
  border-right: 2px solid #ffc107;
}

/* Fresh Vibrant Green: TOTAL INCOME */
.transport-table thead th.th-total-income {
  background: #c3e6cb !important;
  color: #155724 !important;
  border-right: 1px solid #28a745;
}

/* Dark mode adapt header styles */
html.dark .transport-table thead th.th-neutral,
[data-theme="dark"] .transport-table thead th.th-neutral {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

html.dark .transport-table thead th.th-qty,
[data-theme="dark"] .transport-table thead th.th-qty {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}

html.dark .transport-table thead th.th-km-group,
[data-theme="dark"] .transport-table thead th.th-km-group {
  background: #1e3a8a !important;
  color: #bfdbfe !important;
}

html.dark .transport-table thead th.th-expenses-group,
[data-theme="dark"] .transport-table thead th.th-expenses-group {
  background: #334155 !important;
  color: #cbd5e1 !important;
}

html.dark .transport-table thead th.th-total-expenses,
[data-theme="dark"] .transport-table thead th.th-total-expenses,
html.dark .transport-table thead th.th-truck-fare,
[data-theme="dark"] .transport-table thead th.th-truck-fare {
  background: #78350f !important;
  color: #fde68a !important;
}

html.dark .transport-table thead th.th-total-income,
[data-theme="dark"] .transport-table thead th.th-total-income {
  background: #064e3b !important;
  color: #6ee7b7 !important;
}

/* Table Body Rows */
.transport-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.1s ease;
}

.transport-table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.transport-table tbody tr:hover {
  background: #f0f7ff !important;
}

html.dark .transport-table tbody tr,
[data-theme="dark"] .transport-table tbody tr {
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
  background: #111827;
}

html.dark .transport-table tbody tr:nth-child(even),
[data-theme="dark"] .transport-table tbody tr:nth-child(even) {
  background: #151e2e;
}

html.dark .transport-table tbody tr:hover,
[data-theme="dark"] .transport-table tbody tr:hover {
  background: #1e293b !important;
}

.transport-table tbody tr.row-selected {
  background: #e0f2fe !important;
}

html.dark .transport-table tbody tr.row-selected,
[data-theme="dark"] .transport-table tbody tr.row-selected {
  background: rgba(14, 165, 233, 0.2) !important;
}

.transport-table td {
  padding: 0 !important;
  border-right: 1px solid #cbd5e1;
  vertical-align: middle;
  font-family: inherit;
  height: 42px;
  position: relative;
  box-sizing: border-box;
}

html.dark .transport-table td,
[data-theme="dark"] .transport-table td {
  border-right-color: rgba(255, 255, 255, 0.1) !important;
}

/* Cell Alignment Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-mono {
  font-family: 'JetBrains Mono', Consolas, monospace !important;
}

/* Read-only / Calculated static cell wrapper */
.tb-cell-static {
  width: 100%;
  height: 100%;
  min-height: 42px;
  padding: 6px 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  font-weight: 700;
}
.tb-cell-static.justify-center { justify-content: center; }
.tb-cell-static.justify-end { justify-content: flex-end; }
.tb-cell-static.justify-start { justify-content: flex-start; }

/* Table Editable Multi-Line Textarea (Party Name, Address, Approved Location) */
.tb-cell-textarea {
  width: 100%;
  height: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  font-size: 11px;
  font-family: inherit;
  color: inherit;
  border-radius: 0;
  outline: none;
  box-sizing: border-box;
  resize: none;
  line-height: 1.35;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tb-cell-textarea:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* FULL-CELL EDGE-TO-EDGE SELECTION ON FOCUS */
.tb-cell-textarea:focus {
  background: #ffffff !important;
  border: 2px solid #2563eb !important;
  box-shadow: inset 0 0 0 1px #2563eb !important;
  color: #0f172a !important;
  overflow-y: auto;
  z-index: 10;
  position: relative;
}

html.dark .tb-cell-textarea:focus {
  background: #1e293b !important;
  border-color: #60a5fa !important;
  box-shadow: inset 0 0 0 1px #60a5fa !important;
  color: #ffffff !important;
}

/* Table Editable Single-Line Inputs (Numbers, Dates, etc.) */
.tb-cell-input {
  width: 100%;
  height: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  font-size: 11.5px;
  font-family: inherit;
  color: inherit;
  border-radius: 0;
  outline: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tb-cell-input:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* FULL-CELL EDGE-TO-EDGE SELECTION ON FOCUS */
.tb-cell-input:focus {
  background: #ffffff !important;
  border: 2px solid #2563eb !important;
  box-shadow: inset 0 0 0 1px #2563eb !important;
  color: #0f172a !important;
  z-index: 10;
  position: relative;
}

html.dark .tb-cell-input:hover,
[data-theme="dark"] .tb-cell-input:hover {
  background: rgba(30, 41, 59, 0.8) !important;
}

html.dark .tb-cell-input:focus,
[data-theme="dark"] .tb-cell-input:focus {
  background: #1e293b !important;
  border-color: #60a5fa !important;
  box-shadow: inset 0 0 0 1px #60a5fa !important;
  color: #ffffff !important;
}

/* Highlighted Column Backgrounds in Table Body */
.transport-table td.td-qty {
  background: rgba(212, 237, 218, 0.25);
  font-weight: 700;
  color: #155724;
}

.transport-table td.td-km {
  background: rgba(207, 226, 255, 0.22);
}

.transport-table td.td-expenses {
  background: rgba(255, 243, 205, 0.3);
  font-weight: 700;
  color: #92400e;
}

.transport-table td.td-fare {
  background: rgba(255, 243, 205, 0.35);
  font-weight: 700;
  color: #854d0e;
}

.transport-table td.td-income {
  background: rgba(195, 230, 203, 0.35);
  font-weight: 800;
  color: #065f46;
}

html.dark .transport-table td.td-qty,
[data-theme="dark"] .transport-table td.td-qty {
  background: rgba(6, 78, 59, 0.25);
  color: #a7f3d0;
}

html.dark .transport-table td.td-km,
[data-theme="dark"] .transport-table td.td-km {
  background: rgba(30, 58, 138, 0.25);
}

html.dark .transport-table td.td-expenses,
[data-theme="dark"] .transport-table td.td-expenses,
html.dark .transport-table td.td-fare,
[data-theme="dark"] .transport-table td.td-fare {
  background: rgba(120, 53, 15, 0.25);
  color: #fef08a;
}

html.dark .transport-table td.td-income,
[data-theme="dark"] .transport-table td.td-income {
  background: rgba(6, 78, 59, 0.3);
  color: #6ee7b7;
}

/* Table Footer (Totals) */
.transport-table tfoot {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: #f8fafc;
  border-top: 2px solid #475569;
}

html.dark .transport-table tfoot,
[data-theme="dark"] .transport-table tfoot {
  background: #171f2e !important;
  border-top-color: rgba(255, 255, 255, 0.2) !important;
}

.transport-table tfoot td {
  padding: 8px 6px;
  font-weight: 800;
  border-right: 1px solid #cbd5e1;
  font-size: 11.5px;
}

html.dark .transport-table tfoot td,
[data-theme="dark"] .transport-table tfoot td {
  border-right-color: rgba(255, 255, 255, 0.1);
}

/* Modals & Popovers */
.transport-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.transport-modal-card {
  background: #ffffff;
  border-radius: 4px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.15s ease;
}

html.dark .transport-modal-card,
[data-theme="dark"] .transport-modal-card {
  background: #1e293b !important;
  color: #f8fafc !important;
}

.transport-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

html.dark .transport-modal-header,
[data-theme="dark"] .transport-modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

.transport-modal-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transport-modal-body {
  padding: 18px;
  max-height: 70vh;
  overflow-y: auto;
}

.transport-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
}

html.dark .transport-modal-footer,
[data-theme="dark"] .transport-modal-footer {
  background: #171f2e !important;
  border-top-color: rgba(255, 255, 255, 0.1) !important;
}

/* Column Picker Dropdown Popover */
.transport-popover-anchor {
  position: relative;
}

.transport-dropdown-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15);
  z-index: 100;
  padding: 10px;
}

html.dark .transport-dropdown-popover,
[data-theme="dark"] .transport-dropdown-popover {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.tb-col-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-top: 6px;
}

.tb-col-toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #334155;
  cursor: pointer;
}

html.dark .tb-col-toggle-item,
[data-theme="dark"] .tb-col-toggle-item {
  color: #cbd5e1 !important;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   RATE SETTINGS & DELIVERY AREA CONFIGURATION STYLES
   ========================================================================== */
.tb-rates-card {
  max-width: 1220px !important;
  width: 95vw !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 4px !important;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.22) !important;
  border: 1px solid #cbd5e1 !important;
}

html.dark .tb-rates-card,
[data-theme="dark"] .tb-rates-card {
  background: #0f172a !important;
  border-color: #334155 !important;
}

.tb-rates-modal-header {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

html.dark .tb-rates-modal-header,
[data-theme="dark"] .tb-rates-modal-header {
  background: #1e293b !important;
  border-bottom-color: #334155 !important;
}

.tb-rates-title-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
}

html.dark .tb-rates-title-icon,
[data-theme="dark"] .tb-rates-title-icon {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
}

.tb-rates-title-text {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

html.dark .tb-rates-title-text,
[data-theme="dark"] .tb-rates-title-text {
  color: #f8fafc !important;
}

.tb-rates-subtitle-text {
  font-size: 11.5px;
  color: #64748b;
}

html.dark .tb-rates-subtitle-text,
[data-theme="dark"] .tb-rates-subtitle-text {
  color: #94a3b8 !important;
}

.tb-rates-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 12px;
}

html.dark .tb-rates-subbar,
[data-theme="dark"] .tb-rates-subbar {
  background: #172033 !important;
  border-bottom-color: #334155 !important;
}

.tb-rates-tabs {
  display: flex;
  gap: 6px;
}

.tb-rate-tab-btn {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.tb-rate-tab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.tb-rate-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

html.dark .tb-rate-tab-btn,
[data-theme="dark"] .tb-rate-tab-btn {
  background: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}

html.dark .tb-rate-tab-btn:hover,
[data-theme="dark"] .tb-rate-tab-btn:hover {
  background: #2d3748 !important;
  color: #ffffff !important;
}

html.dark .tb-rate-tab-btn.active,
[data-theme="dark"] .tb-rate-tab-btn.active {
  background: #3b82f6 !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
}

.tb-rates-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}

html.dark .tb-rates-active-pill,
[data-theme="dark"] .tb-rates-active-pill {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.tb-rates-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.tb-rates-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  background: #f8fafc;
}

html.dark .tb-rates-modal-body,
[data-theme="dark"] .tb-rates-modal-body {
  background: #0b1120 !important;
}

.tb-rates-layout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .tb-rates-layout-grid {
    grid-template-columns: 1fr;
  }
}

.tb-card-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.dark .tb-card-panel,
[data-theme="dark"] .tb-card-panel {
  background: #1e293b !important;
  border-color: #334155 !important;
}

.tb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

html.dark .tb-panel-header,
[data-theme="dark"] .tb-panel-header {
  border-bottom-color: #334155 !important;
}

.tb-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

html.dark .tb-panel-title,
[data-theme="dark"] .tb-panel-title {
  color: #f1f5f9 !important;
}

.tb-panel-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

html.dark .tb-panel-badge,
[data-theme="dark"] .tb-panel-badge {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

.tb-unit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tb-rate-field-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tb-rate-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

html.dark .tb-rate-field-label,
[data-theme="dark"] .tb-rate-field-label {
  color: #94a3b8 !important;
}

.tb-rate-input-clean {
  height: 34px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tb-rate-input-clean:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

html.dark .tb-rate-input-clean,
[data-theme="dark"] .tb-rate-input-clean {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #334155 !important;
}

.tb-rate-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.tb-rate-curr {
  position: absolute;
  left: 9px;
  font-weight: 700;
  font-size: 12px;
  color: #64748b;
  pointer-events: none;
}

.tb-rate-suffix {
  position: absolute;
  right: 9px;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  pointer-events: none;
}

.tb-rate-input {
  width: 100%;
  height: 34px;
  padding-left: 22px;
  padding-right: 50px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tb-rate-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

html.dark .tb-rate-input,
[data-theme="dark"] .tb-rate-input {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #334155 !important;
}

.tb-metrics-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.tb-metric-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 12px;
  text-align: center;
}

html.dark .tb-metric-box,
[data-theme="dark"] .tb-metric-box {
  background: #0f172a !important;
  border-color: #334155 !important;
}

.tb-metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}

.tb-metric-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

html.dark .tb-metric-value,
[data-theme="dark"] .tb-metric-value {
  color: #ffffff !important;
}

.tb-metric-value small {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.tb-metric-sub {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.tb-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 11.5px;
  color: #1e40af;
  line-height: 1.4;
}

html.dark .tb-info-banner,
[data-theme="dark"] .tb-info-banner {
  background: rgba(30, 58, 138, 0.25) !important;
  border-color: rgba(96, 165, 250, 0.3) !important;
  color: #bfdbfe !important;
}

.tb-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
}

html.dark .tb-table-wrapper,
[data-theme="dark"] .tb-table-wrapper {
  background: #1e293b !important;
  border-color: #334155 !important;
}

.tb-clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.tb-clean-table thead th {
  background: #f8fafc;
  padding: 8px 10px;
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 2;
}

html.dark .tb-clean-table thead th,
[data-theme="dark"] .tb-clean-table thead th {
  background: #172033 !important;
  color: #cbd5e1 !important;
  border-bottom-color: #334155 !important;
}

.tb-clean-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

html.dark .tb-clean-table tbody td,
[data-theme="dark"] .tb-clean-table tbody td {
  border-bottom-color: #334155 !important;
}

.tb-clean-table tbody tr:hover {
  background: #f8fafc;
}

html.dark .tb-clean-table tbody tr:hover,
[data-theme="dark"] .tb-clean-table tbody tr:hover {
  background: #27354a !important;
}

.badge-status-pill {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-active {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

html.dark .badge-active,
[data-theme="dark"] .badge-active {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.badge-historic {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

html.dark .badge-historic,
[data-theme="dark"] .badge-historic {
  background: #334155 !important;
  color: #94a3b8 !important;
  border-color: #475569 !important;
}

.badge-scheduled {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

html.dark .badge-scheduled,
[data-theme="dark"] .badge-scheduled {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.tb-rates-modal-footer {
  padding: 12px 22px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

html.dark .tb-rates-modal-footer,
[data-theme="dark"] .tb-rates-modal-footer {
  background: #1e293b !important;
  border-top-color: #334155 !important;
}

/* ==========================================================================
   PRINT ENGINE STYLES FOR TRANSPORT BILL
   ========================================================================== */
@media print {
  body.printing-transport-bill > *:not(#transportPrintModal) {
    display: none !important;
  }
  body.printing-transport-bill {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.printing-transport-bill #transportPrintModal {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
  }
}
