/* ============================================================
   Diagnostic retraite frontalier France–Suisse — cabinet russo
   Feuille de style principale. Variables alignees sur cabinetrusso.ch.
   ============================================================ */

:root {
  --ink:        #001629;
  --ink-700:    #0a2236;
  --ink-soft:   #2a3d52;
  --metal:      #929395;
  --metal-soft: #c8c9ca;
  --terra:      #ae7f65;
  --terra-deep: #936548;
  --terra-soft: #d4baad;
  --terra-fade: #f0e6df;
  --paper:      #ffffff;
  --paper-warm: #faf8f5;
  --paper-deep: #f2ede7;
  --shell:      #e8e4df;
  --rule:       rgba(0,22,41,0.12);
  --rule-light: rgba(255,255,255,0.14);

  --good:  #2f6f4e;
  --warn:  #9a6700;
  --bad:   #9b2c2c;

  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans:    'Outfit', system-ui, -apple-system, sans-serif;
  --font-body:    'Lora', Georgia, serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 940px;
  --gutter: clamp(18px, 4.5vw, 56px);
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html { background: var(--shell); }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-soft);
  background: var(--paper-warm);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

a { color: var(--terra-deep); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--terra-deep);
  outline-offset: 2px;
  border-radius: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 6px; font-family: var(--font-sans); font-size: 14px;
  z-index: 200; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ── EN-TETE ── */
.app-header {
  background: var(--ink);
  color: var(--paper-warm);
  padding: 18px var(--gutter);
}
.app-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.app-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.app-brand img { height: 34px; width: auto; }
.app-brand-text { display: flex; flex-direction: column; }
.app-brand-name { font-family: var(--font-display); font-size: 18px; color: #fff; line-height: 1.1; }
.app-brand-sub { font-family: var(--font-sans); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--terra-soft); }
.app-header-back { font-family: var(--font-sans); font-size: 13px; color: var(--metal-soft); text-decoration: none; }
.app-header-back:hover { color: #fff; }

/* ── PROGRESSION ── */
.progress-wrap { background: var(--paper); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 40; }
.progress-inner { max-width: var(--maxw); margin: 0 auto; padding: 14px var(--gutter); }
.progress-meta { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-sans); font-size: 12px; color: var(--metal); margin-bottom: 8px; }
.progress-meta strong { color: var(--ink); font-weight: 600; }
.progress-nav { display: flex; align-items: center; gap: 10px; }
.progress-track { flex: 1 1 auto; height: 6px; background: var(--paper-deep); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--terra), var(--terra-deep)); border-radius: 6px; transition: width 0.4s var(--ease); }
.progress-arrow {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); font-size: 19px; line-height: 1; cursor: pointer;
  transition: all 0.2s ease;
}
.progress-arrow:hover:not(:disabled) { border-color: var(--terra); color: var(--terra-deep); }
.progress-arrow:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── LAYOUT PRINCIPAL ── */
main.app-main { padding: clamp(28px,5vw,56px) 0 clamp(60px,8vw,90px); }
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px,4vw,42px);
}

.eyebrow {
  font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--terra-deep); margin: 0 0 10px;
}
.step-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px,3.4vw,32px); color: var(--ink); margin: 0 0 10px; line-height: 1.18; }
.step-intro { font-family: var(--font-body); font-size: 15.5px; color: var(--ink-soft); margin: 0 0 26px; max-width: 62ch; }

.step { display: none; }
.step.is-active { display: block; animation: stepIn 0.35s var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── CHAMPS ── */
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-family: var(--font-sans); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; color: var(--ink); margin-bottom: 12px; padding: 0; }

