/* Load & Haul Operations Console CSS
 * OFALabs Minimalist, Data-Dense, Industrial Fleet Management System
 * - Theme: Minimalist, Data-Dense, Industrial / Fleet Management
 * - Absolute Rules: NO gradients, NO thick drop shadows. Flat, clean, proportional whitespace.
 * - Colors/radii/fonts are inherited from the global stylesheet
 *   /_next/static/chunks/1t4aoiqub9ec4.css; local --lp-* aliases below map
 *   page-level names onto the global tokens — do not hardcode hex values here.
 * - Semantic Status:
 *     HAULING: bg #e0f2fe, text #0369a1
 *     DUMPING / QUEUING: bg #fef9c3, text #854d0e / #475569
 *     LOADING / ACTIVE: bg #dcfce7, text #15803d
 *     BREAKDOWN: bg #fee2e2, text #b91c1c
 * - Spacing Grid: 4px, 8px, 12px, 16px, 24px
 */

:root {
  --lp-bg: var(--c-surface);
  --lp-surface: var(--c-white);
  --lp-surface-subtle: var(--c-surface);
  --lp-surface-hover: var(--c-surface2);
  --lp-surface-selected: #eff6ff;
  --lp-brand: var(--c-accent);
  --lp-brand-hover: var(--c-accent2);
  --lp-brand-light: #eff6ff;
  --lp-text-main: var(--c-text);
  --lp-text-muted: var(--c-sub);
  --lp-text-subtle: var(--c-muted);
  --lp-border: var(--c-border);
  --lp-border-light: var(--c-surface2);
  --lp-border-dark: var(--c-border2);
  --lp-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lp-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --lp-radius-panel: 10px;
  --lp-radius-card: 8px;
  --lp-radius-btn: 6px;
  --lp-radius-pill: 9999px;
  --lp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Base Console Container */
.lp-console {
  display: flex;
  flex-direction: column;
  background: var(--lp-bg);
  color: var(--lp-text-main);
  font-family: var(--lp-font);
  font-size: 13px;
  line-height: 1.5;
  width: 100%;
  min-height: calc(100vh - 64px);
  box-sizing: border-box;
  padding: 16px 24px 48px;
  gap: 16px;
  letter-spacing: -0.01em;
}

.lp-console * {
  box-sizing: border-box;
}

.lp-mono {
  font-family: var(--lp-mono);
  font-feature-settings: "tnum" 1;
}

/* ==================== PAGE HEADER STRIP ==================== */
.lp-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 4px;
}

.lp-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lp-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--lp-text-main);
  margin: 0;
  line-height: 1.2;
}

.lp-header-subtitle {
  font-size: 12px;
  color: var(--lp-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lp-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lp-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dcfce7;
  color: var(--c-loading);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--lp-radius-pill);
  border: 1px solid #bbf7d0;
  letter-spacing: 0.5px;
}

.lp-live-badge.offline {
  background: #fee2e2;
  color: var(--c-error);
  border-color: #fecaca;
}

.lp-live-badge.pending {
  background: #fef9c3;
  color: var(--c-dumping);
  border-color: #fef08a;
}

.lp-live-badge.pending .lp-live-dot {
  background: #eab308;
}

#loader-connection-status[data-tone="live"] { color: var(--c-loading); }
#loader-connection-status[data-tone="pending"],
#loader-connection-status[data-tone="warning"] { color: #a16207; }
#loader-connection-status[data-tone="danger"] { color: var(--c-error); }

.lp-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-loading);
}

.lp-live-dot.pulse {
  animation: lp-pulse 2s infinite ease-in-out;
}

@keyframes lp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.lp-update-time {
  font-size: 12px;
  color: var(--lp-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lp-alert-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: var(--c-error);
  border: 1px solid #fecaca;
  padding: 4px 10px;
  border-radius: var(--lp-radius-pill);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lp-alert-trigger-btn:hover {
  background: #fecaca;
}

/* ==================== KPI SUMMARY ROW ==================== */
.lp-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.lp-kpi-block {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-card);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--lp-shadow-sm);
  transition: border-color 0.15s ease;
}

