/* Budget du foyer — « cahier d'écolier joyeux » : papier, couleurs franches, surligneur, post-it */
:root {
  --paper: #fbf5e9;
  --sheet: #fffdf8;
  --rule: #efe5d2;
  --rule-strong: #ddcfb3;
  --ink: #23304d;
  --ink-soft: #4b5674;
  --muted: #847b6b;
  --sky: #3d8bfd;
  --sun: #ffc83d;
  --coral: #ff6b5b;
  --mint: #12b07a;
  --grape: #8b5cf6;
  --orange: #ff9a1f;
  --red: #e5484d;
  --highlight: #ffe36e;
  --vital: var(--sky);
  --utile: var(--sun);
  --superflu: var(--coral);
  --inconnu: #b7ae9c;
  --revenu: var(--mint);
  --epargne: var(--grape);
  --accent: var(--mint);
  --accent-soft: #dcf5ea;
  --round: "Nunito", "Quicksand", "Varela Round", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171c2b;
    --sheet: #1f2638;
    --rule: #2c3550;
    --rule-strong: #3d4766;
    --ink: #f4efe4;
    --ink-soft: #d0c9ba;
    --muted: #a39b8b;
    --highlight: #8a6d00;
    --accent-soft: #163b30;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--round); font-weight: 800; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
a { color: var(--sky); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.pos { color: var(--mint); }
.hint { font-size: .85rem; color: var(--muted); margin: .5rem 0 0; }
.hl { background: linear-gradient(transparent 52%, var(--highlight) 52%, var(--highlight) 92%, transparent 92%); padding: 0 .1em; }

/* ---------- En-tête ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 960px; margin: 0 auto; padding: 14px 16px 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--round); font-size: 1.25rem; font-weight: 800; }
.brand img { display: block; transform: rotate(-6deg); }
.player-chip { font-family: var(--round); font-weight: 800; font-size: .85rem; background: var(--sun); color: #3a2c00; padding: 4px 12px; border-radius: 999px; box-shadow: 0 2px 0 #d9a514; }

/* ---------- Onglets ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--sheet); border-top: 1px solid var(--rule-strong);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 0; background: none; padding: 6px 2px; min-height: 54px; cursor: pointer; border-radius: 14px;
  font-family: var(--round); font-weight: 700; font-size: .72rem; color: var(--muted);
}
.tabs svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs button[data-tab=mois][aria-current="page"] { background: color-mix(in srgb, var(--sky) 18%, transparent); color: #1f5fc4; }
.tabs button[data-tab=projets][aria-current="page"] { background: color-mix(in srgb, var(--sun) 32%, transparent); color: #8a6100; }
.tabs button[data-tab=analyse][aria-current="page"] { background: color-mix(in srgb, var(--coral) 18%, transparent); color: #c43d2f; }
.tabs button[data-tab=quetes][aria-current="page"] { background: color-mix(in srgb, var(--grape) 16%, transparent); color: #6b3fd6; }
.tabs button[data-tab=operations][aria-current="page"] { background: color-mix(in srgb, var(--mint) 18%, transparent); color: #0b7c56; }
@media (prefers-color-scheme: dark) { .tabs button[aria-current="page"] { color: var(--ink) !important; } }
@media (min-width: 900px) {
  body { padding-bottom: 32px; }
  .tabs { position: static; max-width: 928px; margin: 4px auto 10px; background: transparent; border: 0; padding: 0; gap: 8px; }
  .tabs button { flex-direction: row; justify-content: center; gap: 8px; font-size: 1rem; min-height: 46px; background: var(--sheet); border: 1px solid var(--rule); }
  .tabs svg { width: 19px; height: 19px; }
}

main { max-width: 960px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- Feuilles ---------- */
.card {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; min-width: 0; box-shadow: 0 2px 0 var(--rule);
}
.card > h2:first-child, .card > .row:first-child > h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.grid > .card { margin-bottom: 0; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.section { margin-bottom: 14px; }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.row > * { min-width: 0; }
.stack { display: grid; gap: 8px; }
.eyebrow { font-family: var(--round); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 800; }

/* ---------- Reste libre : la page du mois ---------- */
.hero { position: relative; padding: 22px 16px 18px; overflow: hidden; }
.hero::before { /* ruban adhésif multicolore */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px;
  background: linear-gradient(90deg, var(--sky) 0 25%, var(--sun) 25% 50%, var(--coral) 50% 75%, var(--mint) 75%);
}
.hero .big {
  font-family: var(--round); font-size: clamp(2.4rem, 12vw, 3.6rem); font-weight: 900; letter-spacing: -.02em;
  display: inline-block; line-height: 1.1; margin: 6px 0 4px; font-variant-numeric: tabular-nums;
  background: linear-gradient(transparent 55%, var(--highlight) 55%, var(--highlight) 90%, transparent 90%);
  padding: 0 .12em;
}
.hero.negative .big { color: var(--red); background: linear-gradient(transparent 55%, #ffd2cf 55%, #ffd2cf 90%, transparent 90%); }
.ledger { display: grid; grid-template-columns: 1fr auto; margin-top: 12px; font-size: .95rem; }
.ledger span { padding: 6px 0; border-bottom: 1px dashed var(--rule-strong); }
.ledger span:nth-child(even) { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger span:nth-child(2) { color: var(--mint); }
.month-track { position: relative; height: 12px; margin-top: 16px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.month-track > div { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: repeating-linear-gradient(-45deg, var(--sky) 0 8px, #6aa8ff 8px 16px); }

/* ---------- Jauges du mois ---------- */
.gauge { display: grid; gap: 6px; padding: 11px 0; border-bottom: 1px dashed var(--rule-strong); cursor: pointer; }
.gauge:last-child { border-bottom: 0; }
.gauge .label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.gauge .bar { position: relative; height: 14px; background: var(--rule); border-radius: 999px; }
.gauge .fill { height: 100%; background: var(--mint); border-radius: 999px; transition: width .6s cubic-bezier(.2,.8,.2,1.2); max-width: 100%; }
.gauge.attention .fill { background: var(--orange); }
.gauge.depasse .fill { background: var(--red); }
.gauge .pace { position: absolute; top: -5px; bottom: -5px; width: 3px; border-radius: 3px; background: var(--ink); }
.status { font-family: var(--round); font-size: .72rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.status.ok { background: #d7f5e8; color: #0b7c56; }
.status.attention { background: #ffe8c7; color: #a35a00; }
.status.depasse { background: #ffd9d6; color: #b42c22; }

.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--inconnu); }
.dot.vital { background: var(--vital); }
.dot.utile { background: var(--utile); }
.dot.superflu { background: var(--superflu); }
.dot.revenu { background: var(--revenu); }
.dot.epargne { background: var(--epargne); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--rule-strong); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- Graphiques ---------- */
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font-family: var(--sans); font-size: 11px; }
svg.chart text.strong { fill: var(--ink); font-weight: 700; }
svg.chart text.mono { font-variant-numeric: tabular-nums; font-weight: 700; }
svg.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
svg.chart .zero { stroke: var(--ink-soft); stroke-dasharray: 3 4; }
.n-vital { fill: var(--vital); }
.n-utile { fill: var(--utile); }
.n-superflu { fill: var(--superflu); }
.n-inconnu { fill: var(--inconnu); }
.n-revenu { fill: var(--revenu); }
.n-epargne { fill: var(--epargne); }
.s-vital { stroke: var(--vital); }
.s-utile { stroke: var(--utile); }
.s-superflu { stroke: var(--superflu); }
.s-inconnu { stroke: var(--inconnu); }
svg .bar-bg { fill: var(--rule); }
svg .budget-tick { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
svg .income-line { stroke: var(--mint); stroke-width: 2.5; fill: none; stroke-dasharray: 6 4; stroke-linecap: round; }
svg .line { stroke: var(--grape); stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; }
svg .area { fill: color-mix(in srgb, var(--grape) 14%, transparent); }
svg .pt { fill: var(--sheet); stroke: var(--grape); stroke-width: 2.5; }
svg .ring-bg { stroke: var(--rule); fill: none; }
svg .ring-total { stroke: var(--mint); fill: none; stroke-linecap: round; }
svg .ring-month { stroke: var(--coral); fill: none; stroke-linecap: round; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.donut-wrap { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 18px; align-items: center; }
@media (max-width: 400px) { .donut-wrap { grid-template-columns: 1fr; } .donut-wrap svg { max-width: 220px; margin: 0 auto; } }
.split { display: grid; gap: 8px; }
.split .row { border-bottom: 1px dashed var(--rule-strong); padding-bottom: 6px; align-items: center; }
.split .label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
svg[data-chart=donut] { max-width: 230px; }
svg[data-chart=categories] { max-width: 600px; }
svg[data-chart=months], svg[data-chart=projection] { max-width: 640px; }
svg[data-chart=ring] { max-width: 96px; }

/* ---------- Chiffres clés : trois post-it ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { padding: 10px 12px; min-width: 0; border-radius: 10px; color: #2b2410; }
.kpi:nth-child(1) { background: #d7f5e8; }
.kpi:nth-child(2) { background: #ffe0dc; }
.kpi:nth-child(3) { background: #fff1b8; }
.kpi b { display: block; font-family: var(--round); font-weight: 900; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .72rem; font-weight: 700; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }

.oom { border: 0; box-shadow: none; background: #fff1b8; color: #2b2410; transform: rotate(-.6deg); }
.oom:nth-child(2n) { background: #dbeaff; transform: rotate(.5deg); }
.oom:nth-child(3n) { background: #ffe0dc; }
.oom:nth-child(4n) { background: #d7f5e8; }
.oom b { font-family: var(--round); font-weight: 800; }
.oom ul { margin: 6px 0 0; padding-left: 18px; }
.oom li { margin: 2px 0; }

.tag { display: inline-block; font-family: var(--round); font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: var(--rule); color: var(--ink-soft); vertical-align: 1px; text-transform: uppercase; }
.tag.warn { background: #ffe8c7; color: #a35a00; }
.tag.red { background: #ffd9d6; color: #b42c22; }

/* ---------- Enveloppes : des post-it ---------- */
.goal-card { border: 0; box-shadow: 0 6px 14px -8px rgb(60 40 0 / 35%); position: relative; color: #2b2410; }
.goal-card::before { /* bout de scotch */
  content: ""; position: absolute; top: -9px; left: 50%; width: 70px; height: 20px; margin-left: -35px;
  background: rgb(255 255 255 / 55%); border: 1px solid rgb(0 0 0 / 6%); transform: rotate(-3deg);
}
.goal-card:nth-child(4n+1) { background: #fff1b8; transform: rotate(-.8deg); }
.goal-card:nth-child(4n+2) { background: #ffe0dc; transform: rotate(.7deg); }
.goal-card:nth-child(4n+3) { background: #dbeaff; transform: rotate(-.4deg); }
.goal-card:nth-child(4n+4) { background: #d7f5e8; transform: rotate(.9deg); }
.goal-card .tag { background: rgb(255 255 255 / 70%); }
.goal-card .muted { color: #6d6450; }
.goal-card svg .ring-bg { stroke: rgb(255 255 255 / 75%); }
.goal-card svg text.strong { fill: #2b2410; }
.goal { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; }
.goal h3 { margin: 0; }
.goal .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.goal .amounts { font-family: var(--round); font-weight: 900; font-size: 1.15rem; margin: 4px 0; font-variant-numeric: tabular-nums; }
.goal-grid { padding-top: 8px; }

/* ---------- Quêtes ---------- */
.player { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; background: #efe7ff; border-color: #ddd0ff; }
@media (prefers-color-scheme: dark) { .player { background: #2a2350; border-color: #3b3270; } }
.player .level { font-family: var(--round); font-size: 1.35rem; font-weight: 900; }
.player .xp { font-family: var(--round); font-size: 1.8rem; font-weight: 900; color: var(--grape); font-variant-numeric: tabular-nums; }
.xpbar { grid-column: 1 / -1; height: 14px; background: rgb(255 255 255 / 70%); border-radius: 999px; overflow: hidden; border: 1px solid #ddd0ff; }
.xpbar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sun), var(--coral)); }
.player .meta { grid-column: 1 / -1; }
.stamps { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.stamp {
  font-family: var(--round); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  padding: 6px 11px; border: 2px dashed #c9bdf0; border-radius: 8px; color: #9a8fc4;
}
.stamp.earned { border: 2.5px solid var(--coral); color: var(--coral); background: #fff; transform: rotate(-4deg); box-shadow: 2px 2px 0 var(--coral); }
.stamp.earned:nth-child(2n) { border-color: var(--sky); color: var(--sky); box-shadow: 2px 2px 0 var(--sky); transform: rotate(3deg); }
.stamp.earned:nth-child(3n) { border-color: var(--mint); color: var(--mint); box-shadow: 2px 2px 0 var(--mint); }
.quest { border-left: 6px solid var(--sky); }
.quest.d2 { border-left-color: var(--orange); }
.quest.d3 { border-left-color: var(--coral); }
.quest .gain { font-family: var(--round); font-weight: 900; color: #0b7c56; background: #d7f5e8; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.quest .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quest.done { border-left-color: var(--mint); opacity: .8; }
.quest.done h3 { text-decoration: line-through; text-decoration-color: var(--mint); text-decoration-thickness: 3px; }
.difficulty { color: var(--orange); font-size: .9rem; letter-spacing: .1em; }
.alert { background: #ffd9d6; color: #b42c22; padding: 7px 11px; border-radius: 10px; font-weight: 700; font-size: .85rem; margin-top: 8px; }

/* ---------- Opérations ---------- */
.tx { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--rule-strong); cursor: pointer; min-width: 0; }
.tx:last-child { border-bottom: 0; }
.tx:hover .lbl b { color: var(--sky); }
.tx .lbl { min-width: 0; }
.tx .lbl b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.tx .lbl span { font-size: .8rem; color: var(--muted); }
.tx.unknown .lbl span { color: #a35a00; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.dropzone { border: 2.5px dashed #b9d4ff; border-radius: var(--radius); padding: 20px; text-align: center; background: #f1f7ff; }
@media (prefers-color-scheme: dark) { .dropzone { background: #1d2a44; border-color: #34507f; } }
.dropzone.over { border-color: var(--sky); background: #dbeaff; }

/* ---------- Boutons, formulaires, dialogues ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 10px 16px; min-height: 44px; cursor: pointer;
  background: var(--sky); color: #fff; font-family: var(--round); font-weight: 800; text-decoration: none; font-size: .95rem;
  box-shadow: 0 3px 0 #2563c9; transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2563c9; }
.btn.secondary { background: #fff; color: #1f5fc4; box-shadow: 0 0 0 2px #b9d4ff inset, 0 3px 0 #b9d4ff; }
.btn.ghost { background: transparent; color: var(--ink-soft); box-shadow: 0 0 0 1.5px var(--rule-strong) inset; }
.btn.ok { background: var(--mint); box-shadow: 0 3px 0 #0b7c56; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
label.field { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--rule-strong); background: var(--sheet); min-height: 44px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--sky); }
.btn:focus-visible, .tabs button:focus-visible, [role=button]:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
textarea { min-height: 240px; line-height: 1.5; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--mint); }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--sheet); color: var(--ink); box-shadow: 0 20px 50px rgb(0 0 0 / 25%); }
dialog::backdrop { background: rgb(35 48 77 / 45%); }
dialog form { padding: 18px; display: grid; gap: 12px; }
dialog .buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 20; display: grid; gap: 8px; width: min(480px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--sheet); padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.toast.error { background: var(--red); color: #fff; }
.toast.xp { background: var(--sun); color: #3a2c00; font-family: var(--round); font-weight: 900; font-size: 1.05rem; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }

/* confettis à la réussite d'une quête */
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 30; pointer-events: none; border-radius: 2px; animation: fall 1.6s cubic-bezier(.3,.7,.4,1) forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

.empty { text-align: center; padding: 20px 8px; }
.empty h1 { font-size: 1.8rem; }
.empty p { max-width: 520px; margin-left: auto; margin-right: auto; }
.report p { margin: .4rem 0; }
.score { font-family: var(--round); font-size: 1.8rem; font-weight: 900; color: var(--mint); }

/* bandeaux d'alerte en haut du mois */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fff1b8; color: #3a2c00; border: 2px solid var(--sun); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-weight: 700; }
.banner span { flex: 1 1 220px; }
.sync .list li { align-items: center; }
.sync .list li.off b { text-decoration: line-through; color: var(--muted); }
.sync label { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; cursor: pointer; }

/* liens vers le détail */
svg .hit { fill: transparent; cursor: pointer; }
svg .hit:hover, svg .hit:focus { fill: color-mix(in srgb, var(--sky) 10%, transparent); outline: none; }
.link-btn { border: 0; background: none; padding: 4px 0; color: #1f5fc4; font-weight: 800; font-family: var(--round); cursor: pointer; font-size: .85rem; }
.oom .link-btn { margin-top: 6px; color: inherit; text-decoration: underline; text-decoration-thickness: 2px; }
.gauge .link-btn { font-size: .72rem; text-transform: uppercase; padding: 0 4px; }
.toolbar select { width: auto; max-width: 100%; }
/* rien ne doit rester caché sous la barre d'onglets fixe (téléphone) */
html { scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { html { scroll-padding-bottom: 0; } }

/* ---------- Alertes ---------- */
.alert-card { display: flex; gap: 10px 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; border: 2px solid; background: var(--sheet); }
.alert-card > div:first-child { flex: 1 1 220px; }
.alert-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert-card.attention { border-color: var(--orange); background: #fff4e0; color: #5c3600; }
.alert-card.danger { border-color: var(--red); background: #ffe6e4; color: #7a1d17; }
.alert-card.info { border-color: var(--sky); background: #e8f1ff; }
@media (prefers-color-scheme: dark) { .alert-card { color: var(--ink) !important; background: var(--sheet) !important; } }
.red { color: var(--red); }

/* ---------- Calendrier ---------- */
.seg { display: inline-flex; background: var(--rule); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 999px; font-family: var(--round); font-weight: 800; color: var(--muted); cursor: pointer; text-transform: capitalize; }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 10%); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.cal-head { text-align: center; font-size: .72rem; font-weight: 800; color: var(--muted); }
.cal-day { min-height: 52px; border: 1px solid var(--rule); background: var(--sheet); border-radius: 8px; padding: 3px; display: flex; flex-direction: column; align-items: stretch; gap: 1px; cursor: pointer; font: inherit; min-width: 0; }
.cal-day .n { font-family: var(--round); font-weight: 800; font-size: .8rem; text-align: left; }
.cal-day .amt { font-size: .62rem; font-weight: 800; border-radius: 4px; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.cal-day .amt.out { background: #ffe0dc; color: #b42c22; }
.cal-day .amt.in { background: #d7f5e8; color: #0b7c56; }
.cal-day.past { opacity: .55; }
.cal-day.planned { border-color: #b9d4ff; background: #f1f7ff; }
.cal-day.today { outline: 3px solid var(--sun); outline-offset: -1px; opacity: 1; }
.cal-day.low { border-color: var(--red); background: #fff1f0; }
.cal-day.sel { box-shadow: 0 0 0 3px var(--sky); opacity: 1; }
@media (prefers-color-scheme: dark) { .cal-day.planned, .cal-day.low { background: var(--sheet); } }
.day-detail { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--rule-strong); }
.day-detail b { text-transform: capitalize; font-family: var(--round); }

/* bouton Réglages (en-tête) */
.top-actions { display: flex; align-items: center; gap: 8px; }
.gear { border: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); }
.gear svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gear.on { background: color-mix(in srgb, var(--sky) 18%, transparent); color: #1f5fc4; border-color: #b9d4ff; }

/* filtres par catégorie : pastilles colorées */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; scrollbar-width: thin; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--rule-strong); background: var(--sheet);
  border-radius: 999px; padding: 6px 12px; font-family: var(--round); font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--ink); min-height: 36px; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.chip .dot.interne { background: var(--inconnu); }
@media (min-width: 900px) { .chips { flex-wrap: wrap; overflow: visible; } }
@media (max-width: 420px) {
  .brand { font-size: 1.05rem; gap: 8px; }
  .player-chip { white-space: nowrap; font-size: .78rem; padding: 3px 10px; }
}
