:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #6b7384;
  --border: #e3e6ec;
  --accent: #2f6fed;
  --income: #1a9b5b;
  --expense: #d64545;
  --warn: #d98a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12151b;
    --surface: #1b2029;
    --text: #e6e9ef;
    --muted: #949cad;
    --border: #2b323e;
    --accent: #5b8ef5;
    --income: #3cc47f;
    --expense: #ef6b6b;
    --warn: #f0a92b;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12151b;
  --surface: #1b2029;
  --text: #e6e9ef;
  --muted: #949cad;
  --border: #2b323e;
  --accent: #5b8ef5;
  --income: #3cc47f;
  --expense: #ef6b6b;
  --warn: #f0a92b;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 12px; }

.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.brand-logo { width: 26px; height: 26px; flex: none; }

/* Bannière « My Finance » en tête de l'accueil. */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; margin-bottom: 20px; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, #2f6fed 0%, #1d4fc4 55%, #173d99 100%);
  box-shadow: 0 8px 24px rgba(29, 79, 196, .25);
}
.hero::after { /* motif discret de pièces */
  content: ""; position: absolute; inset-inline-end: -40px; top: -50px; width: 190px; height: 190px; border-radius: 50%;
  border: 26px solid rgba(255, 255, 255, .08); box-shadow: -70px 90px 0 -40px rgba(255, 255, 255, .06);
}
.hero-logo { flex: none; width: 56px; height: 56px; border-radius: 14px; background: rgba(255, 255, 255, .15); display: grid; place-items: center; }
.hero-icon { width: 44px; height: 44px; }
.hero-title { font-size: 1.6rem; font-weight: 800; letter-spacing: .01em; line-height: 1.15; }
.hero-tagline { opacity: .88; font-size: .92rem; margin-top: 2px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; color: var(--muted);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; font: inherit;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  overflow-x: auto;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .82rem; }
.kpi .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: .8rem; }

.pos { color: var(--income); }
.neg { color: var(--expense); }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 16px; margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--expense); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 1rem; }
.icon-btn:hover { color: var(--text); background: var(--bg); }

