/* Tirelire — feuille de style unique, pensée d'abord pour le téléphone. */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --text: #1b2330;
    --muted: #667085;
    --border: #e2e5ea;
    --primary: #2f5fd0;
    --primary-contrast: #ffffff;
    --primary-soft: #e8eefc;
    --pos: #1b8a5a;
    --neg: #c8403a;
    --warn: #b7791f;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --nav-height: 60px;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #11151c;
        --surface: #1a202b;
        --surface-2: #232b38;
        --text: #e8ebf0;
        --muted: #98a2b3;
        --border: #2d3644;
        --primary: #7ea2f5;
        --primary-contrast: #0d1220;
        --primary-soft: #232f4a;
        --pos: #4cc38a;
        --neg: #f0776f;
        --warn: #e0b050;
        --shadow: none;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
[hidden] { display: none !important; }

/* ---- Structure ---- */
.app { min-height: 100dvh; padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
.sidebar { display: none; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { color: var(--primary); }
.topbar .tenant { flex: 1; min-width: 0; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-link { position: relative; display: inline-flex; padding: .35rem; color: var(--text); border-radius: 8px; }
.badge-dot {
    position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: var(--neg); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}
.main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--nav-height) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: .7rem; text-decoration: none;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav .add span {
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-top: -14px;
    border-radius: 50%; background: var(--primary); color: var(--primary-contrast); box-shadow: var(--shadow);
}

.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: .95rem;
}
.nav-list a:hover { background: var(--surface-2); }
.nav-list a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-list .sep { margin: .5rem .75rem; border-top: 1px solid var(--border); }
.nav-list .count { margin-left: auto; }

@media (min-width: 900px) {
    .app { display: grid; grid-template-columns: 240px 1fr; padding-bottom: 0; }
    .sidebar {
        display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
        padding: 1rem .75rem; background: var(--surface); border-right: 1px solid var(--border);
    }
    .sidebar .brand { padding: 0 .75rem; font-size: 1.15rem; }
    .sidebar .foot { margin-top: auto; }
    .topbar, .bottom-nav { display: none; }
    .main { padding: 1.5rem 2rem 3rem; width: 100%; }
}

/* ---- Composants ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card > h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card > h2 a { font-size: .85rem; font-weight: 500; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 1rem 1rem 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 1rem; }
@media (min-width: 700px) {
    .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.chart { position: relative; height: 260px; min-width: 0; }
.chart canvas { max-width: 100%; }
.empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); }
.empty p { margin-bottom: 1rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 40px; padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--border)); }
.btn.small { min-height: 32px; padding: .2rem .6rem; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 0; min-height: 0; font-weight: 500; }
.inline-form { display: inline; }

.chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .78rem; white-space: nowrap; }
.chip.primary { background: var(--primary-soft); color: var(--primary); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; overflow-wrap: anywhere; }
.flash.success { background: color-mix(in srgb, var(--pos) 12%, var(--surface)); border-color: color-mix(in srgb, var(--pos) 35%, transparent); }
.flash.error { background: color-mix(in srgb, var(--neg) 12%, var(--surface)); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.flash.suggestion { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.suggestion-form p { margin: 0 0 .5rem; }
.suggestion-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.suggestion-pattern { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; font-weight: 500; font-size: .88rem; }
.suggestion-pattern input { width: 14rem; max-width: 100%; min-height: 32px; padding: .2rem .5rem; }
.notice { padding: .6rem .9rem; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }

/* ---- Listes ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; color: var(--muted); font-size: .82rem; }
.list a.row-link { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.list .date { width: 2.6rem; flex: none; text-align: center; line-height: 1.1; color: var(--muted); font-size: .75rem; }
.list .date b { display: block; font-size: 1.05rem; color: var(--text); }
.list .side { text-align: right; flex: none; }
.list .side small { display: block; }
.list li.archived { opacity: .6; }
.list li.child { padding-left: 2.25rem; }
.list li.unread { background: var(--primary-soft); }
.check-btn {
    flex: none; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--border);
    background: none; color: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.check-btn.on { background: var(--pos); border-color: var(--pos); color: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .55rem .75rem; text-align: left; border-top: 1px solid var(--border); vertical-align: top; }
thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.sub td:first-child { padding-left: 1.75rem; color: var(--muted); }
tr.total td { font-weight: 700; }

.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: .35rem 0; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.progress.warn > span { background: var(--warn); }
.progress.over > span { background: var(--neg); }
.progress.done > span { background: var(--pos); }
.meter-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: .75rem; }

/* ---- Formulaires ---- */
form .field { margin-bottom: 1rem; }
label { display: block; margin-bottom: .3rem; font-size: .88rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=file], select, textarea {
    width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 0; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.field--error input, .field--error select { border-color: var(--neg); }
.field-errors { list-style: none; margin: .3rem 0 0; padding: 0; color: var(--neg); font-size: .85rem; }
.help-text { margin-top: .3rem; color: var(--muted); font-size: .82rem; }
.field--check { display: flex; align-items: center; gap: .5rem; }
.field--check label { margin: 0; font-weight: 500; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }
.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 600px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .wide { grid-column: 1 / -1; } }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.form-actions .spacer { flex: 1; }
.narrow { max-width: 640px; }

.segmented { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { flex: 1; margin: 0; padding: .55rem .5rem; text-align: center; cursor: pointer; font-weight: 600; color: var(--muted); }
.segmented input:checked + label { background: var(--primary); color: var(--primary-contrast); }
.segmented input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: -2px; }
.amount-field input { font-size: 1.6rem; font-weight: 700; text-align: right; min-height: 56px; }

.split-row { display: grid; grid-template-columns: 1fr 7rem auto; gap: .5rem; align-items: start; margin-bottom: .5rem; }
.split-row .field { margin: 0; }
.split-row label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.split-row .note { grid-column: 1 / -1; }
details.box { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; margin-bottom: 1rem; }
details.box > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
details.box[open] > summary { margin-bottom: .75rem; }

.filters { display: grid; gap: 0 .75rem; grid-template-columns: 1fr 1fr; }
.filters .field { margin-bottom: .6rem; }
.filters .wide, .filters .form-actions { grid-column: 1 / -1; }
@media (min-width: 800px) { .filters { grid-template-columns: repeat(4, 1fr); } .filters .wide { grid-column: span 2; } }

/* ---- Pages publiques (connexion, inscription) ---- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.auth .brand { font-size: 1.5rem; margin-bottom: 1.25rem; }
.auth .card { width: 100%; max-width: 420px; padding: 1.5rem; }
.auth .card h1 { margin-bottom: 1rem; }
.auth .btn.primary { width: 100%; }
.auth .alt { text-align: center; margin: 1rem 0 0; font-size: .92rem; }
.qr { display: block; margin: 0 auto 1rem; background: #fff; padding: 8px; border-radius: 8px; max-width: 100%; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; font-size: .88em; overflow-wrap: anywhere; }

.matrix select { min-height: 36px; padding: .25rem .5rem; min-width: 8.5rem; }
.member-card header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .75rem; }
.member-card header .grow { flex: 1; min-width: 12rem; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.perm-row:first-of-type { border-top: 0; }

/* ---- Saisie d'opération : liste des tiers, création rapide de catégorie ---- */
.combobox { position: relative; }
.combobox-list {
    position: absolute; z-index: 40; left: 0; right: 0; top: 100%;
    max-height: min(18rem, 50vh); overflow-y: auto; margin: .25rem 0 0; padding: .25rem; list-style: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
}
.combobox-list li {
    display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
    padding: .55rem .7rem; border-radius: 6px; cursor: pointer;
}
.combobox-list li small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.combobox-list li:hover, .combobox-list li[aria-selected="true"] { background: var(--primary-soft); }
.combobox-list li.is-new { color: var(--primary); font-weight: 600; }
.btn.link.small-link { font-size: .85rem; margin-top: .35rem; }
.quick-add { border: 1px dashed var(--primary); border-radius: 10px; padding: .75rem .9rem; margin: -.25rem 0 1rem; background: var(--primary-soft); }
.quick-add > strong { display: block; margin-bottom: .5rem; }
@keyframes flash-fill { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent); } to { box-shadow: 0 0 0 3px transparent; } }
.flash-fill { animation: flash-fill 1.2s ease-out; }
details.payee-row > summary { list-style: none; cursor: pointer; }
details.payee-row > summary::-webkit-details-marker { display: none; }

