:root {
  /* Industrial Emerald - Professional Green Theme */
  --primary: #059669;        /* Medium Green */
  --primary-dark: #064e3b;   /* Deep Forest Green */
  --primary-light: #ecfdf5;  /* Soft Mint Tint */

  --secondary: #64748b;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  --sidebar-bg: #062019;     /* Ultra Dark Green */
  --sidebar-text: #a7f3d0;   /* Light Mint Text */
  --sidebar-hover: #064e3b;
  --sidebar-active: #10b981;

  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--body-bg) !important;
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell { display: flex; min-height: 100vh; }

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 95;
  display: none;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block;
}

/* Fixed Sidebar - Refined */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.brand {
  padding: 40px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.brand i {
  width: 44px; height: 44px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: grid; place-items: center; border-radius: var(--radius-md); font-size: 22px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.nav-menu {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

/* Custom Scrollbar for Sidebar Menu */
.nav-menu::-webkit-scrollbar {
  width: 5px;
}
.nav-menu::-webkit-scrollbar-track {
  background: transparent;
}
.nav-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.nav-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
.nav-menu button {
  background: transparent; border: none; color: var(--sidebar-text);
  padding: 14px 18px; border-radius: var(--radius-md); text-align: left;
  font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.8;
}
.nav-menu button i { font-size: 18px; width: 24px; text-align: center; }

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  font-weight: 800;
  padding: 20px 18px 8px 18px;
  opacity: 0.6;
}

.nav-menu button:hover {
  background: var(--sidebar-hover);
  color: #fff;
  opacity: 1;
  transform: translateX(4px);
}
.nav-menu button.active {
  background: var(--primary);
  color: #fff;
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar-footer {
  padding: 20px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.user-profile-mini {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.user-avatar-circle {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.user-info-mini {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-info-mini .name {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.user-info-mini .role {
  font-size: 11px;
  color: var(--sidebar-text);
  font-weight: 500;
}

.btn-signout {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  padding: 10px;
  border-radius: var(--radius-md);
  text-decoration: none;
  display: block;
  text-align: center;
  width: 100%;
}

.btn-signout:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Main Content Area */
.main { margin-left: 280px; flex: 1; min-width: 0; }
.topbar {
  height: 70px; background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
  display: flex; align-items: center;
  justify-content: space-between; padding: 0 40px; border-bottom: 1px solid var(--border-color);
  position: sticky; top: 0; z-index: 90;
}

/* Dashboard Section */
.page-section { padding: 40px; display: none; animation: fadeIn 0.4s ease-out; }
.page-section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dashboard-header { margin-bottom: 40px; }
.dashboard-header h1 { font-size: 32px; font-weight: 800; margin: 0; color: var(--primary-dark); }

/* Stat Cards - Modern Look */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 40px; }
.stat-card {
  background: #fff; padding: 28px; border-radius: var(--radius-lg);
  border: 1px solid var(--border-color); box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}
.stat-card:hover { transform: translateY(-5px); }
.stat-value { font-size: 36px; font-weight: 900; line-height: 1; margin: 12px 0; letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

/* Dashboard Layout */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 32px; }
.card {
  background: #fff; border-radius: var(--radius-lg);
  border: 1px solid var(--border-color); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 20px 28px; background: #fff; border-bottom: 1px solid var(--border-color);
  font-weight: 700; font-size: 16px; color: var(--primary-dark);
}
.card-body { padding: 28px; }

/* Truck Schematic - Real Telemetry UI Look */
.truck-diagram-container {
  background: #f8fafc;
  border-radius: var(--radius-lg);
  padding: 60px 40px 140px 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 650px;
  overflow: hidden;
}

@media (max-width: 576px) {
  .truck-diagram-container {
    padding: 40px 10px 120px 10px;
    min-height: 550px;
  }
}

/* Realistic Mechanical Chassis UI */
.truck-outline {
  width: 90px; /* Narrow rails */
  height: 540px;
  background: #0f172a;
  border-left: 12px solid #334155;
  border-right: 12px solid #334155;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  overflow: visible;
  margin: 0 auto;
}

/* Cross-members */
.truck-outline::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 95px, rgba(255,255,255,0.05) 95px, rgba(255,255,255,0.05) 100px);
  z-index: 1;
}

/* Engine / Transmission Block */
.truck-outline::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 20px;
  width: 54px;
  height: 90px;
  background: linear-gradient(180deg, #475569, #1e293b);
  transform: translateX(-50%);
  border-radius: 8px 8px 20px 20px;
  border: 2px solid #64748b;
  z-index: 5;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* Axle Pipes - Realistic Gradient */
.axle-bar {
  position: absolute;
  left: -85px;
  right: -85px;
  height: 14px;
  background: linear-gradient(180deg, #1e293b, #94a3b8 50%, #1e293b);
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Differential Housing */
.diff-bulge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  background: radial-gradient(circle at 30% 30%, #64748b, #0f172a);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #334155;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}

/* Drive Shaft */
.drive-shaft {
  position: absolute;
  left: 50%;
  top: 110px;
  bottom: 80px;
  width: 8px;
  background: linear-gradient(90deg, #334155, #64748b, #334155);
  transform: translateX(-50%);
  z-index: 3;
  border-radius: 4px;
}

/* Heavy Duty Tires */
.tire-rect {
  width: 44px;
  height: 72px;
  background: #1e293b;
  position: absolute;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 12px rgba(0,0,0,0.4);
  z-index: 10;
}

.tire-rect::after {
  content: "";
  width: 20px;
  height: 34px;
  border: 2px solid rgba(255,255,255,0.05);
  border-radius: 4px;
}

.axle-bar.steer { height: 10px; background: #475569; }
.axle-bar.drive-1 { }
.axle-bar.drive-2 { }

/* Differential Bulge */
.diff-bulge {
  position: absolute;
  left: 50%;
  width: 24px;
  height: 24px;
  background: radial-gradient(circle at 30% 30%, #64748b, #1e293b);
  border-radius: 50%;
  transform: translate(-50%, -8px);
  border: 2px solid #334155;
}

.axle-label {
  position: absolute;
  width: 100%;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 5;
}

/* Reserve Tire Slot */
.reserve-tire-slot {
  position: absolute;
  bottom: -90px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 80px;
  border: 2px dashed #334155;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.05);
}

.reserve-tire-slot .label {
  font-size: 9px;
  font-weight: 900;
  color: #64748b;
  margin-top: 5px;
  text-transform: uppercase;
}

.tire-rect {
  width: 38px;
  height: 62px;
  background: #334155;
  position: absolute;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.tire-rect:hover {
  transform: scale(1.05);
  z-index: 10;
  filter: brightness(1.2);
}

.status-new {
  background: #10b981 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.6);
  border-color: #064e3b !important;
}

.status-warn {
  background: #f59e0b !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
  border-color: #78350f !important;
}

.status-danger {
  background: #ef4444 !important;
  animation: pulse-red-industrial 2s infinite;
  border-color: #7f1d1d !important;
}

@keyframes pulse-red-industrial {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.status-unknown {
  background: #334155;
  opacity: 0.6;
}

.status-warn { background: #f59e0b !important; }
.status-danger {
  background: #ef4444 !important;
  animation: pulse-red 2s infinite;
}
.status-unknown { background: #475569; opacity: 0.8; }

.tire-rect .tire-sn-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
  opacity: 0.9;
  z-index: 12;
}

.tire-rect:hover .tire-sn-label {
  opacity: 1;
  font-size: 9px;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Tables & Lists */
.list-group-item {
  padding: 16px 24px; border-left: none; border-right: none;
  transition: background 0.2s;
}
.list-group-item:hover { background: var(--primary-light); }
.badge { font-weight: 600; padding: 6px 12px; border-radius: 20px; }

/* DataTables & Table Professional Styling */
.dataTables_wrapper {
  padding: 20px 0;
}

table.dataTable {
  border-collapse: separate !important;
  border-spacing: 0 8px !important; /* Space between rows */
  width: 100% !important;
  margin: 0 !important;
}

table.dataTable thead th {
  background: var(--body-bg) !important;
  color: var(--text-muted) !important;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 20px !important;
  border: none !important;
}

table.dataTable tbody tr {
  background-color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
}

table.dataTable tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  background-color: var(--primary-light) !important;
}

table.dataTable tbody td {
  padding: 16px 20px !important;
  vertical-align: middle !important;
  border-top: 1px solid var(--border-color) !important;
  border-bottom: 1px solid var(--border-color) !important;
  color: var(--text-main);
  font-size: 14px;
}

table.dataTable tbody td:first-child {
  border-left: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

table.dataTable tbody td:last-child {
  border-right: 1px solid var(--border-color) !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Custom Search Box */
.dataTables_filter {
  margin-bottom: 20px;
}

.dataTables_filter input {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  padding: 8px 16px !important;
  outline: none !important;
  transition: 0.2s;
  width: 300px !important;
}

.dataTables_filter input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px var(--primary-light) !important;
}

/* Theme Alignment - Fix Blue Pagination & Alignment */
.page-item.active .page-link {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.page-link, .page-link:hover, .page-link:focus {
  color: var(--primary-dark) !important;
  box-shadow: none !important;
}

.page-item.active .page-link {
  color: #fff !important;
}

/* Professional Table Enhancements */
table.dataTable thead th {
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-size: 10px;
  letter-spacing: 1.2px;
  padding: 15px 12px !important;
  border-bottom: 2px solid var(--border-color) !important;
  text-align: left;
}

table.dataTable tbody td {
  padding: 14px 12px !important;
  font-size: 13px;
  vertical-align: middle;
}

/* Fix Search Box UI */
.dataTables_filter {
  float: right;
  margin-bottom: 25px;
}

.dataTables_filter input {
  border: 1.5px solid var(--border-color) !important;
  border-radius: 30px !important;
  padding: 8px 20px !important;
  width: 250px !important;
  background: #fff;
  transition: all 0.3s ease;
}

.dataTables_filter input:focus {
  width: 320px !important;
  border-color: var(--primary) !important;
}

/* Fix QR and Action alignment */
.qr-container {
  width: 42px;
  height: 42px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.action-cell {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Enhanced Checklist UI */
.checklist-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.checklist-table thead th {
  background: #f8fafc !important;
  border: 1px solid var(--border-color) !important;
}

.checklist-table thead th.slanted {
  height: 160px;
  vertical-align: bottom;
  padding: 10px 0 !important;
  min-width: 42px;
  max-width: 42px;
  position: relative;
}

.checklist-table thead th.slanted > span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: left;
  display: inline-block;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--primary-dark);
  letter-spacing: 0.5px;
  margin: 0 auto;
}

.checklist-table tbody td {
  padding: 12px 8px !important;
  font-size: 13px;
  border: 1px solid var(--border-color) !important;
  transition: background 0.2s;
  text-align: center;
  vertical-align: middle;
}

.checklist-table tbody tr:hover td {
  background-color: var(--primary-light) !important;
}

.checklist-table td.sticky-col-left,
.checklist-table th.sticky-col-left {
  position: sticky;
  left: 0;
  z-index: 5;
  text-align: left;
  min-width: 150px;
  background-color: #fff !important;
}

.checklist-table td:nth-child(2),
.checklist-table th:nth-child(2) {
  left: 150px;
  border-right: 2px solid var(--border-color) !important;
}

.checklist-table td.fw-bold {
  color: var(--primary-dark);
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.5px;
}

/* Value Styling */
.checklist-table td:not(.sticky-col-left) {
  font-weight: 700;
  color: #1e293b;
}

.checklist-table td.qty-zero {
  color: #e2e8f0 !important;
  font-weight: 400 !important;
}

/* Action Button Emerald Style */
.checklist-table .btn-icon {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--primary);
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  transition: 0.2s;
}

.checklist-table .btn-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.1);
}

.transfer-tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.transfer-badge {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: white;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin-top: 5px;
}

.transfer-badge::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -4px;
  border-width: 4px;
  border-style: solid;
  border-color: transparent transparent #ef4444 transparent;
}

/* Part Thumbnails */
.part-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #fff;
}

.part-thumb-placeholder {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  font-size: 20px;
}

/* Table Text Optimization */
table.dataTable tbody td {
  white-space: nowrap;
}

table.dataTable tbody td:nth-child(2) {
  white-space: normal;
  min-width: 150px;
}

/* Mini Canvas for QR */
.qr-mini {
  width: 40px;
  height: 40px;
  background: #f8fafc;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Action Buttons */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: 0.2s;
}

/* Stock Movements Styling */
.stock-log-card {
  height: 100%;
  transition: transform 0.3s ease;
}

.stock-log-card:hover {
  transform: translateY(-4px);
}

.stock-log-card .card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.stock-log-card .card-header i {
  font-size: 18px;
}

.stock-in-header { color: var(--success); border-bottom: 2px solid var(--success) !important; }
.stock-out-header { color: var(--danger); border-bottom: 2px solid var(--danger) !important; }

.movement-qty {
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.qty-in { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.qty-out { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.stock-table-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.movement-reason {
  font-style: italic;
  font-size: 13px;
  color: var(--secondary);
}

/* Table Content Specifics */
table.dataTable tbody td:nth-child(1) {
  font-weight: 700;
  color: var(--primary-dark);
}

.plate-badge {
  font-family: 'Inter', sans-serif;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
}

/* Maintenance Checklist Styling */
.maint-checklist-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.maint-checklist-table thead th {
  padding: 20px 10px !important;
  text-align: center;
  border-bottom: 2px solid var(--border-color) !important;
}

.maint-checklist-table thead th.rounded-header {
  min-width: 140px;
}

.maint-checklist-table thead th.rounded-header span {
  display: inline-block;
  background: #fff;
  padding: 8px 20px;
  border-radius: 30px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.maint-checklist-table tbody td {
  padding: 20px 15px !important;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--border-color) !important;
  border-right: 1px solid var(--border-color) !important;
  color: #334155;
}

.maint-checklist-table td.sticky-col-left {
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  background: #fff !important;
  border-right: 2px solid var(--border-color) !important;
}

.maint-checklist-table tr:hover td {
  background-color: var(--primary-light) !important;
}

/* --- TRUCK RECORD UI --- */
.truck-record-container {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  overflow: hidden;
}

.truck-record-table {
  border-collapse: collapse !important;
  width: 100%;
}

.truck-record-table thead th {
  padding: 30px 10px !important;
  background: #fff;
  border: none !important;
  text-align: center;
  vertical-align: middle;
}

.truck-record-table thead th.pill-header span {
  display: inline-block;
  background: #fff;
  padding: 10px 25px;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  color: #000;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.truck-record-table tbody td {
  padding: 15px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-right: 1.5px solid #000 !important; /* Visual column divider from image */
  text-align: center;
  font-weight: 600;
  color: #334155;
  font-size: 14px;
}

.truck-record-table tbody td:last-child {
  border-right: none !important;
}

.truck-record-table tbody tr:hover td {
  background-color: var(--primary-light) !important;
}

.truck-record-table .action-header {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
}

/* --- DIESEL TANK UI --- */
.fw-black { font-weight: 900; }

.tank-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tank-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md) !important;
}

.tank-card.active-tank {
  border: 2px solid var(--primary);
}

.tank-status-chip {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.status-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.status-standby {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid var(--border-color);
}

.tank-icon-bg {
  position: absolute;
  right: -20px;
  bottom: -20px;
  font-size: 120px;
  color: var(--primary-light);
  opacity: 0.5;
  z-index: 0;
  transform: rotate(-15deg);
}

.tank-content {
  position: relative;
  z-index: 1;
  padding: 28px;
}

.tank-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.tank-level-text {
  font-size: 32px;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.tank-progress-container {
  height: 8px;
  background: #f1f5f9;
  border-radius: 10px;
  margin: 15px 0;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.03);
}

.tank-progress-bar {
  height: 100%;
  border-radius: 10px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.tank-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

/* Diesel Consumption Table Enhancements */
#dieselLogsBody td {
  padding: 18px 20px !important;
  vertical-align: middle;
}

.tank-used-badge {
  background: #f1f5f9;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Button Consistency */
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover { background-color: var(--primary-dark) !important; }

/* --- LOGIN PAGE STYLING --- */
.login-page {
  background: radial-gradient(circle at center, #064e3b 0%, #062019 100%) !important;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: #fff;
  font-family: 'Inter', sans-serif;
}

.diagonal-band {
  position: absolute;
  width: 200%;
  height: 300px;
  background: var(--primary);
  transform: rotate(-5deg);
  z-index: 1;
  opacity: 0.1;
}

.diagonal-band.top { top: -150px; left: -50%; }
.diagonal-band.bottom { bottom: -150px; left: -50%; }

.login-box {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(15px);
  padding: 60px 45px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 440px;
  text-align: center;
  position: relative;
  z-index: 10;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.brand-name {
  font-size: 84px;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(135deg, #fff, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -4px;
  line-height: 1;
  filter: drop-shadow(0 10px 20px rgba(16, 185, 129, 0.2));
}

.subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 6px;
  color: var(--primary);
  margin-bottom: 45px;
  font-weight: 800;
}

.login-form .form-control {
  background: rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  padding: 16px 28px !important;
  font-size: 14px;
  margin-bottom: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-form .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 2px;
  font-size: 12px;
  font-weight: 600;
}

.login-form .form-control:focus {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2) !important;
}

.btn-enter {
  background: var(--primary) !important;
  border: none !important;
  color: #fff !important;
  width: 100%;
  padding: 16px !important;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 15px;
  transition: all 0.3s;
  box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
}

.btn-enter:hover {
  background: var(--success) !important;
  transform: translateY(-2px);
  box-shadow: 0 15px 25px -5px rgba(16, 185, 129, 0.6);
}

/* Fleet Monitor & Status UI */
.monitor-container {
  max-width: 1200px;
  margin: 0 auto;
}

.monitor-header h1 {
  font-size: 24px;
  background: #fff;
  padding: 15px 30px;
  border-radius: 50px;
  display: inline-block;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  color: #334155;
  margin-bottom: 30px;
}

.monitor-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.monitor-card-header {
  padding: 20px 25px;
  background: #f8fafc;
  border-bottom: 2px solid var(--border-color);
}

.monitor-list {
  max-height: 600px;
  overflow-y: auto;
}

.monitor-item {
  padding: 18px 25px;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.monitor-item:hover {
  background: var(--primary-light);
}

.monitor-item .plate-no {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.monitor-item .truck-type {
  font-size: 14px;
  color: var(--secondary);
  font-weight: 500;
}

.monitor-item .reserve-count {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
}

.status-active-pulse {
  color: #10b981;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.status-active-pulse::after {
  content: "";
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.monitor-group-divider {
  background: #334155;
  color: #f59e0b;
  padding: 8px 25px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Notepad UI */
.notepad-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  height: 600px;
  display: flex;
  flex-direction: column;
}

.notepad-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.notepad-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fafafa;
}

.note-item {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform 0.2s;
}

.note-item:hover {
  transform: scale(1.02);
}

.note-item .note-content {
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 8px;
}

.note-item .note-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.note-actions i {
  cursor: pointer;
  transition: color 0.2s;
}

.note-actions i:hover {
  color: var(--primary);
}

.note-actions .fa-trash:hover {
  color: var(--danger);
}

/* Route Calculator Styles - Enhanced Professional UI */
.route-calc-header-container {
  text-align: center;
  margin-bottom: 50px;
  display: flex;
  justify-content: center;
}
.letter-spacing-2 { letter-spacing: 2px; }
.fw-900 { font-weight: 900; }

.route-calc-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 16px 80px;
  border-radius: 100px;
  display: inline-block;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  color: var(--primary-dark);
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 15px;
  font-size: 26px;
  text-indent: 15px; /* Offset the letter spacing for center alignment */
}

@media (max-width: 768px) {
  .route-calc-header {
    padding: 12px 30px;
    letter-spacing: 5px;
    font-size: 18px;
    text-indent: 5px;
  }
  .route-calc-header-container {
    margin-bottom: 30px;
  }
}

@media (max-width: 480px) {
  .route-calc-header {
    padding: 10px 20px;
    letter-spacing: 2px;
    font-size: 16px;
    text-indent: 2px;
    width: 90%;
  }
}

.route-input-row {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .route-input-row {
    gap: 12px;
    margin-bottom: 25px;
  }
  #box_oil { background: #fffbeb; border-color: #fde68a; min-width: 150px; }
#box_fuel { background: #ecfdf5; border-color: #a7f3d0; min-width: 150px; }
.label-oil { color: #92400e !important; }
.val-oil { color: #92400e !important; }
.label-fuel { color: #065f46 !important; }
.val-fuel { color: #065f46 !important; }

@media (max-width: 480px) {
  #box_oil, #box_fuel {
    min-width: 100%;
  }
}

.route-input-group {
    padding: 12px 20px;
    min-width: calc(50% - 6px);
  }
}

@media (max-width: 480px) {
  #box_oil { background: #fffbeb; border-color: #fde68a; min-width: 150px; }
#box_fuel { background: #ecfdf5; border-color: #a7f3d0; min-width: 150px; }
.label-oil { color: #92400e !important; }
.val-oil { color: #92400e !important; }
.label-fuel { color: #065f46 !important; }
.val-fuel { color: #065f46 !important; }

@media (max-width: 480px) {
  #box_oil, #box_fuel {
    min-width: 100%;
  }
}

.route-input-group {
    min-width: 100%;
  }
  .btn-status {
    width: 100%;
    padding: 15px;
  }
}

#box_oil { background: #fffbeb; border-color: #fde68a; min-width: 150px; }
#box_fuel { background: #ecfdf5; border-color: #a7f3d0; min-width: 150px; }
.label-oil { color: #92400e !important; }
.val-oil { color: #92400e !important; }
.label-fuel { color: #065f46 !important; }
.val-fuel { color: #065f46 !important; }

@media (max-width: 480px) {
  #box_oil, #box_fuel {
    min-width: 100%;
  }
}

.route-input-group {
  background: #fff;
  padding: 15px 25px;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  min-width: 160px;
  flex: 1;
  position: relative;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.route-input-group:not(.no-click):hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 12px 20px -5px rgba(0,0,0,0.1);
  cursor: pointer;
}

.route-input-group.no-click:hover {
  cursor: default;
}

.route-input-group label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.route-val {
  font-weight: 800;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.2;
  padding-right: 30px; /* Room for icon */
}

.route-val.placeholder {
  display: inline-block;
  background: #f1f5f9;
  height: 12px;
  width: 100%;
  border-radius: 4px;
  color: transparent;
}

.route-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--primary);
  opacity: 0.4;
  transition: all 0.2s;
}

.route-input-group:hover .route-icon {
  opacity: 1;
  transform: translateY(-50%) scale(1.2);
}

.btn-status {
  background: var(--primary-dark);
  padding: 12px 35px;
  border-radius: 100px;
  box-shadow: 0 4px 15px rgba(6, 78, 59, 0.2);
  border: none;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  height: fit-content;
  align-self: center;
  letter-spacing: 1px;
  font-size: 13px;
  transition: all 0.3s;
}

.btn-status:hover {
  background: var(--primary);
  transform: translateY(-2px);
}

.route-main-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 40px;
}

@media (max-width: 1200px) {
  .route-main-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 768px) {
  .route-main-grid {
    gap: 20px;
  }
  .map-panel {
    padding: 15px;
    border-radius: 16px;
    order: -1;
  }
  .route-table-card {
    border-radius: 16px;
  }
}

.route-table-card {
  background: #fff;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 40px rgba(0,0,0,0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.route-table {
  width: 100%;
  border-collapse: collapse;
  flex: 1;
}

.route-table td {
  padding: 24px 30px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  color: var(--text-main);
  font-size: 15px;
}

.route-table tr:hover td {
  background: var(--primary-light);
}

.route-table tr td:first-child {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-dark);
  width: 180px;
  background: #fcfdfe;
  border-right: 1px solid #f1f5f9;
}

@media (max-width: 576px) {
  .route-table tr td:first-child {
    width: 120px;
    padding: 15px;
    font-size: 14px;
  }
  .route-table td {
    padding: 15px;
    font-size: 13px;
  }
}

.map-panel {
  background: #fff;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 40px rgba(0,0,0,0.04);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.map-placeholder {
  width: 100%;
  height: 300px;
  background: #f8fafc;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .map-placeholder {
    height: 400px;
  }
}

.map-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.btn-route {
  background: #fff;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
  padding: 14px;
  border-radius: 12px;
  font-weight: 800;
  text-transform: uppercase;
  transition: all 0.2s;
  font-size: 13px;
  letter-spacing: 1px;
}

.btn-route:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

.btn-route.active-picking {
  background: var(--primary-light);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.btn-calculate {
  grid-column: span 2;
  background: var(--primary) !important;
  color: #fff !important;
  border: none !important;
  margin-top: 5px;
}

.btn-calculate:hover {
  background: var(--primary-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(5, 150, 105, 0.3);
}

#errands_list {
  background: #f8fafc;
  padding: 15px;
  border-radius: 16px;
  border: 1px dashed var(--border-color);
}

.place-items-center {
  display: grid;
  place-items: center;
}

/* Responsive Sidebar */

/* Errand Navigation Controls */
.errand-controls {
  display: flex;
  gap: 5px;
}

.btn-errand-move {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  transition: 0.2s;
}

.btn-errand-move:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.monitor-header h1 {
  font-size: 20px;
  background: #fff;
  padding: 12px 25px;
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  color: #334155;
}

.leaflet-container {
  font-family: 'Inter', sans-serif !important;
}

.truck-marker-label {
  background: var(--primary-dark);
  border: 1px solid #fff;
  border-radius: 4px;
  color: white;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* --- LEDGER UI --- */
.ledger-container {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Floating Notepad Container */
.floating-notepad {
  position: fixed;
  top: 90px;
  right: 40px;
  width: 350px;
  background: #fff;
  border-radius: var(--radius-lg);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
  animation: slideInRight 0.3s ease-out;
  max-height: calc(100vh - 120px);
}

@media (max-width: 576px) {
  .floating-notepad {
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    z-index: 2000;
  }
}

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.floating-notepad .notepad-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  letter-spacing: 1px;
}

.floating-notepad .note-item {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: all 0.2s;
}

.floating-notepad .note-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  border-color: var(--primary);
}

/* Tank Selection Grid */
.tank-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 5px 0;
}

.tank-selector-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  background: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

.tank-selector-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  background: #fafafa;
}

.tank-selector-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.tank-selector-card.active::after {
  content: "\f058";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--primary);
  font-size: 18px;
  animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.tank-selector-card.is-active-db {
  border-color: var(--info);
  background: #f0f9ff;
}

.tank-selector-card i {
  font-size: 28px;
  margin-bottom: 6px;
  display: block;
}

.tank-selector-card .tank-name {
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
  color: var(--text-main);
}

.tank-selector-card .tank-vol {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.tank-card-auto i { color: #64748b; }
.tank-card-small i { color: #3b82f6; }
.tank-card-big i { color: #f59e0b; }
.tank-card-super i { color: #8b5cf6; }

.ledger-header-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  background: var(--primary-dark);
  color: #fff;
  padding: 15px 25px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0 !important;
}

.ledger-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  padding: 18px 25px;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s;
  align-items: center;
}

.ledger-item-row:hover {
  background: var(--primary-light);
  transform: scale(1.005);
  box-shadow: inset 4px 0 0 var(--primary);
}

.ledger-item-row:last-child {
  border-bottom: none;
}

.ledger-val {
  font-weight: 700;
  font-size: 16px;
  color: #334155;
  text-align: center;
}

.ledger-val.item-name {
  text-align: left;
  font-size: 14px;
  color: var(--primary-dark);
}

.ledger-val.released { color: var(--danger); }
.ledger-val.additional { color: var(--success); }
.ledger-val.actual {
  background: #f8fafc;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .ledger-header-row, .ledger-item-row {
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    font-size: 10px;
    padding: 10px 15px;
  }
  .ledger-val { font-size: 13px; }
}

@media (max-width: 991.98px) {
  .sidebar {
    left: -280px;
    transition: all 0.3s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    padding: 0 15px;
    height: 60px;
  }
  .topbar h5 {
    font-size: 16px;
  }
  .page-section {
    padding: 15px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 15px;
    margin-bottom: 25px;
  }
  .dashboard-header .text-end {
    text-align: left !important;
  }
  .page-section h1 {
    font-size: 24px !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-card {
    padding: 20px;
  }
  .stat-value {
    font-size: 28px;
  }
  .dashboard-header h1 {
    font-size: 24px;
  }
}

/* Truck Detail Widget */
#truckDetailWidget {
  display: flex;
  flex-direction: column;
}

.truck-profile-mini {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tire-widget-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.tire-widget-scroll::-webkit-scrollbar {
  width: 4px;
}

.tire-widget-scroll::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.dashed {
  border-style: dashed !important;
}

@media (max-width: 991px) {
  #truckDetailWidget {
    border-start: none !important;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    padding-left: 0 !important;
    margin-top: 30px;
  }
}

.plate-display-widget {
  background: #fff;
  border: 3px solid #0f172a;
  color: #0f172a;
  padding: 4px 16px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 1px;
  display: inline-block;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  text-transform: uppercase;
  border-top: 10px solid #0f172a;
  line-height: 1;
  margin-top: 5px;
}

@media (max-width: 576px) {
  .plate-display-widget {
    font-size: 20px;
    padding: 4px 12px;
    border-top-width: 6px;
  }
}

/* Drag and Drop Tire Styles */
.tire-rect.drag-over {
  border-color: #10b981 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.8) !important;
  background-color: rgba(16, 185, 129, 0.3) !important;
  transform: scale(1.1) !important;
}

.empty-tire-slot {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  min-height: 58px;
}

@media (max-width: 576px) {
  .empty-tire-slot {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .tire-slot-widget {
    flex-wrap: wrap;
  }
}

.empty-tire-slot.drag-over {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.empty-tire-slot .slot-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
}

.empty-tire-slot .slot-action {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px dashed var(--primary);
}

/* Warehouse available tires */
.warehouse-tires-widget {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

.warehouse-tires-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.warehouse-tire-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.warehouse-tire-card:active {
  cursor: grabbing;
  opacity: 0.6;
}

.warehouse-tire-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.warehouse-tire-card .tire-info {
  flex: 1;
}

.warehouse-tire-card .tire-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--primary-dark);
  margin-bottom: 2px;
}

.warehouse-tire-card .tire-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.warehouse-tire-card .tire-qty {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  padding: 4px 8px;
  border-radius: 12px;
  text-align: center;
  min-width: 28px;
}

/* Warehouse Tire Creator Form */
.warehouse-tire-creator {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.warehouse-tire-creator .form-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.warehouse-tire-creator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.warehouse-tire-creator-grid .span-2 {
  grid-column: span 2;
}

@media (max-width: 991px) {
  .warehouse-tire-creator-grid {
    grid-template-columns: 1fr;
  }
  .warehouse-tire-creator-grid .span-2 {
    grid-column: span 1;
  }
  .warehouse-tire-creator-grid .date-group {
    margin-bottom: 4px;
  }
}

.warehouse-tire-creator input {
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.btn-add-tire {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0;
  width: 44px;
  height: 39px; /* Matches the height of the 14px input + padding */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-tire:hover {
  background: var(--primary-dark);
}

.warehouse-tire-creator input:focus {
  border-color: var(--primary);
}

.warehouse-tire-creator .date-group {
  display: flex;
  flex-direction: column;
}

.warehouse-tire-creator .date-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  margin-left: 4px;
}

.warehouse-tire-creator button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.warehouse-tire-creator button:hover {
  background: var(--primary-dark);
}

/* Reports & Analytics Extensions */
.kpi-card {
  transition: transform 0.2s, box-shadow 0.2s;
  background: #ffffff;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.08) !important;
}
.kpi-card h3 {
  font-size: 24px;
  font-weight: 800;
}
.kpi-card small {
  font-size: 11px;
  font-weight: 600;
}

/* Print layout settings */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12px !important;
  }
  
  /* Hide interface controls and side panels */
  .sidebar, 
  .topbar, 
  .btn, 
  button, 
  .route-input-group,
  .route-input-row,
  .row.align-items-end,
  .card-header button, 
  .card-header .badge,
  .dataTables_length,
  .dataTables_filter,
  .dataTables_info,
  .dataTables_paginate,
  .floating-notepad,
  #floatingNotepad {
    display: none !important;
  }
  
  /* Make the main workspace full screen */
  .app-shell {
    display: block !important;
  }
  .main {
    margin-left: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }
  
  /* Hide all other sections */
  .page-section {
    display: none !important;
  }
  
  /* Show only reports section */
  #reports {
    display: block !important;
    padding: 0 !important;
  }
  
  /* Format table and cards */
  .card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
  }
  
  .card-header {
    background: transparent !important;
    border-bottom: 2px solid #334155 !important;
    padding: 10px 0 !important;
  }
  
  .card-body {
    padding: 15px 0 !important;
  }
  
  /* Ensure page breaks inside visual sections are handled gracefully */
  .kpi-card, #chartCard, .card, tr {
    page-break-inside: avoid;
  }
  
  /* Grid formatting for printing */
  #reportsKpiGrid {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 15px !important;
    margin-bottom: 30px !important;
  }
  
  #reportsKpiGrid > div {
    flex: 1 !important;
    max-width: 25% !important;
  }
  
  .kpi-card {
    border: 1px solid #cbd5e1 !important;
    border-left: 5px solid var(--primary) !important;
    background: #ffffff !important;
  }
  
  #chartCard {
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 30px !important;
  }
}
