/* =====================================================================
   ImmigraSoftAI — Design System partagé
   Luxe minimaliste · Navy / Or / Crème
   Utilisé par : index.html, client/dashboard.html, consultant/dashboard.html
   ===================================================================== */

:root {
  /* --- Couleurs --- */
  --navy:        #0D1B2A;   /* Navy principal */
  --navy-light:  #152537;   /* Navy clair (hover, surfaces sombres) */
  --navy-deep:   #07111c;   /* Navy profond (footer, topbar) */
  --gold:        #C49A2A;   /* Or — accent principal */
  --gold-soft:   #e0c178;   /* Or clair */
  --gold-wash:   rgba(196, 154, 42, 0.08);
  --cream:       #F6F1E9;   /* Crème — fond de base */
  --white:       #ffffff;   /* Blanc pur — cartes / sections */
  --ink:         #25303d;   /* Texte principal */
  --muted:       #6b7785;   /* Texte secondaire / gris */
  --line:        #e7e0d4;   /* Bordures légères */
  --line-soft:   #f0eadf;

  /* --- États --- */
  --ok:          #3f7d62;
  --ok-wash:     rgba(63, 125, 98, 0.12);
  --warn:        #b07a2c;
  --warn-wash:   rgba(176, 122, 44, 0.14);
  --danger:      #b3503f;
  --danger-wash: rgba(179, 80, 63, 0.12);
  --info-wash:   rgba(13, 27, 42, 0.08);

  /* --- Espacement (échelle luxe — beaucoup de whitespace) --- */
  --sp-xs:  8px;
  --sp-sm:  16px;
  --sp-md:  24px;   /* element spacing */
  --sp-lg:  32px;   /* card spacing */
  --sp-xl:  48px;   /* bloc spacing */
  --sp-2xl: 60px;   /* section spacing */

  /* --- Padding intérieur --- */
  --pad-card:    40px;
  --pad-section: 60px;

  /* --- Rayons --- */
  --radius-sm: 8px;    /* boutons / inputs */
  --radius:    12px;   /* cartes */
  --radius-lg: 16px;   /* modales */

  /* --- Ombres --- */
  --shadow-subtle: 0 1px 3px rgba(13, 27, 42, 0.05);
  --shadow-card:   0 2px 8px rgba(13, 27, 42, 0.08);
  --shadow-hover:  0 4px 16px rgba(13, 27, 42, 0.10);
  --shadow-modal:  0 10px 40px rgba(13, 27, 42, 0.15);

  /* --- Layout --- */
  --content-max: 1200px;
  --sidebar-w:   280px;

  /* --- Transitions --- */
  --t-fast: 0.15s ease;
  --t-base: 0.22s ease;
}

/* ---------------------------------------------------------------------
   Reset
   --------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Jost', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;          /* aéré */
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--navy);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;   /* luxe */
}

.serif-accent {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------------------------------------------------------------------
   Marque / Logo
   --------------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand .mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: var(--navy-deep);
  display: grid; place-items: center;
  font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.15rem;
  flex-shrink: 0;
}
.brand .name {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem; font-weight: 600; letter-spacing: 0.01em;
  line-height: 1.1;
}
.brand .name b { color: var(--gold); font-weight: 700; }
.brand .tag {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.98rem; font-style: italic; color: var(--muted);
  line-height: 1.1; margin-top: 2px;
}

/* ---------------------------------------------------------------------
   Boutons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  font-family: 'Jost', sans-serif; font-weight: 500; font-size: 0.95rem;
  letter-spacing: 0.02em;
  min-height: 44px;                  /* cliquable mobile */
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.full { width: 100%; }

.btn.gold      { background: var(--gold); color: var(--navy-deep); }
.btn.gold:hover:not(:disabled)  { background: var(--gold-soft); box-shadow: var(--shadow-hover); }

.btn.navy      { background: var(--navy); color: var(--white); }
.btn.navy:hover:not(:disabled)  { background: var(--navy-light); box-shadow: var(--shadow-hover); }

.btn.ghost     { background: transparent; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-wash); }

.btn.link      { background: none; border: none; color: var(--navy); min-height: auto; padding: 0; }
.btn.link:hover { color: var(--gold); }

/* ---------------------------------------------------------------------
   Champs / Formulaires
   --------------------------------------------------------------------- */
.field { margin-bottom: var(--sp-md); }
.field:last-child { margin-bottom: 0; }