/* ---- Tableau de bord : dépenses par catégorie ---- */
.month-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.month-bar select { width: auto; min-width: 11rem; flex: 1 1 11rem; max-width: 16rem; min-height: 36px; padding: .3rem .6rem; }
.month-bar .segmented { flex: 0 0 auto; }
.month-bar .segmented label { padding: .35rem .8rem; font-size: .88rem; }
.summary-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; margin: 0 0 .75rem; }
.category-bars { list-style: none; margin: 0 0 .5rem; padding: 0; }
.category-bars > li { border-top: 1px solid var(--border); padding: .55rem 0; }
.category-bars > li:first-child { border-top: 0; }
.category-bar .progress { display: block; margin-bottom: 0; }
.delta { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--neg); }
.delta.down { color: var(--pos); }
.delta.income.up { color: var(--pos); }
.delta.income.down { color: var(--neg); }
.category-bar { display: block; color: inherit; text-decoration: none; border-radius: 8px; }
.category-bar:hover { text-decoration: none; }
.category-bar:hover .name { color: var(--primary); text-decoration: underline; }
.category-bar-head, .category-children a { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.category-bar-head .name { font-weight: 600; }
.category-bar-head .amounts { white-space: nowrap; }
.category-children { list-style: none; margin: .2rem 0 0; padding: 0 0 0 1rem; font-size: .9rem; }
.category-children a { color: var(--muted); padding: .15rem 0; text-decoration: none; }
.category-children a:hover { color: var(--primary); }
.check-list { display: grid; gap: .35rem; margin: .5rem 0; }
@media (min-width: 600px) { .check-list { grid-template-columns: 1fr 1fr; } }
.check-item { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 500; cursor: pointer; }

/* ---- Messages : fermer, copier, décompte ---- */
.flash { position: relative; overflow: hidden; padding: .6rem .6rem .6rem 1rem; transition: opacity .18s, transform .18s; }
.flash.is-leaving { opacity: 0; transform: translateY(-4px); }
.flash-body { display: flex; align-items: flex-start; gap: .75rem; }
.flash-text { flex: 1; min-width: 0; padding-top: .2rem; }
.flash-text ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.flash-actions { display: flex; gap: .25rem; flex: none; }
.flash-btn {
    min-height: 32px; padding: .2rem .65rem; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); border-radius: 6px;
    background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.flash-btn:hover { background: var(--surface-2); }
.flash-btn.close { min-width: 32px; padding: 0; font-size: 1.2rem; line-height: 1; border-color: transparent; background: transparent; }
.flash-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; background: color-mix(in srgb, currentColor 30%, transparent); }
@media (prefers-reduced-motion: reduce) { .flash { transition: none; } }

