/* ===== SIDEBAR (admin) — refonte 2026-08-22 ===== */

/* ===== COMPOSANTS RÉUTILISABLES (cf. admin/_macros.html) ===== */

/* sticky_toolbar : barre d'outils + recherche + actions */
.search-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #f8faf6;
  padding: 0.4rem 0.5rem;
  margin: 0 0 0.6rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.search-toolbar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: nowrap;
  align-items: center;
}
.search-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap .search-input-icon {
  position: absolute;
  left: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  line-height: 1;
  pointer-events: none;
  opacity: 0.65;
}
.search-input-wrap .search-input,
.search-input-wrap input[type="search"] {
  width: 100%;
  padding: 0.3rem 0.45rem 0.3rem 1.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: transparent;
}
.inline-form {
  display: inline;
  flex: 0 0 auto;
}

/* Stats verticalisées (ref. + pl.) */
.search-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
  padding: 0 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
  line-height: 1.1;
  flex: 0 0 auto;
}
.search-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}
.search-stat-value {
  font-weight: 700;
  color: #2f5d3a;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.search-stat-label {
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1;
}

/* Tableau responsive wrapper */
.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.responsive-table {
  width: 100%;
  border-collapse: collapse;
}
.table-caption {
  color: var(--primary-dark);
  margin: 1.5rem 0 0.5rem 0;
}
.hide-mobile { display: none; }

@media (min-width: 769px) {
  .hide-mobile { display: table-cell; }
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: #1f3f27;
  color: #fff;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-sidebar .brand {
  display: block;
  color: white;
  text-decoration: none;
  font-weight: 700;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}
