/* VAULT Retraite — feuille de style de l'application (même système visuel que le dossier HTML du moteur) */
:root {
  --bg: #FFFFFF; --bg-soft: #FAFAFA; --border: #E5E5E5; --border-strong: #D4D4D8;
  --text: #18181B; --text-muted: #71717A; --text-subtle: #A1A1AA; --black: #000000;
  --rouge: #DC2626; --rouge-bg: #FEE2E2; --orange: #EA580C; --orange-bg: #FFEDD5;
  --jaune: #CA8A04; --jaune-bg: #FEF9C3; --vert: #16A34A; --vert-bg: #DCFCE7;
  --bleu: #2563EB; --bleu-bg: #DBEAFE; --gris: #52525B; --gris-bg: #F4F4F5; --highlight-bg: #FEF3C7;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, 'Inter', 'Geist', 'Helvetica Neue', system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--bleu); }

/* Bandeau */
.admin-banner { background: #FEF3C7; border-bottom: 1px solid #FCD34D; padding: 10px 24px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-banner form { margin: 0; }

/* Gabarit */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 41px); }
.sidebar { background: white; border-right: 1px solid var(--border); padding: 18px 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 0 18px 18px; font-size: 15px; font-weight: 600; color: var(--text); }
.sidebar .logo .marque { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 16px; letter-spacing: 0.5px; }
.sidebar .logo .marque img { width: 26px; height: 26px; }
.sidebar nav { flex: 1; padding: 0 10px; }
.sidebar nav a { display: flex; align-items: center; padding: 8px 12px; color: var(--text-muted); text-decoration: none; border-radius: 6px; font-size: 13px; margin-bottom: 1px; gap: 10px; }
.sidebar nav a:hover { background: var(--bg-soft); }
.sidebar nav a.active { color: var(--text); font-weight: 600; background: var(--bg-soft); }
.sidebar nav a .icon { font-size: 14px; }
.sidebar .pied { padding: 12px 18px 0; font-size: 11px; color: var(--text-subtle); border-top: 1px solid var(--border); margin-top: 12px; }
.topbar { height: 56px; border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; background: white; }
.topbar .titre-page { font-size: 13px; color: var(--text-muted); }
.topbar .droite { display: flex; align-items: center; gap: 12px; }
.topbar .toggle-btn { background: none; border: 1px solid var(--border); padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--text-muted); }
.avatar-user { width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 28px 32px 40px; max-width: 1200px; width: 100%; }

/* En-têtes */
.dossier-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.dossier-header h1 { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.dossier-header .subtitle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.dossier-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Composants */
.btn { padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; background: white; color: var(--text); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { background: var(--bg-soft); }
.btn-primary { background: var(--text); color: white; border-color: var(--text); }
.btn-primary:hover { background: var(--black); }
.btn-danger { color: var(--rouge); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.badge-rouge { background: var(--rouge-bg); color: var(--rouge); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-jaune { background: var(--jaune-bg); color: var(--jaune); }
.badge-vert { background: var(--vert-bg); color: var(--vert); }
.badge-bleu { background: var(--bleu-bg); color: var(--bleu); }
.badge-gris { background: var(--gris-bg); color: var(--gris); }
.card { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-subnote { font-size: 12.5px; color: var(--text-muted); margin-top: -8px; margin-bottom: 14px; }
.empty { color: var(--text-muted); font-size: 13px; padding: 16px 0; }

/* Tuiles de synthèse */
.synthese-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.synthese-tile { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.synthese-tile:hover { border-color: var(--border-strong); }
.synthese-tile .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.synthese-tile .value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.synthese-tile .legend { font-size: 12px; color: var(--text-subtle); margin-top: 6px; }
.synthese-tile.alerte { border-color: #FCD34D; background: #FFFBEB; }

/* Tableaux */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table thead th { text-align: left; padding: 10px 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--bg-soft); color: var(--text); vertical-align: top; }
table tbody tr:hover td { background: var(--bg-soft); }
td.num, th.num { text-align: right; }
.sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--text-muted); }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.form-grid .large { grid-column: 1 / -1; }
.champ label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.champ input[type=text], .champ input[type=email], .champ input[type=password], .champ input[type=date], .champ input[type=tel],
.champ select, .champ textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13.5px; font-family: inherit; color: var(--text); background: white;
}
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: 2px solid var(--bleu-bg); border-color: var(--bleu); }
.champ textarea { min-height: 80px; resize: vertical; }
.champ .aide { font-size: 11.5px; color: var(--text-subtle); margin-top: 4px; }
.champ .erreur-champ { font-size: 12px; color: var(--rouge); margin-top: 4px; }
.champ input[type=file] { font-size: 12.5px; }
.champ.invalide input, .champ.invalide select { border-color: var(--rouge); }
.coche { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.actions-form { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.filtres { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filtres input[type=search], .filtres select { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; font-family: inherit; }
.filtres input[type=search] { min-width: 260px; }

/* Messages */
.flash { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; border: 1px solid transparent; word-break: break-word; }
.flash-succes { background: var(--vert-bg); color: #166534; border-color: #BBF7D0; }
.flash-erreur { background: var(--rouge-bg); color: #991B1B; border-color: #FECACA; }
.flash-info { background: var(--bleu-bg); color: #1E40AF; border-color: #BFDBFE; }

/* Onglets d'administration */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; font-size: 13px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }

/* Étapes (page d'attente) */
.etapes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.etape { padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); font-size: 13px; }
.etape .num { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--gris-bg); color: var(--gris); font-size: 11px; font-weight: 700; align-items: center; justify-content: center; margin-right: 8px; }
.etape.faite { background: var(--vert-bg); border-color: #BBF7D0; }
.etape.faite .num { background: var(--vert); color: white; }
.etape.encours { background: var(--highlight-bg); border-color: #FCD34D; }
.etape.encours .num { background: var(--jaune); color: white; }

/* Page de connexion */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-soft); padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: white; border: 1px solid var(--border); border-radius: 10px; padding: 32px 30px; }
.login-card .marque { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 4px; }
.login-card .marque img { width: 32px; height: 32px; }
.login-card .sous { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.login-card .champ { margin-bottom: 14px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }
.login-pied { text-align: center; font-size: 11.5px; color: var(--text-subtle); margin-top: 18px; }

/* Page d'erreur */
.erreur-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.erreur-wrap .code { font-size: 48px; font-weight: 700; color: var(--text-subtle); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.ouverte { display: flex; position: fixed; inset: 41px 0 0 0; z-index: 50; width: 260px; box-shadow: 4px 0 20px rgba(0,0,0,.08); }
  .content { padding: 18px 16px 30px; }
}
@media (min-width: 861px) { .topbar .toggle-btn { display: none; } }
