/* =========================================================================
   Gestion Finance — feuille de style unique, mobile-first.
   ========================================================================= */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --accent: #06b6d4;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html[data-theme='dark'] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #172033;
  --border: #1f2b45;
  --text: #e6edf7;
  --muted: #94a3b8;
  --primary: #818cf8;
  --primary-soft: #1e1b4b;
  --accent: #22d3ee;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

/* =========================================================================
   Themes saisonniers.

   Seconde dimension, independante du clair/sombre : `data-season` sur <html>
   redefinit les jetons de couleur, `data-theme` continue de choisir le mode.
   Sans `data-season`, la palette d'origine ci-dessus s'applique telle quelle.

   Les couleurs semantiques (--ok, --warn, --danger) ne changent pas : un
   excedent doit rester vert et un decouvert rouge, quelle que soit la saison.
   ========================================================================= */

/* ---------------------------------------------------------- Printemps */
:root[data-season='printemps'][data-theme='light'] {
  --bg: #f2f8f0;
  --surface: #ffffff;
  --surface-2: #eef6ec;
  --border: #d9e8d4;
  --text: #16281c;
  --muted: #5d7a65;
  --primary: #3f9e5a;
  --primary-soft: #e2f2e4;
  --accent: #8fcc6e;
}
:root[data-season='printemps'][data-theme='dark'] {
  --bg: #0d1710;
  --surface: #14211a;
  --surface-2: #1b2d22;
  --border: #25402f;
  --text: #e7f2e9;
  --muted: #8dae96;
  --primary: #5cc47a;
  --primary-soft: #163020;
  --accent: #9ad27f;
}

/* --------------------------------------------------------------- Ete */
:root[data-season='ete'][data-theme='light'] {
  --bg: #eff8fb;
  --surface: #ffffff;
  --surface-2: #e9f5f9;
  --border: #cde5ee;
  --text: #0b2a33;
  --muted: #4c7684;
  --primary: #0e9eb7;
  --primary-soft: #dbf1f6;
  --accent: #f5b301;
}
:root[data-season='ete'][data-theme='dark'] {
  --bg: #071a20;
  --surface: #0d262e;
  --surface-2: #12333f;
  --border: #1b4756;
  --text: #e3f4f9;
  --muted: #83aab7;
  --primary: #2bc0dc;
  --primary-soft: #0d3542;
  --accent: #f7c948;
}

/* ----------------------------------------------------------- Automne */
:root[data-season='automne'][data-theme='light'] {
  --bg: #faf3e9;
  --surface: #fffdfa;
  --surface-2: #f5ecdf;
  --border: #e6d5bf;
  --text: #2f2013;
  --muted: #7c6448;
  --primary: #b45309;
  --primary-soft: #f6e5d1;
  --accent: #d97706;
}
:root[data-season='automne'][data-theme='dark'] {
  --bg: #1a1108;
  --surface: #251a0f;
  --surface-2: #322415;
  --border: #4a3520;
  --text: #f6ecdf;
  --muted: #b39777;
  --primary: #e08a3c;
  --primary-soft: #3a2612;
  --accent: #f0a95c;
}

/* ------------------------------------------------------------- Hiver */
:root[data-season='hiver'][data-theme='light'] {
  --bg: #eff3f9;
  --surface: #ffffff;
  --surface-2: #e9eff7;
  --border: #d3dced;
  --text: #101a2b;
  --muted: #5a6b85;
  --primary: #3b6fd4;
  --primary-soft: #dfe8f9;
  --accent: #7cc4e8;
}
:root[data-season='hiver'][data-theme='dark'] {
  --bg: #0a1120;
  --surface: #101a2c;
  --surface-2: #17233a;
  --border: #223350;
  --text: #e6eefb;
  --muted: #92a4c2;
  --primary: #6d94ef;
  --primary-soft: #1a2745;
  --accent: #9fd4f2;
}