.lp-kpi-block:hover {
  border-color: var(--lp-border-dark);
}

.lp-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--lp-text-muted);
}

.lp-kpi-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--lp-text-main);
  line-height: 1.1;
}

.lp-kpi-sub {
  font-size: 11px;
  color: var(--lp-text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== COMPACT STATE SUMMARY STRIP ==================== */
.lp-state-summary-strip {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-card);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--lp-shadow-sm);
}

.lp-state-groups {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.lp-state-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lp-state-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--lp-text-muted);
  letter-spacing: 0.5px;
}

.lp-state-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--lp-text-main);
  background: var(--lp-surface-subtle);
  border: 1px solid var(--lp-border-light);
  padding: 3px 8px;
  border-radius: var(--lp-radius-btn);
}

.lp-state-counter strong {
  font-family: var(--lp-mono);
  font-weight: 700;
}

.lp-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.lp-state-divider {
  width: 1px;
  height: 16px;
  background: var(--lp-border);
}

/* ==================== EXPANDABLE ALERTS BANNER ==================== */
.lp-alerts-banner {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--lp-radius-card);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: lp-fade-in 0.2s ease;
}

.lp-alerts-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #991b1b;
}

.lp-alerts-btn {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--lp-radius-btn);
  cursor: pointer;
}

.lp-alerts-btn:hover {
  background: #fecaca;
}

/* ==================== 3-COLUMN WORKSPACE ==================== */
.lp-workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
}

/* Shared Card System */
.lp-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  box-shadow: var(--lp-shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lp-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--lp-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--lp-surface);
}

.lp-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--lp-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-badge-counter {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--lp-mono);
  background: var(--lp-surface-hover);
  color: var(--lp-text-muted);
  padding: 2px 8px;
  border-radius: var(--lp-radius-pill);
}

/* Search Box */
.lp-search-box {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--lp-border-light);
  background: var(--lp-surface);
}

.lp-search-icon {
  color: var(--lp-text-subtle);
  margin-right: 8px;
  flex-shrink: 0;
}

.lp-search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--lp-font);
  font-size: 12px;
  color: var(--lp-text-main);
}

.lp-search-input::placeholder {
  color: var(--lp-text-subtle);
}

.lp-search-clear {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--lp-text-subtle);
  padding: 2px;
  display: inline-flex;
}

.lp-search-clear:hover {
  color: var(--lp-text-main);
}

/* ==================== COLUMN 1: LOADERS RAIL ==================== */
.lp-loader-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  max-height: 520px;
  overflow-y: auto;
}

.lp-loader-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-card);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.15s ease;
  user-select: none;
}

.lp-loader-card:hover {
  border-color: var(--lp-brand);
  background: var(--lp-surface-subtle);
}

.lp-loader-card.selected {
  border: 1.5px solid var(--lp-brand);
  background: var(--lp-surface-selected);
  box-shadow: 0 0 0 1px var(--lp-brand);
}

.lp-loader-card.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  background: var(--lp-brand);
  border-radius: 0 2px 2px 0;
}

.lp-loader-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lp-loader-id {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--lp-text-main);
}

.lp-loader-model {
  font-size: 11px;
  color: var(--lp-text-muted);
}

.lp-loader-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--lp-surface-subtle);
  border: 1px solid var(--lp-border-light);
  border-radius: var(--lp-radius-btn);
  padding: 5px 8px;
}

.lp-loader-card.selected .lp-loader-metrics {
  background: var(--c-white);
  border-color: #dbeafe;
}

.lp-loader-metric-col {
  display: flex;
  flex-direction: column;
}

.lp-loader-metric-label {
  font-size: 10px;
  color: var(--lp-text-subtle);
  text-transform: uppercase;
}

.lp-loader-metric-val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--lp-text-main);
}

/* ==================== COLUMN 2: SELECTED LOADER WORKSPACE ==================== */
.lp-main-ops {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Selected Loader Header Card */
.lp-selected-header-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--lp-shadow-sm);
}