.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 20px; margin-bottom: 22px; }
.field-grid.cols-1 { grid-template-columns: 1fr; }
.field-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) {
  .field-grid, .field-grid.cols-3 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
@media (max-width: 640px) { .field.span-2 { grid-column: span 1; } }

.field label, .field .field-label {
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 500; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.field .optional-tag { font-weight: 400; color: var(--metal); font-size: 11px; text-transform: none; letter-spacing: 0; }
.field .hint { font-family: var(--font-sans); font-size: 11.5px; color: var(--metal); margin-top: -2px; }

input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="tel"],
select, textarea {
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 8px; padding: 11px 13px;
  background: var(--paper-warm); transition: border-color 0.2s ease, background 0.2s ease;
  width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: var(--metal); }
input:focus, select:focus, textarea:focus { border-color: var(--terra-deep); background: var(--paper); outline: none; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); background: #fdf2f2; }

select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%232a3d52' stroke-width='1.6' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }

.field-error { font-family: var(--font-sans); font-size: 12px; color: var(--bad); min-height: 14px; }
.field-note { font-family: var(--font-sans); font-size: 11.5px; color: var(--metal); }

.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  font-family: var(--font-sans); font-size: 13px; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 999px; padding: 9px 16px;
  cursor: pointer; transition: all 0.2s ease; user-select: none; background: var(--paper-warm);
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
}
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice:has(input:checked) { background: var(--terra-fade); border-color: var(--terra); color: var(--ink); font-weight: 500; }
.choice:has(input:focus-visible) { outline: 2px solid var(--terra-deep); outline-offset: 2px; }

.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── PENSIONS COMPLEMENTAIRES REPETABLES ── */
.repeatable-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; }
.repeatable-item { border: 1px solid var(--rule); border-radius: 10px; padding: 18px; background: var(--paper-warm); position: relative; }
.repeatable-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.repeatable-item-title { font-family: var(--font-sans); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--terra-deep); }
.btn-remove { background: none; border: 0; color: var(--metal); font-family: var(--font-sans); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 4px; }
.btn-remove:hover { color: var(--bad); }

/* ── BOUTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; letter-spacing: 0.03em;
  padding: 13px 26px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: all 0.25s var(--ease); min-height: 44px;
}
.btn-gold { background: var(--terra); color: #fff; border-color: var(--terra); }
.btn-gold:hover { background: var(--terra-deep); border-color: var(--terra-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-line { background: transparent; color: var(--terra-deep); border-color: var(--terra); }
.btn-line:hover { background: var(--terra-fade); }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: rgba(155,44,44,0.35); }
.btn-danger-ghost:hover { background: #fdf2f2; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 9px 18px; font-size: 12.5px; min-height: 36px; }

/* ── NAVIGATION D'ETAPE ── */
.step-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--rule); flex-wrap: wrap;
}
.step-actions-right { display: flex; gap: 12px; margin-left: auto; }

/* ── LIVE REGION / ALERTES ── */
.live-status { font-family: var(--font-sans); font-size: 13px; color: var(--bad); margin-bottom: 12px; }
.live-status:empty { display: none; }

