:root {
  --ink: #1d2a21;
  --forest: #263b2c;
  --forest-2: #36533d;
  --paper: #f5f2e9;
  --card: #fffef9;
  --lime: #dce877;
  --line: #d9d6c9;
  --muted: #6c726d;
  --danger: #a53c32;
  --warning: #a86512;
  --shadow: 0 18px 45px rgba(37, 50, 40, .10);
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #edf2bb 0, transparent 32%), var(--paper); }
.login-card { width: min(100%, 440px); background: var(--card); border: 1px solid rgba(38,59,44,.12); border-radius: 28px; padding: 34px; box-shadow: var(--shadow); }
.brand-mark, .mini-mark { display: inline-grid; place-items: center; background: var(--forest); color: var(--lime); border-radius: 50%; font-family: Georgia, serif; font-weight: 700; }
.brand-mark { width: 54px; height: 54px; font-size: 27px; }
.mini-mark { width: 30px; height: 30px; margin-right: 9px; }
.eyebrow, .step { color: var(--forest-2); font-weight: 800; letter-spacing: .11em; font-size: .73rem; text-transform: uppercase; }
h1 { margin: 7px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 8vw, 3.1rem); line-height: 1.02; }
.lede { color: var(--muted); line-height: 1.55; margin-bottom: 25px; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; font-size: .91rem; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 12px; padding: 13px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(54,83,61,.12); }
textarea { resize: vertical; line-height: 1.45; min-height: 82px; }
button { border: 0; border-radius: 13px; font-weight: 800; padding: 13px 16px; }
.primary { background: var(--forest); color: white; width: 100%; box-shadow: 0 8px 20px rgba(38,59,44,.18); }
.primary:hover { background: var(--forest-2); }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { background: #e7eadf; color: var(--forest); }
.ghost { background: transparent; color: var(--forest); padding: 8px; }
.text-link { color: var(--forest); text-decoration: none; font-weight: 800; }
.login-card > .text-link { display: block; margin-top: 18px; text-align: center; font-size: .9rem; }
.topbar { height: 64px; position: sticky; z-index: 10; top: 0; background: rgba(255,254,249,.92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 max(18px, calc((100% - 760px)/2)); }
.topbar > div { display: flex; align-items: center; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-actions form { margin: 0; }
.app-shell { width: min(100% - 28px, 760px); margin: 28px auto 90px; }
.hero-card, .success-card { background: var(--card); border: 1px solid rgba(38,59,44,.1); border-radius: 25px; padding: clamp(24px, 6vw, 42px); box-shadow: var(--shadow); }
.hero-card > p:not(.step) { color: var(--muted); line-height: 1.55; }
.camera-button { min-height: 190px; margin: 24px 0 16px; border: 2px dashed #9aa66b; border-radius: 20px; background: #f8fadf; display: grid; place-items: center; align-content: center; gap: 9px; color: var(--forest); }
.camera-button input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.camera-icon { font-size: 3.2rem; line-height: 1; }
.photo-preview { width: 100%; max-height: 440px; object-fit: contain; border-radius: 17px; margin: 7px 0 16px; background: #e9e6dc; }
.capture-grid { display: grid; gap: 14px; margin: 24px 0 16px; }
.capture-slot { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #faf9f3; }
.capture-slot > p { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 10px; color: var(--forest); }
.capture-slot > p span { color: var(--warning); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.capture-slot.optional > p span { color: var(--muted); }
.camera-button.compact { min-height: 125px; margin: 0; }
.camera-button.compact .camera-icon { font-size: 2.35rem; }
.capture-slot .photo-preview { max-height: 300px; margin: 12px 0 0; }
.capture-slot .card-preview { max-height: 220px; }
.photo-hint { color: var(--muted); font-size: .9rem; text-align: center; }
.photo-hint.ready { color: var(--forest-2); font-weight: 800; }
.mode-page { padding-top: 4vh; }
.mode-grid { display: grid; gap: 16px; margin-top: 28px; }
.mode-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 24px; color: var(--ink); text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 21px; box-shadow: var(--shadow); }
.mode-card.featured { border-color: #a8b35c; background: linear-gradient(135deg, #fffef9, #f4f7cf); }
.mode-card:hover { border-color: var(--forest-2); transform: translateY(-1px); }
.mode-card h2 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; color: var(--forest); }
.mode-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.mode-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--forest); color: var(--lime); font-size: 1.8rem; }
.mode-arrow { color: var(--forest); font-size: 1.7rem; }
.status { margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--forest); font-weight: 700; }
.spinner { width: 22px; height: 22px; border: 3px solid #d4d9c1; border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.review-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.review-heading h1 { font-size: clamp(2rem, 7vw, 2.8rem); }
.review-heading .secondary { flex: 0 0 auto; }
.review-form { display: grid; gap: 14px; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
summary { cursor: pointer; list-style: none; padding: 18px 20px; font-weight: 900; color: var(--forest); display: flex; justify-content: space-between; }
summary::after { content: "+"; font-size: 1.25rem; }
details[open] summary::after { content: "−"; }
details > :not(summary) { margin-left: 20px; margin-right: 20px; }
details > :last-child { margin-bottom: 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 16px; margin-bottom: 16px; }
.checks.vertical { grid-template-columns: 1fr; }
.checks label { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.checks input { width: 20px; height: 20px; accent-color: var(--forest); }
.contact-card { border: 1px solid var(--line); background: #f8f7f1; border-radius: 15px; padding: 14px; margin-bottom: 12px; }
.contact-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.remove-contact { background: transparent; color: var(--danger); padding: 6px; }
.low-confidence input, .low-confidence textarea, input.low-confidence, textarea.low-confidence { border-color: #d48922; background: #fff8e7; }
.bilan textarea { min-height: 260px; font-size: 1rem; }
.alert { padding: 13px 15px; border-radius: 13px; margin: 14px 0; line-height: 1.4; }
.alert.error { background: #fbe7e4; color: var(--danger); }
.alert.warning { background: #fff1cf; color: #7a4a06; }
.sticky-submit { position: sticky; bottom: 15px; padding: 16px; z-index: 5; }
.success-card { text-align: center; margin-top: 12vh; }
.success-check { width: 68px; height: 68px; margin: 0 auto 17px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest); font-size: 2.3rem; font-weight: 900; }
.dossier-back { text-decoration: none; font-weight: 800; }
.dossier-grid { display: grid; gap: 18px; }
.dossier-grid figure { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.dossier-grid img { display: block; width: 100%; max-height: 900px; object-fit: contain; border-radius: 12px; background: #e9e6dc; }
.dossier-grid figcaption { padding: 12px 4px 2px; font-weight: 800; color: var(--forest); }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  .topbar { padding: 0 14px; }
  .ghost { font-size: .78rem; }
  .topbar strong { font-size: .88rem; }
  .topbar-actions { gap: 0; }
  .app-shell { width: min(100% - 20px,760px); margin-top: 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .checks { grid-template-columns: 1fr; }
  .review-heading { align-items: flex-start; flex-direction: column; }
  .review-heading .secondary { width: 100%; }
  .login-card { padding: 26px 21px; }
  .mode-card { grid-template-columns: auto 1fr; padding: 20px 17px; }
  .mode-arrow { display: none; }
}
