/* ============================================================
   Planning RDV — design system
   Palette teal/orange sur fond neutre clair, une seule famille
   de police (Plus Jakarta Sans) + IBM Plex Mono pour les donnees
   (heures, telephones, identifiants).
   ============================================================ */

:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-muted: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-muted: #475569;
  --text-faint: #94A3B8;

  --primary: #0D9488;
  --primary-dark: #0F766E;
  --primary-soft: #CCFBF1;
  --primary-soft-text: #115E59;

  --cta: #F97316;
  --cta-dark: #EA580C;
  --cta-soft: #FFEDD5;

  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --success: #16A34A;

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;

  --font-body: 'Plus Jakarta Sans', -apple-system, "Segoe UI", sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { color: var(--text); }
.brand-mark { color: var(--primary); flex-shrink: 0; }

.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: background-color 150ms, color 150ms;
}
.nav a:hover { color: var(--text); background: var(--surface-muted); }
.nav a.nav-active { color: var(--primary-dark); background: var(--primary-soft); }

.who { display: flex; align-items: center; gap: 10px; }
.who-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }

.link-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: background-color 150ms, color 150ms;
}
.link-btn:hover { color: var(--danger); background: var(--surface-muted); }
.link-btn-danger { color: var(--danger); font-size: 0.85rem; font-weight: 600; padding: 8px 0; }
.link-btn-danger:hover { color: var(--danger); text-decoration: underline; background: none; }
.form-supprimer { margin-top: 18px; }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--avatar-bg, var(--primary));
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
  line-height: 1;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.72rem; }
.avatar-xs { width: 20px; height: 20px; font-size: 0.62rem; }

/* ---------- Layout ---------- */
.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}
.page-narrow { max-width: 580px; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}
h1 { font-size: 1.5rem; margin: 0 0 4px; font-weight: 800; letter-spacing: -0.015em; }
h2 { font-size: 1.05rem; margin: 40px 0 14px; font-weight: 700; }
.sous-titre { color: var(--text-muted); margin: 0; font-size: 0.92rem; }

/* Segmented filter control */
.segmented {
  display: inline-flex;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.segment {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background-color 150ms, color 150ms;
}
.segment:hover { color: var(--text); }
.segment-active, .segment-active:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* ---------- Planning : cartes RDV ---------- */
.jour-groupe { margin-bottom: 28px; }
.jour-titre {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.cartes { display: flex; flex-direction: column; gap: 10px; }

.carte-rdv {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 150ms, box-shadow 150ms;
}
.carte-rdv:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.carte-heure {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-dark);
  background: var(--primary-soft);
  min-width: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.carte-corps { flex: 1; padding: 16px 18px; min-width: 0; }
.carte-ligne-haut { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.carte-titre-ligne { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.carte-titre-ligne strong { font-size: 1rem; font-weight: 700; }

.carte-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 150ms;
  flex-shrink: 0;
}
.carte-rdv:hover .carte-actions,
.carte-rdv:focus-within .carte-actions { opacity: 1; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-faint);
  transition: background-color 150ms, color 150ms;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.icon-btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.tel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.83rem;
}
.badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tag {
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}
.who-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.note {
  margin: 12px 0 0;
  color: var(--text);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty svg { color: var(--text-faint); margin-bottom: 8px; }
.empty p { margin: 0 0 16px; }

/* ---------- Formulaires ---------- */
.formulaire { display: flex; flex-direction: column; gap: 16px; max-width: 480px; }
.formulaire-inline { max-width: 680px; }
.carte-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.formulaire label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.formulaire input, .formulaire select, .formulaire textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
.formulaire input:focus, .formulaire select:focus, .formulaire textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.ligne-2 { display: flex; gap: 16px; }
.ligne-2 label { flex: 1; }

.actions { display: flex; gap: 10px; margin-top: 4px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--cta);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-body);
  transition: background-color 150ms, transform 150ms;
}
.btn:hover { background: var(--cta-dark); }
.btn:active { transform: translateY(1px); }
.btn-large { padding: 12px 20px; font-size: 0.95rem; width: 100%; }
.btn-secondaire {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn-secondaire:hover { background: var(--surface-muted); color: var(--text); }

.alerte {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 600;
}

/* ---------- Auth ---------- */
.page-centre {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.carte-auth {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}
.carte-auth h1 { font-size: 1.35rem; }

/* ---------- Table (comptes) ---------- */
.carte-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table tbody tr:last-child td { border-bottom: none; }
.table th {
  color: var(--text-faint);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-muted);
}
.table td:nth-child(2) { font-family: var(--font-mono); color: var(--text-muted); }
.cell-membre { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-actions { text-align: right; }

.role-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
}
.role-admin { color: var(--primary-dark); background: var(--primary-soft); border-color: transparent; }

.statut { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.statut-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.statut-actif { background: var(--success); }
.statut-inactif { background: var(--text-faint); }

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 12px; }
  .nav { order: 3; width: 100%; }
  .ligne-2 { flex-direction: column; }
  .carte-rdv { flex-direction: row; }
  .carte-heure { min-width: 60px; font-size: 0.82rem; }
  .page-head { flex-direction: column; align-items: stretch; }
}

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