/* ---- Rapports : lignes cliquables ---- */
.clickable-rows a, table td.num a { color: inherit; text-decoration: none; }
.clickable-rows tr:hover td, .clickable-rows tr:hover td a { color: var(--primary); }
.clickable-rows a:hover, table td.num a:hover { text-decoration: underline; }

/* ---- Bourse ---- */
.market-source { margin-top: -.5rem; }
.index-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); margin-bottom: 1rem; }
.index-card { margin: 0; padding: .8rem .9rem; display: flex; flex-direction: column; gap: .2rem; }
.index-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.index-head small { font-size: .72rem; }
.index-price { display: flex; align-items: baseline; gap: .5rem; font-size: 1.15rem; }
.sparkline { width: 100%; height: 34px; }
.sparkline.pos { color: var(--pos); }
.sparkline.neg { color: var(--neg); }
.delta-chip { font-size: .8rem; font-weight: 600; }
.section-title { margin: 1.25rem 0 .75rem; font-size: 1.1rem; }
.portfolio-total { font-size: .85rem; font-weight: 400; }
.positions td a { color: inherit; }
.warn-text { color: var(--warn); }
.small-value { font-size: 1.1rem; }
table tfoot td { border-top: 2px solid var(--border); }

/* Justificatifs : photo du ticket et fichiers joints */
.receipt-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.receipt-buttons[hidden] { display: none; }
.receipt-buttons .btn { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.receipt-buttons input:disabled + * , .receipt-buttons label:has(input:disabled) { opacity: .5; pointer-events: none; }
.receipt-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .4rem; }
.receipt-list:empty { display: none; }
.receipt-list li { display: flex; align-items: center; gap: .6rem; padding: .35rem; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.receipt-list img, .receipt-badge { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.receipt-badge { display: grid; place-items: center; background: var(--surface-2); font-size: .7rem; font-weight: 700; color: var(--muted); }
.receipt-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }

/* Application installable */
.install-hint[hidden] { display: none; }
.install-hint { padding: .25rem .25rem 0; }
.install-hint .btn.link { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem .75rem; text-align: left; }
.install-hint small { display: block; padding: .25rem .75rem; }

/* Import : vérification et rapprochement */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Guide « Bien démarrer » et données d'exemple ---- */
.onboarding { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-top: 1px solid var(--border); }
.step:first-child { border-top: 0; }
.step .grow { flex: 1 1 14rem; min-width: 0; }
.step > .btn { white-space: nowrap; }
@media (max-width: 600px) {
    /* Téléphone : le bouton passe sous le texte de l'étape au lieu de se couper en plusieurs lignes. */
    .step { flex-wrap: wrap; }
    .step > .btn { margin-left: calc(28px + .75rem); }
}
.step .title { display: block; font-weight: 600; }
.step .sub { display: block; color: var(--muted); font-size: .85rem; }
.step-mark {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .85rem;
}
.step.is-done .step-mark { background: color-mix(in srgb, var(--pos) 18%, transparent); color: var(--pos); }
.step.is-done .title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.onboarding-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); font-size: .88rem; }
.onboarding-foot .btn.link { font-size: .88rem; }
.btn.link.muted-link { color: var(--muted); font-weight: 400; }
.sample-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .9rem; margin-bottom: 1rem; border-radius: 8px; border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); font-size: .88rem; }
.quick-budgets .check-item { cursor: pointer; }
.quick-budgets .title { white-space: normal; }
.amount-field { display: inline-flex; align-items: center; gap: .35rem; margin: 0; flex: none; color: var(--muted); font-size: .85rem; }
.amount-field input { width: 5.5rem; min-height: 36px; padding: .3rem .5rem; text-align: right; font-size: 1rem; font-weight: 500; }
.card.flush > .form-actions { margin: 0; padding: .75rem 1rem 1rem; border-top: 1px solid var(--border); }
.review-target { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
.review-target .field { margin: 0; min-width: min(100%, 18rem); }
.review-check { margin: .75rem 0 0; font-size: .9rem; }
.review-check.ok { color: var(--pos); }
.review-check.warn { color: var(--warn); }
.review-list > li { align-items: flex-start; }
.review-list .title { white-space: normal; }
.review-action { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }
.review-action select { max-width: 100%; font-size: .85rem; padding: .3rem .4rem; }
.review-duplicate { opacity: .6; }
.review-match .review-action select:first-of-type { border-color: var(--primary); }
.sticky-actions { position: sticky; bottom: calc(var(--nav-height) + .5rem); z-index: 5; background: var(--bg); padding: .5rem 0; }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }
.budget-group { margin: 1.25rem 0 .5rem; font-size: .95rem; color: var(--muted); }
.field--inline { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.field--inline label { margin: 0; }
ul.plain { margin: 0; padding-left: 1.1rem; }
.settle-list > li { padding-left: 0; padding-right: 0; }

/* Abonnement */
.billing-banner { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; background: var(--primary-soft); color: var(--text); }
.billing-banner.warn { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); }
.billing-banner.danger { background: color-mix(in srgb, var(--neg) 14%, var(--surface)); }
.billing-banner a { font-weight: 600; white-space: nowrap; }
.plan-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 800px) { .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.plan-card { display: flex; flex-direction: column; gap: .5rem; }
.plan-card.current { outline: 2px solid var(--primary); }
.plan-card.featured { border-color: var(--primary); }
.plan-price { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.plan-card ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--muted); }
.plan-card form, .plan-card .plan-action { margin-top: auto; }
.legal { max-width: 46rem; }
.legal h2 { margin-top: 1.5rem; font-size: 1.1rem; }
.legal .todo { background: color-mix(in srgb, var(--warn) 20%, transparent); padding: 0 .2rem; border-radius: 3px; }
.public { max-width: 72rem; margin: 0 auto; padding: 1rem 16px 2rem; }
.public-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.public-head .brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.public-head nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.legal-footer { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; justify-content: center; margin-top: 2rem; font-size: .85rem; }
.legal-footer a { color: var(--muted); }

/* Véhicules */
.vehicle-card { color: inherit; text-decoration: none; display: block; }
.vehicle-card:hover { border-color: var(--primary); }
.vehicle-card.archived { opacity: .7; }
.vehicle-card h2 { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.fuel-grid { grid-template-columns: 1fr 1fr; }

/* Support */
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.thread-item { padding: .75rem .9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.thread-item.from-support { background: var(--primary-soft); border-color: transparent; }
.thread-item.internal { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-style: dashed; }
.thread-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .35rem; font-size: .9rem; }
.thread-body { white-space: normal; overflow-wrap: anywhere; }
.thread-file { margin: .5rem 0 0; font-size: .9rem; }
.retention-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: 0 1rem .75rem; }
.list label.grow { cursor: pointer; }
@media (min-width: 900px) { .support-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }

/* ---- Clés d'accès ---- */
.passkey-login { margin-top: .75rem; display: grid; gap: .5rem; }
.passkey-btn { width: 100%; justify-content: center; gap: .5rem; }

/* ---- Lecture des tickets ---- */
.receipt-reading { margin: .4rem 0 0; padding: .45rem .7rem; border-radius: 8px; background: var(--primary-soft); color: var(--text); font-size: .88rem; }
