:root {
  --teal-50: #E1F5EE;
  --teal-100: #9FE1CB;
  --teal-400: #1D9E75;
  --teal-600: #0F6E56;
  --teal-800: #085041;
  --teal-900: #04342C;

  --coral-400: #D85A30;
  --amber-400: #BA7517;

  --bg-page: #F7FAF9;
  --bg-card: #FFFFFF;
  --border: #E1E8E5;
  --text-primary: #1A2420;
  --text-secondary: #5C6B65;
  --text-muted: #93A19B;

  --radius: 10px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

p { margin: 0; color: var(--text-secondary); }

a { color: var(--teal-600); text-decoration: none; }

/* ---------- Formulaires ---------- */
label {
  display: block;
  font-size: 13px;
  color: var(--teal-800);
  margin-bottom: 6px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text-primary);
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px var(--teal-50);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

button:active, .btn:active { transform: scale(0.98); }

.btn-primary { background: var(--teal-600); color: #fff; }
.btn-primary:hover { background: var(--teal-800); }

.btn-secondary { background: #fff; color: var(--teal-800); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--teal-50); }

.btn-danger { background: #fff; color: var(--coral-400); border: 1px solid var(--border); }

/* ---------- Cartes ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border);
}
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 500; color: var(--teal-900); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: var(--teal-50); color: var(--teal-800); }
.badge-warning { background: #FAEEDA; color: #633806; }
.badge-danger { background: #FCEBEB; color: #791F1F; }

/* ---------- Layout app (sidebar + contenu) ---------- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--teal-900);
  color: #fff;
  padding: 24px 16px;
  flex-shrink: 0;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  padding: 0 8px;
}
.sidebar .logo-icon {
  width: 32px; height: 32px;
  background: var(--teal-400);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 500;
}
.sidebar .logo-text { font-size: 15px; font-weight: 500; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--teal-100);
  font-size: 14px;
  margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: var(--teal-600); color: #fff; }

.main-content { flex: 1; padding: 32px 40px; max-width: 1100px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}
.avatar-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--teal-50);
  color: var(--teal-800);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-secondary); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.error-message {
  background: #FCEBEB;
  color: #791F1F;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

/* ---------- Champ mot de passe avec œil ---------- */
.champ-mdp-conteneur { position: relative; }
.champ-mdp-conteneur input { padding-right: 44px; }
.btn-oeil {
  position: absolute;
  right: 6px;
  top: 6px;
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-secondary);
}
.btn-oeil:hover { color: var(--teal-800); }

/* ---------- Bouton copier ---------- */
.ligne-copiable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: monospace;
  font-size: 14px;
  color: var(--teal-900);
}
.btn-copier {
  background: var(--teal-600);
  color: #fff;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}
.btn-copier:hover { background: var(--teal-800); }
.btn-copier.copie { background: var(--teal-400); }

/* ---------- Modale simple ---------- */
.modale-fond {
  position: fixed;
  inset: 0;
  background: rgba(4, 52, 44, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modale-boite {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 90%;
}

/* ---------- Calendrier mensuel ---------- */
.entete-calendrier {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.entete-calendrier .btn-nav-mois {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 34px; height: 34px;
  cursor: pointer;
  font-size: 16px;
  color: var(--teal-800);
}
.entete-calendrier .btn-nav-mois:hover { background: var(--teal-50); }

.grille-calendrier {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.entete-jour-calendrier {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-bottom: 6px;
  text-transform: uppercase;
}
.jour-calendrier {
  min-height: 76px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}
.jour-calendrier.jour-vide { border: none; background: transparent; }
.jour-calendrier.jour-aujourdhui { border: 2px solid var(--teal-400); }
.numero-jour { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }

.legende-calendrier {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 13px;
}
.legende-calendrier .item-legende { display: flex; align-items: center; gap: 6px; }

@media (max-width: 768px) {
  .jour-calendrier { min-height: 50px; font-size: 12px; }
}

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .main-content { padding: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
