/* Reset, typographie, formulaires, tableaux. */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + var(--s5));
}

body.no-nav { padding-bottom: var(--s5); }

main {
    max-width: 40rem;
    margin: 0 auto;
    padding: var(--s4);
    padding-top: calc(var(--s4) + env(safe-area-inset-top));
}

h1, h2, h3, h4 { margin: 0 0 var(--s3); line-height: 1.2; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; margin-top: var(--s5); }
h3 { font-size: 1rem; }
p { margin: 0 0 var(--s3); }
small { font-size: .85rem; }
strong { font-weight: 800; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }

a { color: var(--primary-text); text-underline-offset: .15em; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.num, td.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Formulaires */
label { display: block; font-weight: 700; margin-bottom: var(--s3); }
label > input:where(:not([type=checkbox]):not([type=radio])), label > select, label > textarea { margin-top: var(--s1); font-weight: 400; }

input:where(:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden])), select, textarea {
    display: block;
    width: 100%;
    min-height: 2.9rem;
    padding: .65rem .9rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    margin: 0 0 var(--s3);
    appearance: none;
    -webkit-appearance: none;
}
textarea { min-height: 5rem; resize: vertical; }
select {
    padding-right: 2.4rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236E7B6F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .7rem center;
    background-size: 1.2rem;
}
input[type=search] { padding-left: 2.7rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled, select:disabled { opacity: .55; }
input[aria-invalid=true] { border-color: var(--danger); }

input[type=checkbox], input[type=radio] {
    width: 1.5rem; height: 1.5rem; margin: 0; flex: none;
    accent-color: var(--primary);
    vertical-align: middle;
}

/* Boutons natifs sans classe : action principale */
button:not([class]), input[type=submit]:not([class]) {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    min-height: 2.9rem;
    padding: .6rem 1.3rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: var(--on-primary);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease-out, filter .15s ease-out;
}
button:not([class]):active { transform: scale(.97); }
button:not([class]):hover { filter: brightness(1.06); }
button:disabled { opacity: .5; cursor: default; }
button { font-family: inherit; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--s3); }
th, td { padding: var(--s2) var(--s2); text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child > td { border-bottom: 0; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

progress { appearance: none; -webkit-appearance: none; width: 100%; height: .8rem; border: 0; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-2); display: block; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--primary); border-radius: var(--radius-pill); transition: width .25s ease-out; }
progress::-moz-progress-bar { background: var(--primary); border-radius: var(--radius-pill); }

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

[hidden] { display: none !important; }