.field > label {
  display: block;
  font-size: 0.85rem; font-weight: 500; color: var(--ink);
  margin-bottom: var(--sp-xs);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: 'Jost', sans-serif; font-size: 0.95rem; color: var(--ink);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-wash);
}
input::placeholder, textarea::placeholder { color: #aab2bb; }

.field .helper { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.field .error  { font-size: 0.8rem; color: var(--danger); margin-top: 6px; display: none; }
.field.invalid input,
.field.invalid select { border-color: var(--danger); }
.field.invalid .error { display: block; }

/* Choix de type (radio cartes) */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-sm); }
.radio-card {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--sp-md); cursor: pointer; text-align: center;
  transition: all var(--t-fast);
  background: var(--white);
}
.radio-card:hover { border-color: var(--gold-soft); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .rc-title { font-weight: 600; color: var(--navy); font-size: 0.98rem; }
.radio-card .rc-desc  { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.radio-card:has(input:checked) {
  border-color: var(--gold); border-width: 2px;
  background: var(--gold-wash);
}

/* ---------------------------------------------------------------------
   Cartes
   --------------------------------------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--pad-card);
  margin-bottom: var(--sp-lg);
}
.card.accent { border-top: 3px solid var(--gold); }
.card h3 { font-size: 1.3rem; margin-bottom: var(--sp-md); }

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge {
  display: inline-block;
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0.02em;
  padding: 0.28rem 0.75rem; border-radius: 999px;
}
.badge.ok      { background: var(--ok-wash);     color: var(--ok); }
.badge.warn    { background: var(--warn-wash);   color: var(--warn); }
.badge.danger  { background: var(--danger-wash); color: var(--danger); }
.badge.info    { background: var(--info-wash);   color: var(--navy); }

/* ---------------------------------------------------------------------
   Alertes / messages
   --------------------------------------------------------------------- */
.alert {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: var(--sp-md);
  display: none;
}
.alert.show { display: block; }
.alert.error   { background: var(--danger-wash); color: var(--danger); border-left: 3px solid var(--danger); }
.alert.success { background: var(--ok-wash);     color: var(--ok);     border-left: 3px solid var(--ok); }
.alert.info    { background: var(--gold-wash);   color: var(--warn);   border-left: 3px solid var(--gold); }

/* Note éditoriale */
.note {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.08rem; font-style: italic; color: var(--muted);
  margin-top: var(--sp-md);
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--gold);
  background: var(--gold-wash);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------------------------------------------------------------------
   Utilitaires
   --------------------------------------------------------------------- */
.muted     { color: var(--muted); }
.text-gold { color: var(--gold); }
.center    { text-align: center; }
.hidden    { display: none !important; }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.stack > * + * { margin-top: var(--sp-md); }

.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner.dark { border-color: var(--line); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Animation d'apparition */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* =====================================================================
   APP SHELL — partagé par les dashboards client & consultant
   ===================================================================== */

/* Bandeau supérieur */
.topbar {
  background: var(--navy-deep);
  color: var(--gold-soft);
  font-size: 0.82rem; letter-spacing: 0.04em;
  padding: 0.55rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.5rem;
}

/* En-tête principal */
header.masthead {
  background: var(--navy);
  color: var(--white);
  padding: 0.9rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
header.masthead .brand .name { color: var(--white); }
header.masthead .brand .tag  { color: var(--gold-soft); }
.masthead-actions { display: flex; align-items: center; gap: 1rem; }

.user-chip {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--white); font-size: 0.9rem;
}
.user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: var(--navy-deep); display: grid; place-items: center;
  font-weight: 600; font-size: 0.9rem; flex-shrink: 0;
}
.user-chip .who { line-height: 1.2; }
.user-chip .who small { display: block; color: var(--gold-soft); font-size: 0.74rem; }

.icon-btn {
  background: none; border: 1px solid rgba(224,193,120,0.35);
  color: var(--gold-soft); border-radius: 999px;
  padding: 0.45rem 0.9rem; font-size: 0.85rem; cursor: pointer;
  transition: all var(--t-fast); min-height: 38px;
}
.icon-btn:hover { background: var(--gold); color: var(--navy-deep); border-color: var(--gold); }
.menu-toggle { display: none; background: none; border: none; color: var(--white); cursor: pointer; padding: 0.3rem; }

/* Coquille : sidebar + main */
.shell { display: flex; min-height: calc(100vh - 120px); }

nav.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: var(--sp-lg) var(--sp-sm);
}
.nav-group-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin: var(--sp-md) 0.75rem var(--sp-xs);
}
.nav-group-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; border-radius: var(--radius-sm);
  color: var(--ink); cursor: pointer; font-size: 0.95rem;
  transition: all var(--t-fast); border: 1px solid transparent;
  margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--cream); }
.nav-item.active { background: var(--navy); color: var(--white); }
.nav-item .ico { width: 20px; height: 20px; flex-shrink: 0; color: var(--navy); }
.nav-item.active .ico { color: var(--gold); }
.nav-item .pill {
  margin-left: auto; background: var(--gold); color: var(--navy-deep);
  font-size: 0.7rem; font-weight: 600; border-radius: 999px;
  padding: 1px 8px; min-width: 20px; text-align: center;
}
.nav-item .pill.hidden { display: none; }

main.content { flex: 1; padding: var(--pad-section) var(--sp-xl); max-width: var(--content-max); }

/* Panneaux (onglets) */
.panel { display: none; animation: fade-up 0.3s ease; }
.panel.active { display: block; }

.page-eyebrow { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.page-title { font-size: 2rem; margin: 0.3rem 0 0.4rem; }
.page-sub {
  color: var(--muted); font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem; font-style: italic; margin-bottom: var(--sp-xl);
}

.row-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-md); margin-bottom: var(--sp-lg); flex-wrap: wrap; }
.search-wrap { max-width: 340px; flex: 1; }

