/*
 * AURA Home Academy – charte graphique de la plateforme.
 *
 * - Couleurs du logo officiel, police Montserrat (hébergée dans le projet).
 * - Pensée d'abord pour le téléphone : barre de navigation en bas de l'écran ;
 *   menu latéral à partir d'un écran d'ordinateur (1024 px).
 * - Propriétés « logiques » (inline-start / inline-end) : tout s'inverse seul en arabe.
 */

/* ---------------------------------------------------------------- Police */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin.311d352d9323.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- Variables */

:root {
  /* Couleurs du logo */
  --navy: #1d2350;
  --navy-800: #262d63;
  --navy-950: #151a3d;
  --teal: #13a3a0;
  --teal-700: #0d7f7c;
  --teal-50: #e6f6f5;
  --pink: #e8337a;
  --pink-50: #fdebf2;
  --yellow: #f7c21c;
  --yellow-50: #fef6dc;
  --violet: #7a4fd6;
  --violet-50: #f1ecfc;
  --orange: #f47b2a;
  --orange-50: #feefe5;

  /* Neutres */
  --ink: #1d2350;
  --ink-2: #3b4170;
  --muted: #646a8a;
  --line: #eceaf5;
  --line-strong: #d2d0e4;
  --surface: #ffffff;
  --bg: #f4f3fb;
  --bg-soft: #faf9fe;

  /* États */
  --success: #138a5b;
  --success-50: #e5f5ee;
  --danger: #c4234d;
  --danger-50: #fcebef;
  --warning: #a86a00;

  /* Formes */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(29, 35, 80, 0.06);
  --shadow: 0 1px 2px rgba(29, 35, 80, 0.05), 0 8px 24px rgba(29, 35, 80, 0.06);
  --focus: 0 0 0 4px rgba(19, 163, 160, 0.18);

  --sidebar-width: 268px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

/* L'arabe utilise les polices arabes du téléphone ou de l'ordinateur. */
html[lang="ar"] {
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Montserrat", system-ui,
    sans-serif;
}

/* ---------------------------------------------------------------- Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body {
  font-size: 0.95rem;
  line-height: 1.7;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--teal-700);
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

.icon {
  display: inline-block;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Les flèches changent de sens en arabe. */
[dir="rtl"] .icon-flip {
  transform: scaleX(-1);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Mise en page */

.app {
  min-height: 100vh;
}

.app-main {
  min-width: 0;
}

.sidebar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 1rem;
  color: #fff;
  background: var(--navy);
}

.topbar-logo img {
  display: block;
  width: auto;
  height: 42px;
}

.topbar-title {
  display: none;
}

.topbar-tools {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1rem 6.5rem;
}

/* Barre de navigation en bas de l'écran (téléphone) */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(29, 35, 80, 0.06);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: center;
  padding: 0.55rem 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.bottom-nav a[aria-current="page"] {
  color: var(--teal-700);
}

.bottom-nav a[aria-current="page"] .icon {
  stroke-width: 2.4;
}

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem 1rem 1rem;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.82);
    background: var(--navy);
    background-image: radial-gradient(circle at 0% 100%, rgba(19, 163, 160, 0.16), transparent 45%);
  }

  .topbar {
    height: 72px;
    padding: 0 2rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(160%) blur(8px);
  }

  .topbar-logo {
    display: none;
  }

  .topbar-title {
    display: block;
    font-size: 0.875rem;
    color: var(--muted);
  }

  .topbar-title strong {
    color: var(--ink);
  }

  .content {
    padding: 2rem 2rem 3rem;
  }

  .bottom-nav {
    display: none;
  }
}

/* ---------------------------------------------------------------- Menu latéral */

.sidebar-brand {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 1.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
  display: block;
  width: 148px;
  height: auto;
}

