/* Application de bureau : fenêtre à barre latérale, un écran par étape. Couleurs et polices : theme.css. */
@import url(theme.css);

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; user-select: none; overflow: hidden; font-feature-settings: "cv11", "ss01";
}
input, select, textarea { user-select: text; }
button, select, input { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--sun-1); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.window { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

/* ---------- Barre latérale ---------- */
.side {
  position: relative; display: flex; flex-direction: column; gap: 20px; min-height: 0; padding: 22px 16px 16px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; flex: none; box-shadow: var(--shadow); }
.brand strong { display: block; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.brand span { display: block; font-size: 12px; color: var(--text-2); line-height: 1.35; margin-top: 2px; }

.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; transition: background .2s; }
.steps .num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-2);
}
.steps li.active { background: var(--sun-soft); color: var(--text); font-weight: 600; }
.steps li.active .num { border-color: transparent; background: var(--sun); color: var(--on-sun); box-shadow: var(--shadow-sun); }
.steps li.done { color: var(--text); }
.steps li.done .num { border-color: transparent; background: var(--mint); color: #fff; }
.steps li.done .num b { display: none; }
.steps li.done .num::after { content: ""; width: 10px; height: 5px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
/* Terminée avec réserves (orange) ou en échec (rouge) : un « ! » à la place de la coche. */
.steps li.warn, .steps li.error { color: var(--text); }
.steps li.warn .num, .steps li.error .num { border-color: transparent; }
.steps li.warn .num { background: var(--warn); color: var(--warn-soft); }
.steps li.error .num { background: var(--sun-1); color: #fff; }
.steps li.warn .num b, .steps li.error .num b { display: none; }
.steps li.warn .num::after, .steps li.error .num::after { content: "!"; font-weight: 800; font-size: 14px; line-height: 1; }
.steps li.error { background: color-mix(in srgb, var(--sun-1) 12%, transparent); }

.spacer { flex: 1; }

.plan {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 16px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.plan::before { content: ""; position: absolute; inset: -40% -30% auto auto; width: 160px; height: 160px; background: radial-gradient(circle, rgba(255,150,80,.28), transparent 65%); pointer-events: none; }
.plan-head { position: relative; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface); color: var(--text-2); border: 1px solid var(--line); }
.badge.full { background: var(--mint-soft); color: var(--mint); border-color: transparent; }
.plan p { position: relative; margin: 6px 0 14px; color: var(--text-2); font-size: 12.5px; }
.plan .btn { position: relative; width: 100%; padding-left: 12px; padding-right: 12px; font-size: 13px; }
.plan .link { position: relative; display: block; text-align: center; margin-top: 9px; font-size: 12.5px; }

.side-foot { display: flex; align-items: center; gap: 10px; padding: 0 4px; font-size: 12.5px; }
.side-foot a { color: var(--text-2); }
.side-foot a:hover { color: var(--text); }
.side-foot .grow { flex: 1; }
.select-sm { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 4px 8px; font-size: 12.5px; color: var(--text-2); }

/* ---------- Zone principale ---------- */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--glow), var(--bg); }
.scroll { flex: 1; overflow: auto; padding: 40px 48px 32px; }
.view { max-width: 780px; margin: 0 auto; animation: appear .3s cubic-bezier(.2, .7, .2, 1); }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.15; font-optical-sizing: auto; }
.lead { color: var(--text-2); margin: 0 0 26px; font-size: 15px; }
h2 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 30px 0 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .2s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--sun); border-color: transparent; color: var(--on-sun); box-shadow: var(--shadow-sun); }
.btn.primary:hover { filter: brightness(1.05) saturate(1.05); box-shadow: 0 10px 30px rgba(242, 85, 62, .38); }
.btn.big { height: 48px; padding: 0 26px; font-size: 15px; border-radius: 14px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- 1. Dépôt ---------- */
.drop {
  position: relative; overflow: hidden; border-radius: 24px; padding: 40px 32px 38px; text-align: center;
  background: var(--surface); border: 1.5px dashed var(--line-strong); transition: border-color .2s, background .2s, transform .2s;
}
.drop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 0%, rgba(255, 150, 80, .10), transparent 70%); pointer-events: none; }
.drop.over { border-color: var(--sun-1); background: var(--sun-soft); transform: scale(1.005); }
.drop > * { position: relative; z-index: 1; }
.drop h1 { font-size: 26px; }
.drop .lead { margin-bottom: 22px; }
.drop .alt { display: block; margin-top: 12px; font-size: 13px; }
.drop .alt button { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; }
.drop .alt button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Pile de polaroïds (illustration) */
.stack { position: relative; width: 210px; height: 128px; margin: 0 auto 22px; }
.polaroid {
  position: absolute; top: 8px; width: 86px; height: 104px; padding: 7px 7px 22px; border-radius: 6px;
  background: #fffdf9; box-shadow: 0 8px 22px rgba(20, 10, 0, .18); border: 1px solid rgba(0, 0, 0, .05);
}
.polaroid i { display: block; width: 100%; height: 100%; border-radius: 3px; }
.polaroid b { position: absolute; left: 0; right: 0; bottom: 5px; text-align: center; font: 600 9px/1 var(--font); color: #6b5f57; letter-spacing: .02em; }
.p1 { left: 8px; transform: rotate(-9deg); } .p1 i { background: linear-gradient(160deg, #7cc6ff 0%, #ffd0a1 60%, #ff8a5c 100%); }
.p2 { left: 62px; top: 0; z-index: 2; transform: rotate(2deg); } .p2 i { background: linear-gradient(170deg, #3b2f6b 0%, #ff6b57 55%, #ffc061 100%); }
.p3 { left: 116px; transform: rotate(10deg); } .p3 i { background: linear-gradient(165deg, #b5e3c9 0%, #5fb89a 55%, #2f6f63 100%); }
.drop.over .p1 { transform: rotate(-14deg) translateX(-6px); } .drop.over .p3 { transform: rotate(15deg) translateX(6px); }
.polaroid { transition: transform .25s cubic-bezier(.2, .7, .2, 1); }

.hint { margin-top: 16px; font-size: 13px; color: var(--text-2); text-align: center; }

.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.tip { padding: 18px; }
.tip-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; }
.tip-icon svg { width: 18px; height: 18px; }
.tip:nth-child(1) .tip-icon { background: var(--mint-soft); color: var(--mint); }
.tip:nth-child(2) .tip-icon { background: var(--lilac-soft); color: var(--lilac); }
.tip:nth-child(3) .tip-icon { background: var(--sun-soft); color: var(--sun-1); }
.tip strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.tip span { color: var(--text-2); font-size: 12.5px; line-height: 1.5; display: block; }

/* ---------- Lecture ---------- */
.center-state { text-align: center; padding: 90px 0 40px; }
.spinner { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 24px; background: conic-gradient(from 0deg, transparent 0 25%, var(--sun-1), var(--sun-2)); -webkit-mask: radial-gradient(circle, transparent 55%, #000 57%); mask: radial-gradient(circle, transparent 55%, #000 57%); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.count { font-variant-numeric: tabular-nums; }

/* ---------- 2. Vérifier ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { padding: 18px 18px 15px; }
.tile .v { font-family: var(--font-display); font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.tile .l { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.tile:last-child .v { background: var(--sun); -webkit-background-clip: text; background-clip: text; color: transparent; }

.precision { padding: 18px 20px; margin-top: 12px; }
.precision-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.bar { display: flex; gap: 3px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.bar i { display: block; height: 100%; border-radius: 999px; }
.bar .b1 { background: var(--mint); }
.bar .b2 { background: var(--lilac); }
.bar .b3 { background: var(--sun-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.legend .l1::before { background: var(--mint); }
.legend .l2::before { background: var(--lilac); }
.legend .l3::before { background: var(--sun-2); }

.notice { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); margin-top: 12px; font-size: 13px; }
.notice svg { width: 18px; height: 18px; color: var(--warn); flex: none; margin-top: 1px; }

/* Aperçu en polaroïds */
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 4px 2px 6px; }
.thumb {
  position: relative; padding: 6px 6px 38px; border-radius: 8px; background: #fffdf9; box-shadow: 0 6px 18px rgba(20, 10, 0, .14);
  border: 1px solid rgba(0, 0, 0, .05); transition: transform .25s cubic-bezier(.2, .7, .2, 1);
}
.thumb:nth-child(odd) { transform: rotate(-1.6deg); }
.thumb:nth-child(even) { transform: rotate(1.4deg); }
.thumb:hover { transform: rotate(0) translateY(-3px) scale(1.03); z-index: 2; }
.thumb .ph { position: relative; aspect-ratio: 3 / 4; border-radius: 3px; overflow: hidden; background: #ece4da; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .vid { position: absolute; inset: 0; display: grid; place-items: center; color: #8d8278; background: linear-gradient(160deg, #efe7dd, #e2d6c8); }
.thumb .vid svg { width: 26px; height: 26px; }
.thumb .play { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; display: grid; place-items: center; background: rgba(12, 10, 20, .55); color: #fff; backdrop-filter: blur(3px); }
.thumb .play svg { width: 16px; height: 16px; margin-left: 2px; }
.thumb .date { position: absolute; left: 0; right: 0; bottom: 7px; text-align: center; font-size: 10.5px; font-weight: 650; line-height: 1.25; color: #4f443c; white-space: pre-line; }

/* Options */
.options { padding: 2px 0; }
.opt { display: flex; align-items: center; gap: 16px; padding: 15px 20px; }
.opt + .opt { border-top: 1px solid var(--line); }
.opt-text { flex: 1; min-width: 0; }
.opt-text strong { display: block; font-weight: 600; font-size: 13.5px; }
.opt-text span { display: block; color: var(--text-2); font-size: 12.5px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
.switch input:checked + i { background: var(--sun); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--sun-1); outline-offset: 2px; }
.select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 7px 10px; max-width: 250px; }

/* Barre d'action */
.actionbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 48px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.actionbar .info { flex: 1; color: var(--text-2); font-size: 13px; min-width: 0; }

/* ---------- 3. Traitement ---------- */
.progress-card { padding: 36px 32px 30px; text-align: center; }
.pct { font-family: var(--font-display); font-size: 64px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.pbar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 26px 0 12px; }
.pbar i { display: block; height: 100%; width: 0; background: var(--sun); border-radius: 999px; transition: width .35s ease; box-shadow: var(--shadow-sun); }
.muted { color: var(--text-2); font-size: 13px; }

/* ---------- Terminé ---------- */
.done-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.done-check { width: 60px; height: 60px; border-radius: 50%; background: var(--mint); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 10px 28px rgba(25, 143, 100, .3); }
.done-check svg { width: 30px; height: 30px; }
.done-head h1 { margin: 0; }
.done-head .lead { margin: 3px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.chip { font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.done-thumbs { margin: 4px 0 26px; }
.done-thumbs .thumb .date { color: #1a7a55; }
.next { padding: 20px 22px; margin-top: 24px; }
.next strong { display: block; margin-bottom: 10px; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.next ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.next li + li { margin-top: 5px; }
.upsell { position: relative; overflow: hidden; padding: 20px 22px; margin-top: 14px; display: flex; gap: 18px; align-items: center; border-color: transparent; background: var(--sun-soft); }
.upsell::before { content: ""; position: absolute; right: -60px; top: -80px; width: 240px; height: 240px; background: radial-gradient(circle, rgba(255, 150, 80, .35), transparent 65%); }
.upsell > * { position: relative; }
.upsell div { flex: 1; }
.upsell strong { display: block; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.upsell span { color: var(--text-2); font-size: 13px; }

/* ---------- Activation ---------- */
dialog { border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(460px, calc(100vw - 40px)); overflow: hidden; }
dialog::backdrop { background: rgba(10, 8, 20, .5); backdrop-filter: blur(4px); }
dialog[open] { animation: pop .25s cubic-bezier(.2, .7, .2, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg { position: relative; padding: 28px 28px 22px; }
.dlg::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--sun); }
.dlg h1 { font-size: 23px; }
.dlg .lead { margin-bottom: 18px; font-size: 14px; }
.key { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); padding: 0 14px; font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 14px; letter-spacing: .03em; }
.key:focus { outline: 2px solid var(--sun-1); outline-offset: 0; border-color: transparent; }
.dlg-msg { min-height: 20px; margin: 10px 0 0; font-size: 13px; }
.dlg-msg.err { color: var(--link); }
.dlg-msg.ok { color: var(--mint); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.dlg-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }

/* Barre de défilement discrète */
.scroll::-webkit-scrollbar { width: 12px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
.scroll::-webkit-scrollbar-button { display: none; height: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Version en ligne sur petit écran */
@media (max-width: 900px) {
  body { overflow: auto; }
  .window { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .side { display: none; }
  .scroll { padding: 24px 16px; overflow: visible; }
  .actionbar { position: sticky; bottom: 0; padding: 12px 16px; flex-wrap: wrap; }
  .tips { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .thumbs { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 25px; }
}

/* Barre compacte (version en ligne sur petit écran, quand la barre latérale est masquée). */
.mobile-bar { display: none; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand-sm { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.brand-sm img { width: 28px; height: 28px; border-radius: 8px; }
.mobile-bar .grow { flex: 1; }
.side-foot .theme-btn { width: 30px; height: 30px; }
@media (max-width: 900px) { .mobile-bar { display: flex; position: sticky; top: 0; z-index: 5; } }

/* Erreurs */
.done-head.bad .done-check { background: var(--sun-1); box-shadow: 0 10px 28px rgba(242, 85, 62, .3); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 600; }
.crash-more { margin-top: 22px; }
.crash-more summary { cursor: pointer; font-size: 13px; color: var(--text-2); width: max-content; }
.crash-more summary:hover { color: var(--text); }
.crash-details { padding: 14px 16px; margin: 10px 0 0; max-height: 220px; overflow: auto; font: 12px/1.5 "Cascadia Mono", Consolas, monospace; color: var(--text-2); white-space: pre-wrap; user-select: text; }
#dlg-msg-box { width: min(560px, calc(100vw - 40px)); }
#msg-panel:focus { outline: none; }
#dlg-msg-box .dlg-actions { flex-wrap: wrap; margin-top: 22px; }
.side-foot a { white-space: nowrap; }
.side-foot { gap: 8px; }
.side-foot .select-sm { max-width: 108px; }
/* Pied de barre latérale : le lien du guide sur sa ligne, thème et langue en dessous. */
.side-foot { flex-wrap: wrap; row-gap: 10px; }
.side-foot > a { flex-basis: 100%; }
.side-foot .grow { display: none; }
.side-foot .select-sm { max-width: none; flex: 1; }
