/* ===================================================
   CHANTIER-TRACKER — global.css
   Responsive : mobile (<768px) / tablette / desktop
   =================================================== */

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

:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #e5e7eb;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05);
  --red-bg: #fee2e2;    --red-text: #b91c1c;
  --blue-bg: #dbeafe;   --blue-text: #1d4ed8;
  --green-bg: #dcfce7;  --green-text: #15803d;
  --gray-bg: #f3f4f6;   --gray-text: #9ca3af;
  --orange-bg: #fef3c7; --orange-text: #92400e;
  --topbar-h: 52px;
  --sidebar-w: 175px;
  --bottomnav-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* =========================================
   BOUTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
  min-height: 44px;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--red-bg); color: var(--red-text); }
.btn-danger:hover { opacity: 0.85; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon {
  width: 44px; height: 44px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.12s;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg); }
.btn-icon.danger:hover { background: var(--red-bg); }

/* =========================================
   FORMULAIRES
   ========================================= */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select:not(.st-sel-compact),
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
  min-height: 44px;
  -webkit-appearance: none;
}
select.st-sel-compact {
  width: auto;
  min-height: 0;
  height: auto;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}
.form-group { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* =========================================
   BADGES & STATUTS
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-todo    { background: var(--red-bg);    color: var(--red-text); }
.badge-inprog  { background: var(--blue-bg);   color: var(--blue-text); }
.badge-done    { background: var(--gray-bg);   color: var(--gray-text); }
.badge-retard  { background: var(--orange-bg); color: var(--orange-text); }
.badge-admin   { background: var(--blue-bg);   color: var(--blue-text); }
.badge-editeur { background: var(--green-bg);  color: var(--green-text); }
.badge-global  { background: var(--green-bg);  color: var(--green-text); }

/* ---- Statuts : reset absolu des selects ---- */
select.st-sel {
  all: unset !important;
  display: inline-block !important;
  padding: 2px 14px 2px 7px !important;
  border-radius: 20px !important;
  font-size: 9px !important;
  font-family: inherit !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  line-height: 1.4 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 2px center !important;
  background-size: 12px !important;
  vertical-align: middle !important;
}
/* ---- Badges lecture seule ---- */
.st-badge {
  display: inline-block !important;
  padding: 2px 7px !important;
  border-radius: 20px !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;
  vertical-align: middle !important;
}
/* ---- Couleurs statuts ---- */
.st-todo, select.st-sel.st-todo         { background-color: #fee2e2 !important; color: #b91c1c !important; }
.st-inprogress, .st-prog,
select.st-sel.st-inprogress,
select.st-sel.st-prog                   { background-color: #dbeafe !important; color: #1d4ed8 !important; }
.st-done, select.st-sel.st-done         { background-color: #dcfce7 !important; color: #15803d !important; }
/* compat ancien sélecteur */
.status-select { all: unset !important; display: inline-block !important; padding: 2px 14px 2px 7px !important; border-radius: 20px !important; font-size: 9px !important; font-family: inherit !important; font-weight: 600 !important; white-space: nowrap !important; cursor: pointer !important; line-height: 1.4 !important; appearance: none !important; -webkit-appearance: none !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 2px center !important; background-size: 12px !important; vertical-align: middle !important; }
.status-select.todo, .status-select.st-todo { background-color: #fee2e2 !important; color: #b91c1c !important; }
.status-select.inprog, .status-select.st-inprogress { background-color: #dbeafe !important; color: #1d4ed8 !important; }
.status-select.done, .status-select.st-done { background-color: #dcfce7 !important; color: #15803d !important; }

/* ---- Colonne Équipe & statut ---- */
.equipe-col   { display: flex !important; flex-direction: column !important; gap: 3px !important; }
.membre-ligne {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 1px 0 !important;
  min-height: 0 !important;
}
.membre-nom {
  font-size: 10px !important;
  color: #6b7280 !important;
  min-width: 44px !important;
  max-width: 60px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex-shrink: 0 !important;
}
.progress-row { display: flex !important; align-items: center !important; gap: 5px !important; margin-top: 3px !important; }
.prog-bar     { width: 60px !important; height: 3px !important; background: #e5e7eb !important; border-radius: 2px !important; overflow: hidden !important; }
.prog-fill    { height: 100% !important; background: #22c55e !important; border-radius: 2px !important; transition: width .3s !important; }
.prog-txt     { font-size: 9px !important; color: #9ca3af !important; }
/* Avatar compact */
.av {
  width: 20px !important; height: 20px !important; border-radius: 5px !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  font-size: 8px !important; font-weight: 600 !important; flex-shrink: 0 !important;
}
/* compat anciens sélecteurs colonne statut */
.statuts-cell, .ms-row, .ms-name, .st-global, .membre-line, .prenom { all: unset !important; }

/* =========================================
   LAYOUT PRINCIPAL
   ========================================= */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* =========================================
   TOPBAR
   ========================================= */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  flex-shrink: 0;
}
.topbar-logo {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-logo svg { width: 18px; height: 18px; }
.topbar-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.topbar-sub {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.topbar-spacer { flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Hamburger (mobile uniquement) */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: none;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* Avatar */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--card); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 149;
}
.sidebar-overlay.open { display: block; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 10px 8px;
  z-index: 150;
  transition: transform 0.25s ease;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-weight: 500;
  min-height: 40px;
}
.sidebar-item:hover { background: var(--bg); }
.sidebar-item.active { background: var(--blue-bg); color: var(--blue-text); }
.sidebar-item.danger { color: var(--red-text); }
.sidebar-item.danger:hover { background: var(--red-bg); }
.sidebar-item.locked { color: var(--gray-text); cursor: not-allowed; pointer-events: none; opacity: 0.6; }
.sidebar-item .icon { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-divider { height: 1px; background: var(--border); margin: 6px 4px; }

.chantier-selector { padding: 6px 4px 4px; }
.chantier-selector select { font-size: 12px; padding: 6px 8px; min-height: 36px; }

/* =========================================
   CONTENU PRINCIPAL
   ========================================= */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 20px;
  overflow-y: auto;
  height: calc(100dvh - var(--topbar-h));
  flex: 1;
}

/* =========================================
   BOTTOM NAV (mobile < 768px)
   ========================================= */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 200;
  align-items: stretch;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s;
  padding: 6px 4px;
  position: relative;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-badge {
  position: absolute;
  top: 4px; right: calc(50% - 18px);
  background: var(--red-text);
  color: #fff;
  width: 14px; height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================
   TABLEAU (desktop/tablette)
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--bg);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody tr.done td { color: var(--gray-text); text-decoration: line-through; background: var(--gray-bg); }
tbody tr.done td .badge,
tbody tr.done td .status-select { text-decoration: none; }

/* =========================================
   CARTES TÂCHES (mobile < 768px)
   ========================================= */
.task-cards { display: none; }

.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.task-card.done {
  background: var(--gray-bg);
  opacity: 0.8;
}
.task-card-row1 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.task-card-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}
.task-card-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.task-card-row3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 12px;
}
.task-card-row4 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.task-card-row4 .status-select { flex: 1; }

/* =========================================
   FILTRES CHIPS
   ========================================= */
.chips {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--text);
  white-space: nowrap;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* =========================================
   BARRE PROGRESSION
   ========================================= */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-fill {
  height: 100%;
  background: var(--green-text);
  border-radius: 9999px;
  transition: width 0.3s;
}

/* =========================================
   ALERTES
   ========================================= */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-warning { background: var(--orange-bg); color: var(--orange-text); border: 1px solid #fde68a; }
.alert-info    { background: var(--blue-bg);   color: var(--blue-text);   border: 1px solid #bfdbfe; }
.alert-success { background: var(--green-bg);  color: var(--green-text);  border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-bg);    color: var(--red-text);    border: 1px solid #fca5a5; }

/* =========================================
   MODAL
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--card);
  z-index: 1;
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0;
  background: var(--card);
}

/* =========================================
   DRAWER COMMENTAIRES (desktop)
   ========================================= */
.drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: 360px;
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 180;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}
.drawer.open { transform: translateX(0); }

/* =========================================
   BOTTOM SHEET (commentaires mobile)
   ========================================= */
.bottom-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 85dvh;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  z-index: 320;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 319;
}
.sheet-overlay.open { display: block; }

/* Header/body/footer communs drawer + sheet */
.drawer-header, .sheet-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-title { font-weight: 600; font-size: 14px; }
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-tab {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px; }
.drawer-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.drawer-footer textarea { flex: 1; resize: none; min-height: 56px; font-size: 13px; }

.comment-item { margin-bottom: 12px; padding: 10px; background: var(--bg); border-radius: var(--radius); }
.comment-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: 12px; }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-text { font-size: 13px; }
.history-item { display: flex; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.history-item:last-child { border-bottom: none; }
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex-shrink: 0; }

/* =========================================
   CARTES MEMBRES
   ========================================= */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.member-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 14px; }
.member-email { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* =========================================
   TOGGLE
   ========================================= */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 9999px; cursor: pointer; transition: background 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--green-text); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* =========================================
   CHANTIER BAR
   ========================================= */
.chantier-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.chantier-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.chantier-bar-stat { font-size: 13px; color: var(--text-muted); }
.chantier-bar-stat span { font-weight: 600; color: var(--text); }
.retard-badge { background: var(--red-bg); color: var(--red-text); font-weight: 700; padding: 2px 8px; border-radius: 9999px; font-size: 12px; }

/* =========================================
   GROUPES TERMINÉES
   ========================================= */
.done-group-toggle {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 12px 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  min-height: 44px;
}
.done-group-toggle:hover { background: var(--border); }

/* =========================================
   SECTION HEADERS (vue globale)
   ========================================= */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 10px;
  font-weight: 600;
  font-size: 14px;
}

/* =========================================
   UPLOAD
   ========================================= */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  transition: border-color 0.15s;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); color: var(--accent); background: var(--blue-bg); }
.file-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 200px;
  overflow: hidden;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { background: none; border: none; cursor: pointer; color: var(--red-text); padding: 0 2px; font-size: 14px; line-height: 1; flex-shrink: 0; }
.file-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 7px;
  font-size: 11px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s;
}
.file-chip-link:hover { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); }
.inline-date-edit { border: none !important; background: transparent !important; padding: 0 !important; font-size: 13px; color: var(--text); cursor: pointer; width: 95px; }
.inline-date-edit:hover { background: var(--bg) !important; border-radius: var(--radius); }

/* =========================================
   TOAST
   ========================================= */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 12px);
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 16px;
  border-radius: var(--radius);
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: slideUp 0.2s ease;
  max-width: 280px;
}
.toast.success { background: var(--green-text); }
.toast.error   { background: var(--red-text); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* =========================================
   DUPLICATE INFO
   ========================================= */
.duplicate-info {
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 12px;
  margin-top: 14px;
  font-family: monospace;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--blue-text);
}