.nav-section {
  margin: 1.25rem 0.75rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

html[lang="ar"] .nav-section {
  font-size: 0.8rem;
  letter-spacing: 0;
}

.nav-link {
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  margin-bottom: 3px;
  font-size: 0.86rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  border-radius: 12px;
}

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

.nav-link[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.nav-link[aria-current="page"]::before {
  position: absolute;
  inset-block: 8px;
  inset-inline-start: -1rem;
  width: 4px;
  content: "";
  background: var(--teal);
  border-start-end-radius: 4px;
  border-end-end-radius: 4px;
}

.nav-count {
  margin-inline-start: auto;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

/* Compteur de choses à traiter : pastille jaune */
.nav-count.is-todo {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  font-weight: 700;
  color: var(--navy);
  background: var(--yellow);
}

.nav-link.is-soon {
  color: rgba(255, 255, 255, 0.4);
  cursor: default;
}

.nav-link.is-soon:hover {
  background: none;
}

.nav-soon {
  margin-inline-start: auto;
  padding: 0.05rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
}

.sidebar-footer {
  padding-top: 1rem;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-width: 0;
}

.user-chip .user-name {
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip .user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-footer .icon-button {
  margin-inline-start: auto;
  color: rgba(255, 255, 255, 0.7);
}

/* Menu du compte (téléphone) : s'ouvre sans JavaScript */
.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
  cursor: pointer;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu-panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 10px);
  z-index: 40;
  min-width: 230px;
  padding: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.user-menu-panel .user-name {
  font-weight: 700;
}

.user-menu-panel .user-role {
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (min-width: 1024px) {
  .user-menu {
    display: none;
  }
}

/* ---------------------------------------------------------------- Langues */

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.lang-switch a {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-radius: 999px;
}

.lang-switch a[aria-current="true"] {
  color: var(--navy);
  background: #fff;
}

.lang-switch .lang-long {
  display: none;
}

@media (min-width: 1024px) {
  .topbar .lang-switch {
    background: var(--bg);
    border: 1px solid var(--line);
  }

  .topbar .lang-switch a {
    color: var(--muted);
  }

  .topbar .lang-switch a[aria-current="true"] {
    color: #fff;
    background: var(--navy);
  }

  .topbar .lang-switch .lang-long {
    display: inline;
  }

  .topbar .lang-switch .lang-short {
    display: none;
  }
}

/* ---------------------------------------------------------------- En-tête de page */

.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
}

.page-kicker {
  display: block;
  margin-bottom: 0.15rem;
  font-weight: 700;
  color: var(--muted);
}

/* Aperçu d'un module à venir */
.soon-grid {
  display: grid;
  gap: 0.75rem;
  padding: 1.1rem 1.35rem 1.35rem;
}

.soon-tile {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  background: var(--bg-soft);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
}

.soon-tile strong {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.soon-tile p {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.data-table .item-title {
  white-space: nowrap;
}

/* Remplissage des places d'un tutor */
.capacity {
  display: grid;
  gap: 1rem;
  padding: 1.1rem 1.35rem 1.35rem;
}

.capacity-row {
  display: grid;
  gap: 0.4rem;
}

.capacity-head {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  font-weight: 700;
}

.capacity .progress {
  height: 10px;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.back-link {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--ink);
}

@media (min-width: 1024px) {
  .page-header h1 {
    font-size: 1.55rem;
  }
}

/* ---------------------------------------------------------------- Boutons */

.btn {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1.15rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: var(--surface);
  border: 2px solid var(--navy);
  border-radius: 999px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover {
  background: var(--bg);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

/* Bouton principal : bleu nuit plein */
.btn-primary {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.btn-primary:hover {
  background: var(--navy-800);
  border-color: var(--navy-800);
}

/* Bouton d'action rapide dans une ligne de tableau */
.btn-action {
  min-height: 38px;
  padding: 0 0.95rem;
  font-size: 0.82rem;
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.btn-action:hover {
  background: var(--navy-800);
}

.btn-danger {
  color: var(--danger);
  background: var(--surface);
  border-color: #efc2cf;
}

.btn-danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-sm {
  min-height: 38px;
  padding: 0 0.95rem;
  font-size: 0.82rem;
  border-width: 1.5px;
}

.btn-block {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.link-button {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--teal-700);
  cursor: pointer;
  background: none;
  border: 0;
}

.link-button:hover {
  text-decoration: underline;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* ---------------------------------------------------------------- Cartes */

.card {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(29, 35, 80, 0.04), 0 6px 20px rgba(29, 35, 80, 0.05);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.35rem 0.9rem;
}

.card-header + .stack-list,
.card-header + .data-table,
.card-header + .card-body {
  border-top: 1px solid var(--line);
}

.card-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy);
}

.card-subtitle {
  margin-top: 0.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.card-title {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-size: 1rem;
  font-weight: 700;
}

.card-title .icon {
  color: var(--teal);
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 0.85rem 1.25rem;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-end-start-radius: var(--radius-lg);
  border-end-end-radius: var(--radius-lg);
}

.card-danger {
  border-color: #f2cdd7;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-kpi {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.stack {
  display: grid;
  gap: 1rem;
  align-content: start;
}

@media (min-width: 1024px) {
  .grid-kpi {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
  }

  .grid-main {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1.25rem;
  }

  .grid-halves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

/* ---------------------------------------------------------------- Bandeau d'accueil */

.welcome {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-800) 100%);
  border-radius: var(--radius-lg);
}

.welcome::after {
  position: absolute;
  inset-block-start: -60px;
  inset-inline-end: -40px;
  width: 220px;
  height: 220px;
  content: "";
  background: radial-gradient(circle, rgba(19, 163, 160, 0.45), transparent 65%);
}

.welcome h1 {
  font-size: 1.35rem;
  font-weight: 700;
}

.welcome p {
  margin: 0.3rem 0 0;
  color: rgba(255, 255, 255, 0.75);
}

.welcome-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

@media (min-width: 1024px) {
  .welcome {
    padding: 1.75rem 2rem;
    margin-bottom: 1.25rem;
  }

  .welcome h1 {
    font-size: 1.6rem;
  }
}

/* ---------------------------------------------------------------- Chiffres clés */

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1.15rem 1.3rem 1.2rem;
  color: inherit;
  text-decoration: none;
}

a.kpi:hover {
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line-strong);
}

.kpi-icon {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1rem;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.kpi-label {
  padding-inline-end: 44px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-meta {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal-700);
}

/* Chiffre qui demande une action : encadré orange */
.kpi-alert {
  box-shadow: inset 0 0 0 2px var(--orange), 0 6px 20px rgba(244, 123, 42, 0.12);
}

.kpi-alert .kpi-value,
.kpi-alert .kpi-meta {
  color: #b4430a;
}

/* Teintes reprises des cinq points du logo */
.tone-teal { color: var(--teal-700); background: var(--teal-50); }
.tone-pink { color: #b81f5c; background: var(--pink-50); }
.tone-yellow { color: #946b00; background: var(--yellow-50); }
.tone-violet { color: #5b34b5; background: var(--violet-50); }
.tone-orange { color: #b8530f; background: var(--orange-50); }
.tone-navy { color: var(--navy); background: #e9ebf5; }

/* ---------------------------------------------------------------- Avatars */

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 50%;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.7rem;
}

.avatar-lg {
  width: 60px;
  height: 60px;
  font-size: 1.1rem;
  border-radius: 18px;
}

.avatar-solid {
  color: #fff;
  background: var(--teal);
}

/* ---------------------------------------------------------------- Pastilles */

.badge {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  padding: 0.18rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 999px;
}

.badge-neutral { color: var(--ink-2); background: #eef0f6; }
.badge-success { color: var(--success); background: var(--success-50); }
.badge-danger { color: var(--danger); background: var(--danger-50); }
.badge-english { color: var(--teal-700); background: var(--teal-50); }
.badge-quran { color: #5b34b5; background: var(--violet-50); }
.badge-signatory { color: #946b00; background: var(--yellow-50); }

.badge-id {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: var(--navy);
  background: #e9ebf5;
}

.badge-dot::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

/* ---------------------------------------------------------------- Listes */

.stack-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.stack-list > li {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.stack-list > li:last-child {
  border-bottom: 0;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-weight: 700;
}

.item-title a {
  color: inherit;
  text-decoration: none;
}

.item-title a:hover {
  color: var(--teal-700);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.85rem;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.item-meta a {
  color: var(--muted);
}

.meta-with-icon {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  align-items: center;
  font-size: 0.82rem;
}

.empty-state {
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--muted);
}

.empty-state .empty-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 0.75rem;
  color: var(--teal-700);
  background: var(--teal-50);
  border-radius: 16px;
}

.empty-state strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--ink);
}

/* ---------------------------------------------------------------- Tableaux */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 0.7rem 1.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-align: start;
  border-bottom: 1px solid var(--line);
}

.data-table .cell-action {
  text-align: end;
}

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

.data-table tbody tr {
  position: relative;
}

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

.data-table tbody tr:hover td {
  background: var(--bg-soft);
}

/* Toute la ligne est cliquable */
.row-link {
  color: inherit;
  text-decoration: none;
}

.row-link::after {
  position: absolute;
  inset: 0;
  content: "";
}

.cell-identity {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.cell-chevron {
  width: 1%;
  color: var(--line-strong);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Sur téléphone, chaque ligne devient une carte. */
@media (max-width: 767px) {
  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--line);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    padding: 0.2rem 0;
    border: 0;
  }

  .data-table td[data-label]:not(:first-child) {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: baseline;
    padding-inline-start: 52px;
    font-size: 0.85rem;
  }

  .data-table td[data-label]:not(:first-child)::before {
    grid-row: 1 / span 3;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    content: attr(data-label);
  }

  .data-table td[data-label]:not(:first-child) > * {
    grid-column: 2;
  }

  .data-table tbody tr:hover td {
    background: none;
  }

  .data-table .cell-action {
    padding-top: 0.6rem;
    padding-inline-start: 52px;
    text-align: start;
  }

  .cell-chevron {
    display: none !important;
  }
}

/* Les boutons d'une ligne cliquable restent cliquables. */
.data-table .cell-action .btn {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------- Barre d'outils, onglets, recherche */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: #ebe9f5;
  border-radius: 999px;
}

.tabs a {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.42rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
}

.tabs a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  padding: 0 0.4rem;
  font-size: 0.72rem;
  background: rgba(29, 35, 80, 0.08);
  border-radius: 999px;
}

.search-field {
  position: relative;
  flex: 1 1 240px;
  max-width: 420px;
  margin: 0;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 0.85rem;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 44px;
  padding-inline: 2.6rem 0.9rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.search-field input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--teal);
  box-shadow: var(--focus);
}

/* ---------------------------------------------------------------- Barres de progression */

.progress {
  height: 8px;
  overflow: hidden;
  background: #eef0f6;
  border-radius: 999px;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
}

.progress.is-full > span {
  background: var(--orange);
}

.load-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 0.75rem;
  align-items: center;
}

.load-row .progress {
  grid-column: 1 / -1;
}

/* ---------------------------------------------------------------- Avancement du projet */

.roadmap {
  padding: 0;
  margin: 0;
  list-style: none;
}

.roadmap li {
  position: relative;
  display: flex;
  gap: 0.9rem;
  padding-bottom: 1.1rem;
}

.roadmap li::before {
  position: absolute;
  inset-block: 34px 0;
  inset-inline-start: 15px;
  width: 2px;
  content: "";
  background: var(--line);
}

.roadmap li.is-done::before {
  background: var(--teal);
}

.roadmap li:last-child {
  padding-bottom: 0;
}

.roadmap li:last-child::before {
  display: none;
}

.roadmap-dot {
  position: relative;
  z-index: 1;
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: #eef0f6;
  border-radius: 50%;
}

.is-done .roadmap-dot {
  color: #fff;
  background: var(--teal);
}

.is-current .roadmap-dot {
  color: var(--teal-700);
  background: var(--surface);
  border: 2px solid var(--teal);
  box-shadow: var(--focus);
}

.roadmap-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-weight: 700;
}

.roadmap-text {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.roadmap-summary {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.roadmap-summary strong {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ---------------------------------------------------------------- Alertes « à faire » et messages */

.todo-item {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.todo-item:last-child {
  border-bottom: 0;
}

a.todo-item:hover {
  background: var(--bg-soft);
}

.todo-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.todo-item .icon-flip {
  margin-inline-start: auto;
  color: var(--line-strong);
}

.alert {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  border: 1px solid;
  border-radius: var(--radius);
}

.alert-success {
  color: #0d6b46;
  background: var(--success-50);
  border-color: #bfe5d2;
}

.alert-error {
  color: #9b1a3c;
  background: var(--danger-50);
  border-color: #f2c4d0;
}

.alert-info {
  color: var(--ink-2);
  background: var(--teal-50);
  border-color: #bfe6e4;
}

/* ---------------------------------------------------------------- Fiches (détails) */

.profile {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.profile h1 {
  font-size: 1.35rem;
  font-weight: 700;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.details {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}

.details dt {
  margin-bottom: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

html[lang="ar"] .details dt {
  font-size: 0.82rem;
  letter-spacing: 0;
}

.details dd {
  margin: 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------- Formulaires */

.form-card {
  max-width: 820px;
}

.form-section {
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.form-section-title {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.2rem;
  font-size: 1rem;
  font-weight: 700;
}

.form-section-title .icon {
  color: var(--teal);
}

.form-section-help {
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem 1.25rem;
  }

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

.field label,
.field legend {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-2);
}

.field.is-required > label::after {
  margin-inline-start: 0.2rem;
  color: var(--pink);
  content: "*";
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: var(--focus);
}

.field .helptext {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
}

.errorlist {
  padding: 0;
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
  list-style: none;
}

.errorlist.nonfield {
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  background: var(--danger-50);
  border: 1px solid #f2c4d0;
  border-radius: var(--radius);
}

/* Cases à cocher présentées comme des tuiles */
.field-checkbox label {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-height: 46px;
  padding: 0.6rem 0.85rem;
  margin: 0;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.field-checkbox input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--teal);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-end-start-radius: var(--radius-lg);
  border-end-end-radius: var(--radius-lg);
}

/* ---------------------------------------------------------------- Connexion et pages publiques */

.auth {
  display: grid;
  min-height: 100vh;
  background: var(--surface);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  padding: 2rem 1.25rem 0;
  text-align: center;
}

.auth-brand .logo-white,
.auth-brand .auth-pitch,
.auth-brand .auth-footer {
  display: none;
}

.auth-brand .logo-color {
  width: 170px;
}

.auth-panel {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1.25rem 3rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  margin-bottom: 0.35rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.auth-tools {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.auth-tools .lang-switch {
  background: var(--bg);
  border: 1px solid var(--line);
}

.auth-tools .lang-switch a {
  color: var(--muted);
}

.auth-tools .lang-switch a[aria-current="true"] {
  color: #fff;
  background: var(--navy);
}

.auth-help {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.84rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: var(--radius);
}

@media (min-width: 960px) {
  .auth {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }

  .auth-brand {
    position: relative;
    align-items: flex-start;
    justify-content: space-between;
    padding: 3rem 3.5rem;
    overflow: hidden;
    color: #fff;
    text-align: start;
    background: var(--navy);
    background-image: radial-gradient(circle at 100% 0%, rgba(19, 163, 160, 0.35), transparent 45%),
      radial-gradient(circle at 0% 100%, rgba(122, 79, 214, 0.25), transparent 40%);
  }

  .auth-brand .logo-color {
    display: none;
  }

  .auth-brand .logo-white,
  .auth-brand .auth-pitch,
  .auth-brand .auth-footer {
    display: block;
  }

  .auth-brand .logo-white {
    width: 190px;
  }

  .auth-pitch h2 {
    max-width: 28rem;
    margin-bottom: 1rem;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .auth-pitch ul {
    display: grid;
    gap: 0.7rem;
    padding: 0;
    margin: 0;
    list-style: none;
    color: rgba(255, 255, 255, 0.82);
  }

  .auth-pitch li {
    display: flex;
    gap: 0.65rem;
    align-items: center;
  }

  .auth-pitch li .icon {
    padding: 3px;
    color: var(--navy);
    background: var(--teal);
    border-radius: 50%;
  }

  .auth-footer {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
  }

  .auth-panel {
    align-items: center;
    padding: 3rem;
  }

  .auth-tools {
    justify-content: flex-end;
  }
}

/* Page d'accueil publique (provisoire, avant le site de l'étape 5) */
.hero {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem 1.25rem;
  color: #fff;
  text-align: center;
  background: var(--navy);
  background-image: radial-gradient(circle at 85% 10%, rgba(19, 163, 160, 0.35), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(232, 51, 122, 0.18), transparent 40%);
}

.hero-inner {
  max-width: 40rem;
}

.hero .logo-white {
  width: 220px;
  margin: 0 auto 2rem;
}

.hero h1 {
  margin-bottom: 1rem;
  font-size: 1.55rem;
  font-weight: 700;
}

.hero p {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.8);
}

.hero .lang-switch {
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }
}

/* ---------------------------------------------------------------- Compléments des pages */

/* Sélecteur de langue avec les noms complets (connexion, accueil, pages simples) */
.lang-switch--full .lang-short {
  display: none;
}

.lang-switch--full .lang-long {
  display: inline;
}

/* Bandeau bleu nuit à toutes les tailles (pages simples : refus d'accès, page introuvable…) */
.topbar.is-dark {
  color: #fff;
  background: var(--navy);
  border-bottom: 0;
}

.topbar.is-dark .topbar-logo {
  display: block;
}

.topbar.is-dark .lang-switch {
  background: rgba(255, 255, 255, 0.1);
  border: 0;
}

.topbar.is-dark .lang-switch a {
  color: rgba(255, 255, 255, 0.85);
}

.topbar.is-dark .lang-switch a[aria-current="true"] {
  color: var(--navy);
  background: #fff;
}

.topbar.is-dark .header-link {
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: none;
  border: 0;
}

.content-narrow {
  max-width: 640px;
  padding-bottom: 3rem;
}

.user-text {
  flex: 1;
  min-width: 0;
}

/* Connexion : une seule colonne, sans astérisque */
.auth-card .form-grid {
  grid-template-columns: 1fr;
}

.auth-card .field.is-required > label::after {
  content: none;
}

.auth-card form .btn {
  margin-top: 0.5rem;
}

.alert .icon {
  margin-top: 1px;
}

.section-gap {
  margin-top: 1.25rem;
}

.card-body > .btn,
.capacity > .btn {
  justify-self: start;
}

details.past {
  border-top: 1px solid var(--line);
}

details.past > summary {
  padding: 0.85rem 1.35rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.danger-text {
  margin: 0.25rem 0 0.9rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.text-teal {
  color: var(--teal-700);
}

/* Bouton clair sur fond bleu nuit (accueil public) */
.btn-light {
  color: var(--navy);
  background: #fff;
  border-color: #fff;
}

.btn-light:hover {
  background: var(--bg);
}

.muted-light {
  color: rgba(255, 255, 255, 0.6);
}
.section-gap-sm {
  margin-top: 0.5rem;
}

/* Retouches après captures */
.capacity-head a {
  color: inherit;
  text-decoration: none;
}

.capacity-head a:hover {
  color: var(--teal-700);
}

.hero .logo-white {
  display: block;
  margin: 0 auto 1.75rem;
}

.hero-lang {
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.hero .lang-switch {
  margin: 0;
}

@media (max-width: 767px) {
  .kpi {
    padding: 0.95rem 1rem 1rem;
  }

  .kpi-icon {
    top: 0.8rem;
    inset-inline-end: 0.8rem;
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .kpi-icon .icon {
    width: 1.05rem;
    height: 1.05rem;
  }

  .kpi-label {
    padding-inline-end: 36px;
    font-size: 0.78rem;
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .kpi-meta {
    font-size: 0.74rem;
  }
}
/* ---------------------------------------------------------------- Lot 2 : contrats, planning, paramètres */

.planning-subject {
  border-top: 1px solid var(--line);
}

.planning-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.85rem 1.35rem 0.4rem;
}

.planning-subject .stack-list > li {
  padding-block: 0.7rem;
}

.planning-empty {
  padding: 0.25rem 1.35rem 1rem;
  margin: 0;
  font-size: 0.84rem;
}

.slot-day {
  flex: none;
  min-width: 5.5rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  color: var(--navy);
  background: #e9ebf5;
  border-radius: 999px;
}

.amounts {
  display: grid;
  gap: 1rem;
  padding: 1.1rem 1.35rem 1.25rem;
  border-top: 1px solid var(--line);
}

.amount-box {
  display: grid;
  gap: 0.2rem;
}

.amount-value {
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .amounts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.plain-list {
  display: grid;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.settings-tabs {
  flex-wrap: wrap;
  border-radius: 18px;
}

/* Choix des enfants : cases à cocher présentées comme des tuiles */
.field-choices > div > div {
  margin-bottom: 0.4rem;
}

.field-choices > div > div > label {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-height: 46px;
  padding: 0.6rem 0.85rem;
  margin: 0;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
}

.field-choices input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--teal);
}

.bottom-nav {
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav a {
  font-size: 0.66rem;
}