/* ============================================================
   SOLIVE - Style commun (squelette SaaS multi-tenant)
   Toutes les couleurs primaires/secondaires sont des variables
   CSS reecrites au runtime selon le branding du tenant.
   ============================================================ */

:root {
  /* Palette Atrium DARK (par defaut) */
  --primary: #2F6BFF;
  --primary-dark: #1e4ec7;
  --primary-light: #6FC3FF;
  --primary-neon: #4DA3FF;
  --silver: #D9DDE3;
  --silver-mid: #8A919A;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #020611;
  --bg-card: #0a1124;
  --bg-input: #050a1a;
  --border: #3A4048;
  --text: #E6EAF0;
  --text-muted: #7C8591;
  --text-subtle: #5a6573;
  --logo-blend: lighten;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(47, 107, 255, 0.08);
  font-family: -apple-system, "Segoe UI", "Inter", "Barlow", Roboto, sans-serif;
  letter-spacing: 0.01em;
}

/* Mode CLAIR (active via .theme-light sur <html>) */
html.theme-light {
  --bg: #f4f6fb;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #d1d9e6;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --logo-blend: darken;
  --shadow: 0 4px 16px rgba(47, 107, 255, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* ===== Boutons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: none; border-radius: var(--radius);
  background: var(--primary); color: white; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { background: var(--text-subtle); cursor: not-allowed; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--text-subtle); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ===== Inputs ===== */
.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 6px; font-size: 13px;
  color: var(--text-muted); font-weight: 500;
}
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
}
.textarea { resize: vertical; min-height: 80px; }

/* ===== Couleurs uniques par statut (chaque étape distinguable d'un coup d'œil) ===== */
/* Variables pour réutiliser ailleurs (badges, lignes, indicateurs) */
:root {
  --st-nouveau: #06b6d4;       --st-recue: #06b6d4;       /* cyan = début, frais */
  --st-vue: #818cf8;                                       /* lavande = accusé de réception */
  --st-contact: #a855f7;                                   /* violet = premier échange */
  --st-soumis: #ec4899;        --st-assignee: #ec4899;    /* rose vif = mis en mouvement */
  --st-en_attente: #f59e0b;    --st-en_cours: #f59e0b;    /* ambre = action en cours */
  --st-pause: #eab308;                                     /* jaune = suspendu */
  --st-planifie: #3b82f6;                                  /* bleu marine = prévu */
  --st-actif: #22c55e;                                     /* vert vif = en activité */
  --st-gagne: #10b981;         --st-completee: #10b981;
  --st-validee: #10b981;       --st-termine: #10b981;
  --st-terminee: #10b981;                                  /* vert = succès */
  --st-perdu: #64748b;         --st-fermee: #64748b;      /* gris foncé = clos */
  --st-archive: #94a3b8;       --st-a_faire: #94a3b8;     /* gris pâle = inactif */
  --st-urgent: #ef4444;                                    /* rouge */
  --st-important: #f97316;                                 /* orange */
  --st-pas_urgent: #94a3b8;                                /* gris */
}

/* Helper qui applique fond translucide + texte saturé + bordure pour chaque statut */
.select[class*="status-"], .select[class*="urgence-"] { font-weight: 600; }

