/* ==========================================================================
   WARM OFF-WHITE / CREAM EYE-CARE PAPER DESIGN SYSTEM
   Principles:
   1. Theme: Warm Off-White / Cream Paper (#FBFBFA, #F7F4EB, #F4EFEA) for Eye-Comfort
   2. Anti-Glare: Mimics natural paper reading, eliminates harsh reflections during daylight work
   3. Typography: Deep charcoal / warm near-black (#2D312E & #37352F), never pure #000000
   4. Floating Lift & Aura Glow:
      - Interactive groups (cards, tabs, buttons, icons, table rows) lift up smoothly on hover
      - Soft warm aura glow surrounds hovered elements (transform: translateY(-3px) scale(1.03))
   5. 4 Fleet & Data Palettes:
      - Transit Mixer: Sky Blue (#0EA5E9)
      - Dump Truck / Weigh-ticket: Amber / Warm Gold (#D97706, #F59E0B)
      - Bulk Cement Tanker: Emerald Green (#10B981, #059669)
      - Driver & License Alert: Indigo (#6366F1) & Alert Red (#EF4444)
   6. Strict A4 Print Engine Isolation: Print styles completely preserved for 1-page A4 precision
   7. Zero Em-Dash Policy: Zero em-dashes across all files (hyphens only)
   ========================================================================== */

