/* ===================================
   YES 55 - Shared Design System
   Professional SaaS-Level CSS
   =================================== */

/* Global gestures - disable touchpad/iOS swipe-back navigation */
html, body {
  overscroll-behavior-x: none;
}

/* ===================================
   EPIC 2 — Sticky search bar (utilitaire global)
   Appliquer la classe `.sticky-search` ou wrapper `.search-container` directement.
   =================================== */
.sticky-search,
.search-container.sticky-top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: white;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* Sticky table headers (utilitaire global) */
.sticky-thead thead th,
th.sticky-th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ECFDF5;
}

/* ===================================
   EPIC 1 — Optimisation iOS/iPhone pour suivi-commandes & divers
   Cibles tactiles ≥ 44×44 (Apple HIG), pas de scroll horizontal, cartes empilées.
   =================================== */
@media (max-width: 768px) {
  /* TO DO liste (divers) */
  body.page-divers,
  body.page-suivi {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }
  body.page-divers .note-card,
  body.page-suivi .kanban-card,
  body.page-suivi .commande-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 0.75rem 0 !important;
  }
  body.page-suivi .kanban-board,
  body.page-suivi .columns,
  body.page-suivi .commandes-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    overflow-x: hidden !important;
  }
  body.page-divers button,
  body.page-divers .btn,
  body.page-suivi button,
  body.page-suivi .btn {
    min-height: 44px;
    min-width: 44px;
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }
  body.page-divers input,
  body.page-divers textarea,
  body.page-divers select,
  body.page-suivi input,
  body.page-suivi textarea,
  body.page-suivi select {
    font-size: 16px; /* évite le zoom auto iOS */
    min-height: 44px;
  }
}

/* ===================================
   CSS Custom Properties (Design Tokens)
   =================================== */
:root {
  /* Primary Palette */
  --primary: #10B981;
  --primary-dark: #059669;
  --primary-light: #86EFAC;
  --primary-bg: #ECFDF5;
  --secondary: #2DD4BF;

  /* Semantic Colors */
  --success: #10B981;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --warning: #F59E0B;
  --info: #06B6D4;

  /* Surfaces */
  --background: #F0FDFA;
  --surface: #ffffff;
  --surface-hover: #f8fdfb;

  /* Text */
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;

  /* Borders */
  --border: #E2E8F0;
  --border-dark: #CBD5E1;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(16, 185, 129, 0.1);
  --shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
  --shadow-lg: 0 8px 24px rgba(16, 185, 129, 0.2);
  --card-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);

  /* Transition */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Border Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Responsive spacing */
  --container-padding: 2rem;
  --header-height: auto;
}

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

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #ECFDF5 0%, #F0FDFA 50%, #E0F2FE 100%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Circuit pattern background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

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

a {
  text-decoration: none;
  color: inherit;
}

/* ===================================
   Header & Navigation
   =================================== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, #0D9668 50%, var(--secondary) 100%);
  color: white;
  padding: 1rem var(--container-padding);
  text-align: center;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
  position: sticky;
  top: 0;
  overflow: hidden;
  z-index: 1000;
}

.header::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  animation: charging-scan 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes charging-scan {
  0% { left: -100%; }
  100% { left: 100%; }
}

.header h1 {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
}

.header h1 strong {
  color: var(--primary-light);
}

/* Navigation Bar */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
  background: rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-lg);
  margin: 0.5rem auto 0;
  max-width: 1200px;
}

.nav-bar .btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-bar .btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  transform: translateY(-1px);
}

.nav-bar .btn.nav-active {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.nav-bar .logout-btn {
  color: #fecaca !important;
}

.nav-bar .logout-btn:hover {
  background: rgba(239, 68, 68, 0.35) !important;
  color: #fee2e2 !important;
}

/* ===================================
   Container
   =================================== */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--container-padding);
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ===================================
   Buttons
   =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  font-family: inherit;
  letter-spacing: -0.01em;
  white-space: nowrap;
  min-height: 40px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn i {
  font-size: 0.9rem;
}

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

.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

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

.btn-outline:hover {
  background: var(--background);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  min-height: 32px;
}

/* ===================================
   Cards
   =================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(16, 185, 129, 0.1);
  overflow: hidden;
  transition: var(--transition);
}

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

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #ECFDF5, #F0FDFA);
}

.card-body {
  padding: 1.5rem;
}

/* ===================================
   Search Bar
   =================================== */
.search-container {
  background: var(--surface);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(16, 185, 129, 0.1);
  position: relative;
  overflow: hidden;
}

.search-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.search-container:focus-within::before {
  opacity: 1;
}

.search-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  background: #f8fafc;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

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

