/* ============================================
   SOS Terrain — Design System
   Haute-Correze branding + amber/orange accent
   Mobile-first for field workers with gloves
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* --- CSS Variables --- */
:root {
  --primary: #283E5D;
  --primary-light: #3a5a80;
  --primary-dark: #1a2a40;
  --secondary: #AEB738;
  --accent: #F59E0B;
  --accent-light: #FBBF24;
  --accent-dark: #D97706;
  --magenta: #AF337E;
  --bg: #F5F6F8;
  --bg-card: #FFFFFF;
  --text: #1F2937;
  --text-light: #6B7280;
  --text-white: #FFFFFF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #3B82F6;
  --info-light: #DBEAFE;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 12px 36px rgba(0,0,0,0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;
  --touch-min: 48px;
  --touch-ideal: 64px;
  --nav-height: 72px;
  --header-height: 56px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + 16px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Header --- */
.app-header {
  background: var(--primary);
  color: var(--text-white);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  box-shadow: var(--shadow-md);
}

.app-header .logo {
  height: 32px;
  width: auto;
}

.app-header .header-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.offline-badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  display: none;
  animation: pulse 2s infinite;
}

.offline-badge.show {
  display: inline-block;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom, 8px);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.65rem;
  font-weight: 600;
  gap: 2px;
  padding: 6px 4px;
  min-width: 60px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item:hover {
  color: var(--accent);
}

/* --- Container --- */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text-white);
  padding: 32px 20px;
  text-align: center;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  margin: -16px -16px 20px -16px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: var(--accent);
  opacity: 0.1;
  border-radius: var(--radius-full);
}

.hero h1 {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.hero .subtitle {
  font-size: 1rem;
  opacity: 0.85;
  font-weight: 500;
}

.hero .accent-text {
  color: var(--accent-light);
  font-weight: 800;
}

/* --- Stats Bar --- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card.accent .stat-number {
  color: var(--accent);
}

.stat-card.success .stat-number {
  color: var(--success);
}

/* --- Big Action Button --- */
.big-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 24px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-white);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: var(--shadow-lg), 0 4px 0 var(--accent-dark);
  transition: transform 0.1s, box-shadow 0.1s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.big-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.big-action-btn:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-sm), 0 2px 0 var(--accent-dark);
}

.big-action-btn .btn-icon {
  font-size: 2rem;
}

.big-action-btn.secondary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: var(--shadow-lg), 0 4px 0 var(--primary-dark);
  font-size: 1.1rem;
  padding: 18px;
}

.big-action-btn.secondary:active {
  box-shadow: var(--shadow-sm), 0 2px 0 var(--primary-dark);
}

.big-action-btn.green {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  box-shadow: var(--shadow-lg), 0 4px 0 #047857;
}

.big-action-btn.green:active {
  box-shadow: var(--shadow-sm), 0 2px 0 #047857;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.card-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* --- Category Grid --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 0;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  min-height: var(--touch-ideal);
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.category-btn:active,
.category-btn.selected {
  border-color: var(--accent);
  background: var(--warning-light);
  transform: scale(0.97);
}

.category-btn .cat-icon {
  font-size: 2rem;
  line-height: 1;
}

.category-btn .cat-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.category-btn .cat-delay {
  font-size: 0.6rem;
  color: var(--text-light);
  font-weight: 600;
}

/* --- Urgency badges --- */
.urgency-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.urgency-immediate { background: var(--danger); color: white; }
.urgency-48h { background: #F97316; color: white; }
.urgency-72h { background: var(--accent); color: white; }
.urgency-5j { background: var(--info); color: white; }
.urgency-10j { background: #8B5CF6; color: white; }
.urgency-15j { background: var(--text-light); color: white; }
.urgency-mensuel { background: var(--secondary); color: white; }

/* --- Step Indicator --- */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0 8px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: all 0.3s;
}

.step-dot.active {
  background: var(--accent);
  width: 28px;
  border-radius: 5px;
}

.step-dot.done {
  background: var(--success);
}

.step-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  margin: 8px 0 16px;
  color: var(--primary);
}

/* --- Photo Area --- */
.photo-area {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.photo-slot {
  width: 140px;
  height: 140px;
  border: 3px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.photo-slot:active {
  border-color: var(--accent);
  background: var(--warning-light);
}

.photo-slot .photo-icon {
  font-size: 2.5rem;
}

.photo-slot .photo-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.photo-slot .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* --- Map Area --- */
.map-container {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #e8e8e8;
  position: relative;
}

.map-container .map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--text-light);
}

.map-container .map-placeholder .map-icon {
  font-size: 2.5rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  min-height: var(--touch-min);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* --- Voice Input Button --- */
.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  -webkit-tap-highlight-color: transparent;
}

.voice-btn.recording {
  background: var(--danger);
  animation: pulse 1s infinite;
}

/* --- Skip Button --- */
.skip-btn {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 12px;
  min-height: var(--touch-min);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: var(--touch-min);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
  min-height: 36px;
}

.btn-block {
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

/* --- Status Progress --- */
.status-track {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 12px 0 4px;
}

.status-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.status-step::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  z-index: 0;
}

.status-step:first-child::before {
  left: 50%;
}

.status-step:last-child::before {
  right: 50%;
}

.status-step .step-circle {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-light);
  position: relative;
  z-index: 1;
}

