/* Appli AOF : jetons et cadre repris du tableau de bord (DESIGN.md).
   Cadre anthracite, menu sur cartes sombres brillantes, panneau clair, cartes blanches.
   Rayons de 6 à 14 px, aucune pilule : seuls les vrais cercles (logo, avatar, points) restent ronds. */
:root {
  --frame: #1c1a19; --side-fg: #f4f2ef; --side-fg2: #b3ada7; --side-line: rgba(255,255,255,.09);
  --panel: #f1f0ee; --card: #ffffff; --ink: #1c1a19; --ink2: #57524e; --ink3: #6f6964; --line: #e8e6e3; --line2: #d9d6d2;
  --dark: #262321; --dark-hover: #3a3633; --on-dark: #ffffff; --sand1: #f6dd8e; --sand2: #fdf3cf;
  --bad: #c8392b; --bad-bg: #fbe9e6; --bad-ink: #8f2419;
  --r-panel: 14px; --r-card: 14px; --r-ctl: 10px; --r-icon: 8px; --r-tag: 6px;
  --shadow: 0 1px 2px rgba(28,26,25,.04), 0 8px 24px -12px rgba(28,26,25,.18);
  --glass: inset 0 1px 0 rgba(255,255,255,.09), 0 10px 30px -14px rgba(0,0,0,.7);
  --ease: cubic-bezier(.22,1,.36,1);
  --font: "Geist", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--frame); color: var(--ink); font-family: var(--font); font-size: 14.5px; line-height: 1.45; font-feature-settings: "ss01"; -webkit-text-size-adjust: 100%; }