.lp-selected-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.lp-selected-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lp-selected-id {
  font-size: 20px;
  font-weight: 800;
  color: var(--lp-text-main);
  letter-spacing: -0.02em;
}

.lp-selected-meta-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--lp-text-muted);
}

.lp-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Relationship Context Strip */
.lp-relation-strip {
  background: var(--lp-surface-subtle);
  border: 1px solid var(--lp-border-light);
  border-radius: var(--lp-radius-btn);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
}

.lp-relation-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--lp-text-muted);
}

.lp-relation-item {
  color: var(--lp-text-main);
  font-weight: 600;
}

.lp-relation-arrow {
  color: var(--lp-text-subtle);
  font-size: 10px;
}

.lp-telemetry-chips {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
}

.lp-telem-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--lp-text-muted);
}

.lp-telem-chip strong {
  color: var(--lp-text-main);
}

/* Active Truck Focus Card */
.lp-active-truck-card {
  background: var(--lp-surface);
  border: 1.5px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--lp-shadow-sm);
  position: relative;
}

.lp-active-truck-card.loading-active {
  border-color: #93c5fd;
  background: var(--c-white);
}

.lp-active-truck-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.lp-active-truck-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lp-active-truck-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--lp-brand);
  background: var(--lp-brand-light);
  padding: 2px 6px;
  border-radius: var(--lp-radius-btn);
  letter-spacing: 0.5px;
}

.lp-active-truck-id {
  font-size: 18px;
  font-weight: 800;
  color: var(--lp-text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.lp-next-state-badge {
  font-size: 11px;
  color: var(--lp-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--lp-surface-subtle);
  padding: 2px 8px;
  border-radius: var(--lp-radius-btn);
  white-space: nowrap;
}

.lp-truck-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lp-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--lp-radius-btn);
  border: 1px solid var(--lp-border);
  background: var(--lp-surface);
  color: var(--lp-text-main);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lp-btn-action:hover {
  background: var(--lp-surface-hover);
  border-color: var(--lp-border-dark);
}

.lp-btn-action.brand {
  background: var(--lp-brand);
  border-color: var(--lp-brand);
  color: var(--c-white);
}

.lp-btn-action.brand:hover {
  background: var(--lp-brand-hover);
}

.lp-truck-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.lp-stat-box {
  background: var(--lp-surface-subtle);
  border: 1px solid var(--lp-border-light);
  border-radius: var(--lp-radius-card);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-stat-label {
  font-size: 11px;
  color: var(--lp-text-muted);
  font-weight: 500;
}

.lp-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--lp-text-main);
}

.lp-stat-sub {
  font-size: 11px;
  color: var(--lp-text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Bar */
.lp-payload-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lp-payload-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--lp-text-muted);
}

.lp-payload-bar-track {
  width: 100%;
  height: 8px;
  background: var(--lp-border-light);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.lp-payload-bar-fill {
  height: 100%;
  background: var(--lp-brand);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.lp-payload-bar-fill.target-reached {
  background: var(--c-loading);
}

/* Standby Empty Bay Card */
.lp-empty-bay-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--lp-shadow-sm);
}

.lp-empty-bay-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lp-empty-bay-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-surface2);
  color: var(--c-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lp-empty-bay-text {
  display: flex;
  flex-direction: column;
}

.lp-empty-bay-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--lp-text-main);
}

.lp-empty-bay-desc {
  font-size: 12px;
  color: var(--lp-text-muted);
}

/* ==================== COLUMN 3: HAUL FLEET RAIL ==================== */
.lp-hauler-header-sub {
  font-size: 11px;
  color: var(--lp-text-muted);
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--lp-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lp-fleet-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--lp-border-light);
  background: var(--lp-surface-subtle);
}

.lp-filter-tab-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--lp-radius-btn);
  border: none;
  background: transparent;
  color: var(--lp-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lp-filter-tab-btn.active {
  background: var(--c-white);
  color: var(--lp-brand);
  border: 1px solid var(--lp-border);
  box-shadow: var(--lp-shadow-sm);
}

.lp-truck-dir-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--lp-border-light);
}

