/* ============================================================
   WAHTS Gau Raksha — Design System
   Mobile-First | Premium Dark UI | PWA Ready
   ============================================================ */

/* ─── CSS Custom Properties (Design Tokens) — UI_UX_PLAN.md aligned ── */
:root {
  /* Backgrounds — True Black (AMOLED battery saving) */
  --bg-void: #000000;
  --bg-surface: #0D0D14;
  --bg-elevated: #16161F;
  --bg-glass: rgba(255,255,255,0.06);
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* Legacy aliases (transition helpers) */
  --bg-primary: var(--bg-void);
  --bg-secondary: var(--bg-surface);
  --bg-tertiary: var(--bg-elevated);
  --bg-card: var(--bg-surface);
  --bg-card-hover: #1E1E2A;
  --bg-input: #0F0F18;

  /* Text — high contrast for dark mode */
  --text-primary: #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary: #636366;
  --text-muted: #48484A;

  /* Borders */
  --border-subtle: rgba(255,255,255,0.12);
  --border-active: rgba(255,255,255,0.22);
  --border-primary: var(--border-subtle);
  --border-secondary: var(--border-active);
  --border-focus: #FF8C00;

  /* Accent — Saffron (sacred cow protection) */
  --accent: #FF8C00;
  --accent-hover: #E07800;
  --accent-light: rgba(255, 140, 0, 0.10);
  --accent-text: #FFB800;

  /* Semantic / Status */
  --status-active: #32D74B;
  --status-critical: #FF453A;
  --status-warning: #FF9F0A;
  --status-info: #0A84FF;
  --status-legal: #BF5AF2;
  --accent-highvis: #E5FF00;

  --success: #32D74B;
  --success-bg: rgba(50, 215, 75, 0.10);
  --danger: #FF453A;
  --danger-bg: rgba(255, 69, 58, 0.10);
  --warning: #FF9F0A;
  --warning-bg: rgba(255, 159, 10, 0.10);
  --info: #0A84FF;
  --info-bg: rgba(10, 132, 255, 0.10);

  /* FIR Type Colors */
  --type-smuggling: #FF453A;
  --type-transport: #FF9F0A;
  --type-slaughter: #FF453A;
  --type-theft: #BF5AF2;

  /* Typography — Dual font stack */
  --font-display: 'Space Grotesk', 'Noto Sans Devanagari', 'Noto Sans Kannada', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', 'Noto Sans Devanagari', 'Noto Sans Kannada', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Grotesk', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  /* Legacy alias */
  --font-family: var(--font-body);

  /* Spacing — 8px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --space-10: 64px;
  /* Legacy aliases */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* Border Radius — Neo-Brutalist softened */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Shadows — subtle for true black */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px rgba(255, 140, 0, 0.15);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;

  /* Safe areas for mobile */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Bottom nav height */
  --nav-height: 64px;
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

/* ─── Loading Screen ─────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s var(--ease);
}
.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-content { text-align: center; }
.loading-icon { font-size: 48px; margin-bottom: 12px; animation: pulse 2s infinite; }
.loading-title { font-size: 22px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.loading-sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.loading-spinner {
  width: 28px; height: 28px; margin: 20px auto 0;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ─── App Layout ─────────────────────────────────────────────── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid var(--border-primary);
  padding: var(--space-md) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-md));
  display: flex;
  align-items: center;
  gap: var(--space-md);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}
.header-brand-icon { font-size: 24px; }
.header-brand-text { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--accent); letter-spacing: -0.3px; }
.header-brand-sub { font-size: 10px; color: var(--text-tertiary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.header-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* Main content area */
.app-main {
  flex: 1;
  padding: var(--space-lg);
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 120px);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  border-top: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  min-width: 48px;
  min-height: 48px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--duration) var(--ease), transform 0.1s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  justify-content: center;
}
.nav-item .material-icons-round { font-size: 24px; transition: transform var(--duration) var(--ease); }
.nav-item span:last-child { font-size: 10px; font-weight: 600; }
.nav-item.active { color: var(--accent); }
.nav-item.active::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.nav-item.active .material-icons-round { transform: scale(1.1); }
.nav-item:active { transform: scale(0.88); }

