:root {
  --ink: #102a32;
  --muted: #60727a;
  --line: #dbe5e7;
  --paper: #ffffff;
  --canvas: #f3f7f7;
  --navy: #081f27;
  --navy-2: #0e3038;
  --mint: #2dd4a3;
  --mint-soft: #dff8ef;
  --amber: #b76a06;
  --amber-soft: #fff1cf;
  --rose: #be3455;
  --rose-soft: #ffe6ec;
  --blue: #2563a9;
  --shadow: 0 16px 45px rgba(15, 42, 50, .09);
  font-family: Aptos, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--navy); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a, select, input[type="file"] { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.hidden { display: none !important; }
.loading-screen { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; color: white; background: radial-gradient(circle at 60% 30%, #164c55, var(--navy) 55%); }
.brand-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 17px; background: var(--mint); color: var(--navy); font-size: 24px; font-weight: 900; box-shadow: 0 14px 34px rgba(45, 212, 163, .25); }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: var(--navy); }
.auth-intro { position: relative; overflow: hidden; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: clamp(34px, 6vw, 84px); color: white; background: linear-gradient(145deg, #071b22 0%, #0a3038 100%); }
.auth-intro::after { content: ""; position: absolute; width: 430px; height: 430px; right: -160px; bottom: -100px; border: 1px solid rgba(126, 231, 199, .22); border-radius: 50%; box-shadow: 0 0 0 58px rgba(126, 231, 199, .035), 0 0 0 116px rgba(126, 231, 199, .025); }
.brand-lockup { display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: 21px; }
.brand-lockup .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 20px; }
.auth-copy { position: relative; z-index: 1; max-width: 650px; }
.eyebrow { margin: 0 0 12px; color: #68e1bd; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
.auth-copy h1 { max-width: 700px; margin: 0; font-size: clamp(38px, 5vw, 70px); line-height: 1.02; letter-spacing: -.045em; }
.auth-copy > p:last-child { max-width: 620px; margin: 24px 0 0; color: #c2d3d7; font-size: 18px; line-height: 1.7; }
.auth-points { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 42px; }
.auth-points span { border: 1px solid rgba(255,255,255,.13); border-radius: 999px; padding: 10px 14px; color: #dce8ea; background: rgba(255,255,255,.045); font-size: 14px; }
.auth-panel { display: grid; place-items: center; min-height: 100vh; padding: 32px; background: #f7faf9; }
.auth-card { width: min(100%, 520px); padding: clamp(28px, 5vw, 52px); border: 1px solid var(--line); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.auth-card .lead { margin: 12px 0 28px; color: var(--muted); line-height: 1.6; }

.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field > span, .field > label { font-size: 14px; font-weight: 750; color: #30464d; }
.input, .select, .textarea { width: 100%; min-height: 46px; border: 1px solid #cbd9dc; border-radius: 12px; padding: 10px 13px; color: var(--ink); background: white; outline: 0; transition: border .15s, box-shadow .15s; }
.textarea { min-height: 100px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #1cb68b; box-shadow: 0 0 0 4px rgba(45, 212, 163, .16); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 9px 16px; background: var(--mint); color: #062128; font-weight: 800; text-decoration: none; transition: transform .12s, filter .12s, background .12s; }
.button:hover { filter: brightness(.98); transform: translateY(-1px); }
.button.secondary { border-color: #cbd9dc; background: white; color: var(--ink); }
.button.danger { border-color: #f2b9c6; background: var(--rose-soft); color: #92233e; }
.button.dark { background: var(--navy); color: white; }
.button.small { min-height: 36px; padding: 6px 11px; border-radius: 9px; font-size: 13px; }
.button.block { width: 100%; }
.help { color: var(--muted); font-size: 13px; line-height: 1.55; }
.error-box, .success-box, .notice-box { margin: 16px 0; border-radius: 12px; padding: 13px 15px; font-size: 14px; line-height: 1.5; }
.error-box { border: 1px solid #f2b9c6; background: var(--rose-soft); color: #8d203a; }
.success-box { border: 1px solid #9ae7cf; background: var(--mint-soft); color: #126147; }
.notice-box { border: 1px solid #efcf87; background: var(--amber-soft); color: #704307; }
.secret-box { overflow-wrap: anywhere; border: 1px dashed #8dbeb0; border-radius: 12px; padding: 13px; background: #f0fbf7; font: 700 14px ui-monospace, SFMono-Regular, Menlo, monospace; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 286px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; padding: 22px 16px; background: var(--navy); color: white; }
.sidebar .brand-lockup { padding: 2px 8px 22px; }
.context-box { display: grid; gap: 12px; margin: 4px 0 20px; border: 1px solid rgba(255,255,255,.1); border-radius: 17px; padding: 14px; background: rgba(255,255,255,.045); }
.context-box label { display: grid; gap: 6px; color: #849ba1; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.context-box select { min-width: 0; width: 100%; height: 39px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 0 10px; color: white; background: var(--navy-2); }
.context-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-nav { display: grid; gap: 5px; }
.side-nav button { display: flex; width: 100%; min-height: 43px; align-items: center; gap: 11px; border: 0; border-radius: 11px; padding: 9px 12px; color: #bdcdd1; background: transparent; text-align: left; font-weight: 700; }
.side-nav button:hover, .side-nav button.active { color: white; background: rgba(255,255,255,.09); }
.side-nav .count { margin-left: auto; border-radius: 99px; padding: 2px 7px; background: rgba(239, 80, 119, .2); color: #ffb4c5; font-size: 12px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 18px 8px 2px; color: #94a9ae; font-size: 13px; line-height: 1.5; }
.sidebar-footer strong { display: block; color: white; }
.main { min-width: 0; background: var(--canvas); }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 13px clamp(18px, 4vw, 48px); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.topbar h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.02em; }
.crumb { color: #228467; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.save-state { border: 1px solid #bcebdc; border-radius: 999px; padding: 7px 11px; color: #147156; background: #ecfbf6; font-size: 13px; font-weight: 750; }
.content { width: min(100%, 1500px); margin: 0 auto; padding: clamp(20px, 4vw, 46px); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h2 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.035em; }
.page-head p { max-width: 760px; margin: 9px 0 0; color: var(--muted); line-height: 1.65; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.grid { display: grid; gap: 18px; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--paper); box-shadow: 0 8px 24px rgba(15, 42, 50, .045); }
.card h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.card p { color: var(--muted); line-height: 1.6; }
.metric strong { display: block; margin-top: 16px; font-size: 31px; letter-spacing: -.04em; }
.metric span { color: var(--muted); font-size: 14px; }
.hero-card { overflow: hidden; position: relative; margin-bottom: 18px; padding: clamp(24px, 4vw, 38px); color: white; background: linear-gradient(130deg, #08252d, #0c3a42); }
.hero-card::after { content: ""; position: absolute; right: -50px; bottom: -150px; width: 320px; height: 320px; border: 1px solid rgba(126,231,199,.2); border-radius: 50%; box-shadow: 0 0 0 42px rgba(126,231,199,.035), 0 0 0 84px rgba(126,231,199,.025); }
.hero-card > * { position: relative; z-index: 1; }
.hero-card h2 { max-width: 750px; margin: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; }
.hero-card p { max-width: 760px; color: #c6dadd; }
.progress-track { width: 100%; height: 11px; overflow: hidden; border: 0; border-radius: 99px; background: #dce9e7; }
.progress-track::-webkit-progress-bar { border-radius: inherit; background: #dce9e7; }
.progress-track::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, #18b886, var(--mint)); }
.progress-track::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, #18b886, var(--mint)); }
.badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 9px; background: #edf4f5; color: #3d565d; font-size: 12px; font-weight: 800; }
.badge.good { background: var(--mint-soft); color: #126147; }
.badge.warn { background: var(--amber-soft); color: #7f4c05; }
.badge.risk { background: var(--rose-soft); color: #952640; }
.badge.blue { background: #e5f0ff; color: #245b9a; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #e5ecee; padding: 13px 10px; text-align: left; vertical-align: top; font-size: 14px; }
th { color: #597077; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:last-child td { border-bottom: 0; }
.empty { border: 1px dashed #b9cbcf; border-radius: 16px; padding: 30px; color: var(--muted); background: #f9fbfb; text-align: center; }
.upload-zone { display: grid; place-items: center; min-height: 150px; border: 2px dashed #9ebfba; border-radius: 16px; padding: 22px; background: #f2fbf8; text-align: center; }
.upload-zone input { max-width: 100%; }
.upload-zone strong { display: block; margin: 9px 0 4px; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.audit-item { border-left: 4px solid #96aeb3; }
.audit-item.severity-critique, .audit-item.severity-élevé { border-left-color: var(--rose); }
.audit-item.severity-moyen { border-left-color: #d68a1d; }
.audit-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.audit-item h3 { margin-top: 8px; }
.audit-item .recommendation { border-radius: 11px; padding: 12px; background: #f2f7f7; color: #385159; }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; margin-left: 7px; border-left: 2px solid #cfdfdc; padding: 4px 0 20px 20px; }
.timeline-item::before { content: ""; position: absolute; top: 7px; left: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); }
.timeline-item strong { display: block; }
.timeline-item small { color: var(--muted); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.check-option { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; padding: 11px; font-size: 14px; }
dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 38px); overflow: auto; border: 0; border-radius: 22px; padding: 0; box-shadow: 0 30px 90px rgba(5, 22, 27, .32); }
dialog::backdrop { background: rgba(4, 20, 25, .62); backdrop-filter: blur(3px); }
.dialog-body { padding: 27px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.dialog-head h2 { margin: 0; font-size: 25px; }
.close-button { border: 0; border-radius: 50%; width: 36px; height: 36px; background: #eef3f4; color: var(--ink); font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.mobile-menu { display: none; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); border-radius: 13px; padding: 13px 16px; color: white; background: var(--navy); box-shadow: var(--shadow); }
.toast.error { background: #9f2945; }
.enrollment-form { margin-top: 22px; }
.empty-start { max-width: 760px; margin: 7vh auto; padding: clamp(28px, 6vw, 60px); }
.empty-start h2 { margin: 0; font-size: clamp(30px, 5vw, 48px); }
.lead-large { font-size: 18px; }
.section-gap { margin-top: 18px; }
.submit-gap { margin-top: 16px; }
.action-gap { margin-top: 14px; }

@media (max-width: 1100px) {
  .grid.metrics { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-panel { padding: 18px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(88vw, 310px); transform: translateX(-105%); transition: transform .2s; box-shadow: 20px 0 70px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .save-state { display: none; }
  .content { padding: 20px 15px 42px; }
  .topbar { padding: 12px 15px; }
  .page-head { flex-direction: column; }
  .form-row, .check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .grid.metrics { grid-template-columns: 1fr; }
  .auth-card { padding: 25px 20px; border-radius: 20px; }
  .dialog-body { padding: 20px 16px; }
  .actions, .dialog-actions { width: 100%; }
  .actions .button, .dialog-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.qr-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.75rem 0 1.25rem;
  padding: 1rem;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 1rem;
  background: #ffffff;
}

#mfa-qr img,
#mfa-qr canvas {
  display: block;
  max-width: 220px;
  height: auto;
}