.lp-status-select {
  font-family: var(--lp-font);
  font-size: 11px;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-btn);
  padding: 4px 6px;
  color: var(--lp-text-main);
  background: var(--lp-surface);
  outline: none;
  max-width: 110px;
}

.lp-truck-list {
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow-y: auto;
}

.lp-truck-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--lp-border-light);
  cursor: pointer;
  transition: background 0.1s ease;
}

.lp-truck-row:hover {
  background: var(--lp-surface-hover);
}

.lp-truck-row.assigned-active {
  background: var(--c-surface);
}

.lp-truck-row.is-loading {
  background: #f0fdf4;
}

.lp-truck-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-truck-row-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--lp-text-main);
  white-space: nowrap;
}

.lp-truck-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-truck-row-metric {
  font-size: 11px;
  color: var(--lp-text-muted);
  font-family: var(--lp-mono);
  white-space: nowrap;
}

.lp-truck-hover-actions {
  display: none;
  gap: 4px;
}

.lp-truck-row:hover .lp-truck-hover-actions {
  display: flex;
}

.lp-truck-row:hover .lp-truck-row-metric {
  display: none;
}

.lp-btn-mini {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--lp-radius-btn);
  border: 1px solid var(--lp-border);
  background: var(--c-white);
  color: var(--lp-text-main);
  cursor: pointer;
  text-decoration: none;
}

.lp-btn-mini:hover {
  background: var(--lp-surface-hover);
  border-color: var(--lp-border-dark);
}

/* ==================== TRUCK QUEUE TABLE ==================== */
.lp-queue-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  box-shadow: var(--lp-shadow-sm);
  overflow: hidden;
}

.lp-table-container {
  width: 100%;
  overflow-x: auto;
}

.lp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.lp-table th {
  background: var(--lp-surface-subtle);
  color: var(--lp-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--lp-border);
  white-space: nowrap;
}

.lp-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--lp-border-light);
  color: var(--lp-text-main);
  vertical-align: middle;
}

.lp-table tr:hover {
  background: var(--lp-surface-hover);
}

.lp-table tr.lp-related-row {
  background: var(--c-surface);
  border-left: 3px solid var(--lp-brand);
}

.lp-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--lp-surface-hover);
  font-size: 11px;
  font-weight: 700;
  color: var(--lp-text-muted);
}

/* ==================== SHIFT & PERFORMANCE ANALYTICS (BELOW THE FOLD) ==================== */
.lp-analytics-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.lp-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--lp-border);
  padding-bottom: 8px;
}

.lp-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--lp-text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lp-section-sub {
  font-size: 12px;
  color: var(--lp-text-muted);
}

.lp-analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.lp-prod-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.lp-metrics-subgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px;
}

/* Balance Badges */
.lp-balance-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--lp-radius-pill);
  font-family: var(--lp-mono);
}

.lp-balance-badge.balance-balanced {
  background: #dcfce7;
  color: var(--c-loading);
  border: 1px solid #bbf7d0;
}

.lp-balance-badge.balance-over {
  background: #fef9c3;
  color: var(--c-dumping);
  border: 1px solid #fef08a;
}

.lp-balance-badge.balance-under {
  background: #fee2e2;
  color: var(--c-error);
  border: 1px solid #fecaca;
}

.lp-balance-reason {
  font-size: 11px;
  color: var(--lp-text-muted);
  margin-top: 4px;
}

/* Hourly Trend Chart */
.lp-trend-chart-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  padding: 16px;
  box-shadow: var(--lp-shadow-sm);
}

.lp-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 120px;
  padding: 16px 8px 8px;
  margin-top: 8px;
  border-bottom: 1px solid var(--lp-border);
}

.lp-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}