* { box-sizing: border-box; }

/* L'attribut `hidden` doit l'emporter sur les `display` declares plus bas :
   une regle auteur bat la feuille du navigateur, et masquer un element cesse
   alors de fonctionner sans prevenir. */
[hidden] { display: none !important; }

html, body { height: 100%; }
html { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------- Structure */

.app {
  display: grid;
  min-width: 0;
  grid-template-areas: 'top' 'content' 'foot' 'tabs';
  /* minmax(0, 1fr) et non `auto` : sinon un libelle long (sous-titre d'en-tete,
     option de <select>) impose sa largeur min-content a toute la page. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto auto;
  min-height: 100%;
}

.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* `overflow: hidden` annule la contribution min-content du titre et du
   sous-titre : sans lui, un sous-titre long elargit toute la grille .app. */
.topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.topbar__brand > div { min-width: 0; overflow: hidden; }

.topbar__logo {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  color: #fff; font-weight: 700; font-size: 18px;
  flex: none;
}

.topbar h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; gap: 8px; flex: none; }

.sidenav { display: none; }
.sidenav__foot { display: none; }

/* Reglages vit dans l'en-tete sur mobile (la barre du bas garde 5 onglets),
   et dans le menu lateral sur grand ecran. */
.topbar__settings.is-active { color: var(--primary); background: var(--primary-soft); }

.content {
  grid-area: content;
  padding: 16px 16px 8px;
  outline: none;
  min-width: 0;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* Signature : dans le menu lateral sur grand ecran, en pied sur mobile. */
.brandmark { font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.brandmark__version {
  font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); opacity: .8;
}

.appfoot {
  grid-area: foot;
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  padding: 6px 16px calc(78px + var(--safe-b));
  text-align: center;
}

.tabbar {
  grid-area: tabs;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.tabbar__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; overflow: hidden;
  padding: 7px 2px;
  border: 0; border-radius: 12px;
  background: none; color: var(--muted);
  font-size: 10.5px; font-weight: 600;
  cursor: pointer;
}
.tabbar__item span { font-size: 17px; line-height: 1; }
.tabbar__item.is-active { color: var(--primary); background: var(--primary-soft); }

/* ---------------------------------------------------------------- Blocs */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card + .card, .stack > * + * { margin-top: 14px; }
.stack { display: block; }

.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.card__head h2 { font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.card__head h3 { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.card__hint { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: minmax(0, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* ---------------------------------------------------------------- Stats */

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.stat__label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.stat__value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__foot { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat--ok .stat__value { color: var(--ok); }
.stat--warn .stat__value { color: var(--warn); }
.stat--danger .stat__value { color: var(--danger); }

/* -------------------------------------------------------------- Verdict */

.verdict {
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid transparent;
  display: grid; gap: 6px;
}
.verdict h2 { font-size: 19px; }
.verdict p { font-size: 13.5px; opacity: .92; }
.verdict--ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.verdict--warning { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 38%, transparent); }
.verdict--danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 38%, transparent); }
.verdict__amount { font-size: 30px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.verdict--ok .verdict__amount { color: var(--ok); }
.verdict--warning .verdict__amount { color: var(--warn); }
.verdict--danger .verdict__amount { color: var(--danger); }

/* ------------------------------------------------------------- Controles */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: filter .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; }
.btn--sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn--block { width: 100%; }
/* Sous 430px, l'en-tete porte deja trois boutons : le libelle cede la place au titre. */
@media (max-width: 430px) { .btn__label { display: none; } }

.segment {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
}
.segment button {
  border: 0; background: none; color: var(--muted);
  padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.segment button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.field { display: grid; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.field small { font-size: 11.5px; color: var(--muted); }

input[type='text'], input[type='number'], input[type='date'], input[type='month'], select, textarea {
  width: 100%;
  min-width: 0; /* sinon un <select> impose la largeur de sa plus longue option */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 16px; /* evite le zoom auto iOS */
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--primary);
}
textarea { min-height: 70px; resize: vertical; }
input[type='color'] { padding: 3px; height: 42px; }
input[type='range'] { width: 100%; accent-color: var(--primary); }

/* Champ inactif : on le laisse visible pour montrer ce qu'il ferait, mais il
   est clairement hors service. */
.field--off { opacity: .45; }
.field--off label, .field--off small { color: var(--muted); }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
input[type='range']:disabled { accent-color: var(--muted); }

.row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.row--3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.form__actions { display: flex; gap: 8px; margin-top: 6px; }
.form__actions .btn { flex: 1; }

/* --------------------------------------------------------------- Listes */

.list { display: grid; gap: 8px; }

.item {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.item:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.item__bar { width: 6px; height: 34px; border-radius: 3px; background: var(--primary); }
.item__main { min-width: 0; }
.item__title { font-weight: 620; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__amount { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; font-size: 14.5px; }
.item__sub { font-size: 11px; color: var(--muted); text-align: right; }
.item--muted { opacity: .55; }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 650;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.tag--ponctuelle { color: #0284c7; border-color: #0284c744; background: #0284c714; }
.tag--mensuelle { color: #7c3aed; border-color: #7c3aed44; background: #7c3aed14; }
.tag--semestrielle { color: #d97706; border-color: #d9770644; background: #d9770614; }
.tag--annuelle { color: #db2777; border-color: #db277744; background: #db277714; }
.tag--income { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
/* Mise de cote : sortie de tresorerie, mais pas une depense. */
.tag--saving { color: #0284c7; border-color: #0ea5e966; background: #0ea5e91f; }
.item--saving { border-style: dashed; }

/* En-tete de groupe dans la liste des depenses. */
.grouphead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.grouphead:first-child { margin-top: 0; }
.grouphead__name { font-size: 13.5px; font-weight: 700; }
.grouphead__meta { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 28px 14px; color: var(--muted); font-size: 13.5px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* ------------------------------------------------------------- Donut/SVG */

.chart { width: 100%; display: block; overflow: visible; }
/* Suivi du pointeur sur les courbes : le cadre sert de repere a l'infobulle. */
.chart-wrap { position: relative; }
.chart-wrap svg { cursor: crosshair; }
.chart__tip {
  position: absolute;
  top: 2px;
  pointer-events: none;
  z-index: 2;
  display: grid;
  gap: 2px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  line-height: 1.35;
  white-space: nowrap;
  /* Sur un cadre etroit l'infobulle peut etre plus large que la courbe : on la
     borne au cadre, sinon le calage horizontal ne suffit pas a la contenir. */
  max-width: 100%;
  overflow: hidden;
}
.chart__tip[hidden] { display: none; }
.chart__tip-x { color: var(--muted); font-weight: 650; }
.chart__tip-y {
  display: flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums;
}
.chart__tip-y > span:first-child {
  width: 8px; height: 8px; border-radius: 2px; flex: none;
}

.donut-wrap { position: relative; display: grid; place-items: center; }
.donut__center {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
  pointer-events: none;
}
.donut__center .amount { font-size: 21px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.donut__center .caption { font-size: 11px; color: var(--muted); max-width: 118px; margin: 2px auto 0; line-height: 1.25; }
.slice { cursor: pointer; transition: opacity .15s, transform .15s; transform-origin: center; }
.slice:hover { opacity: .82; }
.slice.is-dim { opacity: .28; }

.legend { display: grid; gap: 4px; margin-top: 12px; }
.legend__row {
  display: grid; grid-template-columns: 11px minmax(0, 1fr) auto auto; gap: 9px; align-items: center;
  padding: 7px 8px; border-radius: 9px; cursor: pointer; border: 1px solid transparent;
}
.legend__row:hover { background: var(--surface-2); }
.legend__row.is-active { background: var(--surface-2); border-color: var(--border); }
.legend__dot { width: 11px; height: 11px; border-radius: 3px; }
.legend__name { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend__val { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.legend__pct { font-size: 11.5px; color: var(--muted); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 8px; }
.bar__top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 3px; }
.bar__track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .4s ease; }

.progress { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 9px 0 6px; }
.progress__fill { height: 100%; border-radius: 999px; transition: width .5s ease; }

/* ------------------------------------------------------------- Portefeuilles */

.wallet {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.wallet__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wallet__name { font-weight: 680; font-size: 15px; }
.wallet__amount { font-weight: 750; font-variant-numeric: tabular-nums; }
.wallet__meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.wallet__actions { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }

/* Circuit bancaire d'une enveloppe : debite -> credite. */
.circuit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 11px 0 4px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.circuit__side { min-width: 0; display: grid; gap: 3px; }
.circuit__role {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
}
.circuit__bank {
  display: block; min-width: 0;
  padding-left: 7px; border-left: 3px solid var(--border);
  font-size: 12.5px; font-weight: 620; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis;
}
.circuit__bank small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.circuit__bank--empty { font-weight: 500; color: var(--muted); font-style: italic; }
.circuit__arrow { text-align: center; color: var(--muted); flex: none; }
.circuit__arrow span { font-size: 17px; line-height: 1; }
.circuit__arrow small { display: block; font-size: 10px; white-space: nowrap; }

.wallet__chart { margin-top: 10px; }

.badge { font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px; }
.badge--onTrack, .badge--reached { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge--behind { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge--neutral { background: var(--surface-2); color: var(--muted); }

/* -------------------------------------------------------------- Modale */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .55); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative;
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(20px + var(--safe-b));
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(22px); opacity: .5; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal__head h2 { font-size: 16px; }

/* -------------------------------------------------------------- Toasts */

.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(78px + var(--safe-b)); z-index: 70; display: grid; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow);
  animation: pop .2s ease;
}
.toast--error { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shine 1.2s infinite; height: 90px; }
@keyframes shine { to { background-position: -200% 0; } }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.right { text-align: right; }
.mt { margin-top: 14px; }
.hr { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

/* --------------------------------------------------------- Tablette/desktop */

@media (min-width: 720px) {
  .grid--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content { padding: 20px 24px 40px; }
}

@media (min-width: 960px) {
  .app {
    grid-template-areas: 'top top' 'nav content';
    grid-template-columns: 232px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  .tabbar { display: none; }
  .appfoot { display: none; }
  .topbar__settings { display: none; }
  .sidenav__foot {
    margin-top: auto;
    display: grid; gap: 2px;
    padding: 12px 12px 4px;
    border-top: 1px solid var(--border);
  }
  .sidenav {
    grid-area: nav;
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px 12px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    position: sticky; top: 61px;
    height: calc(100vh - 61px);
  }
  .sidenav__item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border: 0; border-radius: 11px;
    background: none; color: var(--muted);
    font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
  }
  .sidenav__item:hover { background: var(--surface-2); color: var(--text); }
  .sidenav__item.is-active { background: var(--primary-soft); color: var(--primary); }
  .sidenav__icon { font-size: 16px; width: 20px; text-align: center; }
  .content { padding: 24px 28px 48px; max-width: none; }
  .modal__panel { margin: auto; border-radius: 20px; padding: 20px; }
  .toasts { left: auto; right: 20px; bottom: 20px; width: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------- Selecteur de theme */

.themes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}
.theme {
  display: grid; gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, transform .1s;
}
.theme:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.theme:active { transform: translateY(1px); }
.theme.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.theme__swatch { display: flex; height: 26px; border-radius: 7px; overflow: hidden; }
.theme__swatch span { flex: 1; }
.theme__name { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.theme__check { color: var(--primary); font-size: 12px; }
.theme__hint { font-size: 11px; color: var(--muted); line-height: 1.3; }
