@import url("./tokens.css");
/* Capsulas · charte épurée (04-tecnologia/chartes/charte-capsulas.md). Le CSS n'écrit que var(--…) : aucune couleur, fonte
   ni rayon en dur (contrôle : scripts/tokens-check.mjs). Aucune ombre, aucun dégradé, une seule couleur d'action : l'encre. */
:root {
  --bg: var(--color-bg); --subtle: var(--color-subtle);
  --ink: var(--color-ink); --ink2: var(--color-ink2); --meta: var(--color-meta);
  --hair: var(--color-hairline); --border: var(--color-border);
  --primary: var(--color-primary); --primary-ink: var(--color-primary-ink);
  --ok: var(--color-ok); --warn: var(--color-warn); --danger: var(--color-danger);
  --font: var(--font-sans); --mono: var(--font-mono);
  --r: var(--radius-ctl); --pill: var(--radius-pill);
  --tap: var(--size-tap-min);
}
html { scroll-padding-top: 64px; scroll-padding-bottom: 120px; color-scheme: light dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Structure : un écran à la fois, l'action primaire dans la zone du pouce, rien de flottant sauf l'en-tête et le pied */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.scr { display: none; flex: 1; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.scr.on { display: flex; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--hair); padding: 14px 20px; padding-top: max(14px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; min-height: 56px; }
.top h1 { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .back { width: var(--tap); height: var(--tap); margin-left: -12px; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.body { flex: 1; padding: 8px 20px 28px; display: flex; flex-direction: column; gap: 12px; }
.footer { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--hair); padding: 12px 20px; padding-bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 10px; flex-wrap: wrap; }
.footer .falta { flex-basis: 100%; margin: -2px 0 2px; }

/* Texte */
.mini { color: var(--ink2); font-size: 14px; line-height: 1.45; }
.mini.warn { color: var(--warn); }
.mini.err { color: var(--danger); }
.etape { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--hair); font-size: 14px; font-weight: 600; color: var(--ink2); }
.etape .num { color: var(--meta); font-variant-numeric: tabular-nums; }
.etape .num::after { content: "."; }
.etape.ok { color: var(--ink); }
.etape.ok .num { color: var(--ok); }
.paso:first-of-type .etape { border-top: 0; padding-top: 6px; margin-top: 4px; }

/* États : un point et des mots, jamais une pastille pleine */
.pastille { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 500; color: var(--ink2); white-space: nowrap; }
.pastille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: 0 0 auto; }
.pastille.sent { color: var(--ink); } .pastille.sent::before { background: var(--ink); }
.pastille.sync { color: var(--ok); } .pastille.sync::before { background: var(--ok); }
.pastille.off { color: var(--warn); } .pastille.off::before { background: var(--warn); }
.pastille.crit { color: var(--danger); } .pastille.crit::before { background: var(--danger); }
.pastille.an { color: var(--ink); } .pastille.an::before { background: var(--ok); }

/* Lignes de liste : contenu à même le fond, séparées par une hairline */
.ligne { background: transparent; border: 0; border-bottom: 1px solid var(--hair); padding: 14px 0; width: 100%; text-align: left; }
.body > .ligne:last-child { border-bottom: 0; }
button.ligne:active { background: var(--subtle); }
.ligne .n { font-weight: 600; font-size: 17px; color: var(--ink); }
.ligne .s { color: var(--ink2); font-size: 14px; margin-top: 3px; }
.ligne .row { display: flex; align-items: center; gap: 12px; }
.ligne .row .grow { flex: 1; min-width: 0; }
#identidad { padding-top: 10px; }
.vide { text-align: center; padding: 48px 8px; color: var(--ink2); }
.vide .big { font-size: 34px; margin-bottom: 10px; }

/* Boutons : un seul plein par écran (noir) ; les autres contourés ; le tertiaire en texte souligné */
.bp, .bs, .bt { min-height: var(--tap); border-radius: var(--pill); padding: 10px 18px; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.bp { background: var(--primary); color: var(--primary-ink); min-height: var(--size-primary-btn); }
.bp:active { opacity: 0.85; }
.bp[disabled] { opacity: 0.35; cursor: not-allowed; }
.bs { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.bs:active { background: var(--subtle); }
.bs[disabled] { opacity: 0.35; cursor: not-allowed; }
.bt { background: transparent; color: var(--ink); border: 1px solid var(--border); font-weight: 500; }
.bt:active { background: var(--subtle); }
.bt.danger { color: var(--danger); border-color: var(--border); }
.w { width: 100%; }
.lien { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--border); background: none; font-size: 15px; min-height: var(--tap); }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* Champs */
.champ { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 12px; font-size: 16px; color: var(--ink); min-height: var(--tap); }
.champ::placeholder { color: var(--meta); }
.champ:focus { border-color: var(--ink); outline: 0; }
select.champ { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.selw { position: relative; }
.selw::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 1.5px solid var(--ink2); border-bottom: 1.5px solid var(--ink2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
label.lab { display: block; font-size: 13px; font-weight: 500; color: var(--ink2); margin-bottom: 5px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: var(--pill); overflow: hidden; padding: 0; gap: 0; }
.seg button { flex: 1; min-height: var(--tap); padding: 6px 12px; border-radius: var(--pill); font-size: 15px; font-weight: 500; color: var(--ink2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Sujets récents */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--subtle); border: 1px solid var(--hair); color: var(--ink); border-radius: var(--pill); min-height: var(--tap); padding: 6px 14px; font-size: 14px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:active { background: var(--hair); }

/* Suggestions LOOM */
.sug { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-top: 6px; background: var(--bg); }
.sug button { display: block; width: 100%; text-align: left; border-bottom: 1px solid var(--hair); padding: 11px 12px; font-size: 16px; color: var(--ink); min-height: var(--tap); }
.sug button:last-child { border-bottom: 0; }
.sug button:active { background: var(--subtle); }
.sug .m { font-size: 13px; color: var(--ink2); display: block; margin-top: 1px; }
.sug .h { font-size: 13px; color: var(--meta); font-weight: 500; padding: 8px 12px 6px; background: var(--subtle); border-bottom: 1px solid var(--hair); }
.src { font-size: 13px; color: var(--ink2); margin-left: 6px; }
.src::before { content: "· "; }
.src.off { color: var(--meta); }

/* Fichiers */
.vign { position: relative; aspect-ratio: 1; background: var(--subtle); border: 1px solid var(--hair); border-radius: var(--r); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--meta); font-size: 13px; }
.vign img, .vign video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vign .ver { position: absolute; inset: 0; display: block; }
.vign .tag { position: absolute; left: 6px; bottom: 6px; background: var(--bg); color: var(--ink2); font-size: 12px; font-weight: 500; padding: 2px 7px; border-radius: var(--pill); border: 1px solid var(--hair); }
.vign .tag.warn { color: var(--warn); }
.vign .x { position: absolute; right: 0; top: 0; width: 44px; height: 44px; padding: 6px; background: none; display: flex; align-items: flex-start; justify-content: flex-end; }
.vign .x::before { content: "×"; width: 30px; height: 30px; border-radius: 50%; background: var(--bg); color: var(--ink); border: 1px solid var(--hair); display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; }

/* Carte */
.carte { height: 220px; border-radius: var(--r); border: 1px solid var(--hair); overflow: hidden; background: var(--subtle); position: relative; }
.carte .maplibregl-ctrl-attrib { font-size: 10px; }
.carte .vide-carte { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: var(--ink2); font-size: 14px; }
.pin-centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); width: 24px; height: 24px; pointer-events: none; color: var(--ink); }

/* Voix */
.voix { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 0; text-align: center; }
.rec { width: 76px; height: 76px; border-radius: 50%; background: var(--bg); color: var(--ink); border: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center; }
.rec svg { width: 30px; height: 30px; }
.rec.stop { background: var(--danger); border-color: var(--danger); color: var(--bg); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--hair); } 100% { box-shadow: 0 0 0 16px transparent; } }
.duree { font-family: var(--mono); font-size: 24px; font-weight: 500; color: var(--ink); letter-spacing: 1px; font-variant-numeric: tabular-nums; }
audio { width: 100%; }
.nivel { width: 160px; height: 6px; border-radius: var(--pill); background: var(--hair); overflow: hidden; }
.nivel i { display: block; height: 100%; background: var(--ok); transition: width 0.1s; }
.barre { height: 4px; border-radius: var(--pill); background: var(--hair); overflow: hidden; margin-top: 8px; }
.barre i { display: block; height: 100%; background: var(--ink); transition: width 0.25s; }
.barre.mala i { background: var(--danger); }

/* Icônes */
.i { width: 1.15em; height: 1.15em; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

/* Réseau et toast */
.net { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--meta); }
.net.on { color: var(--ink2); }
#toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--pill); font-size: 14px; font-weight: 500; z-index: 50; max-width: 88vw; text-align: center; display: flex; align-items: center; gap: 12px; }
#toast button { color: var(--bg); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: var(--tap); padding: 0 6px; }

/* Dossier */
.dossier { font-family: var(--mono); font-size: 13px; color: var(--ink); word-break: break-all; }