/* =========================================
   RADIO GROUP
   ========================================= */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; min-height: 44px; }
.radio-group input[type="radio"] { width: auto; min-height: auto; }

/* =========================================
   PAGES
   ========================================= */
.page { display: none; }
.page.active { display: block; }

/* =========================================
   UTILITAIRES
   ========================================= */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-600 { font-weight: 600; }

/* =========================================
   RESPONSIVE — TABLETTE (768–1024px)
   ========================================= */
@media (max-width: 1024px) and (min-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    top: var(--topbar-h);
    z-index: 150;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
  .main-content { margin-left: 0; }

  /* Masquer colonne "Créée le" */
  thead th:nth-child(1),
  tbody td:nth-child(1) { display: none; }

  .topbar-sub { display: none; }
}

/* =========================================
   RESPONSIVE — MOBILE (< 768px)
   ========================================= */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    top: var(--topbar-h);
    width: 240px;
    z-index: 150;
    bottom: var(--bottomnav-h);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 14px;
    height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h));
    padding-bottom: 8px;
  }
  .bottom-nav { display: flex; }
  .topbar-sub { display: none; }
  .topbar-title { max-width: 130px; font-size: 14px; }

  /* Topbar déconnexion label masqué */
  .btn-deconnexion-label { display: none; }

  /* Table → Cards */
  .table-wrapper { display: none; }
  .task-cards { display: block; }

  /* Modal plein écran */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
  }
  .modal-footer {
    position: sticky;
    bottom: 0;
  }

  /* Drawer → bottom sheet */
  .drawer { display: none; }
  .bottom-sheet-wrapper { display: flex; flex-direction: column; }

  /* Members grid */
  .members-grid { grid-template-columns: 1fr; }

  /* Avatar stack masqué */
  .avatar-stack { display: none; }

  #toast-container { right: 8px; left: 8px; }
  .toast { max-width: 100%; }

  /* iOS Safari : évite le zoom automatique sur les champs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px;
  }

  /* Chips : taille tactile confortable */
  .chip { min-height: 38px; padding: 7px 14px; }

  /* Chantier bar : wrap serré */
  .chantier-bar { padding: 12px; }
  .chantier-bar-row { gap: 8px; }
  .chantier-bar-stat { font-size: 12px; }

  /* Buttons full-width dans les modals mobile */
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }

  /* Section header */
  .section-header { margin: 14px 0 8px; }

  /* Topbar : serrer les actions */
  .topbar-actions .btn { padding: 6px 10px; font-size: 13px; }
}

/* Desktop : sidebar visible, hamburger masqué */
@media (min-width: 1025px) {
  .hamburger { display: none; }
  .sidebar-overlay { display: none !important; }
}

/* =========================================
   IOS / MOBILE FIXES
   ========================================= */
html, body {
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}
input, select, textarea {
  font-size: 16px !important;
}
