/* --- FA0 CORE: STABLE TRACKER FOUNDATION --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { 
  overscroll-behavior-y: contain; 
  margin: 0; padding: 0; 
  height: 100%; width: 100%; 
  overflow: hidden; 
  position: fixed; 
}

body { 
  font-family: -apple-system, system-ui, sans-serif; 
  background: #fafafa; 
  padding: 12px;
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: env(safe-area-inset-bottom);
  overflow-y: auto; 
  -webkit-overflow-scrolling: touch;
}

.app-shell { max-width: 520px; margin: 0 auto; }

/* 1. TABS: Blue Theme */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { 
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid #ccc; 
  background: #fff; font-size: 14px; cursor: pointer; color: #666;
}
.tab.active { font-weight: 700; background: #007AFF; color: #fff; border-color: #007AFF; }
.tabPanel { display: none !important; } 
.tabPanel.active { display: block !important; }

/* 2. CARDS & INPUTS */
.card { 
  border: 1px solid #ddd; border-radius: 12px; padding: 16px; 
  background: #fff; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
}
.row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-end; }
label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: .6; margin-bottom: 4px; }
input, select, button { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #ccc; font-size: 16px; height: 44px; }

.addBtn { background: #007AFF; color: #fff; border: none; font-weight: 700; margin-top: 8px; }

/* 3. SUMMARY BAR (Totals Header) */
.summary-bar {
  background: #334155; color: white; border-radius: 12px;
  padding: 12px; display: flex; justify-content: space-around;
  margin-bottom: 12px; text-align: center; border-left: 4px solid #007AFF;
}
.summary-bar label { color: #cbd5e1; font-size: 9px; margin: 0; }
.summary-bar div { font-weight: 700; font-size: 16px; }

/* 4. HISTORY TABLES: Horizontal Density Fix */
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th { text-align: left; padding-bottom: 8px; border-bottom: 1px solid #eee; font-size: 10px; opacity: 0.5; text-transform: uppercase; }
td { padding: 12px 4px; border-bottom: 1px solid #eee; vertical-align: middle; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fuel Column Weighting */
#fuel-history th:nth-child(1) { width: 40%; }
#fuel-history th:nth-child(n+2):nth-child(-n+5) { width: 10%; text-align: center; }
#fuel-history th:last-child { width: 20%; text-align: right; }
#fuel-history td:nth-child(n+2):nth-child(-n+5) { text-align: center; }
#fuel-history td:last-child { text-align: right; }

/* 5. ACTION ICONS: Easy Fix for Edit/Delete */
.action-btn { background: none; border: none; font-size: 16px; cursor: pointer; padding: 4px; opacity: 0.6; width: auto; height: auto; }
.edit-icon { color: #007AFF; margin-right: 8px; }
.del-icon { color: #FF3B30; }

/* 6. MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; justify-content: center; align-items: center; padding: 20px; }
.modal-content { background: #fff; width: 100%; max-width: 400px; border-radius: 12px; padding: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }