:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#14283f;background:#eef4f6}*{box-sizing:border-box}body{margin:0}.shell{max-width:650px;margin:auto;min-height:100dvh;background:#f7fafb;padding:24px 18px 90px}header{display:flex;align-items:center;justify-content:space-between}header small{font-size:11px;letter-spacing:2px;color:#6e8490}h1{font-size:27px;margin:4px 0 20px}h2{font-size:17px;margin:23px 0 13px}.logo{background:#dff5f0;color:#087f84;border-radius:50%;width:42px;height:42px;display:grid;place-items:center;font-weight:800}.hero{background:linear-gradient(120deg,#0d777c,#123c52);color:white;padding:23px;border-radius:22px;display:flex;flex-direction:column;gap:9px;box-shadow:0 9px 22px #16455a24}.hero strong{font-size:37px}.hero small{color:#d3efed}nav{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin:22px 0 10px;background:#e8eff2;border-radius:13px;padding:5px}button{font:inherit;cursor:pointer;border:0}nav button{padding:11px 3px;background:transparent;border-radius:10px;color:#607580;font-size:12px}nav button.active{background:white;color:#0d777c;font-weight:750;box-shadow:0 1px 5px #0001}.cards{display:grid;grid-template-columns:repeat(2,1fr);gap:11px}.card,.panel,.entry{background:white;border-radius:16px;padding:17px;box-shadow:0 2px 12px #0c3c5010}.card small{color:#607580}.card strong{display:block;font-size:23px;margin:12px 0}.card .sub{font-size:12px;color:#7b8e98}.bar{height:8px;border-radius:12px;background:#e6eff0;overflow:hidden;margin-top:13px}.bar i{display:block;background:#1ab09e;height:100%;border-radius:12px}.card.over i{background:#dd755f}.card.over strong{color:#b74432}.panel{margin-bottom:12px}.saver,.metric,.entry{display:flex;align-items:center;justify-content:space-between;gap:10px}.saver span,.metric span{color:#637783;font-size:13px}.metric{padding:12px 0;border-bottom:1px solid #edf1f3}.metric:last-child{border:0}.entry{margin-bottom:8px}.entry small{display:block;color:#7b8e98;margin-top:4px}.entry b{white-space:nowrap}.entry button{background:#fff0ee;color:#a84335;border-radius:8px;padding:8px}.hidden{display:none}label{display:block;font-size:13px;font-weight:650;margin-bottom:15px}input,select{display:block;margin-top:7px;width:100%;font:inherit;font-size:16px;padding:13px;border:1px solid #d5e2e5;border-radius:11px;background:white;color:#14283f}.primary,.secondary{width:100%;padding:14px;border-radius:12px;font-weight:700}.primary{background:#0b8185;color:white}.secondary{background:#e3f3f2;color:#07696e}.note{color:#6b7e87;font-size:12px;line-height:1.6}.fab{position:fixed;bottom:22px;right:max(20px,calc((100vw - 650px)/2 + 22px));background:#0b8185;color:white;width:57px;height:57px;border-radius:50%;font-size:30px;box-shadow:0 7px 18px #0b818544}#toast{position:fixed;bottom:84px;left:50%;transform:translateX(-50%);background:#14283f;color:white;padding:10px 17px;border-radius:12px;display:none;white-space:nowrap;font-size:13px}
/* Enveloppes interactives */
.envelope{display:block;text-align:left;width:100%;font:inherit;color:inherit;cursor:pointer;border:1px solid #e3edf0;transition:transform .15s,box-shadow .15s}.envelope:active{transform:scale(.985)}.envelope:focus-visible{outline:3px solid #0b8185;outline-offset:2px}.envelope-top,.envelope-bottom{display:flex;justify-content:space-between;align-items:center;gap:6px}.envelope-name{font-size:14px;font-weight:750}.percent{font-size:11px;font-weight:750;color:#087f84;background:#e5f7f3;border-radius:7px;padding:5px;white-space:nowrap}.percent.warning{color:#975500;background:#fff0d7}.percent.danger{color:#b74432;background:#ffebe6}.envelope strong{font-size:25px;margin:13px 0 1px}.envelope .sub{margin-bottom:14px}.envelope-bottom{font-size:11px;color:#637783}.bar i.warning{background:#e9a04b}.bar i.danger{background:#dd755f}.view-detail{font-size:12px;color:#087f84;font-weight:700;margin-top:12px}.back{background:transparent;color:#087f84;padding:6px 0;font-weight:700}.detail-summary{display:flex;flex-direction:column;gap:7px}.detail-summary strong{font-size:28px}.detail-summary span{color:#637783;font-size:13px}@media(max-width:390px){.cards{grid-template-columns:1fr}}

.month-picker{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:16px 0 8px;background:white;border-radius:16px;padding:8px 12px;box-shadow:0 2px 12px #0c3c5010;text-align:center}
.month-picker button{font-size:28px;width:43px;height:43px;border-radius:12px;background:#e2f3f1;color:#087f84}
.month-picker strong{display:block;text-transform:capitalize;font-size:17px}
.month-picker small{display:block;color:#718690;font-size:11px;margin-top:4px}

/* Couleurs dynamiques selon le pourcentage consommé */
.envelope .bar i{background:#20b69f;transition:width .25s ease,background-color .25s ease}
.envelope .bar i.yellow{background:#e9b949}
.envelope .bar i.orange{background:#ef913f}
.envelope .bar i.danger{background:#dc4545}
.envelope .percent.yellow{color:#795b05;background:#fff5d4}
.envelope .percent.orange{color:#975000;background:#ffebd6}
.envelope .percent.danger{color:#b32727;background:#ffe4e4}

/* V7 — Thème sombre et accents orange fauve */
:root{color-scheme:dark;--fauve:#C46A32;--fauve-light:#EAA16A;--bg:#0B0D10;--surface:#181B20;--surface-2:#24282F;--text:#F2F0ED;--muted:#B5B4B1}
html,body{background:var(--bg);color:var(--text)}
.shell{background:var(--bg);color:var(--text)}
header small,.note,.entry small,.card small,.card .sub,.envelope-bottom,.detail-summary span,.month-picker small,.saver span,.metric span{color:var(--muted)}
.logo{background:#332318;color:var(--fauve-light)}
.hero{background:linear-gradient(120deg,#7B3F1F,#3B241A);color:#FFF8F2;box-shadow:0 9px 22px #0005}
.hero small{color:#F2C9AB}
nav{background:var(--surface-2)}
nav button{color:#C9C3BD}
nav button.active{background:#423024;color:var(--fauve-light);box-shadow:none}
.card,.panel,.entry,.month-picker{background:var(--surface);box-shadow:0 2px 14px #0003;color:var(--text)}
.envelope{border-color:#393332}
.envelope:focus-visible{outline-color:var(--fauve-light)}
.bar{background:#383C43}
.bar i,#savingBar{background:var(--fauve)}
.percent{background:#39281E;color:var(--fauve-light)}
.view-detail,.back{color:var(--fauve-light)}
.month-picker button{background:#3A2A20;color:var(--fauve-light)}
input,select{background:#24282F;color:var(--text);border-color:#454A50}
input::placeholder{color:#A6A9AD}
.primary,.fab{background:var(--fauve);color:#14100D;box-shadow:0 7px 18px #0005}
.secondary{background:#3A2A20;color:var(--fauve-light)}
.metric{border-bottom-color:#383C43}
.entry button{background:#422A27;color:#FFB1A1}
#toast{background:#36251D;color:#FFF4EC}
/* Les alertes de consommation restent jaune/orange/rouge pour être identifiables. */
.envelope .bar i{background:var(--fauve)}
.envelope .bar i.yellow{background:#E9B949}
.envelope .bar i.orange{background:#EF913F}
.envelope .bar i.danger{background:#EF6262}
.envelope .percent.yellow{background:#403518;color:#F5D17A}
.envelope .percent.orange{background:#442B1C;color:#FFAE6D}
.envelope .percent.danger{background:#492327;color:#FF9999}
.envelope.over strong,.card.over strong{color:#FF9999}

/* V8 : couleurs de progression originales, même en mode sombre */
.envelope .bar i{background:#20B69F}
.envelope .bar i.yellow{background:#E9B949}
.envelope .bar i.orange{background:#EF913F}
.envelope .bar i.danger{background:#DC4545}

.sync-panel{margin:12px 0 16px}.sync-panel form{display:grid;gap:10px}.sync-panel input{width:100%}.sync-panel #syncControls{display:flex;flex-wrap:wrap;gap:9px}.sync-panel #syncControls.hidden{display:none}.sync-panel #syncControls .note{width:100%}.sync-panel h2{margin-top:0}