.select.status-nouveau    { background: color-mix(in srgb, var(--st-nouveau) 15%, transparent); color: var(--st-nouveau);    border-color: var(--st-nouveau); }
.select.status-recue      { background: color-mix(in srgb, var(--st-recue) 15%, transparent);   color: var(--st-recue);      border-color: var(--st-recue); }
.select.status-vue        { background: color-mix(in srgb, var(--st-vue) 15%, transparent);     color: var(--st-vue);        border-color: var(--st-vue); }
.select.status-contact    { background: color-mix(in srgb, var(--st-contact) 15%, transparent); color: var(--st-contact);    border-color: var(--st-contact); }
.select.status-soumis     { background: color-mix(in srgb, var(--st-soumis) 15%, transparent);  color: var(--st-soumis);     border-color: var(--st-soumis); }
.select.status-assignee   { background: color-mix(in srgb, var(--st-assignee) 15%, transparent); color: var(--st-assignee);  border-color: var(--st-assignee); }
.select.status-en_attente { background: color-mix(in srgb, var(--st-en_attente) 15%, transparent); color: var(--st-en_attente); border-color: var(--st-en_attente); }
.select.status-en_cours   { background: color-mix(in srgb, var(--st-en_cours) 15%, transparent); color: var(--st-en_cours);   border-color: var(--st-en_cours); }
.select.status-pause      { background: color-mix(in srgb, var(--st-pause) 15%, transparent);    color: var(--st-pause);     border-color: var(--st-pause); }
.select.status-planifie   { background: color-mix(in srgb, var(--st-planifie) 15%, transparent); color: var(--st-planifie);  border-color: var(--st-planifie); }
.select.status-actif      { background: color-mix(in srgb, var(--st-actif) 15%, transparent);    color: var(--st-actif);     border-color: var(--st-actif); }
.select.status-gagne      { background: color-mix(in srgb, var(--st-gagne) 15%, transparent);    color: var(--st-gagne);     border-color: var(--st-gagne); }
.select.status-completee  { background: color-mix(in srgb, var(--st-completee) 15%, transparent); color: var(--st-completee); border-color: var(--st-completee); }
.select.status-validee    { background: color-mix(in srgb, var(--st-validee) 15%, transparent);  color: var(--st-validee);   border-color: var(--st-validee); }
.select.status-termine    { background: color-mix(in srgb, var(--st-termine) 15%, transparent);  color: var(--st-termine);   border-color: var(--st-termine); }
.select.status-terminee   { background: color-mix(in srgb, var(--st-terminee) 15%, transparent); color: var(--st-terminee);  border-color: var(--st-terminee); }
.select.status-perdu      { background: color-mix(in srgb, var(--st-perdu) 15%, transparent);    color: var(--st-perdu);     border-color: var(--st-perdu); }
.select.status-fermee     { background: color-mix(in srgb, var(--st-fermee) 15%, transparent);   color: var(--st-fermee);    border-color: var(--st-fermee); }
.select.status-archive    { background: color-mix(in srgb, var(--st-archive) 15%, transparent);  color: var(--st-archive);   border-color: var(--st-archive); }
.select.status-a_faire    { background: color-mix(in srgb, var(--st-a_faire) 15%, transparent);  color: var(--st-a_faire);   border-color: var(--st-a_faire); }
.select.urgence-urgent    { background: color-mix(in srgb, var(--st-urgent) 15%, transparent);   color: var(--st-urgent);    border-color: var(--st-urgent); }
.select.urgence-important { background: color-mix(in srgb, var(--st-important) 15%, transparent); color: var(--st-important); border-color: var(--st-important); }
.select.urgence-pas_urgent{ background: color-mix(in srgb, var(--st-pas_urgent) 15%, transparent); color: var(--st-pas_urgent); border-color: var(--st-pas_urgent); }
.select.status-changing   { animation: pulse-status 0.4s ease-out; }
@keyframes pulse-status { 0% { transform: scale(1); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* Badges colorés par statut (utilisés dans les tableaux à la place des badge-primary génériques) */
.st-badge {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  background: color-mix(in srgb, currentColor 18%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
}
.st-badge.st-nouveau, .st-badge.st-recue   { color: var(--st-nouveau); }
.st-badge.st-vue                            { color: var(--st-vue); }
.st-badge.st-contact                        { color: var(--st-contact); }
.st-badge.st-soumis, .st-badge.st-assignee { color: var(--st-soumis); }
.st-badge.st-en_attente, .st-badge.st-en_cours { color: var(--st-en_attente); }
.st-badge.st-pause                          { color: var(--st-pause); }
.st-badge.st-planifie                       { color: var(--st-planifie); }
.st-badge.st-actif                          { color: var(--st-actif); }
.st-badge.st-gagne, .st-badge.st-completee, .st-badge.st-validee,
.st-badge.st-termine, .st-badge.st-terminee { color: var(--st-gagne); }
.st-badge.st-perdu, .st-badge.st-fermee     { color: var(--st-perdu); }
.st-badge.st-archive, .st-badge.st-a_faire  { color: var(--st-archive); }
.st-badge.st-urgent                         { color: var(--st-urgent); }
.st-badge.st-important                      { color: var(--st-important); }
.st-badge.st-pas_urgent                     { color: var(--st-pas_urgent); }

/* ===== Layout d'authentification (login, onboarding) ===== */
.auth-layout {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; max-width: 460px; width: 100%;
  box-shadow: var(--shadow);
}
/* Le logo se confond avec le fond grace au blend-mode, on supprime le padding top pour qu'il deborde du card visuellement */
.auth-card .auth-logo { margin-top: -12px; }
.auth-logo {
  text-align: center; margin-bottom: 28px;
}
.auth-logo img {
  width: 220px; height: auto; display: block; margin: 0 auto 8px;
  mix-blend-mode: var(--logo-blend);
}
.auth-logo h1 {
  margin: 0; font-size: 28px; color: var(--text); font-weight: 600;
  letter-spacing: 4px;
}
.auth-logo p { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.auth-card {
  box-shadow: 0 0 40px rgba(47, 107, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== Layout d'app (sidebar + topbar + content) ===== */
.app-layout {
  display: flex; min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w); background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
}
.sidebar-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.sidebar-header img {
  width: 130px; height: auto; display: block; margin: 0 auto 6px;
  mix-blend-mode: var(--logo-blend);
}
.sidebar-header h1 {
  margin: 0; font-size: 18px; color: var(--text);
  font-weight: 600; letter-spacing: 2px; text-align: center;
}
.sidebar-header p {
  margin: 4px 0 0; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; text-align: center;
}
.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 0;
}
.nav-section {
  padding: 8px 16px 4px; font-size: 11px;
  color: var(--text-subtle); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
}
.nav-group { user-select: none; }
.nav-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; font-size: 11px; cursor: pointer;
  color: var(--text-subtle); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
  transition: color 0.15s;
}
.nav-group-header:hover { color: var(--text); }
.nav-group-header .chevron { transition: transform 0.15s; font-size: 10px; }
.nav-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-group-content { overflow: hidden; max-height: 1000px; transition: max-height 0.2s ease-out; }
.nav-group.collapsed .nav-group-content { max-height: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--text-muted);
  font-size: 14px; cursor: pointer; transition: all 0.15s;
  text-decoration: none; border-left: 3px solid transparent;
}
.nav-link:hover {
  background: var(--bg); color: var(--text); text-decoration: none;
}
.nav-link.active {
  color: var(--primary); border-left-color: var(--primary);
  background: var(--bg);
}
.nav-icon { width: 18px; text-align: center; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  font-size: 12px;
}
.user-info { display: flex; flex-direction: column; gap: 2px; }
.user-name { color: var(--text); font-weight: 600; font-size: 13px; }
.user-role {
  color: var(--text-subtle); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.user-org { color: var(--text-muted); font-size: 12px; }

.main {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h); background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-title {
  font-size: 18px; font-weight: 600; color: var(--text);
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content {
  flex: 1; padding: 24px; overflow-y: auto;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card-header h2, .card-header h3 {
  margin: 0; color: var(--primary); font-size: 17px;
}

/* ===== Tables ===== */
.table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.table th, .table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--text-subtle); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.table tr:hover td { background: rgba(91, 141, 239, 0.05); }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger  { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-muted   { background: var(--border); color: var(--text-muted); }

/* ===== Stats ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.stat-label {
  font-size: 12px; color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.stat-value {
  font-size: 28px; font-weight: 700; color: var(--text);
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state h3 { color: var(--text); margin: 0 0 8px; }
.empty-state p { margin: 0 0 16px; }

/* ===== Modales ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; max-width: 540px; width: 90%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-header h2 { margin: 0; color: var(--primary); font-size: 20px; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 24px; cursor: pointer; line-height: 1;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px;
}

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow);
  display: none; max-width: 360px;
}
.toast.show { display: block; animation: slideIn 0.2s ease-out; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== Helpers ===== */
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ===== Responsive (mobile + tablette) ===== */

.hamburger {
  display: none; background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 6px 10px; border-radius: var(--radius);
  cursor: pointer; font-size: 18px; line-height: 1;
}
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 9; opacity: 0; transition: opacity 0.2s;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

@media (hover: none) and (pointer: coarse) {
  /* WCAG 2.1 AA : zones tactiles 44x44 minimum */
  .btn { min-height: 48px; padding: 12px 18px; }
  .btn-sm { min-height: 44px; padding: 8px 14px; }
  .btn-punch-big { min-height: 64px; padding: 18px 24px; font-size: 16px; }
  .input, .select, .textarea { min-height: 48px; font-size: 16px; }
  /* Espacement minimum entre boutons proches */
  .flex.gap-12 > .btn + .btn,
  .topbar-actions > .btn + .btn { margin-left: 8px; }
  /* Focus visible plus large pour saisie tactile */
  *:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
}

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .grid-2 { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%); transition: transform 0.25s ease-out;
    width: 260px; z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { gap: 4px; flex-shrink: 0; }
  .content { padding: 12px; }
  .card { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 22px; }
  .quick-links { grid-template-columns: repeat(2, 1fr) !important; }
  .table { font-size: 13px; }
  .card > .table, .card > div > .table, [id="content"] > .table {
    display: block; overflow-x: auto; white-space: nowrap;
  }
  .table th, .table td { padding: 8px 10px; }
  .modal { width: 95vw !important; max-width: none !important; padding: 18px; }
  .modal-header h2 { font-size: 18px; }
  .auth-card { padding: 22px; }
  .auth-logo img { width: 160px !important; }
  .topbar-actions .btn-secondary { padding: 6px 10px; font-size: 12px; }
  .punch-hero { padding: 18px; }
  .punch-state { font-size: 24px; }
  .btn-punch-big { padding: 14px 20px; font-size: 14px; min-width: 130px; flex: 1; }
  .flex.gap-12 { flex-direction: column; }
  .flex.gap-12 > .field { width: 100% !important; }
}

@media (max-width: 380px) {
  .stats-grid, .quick-links { grid-template-columns: 1fr !important; }
}

/* ============================================================
   RESPONSIVE — Grands ecrans (>= 1600px : 27" et 32")
   Cible : utilisateurs sur ecran 27"-32" qui trouvent le
   contenu trop condense. Augmente padding, taille, densite.
   ============================================================ */
@media (min-width: 1600px) {
  :root {
    --sidebar-w: 280px;
    --topbar-h: 68px;
    --radius: 10px;
  }
  html, body { font-size: 15.5px; }
  .content { padding: 32px 40px; max-width: 1900px; margin: 0 auto; width: 100%; }
  .topbar { padding: 0 32px; }
  .topbar-title { font-size: 22px; }
  .card { padding: 26px 28px; margin-bottom: 22px; border-radius: 10px; }
  .card-header h2 { font-size: 19px; }
  .card-header h3 { font-size: 16px; }
  .nav-link { padding: 12px 20px; font-size: 14.5px; }
  .nav-icon { width: 22px; font-size: 16px; }
  .sidebar-header h1 { font-size: 22px; }
  .sidebar-header img { width: 160px; }
  .table { font-size: 14px; }
  .table th, .table td { padding: 12px 14px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
  .stat-card { padding: 22px; }
  .stat-value { font-size: 30px; }
  .quick-links { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important; gap: 14px; }
  .quick-link { padding: 18px 14px; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 22px; }
  .field { margin-bottom: 16px; }
  .input, .select { padding: 10px 14px; font-size: 14.5px; }
  .btn { padding: 10px 18px; font-size: 14px; }
  .btn-sm { padding: 6px 12px; font-size: 12.5px; }
  .modal { max-width: 720px; padding: 28px 32px; }
  .modal-header h2 { font-size: 22px; }
  .auth-card { max-width: 520px; padding: 38px 36px; }
}

/* Ecrans tres larges (>= 2200px : 32"+ haute resolution) :
   plus de respiration mais sans devenir vide. */
@media (min-width: 2200px) {
  :root { --sidebar-w: 320px; }
  html, body { font-size: 16.5px; }
  .content { padding: 40px 56px; max-width: 2200px; }
  .card { padding: 30px 32px; }
  .nav-link { padding: 14px 24px; font-size: 15.5px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .quick-links { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important; }
  .grid-2 { gap: 28px; }
  .table { font-size: 15px; }
  .table th, .table td { padding: 14px 18px; }
  /* Permet aux dashboards d'afficher 3 colonnes au lieu de 2 */
  .grid-2.wide-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ============================================================
   RESPONSIVE — Tablette (1025-1280px paysage, 768-1024px)
   ============================================================ */
@media (min-width: 1025px) and (max-width: 1280px) {
  .content { padding: 20px; }
  .card { padding: 18px; }
  .nav-link { padding: 9px 14px; font-size: 13.5px; }
  .stats-grid { gap: 12px; }
}

/* Tablette portrait (iPad ~768-900) : sidebar reduit en icones */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .content { padding: 16px; }
  .card { padding: 16px; }
  .nav-link { padding: 9px 12px; font-size: 13px; }
  .nav-icon { width: 18px; }
  .sidebar-header h1 { font-size: 16px; }
  .sidebar-header img { width: 110px; }
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 16px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .table { font-size: 12.5px; }
  .table th, .table td { padding: 8px 10px; }
}

/* ============================================================
   AMELIORATIONS MOBILE (<= 768px) — boutons d'action plus
   gros, navigation plus accessible, cartes plus aerees
   ============================================================ */
@media (max-width: 768px) {
  /* Boutons plus larges en bas pour le pouce */
  .modal-footer .btn { min-height: 44px; padding: 12px 16px; }
  /* Empile mieux les actions */
  .topbar-actions .btn { padding: 8px 12px; min-height: 38px; }
  /* Tables : plus lisibles, scroll fluide */
  .table { font-size: 12.5px; }
  /* Champs de formulaire plus gros sur mobile (anti-zoom iOS) */
  .input, .select, textarea.input { font-size: 16px !important; min-height: 42px; }
  textarea.input { min-height: 80px; }
  /* Cartes plus aerees */
  .card { margin-bottom: 12px; border-radius: 10px; }
  /* Modale : plus de marge en bas pour le clavier mobile */
  .modal { padding-bottom: 24px; max-height: 90vh; overflow-y: auto; }
  /* Empile labels et inputs */
  .field label { font-size: 13px; margin-bottom: 6px; }
  /* Formulaire en ligne : tout en colonne */
  .flex-between { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Mobile etroit (<= 480px) : optimisations supplementaires */
@media (max-width: 480px) {
  .content { padding: 10px; }
  .card { padding: 12px; }
  .topbar { padding: 0 10px; }
  .topbar-title { font-size: 15px; }
  .quick-link { padding: 14px 8px; }
  .quick-link-count { font-size: 22px; }
  .quick-link-label { font-size: 12px; }
  /* Cartes employes/locataires plus compactes */
  .demande-row, .demande-card, .perm-row { padding: 12px; }
  /* Boutons d'action proeminents */
  .btn { min-height: 40px; }
  /* Pages avec bouton flottant en bas */
  .topbar-actions .btn[onclick*="openModal"] {
    position: fixed; bottom: 16px; right: 16px;
    width: 56px; height: 56px; border-radius: 50%;
    padding: 0; font-size: 24px; z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  }
}

/* ============================================================
   ACCESSIBILITE — touch-target min 44x44 + zoom-friendly
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  .nav-link { padding: 12px 16px; min-height: 44px; }
  .btn-sm { min-height: 36px; padding: 8px 12px; }
  /* Selects + inputs : zone de tap plus grande */
  select.select { min-height: 40px; }
  /* Onglets/badges cliquables */
  .badge[onclick], .stat-card, .urgent-row, .quick-link { min-height: 44px; }
}