input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); }
.field input, .field select { color: var(--text); }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: start; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; white-space: nowrap; }
.table td:last-child { text-align: end; white-space: nowrap; width: 1%; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; background: var(--bg); border: 1px solid var(--border); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.list li:last-child { border-bottom: 0; }

.bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .88rem; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.bar-row .amt { font-variant-numeric: tabular-nums; }

.progress { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress > div { height: 100%; background: var(--income); border-radius: 99px; transition: width .3s; }
.progress.warn > div { background: var(--warn); }
.progress.over > div { background: var(--expense); }

.budget-row { display: flex; flex-direction: column; }
.budget-row .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; background: var(--c); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text); width: min(420px, calc(100vw - 32px));
}
dialog.wide { width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }
dialog form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented label { text-align: center; padding: 8px; cursor: pointer; }
.segmented input { display: none; }
.segmented label:has(input:checked) { background: var(--accent); color: #fff; }

.split-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--bg); }
.split-bar > div { height: 100%; transition: width .2s; }
.split-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: -4px; }
.split-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; background: var(--c); }
.split-scroll { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.split-table td { padding: 6px 10px; }
.split-table tr.group td { text-align: start; width: auto; background: var(--bg); font-weight: 600; font-size: .8rem; color: var(--muted); padding: 6px 10px; }
.split-table input { width: 110px; text-align: end; padding: 5px 8px; font-variant-numeric: tabular-nums; }
.split-table .share { color: var(--muted); font-size: .8rem; width: 1%; white-space: nowrap; text-align: end; }
.split-total { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }

.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.faith { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.faith h3 { font-size: .95rem; margin: 0; }
.faith .banner { margin: 0; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.transport { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.transport legend { font-size: .88rem; color: var(--muted); padding: 0; margin-bottom: 6px; }
.transport-options { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.field.inline { flex-direction: row; align-items: center; gap: 6px; }
.field.inline input { width: 64px; padding: 4px 8px; }
.inline-inputs { display: flex; gap: 8px; align-items: center; }
.inline-inputs input { flex: 1; min-width: 0; }
.kids-ages { display: flex; flex-wrap: wrap; gap: 12px; }
.kids-ages:empty { display: none; }
.kid-card {
  display: grid; grid-template-columns: auto 80px minmax(150px, 1fr) minmax(110px, 1fr) minmax(140px, 1fr); gap: 10px; align-items: end;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); flex: 1 1 100%;
}
.kid-card strong { align-self: center; font-size: .88rem; }
@media (max-width: 640px) { .kid-card { grid-template-columns: 1fr 1fr; } .kid-card strong { grid-column: 1 / -1; } }
.split-table .hint { display: block; color: var(--muted); font-size: .78rem; }
.split-details { margin-top: 6px; font-size: .88rem; }
.split-details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.split-details[open] summary { margin-bottom: 6px; }

/* Téléphone : chaque ligne de la proposition sur deux niveaux (catégorie, puis part et montant),
   pour que la case du montant reste toujours visible. */
@media (max-width: 640px) {
  .split-scroll { max-height: 52vh; }
  .split-table, .split-table tbody { display: block; }
  .split-table tr:not(.group) {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name name" "share input";
    align-items: center; gap: 4px 10px; padding: 8px 10px; border-bottom: 1px solid var(--border);
  }
  .split-table tr.group { display: block; }
  .split-table tr.group td { display: block; }
  .split-table tr:not(.group) td { display: block; padding: 0; border: 0; width: auto; }
  .split-table tr:not(.group) td:first-child { grid-area: name; }
  .split-table .share { grid-area: share; text-align: start; }
  .split-table td.num { grid-area: input; }
  .split-table input { width: 130px; }
}

.banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 100;
  max-width: calc(100vw - 32px);
}
textarea {
  font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; width: 100%; min-height: 180px; resize: vertical;
}
.btn:focus-visible, .icon-btn:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button, a, label { -webkit-tap-highlight-color: transparent; }

/* Appel à l'action « Répartir mon salaire » sur l'accueil. */
.split-cta { background: var(--surface); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* Onglets : icônes et libellés courts réservés au mobile. */
.tab-icon { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lbl-short { display: none; }
.fab { display: none; }

@media (max-width: 640px) {
  .topbar { padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; top: 0; gap: 12px; }
  main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .bar-row { grid-template-columns: 90px 1fr auto; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }

  /* Barre d'onglets fixée en bas, à portée de pouce. */
  .tabs {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 20; overflow: visible;
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabs button {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 1px; font-size: .62rem; border-radius: 10px; min-height: 52px; justify-content: center;
  }
  .tabs button.active { background: none; }
  .tabs button.active .tab-icon { stroke-width: 2.3; }
  .tab-icon { display: block; }
  .lbl-long { display: none; }
  .lbl-short { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

  /* Bouton « + » flottant pour ajouter une opération. */
  .fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; inset-inline-end: 18px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 21;
    width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent); color: #fff; font-size: 30px; line-height: 1;
    box-shadow: 0 6px 16px rgba(20, 40, 90, .3);
  }
  .fab[hidden] { display: none; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }

  .split-cta .btn, #view-budgets .view-head .btn { flex: 1 1 auto; justify-content: center; }
  #view-budgets .view-head .actions, #view-budgets .view-head input { width: 100%; }

  /* Zones tactiles plus grandes. */
  .btn { min-height: 44px; }
  .icon-btn { padding: 8px 10px; }
  input, select { min-height: 44px; font-size: 16px; } /* 16 px évite le zoom automatique sur iPhone */
  dialog { max-height: calc(100dvh - 32px); overflow: auto; }
}

/* App installée : pas de barre du navigateur, on respecte les zones de l'écran. */
@media (display-mode: standalone) {
  body { -webkit-user-select: none; user-select: none; overscroll-behavior-y: none; }
  input, textarea, .card, .list, .table { -webkit-user-select: text; user-select: text; }
}

.lang-select { margin-inline-start: auto; padding: 6px 8px; font-size: .88rem; }
/* Les graphiques temporels restent de gauche à droite, y compris en arabe. */
.chart svg { direction: ltr; }


/* ---------- Catégories : icônes colorées ---------- */
.cat-icon {
  --c: #6b7384;
  display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 12px; font-size: 1.35rem; line-height: 1;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
}
.cat-icon.sm { width: 26px; height: 26px; border-radius: 8px; font-size: .95rem; margin-inline-end: 6px; }
.sub-title { font-size: .85rem; color: var(--muted); margin: 6px 0 0; font-weight: 600; }

/* Grille de choix de la catégorie (saisie). */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; max-height: 236px; overflow-y: auto; padding: 2px; }
.cat-choice {
  --c: #6b7384;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit;
}
.cat-choice .cat-icon { width: 40px; height: 40px; }
.cat-choice .cat-name { font-size: .72rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.cat-choice.selected { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.cat-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented.seg-3 { grid-template-columns: repeat(3, 1fr); }
.segmented.seg-wrap label { display: flex; align-items: center; justify-content: center; min-height: 44px; line-height: 1.25; color: var(--text); }
.segmented.seg-wrap label:has(input:checked) { color: #fff; }
/* Choix des listes déroulantes toujours lisibles (arabe, mode sombre, affichage dans une page intégrée). */
select option, select optgroup { color: var(--text); background-color: var(--surface); direction: inherit; }
.accounts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

/* Calculatrice du montant. */
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.calc-keys button {
  border: 0; border-radius: 10px; padding: 8px 0; cursor: pointer; font: inherit; font-size: 1.1rem; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent);
}
.calc-keys button:last-child { background: var(--accent); color: #fff; }

/* ---------- Opérations groupées par jour ---------- */
.month-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px 14px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.period-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 10px; }
.period-nav strong { min-width: 150px; text-align: center; text-transform: capitalize; }
.nav-arrow { font-size: 1.5rem; line-height: 1; width: 36px; height: 36px; border-radius: 50%; background: var(--bg); }
[dir="rtl"] .nav-arrow { transform: scaleX(-1); }
.month-sums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.month-sums div { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; }
.month-sums strong { font-size: clamp(.82rem, 3.6vw, 1.05rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.day-groups { display: flex; flex-direction: column; gap: 14px; }
.day-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 0 4px 6px; font-size: .82rem; color: var(--muted); text-transform: capitalize; }
.day-sums { display: flex; gap: 12px; }
.day-sums b { font-variant-numeric: tabular-nums; }
.tx-list { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px 12px; }
.card .tx-list, #recent.tx-list { border: 0; padding: 0; }
.list li.tx-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; }
.tx-main { display: flex; flex-direction: column; min-width: 0; }
.tx-main strong { font-weight: 600; }
.tx-sub { display: block; color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-actions { display: flex; }
#recent li.tx-row .tx-actions { display: none; }

/* ---------- Comptes ---------- */
.section-head { margin-top: 28px; }
.section-head h2 { margin: 0; font-size: 1.2rem; }
.acc-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acc-balance { font-size: 1.5rem; font-weight: 800; margin: 12px 0 10px; font-variant-numeric: tabular-nums; }
.account-card .btn { align-self: flex-start; }
.debt-card.done { opacity: .6; }
.debt-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.warn-text { color: var(--warn); font-weight: 600; }
.due-banner { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }

/* Catégories dans les réglages. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { --c: #6b7384; display: inline-flex; align-items: center; padding: 3px 10px 3px 4px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); font-size: .85rem; }
.chip-del { border: 0; background: none; color: var(--muted); cursor: pointer; margin-inline-start: 6px; font-size: .8rem; padding: 2px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; max-height: 150px; overflow-y: auto; }
.icon-grid button, .color-grid button { border: 1.5px solid var(--border); background: var(--surface); border-radius: 10px; font-size: 1.3rem; padding: 6px 0; cursor: pointer; }
.icon-grid button.selected, .color-grid button.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.color-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.color-grid button { width: 40px; display: grid; place-items: center; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: block; }

/* ---------- Rapports ---------- */
.donut-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; }
.donut { width: 180px; max-width: 100%; flex: none; direction: ltr; }
.donut circle { transition: stroke-width .15s; }
.donut circle:hover { stroke-width: 30; }
.donut-label { fill: var(--muted); font-size: 11px; }
.donut-total { fill: var(--text); font-size: 15px; font-weight: 700; }
.donut-legend { flex: 1 1 220px; min-width: 0; }
.legend-name { display: inline-flex; align-items: center; min-width: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { text-align: center; font-size: .72rem; color: var(--muted); padding-bottom: 2px; text-transform: uppercase; }
.cal-day {
  --level: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font: inherit; color: var(--text); padding: 2px;
  background: color-mix(in srgb, var(--expense) calc(var(--level) * 70%), var(--surface));
}
.cal-day span { font-size: .8rem; font-weight: 600; }
.cal-day small { font-size: .62rem; font-variant-numeric: tabular-nums; }
.cal-day.today { border-color: var(--accent); border-width: 2px; }
.cal-day.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.day-detail { margin-top: 12px; }

/* ---------- Écran de verrouillage ---------- */
.lock {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, #2f6fed 0%, #1d4fc4 55%, #173d99 100%); color: #fff;
}
body.locked main, body.locked .topbar, body.locked .fab { visibility: hidden; }
.lock-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(320px, 100%); }
.lock-logo { width: 64px; height: 64px; }
.lock-title { margin: 0; font-size: 1.1rem; font-weight: 600; text-align: center; }
.pin-dots { display: flex; gap: 16px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.pin-dots span.filled { background: #fff; }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.lock-error { margin: 0; min-height: 1.3em; color: #ffd2d2; font-size: .9rem; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keypad button {
  width: 72px; height: 72px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.6rem; font-weight: 600;
}
.keypad button:active { background: rgba(255, 255, 255, .32); }
.keypad .key-text { font-size: .85rem; background: none; }
.lock-forgot { border: 0; background: none; color: #fff; opacity: .85; text-decoration: underline; cursor: pointer; font: inherit; }
@media (prefers-reduced-motion: reduce) { .pin-dots.shake { animation: none; } }

@media (max-width: 640px) {
  #view-transactions .view-head .actions > * { flex: 1 1 140px; }
  .period-nav strong { min-width: 120px; }
  .list li.tx-row { gap: 10px; }
  .tx-actions .icon-btn { padding: 6px; }
}

/* Avertissements de la proposition (épargne faible, scolarité élevée…). */
.split-alert {
  flex-basis: 100%; display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px; border-radius: 10px; font-size: .85rem; line-height: 1.45;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); color: var(--text);
}

/* ---------- À propos ---------- */
.about-head { display: flex; align-items: center; gap: 14px; }
.about-logo { width: 64px; height: 64px; flex: none; border-radius: 16px; box-shadow: 0 6px 16px rgba(29, 79, 196, .25); }
.about-name { font-size: 1.3rem; font-weight: 800; }
.about-tagline { font-weight: 600; margin: 14px 0 6px; }
.about p.muted { margin: 6px 0; line-height: 1.6; }
.about-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 14px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.about-info div { padding: 10px 14px; border-bottom: 1px solid var(--border); border-inline-end: 1px solid var(--border); margin-block-end: -1px; margin-inline-end: -1px; }
.about-info dt { font-size: .85rem; }
.about-info dd { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.about-links { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.about-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: start;
}
.about-link:last-child { border-bottom: 0; }
.about-link:hover { background: var(--bg); }
.about-link-icon { --c: #2f6fed; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 1rem; }
.about-link .chev { margin-inline-start: auto; color: var(--muted); font-size: 1.3rem; }
[dir="rtl"] .about-link .chev { transform: scaleX(-1); }
.privacy-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