/* Cartes statistiques */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-md); margin-bottom: var(--sp-xl); }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  border-top: 3px solid var(--gold);
  padding: var(--sp-lg); box-shadow: var(--shadow-card);
}
.stat-card .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-card .value { font-family: 'Playfair Display', serif; font-size: 2.2rem; color: var(--navy); font-weight: 700; margin-top: 0.3rem; }
.stat-card .delta { font-size: 0.82rem; color: var(--ok); margin-top: 0.2rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 0.7rem 0.85rem; border-bottom: 2px solid var(--line); }
td { padding: 0.95rem 0.85rem; border-bottom: 1px solid var(--line-soft); font-size: 0.95rem; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--cream); }
.table-link { color: var(--navy); font-weight: 500; cursor: pointer; }
.table-link:hover { color: var(--gold); }

/* Barre de progression */
.prog-label { font-size: 0.82rem; color: var(--muted); margin: 0.6rem 0 0.35rem; }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--gold)); border-radius: 999px; transition: width 0.5s ease; }

/* Timeline de progression */
.timeline { position: relative; padding-left: 36px; }
.timeline::before { content: ''; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: var(--sp-lg); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .dot {
  position: absolute; left: -36px; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.85rem;
  background: var(--white); border: 2px solid var(--line); color: var(--muted);
}
.tl-item.done .dot    { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-item.current .dot { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.tl-item .tl-title { font-weight: 600; color: var(--navy); }
.tl-item .tl-meta  { font-size: 0.85rem; color: var(--muted); }

/* Steps (questionnaire multi-étapes) */
.stepper { display: flex; gap: var(--sp-xs); margin-bottom: var(--sp-xl); }
.step-pip { flex: 1; text-align: center; font-size: 0.8rem; color: var(--muted); }
.step-pip .num {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 6px;
  display: grid; place-items: center; font-weight: 600;
  background: var(--white); border: 2px solid var(--line); color: var(--muted);
  transition: all var(--t-fast);
}
.step-pip.active .num { background: var(--navy); border-color: var(--navy); color: #fff; }
.step-pip.done .num   { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-pip.active { color: var(--navy); font-weight: 500; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }
.form-grid .full { grid-column: 1 / -1; }
.step-pane { display: none; }
.step-pane.active { display: block; animation: fade-up 0.3s ease; }
.step-nav { display: flex; justify-content: space-between; gap: var(--sp-sm); margin-top: var(--sp-xl); }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--gold); border-radius: var(--radius);
  background: var(--gold-wash); padding: var(--sp-2xl) var(--sp-lg); text-align: center;
  cursor: pointer; transition: background var(--t-fast);
}
.dropzone:hover, .dropzone.drag { background: rgba(196,154,42,0.14); }
.dropzone .big { font-family: 'Playfair Display', serif; color: var(--navy); font-size: 1.25rem; }
.dropzone .small { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }
.file-list { margin-top: var(--sp-lg); display: flex; flex-direction: column; gap: 0.6rem; }
.file-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 1rem; background: var(--cream); border-radius: var(--radius-sm);
  font-size: 0.92rem; gap: 1rem;
}
.file-item .fmeta { color: var(--muted); font-size: 0.8rem; }

/* Listes diverses */
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md);
  padding: var(--sp-md) 0.25rem; border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: none; }

/* État vide */
.empty {
  text-align: center; padding: var(--sp-2xl) var(--sp-md); color: var(--muted);
}
.empty .big { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1.3rem; color: var(--navy); margin-bottom: 0.4rem; }

/* Modale */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13,27,42,0.55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 5vh 20px; z-index: 100; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal); width: 100%; max-width: 720px;
  animation: fade-up 0.25s ease;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--sp-lg) var(--pad-card) var(--sp-md);
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 1.4rem; }
.modal-close { background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-close:hover { color: var(--navy); }
.modal-body { padding: var(--pad-card); }

/* Onglets internes (modale) */
.subtabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--line); margin-bottom: var(--sp-lg); flex-wrap: wrap; }
.subtab { padding: 0.6rem 1rem; cursor: pointer; font-size: 0.9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtab.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 500; }
.subpane { display: none; } .subpane.active { display: block; }

/* Paire clé/valeur */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 0.6rem 1rem; }
.kv dt { color: var(--muted); font-size: 0.88rem; }
.kv dd { color: var(--ink); font-weight: 500; }

/* Fil de discussion / notes */
.note-item { padding: var(--sp-md); background: var(--cream); border-radius: var(--radius-sm); margin-bottom: var(--sp-sm); }
.note-item .nmeta { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.3rem; }

/* Footer */
footer.app {
  background: var(--navy-deep); color: var(--gold-soft);
  text-align: center; padding: 1.5rem; font-size: 0.85rem; letter-spacing: 0.03em;
}
footer.app a { color: var(--gold); }

/* Voile de chargement plein écran */
.page-loader {
  position: fixed; inset: 0; background: var(--cream);
  display: grid; place-items: center; z-index: 200;
}
.page-loader.hidden { display: none; }