/* Raid Mode FAB */
.raid-fab {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: 3px solid var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: -20px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.raid-fab:active { transform: scale(0.9); }
.raid-fab .material-icons-round { font-size: 26px; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: border-color var(--duration) var(--ease), transform 0.15s var(--ease), box-shadow var(--duration) var(--ease);
}
.card:hover { border-color: var(--border-secondary); }
.card-accent { border-left: 3px solid var(--accent); }
.card-danger { border-left: 3px solid var(--danger); }
.card-success { border-left: 3px solid var(--success); }
.card-clickable { cursor: pointer; }
.card-clickable:hover { background: var(--bg-card-hover); box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.card-clickable:active { transform: scale(0.97); background: var(--bg-elevated); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.5px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
  font-weight: 500;
}
.stat-card.highlight {
  background: var(--accent-light);
  border-color: rgba(245, 158, 11, 0.2);
}
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #000;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4); }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-secondary);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.btn-full { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-md); }
.btn-icon .material-icons-round { font-size: 20px; }

/* Icon Button (header, etc.) */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); border-color: var(--accent); }
.icon-btn:active { transform: scale(0.88); background: var(--accent-light); }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-lg);
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}
.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), background var(--duration) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), inset 0 0 0 1px var(--accent);
  background: #111119;
}
.form-input::placeholder { color: var(--text-tertiary); }

.form-textarea { min-height: 80px; resize: vertical; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-help {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* File Upload */
.file-upload {
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}
.file-upload:hover, .file-upload.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-upload-icon { font-size: 32px; color: var(--text-tertiary); margin-bottom: 8px; }
.file-upload-text { font-size: 13px; color: var(--text-secondary); }

/* ─── Tags / Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

/* Status badges for FIR */
.status-open { background: var(--info-bg); color: var(--info); }
.status-investigation { background: var(--warning-bg); color: var(--warning); }
.status-chargesheet { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.status-trial { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.status-convicted { background: var(--success-bg); color: var(--success); }
.status-acquitted { background: var(--danger-bg); color: var(--danger); }
.status-closed { background: var(--bg-tertiary); color: var(--text-tertiary); }

/* ─── Lists ──────────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-primary);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--bg-tertiary); margin: 0 calc(-1 * var(--space-lg)); padding-left: var(--space-lg); padding-right: var(--space-lg); }

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.list-content { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.list-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.list-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.list-arrow { color: var(--text-muted); flex-shrink: 0; align-self: center; }

/* ─── Search Bar ─────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-md);
  margin-bottom: var(--space-lg);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.search-bar .material-icons-round { color: var(--text-secondary); font-size: 20px; }
.search-bar input {
  flex: 1;
  border: none;
  background: none;
  padding: 13px 10px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-tertiary); }

/* ─── Page Headers ───────────────────────────────────────────── */
.page-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.page-bar .page-title { margin-bottom: 0; }
.page-bar .page-subtitle { margin-top: 2px; }

.page-header {
  margin-bottom: var(--space-xl);
}
.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Section Headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  margin-top: var(--space-xl);
}
.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-secondary);
}
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.7; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; max-width: 280px; margin: 0 auto; }

/* ─── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 16px);
  left: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideDown 0.3s var(--ease);
  max-width: 500px;
  margin: 0 auto;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } }

/* ─── Bottom Sheet ───────────────────────────────────────────── */
.bottom-sheet { position: fixed; inset: 0; z-index: 1000; }
.bottom-sheet-overlay { position: absolute; inset: 0; background: var(--bg-overlay); }
.bottom-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s var(--ease);
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin: 10px auto;
}
.bottom-sheet-body { padding: var(--space-lg) var(--space-lg) var(--space-2xl); }

@keyframes slideUp { from { transform: translateY(100%); } }

/* ─── Raid Mode ──────────────────────────────────────────────── */
.raid-mode {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9998;
  display: flex;
  flex-direction: column;
}
.raid-header {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  padding: var(--space-md) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-md));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}
.raid-header-title { font-size: 16px; font-weight: 700; }
.raid-gps-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  background: rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.raid-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl);
  justify-content: center;
}