.notice { border-left: 3px solid var(--terra); background: var(--terra-fade); padding: 14px 18px; border-radius: 6px; font-family: var(--font-sans); font-size: 13px; color: var(--ink); margin-bottom: 20px; }
.notice.notice-info { border-color: var(--metal); background: var(--paper-deep); }
.notice.notice-warn { border-color: var(--warn); background: #fff6e6; }

/* ── INTRO ── */
.intro-list { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.intro-list li { font-family: var(--font-sans); font-size: 13.5px; color: var(--ink-soft); padding-left: 22px; position: relative; }
.intro-list li::before { content: '\2013'; position: absolute; left: 0; color: var(--terra); }
.intro-privacy { display: flex; gap: 12px; align-items: flex-start; background: var(--paper-deep); border-radius: 10px; padding: 16px 18px; margin-bottom: 24px; }
.intro-privacy svg { flex: none; margin-top: 2px; color: var(--terra-deep); }
.intro-privacy p { margin: 0; font-family: var(--font-sans); font-size: 13px; color: var(--ink-soft); }

/* ── RECAPITULATIF ── */
.recap-section { margin-bottom: 22px; }
.recap-section h3 { font-family: var(--font-sans); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--terra-deep); border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.recap-section h3 button { font-size: 11px; text-transform: none; letter-spacing: 0; }
.recap-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
@media (max-width: 640px) { .recap-grid { grid-template-columns: 1fr; } }
.recap-row { display: flex; justify-content: space-between; gap: 12px; font-family: var(--font-sans); font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.recap-row dt { color: var(--metal); }
.recap-row dd { margin: 0; color: var(--ink); font-weight: 500; text-align: right; }

/* ── RESULTAT ── */
.result-head { display: flex; flex-wrap: wrap; gap: 20px 32px; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.result-head-meta { display: flex; flex-wrap: wrap; gap: 20px; font-family: var(--font-sans); font-size: 12.5px; color: var(--metal); }
.result-head-meta strong { color: var(--ink); display: block; font-size: 13px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
@media (max-width: 760px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card { border: 1px solid var(--rule); border-left: 3px solid var(--terra); border-radius: 8px; padding: 16px 18px; background: var(--paper-warm); }
.stat-card .n { font-family: var(--font-display); font-size: 26px; color: var(--terra-deep); line-height: 1.1; }
.stat-card .l { font-family: var(--font-sans); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); margin-top: 6px; display: block; }

.result-section { margin: 34px 0; }
.result-section h2 { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--ink); margin: 0 0 4px; }
.result-section .section-sub { font-family: var(--font-sans); font-size: 12.5px; color: var(--metal); margin: 0 0 16px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; }
table.consolidated { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 13px; min-width: 640px; }
table.consolidated thead th { background: var(--ink); color: #fff; text-align: left; padding: 12px 14px; font-weight: 400; letter-spacing: 0.03em; font-size: 11px; text-transform: uppercase; }
table.consolidated tbody td { padding: 12px 14px; border-bottom: 1px solid var(--rule); color: var(--ink-soft); }
table.consolidated tbody tr:nth-child(even) { background: var(--paper-warm); }
table.consolidated tbody tr:last-child td { border-bottom: none; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 500; }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.status-included { background: rgba(47,111,78,0.12); color: var(--good); }
.status-included::before { background: var(--good); }
.status-indicative { background: rgba(154,103,0,0.12); color: var(--warn); }
.status-indicative::before { background: var(--warn); }
.status-unavailable { background: rgba(155,44,44,0.1); color: var(--bad); }
.status-unavailable::before { background: var(--bad); }

.completeness-block { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; padding: 20px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-warm); }
.completeness-score { font-family: var(--font-display); font-size: 44px; color: var(--ink); line-height: 1; }
.completeness-score span { font-size: 18px; color: var(--metal); }
.completeness-level { font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; font-weight: 600; }
.level-eleve { background: rgba(47,111,78,0.14); color: var(--good); }
.level-partiel { background: rgba(154,103,0,0.14); color: var(--warn); }
.level-insuffisant { background: rgba(155,44,44,0.12); color: var(--bad); }
.completeness-text { font-family: var(--font-sans); font-size: 12.5px; color: var(--ink-soft); flex: 1 1 260px; }

.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert-item { display: flex; gap: 12px; border: 1px solid var(--rule); border-left-width: 4px; border-radius: 8px; padding: 13px 16px; background: var(--paper); font-family: var(--font-sans); font-size: 13px; }
.alert-item .badge { flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 9px; border-radius: 999px; font-weight: 600; height: fit-content; }
.priority-critical { border-left-color: var(--bad); } .priority-critical .badge { background: rgba(155,44,44,0.12); color: var(--bad); }
.priority-high { border-left-color: var(--terra-deep); } .priority-high .badge { background: rgba(147,101,72,0.14); color: var(--terra-deep); }
.priority-medium { border-left-color: var(--warn); } .priority-medium .badge { background: rgba(154,103,0,0.12); color: var(--warn); }
.priority-low { border-left-color: var(--metal); } .priority-low .badge { background: var(--paper-deep); color: var(--metal); }
.priority-info { border-left-color: var(--metal-soft); } .priority-info .badge { background: var(--paper-deep); color: var(--ink-soft); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist-item { display: flex; gap: 12px; border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; background: var(--paper); align-items: flex-start; }
.checklist-item input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--terra-deep); flex: none; }
.checklist-item .title { font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; color: var(--ink); }
.checklist-item .desc { font-family: var(--font-sans); font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.checklist-item.is-checked { opacity: 0.55; }
.checklist-item.is-checked .title { text-decoration: line-through; }
.checklist-item .meta { display: flex; gap: 8px; margin-top: 6px; }
.tag { font-family: var(--font-sans); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--metal); background: var(--paper-deep); padding: 2px 8px; border-radius: 999px; }

.lpp-table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 12.5px; }
.lpp-table th, .lpp-table td { padding: 11px 13px; border-bottom: 1px solid var(--rule); text-align: left; }
.lpp-table thead th { background: var(--paper-deep); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; color: var(--ink); }
.lpp-table td.highlighted, .lpp-table th.highlighted { background: var(--terra-fade); }
.lpp-table tbody th { font-weight: 500; color: var(--ink-soft); white-space: nowrap; }

.warning-box { border: 1px solid rgba(154,103,0,0.35); background: #fff8ec; border-radius: 10px; padding: 16px 18px; font-family: var(--font-sans); font-size: 12.5px; color: var(--ink); margin: 26px 0; }
.warning-box strong { color: var(--warn); }

.eyebrow-light { color: var(--terra-soft); }

.carnet-offer { background: var(--paper-warm); border: 1px solid var(--rule); border-left: 3px solid var(--terra); border-radius: var(--radius); padding: clamp(22px,4vw,34px); margin: 30px 0; }
.carnet-offer h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(20px,2.6vw,25px); color: var(--ink); line-height: 1.22; margin: 6px 0 10px; }
.carnet-offer p { font-family: var(--font-sans); font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); max-width: 62ch; margin: 0 0 18px; }
.carnet-offer-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.carnet-offer-note { font-family: var(--font-sans); font-size: 11.5px; letter-spacing: 0.04em; color: var(--metal); }

.audit-cta { background: var(--ink); color: var(--paper-warm); border-radius: var(--radius); padding: clamp(24px,4vw,38px); margin: 30px 0; }
.audit-cta h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(21px,3vw,27px); color: #fff; line-height: 1.22; margin: 6px 0 12px; }
.audit-cta p { font-family: var(--font-sans); font-size: 13.5px; line-height: 1.65; color: var(--metal-soft); max-width: 62ch; margin: 0 0 22px; }
.audit-cta .btn-gold { background: var(--terra); border-color: var(--terra); }
.audit-cta .btn-gold:hover { background: var(--terra-soft); border-color: var(--terra-soft); color: var(--ink); }

.result-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--rule); }

/* ── MODALE RESET ── */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,22,41,0.55); }
.modal-panel { position: relative; background: var(--paper); border-radius: var(--radius); padding: 28px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal-panel h2 { font-family: var(--font-display); font-size: 21px; color: var(--ink); margin: 0 0 10px; }
.modal-panel p { font-family: var(--font-sans); font-size: 13.5px; color: var(--ink-soft); margin: 0 0 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ── PIED DE PAGE ── */
.app-footer { background: var(--ink); color: var(--metal-soft); padding: 26px var(--gutter); text-align: center; }
.app-footer p { max-width: var(--maxw); margin: 0 auto; font-family: var(--font-sans); font-size: 11.5px; line-height: 1.7; }
.app-footer a { color: var(--terra-soft); }

/* ── UTILITAIRES ── */
.only-print { display: none; }
[hidden] { display: none !important; }
