/* ==========================================================================
   Gestion des dépenses — feuille de style (sans framework)
   Clair / sombre · responsive mobile → desktop
   ========================================================================== */
:root {
    --bg: #f4f5fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e6e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-soft: #eef0ff;
    --danger: #e11d48;
    --danger-soft: #fff1f3;
    --success: #059669;
    --warning: #d97706;
    --track: #eef0f5;
    --sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
    --shadow-lg: 0 10px 40px rgba(15, 23, 42, .12);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color-scheme: light;
}
[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #131a2e;
    --surface-2: #182038;
    --border: #232c46;
    --text: #e5e9f5;
    --muted: #8b95b0;
    --primary: #6366f1;
    --primary-600: #818cf8;
    --primary-soft: rgba(99, 102, 241, .14);
    --danger-soft: rgba(225, 29, 72, .14);
    --track: #222b45;
    --sidebar: #0a0f1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .88em; }
.ico { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.link { color: var(--primary); font-weight: 600; font-size: .88rem; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40;
    background: var(--sidebar); color: var(--sidebar-text);
    display: flex; flex-direction: column; padding: 20px 16px;
    transition: transform .25s ease;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.brand-logo {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #6366f1, #a855f7); box-shadow: 0 6px 18px rgba(99, 102, 241, .45);
}
.brand-logo.lg { width: 56px; height: 56px; border-radius: 16px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
    font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav a.active { background: rgba(99, 102, 241, .18); color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
.nav a.active .ico { color: #a5b4fc; }
.sidebar-cta { margin-top: 22px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .icon-btn { color: var(--sidebar-text); margin-left: auto; }
.user-chip .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
    background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: .75rem; }

.main { flex: 1; min-width: 0; margin-left: 260px; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
    padding: 18px 32px; background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1.5rem; margin: 0; }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { padding: 8px 32px 32px; display: flex; flex-direction: column; gap: 22px; }
.app-footer { display: flex; justify-content: space-between; padding: 16px 32px 24px; color: var(--muted); font-size: .8rem; margin-top: auto; }
.backdrop { display: none; }
.only-mobile { display: none !important; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 720px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font: 600 .9rem var(--font); cursor: pointer;
    transition: transform .08s, background .15s, box-shadow .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: .82rem; border-radius: 10px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn {
    width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
    border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; font-size: 1.3rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.topbar .icon-btn { background: var(--surface); border: 1px solid var(--border); }
.show-dark { display: none; }
[data-theme="dark"] .show-dark { display: inline; }
[data-theme="dark"] .show-light { display: none; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; } .col-12 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field em { font-weight: 400; font-style: normal; opacity: .8; }
input, select, textarea {
    width: 100%; font: 400 .95rem var(--font); color: var(--text); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 42px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 40px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.section-title { margin: 8px 0 -4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); }
.amount-field input { font-size: 2rem; font-weight: 700; height: 64px; letter-spacing: -.02em; }
.form-layout { max-width: 820px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); font-size: .88rem; font-weight: 500; transition: all .15s;
}
.chip span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip:hover span { border-color: var(--c); }
.chip input:checked + span { background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-color: var(--c); color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.chip input:focus-visible + span { outline: 2px solid var(--c); outline-offset: 2px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 32px; height: 32px; border-radius: 10px; cursor: pointer; transition: transform .12s; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.swatches span:hover { transform: scale(1.08); }
.swatches input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }

/* ---------- Alertes ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; font-size: .92rem; border: 1px solid; }
.alert .ico { margin-top: 1px; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); color: var(--text); }
[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .3); color: #6ee7b7; }
[data-theme="dark"] .alert-error { background: rgba(225, 29, 72, .12); border-color: rgba(225, 29, 72, .3); color: #fda4af; }
[data-theme="dark"] .alert-warning { background: rgba(217, 119, 6, .12); border-color: rgba(217, 119, 6, .3); color: #fcd34d; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
    position: relative; overflow: hidden; display: flex; gap: 14px; align-items: flex-start;
    padding: 20px; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow);
}
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.kpi-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.kpi-sky { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.kpi-amber { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.kpi-emerald { background: linear-gradient(135deg, #10b981, #059669); }
.kpi-rose { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.kpi-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); flex-shrink: 0; }
.kpi-body { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
.kpi-lbl { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.kpi-val { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: .8rem; opacity: .9; }

/* ---------- Graphiques ---------- */
.donut-wrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: center; }
.donut { width: 100%; max-width: 200px; }
.donut circle { transition: stroke-width .15s; }
.donut circle:hover { stroke-width: 30; }
.donut-big { font-size: 30px; font-weight: 800; fill: var(--text); }
.donut-small { font-size: 12px; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.lg-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-val { font-weight: 600; text-align: right; white-space: nowrap; }
.lg-val small { display: inline-block; min-width: 42px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: middle; flex-shrink: 0; }
.sw-line { width: 16px; height: 0; border-top: 2px dashed var(--danger); border-radius: 0; }
.legend-inline { font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; }
.bars-wrap { height: 240px; }
.bars-wrap.tall { height: 300px; }
.bars { width: 100%; height: 100%; overflow: visible; }
.bars .grid { stroke: var(--border); stroke-dasharray: 3 4; }
.bars .bar { fill: color-mix(in srgb, var(--primary) 28%, var(--track)); transition: fill .15s; }
.bars .bar.hi, .bars .bar:hover { fill: var(--primary); }
.bars .axis { font-size: 12px; fill: var(--muted); }
.bars .budget-line { stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 6 5; }
.bars .budget-lbl { font-size: 11px; fill: var(--danger); font-weight: 600; }

/* ---------- Budgets / progression ---------- */
.budgets { display: flex; flex-direction: column; gap: 16px; }
.budget-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-weight: 500; font-size: .92rem; }
.progress { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--primary)); transition: width .6s ease; }
.progress.warn span { background: var(--warning); }
.progress.over span { background: var(--danger); }

/* ---------- Liste de transactions ---------- */
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.tx-list li:last-child { border-bottom: 0; }
.tx-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); flex-shrink: 0; }
.tx-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tx-main a { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main a:hover { color: var(--primary); }
.tx-main small { color: var(--muted); font-size: .8rem; }
.tx-amt { white-space: nowrap; font-size: .92rem; }

/* ---------- Tableaux ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head { padding: 20px 22px 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th a:hover { color: var(--primary); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tfoot td { background: var(--surface-2); font-weight: 600; border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.w-check { width: 44px; }
.w-actions { width: 90px; text-align: right; white-space: nowrap; }
.w-actions form { display: inline; }
.pivot td, .pivot th { padding: 11px 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.status { font-size: .8rem; font-weight: 600; }
.status::before { content: "● "; }
.status.on { color: var(--success); } .status.off { color: var(--muted); }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--primary-soft); border-bottom: 1px solid var(--border); font-size: .9rem; }
.bulk-bar[hidden] { display: none; }
.pagination { display: flex; justify-content: center; gap: 6px; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--muted); }
.pagination a:hover { background: var(--surface-2); color: var(--text); }
.pagination a.active { background: var(--primary); color: #fff; }

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 18px; }
.filters .field { flex: 1 1 150px; }
.filters .field.grow { flex: 3 1 240px; }
.filters-actions { display: flex; gap: 8px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--muted); }
.empty .ico { opacity: .5; }
.empty p { margin: 0 0 6px; }

.month-picker { display: flex; align-items: center; gap: 6px; }
.month-picker input { width: auto; min-height: 38px; padding: 6px 10px; background: var(--surface); }
.month-picker .year { font-weight: 700; padding: 0 6px; }

/* ---------- Catégories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cat-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-top: 4px solid var(--c); transition: transform .15s, box-shadow .15s; }
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cat-card.selected { box-shadow: 0 0 0 2px var(--c), var(--shadow-lg); }
.cat-top { display: flex; align-items: center; gap: 12px; }
.cat-dot { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--c); flex-shrink: 0; }
.cat-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cat-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-title small { color: var(--muted); font-size: .78rem; }
.cat-amounts strong { font-size: 1.2rem; font-weight: 800; margin-right: 6px; }
.cat-amounts span { font-size: .85rem; }
.side-form { position: sticky; top: 96px; }
.danger-zone { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border); }
.danger-zone h3 { color: var(--danger); margin: 0; }

/* ---------- Paramètres ---------- */
.tabs { display: flex; gap: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--primary); color: #fff; }
.dl { display: grid; grid-template-columns: 200px 1fr; gap: 12px 20px; margin: 0 0 20px; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; font-weight: 600; }

/* ---------- Connexion ---------- */
.auth-body { background: var(--surface); }
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-side {
    background: radial-gradient(circle at 20% 20%, #818cf8 0, transparent 40%), radial-gradient(circle at 80% 70%, #c084fc 0, transparent 45%), linear-gradient(135deg, #312e81, #4f46e5);
    color: #e0e7ff; display: flex; align-items: center; justify-content: center; padding: 48px;
}
.auth-side-inner { max-width: 420px; }
.auth-side h2 { color: #fff; font-size: 2.1rem; margin: 22px 0 12px; }
.auth-side p { font-size: 1.05rem; opacity: .9; }
.auth-side ul { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-side li { display: flex; align-items: center; gap: 10px; }
.auth-side li .ico { background: rgba(255, 255, 255, .18); border-radius: 50%; padding: 3px; width: 22px; height: 22px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { font-size: 1.8rem; margin: 0; }

/* ---------- Installation ---------- */
.install-body { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent), var(--bg); }
.install-wrap { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; }
.install-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.install-brand div { display: flex; flex-direction: column; }
.install-brand small { color: var(--muted); }
.install-card { padding: 32px; }
.install-card h1 { font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
.stepper { list-style: none; display: flex; padding: 0; margin: 0 0 22px; gap: 8px; counter-reset: s; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: .88rem; position: relative; }
.stepper li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; }
.stepper .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border); flex-shrink: 0; }
.stepper li.active { color: var(--text); }
.stepper li.active .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.stepper li.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper li.done::after { background: var(--primary); }
.checklist { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.checklist li.ok .ico { color: var(--success); }
.checklist li.ko { border-color: #fecdd3; }
.checklist li.ko .ico { color: var(--danger); }
.success-hero { text-align: center; padding: 20px 0; }
.success-hero h1 { justify-content: center; }
.success-icon { width: 76px; height: 76px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 10px 30px rgba(16, 185, 129, .4); margin-bottom: 16px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
    .main { margin-left: 0; }
    .only-mobile { display: inline-grid !important; }
    .grid-2, .split { grid-template-columns: minmax(0, 1fr); }
    .side-form { position: static; }
    .hide-md, .hide-md-cell { display: none; }
}
@media (max-width: 720px) {
    body { font-size: 14px; }
    .topbar { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
    .topbar-title { flex: 1; }
    .topbar-title h1 { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-title p { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-actions { gap: 6px; }
    .topbar-actions .btn { height: 38px; padding: 0 12px; }
    .month-picker { flex: 1; }
    .topbar-actions:has(.month-picker) { width: 100%; }
    .month-picker input { flex: 1; }
    .badge { white-space: nowrap; }
    .content { padding: 4px 14px 20px; gap: 16px; }
    .app-footer { padding: 12px 16px 20px; }
    .card { padding: 16px; }
    .kpis, .kpis-3 { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .kpi { padding: 16px; }
    .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .legend { width: 100%; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid > * { grid-column: 1 / -1 !important; }
    .form-actions .btn { flex: 1; }
    .hide-sm { display: none !important; }
    .auth { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .install-card { padding: 20px; }
    .stepper .lbl { display: none; }
    .dl { grid-template-columns: 1fr; gap: 2px; }
    .dl dd { margin-bottom: 10px; }
    .filters-actions { width: 100%; }
    .filters-actions .btn { flex: 1; }

    /* Liste des dépenses en cartes */
    .table-cards thead { display: none; }
    .table-cards tbody tr {
        display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px;
        grid-template-areas: "chk lib amt" "chk cat act" "chk date act";
        padding: 14px; border-bottom: 1px solid var(--border); align-items: center;
    }
    .table-cards td { border: 0; padding: 0; min-width: 0; }
    .table-cards td.w-check { grid-area: chk; width: auto; }
    .table-cards td[data-label="Libellé"] { grid-area: lib; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .table-cards td[data-label="Libellé"] small { display: none; }
    .table-cards td[data-label="Montant"] { grid-area: amt; text-align: right; }
    .table-cards td[data-label="Catégorie"] { grid-area: cat; }
    .table-cards td[data-label="Catégorie"] .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
    .table-cards td[data-label="Date"] { grid-area: date; color: var(--muted); font-size: .8rem; }
    .table-cards td.w-actions { grid-area: act; width: auto; display: flex; gap: 2px; justify-content: flex-end; }
    .table-cards tfoot tr { display: flex; justify-content: space-between; padding: 14px; }
    .table-cards tfoot td { padding: 0; background: none; }
}
@media print {
    .sidebar, .topbar-actions, .filters, .w-actions, .w-check, .app-footer { display: none !important; }
    .main { margin: 0; }
}
