/* ============================================================
   KASS MANAGER — Design System
   Graphite profond + vert signature, précision d'atelier Apple
   ============================================================ */

:root {
  --ink: #171b21;          /* graphite profond (sidebar, titres) */
  --ink-soft: #232932;
  --surface: #f4f5f7;      /* fond général */
  --card: #ffffff;
  --line: #e4e7ec;
  --text: #1c2128;
  --text-soft: #6b7280;
  --accent: #0e8c6d;       /* vert KASS */
  --accent-strong: #0b7159;
  --accent-soft: #e3f4ee;
  --amber: #b45309;
  --amber-soft: #fef3e2;
  --red: #b91c1c;
  --red-soft: #fdeaea;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(23, 27, 33, 0.06), 0 8px 24px rgba(23, 27, 33, 0.05);
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  font-size: 15px;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ============ ÉCRAN DE CONNEXION ============ */

#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(14, 140, 109, 0.25), transparent 60%),
    var(--ink);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.5px;
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--card);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: var(--ink);
  line-height: 1.1;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.login-card .subtitle {
  color: var(--text-soft);
  font-size: 13.5px;
  margin-bottom: 26px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fbfbfc;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 140, 109, 0.15);
  background: #fff;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s;
  margin-top: 6px;
}

.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.login-error {
  display: none;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.login-footer {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

/* ============ SÉLECTEUR DE LANGUE ============ */

.lang-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all 0.15s;
}

.lang-btn.active {
  background: var(--ink);
  color: #fff;
}

/* ============ APPLICATION (après connexion) ============ */

#screen-app { display: none; min-height: 100vh; }

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* --- Sidebar --- */

.sidebar {
  background: var(--ink);
  color: #cfd4dc;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand { margin-bottom: 30px; padding: 0 8px; }
.sidebar .brand-name { color: #fff; font-size: 16px; }
.sidebar .brand-sub { color: #8b93a1; }
.sidebar .brand-mark { background: rgba(255,255,255,0.08); }
.sidebar .brand-mark::after { border-color: var(--ink); }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #b9c0cb;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.nav-item .icon { width: 19px; height: 19px; flex-shrink: 0; }

.sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-top: 16px;
  margin-top: 16px;
}

.user-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-name { font-size: 13.5px; font-weight: 600; color: #fff; }
.user-role { font-size: 11.5px; color: #8b93a1; }

.btn-logout {
  width: 100%;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #cfd4dc;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-logout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* --- Contenu principal --- */

.main { padding: 30px 36px; max-width: 1200px; }

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.main-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.main-header .date-line {
  color: var(--text-soft);
  font-size: 13.5px;
  margin-top: 4px;
}

/* --- Cartes de statistiques --- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--ink);
  line-height: 1;
}

.stat-value small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0;
}

.stat-card.tone-green .stat-value { color: var(--accent-strong); }
.stat-card.tone-amber .stat-value { color: var(--amber); }

.stat-chip {
  display: inline-block;
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.chip-green { background: var(--accent-soft); color: var(--accent-strong); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-grey { background: var(--surface); color: var(--text-soft); }

/* --- Panneau "module à venir" --- */

.placeholder {
  background: var(--card);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 60px 30px;
  text-align: center;
  color: var(--text-soft);
}

.placeholder h3 {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 19px;
  margin-bottom: 8px;
}

/* --- Toast d'erreur globale --- */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: none;
  max-width: 90vw;
  z-index: 100;
}

/* ============ RESPONSIVE (smartphone) ============ */

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    z-index: 50;
    gap: 4px;
  }

  .sidebar .brand, .sidebar-user { display: none; }

  .nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }

  .nav-item {
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    padding: 8px 6px;
    text-align: center;
    align-items: center;
  }

  .nav-item span.label { font-size: 10px; }

  .main { padding: 20px 16px 110px; }
  .main-header h2 { font-size: 21px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ============================================================
   MODULE CLIENTS & RÉPARATIONS
   ============================================================ */

/* --- Barre d'outils (recherche + bouton) --- */

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: var(--card);
}

.toolbar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 140, 109, 0.12);
}

.btn-action {
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-action:hover { background: var(--accent-strong); }

.btn-secondary {
  padding: 10px 16px;
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

.btn-secondary:hover { border-color: var(--ink); }

/* --- Filtres par statut --- */

.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.chip-filter {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  transition: all 0.15s;
}

.chip-filter.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* --- Tableaux --- */

.table-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data tr:last-child td { border-bottom: none; }

table.data tbody tr { cursor: pointer; transition: background 0.1s; }
table.data tbody tr:hover { background: #f7faf9; }

.cell-strong { font-weight: 600; color: var(--ink); }
.cell-soft { color: var(--text-soft); font-size: 13px; }

.mono {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.empty-state {
  padding: 50px 20px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
}

/* --- Badges de statut --- */

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-recu          { background: #eef1f5; color: #4b5563; }
.badge-diagnostic    { background: var(--blue-soft); color: var(--blue); }
.badge-devis_envoye  { background: #f3e8ff; color: #7e22ce; }
.badge-en_attente    { background: var(--amber-soft); color: var(--amber); }
.badge-en_reparation { background: #e0f2fe; color: #0369a1; }
.badge-pret          { background: var(--accent-soft); color: var(--accent-strong); }
.badge-livre         { background: #e5e7eb; color: #374151; }
.badge-annule        { background: var(--red-soft); color: var(--red); }

/* --- Modales --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 27, 33, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
  z-index: 200;
  overflow-y: auto;
}

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

.modal {
  background: var(--card);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  margin: auto 0;
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
  color: var(--ink);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-grid label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink-soft);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfbfc;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 140, 109, 0.12);
  background: #fff;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.form-error {
  display: none;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  padding: 9px 13px;
  border-radius: 9px;
  margin-top: 14px;
}

.form-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 4px;
}

/* --- Détail réparation --- */

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.detail-sub {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 18px;
}

.tracking-box {
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.tracking-box .code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #7fe0c3;
}

.tracking-box .lbl { font-size: 11.5px; color: #9aa3b0; text-transform: uppercase; letter-spacing: 0.06em; }

.next-status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 6px;
}

.btn-status {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
}

.btn-status:hover { border-color: var(--accent); color: var(--accent-strong); }

.btn-whatsapp {
  width: 100%;
  padding: 12px;
  background: #22a35b;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
}

.btn-whatsapp:hover { background: #1b8a4c; }

.timeline { margin-top: 16px; border-left: 2px solid var(--line); padding-left: 16px; }

.timeline-item { position: relative; padding-bottom: 12px; font-size: 13px; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -21.5px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item .tl-date { color: var(--text-soft); font-size: 12px; }

/* --- Tableaux responsives (mobile : cartes) --- */

@media (max-width: 820px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  table.data td { border: none; padding: 3px 0; }
  .modal { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   THÈME KASS — Bleu marine & Jaune or (identité officielle)
   Couleurs extraites du logo et des affiches KASS APPLE SERVICES
   ============================================================ */

:root {
  --ink: #14213d;            /* bleu marine profond (logo, affiches) */
  --ink-soft: #1e2d52;
  --accent: #f6b21b;         /* jaune or KASS */
  --accent-strong: #d99a06;
  --accent-soft: #fdf3d8;
  --green: #0e8c6d;          /* vert conservé pour les statuts positifs */
  --green-strong: #0b7159;
  --green-soft: #e3f4ee;
}

/* Connexion : halo jaune sur fond marine */
#screen-login {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(246,178,27,0.30), transparent 60%),
    var(--ink);
}

/* Texte marine sur les boutons jaunes (lisibilité) */
.btn-primary, .btn-action { color: #14213d; font-weight: 700; }
.nav-item.active { color: #14213d; }
.user-avatar { color: #14213d; }

/* Focus des champs en jaune */
.field input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.toolbar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(246,178,27,0.25);
}

/* Logo dans la pastille de marque */
.brand-mark { background: #fff; overflow: hidden; }
.brand-mark img { width: 86%; height: auto; display: block; }
.brand-mark::after { display: none; }

/* Statuts positifs : le vert reste vert (lisibilité universelle) */
.badge-pret { background: var(--green-soft); color: var(--green-strong); }
.stat-card.tone-green .stat-value { color: var(--green-strong); }

/* Code de suivi en jaune dans l'encadré marine */
.tracking-box .code { color: #ffd66b; }


/* ============================================================
   MODULE STATISTIQUES
   ============================================================ */

.stats-panneaux {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.stats-panneau {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.stats-panneau.large { grid-column: 1 / -1; }

.stats-panneau h4 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin-bottom: 4px;
}

.stats-sous {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 14px;
}

/* Barres verticales (CA mensuel) */
.vbar-chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 170px;
}

.vbar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.vbar-valeur {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-soft);
  height: 14px;
  white-space: nowrap;
}

.vbar-piste {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.vbar-barre {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 5px 5px 0 0;
  min-height: 0;
}

.vbar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-soft);
  margin-top: 5px;
  text-transform: capitalize;
}

/* Barres horizontales */
.hbar-ligne { margin-bottom: 11px; }

.hbar-tete {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  margin-bottom: 4px;
}

.hbar-label { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-valeur { color: var(--text-soft); white-space: nowrap; font-weight: 600; }

.hbar-piste {
  height: 9px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
}

.hbar-barre {
  height: 100%;
  background: linear-gradient(90deg, var(--ink), #2e4270);
  border-radius: 999px;
}


/* ============================================================
   NAVIGATION MOBILE & TABLETTE — Barre en haut + menu déroulant
   ============================================================ */

.topbar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1024px) {

  /* --- Barre du haut --- */
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 58px;
    background: var(--ink);
    padding: 0 14px;
    z-index: 60;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  }

  .topbar .brand-mark { width: 36px; height: 36px; }
  .topbar .brand-name { color: #fff; font-size: 15px; }

  #btn-menu {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    border-radius: 10px;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
  }

  #btn-menu:active { background: var(--accent); color: var(--ink); }

  /* --- Le menu devient un panneau déroulant sous la barre --- */
  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 58px;
    bottom: auto;
    left: 0; right: 0;
    height: auto;
    max-height: calc(100vh - 58px);
    overflow-y: auto;
    flex-direction: column;
    padding: 14px;
    z-index: 55;
    transform: translateY(-110%);
    transition: transform 0.22s ease;
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
    border-radius: 0 0 18px 18px;
  }

  .sidebar.open { transform: translateY(0); }

  .sidebar .brand { display: none; }

  /* Noms complets, bien lisibles, les uns sous les autres */
  .nav {
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    flex: none;
  }

  .nav-item {
    flex-direction: row;
    align-items: center;
    gap: 13px;
    font-size: 15px;
    padding: 13px 14px;
    text-align: left;
  }

  .nav-item .icon { width: 21px; height: 21px; }
  .nav-item span.label { font-size: 15px; }

  /* Utilisateur + langue + déconnexion visibles dans le menu */
  .sidebar-user { display: block; }

  /* Fond assombri derrière le menu ouvert */
  .nav-backdrop.open {
    display: block;
    position: fixed;
    inset: 58px 0 0 0;
    background: rgba(20, 33, 61, 0.45);
    z-index: 50;
  }

  /* Le contenu commence sous la barre du haut */
  .main { padding: 76px 16px 30px; }
}


/* Barre du haut : bouton menu à gauche, marque centrée */
@media (max-width: 1024px) {
  .topbar-spacer { width: 42px; flex-shrink: 0; }
}