.search-select {
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
  min-width: 150px;
}

.search-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===================================
   Tables
   =================================== */
.table-wrapper,
.table-container,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Scroll indicator for mobile */
.table-wrapper::after,
.table-container::after,
.table-responsive::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.table-wrapper.has-scroll::after,
.table-container.has-scroll::after,
.table-responsive.has-scroll::after {
  opacity: 1;
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(16, 185, 129, 0.1);
}

th, td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.875rem;
}

td {
  white-space: normal;
  word-break: break-word;
}

th {
  background: linear-gradient(135deg, #ECFDF5, #F0FDFA);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: var(--primary-dark);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

tr:nth-child(even) {
  background: #f8fdfb;
}

tr:hover {
  background: rgba(16, 185, 129, 0.06) !important;
}

/* Inline editing */
[contenteditable="true"] {
  transition: all 0.2s;
  cursor: text;
  padding: 0.5rem;
  border-radius: 4px;
}

[contenteditable="true"]:hover {
  background: #f1f5f9;
}

[contenteditable="true"]:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--primary);
  outline: none;
}

/* Actions cell */
.actions-cell {
  text-align: center;
  min-width: 120px;
}

.actions-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

/* Date modification style */
.date-modif {
  font-size: 0.82rem;
  color: var(--text-light);
  white-space: nowrap;
  text-align: center;
}

.date-modif small {
  color: var(--text-lighter);
  font-style: italic;
}

/* ===================================
   Forms
   =================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
}

.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  background: #f8fafc;
  color: var(--text);
}

.form-control::placeholder {
  color: var(--text-lighter);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  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='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ===================================
   Toast Notifications
   =================================== */
.toast-notif {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
}

.toast-notif.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-notif.success {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.toast-notif.error {
  background: linear-gradient(135deg, var(--danger), var(--danger-hover));
}

.toast-notif.warning {
  background: linear-gradient(135deg, var(--warning), #D97706);
}

/* ===================================
   Tab Navigation (Bottom Tabs)
   =================================== */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(16, 185, 129, 0.15);
  border-top: 2px solid var(--primary);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-light);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
  font-family: inherit;
}

.tab-btn:hover {
  background: var(--primary-bg);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.tab-btn.active {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
}

.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ===================================
   Send to Objectif Button
   =================================== */
.btn-send-objectif {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, var(--info), #0891B2);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  max-width: 120px;
  justify-content: center;
  font-family: inherit;
}

.btn-send-objectif:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-send-objectif.sent {
  background: linear-gradient(135deg, var(--success), var(--primary-dark));
  cursor: default;
}

.btn-send-objectif:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ===================================
   Footer
   =================================== */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-lighter);
  font-size: 0.8rem;
  margin-top: auto;
  padding-bottom: 5rem; /* Space for fixed tabs */
  position: relative;
  z-index: 1;
}

/* Push footer to bottom on short pages */
body {
  display: flex;
  flex-direction: column;
}

body > .container {
  flex: 1;
  margin-bottom: 120px; /* Prevent overlap with fixed tabs */
}

/* ===================================
   Loading State
   =================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-light);
  gap: 0.5rem;
}

.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================================
   Empty State
   =================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-light);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-lighter);
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* ===================================
   Save Success Animation
   =================================== */
.save-success {
  background-color: #e8f5e9 !important;
  transition: background-color 0.5s ease;
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

tr {
  animation: fadeIn 0.3s ease;
}

/* ===================================
   Counter Badge
   =================================== */
.counter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 0.4rem;
}

/* ===================================
   Stats Cards
   =================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(16, 185, 129, 0.1);
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ===================================
   Utility Classes
   =================================== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-light  { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* 2560px+ (4K / Ultra-wide) */
@media (min-width: 2560px) {
  :root {
    --container-padding: 4rem;
  }
  
  .container {
    max-width: 2200px;
  }
  
  body {
    font-size: 1.1rem;
  }
  
  th, td {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
  
  th {
    font-size: 0.85rem;
  }
}

/* 1920px (Full HD) */
@media (max-width: 1920px) {
  .container {
    max-width: 1600px;
  }
}

/* 1440px (Desktop) */
@media (max-width: 1440px) {
  .container {
    max-width: 1300px;
  }
}

/* 1200px (Small Desktop / Large Tablet) */
@media (max-width: 1200px) {
  :root {
    --container-padding: 1.5rem;
  }

  .header h1 {
    font-size: 1.6rem;
  }

  .nav-bar {
    gap: 0.25rem;
  }

  .nav-bar .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
  }
  
  .search-form {
    flex-direction: column;
  }
  
  .search-input,
  .search-select,
  .search-form .btn {
    width: 100%;
  }
}

