@font-face { font-family: 'Nunito'; font-weight: 400; font-display: swap; src: url('../assets/fonts/nunito-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url('../assets/fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url('../assets/fonts/nunito-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url('../assets/fonts/nunito-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 900; font-display: swap; src: url('../assets/fonts/nunito-latin-900-normal.woff2') format('woff2'); }

:root {
  --bg: #FFF7F0;
  --bg-2: #F5F0FF;
  --card: #FFFFFF;
  --ink: #1F1B2E;
  --muted: #6B6580;
  --line: #EEE8F5;
  --track: #EFEAF6;
  --field: #FAF8FD;
  --accent: #8B5CF6;
  --accent-ink: #FFFFFF;
  --ok: #22C55E;
  --warn: #F59E0B;
  --danger: #EF4444;
  --pos: #16A34A;
  --shadow: 0 6px 24px rgba(76, 42, 140, 0.08), 0 1px 3px rgba(76, 42, 140, 0.06);
  --radius: 22px;
  --space: var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15121F; --bg-2: #1C1630; --card: #221C33; --ink: #F4F1FA; --muted: #A8A1BD; --line: #332B48;
    --track: #342C4A; --field: #2A2340; --pos: #4ADE80; --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15121F; --bg-2: #1C1630; --card: #221C33; --ink: #F4F1FA; --muted: #A8A1BD; --line: #332B48;
  --track: #342C4A; --field: #2A2340; --pos: #4ADE80; --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 16px; line-height: 1.45;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg-2), transparent 60%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 980px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 900; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.12rem; margin-bottom: 12px; }
h3 { font-size: 1rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; }
.pos { color: var(--pos); }
.neg { color: var(--danger); }
.big { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.02em; }
.stack { display: grid; gap: 16px; }
[hidden] { display: none !important; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.empty { text-align: center; padding: 32px 20px; }
.card.empty.small { padding: 22px; }
.empty-emoji { font-size: 3rem; margin-bottom: 8px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 800; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, var(--space), color-mix(in srgb, var(--space) 70%, #F472B6)); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--space) 35%, transparent); }
.btn.ghost { background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 0.9rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 8px; text-decoration: underline; text-underline-offset: 3px; }
.link.small { font-size: .88rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--field); cursor: pointer; font-size: 1.1rem; display: inline-grid; place-items: center; flex: none; }
.icon-btn.subtle { background: transparent; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.actions.center { justify-content: center; }
.actions.sticky { position: sticky; bottom: -1px; background: var(--card); padding: 12px 0 4px; margin-top: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* Champs */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field-label { font-weight: 800; font-size: .88rem; color: var(--muted); display: block; margin-bottom: 6px; }
.field .field-label { margin-bottom: 0; }
input:not([type=range]):not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--field); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.hint { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Marque, connexion */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand-logo { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: linear-gradient(135deg, #F472B6, #8B5CF6); box-shadow: 0 6px 14px rgba(139, 92, 246, .35); }
.auth { max-width: 460px; margin: 0 auto; display: grid; gap: 16px; padding-top: 4vh; }
.auth-hero { text-align: center; display: grid; gap: 10px; justify-items: center; }
.auth-emojis { font-size: 1.6rem; letter-spacing: .25em; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .btn.block { margin-top: 6px; }
.auth-card .link { display: block; margin: 8px auto 0; }
.demo-banner { background: #FEF3C7; color: #78350F; border-radius: 16px; padding: 10px 14px; font-size: .88rem; font-weight: 600; }
.identity { display: grid; }
.identity .avatar.xl { justify-self: center; margin-bottom: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.swatch.on { border-color: var(--ink); transform: scale(1.1); }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.emoji-btn { aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--line); background: var(--field); font-size: 1.4rem; cursor: pointer; }
.emoji-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--field)); }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.4rem; border: 3px solid var(--card); box-shadow: var(--shadow); cursor: pointer; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 1rem; border-width: 2px; cursor: default; }
.avatar.xl { width: 84px; height: 84px; font-size: 2.6rem; cursor: default; }
.members { list-style: none; padding: 0; display: grid; gap: 8px; }
.members li { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.code { font-size: 1.3rem; letter-spacing: .2em; background: var(--field); padding: 2px 10px; border-radius: 10px; }

/* Accueil */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.hello { margin: 12px 0 22px; }
.hello p { margin: 6px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
.tile {
  position: relative; aspect-ratio: 1 / 0.92; border-radius: 28px; padding: 18px; color: #fff; text-decoration: none;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  box-shadow: 0 10px 24px rgba(31, 27, 46, .14); transition: transform .18s cubic-bezier(.3,1.6,.6,1);
}
.tile::after { content: ''; position: absolute; width: 140px; height: 140px; right: -40px; bottom: -50px; border-radius: 50%; background: rgba(255,255,255,.18); }
a.tile:hover { transform: translateY(-3px) rotate(-1deg); }
a.tile:active { transform: scale(.97); }
.tile-emoji { font-size: 2.6rem; filter: drop-shadow(0 4px 6px rgba(0,0,0,.15)); }
.tile-label { font-weight: 900; font-size: 1.2rem; position: relative; z-index: 1; }
.tile.soon { filter: saturate(.55); opacity: .75; }
.tile-badge { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.3); padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; }

/* Outil */
.tool-head { display: grid; gap: 14px; margin-bottom: 14px; }
.tool-title { display: flex; align-items: center; gap: 10px; }
.back { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); text-decoration: none; font-size: 1.6rem; font-weight: 700; line-height: 1; padding-bottom: 3px; }
.space-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.space-pill {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 18px; border: 2px solid transparent; cursor: pointer; text-align: left;
  background: var(--card); box-shadow: var(--shadow); transition: all .15s;
}
.space-pill strong { display: block; font-weight: 900; }
.space-pill small { color: var(--muted); font-weight: 700; }
.space-pill.on { border-color: var(--pill); background: color-mix(in srgb, var(--pill) 12%, var(--card)); }
.pill-emoji { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--pill); font-size: 1.2rem; flex: none; }
.tabs { display: flex; gap: 6px; background: var(--card); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; white-space: nowrap; text-align: center; padding: 9px 12px; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: .92rem; color: var(--muted); }
.tab.on { background: var(--space); color: #fff; }
@media (max-width: 520px) {
  .tabs { border-radius: 22px; }
  .tab { display: grid; justify-items: center; gap: 0; font-size: .76rem; padding: 6px 2px; border-radius: 16px; }
  .tab span { font-size: 1.15rem; }
}

.month-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.month-label { min-width: 160px; text-align: center; font-size: 1.1rem; text-transform: capitalize; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--card); border-radius: 20px; padding: 14px; box-shadow: var(--shadow); display: grid; gap: 2px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--ok); }
.kpi[data-tone="out"]::before { background: #F472B6; }
.kpi-emoji { font-size: 1.2rem; }
.kpi-label { color: var(--muted); font-weight: 700; font-size: .82rem; }
.kpi-value { font-size: 1.25rem; font-weight: 900; letter-spacing: -0.02em; }
@media (max-width: 420px) { .kpi { padding: 12px 10px; } .kpi-value { font-size: 1.05rem; } }

.rav { display: flex; align-items: center; gap: 16px; }
.ring-text { font-weight: 900; font-size: 15px; fill: var(--ink); }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li { padding: 10px 14px; border-radius: 14px; font-weight: 700; background: var(--field); }
.alerts li[data-level="danger"] { background: color-mix(in srgb, var(--danger) 12%, var(--card)); }
.alerts li[data-level="warning"] { background: color-mix(in srgb, var(--warn) 14%, var(--card)); }
.alerts a { text-decoration: none; }

.donut-wrap { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 18px; align-items: center; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .legend { width: 100%; } }
.donut { width: 100%; max-width: 210px; height: auto; }
.donut-seg { transition: stroke-width .2s; }
.donut-center { font-weight: 900; font-size: 22px; fill: var(--ink); }
.donut-sub { font-weight: 700; font-size: 12px; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; font-weight: 700; }
.legend-value { color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.in { background: var(--ok); } .dot.out { background: #F472B6; }

.untouched summary { cursor: pointer; font-weight: 700; color: var(--muted); margin-top: 14px; }
.untouched .compare { margin-top: 12px; }
.compare { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.compare-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; margin-bottom: 6px; }
.compare-values { color: var(--muted); white-space: nowrap; }
.compare-values strong { color: var(--ink); }
.gauge { height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 999px; background: var(--ok); transition: width .5s cubic-bezier(.3,1.3,.6,1); }
.gauge[data-status="attention"] .gauge-fill { background: var(--warn); }
.gauge[data-status="depasse"] .gauge-fill { background: var(--danger); }

.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; height: 170px; align-items: end; }
.bar-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; }
.bar-pair { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 100%; }
.bar { width: 40%; max-width: 22px; border-radius: 8px 8px 3px 3px; min-height: 2px; }
.bar.in { background: var(--ok); } .bar.out { background: #F472B6; }
.bar-label { font-size: .75rem; text-align: center; color: var(--muted); font-weight: 700; text-transform: capitalize; }
.bars-legend { display: flex; gap: 8px; align-items: center; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.bars-legend .dot + * { margin-right: 6px; }

/* Prévisionnel */
.plan-intro { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.plan-intro p { margin: 0; }
.saved-badge { font-size: .8rem; font-weight: 800; color: var(--pos); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.saved-badge.show { opacity: 1; }
.plan-lines { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.plan-lines li { display: grid; grid-template-columns: 44px 1fr 120px 36px; gap: 8px; align-items: center; }
@media (max-width: 480px) { .plan-lines li { grid-template-columns: 40px 1fr 112px 30px; gap: 6px; } .amount-input { padding-left: 8px !important; } }
.amount-wrap { display: flex; align-items: center; gap: 4px; font-weight: 800; color: var(--muted); }
.amount-input { text-align: right; padding-right: 8px !important; }
.cat-chip { width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; font-size: 1.25rem; background: color-mix(in srgb, var(--chip, var(--accent)) 22%, var(--card)); }
.cat-chip.wide { width: 100%; min-height: 46px; font-size: 1rem; font-weight: 800; text-align: left; padding: 0 14px; }
.equation { display: flex; align-items: stretch; justify-content: center; gap: 8px; flex-wrap: wrap; }
.eq-box { flex: 1 1 120px; border-radius: 18px; padding: 12px; text-align: center; display: grid; gap: 2px; background: var(--field); }
.eq-box[data-tone="in"] { background: color-mix(in srgb, var(--ok) 14%, var(--card)); }
.eq-box[data-tone="fixed"] { background: color-mix(in srgb, #6366F1 14%, var(--card)); }
.eq-box[data-tone="rest"] { background: linear-gradient(135deg, color-mix(in srgb, #F472B6 22%, var(--card)), color-mix(in srgb, #8B5CF6 22%, var(--card))); }
.eq-box[data-tone="out"] { background: color-mix(in srgb, var(--danger) 16%, var(--card)); }
.eq-box strong { font-size: 1.3rem; font-weight: 900; }
.eq-box small { font-weight: 700; color: var(--muted); }
.eq-emoji { font-size: 1.3rem; }
.eq-op { align-self: center; font-size: 1.6rem; font-weight: 900; color: var(--muted); }
@media (max-width: 480px) { .eq-op { display: none; } .eq-box { flex-basis: 30%; padding: 10px 6px; } .eq-box strong { font-size: 1.05rem; } }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.split-pie { display: grid; justify-items: center; margin: 6px 0 12px; }
.split-pie .donut { max-width: 180px; }
.split-pie p { margin: 8px 0 0; font-weight: 700; }
.split-group { margin-top: 14px; }
.split-group h3 { margin-bottom: 8px; }
.split-row { display: grid; grid-template-columns: minmax(130px, 1.2fr) 2fr 48px 70px; gap: 10px; align-items: center; padding: 6px 0; }
@media (max-width: 560px) { .split-row { grid-template-columns: 1fr 48px 64px; row-gap: 2px; } .split-row input { grid-column: 1 / -1; grid-row: 2; } }
.split-label { font-weight: 700; }
.split-pct { font-weight: 900; text-align: right; }
.split-amount { color: var(--muted); font-weight: 700; text-align: right; font-size: .9rem; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 25%, var(--track)); }
input[type=range]::-moz-range-track { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 25%, var(--track)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -8px; border-radius: 50%; background: var(--c); border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--c); border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

/* Opérations */
.op-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.op-actions .btn { flex: 1 1 180px; }
.op-actions + p { margin: -6px 0 0; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .filters { grid-template-columns: 1fr; } }
.day-title { font-size: .85rem; color: var(--muted); text-transform: capitalize; margin: 4px 6px 8px; font-weight: 800; }
.op-list { display: grid; gap: 14px; }
.ops { list-style: none; margin: 0; padding: 4px 6px; }
.op { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.op:last-child { border-bottom: 0; }
.op.excluded { opacity: .5; }
.op-cat { width: 44px; height: 44px; border-radius: 14px; border: 0; display: grid; place-items: center; font-size: 1.3rem; cursor: pointer; box-shadow: inset 0 0 0 100px rgba(255,255,255,.55); }
:root[data-theme="dark"] .op-cat { box-shadow: inset 0 0 0 100px rgba(0,0,0,.35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .op-cat { box-shadow: inset 0 0 0 100px rgba(0,0,0,.35); } }
.op-main { display: grid; min-width: 0; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.op-label { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-sub { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-amount { font-weight: 900; white-space: nowrap; }
.op-amount.pos { color: var(--pos); }
.detail { word-break: break-word; background: var(--field); padding: 8px 12px; border-radius: 12px; }

.import-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.import-summary > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.import-summary .big { background: linear-gradient(135deg, #F472B6, #8B5CF6); color: #fff; border-radius: 18px; padding: 6px 16px; }
.checks { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; font-weight: 700; font-size: .9rem; }
.import-list { max-height: 48vh; overflow: auto; box-shadow: inset 0 0 0 1.5px var(--line); }

/* Objectifs */
.goals { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.goal { border-top: 6px solid var(--goal); }
.goal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.goal-emoji { font-size: 2rem; }
.goal-title { flex: 1; min-width: 0; }
.goal-body { display: flex; align-items: center; gap: 16px; }
.goal-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.history ul { padding-left: 18px; margin: 8px 0; }
.history summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }

/* Fenêtres */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(31, 27, 46, .4); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.overlay.open { opacity: 1; }
.sheet {
  background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow: auto;
  border-radius: 28px 28px 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(30px); transition: transform .25s cubic-bezier(.3,1.3,.6,1);
}
.sheet.wide { max-width: 720px; }
.overlay.open .sheet { transform: none; }
@media (min-width: 640px) { .overlay { align-items: center; } .sheet { border-radius: 28px; padding-bottom: 20px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -8px; background: var(--card); padding: 12px 0; z-index: 1; }
.sheet-head h2 { margin: 0; }
.confirm-text { font-weight: 700; font-size: 1.05rem; }
.pick-group { margin: 14px 0 8px; font-size: .92rem; color: var(--muted); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cat-pick { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 14px; border: 2px solid transparent; background: color-mix(in srgb, var(--c) 14%, var(--card)); cursor: pointer; font-weight: 700; text-align: left; font-size: .9rem; }
.cat-pick.on { border-color: var(--c); }
.cat-pick-emoji { font-size: 1.3rem; }

/* Messages */
.toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); z-index: 100; transform: translate(-50%, -30px);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: all .25s cubic-bezier(.3,1.3,.6,1); max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-type="error"] { background: var(--danger); color: #fff; }
.toast[data-type="warn"] { background: var(--warn); color: #1F1B2E; }
.confetti { position: fixed; z-index: 120; width: 9px; height: 13px; border-radius: 3px; pointer-events: none; animation: confetti 1s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