.raid-btn {
  border: none;
  border-radius: var(--radius-xl);
  padding: 24px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: transform var(--duration) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.raid-btn:active { transform: scale(0.95); }
.raid-btn .material-icons-round { font-size: 32px; }

.raid-btn-camera {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #000;
  flex: 1;
}
.raid-btn-voice {
  background: var(--bg-tertiary);
  color: white;
}
.raid-btn-gps {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.raid-counter {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.raid-counter-label { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.raid-counter-value { font-size: 36px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.raid-counter-btns { display: flex; gap: 8px; }
.raid-counter-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-secondary);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.raid-counter-btn:active { transform: scale(0.9); }

.raid-captures {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: var(--space-md) var(--space-xl);
}
.raid-capture-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--border-primary);
}

.raid-end-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin: 0 var(--space-xl) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ─── Misc Utilities ─────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hidden { display: none !important; }

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}
.tab-item {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
}
.tab-item.active {
  background: var(--bg-tertiary);
  color: var(--accent);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-primary);
  margin: var(--space-lg) 0;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Responsive — Tablet/Desktop ────────────────────────────── */
@media (min-width: 768px) {
  .app-main { max-width: 680px; padding: var(--space-xl); padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 120px); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .bottom-nav { max-width: 680px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
}

@media (min-width: 1024px) {
  .app-main { max-width: 800px; }
}

/* ─── Bento Card Variants ────────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: 0;
}
.bento-card { grid-column: span 1; }
.bento-card--wide { grid-column: span 2; }
@media (min-width: 640px) {
  .bento-grid { grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
}

/* Glass card — glassmorphism */
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-active);
}

/* Accent card — saffron tint */
.card-accent-tint {
  background: rgba(255, 140, 0, 0.08);
  border: 1px solid rgba(255, 140, 0, 0.20);
}

/* Critical card — red tint */
.card-critical {
  background: rgba(255, 69, 58, 0.08);
  border: 1px solid rgba(255, 69, 58, 0.20);
}
.card-critical .stat-value { color: var(--danger); }

/* ─── Data Pills ─────────────────────────────────────────────── */
.data-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
}
.data-pill--cattle { background: rgba(50, 215, 75, 0.12); color: #32D74B; }
.data-pill--beef, .data-pill--danger { background: rgba(255, 69, 58, 0.12); color: #FF453A; }
.data-pill--dead { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
.data-pill--type { background: rgba(255, 140, 0, 0.12); color: #FF8C00; }

/* ─── FIR Number / Vehicle Plate Monospace ────────────────────── */
.mono-data {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* ─── Raid Mode Color Overrides ──────────────────────────────── */
.raid-mode {
  --bg-primary: #000000;
  --accent: #FF5C00;
  --accent-hover: #E05000;
  --text-primary: #FFFFFF;
}
.raid-btn-camera {
  background: linear-gradient(135deg, #FF5C00, #FF3D00) !important;
  color: #000 !important;
  min-height: max(180px, 40vh);
  max-height: 280px;
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  will-change: transform;
}
.raid-counter-value {
  font-family: var(--font-display);
}
.raid-counter-btn {
  width: 56px;
  height: 56px;
}

/* Raid FAB pulse animation */
@keyframes raidPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(255, 69, 58, 0.4); }
  50% { transform: scale(1.06); box-shadow: 0 6px 24px rgba(255, 69, 58, 0.6); }
}
.raid-fab { animation: raidPulse 2s ease-in-out infinite; }
.raid-fab:hover { animation-play-state: paused; }

/* ─── Offline Banner ─────────────────────────────────────────── */
.offline-banner {
  background: rgba(255, 159, 10, 0.15);
  border-bottom: 1px solid rgba(255, 159, 10, 0.3);
  color: var(--warning);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 6px 16px;
  display: none;
}
.offline-banner.visible { display: block; }

/* ─── Low Power Mode ─────────────────────────────────────────── */
.low-power .card-glass {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg-surface);
}
.low-power .raid-fab { animation: none; }
.low-power * {
  animation-duration: 0s !important;
  transition-duration: 0s !important;
}

/* ─── Dark Mode Body Typography ──────────────────────────────── */
body {
  letter-spacing: 0.01em;
}

/* ─── Offline Banner ────────────────────────────────────────── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  background: linear-gradient(135deg, #FF453A, #dc2626);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease), padding 0.3s var(--ease);
}
.offline-banner.visible {
  padding: 8px 16px;
  max-height: 40px;
}

/* ─── List Item Card Variant ─────────────────────────────────── */
.list-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.list-card:hover { border-color: var(--border-secondary); background: var(--bg-card-hover); }
.list-card:active { transform: scale(0.97); }
.list-card .list-icon { background: var(--accent-light); color: var(--accent); }

/* ─── Page Bar Transition ────────────────────────────────────── */
.page-bar .icon-btn {
  border-color: rgba(255, 255, 255, 0.15);
}
.page-bar .icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Skeleton Loading ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Progress Bar (Gaushala capacity etc.) ───────────────────── */
.progress-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-sm);
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease);
}