:root {
  /* Cool White & iOS 18 Design Canvas Tokens */
  --bg-canvas: #f8f9fc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-active: #cbd5e1;

  /* Hairline Clean Modern Borders & Specular Highlights */
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #d97706;
  --light-highlight: rgba(255, 255, 255, 0.98);
  --light-bevel: inset 0 1.5px 0 rgba(255, 255, 255, 0.95);

  /* Soft Diffuse Shadows & Delicate Warm Aura Glow */
  --shadow-xs: 0 1px 3px rgba(55, 53, 47, 0.04);
  --shadow-sm: 0 4px 12px -2px rgba(55, 53, 47, 0.04), 0 2px 4px -1px rgba(55, 53, 47, 0.02);
  --shadow-soft-3d: 0 10px 30px -5px rgba(55, 53, 47, 0.05), 0 4px 12px -2px rgba(55, 53, 47, 0.02);
  --shadow-clay: 0 12px 28px -4px rgba(55, 53, 47, 0.06), 0 4px 8px -2px rgba(55, 53, 47, 0.02);
  
  /* Aura Glow Tokens */
  --aura-warm: 0 16px 36px -4px rgba(55, 53, 47, 0.08), 0 0 22px rgba(245, 158, 11, 0.16);
  --aura-primary: 0 16px 36px -4px rgba(55, 53, 47, 0.08), 0 0 20px rgba(14, 165, 233, 0.22);
  --aura-success: 0 16px 36px -4px rgba(55, 53, 47, 0.08), 0 0 20px rgba(16, 185, 129, 0.22);
  --aura-danger: 0 16px 36px -4px rgba(55, 53, 47, 0.08), 0 0 20px rgba(239, 68, 68, 0.22);

  /* 4 Data & Fleet Mapping Palettes */
  /* Palette 1: Transit Mixer (Sky Blue) */
  --mixer-primary: #0284c7;
  --mixer-hover: #0369a1;
  --mixer-bg: #f0f9ff;
  --mixer-border: #bae6fd;
  --mixer-text: #0369a1;
  --mixer-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);

  /* Palette 2: Dump Truck (Amber / Warm Gold) */
  --dump-primary: #d97706;
  --dump-hover: #b45309;
  --dump-bg: #fef9ee;
  --dump-border: #fde68a;
  --dump-text: #92400e;
  --dump-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);

  /* Palette 3: Bulk Cement Tanker (Emerald Green) */
  --cement-primary: #059669;
  --cement-hover: #047857;
  --cement-bg: #f0fdf4;
  --cement-border: #a7f3d0;
  --cement-text: #065f46;
  --cement-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);

  /* Palette 4: Driver / License / Alert (Indigo & Alert Red) */
  --driver-primary: #4f46e5;
  --driver-hover: #4338ca;
  --driver-bg: #f5f3ff;
  --driver-border: #c7d2fe;
  --driver-text: #3730a3;
  --driver-gradient: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);

  --alert-danger: #dc2626;
  --alert-bg: #fef2f2;
  --alert-border: #fecaca;
  --alert-text: #991b1b;

  /* Primary Theme Accents */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: #f0f9ff;
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);

  --success: #059669;
  --success-hover: #047857;
  --success-soft: #f0fdf4;
  --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);

  --warning: #d97706;
  --warning-hover: #b45309;
  --warning-soft: #fef9ee;
  --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);

  /* Anti-Glare Typographic Tokens (Warm Charcoal, Never #000000) */
  --text-primary: #2d312e;
  --text-secondary: #4a4740;
  --text-muted: #736e65;
  --text-caption: #969085;

  /* Soft 3D Proportional Corner Radii */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-card: 20px;
  --radius-pill: 9999px;
  --radius-full: 9999px;

  /* Apple iOS Human Interface Design Tokens */
  --ios-bg: #f8f9fc;
  --ios-card: #ffffff;
  --ios-card-glass: rgba(255, 255, 255, 0.88);
  --ios-border: rgba(226, 232, 240, 0.8);
  --ios-divider: rgba(226, 232, 240, 0.8);
  --ios-fill-tertiary: rgba(148, 163, 184, 0.12);
  --ios-shadow: 0 4px 20px -2px rgba(148, 163, 184, 0.12), 0 2px 6px -1px rgba(148, 163, 184, 0.06);
  --ios-shadow-hover: 0 12px 32px -4px rgba(148, 163, 184, 0.2), 0 4px 12px -2px rgba(148, 163, 184, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Apple iOS System Grouped Canvas Background (Cool White) */
body {
  background-color: var(--ios-bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(255, 255, 255, 0.98) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(224, 231, 255, 0.45) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(241, 245, 249, 0.75) 0px, transparent 60%),
    linear-gradient(180deg, #f8f9fc 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  letter-spacing: -0.015em;
}

/* Smooth Apple Minimalist Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
}

/* Lucide & SVG Icon Global Standards */
svg.lucide,
[data-lucide],
.lucide {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Ensure date/month inputs do not clip and icons remain crisp */
input[type="date"],
input[type="month"],
input[type="time"] {
  min-width: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ==========================================================================
   DUAL THEME ENGINE (หิน-ทราย = AMBER SAND vs ปูนผง = CYAN CEMENT)
   ========================================================================== */

/* Default / หิน-ทราย (Rock & Sand) Theme */
:root,
body[data-business-group="rock_sand"] {
  --group-primary: #d97706;
  --group-primary-hover: #b45309;
  --group-secondary: #f59e0b;
  --group-accent-rgb: 217, 119, 6;
  --group-header-accent: #f59e0b;
  --group-badge-bg: #fffbeb;
  --group-badge-border: #fde68a;
  --group-badge-text: #92400e;
  --group-dot: #f59e0b;
  --group-glow: 0 0 18px rgba(245, 158, 11, 0.28);
  --group-btn-active-bg: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --group-btn-active-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  --header-center-bg: linear-gradient(135deg, #b45309 0%, #d97706 60%, #92400e 100%);
  --header-center-border: #f59e0b;
  --header-center-shadow: 0 4px 18px rgba(217, 119, 6, 0.42);
  --header-center-text: #ffffff;
}

/* กลุ่มปูนผง (Bulk Cement) Theme */
body[data-business-group="cement"] {
  --group-primary: #0284c7;
  --group-primary-hover: #0369a1;
  --group-secondary: #0ea5e9;
  --group-accent-rgb: 2, 132, 199;
  --group-header-accent: #0ea5e9;
  --group-badge-bg: #f0f9ff;
  --group-badge-border: #bae6fd;
  --group-badge-text: #0369a1;
  --group-dot: #0ea5e9;
  --group-glow: 0 0 18px rgba(14, 165, 233, 0.28);
  --group-btn-active-bg: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --group-btn-active-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  --header-center-bg: linear-gradient(135deg, #0369a1 0%, #0284c7 60%, #075985 100%);
  --header-center-border: #38bdf8;
  --header-center-shadow: 0 4px 18px rgba(2, 132, 199, 0.42);
  --header-center-text: #ffffff;
}

/* ==========================================================================
   MODERN COLLAPSIBLE DYNAMIC SIDEBAR (iOS Squircle & Group Themes)
   ========================================================================== */

:root {
  --sidebar-w-collapsed: 80px;
  --sidebar-w-expanded: 280px;
  --sidebar-bg-gradient: rgba(248, 250, 252, 0.94);
  --sidebar-surface: #ffffff;
  --sidebar-border: rgba(0, 0, 0, 0.08);
  --sidebar-neon: #0284c7;
  --sidebar-glow: rgba(2, 132, 199, 0.15);
  --sidebar-text: #475569;
  --sidebar-text-bright: #0f172a;
}

/* 1. Dynamic Theming per Business Group */
body[data-business-group="rock_sand"] {
  --sidebar-bg-gradient: rgba(250, 250, 250, 0.96);
  --sidebar-surface: #ffffff;
  --sidebar-border: rgba(0, 0, 0, 0.08);
  --sidebar-neon: #f59e0b;
  --sidebar-glow: rgba(245, 158, 11, 0.18);
  --sidebar-text: #475569;
  --sidebar-text-bright: #0f172a;
}

body[data-business-group="cement"] {
  --sidebar-bg-gradient: rgba(248, 250, 252, 0.96);
  --sidebar-surface: #ffffff;
  --sidebar-border: rgba(0, 0, 0, 0.08);
  --sidebar-neon: #0ea5e9;
  --sidebar-glow: rgba(14, 165, 233, 0.18);
  --sidebar-text: #475569;
  --sidebar-text-bright: #0f172a;
}

/* Sidebar Container (Apple iOS 18 Frosted Glass Light) */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w-collapsed);
  background: var(--sidebar-bg-gradient);
  backdrop-filter: blur(25px) saturate(1.8);
  -webkit-backdrop-filter: blur(25px) saturate(1.8);
  border-right: 1px solid var(--sidebar-border);
  border-top: none;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.26s ease, border-color 0.25s, background 0.25s ease;
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
}

/* Hover expansion, Pinned state, or Open */
.app-sidebar:hover,
.app-sidebar.is-pinned,
.app-sidebar.is-open {
  width: var(--sidebar-w-expanded);
  box-shadow: 12px 0 36px -4px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* 2. Sidebar Brand Header & Clean Logo */
.sidebar-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
  transition: padding 0.25s ease, justify-content 0.25s ease;
}

.app-sidebar:hover .sidebar-header,
.app-sidebar.is-pinned .sidebar-header,
.app-sidebar.is-open .sidebar-header {
  padding: 0 14px;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  justify-content: center;
}

.app-sidebar:hover .sidebar-brand,
.app-sidebar.is-pinned .sidebar-brand,
.app-sidebar.is-open .sidebar-brand {
  width: auto;
  justify-content: flex-start;
}

/* iOS App Icon Style Logo Frame */
.sidebar-logo-frame {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: #ffffff;
  border-radius: 12px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  box-sizing: border-box;
}

.app-sidebar:hover .sidebar-logo-frame,
.app-sidebar.is-pinned .sidebar-logo-frame {
  transform: scale(1.03);
}

.sidebar-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand-text {
  display: none;
  flex-direction: column;
  min-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
}

.app-sidebar:hover .sidebar-brand-text,
.app-sidebar.is-pinned .sidebar-brand-text,
.app-sidebar.is-open .sidebar-brand-text {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.sidebar-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sidebar-subtitle {
  font-size: 0.72rem;
  color: #64748b;
  margin: 2px 0 0 0;
  font-weight: 500;
}

/* Pin Toggle Button */
.sidebar-pin-btn {
  display: none;
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

.app-sidebar:hover .sidebar-pin-btn,
.app-sidebar.is-pinned .sidebar-pin-btn,
.app-sidebar.is-open .sidebar-pin-btn {
  display: flex;
  opacity: 1;
}

.sidebar-pin-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

.app-sidebar.is-pinned .sidebar-pin-btn {
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
}

/* 3. Business Group Switcher Section */
.sidebar-group-section {
  padding: 10px 8px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

/* Compact group icon (visible when collapsed) */
.compact-group-btn {
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.compact-group-squircle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: var(--sidebar-neon);
}

.compact-group-btn:hover .compact-group-squircle {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.compact-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.compact-group-btn .pulse-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sidebar-neon);
  box-shadow: 0 0 6px var(--sidebar-neon);
}

/* Expanded Group Switcher (Apple Segmented Control) */
.sidebar-group-buttons {
  display: none;
  width: 100%;
}

.app-sidebar:hover .compact-group-btn,
.app-sidebar.is-pinned .compact-group-btn,
.app-sidebar.is-open .compact-group-btn {
  display: none;
}

.app-sidebar:hover .sidebar-group-buttons,
.app-sidebar.is-pinned .sidebar-group-buttons,
.app-sidebar.is-open .sidebar-group-buttons {
  display: block;
}

.sidebar-group-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  padding: 0 2px;
}

.sidebar-section-title {
  font-size: 0.70rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.group-pills-row {
  display: flex;
  gap: 2px;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.sidebar-group-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  color: #64748b;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.sidebar-group-btn:hover {
  color: #0f172a;
}

.sidebar-group-btn#btn-group-rock-sand.active {
  background: #ffffff;
  color: #b45309;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.04);
}

.sidebar-group-btn#btn-group-cement.active {
  background: #ffffff;
  color: #0284c7;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.04);
}

/* 4. Main Navigation with Apple iOS 18 Squircle Icons */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
}

.app-sidebar:hover .sidebar-nav,
.app-sidebar.is-pinned .sidebar-nav,
.app-sidebar.is-open .sidebar-nav {
  align-items: stretch;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.sidebar-nav-header {
  padding: 2px 6px 6px 6px;
  display: none;
  width: 100%;
}

.app-sidebar:hover .sidebar-nav-header,
.app-sidebar.is-pinned .sidebar-nav-header,
.app-sidebar.is-open .sidebar-nav-header {
  display: block;
}

.sidebar-nav .nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 46px;
  border-radius: 11px;
  background: transparent;
  border: 1px solid transparent;
  color: #475569;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
}

.app-sidebar:hover .sidebar-nav .nav-tab,
.app-sidebar.is-pinned .sidebar-nav .nav-tab,
.app-sidebar.is-open .sidebar-nav .nav-tab {
  width: 100%;
  justify-content: flex-start;
  padding: 6px 10px;
  gap: 10px;
}

/* Rounded Indicator bar (left edge) */
.sidebar-nav .nav-tab .neon-indicator {
  position: absolute;
  left: 3px;
  top: 20%;
  bottom: 20%;
  width: 3.5px;
  border-radius: 9999px;
  background: transparent;
  transition: background 0.2s ease;
}

/* ==========================================================================
   Apple iOS 18 Squircle Icons (SF Symbols Style)
   ========================================================================== */

.ios-icon-squircle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.12), inset 0 0.5px 0.5px rgba(255, 255, 255, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  flex-shrink: 0;
}

.sidebar-nav .nav-tab:hover .ios-icon-squircle {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
}

/* Lucide SVG Icon inside Apple Squircle */
.ios-icon-squircle svg,
.ios-icon-squircle [data-lucide],
.ios-icon-squircle .lucide {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  stroke-width: 2;
  fill: none;
  z-index: 1;
}

/* Authentic Apple System Color Schemes */
.ios-green {
  background: linear-gradient(135deg, #34c759 0%, #28a745 100%);
}

.ios-orange {
  background: linear-gradient(135deg, #ff9500 0%, #ea580c 100%);
}

.ios-blue {
  background: linear-gradient(135deg, #007aff 0%, #0284c7 100%);
}

.ios-purple {
  background: linear-gradient(135deg, #af52de 0%, #8b5cf6 100%);
}

.ios-teal {
  background: linear-gradient(135deg, #30b0c7 0%, #0891b2 100%);
}

.ios-indigo {
  background: linear-gradient(135deg, #5856d6 0%, #4f46e5 100%);
}

.ios-gray {
  background: linear-gradient(135deg, #8e8e93 0%, #64748b 100%);
}

.ios-red {
  background: linear-gradient(135deg, #ff3b30 0%, #e11d48 100%);
}

.ios-mint {
  background: linear-gradient(135deg, #00c7be 0%, #059669 100%);
}

.ios-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.ios-cyan {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.ios-pink {
  background: linear-gradient(135deg, #ff2d55 0%, #e11d48 100%);
}

/* Text Column */
.sidebar-nav .nav-tab .nav-text-col {
  display: none;
  flex-direction: column;
  min-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.app-sidebar:hover .sidebar-nav .nav-tab .nav-text-col,
.app-sidebar.is-pinned .sidebar-nav .nav-tab .nav-text-col,
.app-sidebar.is-open .sidebar-nav .nav-tab .nav-text-col {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.sidebar-nav .nav-tab .nav-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #334155;
  transition: color 0.18s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav .nav-tab .nav-desc {
  font-size: 0.72rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Hover State */
.sidebar-nav .nav-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-nav .nav-tab:hover .nav-label {
  color: #0f172a;
}

/* Active State (Apple Soft Tint) */
.sidebar-nav .nav-tab.active {
  background: rgba(2, 132, 199, 0.08);
}

body[data-business-group="rock_sand"] .sidebar-nav .nav-tab.active {
  background: rgba(245, 158, 11, 0.1);
}

.sidebar-nav .nav-tab.active .neon-indicator {
  background: var(--group-primary, #0284c7);
}

.sidebar-nav .nav-tab.active .nav-label {
  color: #0f172a;
  font-weight: 800;
}

.sidebar-nav .nav-tab.active .nav-desc {
  color: #64748b;
}

/* Click Ripple Wave Animation */
.sidebar-nav .nav-tab.tab-clicked {
  animation: sidebarTabRipple 0.25s ease;
}

@keyframes sidebarTabRipple {
  0% { transform: scale(0.97); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* 5. Sidebar Footer (Apple ID Profile & Logout) */
.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.app-sidebar:hover .sidebar-footer,
.app-sidebar.is-pinned .sidebar-footer,
.app-sidebar.is-open .sidebar-footer {
  padding: 8px 10px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  border-radius: 12px;
  background: transparent;
  border: none;
  box-sizing: border-box;
}

.app-sidebar:hover .sidebar-user-card,
.app-sidebar.is-pinned .sidebar-user-card,
.app-sidebar.is-open .sidebar-user-card {
  width: 100%;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.user-avatar-wrap {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #e2e8f0;
  margin: 0 auto;
  flex-shrink: 0;
}

.sidebar-user-card .user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
}

.sidebar-user-card .user-info-text {
  display: none;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar:hover .sidebar-user-card .user-info-text,
.app-sidebar.is-pinned .sidebar-user-card .user-info-text,
.app-sidebar.is-open .sidebar-user-card .user-info-text {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.sidebar-user-card .user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-card .badge {
  font-size: 0.70rem;
  padding: 2px 7px;
  border-radius: 4px;
  width: fit-content;
}

.sidebar-user-card .btn-logout {
  display: none;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #dc2626;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  align-items: center;
  gap: 4px;
  opacity: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.app-sidebar:hover .sidebar-user-card .btn-logout,
.app-sidebar.is-pinned .sidebar-user-card .btn-logout,
.app-sidebar.is-open .sidebar-user-card .btn-logout {
  display: inline-flex;
  opacity: 1;
}

.sidebar-user-card .btn-logout:hover {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.15);
}

/* ==========================================================================
   WORKSPACE MAIN LAYOUT (Full Screen Height & Width)
   ========================================================================== */

main.app-main-content,
main {
  flex: 1;
  max-width: none;
  width: auto;
  margin: 1.25rem 2rem 2.5rem calc(var(--sidebar-w-collapsed) + 1.5rem);
  padding: 0;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-pinned main.app-main-content,
body.sidebar-pinned main {
  margin-left: calc(var(--sidebar-w-expanded) + 1.5rem);
}

/* Mobile Top Navigation Bar & Drawer Backdrop */
.mobile-top-bar {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1190;
  animation: modalFadeIn 0.2s ease;
}

.sidebar-backdrop.active {
  display: block;
}

@media (max-width: 900px) {
  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 1rem;
    background: #ffffff;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }

  .mobile-nav-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .mobile-nav-toggle-btn:active {
    background: #e2e8f0;
    transform: scale(0.96);
  }

  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w-expanded);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1200;
  }

  .app-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.55);
  }

  main.app-main-content,
  main {
    margin: 0.75rem 0.75rem 2rem 0.75rem;
    padding: 0;
  }

  body.sidebar-pinned main.app-main-content,
  body.sidebar-pinned main {
    margin-left: 0.75rem;
  }

  /* Prevent auto-zoom on iOS Safari */
  .form-control, input, select, textarea {
    font-size: 16px !important;
  }

  /* Mobile Modal Dialog Adaptation */
  .modal-backdrop,
  .modal-overlay {
    padding: 0.75rem !important;
  }
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block !important;
  animation: naturalFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Apple iOS 18 Neumorphism Inset & Outset Grouped Card */
.card {
  background: var(--ios-card);
  border-radius: var(--radius-card);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 
    0 10px 25px -5px rgba(148, 163, 184, 0.16),
    0 8px 10px -6px rgba(148, 163, 184, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, border-color 0.28s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 18px 36px -8px rgba(148, 163, 184, 0.24),
    0 10px 16px -4px rgba(148, 163, 184, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  border-color: rgba(203, 213, 225, 0.95);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--ios-divider);
  gap: 1.25rem;
}

.card-header h2 {
  font-size: 1.28rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   FORM GRID & INPUTS (Apple iOS Inset Form Standards)
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s ease;
}

.form-group label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: -0.01em;
}

.form-group label span.req {
  color: var(--danger);
  font-weight: 800;
}

/* Apple iOS 18 Rounded Form Controls */
.form-control {
  width: 100%;
  padding: 0.72rem 1.05rem;
  font-size: 0.92rem;
  font-weight: 500;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  color: #0f172a;
  outline: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.form-control:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.16), inset 0 1px 2px rgba(0, 0, 0, 0.02);
  background: #ffffff;
}

.form-control[readonly], .form-control:disabled {
  background: #f1f5f9;
  color: #334155;
  cursor: not-allowed;
  border-color: #e2e8f0;
  box-shadow: none;
}

/* iOS Highlight Info Box */
.highlight-box {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 1.15rem 1.4rem;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.08);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.highlight-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.15);
}

/* ==========================================================================
   BUTTONS (Apple iOS Tactile Spring Buttons)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  user-select: none;
}

.btn:active {
  transform: scale(0.96) !important;
}

/* Primary Button */
.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.38);
}

/* Secondary Button */
.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.22);
}

/* Success Button */
.btn-success {
  background: var(--success-gradient);
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.28);
}

.btn-success:hover {
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.38);
}

/* Warning Button with Amber Aura */
.btn-warning {
  background: var(--warning-gradient);
  color: #ffffff;
  border-color: #d97706;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px rgba(245, 158, 11, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.btn-warning:hover {
  transform: translateY(-3px) scale(1.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 24px rgba(245, 158, 11, 0.38), 0 0 22px rgba(245, 158, 11, 0.35);
}

.btn-warning:active {
  transform: translateY(1px) scale(0.98);
}

/* Danger Button with Red Aura */
.btn-danger {
  background: var(--danger-gradient);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px rgba(239, 68, 68, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.btn-danger:hover {
  transform: translateY(-3px) scale(1.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 24px rgba(239, 68, 68, 0.38), 0 0 22px rgba(239, 68, 68, 0.32);
}

.btn-danger:active {
  transform: translateY(1px) scale(0.98);
}

/* Outline Buttons */
.btn-outline-primary {
  background: #ffffff;
  color: var(--primary);
  border: 1.5px solid #bae6fd;
  font-weight: 700;
  padding: 0.48rem 1.1rem;
  border-radius: var(--radius-pill);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(55, 53, 47, 0.02);
}

.btn-outline-primary:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0369a1;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.18), 0 0 16px rgba(14, 165, 233, 0.22);
}

.btn-outline-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1.5px solid #ded9cc;
  font-weight: 700;
  padding: 0.48rem 1.1rem;
  border-radius: var(--radius-pill);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(55, 53, 47, 0.02);
}

.btn-outline-secondary:hover {
  background: #fdfbf7;
  border-color: #c9c2b3;
  color: var(--text-primary);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 16px rgba(55, 53, 47, 0.08), 0 0 16px rgba(245, 158, 11, 0.18);
}

.btn-sm {
  padding: 0.46rem 1rem;
  font-size: 0.84rem;
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   VIEW MODE SWITCHER
   ========================================================================== */

.view-mode-toggle {
  display: inline-flex;
  background: #ede8dc;
  border: 1px solid #ded9cc;
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
  box-shadow: inset 0 2px 4px rgba(55, 53, 47, 0.04);
}

.view-mode-btn {
  border: none;
  background: transparent;
  padding: 8px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-mode-btn:hover {
  color: var(--text-primary);
  transform: translateY(-1.5px) scale(1.03);
  box-shadow: 0 4px 10px rgba(55, 53, 47, 0.06), 0 0 14px rgba(245, 158, 11, 0.15);
}

.view-mode-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 3px 10px rgba(55, 53, 47, 0.08), 0 0 14px rgba(14, 165, 233, 0.16);
  font-weight: 800;
  transform: translateY(-1px);
}

/* ==========================================================================
   /* ==========================================================================
   APPLE HEALTH & CONTROL CENTER KPI WIDGETS
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-radius: 20px;
  padding: 1.35rem 1.6rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 
    0 8px 24px -4px rgba(148, 163, 184, 0.18),
    0 4px 8px -2px rgba(148, 163, 184, 0.08),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, border-color 0.28s ease;
  cursor: default;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #38bdf8, #0284c7);
  border-radius: 20px 20px 0 0;
}

.kpi-card.info::before {
  background: linear-gradient(90deg, #38bdf8, #0284c7);
}

.kpi-card.warning::before {
  background: linear-gradient(90deg, #fbbf24, #d97706);
}

.kpi-card.success::before {
  background: linear-gradient(90deg, #34d399, #059669);
}

.kpi-card.secondary::before {
  background: linear-gradient(90deg, #818cf8, #4f46e5);
}

/* Hover Floating Lift on KPI Cards */
.kpi-card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: rgba(255, 255, 255, 1);
  box-shadow: 
    0 16px 32px -6px rgba(148, 163, 184, 0.28),
    0 8px 16px -4px rgba(148, 163, 184, 0.14),
    inset 0 1.5px 0 rgba(255, 255, 255, 1);
}

.kpi-card:hover .kpi-val {
  transform: scale(1.02);
}

.kpi-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}

.kpi-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum";
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kpi-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.6rem;
  padding: 3px 10px;
  background: rgba(118, 118, 128, 0.08);
  border-radius: 9999px;
  width: fit-content;
  font-weight: 600;
}

/* ==========================================================================
   7-FIELD SEARCH BOX (Apple iOS Inset Filter Panel)
   ========================================================================== */

.trip-search-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.15rem 1.35rem;
  margin-top: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.trip-search-box:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

/* 4 equal columns on desktop, perfectly balanced 2 rows */
.trip-search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
}

.filter-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.filter-col-span-2 {
  grid-column: span 2;
}

.filter-col label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-col label i[data-lucide] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #0284c7;
  display: inline-block;
  vertical-align: middle;
}

.filter-col .form-control {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.55rem 0.85rem;
  font-size: 0.86rem;
  border-radius: var(--radius-xs);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-col .form-control:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  outline: none;
}

.filter-date-inputs-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.filter-date-separator {
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.82rem;
  user-select: none;
  flex-shrink: 0;
  padding: 0 2px;
}

@media (max-width: 1100px) {
  .trip-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .trip-search-grid {
    grid-template-columns: 1fr;
  }
  .filter-col-span-2 {
    grid-column: span 1;
  }
  .filter-date-inputs-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .filter-date-separator {
    display: none;
  }
}

/* Empty State Placeholder */
.trips-empty-placeholder {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.trips-empty-placeholder .icon {
  font-size: 2.6rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 8px rgba(217, 119, 6, 0.15));
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trips-empty-placeholder:hover .icon {
  transform: scale(1.25) translateY(-4px);
}

.trips-empty-placeholder .title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #2d312e;
  margin-bottom: 6px;
}

.trips-empty-placeholder .desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ==========================================================================
   DATA TABLES (Apple iOS Inset Grouped Table with Sticky Blur Header)
   ========================================================================== */

.table-container {
  width: 100%;
  max-width: 100%;
  max-height: min(72vh, 720px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--ios-border);
  background: #ffffff;
  box-shadow: var(--ios-shadow);
  position: relative;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.table-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 9999px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.modal-body .table-container {
  max-height: 52vh;
}

.table-container.is-dragging {
  cursor: grabbing !important;
  user-select: none;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  text-align: left;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  color: #475569;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.9rem 1rem;
  border-bottom: 1.5px solid #e2e8f0;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(148, 163, 184, 0.08);
}

.data-table tbody td {
  padding: 0.82rem 1rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  color: #334155;
  transition: background 0.15s ease, color 0.15s ease;
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(248, 250, 252, 0.45);
}

/* Hover on Table Rows: Soft Apple Row Highlight */
.data-table tbody tr:hover td {
  background: rgba(224, 242, 254, 0.5) !important;
  color: #0f172a;
}

.data-table tbody tr:hover .badge {
  transform: scale(1.05);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 8;
  padding: 0.95rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(248, 250, 252, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 800;
  color: #0f172a;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: 800; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.font-mono { font-family: 'Inter', monospace; font-feature-settings: "tnum"; }

/* ==========================================================================
   BADGES (Pills with Hover Lift & Aura)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
}

.badge:hover {
  transform: translateY(-1.5px) scale(1.08);
  box-shadow: 0 4px 10px rgba(55, 53, 47, 0.08), 0 0 14px rgba(245, 158, 11, 0.28);
}

/* Palette 1: Transit Mixer / Plate */
.badge-info {
  background: var(--mixer-bg);
  color: var(--mixer-text);
  border-color: var(--mixer-border);
}
.badge-info:hover {
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.15), 0 0 14px rgba(14, 165, 233, 0.3);
}

/* Palette 2: Dump Truck / Material */
.badge-warning {
  background: var(--dump-bg);
  color: var(--dump-text);
  border-color: var(--dump-border);
}
.badge-warning:hover {
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.15), 0 0 14px rgba(245, 158, 11, 0.35);
}

/* Palette 3: Bulk Cement / Success */
.badge-success {
  background: var(--cement-bg);
  color: var(--cement-text);
  border-color: var(--cement-border);
}
.badge-success:hover {
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.15), 0 0 14px rgba(16, 185, 129, 0.3);
}

/* Palette 4: Driver / Alert */
.badge-purple {
  background: var(--driver-bg);
  color: var(--driver-text);
  border-color: var(--driver-border);
}
.badge-purple:hover {
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15), 0 0 14px rgba(99, 102, 241, 0.3);
}

.badge-danger {
  background: var(--alert-bg);
  color: var(--alert-text);
  border-color: var(--alert-border);
}
.badge-danger:hover {
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.15), 0 0 14px rgba(239, 68, 68, 0.3);
}

.badge-primary {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.badge-gray {
  background: #ede8dc;
  color: var(--text-secondary);
  border-color: #ded9cc;
}

/* ==========================================================================
   FLEET STATUS (32 Trucks Grid) & TODO CARDS (Lift & Aura on Hover)
   ========================================================================== */

.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.truck-card {
  background: #ffffff;
  border: 1.5px solid #e2dcd0;
  border-radius: 18px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 4px 12px rgba(55, 53, 47, 0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
}

/* Hover Lift & Aura on 32-Truck Cards */
.truck-card:hover {
  transform: translateY(-5px) scale(1.025);
  box-shadow: 0 18px 36px -4px rgba(55, 53, 47, 0.09), 0 0 22px rgba(245, 158, 11, 0.18);
  border-color: #d0c8b8;
}

.truck-card:hover .truck-plate {
  transform: scale(1.06);
  display: inline-block;
  color: #1e201e;
}

/* Category Accent Strip on Truck Card */
.truck-card.cat-mixer {
  border-top: 4px solid var(--mixer-primary);
}
.truck-card.cat-dump {
  border-top: 4px solid var(--dump-primary);
}
.truck-card.cat-cement {
  border-top: 4px solid var(--cement-primary);
}

.truck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.truck-plate {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.truck-driver {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.truck-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   SUPERVISOR DASHBOARD INFOGRAPHICS (Progress Bars & Leaderboards)
   ========================================================================== */

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: #ede8dc;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.podium-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.podium-badge:hover {
  transform: scale(1.25) rotate(6deg);
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.45));
}

.podium-gold {
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%);
  color: #78350f;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.podium-silver {
  background: linear-gradient(135deg, #f1ece1 0%, #cbd5e1 100%);
  color: #334155;
  box-shadow: 0 2px 6px rgba(148, 163, 184, 0.3);
}

.podium-bronze {
  background: linear-gradient(135deg, #fed7aa 0%, #ea580c 100%);
  color: #7c2d12;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.3);
}

/* ==========================================================================
   MODAL DIALOG (Warm Frosted Dialog with Soft Backdrop)
   ========================================================================== */

.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1250;
  padding: 1.5rem;
  animation: modalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 
    0 32px 72px -16px rgba(15, 23, 42, 0.38), 
    0 0 0 1px rgba(148, 163, 184, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  width: 100%;
  max-width: 620px;
  overflow: hidden;
  position: relative;
  animation: iosModalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-sheet-handle {
  width: 36px;
  height: 5px;
  background: rgba(60, 60, 67, 0.3);
  border-radius: 9999px;
  margin: 10px auto 4px auto;
  flex-shrink: 0;
}

@keyframes iosModalSlideUp {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.6rem;
  border-bottom: 1px solid rgba(60, 60, 67, 0.09);
  background: #ffffff;
}

.modal-close-btn {
  background: rgba(118, 118, 128, 0.12);
  border: none;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: scale(1.08);
}

.modal-body {
  padding: 1.5rem 1.6rem;
  max-height: 78vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.6rem;
  border-top: 1px solid rgba(60, 60, 67, 0.09);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   PREDICTIVE TEXT & SMART COMBOBOX (Floating Card with Soft Shadow)
   ========================================================================== */

.predictive-wrapper {
  position: relative;
  width: 100%;
}

.predictive-combobox-wrapper {
  position: relative;
  width: 100%;
}

.predictive-input-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.predictive-input-container .form-control {
  padding-right: 56px;
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.predictive-input-container .form-control:focus {
  background-color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.12), 0 0 16px rgba(245, 158, 11, 0.18), inset 0 1px 2px rgba(55, 53, 47, 0.02);
}

.predictive-clear-btn {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 4px;
  display: none;
  z-index: 2;
  transition: all 0.15s ease;
}

.predictive-clear-btn:hover {
  color: #dc2626;
  background: #fee2e2;
}

.predictive-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 4px;
  z-index: 2;
  transition: all 0.15s ease;
}

.predictive-toggle-btn:hover {
  color: var(--primary);
  background: #ede8dc;
}

.predictive-box {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1.5px solid #ded9cc;
  border-radius: 14px;
  box-shadow: 0 16px 36px -4px rgba(55, 53, 47, 0.14), 0 0 20px rgba(245, 158, 11, 0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1050;
  padding: 6px;
  animation: predictiveDropdown 0.15s ease-out;
}

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

.predictive-item {
  padding: 9px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all 0.14s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.predictive-item:hover, .predictive-item.active {
  background: #fbf7ee;
  color: #b45309;
  font-weight: 700;
  transform: translateX(3px);
}

.predictive-item-custom {
  background: #fffbeb;
  border: 1.5px dashed #f59e0b;
  margin-top: 6px;
  margin-bottom: 2px;
  border-radius: 8px;
}

.predictive-item-custom:hover, .predictive-item-custom.active {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
  transform: scale(1.01);
}

.predictive-item mark {
  background: #fef08a;
  color: #78350f;
  font-weight: 800;
  padding: 0 2px;
  border-radius: 2px;
}

.predictive-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* ==========================================================================
   SPECIAL NOTICES & DUPLICATE TRIP WARNING
   ========================================================================== */

.route-notice {
  background: #f0fdf4;
  border: 1.5px solid #a7f3d0;
  color: #065f46;
  font-weight: 600;
  border-radius: 12px;
  padding: 10px 16px;
  animation: naturalFadeIn 0.2s ease;
}

.route-notice.route-notice-success {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #166534;
}

.route-notice.route-notice-danger {
  background: #fef2f2;
  border: 1.5px solid #f87171;
  color: #991b1b;
  font-weight: 700;
}

.route-notice.route-notice-warning {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  color: #92400e;
}

.route-notice.route-notice-info {
  background: #f0f9ff;
  border: 1.5px solid #7dd3fc;
  color: #0369a1;
}

.duplicate-warning-banner {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fef9ee;
  border: 1.5px solid #fde68a;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15), 0 0 14px rgba(245, 158, 11, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Adaptive Breakpoints)
   ========================================================================== */

@media (max-width: 1024px) {
  header { padding: 1rem 1.5rem; }
  main { padding: 0 1.5rem; margin: 1.5rem auto; }
  .card { padding: 1.75rem 1.5rem; }
  .nav-container { padding: 0.5rem 1.5rem; }
}

@media (max-width: 768px) {
  header { padding: 0.85rem 1rem; }
  main { padding: 0 1rem; margin: 1rem auto; }
  .brand-logo { height: 60px; min-width: 90px; padding: 4px 8px; border-radius: 14px; }
  .brand-text h1 { font-size: 1.15rem; }
  .card { padding: 1.25rem 1.15rem; border-radius: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .trip-search-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ENTERPRISE A4 ZERO-CONFIG PRINT ENGINE & PRINT PREVIEW
   Principles:
   1. Strict A4 Portrait geometry (210mm x 297mm) with 10mm-12mm printable margins
   2. High-contrast crisp black & white table layout
   3. Complete isolation from screen paper tints and aura glows
   ========================================================================== */


/* ==========================================================================
   PRINT CONTAINER STRICT SCREEN ISOLATION
   ========================================================================== */
@media screen {
  .print-only,
  #print-engine-container {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
  }
}

/* ==========================================================================
   OFFICIAL A4 PRINT ENGINE & ON-SCREEN PREVIEW STYLES
   ========================================================================== */

/* On-Screen Print Preview Modal Desk */
.print-preview-modal-card {
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.5);
  border: 1px solid #475569;
}

#print-preview-body {
  background: #525659;
  padding: 24px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* Formal A4 Sheet Representation */
.print-preview-sheet.a4-sheet,
.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff !important;
  color: #1e293b !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.15);
  padding: 12mm 14mm;
  box-sizing: border-box;
  margin: 0 auto;
  position: relative;
  font-family: 'Sarabun', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 8.5pt;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
}

/* Document Header */
.print-doc-header {
  border-bottom: 2px solid #1e3a8a;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.print-doc-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.print-doc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.print-doc-brand-icon img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.print-doc-company {
  font-size: 12pt;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.print-doc-title {
  font-size: 10pt;
  font-weight: 700;
  color: #1e40af;
  margin-top: 2px;
}

.print-doc-group-badge {
  display: inline-block;
  font-size: 7.5pt;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 3px;
}

/* Driver Info & Metadata Box */
.print-doc-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 8.2pt;
  color: #1e293b;
}

.print-doc-meta strong {
  color: #0f172a;
}

.print-doc-meta-item {
  font-size: 8.2pt;
}

/* Formal Itemized Table */
.print-data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 7.8pt;
  color: #1e293b;
}

.print-data-table th,
.print-data-table td {
  border: 1px solid #94a3b8;
  padding: 4px 5px;
  vertical-align: middle;
}

.print-data-table thead th {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 800;
  text-align: center;
  padding: 5px 4px;
  border-bottom: 1.5px solid #475569;
}

.print-data-table tbody td {
  background: #ffffff;
}

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

.print-data-table tfoot th {
  background: #f8fafc !important;
  color: #0f172a !important;
  font-weight: 800;
  border-top: 1.5px solid #475569;
  padding: 5px 4px;
}

/* Verification Checkbox Square for Print Sheets */
.print-chk-square {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1.2px solid #64748b;
  border-radius: 2px;
  background: #ffffff;
  vertical-align: middle;
}

/* Financial Settlement Cards */
.print-kpi-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.print-kpi-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
}

.print-kpi-box-title {
  font-size: 7.2pt;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 2px;
}

.print-kpi-box-val {
  font-size: 9.5pt;
  font-weight: 800;
  color: #0f172a;
}

.print-kpi-box.highlight {
  background: #eff6ff;
  border: 1.5px solid #3b82f6;
}

.print-kpi-box.highlight .print-kpi-box-title {
  color: #1e40af;
}

.print-kpi-box.highlight .print-kpi-box-val {
  font-size: 11pt;
  color: #1e3a8a;
}

/* Signatures Section */
.print-signatures-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: auto;
  padding-top: 16px;
}

.print-signatures-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

.print-sig-box {
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
  background: #fafafa;
}

.print-sig-role {
  font-size: 8pt;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 24px;
}

.print-sig-line {
  border-bottom: 1px dotted #475569;
  width: 80%;
  margin: 0 auto 6px auto;
}

.print-sig-name {
  font-size: 7.8pt;
  color: #475569;
}

.print-sig-date {
  font-size: 7.2pt;
  color: #64748b;
  margin-top: 4px;
}

.print-signatures-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: auto;
  padding-top: 14px;
}

.print-group-pill {
  display: inline-block;
  font-size: 8pt;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
}

.print-group-pill.rock-sand {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.print-group-pill.cement {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.print-page-footer {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7.5pt;
  color: #64748b;
  border-top: 1px solid #cbd5e1;
}

/* Routes Table Filter Bar */
.routes-filter-bar {
  transition: all 0.2s ease;
}

.routes-filter-bar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--group-accent-rgb), 0.15);
}

/* Merge Locations Modal Cards */
.merge-candidate-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s;
}

.merge-candidate-card:hover {
  border-color: #cbd5e1;
}

.merge-candidate-card.is-selected {
  border-color: #f59e0b;
  background: #fffdfa;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

.merge-items-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0.65rem 0;
}

.merge-item-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.82rem;
  color: #334155;
}

.merge-item-pill.is-master {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  font-weight: 700;
}

@page {
  size: A4 portrait;
  margin: 8mm 10mm 8mm 10mm;
}

@media print {
  html, body {
    background: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 8.5pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .app-header, .logo-popup-menu, .app-sidebar, .app-topbar, .app-main-wrapper, .app-layout, header, nav, main, .modal-backdrop, .no-print, #print-preview-backdrop {
    display: none !important;
  }

  #print-engine-container,
  .print-only {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .print-preview-sheet.a4-sheet,
  .a4-sheet {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .print-preview-sheet.a4-sheet:last-child,
  .a4-sheet:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .print-data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.2pt !important;
  }

  .print-data-table th,
  .print-data-table td {
    border: 1px solid #333333 !important;
    padding: 2.5px 3px !important;
  }

  .print-chk-square {
    display: inline-block !important;
    width: 10px !important;
    height: 10px !important;
    border: 1.2px solid #000000 !important;
    border-radius: 2px !important;
    background: #ffffff !important;
    vertical-align: middle !important;
  }

  .print-data-table thead th {
    background: #e2e8f0 !important;
    color: #000000 !important;
    font-weight: 800 !important;
  }

  .print-data-table tfoot th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    font-weight: 800 !important;
  }

  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-kpi-summary-row,
  .print-signatures-2col,
  .print-signatures-4col,
  .print-sig-box {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}


/* ==========================================================================
   EXTRA INTERACTIVE HOVER LIFT & AURA GLOW ENHANCEMENTS
   ========================================================================== */

/* Form Group & Control Hover */
.form-control {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.form-control:hover {
  border-color: #c4bdad;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.12);
}

.filter-col {
  transition: transform 0.2s ease;
}

.filter-col:hover label {
  color: #b45309;
  transform: translateX(2px);
  transition: all 0.18s ease;
}

/* Tab 1 Bottom Summary Box Hover Aura */
#tab-entry form > div:last-child {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

#tab-entry form > div:last-child:hover {
  transform: translateY(-2.5px);
  box-shadow: inset 0 1px 0 #ffffff, 0 8px 24px rgba(217, 119, 6, 0.12), 0 0 22px rgba(245, 158, 11, 0.2);
}

/* Supervisor Breakdown Rows Hover Lift & Aura */
#sup-materials-list > div,
#sup-dest-list > div,
#sup-drivers-list > div {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 10px 8px;
  border-radius: 10px;
}

#sup-materials-list > div:hover,
#sup-dest-list > div:hover,
#sup-drivers-list > div:hover {
  background: #fdfbf7;
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 4px 14px rgba(55, 53, 47, 0.05), 0 0 16px rgba(245, 158, 11, 0.16);
}

/* Todo Kanban Items Hover Lift & Aura */
#todos-container .card > div > div > div {
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#todos-container .card > div > div > div:hover {
  transform: translateY(-3.5px) scale(1.02);
  box-shadow: 0 10px 22px rgba(55, 53, 47, 0.08), 0 0 18px rgba(245, 158, 11, 0.2);
  border-color: #d0c9bb;
}

/* Table Action Buttons Hover Lift & Aura */
.data-table button.btn-sm {
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.data-table button.btn-sm:hover {
  transform: translateY(-2px) scale(1.18);
  box-shadow: 0 4px 12px rgba(55, 53, 47, 0.12), 0 0 14px rgba(245, 158, 11, 0.28);
}


/* ==========================================================================
   ENTERPRISE SUITE: AUTH, RBAC, PERIOD LOCKS, BATCH IMPORT & DATA QUALITY
   ========================================================================== */

/* 1. Header User Profile Pill */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.user-profile-badge:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-soft-3d);
}

