/* DocCollect — feuille de style unique, mobile d'abord. Jetons de couleur en variables, thème sombre automatique. */
:root {
    --paper: #f6f4ef;
    --surface: #ffffff;
    --surface-2: #f0ede6;
    --ink: #1c2430;
    --ink-soft: #5b6573;
    --line: #e2ded5;
    --brand: #16324f;
    --brand-ink: #ffffff;
    --accent: #1f8a70;
    --ok: #1f8a70;
    --ok-bg: #e3f3ee;
    --warn: #a15c07;
    --warn-bg: #fdf1dd;
    --err: #b42318;
    --err-bg: #fde7e5;
    --info: #1d5fa8;
    --info-bg: #e5effa;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(28, 36, 48, .06), 0 2px 8px rgba(28, 36, 48, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #11161d;
        --surface: #18202a;
        --surface-2: #1f2934;
        --ink: #e7ebf0;
        --ink-soft: #9aa6b4;
        --line: #2b3643;
        --brand: #9cc3ea;
        --brand-ink: #0d1520;
        --accent: #4cc39f;
        --ok: #4cc39f;
        --ok-bg: #173a31;
        --warn: #f0b45a;
        --warn-bg: #3a2c15;
        --err: #f2877c;
        --err-bg: #3d1d1a;
        --info: #8bbcf0;
        --info-bg: #1a2e45;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
a { color: var(--info); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Chargement initial */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--ink-soft); }
.boot-mark { width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); display: grid; place-content: center; font-weight: 700; margin: 0 auto 12px; }

/* Structure */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 10; }
.topbar a { color: inherit; text-decoration: none; }
.logo { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.logo img { width: 28px; height: 28px; }
.env { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--warn); color: #fff; font-weight: 600; }
.spacer { flex: 1; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.nav a { white-space: nowrap; padding: 6px 12px; border-radius: 8px; color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.nav a.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.content { width: 100%; max-width: 980px; margin: 0 auto; padding: 16px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.content.narrow { max-width: 460px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; justify-content: space-between; margin-bottom: 16px; }
.embed .content { padding: 12px; }

/* Cartes et listes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card.tight { padding: 12px; }
.list { display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
a.card-link { display: block; text-decoration: none; color: inherit; }
a.card-link:hover .card { border-color: var(--ink-soft); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { opacity: .8; }

/* Progression */
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* Pièces attendues */
.item { border-left: 4px solid var(--line); }
.item.Accepted { border-left-color: var(--ok); }
.item.Submitted { border-left-color: var(--info); }
.item.Rejected { border-left-color: var(--err); }
.item.Missing.required { border-left-color: var(--warn); }
.doc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); font-size: .92rem; }
.doc .name { flex: 1; min-width: 140px; overflow-wrap: anywhere; }

/* Formulaires */
label { display: block; font-size: .9rem; font-weight: 600; margin: 10px 0 4px; }
.hint { font-size: .82rem; color: var(--ink-soft); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
    width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.code-input { font-size: 1.5rem; letter-spacing: .4em; text-align: center; font-family: ui-monospace, monospace; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; min-height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Messages */
.alert { border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: .92rem; }
.alert.err { background: var(--err-bg); color: var(--err); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--ink-soft); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* QR et codes */
.qr { width: 200px; height: 200px; background: #fff; border-radius: 8px; padding: 6px; margin: 8px 0; }
.qr svg { width: 100%; height: 100%; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: ui-monospace, monospace; }
.codes span { background: var(--surface-2); border-radius: 6px; padding: 6px; text-align: center; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px; background: var(--err-bg); color: var(--err); z-index: 100; }
#blazor-error-ui .reload { margin-left: 8px; }