::selection { background: var(--sand1); color: var(--ink); }
input { caret-color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-icon); }
.side :focus-visible, .login :focus-visible { outline-color: var(--side-fg); }
.login .card :focus-visible { outline-color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
p, h1, h2 { margin: 0; }
h1 { font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
h1:focus { outline: none; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.lead { color: var(--ink2); max-width: 60ch; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Logo ---------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mono { width: 38px; height: 38px; border-radius: 50%; background: var(--side-fg); color: var(--frame); display: grid; place-items: center; font-weight: 700; font-size: 11.5px; letter-spacing: .02em; flex-shrink: 0; }
.brand b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--side-fg); }

/* ---------- Boutons ---------- */
.btn { height: 44px; padding: 0 16px; border-radius: var(--r-ctl); border: 0; background: var(--dark); color: var(--on-dark); font: 500 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; transition: transform .15s var(--ease), background-color .2s; }
.btn:hover { background: var(--dark-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--dark); background: var(--dark); color: var(--on-dark); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.iconbtn svg { width: 18px; height: 18px; }

/* ---------- Champs et messages ---------- */
.field { display: grid; gap: 6px; }
label { font-size: 13px; color: var(--ink2); font-weight: 500; }
.field input { height: 48px; width: 100%; border: 1px solid var(--line2); border-radius: var(--r-ctl); background: var(--card); color: var(--ink); font: 16px var(--font); padding: 0 14px; letter-spacing: .04em; }
.field input:focus { outline: none; border-color: var(--ink2); }
.field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-ctl); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.err { background: var(--bad-bg); color: var(--bad-ink); border-radius: var(--r-ctl); padding: 10px 12px; font-size: 13.5px; }
.err:empty { display: none; }
.empty { border: 1px dashed var(--line2); border-radius: var(--r-card); padding: 16px; color: var(--ink2); font-size: 14px; background: rgba(255,255,255,.45); }

/* ---------- Page de connexion ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px)); }
.login-box { width: min(380px, 100%); display: grid; gap: 18px; }
.login .brand { padding: 0 4px; }
.login .card { background: var(--card); border-radius: var(--r-card); padding: 22px 20px 20px; display: grid; gap: 16px; box-shadow: 0 18px 40px -20px rgba(0,0,0,.6); }
.login h1 { font-size: 22px; }
.login .lead { font-size: 14px; margin-top: 4px; }
.login form { display: grid; gap: 14px; }
.login .btn { width: 100%; }
.login .foot { color: var(--side-fg2); font-size: 12.5px; padding: 0 4px; }

/* ---------- Cadre de l'appli ---------- */
.app { min-height: 100%; display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 12px; padding: 12px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
.side { position: sticky; top: 12px; height: calc(100vh - 24px); min-height: 460px; display: flex; flex-direction: column; gap: 12px; color: var(--side-fg); }
.side .brand { padding: 8px 6px 6px; }
.side::before { content: ""; position: absolute; left: 0; right: 0; top: 60px; height: 220px; background: radial-gradient(60% 55% at 35% 40%, rgba(246,221,142,.22), transparent 70%), radial-gradient(45% 45% at 80% 75%, rgba(196,150,110,.18), transparent 70%); pointer-events: none; }
.side > * { position: relative; }
.glossy { border-radius: var(--r-card); background-color: rgba(43,40,38,.62); background-image: linear-gradient(180deg, rgba(74,68,63,.55) 0%, rgba(43,40,38,.45) 55%, rgba(37,34,32,.6) 100%); border: 1px solid var(--side-line); box-shadow: var(--glass); }
.nav { padding: 8px; display: grid; gap: 2px; position: relative; }
.ind { position: absolute; left: 8px; right: 8px; top: 8px; height: 44px; border-radius: var(--r-ctl); background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08)); box-shadow: inset 0 1px 0 rgba(255,255,255,.14); transition: transform .45s var(--ease); pointer-events: none; opacity: 0; }
.ind.on { opacity: 1; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 8px; border-radius: var(--r-ctl); text-decoration: none; color: var(--side-fg2); font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--side-fg); }
.ic { width: 30px; height: 30px; border-radius: var(--r-icon); background: rgba(255,255,255,.08); display: grid; place-items: center; flex-shrink: 0; }
.nav a[aria-current="page"] .ic { background: rgba(255,255,255,.16); }
.ic svg { width: 16px; height: 16px; }
.nav .ext { margin-left: auto; width: 14px; height: 14px; opacity: .7; }
.nav .sep { height: 1px; background: var(--side-line); margin: 6px 8px; }
.sidefill { flex: 1; }
.who { padding: 10px; display: grid; gap: 10px; }
.who .id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.av { width: 36px; height: 36px; border-radius: 50%; background: #cfc5ba; color: var(--frame); display: grid; place-items: center; font-weight: 600; flex-shrink: 0; }
.who .id > span:last-child { min-width: 0; }
.who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; color: var(--side-fg2); font-size: 12.5px; }
.out { width: 100%; height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--side-line); background: rgba(255,255,255,.06); color: var(--side-fg); font: 500 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background-color .2s, transform .15s var(--ease); }
.out:hover { background: rgba(255,255,255,.12); }
.out:active { transform: scale(.98); }
.out:disabled { opacity: .45; cursor: default; }
.out svg { width: 16px; height: 16px; }
.side-err { color: #f0b3aa; font-size: 12.5px; }
.side-err:empty { display: none; }

/* ---------- Panneau clair ---------- */
.panel { background: var(--panel); border-radius: var(--r-panel); min-width: 0; padding: 26px 28px 32px; display: grid; gap: 18px; align-content: start; min-height: calc(100vh - 24px); }
.top { display: none; }
main { min-width: 0; }
.view { display: grid; gap: 18px; min-width: 0; max-width: 760px; }
.view > header { display: grid; gap: 6px; }
.card { background: var(--card); border-radius: var(--r-card); padding: 18px; display: grid; gap: 12px; box-shadow: var(--shadow); min-width: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.steps li { border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; text-decoration: none; font-weight: 500; }
.steps a:hover span:first-child { text-decoration: underline; }
.steps small { color: var(--ink3); font-size: 13px; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Téléphone : menu burger ---------- */
.scrim, .side .close { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 8px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .top { display: flex; align-items: center; gap: 12px; }
  .top .brand b { color: var(--ink); font-size: 15px; }
  .side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); height: auto; min-height: 0; padding: calc(env(safe-area-inset-top, 0px) + 14px) 12px calc(env(safe-area-inset-bottom, 0px) + 14px) max(12px, env(safe-area-inset-left, 0px)); background: var(--frame); border-radius: 0 var(--r-panel) var(--r-panel) 0; box-shadow: 24px 0 60px -20px rgba(0,0,0,.6); transform: translateX(-105%); visibility: hidden; transition: transform .38s var(--ease), visibility 0s linear .38s; overflow-y: auto; }
  body.menu-open .side { transform: none; visibility: visible; transition: transform .38s var(--ease), visibility 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(20,18,17,.45); opacity: 0; pointer-events: none; transition: opacity .3s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .side .close { display: grid; margin-left: auto; width: 44px; height: 44px; border-radius: var(--r-ctl); border: 0; background: rgba(255,255,255,.1); color: var(--side-fg); cursor: pointer; place-items: center; }
  .side .close svg { width: 18px; height: 18px; }
  .nav a { min-height: 48px; }
  .panel { padding: 12px 14px 28px; min-height: calc(100vh - 16px); }
  .view { padding-top: 6px; }
  h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