.user-profile-badge .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.user-profile-badge .user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-profile-badge .user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-badge .btn-logout {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.user-profile-badge .btn-logout:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
  transform: translateY(-1px);
}

/* 2. Role Badges */
.badge-admin {
  background: #fdf4ff !important;
  color: #9333ea !important;
  border: 1px solid #f0abfc !important;
  font-weight: 700;
}

.badge-account {
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border: 1px solid #86efac !important;
  font-weight: 700;
}

.badge-entry {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 700;
}

.badge-locked {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 3. Field Anomaly Badges */
.field-anomaly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  animation: fadeIn 0.25s ease-in-out;
}

.field-anomaly-badge.danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1.5px solid #fecaca;
}

.field-anomaly-badge.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1.5px solid #fde68a;
}

/* 4. Period Lock Status Banner */
.period-locked-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #fef9ee 0%, #fef3c7 100%);
  border: 1.5px solid #fde68a;
  border-radius: 12px;
  color: #92400e;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 8px rgba(217, 119, 6, 0.08);
}

.period-locked-notice .notice-icon {
  font-size: 1.25rem;
}

/* 5. Login Portal Modal */
.login-backdrop {
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(8px) !important;
}

.login-card {
  max-width: 440px !important;
  width: 92% !important;
  padding: 2.25rem 2rem !important;
  border-radius: 24px !important;
  border: 1px solid var(--border-medium) !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 35px rgba(217, 119, 6, 0.15) !important;
  background: #ffffff !important;
}