.lp-chart-bar-bg {
  width: 100%;
  max-width: 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.lp-chart-val {
  font-size: 10.5px;
  color: var(--lp-text-muted);
  margin-bottom: 4px;
}

.lp-chart-bar-fill {
  width: 100%;
  background: var(--c-accent);
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
  min-height: 4px;
}

.lp-chart-label {
  font-size: 11px;
  color: var(--lp-text-muted);
}

/* ==================== SEMANTIC STATUS PILLS ==================== */
.lp-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--lp-radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* Canonical Mappings per OFALabs guidelines */
.lp-status-LOADING,
.lp-status-ACTIVE {
  background: #dcfce7;
  color: var(--c-loading);
}

.lp-status-HAULING_LOADED,
.lp-status-HAULING,
.lp-status-REFUELING {
  background: #e0f2fe;
  color: #0369a1;
}

.lp-status-QUEUE_LOADING,
.lp-status-SPOTTING,
.lp-status-QUEUE_DUMP,
.lp-status-DUMPING {
  background: #fef9c3;
  color: var(--c-dumping);
}

.lp-status-RETURN_EMPTY,
.lp-status-STANDBY,
.lp-status-PARKED,
.lp-status-OFFLINE {
  background: var(--c-surface2);
  color: var(--c-queuing);
}

.lp-status-BREAKDOWN,
.lp-status-WORKSHOP {
  background: #fee2e2;
  color: var(--c-error);
}

/* ==================== MODALS ==================== */
.lp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lp-modal {
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-panel);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: lp-fade-in 0.15s ease-out;
}

.lp-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--lp-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lp-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--lp-text-main);
}

.lp-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lp-modal-footer {
  padding: 12px 18px;
  background: var(--lp-surface-subtle);
  border-top: 1px solid var(--lp-border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Mobile Tabs Header */
.lp-mobile-tabs {
  display: none;
  background: var(--lp-surface);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-card);
  padding: 4px;
  gap: 4px;
}

.lp-mobile-tab-btn {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--lp-text-muted);
  border-radius: var(--lp-radius-btn);
  cursor: pointer;
}

.lp-mobile-tab-btn.active {
  background: var(--lp-brand);
  color: var(--c-white);
}

/* ==================== RESPONSIVE ADAPTATIONS ==================== */
@media (max-width: 1280px) {
  .lp-kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .lp-workspace {
    grid-template-columns: 220px minmax(0, 1fr) 270px;
  }
}

/* Tablet (768px - 1024px): Stacked operational flow without tabs */
@media (min-width: 768px) and (max-width: 1024px) {
  .lp-console {
    padding: 12px 16px 36px;
  }

  .lp-mobile-tabs {
    display: none !important;
  }

  .lp-workspace {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .lp-col-loaders,
  .lp-col-haulers,
  .lp-main-ops,
  .lp-queue-wrapper,
  .lp-analytics-wrapper {
    width: 100%;
    display: block !important;
  }

  .lp-loader-rail,
  .lp-haul-rail {
    width: 100%;
  }

  .lp-loader-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: none;
  }

  .lp-analytics-grid,
  .lp-prod-grid {
    grid-template-columns: 1fr;
  }

  .lp-truck-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile (<= 767px): Tabbed layout */
@media (max-width: 767px) {
  /* Fix global shell scrim intercepting clicks when closed */
  .app-shell__scrim:not(.app-shell__scrim--visible) {
    pointer-events: none !important;
    display: none !important;
  }

  .lp-console {
    padding: 10px 12px 36px;
    gap: 12px;
  }

  .lp-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .lp-mobile-tabs {
    display: flex;
  }

  .lp-workspace {
    display: flex;
    flex-direction: column;
  }

  .lp-col-loaders,
  .lp-col-haulers,
  .lp-main-ops,
  .lp-queue-wrapper,
  .lp-analytics-wrapper {
    width: 100%;
  }

  .lp-loader-rail,
  .lp-haul-rail {
    width: 100%;
  }

  .lp-mobile-only-hidden,
  .lp-mobile-hidden,
  .lp-mobile-hide {
    display: none !important;
  }

  .lp-analytics-grid,
  .lp-prod-grid {
    grid-template-columns: 1fr;
  }

  .lp-truck-stats-grid {
    grid-template-columns: 1fr;
  }
}

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