/* ─── Focus ring for accessibility ───────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Smooth scrolling on content ────────────────────────────── */
.app-main {
  scroll-behavior: smooth;
}

/* ─── prefers-reduced-motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .raid-fab { animation: none; }
  .skeleton { animation: none; }
}

/* ─── Alert Cards (Vehicle/FIR Warnings) ───────────────────── */
.alert-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid;
  margin-bottom: 12px;
}
.alert-card .alert-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.alert-card .alert-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.alert-card .alert-link {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--accent);
}
.alert-card .alert-link:hover {
  background: rgba(255,149,0,0.1);
}
.alert-card.alert-danger {
  border-color: rgba(255,69,58,0.3);
  background: rgba(255,69,58,0.06);
}
.alert-card.alert-danger .alert-icon {
  background: rgba(255,69,58,0.15);
  color: var(--danger);
}
.alert-card.alert-warning {
  border-color: rgba(255,214,10,0.3);
  background: rgba(255,214,10,0.05);
}
.alert-card.alert-warning .alert-icon {
  background: rgba(255,214,10,0.15);
  color: var(--warning);
}
.alert-card.alert-info {
  border-color: rgba(100,210,255,0.3);
  background: rgba(100,210,255,0.05);
}
.alert-card.alert-info .alert-icon {
  background: rgba(100,210,255,0.15);
  color: var(--info);
}

/* ─── Form Help Text ──────────────────────────────────────── */
.form-help {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-family: 'Space Grotesk', monospace;
}
.text-success { color: var(--success) !important; }

/* ─── Card Accent (Vehicle timeline) ──────────────────────── */
.card-accent {
  border-left: 3px solid var(--accent);
}

/* ─── Stat Card Highlight (repeat offender) ───────────────── */
.stat-card.highlight {
  border-color: var(--danger);
  box-shadow: 0 0 16px rgba(255,69,58,0.2);
}
.stat-card.highlight .stat-value {
  color: var(--danger);
}

/* ─── Badge Utilities ─────────────────────────────────────── */
.mr-sm { margin-right: 6px; }
.mb-sm { margin-bottom: 6px; }
.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
  min-height: 28px;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.btn-danger:active {
  opacity: 0.8;
  transform: scale(0.97);
}

/* ─── Evidence Gallery ────────────────────────────────────────── */
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: var(--space-md);
}
.evidence-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, border-color 0.2s;
}
.evidence-thumb:hover,
.evidence-thumb:active {
  transform: scale(1.04);
  border-color: var(--accent);
}
.evidence-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.evidence-thumb.doc {
  background: var(--bg-card);
}
.evidence-video-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--bg-card);
}
.evidence-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(0,0,0,0.75);
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Alert Link (clickable items in alert cards) ────────────── */
.alert-link {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}
.alert-link:hover,
.alert-link:active {
  background: rgba(255,255,255,0.12);
}

/* ─── Quick Actions Row ──────────────────────────────────────── */
.quick-actions-row {
  display: flex;
  gap: 10px;
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
  padding: 14px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  flex: 1;
}
.quick-action-btn .material-icons-round {
  font-size: 24px;
  color: var(--accent);
}
.quick-action-btn:hover,
.quick-action-btn:active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(245,166,35,0.06);
}

/* ─── Chart Containers ───────────────────────────────────────── */
.chart-container {
  position: relative;
  min-height: 250px;
  padding: var(--space-md);
}
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.chart-half {
  min-height: 280px;
}
@media (max-width: 600px) {
  .chart-row { grid-template-columns: 1fr; }
}

/* ─── Data Table ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* ─── Divider ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xl) 0;
}

/* ─── i18n Text Overflow Guards ──────────────────────────────── */
/* Kannada/Hindi text is ~30% wider than English; prevent overflow */
.btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-full { white-space: normal; word-break: break-word; }
.badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.bottom-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px; font-size: 10px; }
.quick-action-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80px; display: block; font-size: 11px; }
.stat-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { word-break: break-word; }
.header-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