.login-brand-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo-badge {
  width: 84px;
  height: 84px;
  margin: 0 auto 1rem auto;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-shadow: inset 0 1.5px 0 #ffffff, 0 8px 20px rgba(55, 53, 47, 0.06);
}

.login-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.login-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.login-error-box {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  text-align: center;
}

.quick-login-container {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed #e2e8f0;
}

.quick-login-divider {
  text-align: center;
  margin-bottom: 0.85rem;
}

.quick-login-divider span {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-login-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-quick-role {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-quick-role.role-admin {
  background: #faf5ff;
  border-color: #e9d5ff;
  color: #7e22ce;
}
.btn-quick-role.role-admin:hover {
  background: #f3e8ff;
  transform: translateX(4px);
}

.btn-quick-role.role-account {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
.btn-quick-role.role-account:hover {
  background: #dcfce7;
  transform: translateX(4px);
}

.btn-quick-role.role-entry {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.btn-quick-role.role-entry:hover {
  background: #dbeafe;
  transform: translateX(4px);
}

/* 6. Excel Batch Import Dropzone */
.excel-dropzone {
  border: 2.5px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.excel-dropzone:hover,
.excel-dropzone.dragover {
  border-color: #059669;
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.12);
}

.excel-dropzone .dropzone-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.excel-dropzone .dropzone-text strong {
  display: block;
  font-size: 1.05rem;
  color: #0f172a;
}

/* Batch preview status chips */
.badge-status-valid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
}

.badge-status-error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
}

.badge-status-warn {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
}

/* Locked trip row decoration */
.tr-locked-trip {
  background-color: rgba(254, 243, 199, 0.18) !important;
}

.tr-locked-trip td:first-child {
  border-left: 3px solid #d97706;
}


/* ==========================================================================
   FLEET & DRIVER PROFILES, EXPIRY HUB & ATTACHMENTS SUITE
   ========================================================================== */

/* 1. Smart Expiry Hub KPI Bar */
.fleet-expiry-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 1.5rem;
}

.hub-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.hub-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-soft-3d);
}

.hub-card.active {
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2), var(--shadow-soft-3d);
}

.hub-card .hub-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.hub-card .hub-meta {
  display: flex;
  flex-direction: column;
}

.hub-card .hub-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.hub-card .hub-count {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  margin: 2px 0;
}

.hub-card .hub-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

/* Hub Themes */
.hub-card.danger {
  background: #fffafa;
  border-color: #fecaca;
}
.hub-card.danger .hub-count { color: #dc2626; }
.hub-card.danger.active {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2), var(--shadow-soft-3d);
}

.hub-card.warning {
  background: #fffbf7;
  border-color: #fed7aa;
}
.hub-card.warning .hub-count { color: #ea580c; }
.hub-card.warning.active {
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2), var(--shadow-soft-3d);
}

.hub-card.notice {
  background: #fefef5;
  border-color: #fef08a;
}
.hub-card.notice .hub-count { color: #ca8a04; }
.hub-card.notice.active {
  border-color: #ca8a04;
  box-shadow: 0 0 0 3px rgba(202, 138, 4, 0.2), var(--shadow-soft-3d);
}

.hub-card.success {
  background: #f8fdf9;
  border-color: #bbf7d0;
}
.hub-card.success .hub-count { color: #16a34a; }
.hub-card.success.active {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2), var(--shadow-soft-3d);
}

/* 2. Fleet Cards Grid */
.fleet-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.fleet-profile-card {
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  border-radius: 20px;
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.fleet-profile-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-clay), 0 0 20px rgba(217, 119, 6, 0.12);
  border-color: var(--border-medium);
}