.status-step.completed .step-circle {
  background: var(--success);
  color: white;
}

.status-step.completed::before {
  background: var(--success);
}

.status-step.current .step-circle {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.status-step.current::before {
  background: linear-gradient(to right, var(--success), var(--accent));
}

.status-step .step-name {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 4px;
}

.status-step.completed .step-name,
.status-step.current .step-name {
  color: var(--text);
}

/* --- Signalement Card --- */
.signal-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  cursor: pointer;
  border-left: 4px solid var(--border);
  transition: all 0.2s;
}

.signal-card:active {
  transform: scale(0.99);
  box-shadow: var(--shadow-md);
}

.signal-card.urgency-high {
  border-left-color: var(--danger);
}

.signal-card.urgency-medium {
  border-left-color: var(--accent);
}

.signal-card.urgency-low {
  border-left-color: var(--info);
}

.signal-card .signal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.signal-card .signal-cat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.signal-card .signal-cat-icon {
  font-size: 1.3rem;
}

.signal-card .signal-cat-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.signal-card .signal-code {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-light);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
}

.signal-card .signal-location {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.signal-card .signal-date {
  font-size: 0.7rem;
  color: var(--text-light);
}

.signal-card .signal-photos {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.signal-card .signal-photos img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.signal-card .signal-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.signal-card.expanded .signal-detail {
  display: block;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  min-height: 40px;
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--warning-light);
  color: var(--accent-dark);
}

/* --- Admin Vie Sections --- */
.level-section {
  margin-bottom: 24px;
}

.level-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin-bottom: 8px;
  cursor: pointer;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
}

.level-n7 { background: var(--success); }
.level-n6 { background: var(--info); }
.level-n5 { background: var(--accent); }
.level-n4 { background: var(--magenta); }
.level-n3 { background: var(--primary); }

.level-title {
  font-size: 1rem;
  font-weight: 800;
}

.admin-tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.admin-tool-card:active {
  border-color: var(--accent);
}

.admin-tool-card .tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-tool-card .tool-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-tool-card .tool-icon {
  font-size: 1.4rem;
}

.admin-tool-card .tool-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-tool-card .tool-time {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
}

.admin-tool-card .tool-chevron {
  font-size: 1.2rem;
  color: var(--text-light);
  transition: transform 0.2s;
}

.admin-tool-card.open .tool-chevron {
  transform: rotate(90deg);
}

.admin-tool-card .tool-form {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.admin-tool-card.open .tool-form {
  display: block;
}

/* --- Dashboard --- */
.login-box {
  max-width: 320px;
  margin: 60px auto;
  text-align: center;
}

.login-box .login-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.chart-container h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
}

.chart-container canvas {
  max-height: 250px;
}

.alert-card {
  background: var(--danger-light);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.alert-card .alert-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--danger);
}

.alert-card .alert-text {
  font-size: 0.8rem;
  color: var(--text);
}

/* --- Summary Confirm Card --- */
.summary-card {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.summary-row .summary-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  min-width: 80px;
}

.summary-row .summary-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.summary-photos {
  display: flex;
  gap: 8px;
}

.summary-photos img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* --- Success Screen --- */
.success-screen {
  text-align: center;
  padding: 40px 20px;
}

.success-screen .success-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.success-screen .success-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--success);
  margin-bottom: 8px;
}

.success-screen .tracking-code {
  display: inline-block;
  background: var(--primary);
  color: var(--accent-light);
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 12px 0;
}

/* --- Checklist --- */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  min-height: var(--touch-min);
}

.checklist-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--success);
  flex-shrink: 0;
}

.checklist-item label {
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.checklist-item.checked label {
  text-decoration: line-through;
  color: var(--text-light);
}

/* --- Section Title --- */
.section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  margin: 20px 0 10px;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

/* --- Toast / Notification --- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.empty-state .empty-text {
  font-size: 0.85rem;
}

/* --- Swipe Actions (for validation) --- */
.swipe-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.swipe-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.swipe-actions .btn {
  flex: 1;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 16px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 16px;
}

/* --- Print --- */
@media print {
  .bottom-nav,
  .app-header,
  .toast,
  .modal-overlay {
    display: none !important;
  }

  body {
    padding-bottom: 0;
    background: white;
  }

  .card, .signal-card, .chart-container {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* --- Responsive Desktop --- */
@media (min-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
  }

  .photo-slot {
    width: 180px;
    height: 180px;
  }

  .container {
    max-width: 720px;
  }
}

@media (min-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }

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

/* --- Safe area for notched phones --- */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  }

  body {
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px);
  }
}

/* --- Transitions --- */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Dark mode support --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --bg-card: #1F2937;
    --text: #F9FAFB;
    --text-light: #9CA3AF;
    --border: #374151;
  }

  .app-header {
    background: #0f1a2b;
  }

  .bottom-nav {
    background: #1F2937;
    border-top-color: #374151;
  }

  .category-btn {
    background: var(--bg-card);
    border-color: var(--border);
  }

  .form-input,
  .form-select,
  .form-textarea {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border);
  }
}