.admin-sidebar .brand .emoji { margin-right: 0.4rem; }
.admin-sidebar .brand .brand-logo {
  height: 1.6rem;
  width: auto;
  vertical-align: middle;
  margin-right: 0.5rem;
  border-radius: 50%;
}
/* Hamburger dans la zone brand : visible uniquement sur tablette/mobile */
.admin-sidebar .brand .brand-burger {
  display: none;
  margin-left: auto;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
}
.admin-sidebar .brand .brand-burger:hover {
  background: rgba(255,255,255,0.18);
}
.admin-sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; padding: 0 0.5rem; }
.admin-sidebar details { border-radius: 6px; }
.admin-sidebar details[open] { background: rgba(255,255,255,0.04); }
.admin-sidebar summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  color: #d4e5d6;
  border-radius: 6px;
  display: flex; align-items: center; gap: 0.5rem;
  user-select: none;
}
.admin-sidebar summary::-webkit-details-marker { display: none; }
.admin-sidebar summary::before {
  content: "▸";
  font-size: 0.75rem;
  transition: transform 0.15s;
  color: #b6862c;
}
.admin-sidebar details[open] summary::before { transform: rotate(90deg); }
.admin-sidebar summary:hover { background: rgba(255,255,255,0.08); }
.admin-sidebar summary.active { background: #2f5d3a; color: white; }

/* Lien direct cliquable pour les rubriques sans sous-menu (ex: Palette) */
.admin-sidebar a.rubrique {
  display: block;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  color: #d4e5d6;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.admin-sidebar a.rubrique:hover { background: rgba(255,255,255,0.08); color: #d4e5d6; }
.admin-sidebar a.rubrique.active { background: #2f5d3a; color: white; }
.admin-sidebar .sub {
  display: flex; flex-direction: column;
  padding: 0.25rem 0 0.5rem 2rem;
}
.admin-sidebar .sub a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.93rem;
}
.admin-sidebar .sub a:hover { background: rgba(255,255,255,0.06); color: white; }
.admin-sidebar .sub a.active { background: #b6862c; color: white; font-weight: 600; }
.admin-sidebar .sub a.soon {
  color: rgba(255,255,255,0.45);
  cursor: not-allowed;
  font-style: italic;
}
.admin-sidebar .sub a.soon:hover { background: transparent; }
.admin-sidebar .sub a.soon small { opacity: 0.7; font-size: 0.78rem; }

.admin-main { background: #f0f2f5; min-height: 100vh; display: flex; flex-direction: column; }

/* ===== BURGER MOBILE (topbar, toujours visible en mobile) ===== */
.sidebar-burger-topbar {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 220; /* au-dessus de la topbar et de la sidebar */
  width: 40px;
  height: 40px;
  background: #E87722;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sidebar-burger-topbar:hover { background: #c4631a; }
.sidebar-burger-topbar:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ===== TOPBAR (verte, sticky desktop / fixed mobile, avec fil d'Ariane) ===== */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1f3f27;
  color: #F5F1E6;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  min-height: 56px;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  /* Aligné sur le brand "Pépinière PEI" de la sidebar : blanc, 1.1rem, gras */
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 0;
}
.topbar-breadcrumb .bc-home {
  color: #fff;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.topbar-breadcrumb .bc-home:hover { opacity: 1; text-decoration: underline; }
.topbar-breadcrumb .bc-sep {
  opacity: 0.55;
  font-weight: 300;
  user-select: none;
}
.topbar-breadcrumb .bc-section {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.user-email {
  color: #F5F1E6;
  text-decoration: none;
  font-size: 0.88rem;
  opacity: 0.9;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.user-email:hover { opacity: 1; text-decoration: underline; }
/* Bouton déconnexion : rouge/orange, alert signal */
.btn-logout {
  background: #E87722;
  color: #fff;
  padding: 0.45rem 0.95rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-logout:hover {
  background: #c4631a;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
/* Sur mobile, le bouton logout est icône seule (carré compact) */
.btn-logout-icon svg { display: block; }
@media (max-width: 768px) {
  .btn-logout-icon {
    padding: 0.45rem;
    width: 36px;
    height: 36px;
  }
}
/* Mobile : stack vertical */
@media (max-width: 768px) {
  .admin-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
  }
  .topbar-breadcrumb { font-size: 0.88rem; }
  .topbar-user { justify-content: flex-end; }
  .user-email { display: none; } /* mobile : on garde juste le bouton déco */
}

/* ===== RESPONSIVE : sidebar coulissante sur tablette/mobile ===== */
@media (max-width: 900px) {
  /* Burger topbar visible */
  .sidebar-burger-topbar { display: inline-flex; }

  /* Layout : la sidebar sort du flux pour pouvoir coulisser */
  .admin-layout {
    grid-template-columns: 1fr;
  }
  /* Topbar : fixe en haut, full-width, padding-left pour ne pas cacher sous le burger */
  .admin-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-left: 60px; /* laisse la place au burger fixed */
    color: #fff; /* texte blanc par défaut pour visibilité sur fond vert foncé */
  }
  /* Force tous les éléments enfants de la topbar en blanc (sauf le bouton Déconnexion) */
  .admin-topbar a:not(.btn-logout),
  .admin-topbar .bc-home,
  .admin-topbar .bc-sep,
  .admin-topbar .bc-section,
  .admin-topbar .topbar-breadcrumb,
  .admin-topbar .topbar-breadcrumb a {
    color: #fff !important;
    text-decoration: none;
  }
  .admin-topbar .bc-sep { opacity: 0.6; }
  .admin-topbar .bc-home:hover,
  .admin-topbar .bc-section { opacity: 1; }
  .admin-topbar .bc-section { opacity: 0.9; }
  .admin-topbar .user-email { color: #fff !important; }
  /* Burger et bouton Déconnexion : même hauteur, alignés verticalement */
  .sidebar-burger-topbar,
  .btn-logout-icon {
    box-sizing: border-box;
    height: 40px;
  }
  .btn-logout-icon {
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* Compense la topbar fixed : le main démarre en-dessous (sur toutes les pages) */
  .admin-main {
    padding-top: 72px;
  }
  /* Sidebar : cachée par défaut, slide-in depuis la gauche */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,0.18);
  }
  .admin-sidebar.is-open {
    transform: translateX(0);
  }
  /* Le burger devient visible */
  .admin-sidebar .brand .brand-burger {
    display: inline-block;
  }
  /* Overlay sombre quand la sidebar est ouverte */
  .admin-sidebar.is-open::after {
    content: "";
    position: fixed;
    top: 240px; /* sous la zone brand ; optionnel */
    left: 240px;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: -1;
  }
  /* Le contenu principal prend toute la largeur */
  .admin-main { width: 100%; }
}

.admin-content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* H1 dans le contenu admin : marge haute propre (plus de topbar verte au-dessus) */
.admin-content > h1:first-child {
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 1.65rem;
  font-weight: 700;
  color: #1a2e1a;
}

/* ===== DASHBOARD : 5 blocs-rubriques ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}
.dashboard-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
  border-top: 4px solid #2f5d3a;
}
.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  text-decoration: none;
}
.dashboard-card.production    { border-top-color: #b6862c; }
.dashboard-card.produits      { border-top-color: #2f5d3a; }
.dashboard-card.site          { border-top-color: #2563eb; }
.dashboard-card.ventes        { border-top-color: #c2410c; }
.dashboard-card.comptabilite  { border-top-color: #6d28d9; }

.dashboard-card .emoji { font-size: 2.2rem; margin-bottom: 0.5rem; }
.dashboard-card h3 { margin: 0 0 0.5rem; color: var(--primary-dark); font-size: 1.15rem; }
.dashboard-card .nums {
  display: flex; gap: 1rem; flex-wrap: wrap;
  margin-top: 0.75rem;
}
.dashboard-card .num {
  background: #f5f8f4;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  flex: 1 1 100px;
  text-align: center;
}
.dashboard-card .num strong { display: block; font-size: 1.5rem; color: var(--primary-dark); }
.dashboard-card .num span { font-size: 0.82rem; color: var(--muted); }
.dashboard-card .alert {
  background: #fef3c7;
  border-left: 3px solid #c2410c;
  padding: 0.5rem 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: #92400e;
  border-radius: 4px;
}

.welcome-banner {
  background: linear-gradient(135deg, #2f5d3a, #1f3f27);
  color: white;
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}
.welcome-banner h2 { margin: 0 0 0.25rem; }
.welcome-banner p { margin: 0; opacity: 0.9; }

/* Boutons d'action colorés */
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.btn-orange {
  background: #b6862c;
  color: white;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  border: none;
  cursor: pointer;
}
.btn-orange:hover { background: #a37523; color: white; }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
}
.btn-ghost:hover { background: var(--primary); color: white; }

@media (max-width: 768px) {
  /* NE PAS reset la sidebar en position:relative ici : le @media (max-width: 900px)
     ci-dessus la met en fixed + transform translateX(-100%) pour le slide-in mobile.
     Si on la repasse en relative, elle reprend sa place dans la grille et crée
     un énorme espace blanc au-dessus du contenu (bug observé 11/09 sur fiche édition). */
  .admin-layout { grid-template-columns: 1fr; }  /* safe, déjà appliqué par le @media 900px */
}

/* ===== STATS GRID (dashboard) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.stat .num {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat > div:last-child {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ===== TABLE ADMIN ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
.admin-table thead th {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}
.admin-table tbody td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.admin-table tbody tr:hover {
  background: var(--accent-light);
}

/* ===== BADGES ===== */
.badge.out {
  background: var(--error);
  color: white;
}

/* ===== BOUTONS (alias) ===== */
.btn {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn:hover { background: var(--primary-dark); }
.btn-small {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85rem;
}
.btn-small:hover { background: var(--accent-dark); }

/* ===== FORMS ADMIN ===== */
.form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
}
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"],
.form textarea {
  display: block;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  margin-top: 0.25rem;
}
.form input:focus,
.form textarea:focus {
  border-color: var(--primary);
  outline: 2px solid var(--primary-light);
}
.form .checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form .checkbox input { width: auto; margin: 0; }
.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 2rem;
}

/* ===== DL GRID (caractéristiques) ===== */
.bot-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0;
}
.bot-grid dt {
  font-weight: 600;
  color: var(--primary-dark);
}
.bot-grid dd {
  margin: 0;
  color: var(--fg);
}

/* ===== STATUS BADGES (prospects) ===== */
.status-nouveau { background: #dbeafe; color: #1e3a8a; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.status-contacte { background: #fef3c7; color: #854d0e; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.status-interesse { background: #ede9fe; color: #5b21b6; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.status-devis { background: #fce7f3; color: #9d174d; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.status-gagne { background: #dcfce7; color: #166534; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }
.status-perdu { background: #fee2e2; color: #991b1b; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; }

/* ===== FLASH MESSAGES ===== */
.flashes { margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ===== Page de connexion (re-design 2026-09-08) ===== */
.login-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(31, 63, 39, 0.12);
  padding: 2.2rem 2.4rem;
  text-align: center;
}
.login-logo {
  width: 84px;
  height: auto;
  margin: 0 auto 0.8rem;
  display: block;
}
.login-title {
  color: var(--primary-dark);
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0.2rem 0 0.15rem;
  letter-spacing: -0.01em;
}
.login-sub {
  color: var(--primary);
  font-size: 0.92rem;
  margin: 0 0 1.4rem;
  opacity: 0.75;
}
.login-flash {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.login-flash li {
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
.login-flash--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.login-flash--success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.login-flash--info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}
.login-field span {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.3rem;
}
.login-field input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--primary-dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 93, 58, 0.15);
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: #4b5563;
  cursor: pointer;
}
.login-submit {
  margin-top: 0.3rem;
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.login-submit:hover { background: var(--primary-dark); }
.login-foot {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ===== Login — champ mot de passe avec toggle afficher/masquer (2026-09-08) ===== */
.login-password {
  position: relative;
  display: block;
}
.login-password input {
  width: 100%;
  padding: 0.65rem 2.8rem 0.65rem 0.8rem; /* place à droite pour l'icône */
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--primary-dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-password input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 93, 58, 0.15);
}
.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.login-password-toggle:hover { background: var(--accent-light); color: var(--primary-dark); }
.login-password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.login-password-toggle .login-eye-off  { display: none; }
.login-password-toggle .login-eye-open { display: block; }
.login-password-toggle.is-visible .login-eye-open { display: none; }
.login-password-toggle.is-visible .login-eye-off  { display: block; }

/* ===== MOBILE-FIRST GLOBAL : table + form + buttons =====
   Appliqué à TOUTES les pages admin sans modifier les templates.
   Réf. : Piège #87 / P-Palette-91 / pitfalls-batch-2026-09-11-e.md
   Cible : iPhone 12 portrait (412x900) — débordement horizontal JAMAIS toléré.
*/
@media (max-width: 768px) {
  /* 1. Table compacte pleine largeur (cible tactile Apple HIG = 44px) */
  .admin-content table,
  .admin-table,
  .responsive-table,
  #plants-table, #clients-table, #cmd-table, #consommables-table,
  #cultures-table, #lots-table, #groupes-table, #data-table,
  #tarif-table, #ap-table, #ad-table, #devis-lignes-table,
  .table-scroll-wrap > table {
    font-size: 11px !important;
    line-height: 1.3 !important;
    width: 100% !important;
    table-layout: auto;
    border-collapse: collapse;
  }
  .admin-content table th,
  .admin-content table td,
  .admin-table th, .admin-table td,
  .responsive-table th, .responsive-table td {
    padding: 0.35rem 0.4rem !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    vertical-align: middle;
  }
  .admin-content table thead th,
  .admin-table thead th,
  .responsive-table thead th {
    font-weight: 700;
    background-color: #e8efe6 !important;
    color: #1a2e1a;
    position: static !important;     /* PAS sticky en mobile : économie 28px */
    white-space: nowrap;
  }
  /* Wrap cellules 2 lignes max pour noms longs */
  .admin-content table td,
  .admin-table td {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 180px;
  }
  /* Compacter la 1ère colonne (souvent # ou checkbox) */
  .admin-content table th:first-child,
  .admin-content table td:first-child,
  .admin-table th:first-child, .admin-table td:first-child {
    width: 38px;
    padding-left: 0.4rem !important;
    padding-right: 0.3rem !important;
  }
  /* Cellule de mise en valeur (stock, prix…) — dernier enfant : valeur primary */
  .admin-content table td:last-child:not(:first-child),
  .admin-table td:last-child:not(:first-child) {
    font-weight: 700;
    color: var(--primary-dark, #1f3f27);
    text-align: right;
  }
  /* Pas de scroll horizontal : on accepte une dernière ligne tronquée plutôt
     qu'un scroll horizontal qui perd le contexte. Le tableau reste lisible. */

  /* 2. Boutons toolbar → icône seule (Piège #88) */
  .admin-content .btn-row,
  .admin-content .search-bar-wrap,
  .admin-content .action-bar,
  .admin-content .btn-row-top {
    flex-wrap: wrap;
    gap: 0.35rem !important;
  }
  .admin-content .btn-ghost,
  .admin-content .btn-orange,
  .admin-content .btn,
  .admin-content a.btn-add-espece,
  .admin-content button[type="submit"].btn,
  .btn-add-espece {
    padding: 0.4rem 0.55rem !important;
    font-size: 12px !important;
    min-height: 36px;
  }
  /* Sur les boutons avec icône + texte, on cache le texte si la classe
     .btn-icon-text est appliquée (déjà documenté P-Palette-92). Force un
     format compact : icône visible, texte dans title pour long-press. */
  .admin-content .btn-icon-text .btn-label { display: none !important; }
  .admin-content .btn-icon-text .btn-icon {
    font-size: 1.2rem;
    line-height: 1;
  }

  /* 3. Inputs en priorité tactile (44px min) — anti zoom iOS */
  .admin-content input[type="text"],
  .admin-content input[type="number"],
  .admin-content input[type="email"],
  .admin-content input[type="search"],
  .admin-content input[type="password"],
  .admin-content input[type="tel"],
  .admin-content input[type="url"],
  .admin-content input[type="date"],
  .admin-content select,
  .admin-content textarea {
    min-height: 44px !important;
    padding: 0.55rem 0.7rem !important;
    font-size: 16px !important;       /* anti zoom iOS (Piège #89) */
  }
  .admin-content input[type="number"] {
    -moz-appearance: textfield;
  }
  .admin-content input[type="number"]::-webkit-inner-spin-button,
  .admin-content input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none; margin: 0;
  }
  /* Textarea : pas de min-height 44px (sinon bloque 1 ligne) */
  .admin-content textarea { min-height: 96px !important; }

  /* 4. Forms : grid 2 colonnes → 1 colonne (déjà OK dans admin_base via .form-grid) */
  .admin-content .form-grid,
  .admin-content .form .form-row {
    grid-template-columns: 1fr !important;
  }

  /* 5. Padding contenu : aéré mais pas étouffant */
  .admin-content {
    padding: 0.85rem !important;
  }
  .admin-content > h1:first-child {
    font-size: 1.3rem !important;
    margin-bottom: 0.85rem !important;
  }

  /* 6. Flashes (popups fixes) : moins larges en mobile */
  .flash-popup {
    max-width: calc(100vw - 24px) !important;
    right: 12px !important;
    left: 12px !important;
    padding: 0.6rem 0.9rem !important;
    font-size: 0.95rem;
  }

  /* 7. Tables dans .table-scroll-wrap : doivent remplir la largeur
        utile, PAS scroller horizontalement. On retire l'overflow hidden
        sur les wrappers car le tableau est déjà compact. */
  .table-scroll-wrap {
    overflow-x: visible !important;
    border-radius: 6px;
  }
}

/* Vue très petite (≤400px) : encore plus compact pour vieux Android */
@media (max-width: 400px) {
  .admin-content table,
  .admin-table,
  .responsive-table { font-size: 10px !important; }
  .admin-content table th,
  .admin-content table td,
  .admin-table th, .admin-table td {
    padding: 0.25rem 0.3rem !important;
    font-size: 10px !important;
  }
}