/* Status Indicator Top Bar */
.fleet-card-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.fleet-card-plate-wrap {
  display: flex;
  flex-direction: column;
}

.fleet-card-plate {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  letter-spacing: 0.5px;
}

.fleet-card-trailer {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  margin-top: 2px;
}

.fleet-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.fleet-card-model {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}

/* Driver Box inside Card */
.fleet-card-driver-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
}

.fleet-card-driver-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.fleet-card-driver-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fleet-card-driver-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fleet-card-driver-phone {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

/* Expiry Metric Chips inside Card */
.fleet-card-expiry-box {
  background: #fdfbf7;
  border: 1.5px solid #fde68a;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}

.fleet-card-expiry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fleet-card-expiry-label {
  font-weight: 600;
  color: #78350f;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Countdown Badges */
.countdown-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.countdown-pill.expired {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulseWarning 1.8s infinite;
}

.countdown-pill.urgent {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.countdown-pill.upcoming {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.countdown-pill.valid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* Document & Photo Badges Bar */
.fleet-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.fleet-card-doc-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-view-fleet-profile {
  background: var(--bg-surface);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-view-fleet-profile:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

/* 3. Fleet Detail Modal Tabs & Panels */
.fleet-modal-tabs {
  gap: 8px;
}

.fleet-tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.92rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fleet-tab-btn:hover {
  color: var(--primary);
}

.fleet-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #ffffff;
  border-radius: 8px 8px 0 0;
}

/* 4. Photo Gallery Grid in Modal */
.fleet-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.photo-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  aspect-ratio: 4/3;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-card:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

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

.photo-card-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(2px);
}

.photo-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(220, 38, 38, 0.9);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
}

.photo-delete-btn:hover {
  background: #b91c1c;
  transform: scale(1.1);
}

.empty-gallery-notice {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  font-size: 0.88rem;
}

/* ==========================================================================
   SIDE-BY-SIDE HEAD & TRAILER EXPIRY CARDS & INSURANCE CLAIM BOX
   ========================================================================== */

.expiry-cards-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 1.25rem;
}

@media (max-width: 820px) {
  .expiry-cards-container {
    grid-template-columns: 1fr;
  }
}

.expiry-card-box {
  border-radius: 16px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tractor Head Accent */
.expiry-card-box.head-box {
  background: #fffcf4;
  border: 1.5px solid #fde68a;
}

.expiry-card-box.head-box:hover {
  border-color: #f59e0b;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.12);
}

.expiry-card-box.head-box .expiry-card-title {
  color: #b45309;
}

/* Trailer Accent */
.expiry-card-box.trailer-box {
  background: #f4fdf8;
  border: 1.5px solid #a7f3d0;
}

.expiry-card-box.trailer-box:hover {
  border-color: #10b981;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.12);
}

.expiry-card-box.trailer-box .expiry-card-title {
  color: #047857;
}

.expiry-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.expiry-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expiry-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.expiry-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}

.expiry-card-plate {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  display: inline-block;
  margin-top: 2px;
}

/* Insurance Company & Emergency Claim 24h Box */
.insurance-claim-box {
  margin-top: 14px;
  background: #f6f9fe;
  border: 1.5px solid #bfdbfe;
  border-radius: 16px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.04);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.insurance-claim-box:hover {
  border-color: #60a5fa;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.1);
}

.insurance-claim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.insurance-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insurance-icon {
  font-size: 1.45rem;
}

.insurance-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #1e40af;
  margin: 0;
  letter-spacing: -0.01em;
}

.insurance-subtitle {
  font-size: 0.74rem;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

.quick-claim-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quick-claim-btn:hover {
  background: #1e40af;
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.45);
}

/* ==========================================================================
   SMART MERGE & DEDUPLICATE LOCATIONS MODAL STYLES
   ========================================================================== */
.merge-candidate-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
}

.merge-candidate-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.merge-items-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px 0;
}

.merge-item-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  transition: all 0.18s ease;
}

.merge-item-pill.active-master {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 700;
}

.merge-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  color: #1e293b;
  transition: background 0.15s ease;
}

.merge-radio-option:hover {
  background: #f8fafc;
}

/* Routes Print Preview Toolbar Enhancements */
#print-preview-toolbar {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  transition: all 0.2s ease;
}

#print-preview-toolbar select.form-control:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

/* ==========================================================================
   APPLE iOS SYSTEM COMPONENTS (SQUIRCLES, INSET GROUPS, SEGMENTED CONTROLS)
   ========================================================================== */

/* 1. Small iOS Squircle Icon (32px x 32px) for Section Titles */
.ios-icon-squircle-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), inset 0 0.5px 0.5px rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.ios-icon-squircle-sm .ios-emoji {
  font-size: 1.05rem;
  z-index: 1;
}

.ios-icon-squircle-sm svg,
.ios-icon-squircle-sm [data-lucide],
.ios-icon-squircle-sm .lucide {
  width: 17px;
  height: 17px;
  stroke: #ffffff;
  stroke-width: 2;
  fill: none;
  z-index: 1;
}

/* 2. Apple iOS Inset Group Container */
.ios-form-section {
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ios-form-section:hover {
  border-color: rgba(0, 0, 0, 0.14);
}

.ios-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.ios-section-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0;
}

.ios-section-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin-left: auto;
}

/* 3. Apple iOS Segmented Control */
.view-mode-toggle,
.ios-segmented-control {
  display: inline-flex;
  background: rgba(118, 118, 128, 0.12);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  align-items: center;
}

.view-mode-btn,
.ios-segmented-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.view-mode-btn:hover,
.ios-segmented-btn:hover {
  color: #0f172a;
}

.view-mode-btn.active,
.ios-segmented-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* 4. Apple Dynamic Island Capsule Toast Notification */
.ios-dynamic-island {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-65px) scale(0.85);
  background: #090d16;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.36s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.28s ease, box-shadow 0.3s;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  max-width: 90vw;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.ios-dynamic-island.is-active {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  box-shadow: 0 20px 48px -4px rgba(0, 0, 0, 0.55), 0 0 20px var(--sidebar-glow), 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* 5. iOS Capsule Bottom Summary Bar */