/* 1024px (Tablet Landscape) */
@media (max-width: 1024px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
  }

  .nav-bar {
    margin: 0.25rem 0 0;
    padding: 0.4rem 0.5rem;
    gap: 0.2rem;
  }

  .nav-bar .btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }

  th, td {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }

  th {
    font-size: 0.68rem;
  }

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

/* 768px (Tablet Portrait) */
@media (max-width: 768px) {
  :root {
    --container-padding: 1rem;
  }

  .header {
    padding: 0.75rem;
  }

  .header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .nav-bar {
    padding: 0.35rem;
    gap: 0.15rem;
    border-radius: var(--radius);
  }

  .nav-bar .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    gap: 0.25rem;
  }

  /* Hide nav text on tablet, show icons only */
  .nav-bar .btn .nav-text {
    display: none;
  }

  .table-wrapper,
  .table-container,
  .table-responsive {
    margin: 0 -1rem;
    width: calc(100% + 2rem);
    border-radius: 0;
  }

  table {
    border-radius: 0;
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.5rem 0.4rem;
    font-size: 0.75rem;
    min-width: 80px;
  }

  .tabs {
    padding: 0.4rem 0.5rem;
    gap: 0.25rem;
  }

  .tab-btn {
    min-width: 80px;
    padding: 0.5rem 0.7rem;
    font-size: 0.72rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .toast-notif {
    left: 1rem;
    right: 1rem;
    bottom: 5rem;
    max-width: none;
  }

  /* Forms 100% width */
  .form-control,
  .search-input,
  .search-select,
  .btn,
  .btn-search,
  .btn-outline,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  select,
  textarea {
    width: 100% !important;
    max-width: 100%;
  }

  .search-form {
    flex-direction: column;
  }

  .actions-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .actions-group {
    width: 100%;
  }

  .actions-group .btn {
    width: 100%;
  }

  body > .container {
    margin-bottom: 100px;
  }
}

/* 480px (Large Phone) */
@media (max-width: 480px) {
  :root {
    --container-padding: 0.75rem;
  }

  .header {
    padding: 0.5rem;
  }

  .header h1 {
    font-size: 1.1rem;
  }

  .nav-bar {
    padding: 0.3rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

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

  .nav-bar .btn {
    font-size: 0.68rem;
    padding: 0.25rem 0.45rem;
    flex-shrink: 0;
  }

  .btn {
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
  }

  th, td {
    padding: 0.4rem 0.35rem;
    font-size: 0.72rem;
    min-width: 70px;
  }

  th {
    font-size: 0.62rem;
  }

  .form-control {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
  }

  .tabs {
    padding: 0.3rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    min-width: 70px;
    padding: 0.4rem 0.6rem;
    font-size: 0.68rem;
    flex-shrink: 0;
  }

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

  .footer {
    font-size: 0.72rem;
    padding: 1rem 0.5rem 5rem;
  }
}

/* 375px (iPhone SE / Small Phone) */
@media (max-width: 375px) {
  .header h1 {
    font-size: 1rem;
  }

  .nav-bar .btn {
    font-size: 0.65rem;
    padding: 0.2rem 0.35rem;
  }

  th, td {
    padding: 0.35rem 0.3rem;
    font-size: 0.68rem;
    min-width: 60px;
  }

  .btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.85rem;
  }

  .search-container {
    padding: 0.85rem;
  }

  .search-input {
    font-size: 0.85rem;
    padding: 0.55rem 0.7rem;
  }
}

/* 320px (Very Small Phone) */
@media (max-width: 320px) {
  :root {
    --container-padding: 0.5rem;
  }

  .header h1 {
    font-size: 0.9rem;
  }

  .nav-bar .btn {
    font-size: 0.6rem;
    padding: 0.2rem 0.3rem;
  }

  th, td {
    padding: 0.3rem 0.25rem;
    font-size: 0.65rem;
    min-width: 55px;
  }

  .btn {
    font-size: 0.72rem;
    padding: 0.4rem 0.7rem;
  }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
  body::before,
  .header::before,
  .tabs,
  .nav-bar .logout-btn,
  .toast-notif,
  .actions-cell,
  .btn-send-objectif {
    display: none !important;
  }

  body {
    background: white !important;
  }

  .header {
    position: static;
    box-shadow: none;
    background: var(--primary) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  table {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  th {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }
}

/* ===================================
   Accessibility: Focus Visible
   =================================== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===================================
   Reduced Motion
   =================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================
   Dark Mode Support (future-ready)
   =================================== */
@media (prefers-color-scheme: dark) {
  /* Placeholder for future dark mode support */
}
