:root{--rouge:#a01414;--vert:#1b7a3d;--orange:#e08512;--refus:#d32f2f;--bleu:#2f6fb0;--bg:#faf7f5;--bord:#e5ddd8;}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
body{margin:0;font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:#1a1a1a;}
#app{max-width:520px;margin:0 auto;min-height:100vh;}
button{font-family:inherit;cursor:pointer;}
input,select,textarea{font-family:inherit;font-size:16px;}

/* header */
.hd{background:var(--rouge);color:#fff;padding:14px 16px;position:sticky;top:0;z-index:20;display:flex;justify-content:space-between;align-items:center;}
.hd small{opacity:.85;font-size:12px;}
.hd b{font-size:17px;display:block;}
.hd .g{background:rgba(255,255,255,.18);border:none;color:#fff;width:38px;height:38px;border-radius:10px;font-size:18px;}

/* login / setup */
.auth{min-height:100vh;background:var(--rouge);color:#fff;display:flex;flex-direction:column;justify-content:center;padding:24px;}
.auth h1{font-size:28px;font-weight:900;margin:6px 0 24px;line-height:1.1;}
.auth label{font-size:13px;font-weight:700;display:block;margin:14px 0 6px;}
.auth input{width:100%;padding:14px;border-radius:10px;border:none;}
.auth button{margin-top:24px;padding:16px;font-size:18px;font-weight:800;border:none;border-radius:12px;background:#fff;color:var(--rouge);}
.auth .err{background:rgba(0,0,0,.2);padding:10px;border-radius:8px;margin-top:14px;font-size:14px;}

/* progress */
.card{background:#fff;border-radius:16px;padding:16px;box-shadow:0 1px 3px rgba(0,0,0,.06);margin:8px 16px;}
.big{display:flex;justify-content:space-between;align-items:baseline;}
.big .v{font-size:26px;font-weight:900;}
.bar{height:10px;background:#eee;border-radius:6px;overflow:hidden;margin:10px 0 4px;}
.bar>i{display:block;height:100%;background:var(--rouge);transition:width .3s;}
.mut{color:#888;font-size:12px;}

/* rows */
.row{width:100%;display:flex;justify-content:space-between;align-items:center;padding:14px 12px;margin:0 0 6px;background:#fff;border:1px solid #eee;border-radius:12px;text-align:left;}
.row b{font-size:15px;}
.pill{font-size:11px;font-weight:800;padding:3px 8px;border-radius:20px;}
.list{padding:4px 12px;}

/* legende + grille numéros */
.leg{display:flex;gap:12px;padding:0 16px 4px;flex-wrap:wrap;font-size:11px;color:#666;align-items:center;}
.leg span{display:inline-flex;align-items:center;gap:5px;}
.leg i{width:13px;height:13px;border-radius:4px;display:inline-block;}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:8px;padding:12px;}
.num{padding:14px 4px;border-radius:10px;border:1.5px solid var(--bord);background:#fff;color:#1a1a1a;font-weight:800;font-size:17px;min-height:58px;}
.num small{display:block;font-size:10px;font-weight:600;}
.num.done{border:none;color:#fff;}

/* barre navigation */
.nav{position:fixed;bottom:0;left:0;right:0;max-width:520px;margin:0 auto;display:flex;background:#fff;border-top:1px solid var(--bord);}
.nav button{flex:1;padding:10px 0 14px;border:none;background:none;color:#aaa;font-weight:800;font-size:12px;}
.nav button.on{color:var(--rouge);}
.nav button div{font-size:20px;}
.pad{padding-bottom:76px;}

/* feuille modale */
.sheet-bg{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:50;display:flex;align-items:flex-end;justify-content:center;}
.sheet{background:#fff;width:100%;max-width:520px;border-radius:20px 20px 0 0;padding:20px;max-height:88vh;overflow-y:auto;}
.sheet .drag{width:40px;height:4px;background:#ddd;border-radius:2px;margin:0 auto 16px;}
.modes{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:14px;}
.modes button{padding:12px 4px;border-radius:10px;border:1.5px solid var(--bord);background:#fff;font-weight:700;font-size:14px;color:#555;display:flex;flex-direction:column;align-items:center;gap:5px;}
.modes button.sel{border:2px solid var(--rouge);background:#fbeaea;color:var(--rouge);}
.modes i{width:12px;height:12px;border-radius:4px;}
.chips{display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap;}
.chips button{flex:1 0 auto;min-width:56px;padding:10px 0;border-radius:8px;border:1.5px solid var(--bord);background:#fff;font-weight:800;}
.chips button.sel{background:var(--rouge);color:#fff;}
.fld{width:100%;padding:13px 14px;border-radius:10px;border:1.5px solid var(--bord);margin-bottom:6px;}
.btn{width:100%;padding:15px;border-radius:12px;border:none;background:var(--rouge);color:#fff;font-weight:800;font-size:16px;}
.btn.o{background:#fff;border:2px solid var(--rouge);color:var(--rouge);}
.btn:disabled{opacity:.5;}
.two{display:flex;gap:10px;}
.two>*{flex:1;}
.back{background:#fff;border:1.5px solid var(--bord);width:40px;height:40px;border-radius:10px;font-size:24px;color:var(--rouge);font-weight:800;line-height:1;}
h2.t{font-size:17px;font-weight:800;margin:0;}
.sub{padding:12px 16px;display:flex;align-items:center;gap:10px;position:sticky;top:62px;background:var(--bg);z-index:10;}
.secline{background:#fff;border:1px solid #eee;border-radius:12px;padding:12px;margin-bottom:8px;}
.secline.moi{background:#fff5f5;border:1.5px solid var(--rouge);}