.ios-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.2rem 1.6rem;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* =========================================================
   DISPATCH SYSTEM STYLES (ระบบจ่ายงานให้คนขับรถ)
   ========================================================= */

/* 1. Dispatch Toolbar */
.dispatch-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
  margin-bottom: 20px;
}

.dispatch-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dispatch-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dispatch-btn-line {
  background: linear-gradient(135deg, #06c755 0%, #05a847 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(6, 199, 85, 0.35) !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px !important;
  padding: 8px 16px !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dispatch-btn-line:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 199, 85, 0.45) !important;
}

/* 2. Dispatch Metrics Grid */
.dispatch-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.dispatch-metric-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s ease;
}

.dispatch-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.dispatch-metric-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.dispatch-metric-lbl {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.dispatch-chip-dest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.dispatch-chip-dest .count-badge {
  background: #0284c7;
  color: #ffffff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.72rem;
}

/* 3. Dispatch Board Table */
.dispatch-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.dispatch-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: 0.88rem;
}

.dispatch-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}

.dispatch-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.dispatch-table tr:hover td {
  background: #fbfcfe;
}

.dispatch-table tr.row-disabled td {
  background: #f8fafc;
  opacity: 0.72;
}

.dispatch-trip-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  min-width: 200px;
}

.dispatch-trip-box.active-trip {
  background: #ffffff;
  border-color: #cbd5e1;
}

.dispatch-input-sm {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.82rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-sizing: border-box;
}

.dispatch-input-sm:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.dispatch-status-select {
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
}

.dispatch-status-select.status-normal {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.dispatch-status-select.status-repair {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.dispatch-status-select.status-leave {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.dispatch-status-select.status-service {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.dispatch-status-select.status-standby {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

/* 4. Compact Queue in Tab-Entry */
.dispatch-queue-compact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #fffbf5 100%);
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  padding: 8px 14px;
  margin-bottom: 16px;
  box-shadow: 0 3px 12px rgba(249, 115, 22, 0.06);
  flex-wrap: wrap;
  position: relative;
}

.dispatch-compact-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dispatch-icon-badge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dispatch-icon-squircle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
}

.dispatch-icon-squircle svg,
.dispatch-icon-squircle i {
  width: 18px;
  height: 18px;
}

.dispatch-notification-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
  border: 1.5px solid #ffffff;
}

.dispatch-compact-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9a3412;
  white-space: nowrap;
}

.dispatch-queue-list-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

/* Plate Chip with Popover Trigger */
.dispatch-plate-chip-wrap {
  position: relative;
  display: inline-block;
}

.dispatch-plate-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: #ffffff;
  border: 1.5px solid #fdba74;
  color: #9a3412;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  user-select: none;
}

.dispatch-plate-chip:hover,
.dispatch-plate-chip.active {
  background: #ffedd5;
  border-color: #f97316;
  color: #c2410c;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.18);
}

.dispatch-plate-chip .plate-num {
  font-weight: 800;
  color: #0f172a;
}

.dispatch-plate-chip .trip-pill-badge {
  background: #f97316;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
}

/* Hover Popover Card */
.dispatch-popover-card {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1050;
  min-width: 320px;
  max-width: 420px;
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(249, 115, 22, 0.08);
  display: none;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.dispatch-plate-chip-wrap:hover .dispatch-popover-card,
.dispatch-plate-chip-wrap:focus-within .dispatch-popover-card,
.dispatch-popover-card.open {
  display: block;
}

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

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

.dispatch-popover-header .driver-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.dispatch-popover-trip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.dispatch-popover-trip-item {
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  padding: 9px 10px;
  transition: all 0.15s ease;
}

.dispatch-popover-trip-item:hover {
  background: #fff7ed;
  border-color: #fdba74;
}

.dispatch-popover-trip-dest {
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
}

.dispatch-popover-trip-meta {
  font-size: 0.76rem;
  color: #64748b;
  margin: 3px 0 6px 0;
  line-height: 1.35;
}

.dispatch-popover-trip-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.btn-fill-dispatch {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-fill-dispatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.35);
}

/* 5. LINE Message Modal Preview */
.line-modal-preview {
  background: #79a7d3;
  border-radius: 16px;
  padding: 16px;
  max-height: 480px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.line-chat-bubble {
  background: #ffffff;
  border-radius: 14px 14px 14px 2px;
  padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #111827;
  font-family: monospace, inherit;
}

/* iOS Style Toggle Switch for Permissions Matrix */
.perm-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.perm-toggle-switch.disabled {
  cursor: default;
  opacity: 0.88;
}

.perm-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.perm-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: #cbd5e1;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.perm-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.perm-toggle-switch input:checked + .perm-slider {
  background: linear-gradient(135deg, #10b981, #059669);
}

.perm-toggle-switch input:checked + .perm-slider:before {
  transform: translateX(20px);
}

.perm-toggle-switch.locked input:checked + .perm-slider {
  background: linear-gradient(135deg, #9333ea, #7e22ce);
}

.perm-status-label {
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 0.2s;
  min-width: 58px;
  text-align: left;
}

.perm-status-label.on {
  color: #059669;
}

.perm-status-label.off {
  color: #94a3b8;
}

.perm-status-label.admin-lock {
  color: #7e22ce;
}

/* ==========================================================================
   GPS TELEMETRY & REAL-TIME TRACKING STYLES (ONETRACK)
   ========================================================================== */

.badge-gps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-gps:hover {
  transform: translateY(-1.5px) scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* 🟢 Running */
.badge-gps-running {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.badge-gps-running:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

/* 🟡 Idle (Engine on, parked) */
.badge-gps-idle {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.badge-gps-idle:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}

/* 🔴 Parked (Engine off) */
.badge-gps-parked {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.badge-gps-parked:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* ⚪ Offline / No signal */
.badge-gps-offline {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}
.badge-gps-offline:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

/* Live Pulse Indicator Dot */
.gps-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background-color: currentColor;
}

.badge-gps-running .gps-pulse-dot {
  animation: gpsPulse 1.6s infinite;
}

@keyframes gpsPulse {
  0% { transform: scale(0.95); opacity: 0.85; }
  50% { transform: scale(1.4); opacity: 1; filter: drop-shadow(0 0 4px #10b981); }
  100% { transform: scale(0.95); opacity: 0.85; }
}

/* GPS Map Modal & Telemetry Overlay */
.modal-gps-card {
  max-width: 840px !important;
  width: 95vw !important;
  border-radius: 24px;
}

#gps-map-canvas {
  width: 100%;
  height: 440px;
  background: #e2e8f0;
  z-index: 1;
}

.gps-telemetry-overlay {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18);
  max-width: 290px;
  font-size: 0.82rem;
  color: #1e293b;
  pointer-events: auto;
}

.gps-telemetry-title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 6px;
}

.gps-telemetry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 0.8rem;
}

.gps-telemetry-label {
  color: #64748b;
}

.gps-telemetry-val {
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}

/* =========================================================
   DISPATCH TRIP STEPPER (GRAB / LINE MAN STYLE)
   ========================================================= */

.dispatch-trip-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 8px;
  margin-top: 6px;
  user-select: none;
}

.trip-step-node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  position: relative;
  white-space: nowrap;
}

.trip-step-node:hover {
  background: #f1f5f9;
  color: #475569;
}

.trip-step-node.done {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.trip-step-node.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
  animation: pulseStep 2s infinite;
}

@keyframes pulseStep {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.trip-step-node .step-bullet {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  background: #cbd5e1;
  color: #ffffff;
  flex-shrink: 0;
}

.trip-step-node.done .step-bullet {
  background: #059669;
}

.trip-step-node.active .step-bullet {
  background: #2563eb;
}

.trip-step-node .step-time {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  margin-left: 2px;
}

.trip-step-connector {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  min-width: 8px;
}

.trip-step-connector.done {
  background: #059669;
}

.btn-trip-live-map {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
  margin-left: 4px;
}

.btn-trip-live-map:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
}

/* Modal Route Tracking Enhancements */
.route-telemetry-hud {
  font-family: inherit;
  font-size: 0.82rem;
  color: #0f172a;
  min-width: 260px;
}

.route-telemetry-hud .hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}

.route-telemetry-hud .hud-row:last-child {
  border-bottom: none;
}

.route-telemetry-hud .hud-label {
  color: #64748b;
  font-size: 0.78rem;
}

.route-telemetry-hud .hud-value {
  font-weight: 700;
  color: #0f172a;
}

/* Modal Stepper Big Bar (Inside Tracking Modal) */
.modal-route-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  gap: 8px;
  width: 100%;
}

.modal-route-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  flex: 1;
  position: relative;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.modal-route-step:hover {
  background: rgba(241, 245, 249, 0.8);
}

.modal-route-step .step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  background: #f1f5f9;
  color: #94a3b8;
  border: 2px solid #cbd5e1;
  transition: all 0.2s ease;
  z-index: 2;
}

.modal-route-step.done .step-circle {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}

.modal-route-step.active .step-circle {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
}

.modal-route-step .step-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
}

.modal-route-step.done .step-text {
  color: #059669;
}

.modal-route-step.active .step-text {
  color: #1d4ed8;
}

.modal-route-step .step-subtext {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.modal-route-step-bar {
  flex: 1;
  height: 3px;
  background: #cbd5e1;
  margin-top: -24px;
  z-index: 1;
}

.modal-route-step-bar.done {
  background: #10b981;
}

/* Station Geofence Badges */
.badge-geofence-linked {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-geofence-unlinked {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-geofence-suggested {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Daily Vehicle Timeline Views & Components */
.dispatch-view-switcher .btn-tab-view {
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.dispatch-view-switcher .btn-tab-view:hover {
  filter: brightness(0.97);
}

.dispatch-view-switcher .btn-tab-view.active {
  border-color: #0284c7 !important;
  background: #e0f2fe !important;
  color: #0369a1 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}

.vehicle-timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .vehicle-timeline-grid {
    grid-template-columns: 1fr;
  }
}

.vehicle-timeline-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.vehicle-timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.vehicle-timeline-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vehicle-timeline-plate {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vehicle-timeline-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.timeline-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-trips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-trip-chip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.83rem;
  color: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.timeline-trip-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.timeline-events-flow {
  position: relative;
  padding-left: 20px;
  margin-left: 6px;
  border-left: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-event-item {
  position: relative;
  font-size: 0.82rem;
  color: #334155;
}

.timeline-event-dot {
  position: absolute;
  left: -27px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 1.5px #cbd5e1;
}

.timeline-event-dot.arrival {
  background: #10b981;
}

.timeline-event-dot.departure {
  background: #f59e0b;
}

.timeline-event-title {
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-event-meta {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-dwell-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.timeline-empty-hint {
  font-size: 0.82rem;
  color: #94a3b8;
  font-style: italic;
  padding: 8px 0;
}


/* ==========================================================================
   SUPERVISOR SUB-TABS & MONTHLY TARGET MATRIX (ปูนผง & หิน-ทราย)
   ========================================================================== */

.supervisor-subnav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.segmented-subtabs {
  display: inline-flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sup-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.sup-subtab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.5);
}

.sup-subtab-btn.active {
  background: #ffffff;
  color: #0284c7;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Quick Group Switcher in Targets Matrix */
.matrix-group-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.matrix-group-pill:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.matrix-group-pill.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

/* Target Matrix Top Summary Cards */
.matrix-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.matrix-kpi-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-soft-3d);
  transition: transform 0.2s, box-shadow 0.2s;
}

.matrix-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.matrix-kpi-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.matrix-kpi-val {
  font-size: 1.7rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.2;
}

.matrix-kpi-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* Spreadsheet Matrix Table */
.matrix-table-container {
  overflow-x: auto;
  border-radius: 16px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  box-shadow: var(--shadow-soft-3d);
  position: relative;
  max-width: 100%;
}

.matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
  font-family: inherit;
}

.matrix-table thead th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  padding: 10px 10px;
  text-align: center;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.matrix-table thead th:last-child {
  border-right: none;
}

/* Header Categories & Color Accents */
.matrix-th-history {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

.matrix-th-current {
  background: #fef9c3 !important;
  color: #854d0e !important;
  border-bottom-color: #facc15 !important;
}

.matrix-th-target {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}

.matrix-th-metrics {
  background: #f0fdf4 !important;
  color: #15803d !important;
}

.matrix-th-finance {
  background: #ecfdf5 !important;
  color: #047857 !important;
}

.matrix-th-orc {
  background: #fff7ed !important;
  color: #c2410c !important;
}

/* Freeze First Column (Month) */
.matrix-table th.matrix-col-freeze,
.matrix-table td.matrix-col-freeze {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #ffffff;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.04);
}

.matrix-table thead th.matrix-col-freeze {
  z-index: 15;
  background: #f8fafc;
}

.matrix-table tbody tr:hover td.matrix-col-freeze {
  background: #f8fafc;
}

/* Cells Styling */
.matrix-table td {
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap;
}

.matrix-table td:last-child {
  border-right: none;
}

.matrix-table tbody tr:hover td {
  background-color: #fbfcfe;
}

/* Matrix Inputs (Spreadsheet style) */
.matrix-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  text-align: right;
  padding: 5px 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  border-radius: 6px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s ease-in-out;
}

.matrix-input:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.matrix-input:focus {
  background: #ffffff;
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* Auto-calculated cells */
.matrix-calc-cell {
  background: #f8fafc;
  color: #1e293b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 6px 8px;
}

.matrix-calc-cell.current-year-col {
  background: #fefce8;
  color: #713f12;
  font-weight: 800;
}

/* Percentage Badges */
.matrix-pct-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.matrix-pct-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.matrix-pct-info {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.matrix-pct-warning {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.matrix-pct-zero {
  color: #94a3b8;
  font-weight: 500;
}

/* Executive Total Footer Row */
.matrix-table tr.matrix-total-row td {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 0.92rem;
  border-top: 2.5px solid #0284c7;
  border-bottom: none;
  padding: 10px 8px;
  font-variant-numeric: tabular-nums;
}

.matrix-table tr.matrix-total-row td.matrix-col-freeze {
  background: #0f172a !important;
  color: #38bdf8 !important;
}

.matrix-table tr.matrix-total-row .matrix-pct-pill {
  border: none;
}

/* Executive Target Charts Styling */
.target-charts-card {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.target-scope-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.target-scope-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.target-scope-btn.active {
  background: #ffffff;
  color: #0284c7;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid #cbd5e1;
}

.target-subchart-box {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.target-subchart-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.06);
}

.target-chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
}

/* Multi-Month Selector Chips & Presets */
.month-chips-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.month-chip {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}

.month-chip:hover {
  border-color: #94a3b8;
  color: #0f172a;
  background: #f1f5f9;
  transform: translateY(-1px);
}

.month-chip.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  font-weight: 800;
}

.month-quick-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.month-quick-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.month-quick-btn.month-quick-clear:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* Executive Scorecard Styling */
.exec-scorecard-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exec-scorecard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.06);
}

.exec-eff-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.exec-eff-pill strong {
  color: #0f172a;
}

@media (max-width: 1200px) {
  .target-charts-grid-3 {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 768px) {
  .target-charts-grid-3 {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   MONTHLY TRANSPORT COST MATRIX (EXECUTIVE & MANAGERS)
   ========================================================================== */
.monthly-matrix-scroll-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  position: relative;
  max-height: 75vh;
  overflow-y: auto;
}

.cost-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cost-subtab-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.cost-subtab-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.monthly-cost-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  font-family: inherit;
  text-align: center;
}

.monthly-cost-table thead tr:nth-child(1) th {
  position: sticky;
  top: 0;
  z-index: 25;
}
.monthly-cost-table thead tr:nth-child(2) th {
  position: sticky;
  top: 32px;
  z-index: 24;
}
.monthly-cost-table thead tr:nth-child(3) th {
  position: sticky;
  top: 64px;
  z-index: 23;
}
.monthly-cost-table thead tr:nth-child(4) th {
  position: sticky;
  top: 96px;
  z-index: 22;
}
.monthly-cost-table thead tr:nth-child(5) th {
  position: sticky;
  top: 128px;
  z-index: 21;
}

.monthly-cost-table th {
  padding: 6px 8px;
  font-weight: 700;
  border-bottom: 1px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
  background: #f8fafc;
  color: #334155;
}

.monthly-cost-table th.mc-th-old {
  background: #fff7ed !important;
  color: #c2410c !important;
  border-bottom: 2px solid #fb923c !important;
}

.monthly-cost-table th.mc-th-new {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border-bottom: 2px solid #4ade80 !important;
}

.monthly-cost-table th.mc-th-quarry {
  background: #ffffff;
  color: #0f172a;
  font-size: 0.86rem;
}

.monthly-cost-table th.mc-th-subcol {
  font-size: 0.76rem;
  padding: 4px 6px;
  background: #f1f5f9;
  color: #475569;
}

.monthly-cost-table th.mc-th-total {
  background: #eff6ff !important;
  color: #1e40af !important;
}

.monthly-cost-table .mc-sticky-col-0 {
  position: sticky;
  left: 0;
  width: 45px;
  min-width: 45px;
  max-width: 45px;
  z-index: 15;
  background: #f8fafc;
  text-align: center;
  border-right: 1px solid #cbd5e1;
}

.monthly-cost-table .mc-sticky-col-1 {
  position: sticky;
  left: 45px;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  z-index: 15;
  background: #ffffff;
  text-align: left;
  font-weight: 700;
  color: #0f172a;
  border-right: 2px solid #cbd5e1;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.04);
  padding-left: 10px;
}

.monthly-cost-table thead th.mc-sticky-col-0,
.monthly-cost-table thead th.mc-sticky-col-1 {
  z-index: 30 !important;
  background: #e2e8f0;
}

.monthly-cost-table td {
  padding: 3px 4px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap;
}

.monthly-cost-table tbody tr:hover td {
  background-color: #f8fafc;
}
.monthly-cost-table tbody tr:hover td.mc-sticky-col-1 {
  background-color: #f1f5f9;
}

.mc-cell-input {
  width: 100%;
  min-width: 65px;
  max-width: 85px;
  padding: 4px 6px;
  border: 1px solid transparent;
  background: transparent;
  text-align: right;
  font-size: 0.82rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  transition: all 0.15s ease;
  color: #0f172a;
}

.mc-cell-input:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.mc-cell-input:focus {
  background: #ffffff;
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.mc-cell-total {
  font-weight: 800;
  color: #1e40af;
  background: #eff6ff;
  border-radius: 4px;
  padding: 4px 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  display: block;
}

.mc-map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  transition: all 0.15s ease;
}
.mc-map-btn:hover {
  background: #fca5a5;
  transform: scale(1.1);
}

.diesel-scale-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: center;
}

.diesel-scale-table th,
.diesel-scale-table td {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.diesel-scale-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
}

.diesel-scale-table td.active-bracket {
  background: #dbeafe !important;
  color: #1e40af !important;
  font-weight: 800 !important;
  border: 2px solid #3b82f6 !important;
}


