:root {
    --bg: #f6f7f9;
    --bg-elev: #ffffff;
    --ink: #111111;
    --ink-secondary: #2a2a2a;
    --muted: #5c5c5c;
    --line: #d8dbe0;
    --line-light: #eef0f3;
    --header: #141414;
    --header-ink: #ffffff;
    --accent: #0b6e4f;
    --accent-hover: #095c42;
    --accent-soft: #e7f5ef;
    --accent-ring: rgba(11, 110, 79, 0.18);
    --accent-ink: #fff;
    --danger: #b42318;
    --danger-soft: #fdeceb;
    --warn: #a15c00;
    --ok: #0b6e4f;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --tap: 48px;
    --shadow-xs: none;
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.10);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --ease: 140ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; overflow-x: hidden; color-scheme: light; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
    line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, select, textarea { color: var(--ink); background: #fff; color-scheme: light; }
select option, select optgroup { color: var(--ink); background: #fff; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ─── LOGIN ──────────────────────────────────────────────── */
.login {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 20px 24px;
    overflow: hidden;
}
.login-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 90% 55% at 50% -5%, rgba(11, 110, 79, 0.14), transparent 58%),
        radial-gradient(circle at 85% 90%, rgba(255, 216, 77, 0.18), transparent 35%),
        #f3f5f4;
}
.login-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    animation: loginIn 0.4s ease both;
}
@keyframes loginIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 28px;
}
.login-mark-wrap {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: #111;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    box-shadow: 0 10px 28px rgba(17, 17, 17, 0.18);
}
.login-mark {
    width: 40px;
    height: 46px;
    display: block;
}
.login-brand h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.04em;
    color: var(--ink);
    line-height: 1.1;
}
.login-brand .sub {
    margin: 8px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}
.login-form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px 20px 20px;
    box-shadow: 0 8px 28px rgba(17, 17, 17, 0.06);
}
.login-form .field { margin-bottom: 14px; }
.login-form .field:last-of-type { margin-bottom: 18px; }
#login-error { margin: 0 0 14px; }
#login-error:empty { display: none; margin: 0; }
.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--ink-secondary);
}
.login-form input {
    width: 100%;
    height: var(--tap);
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
}
.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:hover,
.login-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 40px #fff inset;
    transition: background-color 9999s ease-in-out 0s;
    caret-color: var(--ink);
}
.login-form .btn {
    margin-top: 0;
    min-height: 50px;
    font-size: 16px;
}
.login-form .alert,
#login-error .alert { border: 1px solid rgba(180, 35, 24, 0.2); }
.login-forgot {
    display: block;
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.login-forgot:hover { color: var(--accent); }
.login-footer {
    position: relative;
    z-index: 1;
    margin-top: 28px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
    opacity: 0.7;
    text-align: center;
    line-height: 1.6;
}
.login-desktop-link {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}
.login-desktop-link:hover { color: var(--accent); opacity: 1; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    width: 100%;
}
.btn:hover:not(:disabled) { background: var(--accent-hover); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost {
    background: transparent;
    color: var(--muted);
    width: auto;
    min-height: 36px;
    padding: 0 10px;
    box-shadow: none;
}
.btn.ghost:hover { color: var(--ink); background: var(--line-light); }
.btn.sm {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 40px;
    border-radius: 8px;
    width: auto;
}
.btn-lg { min-height: 52px; font-size: 16px; border-radius: var(--radius); }
.btn.danger-outline {
    width: 100%;
    background: #fff;
    color: var(--danger);
    border: 1.5px solid rgba(180, 35, 24, 0.35);
    box-shadow: none;
}
.btn.danger-outline:hover:not(:disabled) {
    background: var(--danger-soft);
}

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(180, 35, 24, 0.15);
}

/* ─── HEADER ─────────────────────────────────────────────── */
.top {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header);
    color: var(--header-ink);
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 800;
    flex: 0 0 auto;
    letter-spacing: -0.02em;
}
.top-ent {
    position: relative;
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.picker-wrap { position: relative; min-width: 0; }
.top-ent > span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.picker-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 170px;
    min-height: 36px;
    padding: 0 10px 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}
.picker-btn small {
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}
.picker-btn .lbl { min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-btn .chev { flex-shrink: 0; opacity: 0.65; font-size: 10px; }
.picker-btn.is-open { background: rgba(255, 255, 255, 0.18); }
.picker-btn.picker-static { cursor: default; user-select: none; }

.picker-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 110;
    min-width: min(260px, 82vw);
    max-height: min(50vh, 300px);
    overflow-y: auto;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}
.picker-menu[hidden] { display: none !important; }
.picker-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
}
.picker-menu button:hover { background: var(--line-light); }
.picker-menu button.active { background: var(--accent-soft); color: var(--accent); }
.picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.25);
}

/* ─── PAGE ───────────────────────────────────────────────── */
.page {
    flex: 1;
    padding: 18px 14px 104px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
}
.card h2 {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
}
.card h2 .count { font-weight: 600; color: var(--muted); font-size: 14px; }

/* ─── KPI ────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.kpi span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kpi strong {
    display: block;
    font-size: 22px;
    margin-top: 6px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.kpi small { color: var(--muted); font-size: 13px; }
.kpi small.up { color: var(--ok); font-weight: 700; }
.kpi small.down { color: var(--danger); font-weight: 700; }

/* ─── FORMS ──────────────────────────────────────────────── */
form.stack label,
.field-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--ink-secondary);
}
form.stack .field { margin-bottom: 14px; }
form.stack input,
form.stack select {
    width: 100%;
    height: var(--tap);
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
}
form.stack input:focus,
form.stack select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
form.stack select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235c5c5c' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ─── CAISSE ─────────────────────────────────────────────── */
.caisse-form-card { position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 5; }
.caisse-site-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    border: 1px solid rgba(11, 110, 79, 0.18);
}
.caisse-site-badge::before { content: "📍"; }

.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 420px) { .type-grid { grid-template-columns: repeat(3, 1fr); } }
.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 78px;
    padding: 12px 8px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.type-btn:active { transform: scale(0.97); }
.type-btn.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.type-emoji { font-size: 26px; line-height: 1; }
.type-label {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
    color: var(--muted);
}
.type-btn.active .type-label { color: var(--accent); }

.caisse-amount {
    font-size: 34px !important;
    font-weight: 800 !important;
    text-align: center;
    letter-spacing: -0.03em;
    height: 60px !important;
    font-variant-numeric: tabular-nums;
}
.field-date input { font-size: 16px !important; }

/* ─── TX LIST ────────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.tx-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.tx-emoji { font-size: 24px; line-height: 1; flex-shrink: 0; }
.tx-body { min-width: 0; }
.tx-body strong { display: block; font-size: 15px; font-weight: 700; }
.tx-meta { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.tx-amt {
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tx-actions { display: flex; gap: 6px; }
.tx-card.is-editing {
    border-color: var(--ink);
    background: #f7f7f8;
}
.btn-icon-edit,
.btn-icon-del {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.btn-icon-edit {
    background: var(--line-light);
    color: var(--ink);
}
.btn-icon-del {
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 18px;
}
.caisse-form-card.is-editing {
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
}
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tx { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.tx:first-of-type { border-top: 0; padding-top: 0; }
.tx .meta { color: var(--muted); font-size: 13px; grid-column: 1 / -1; }
.tx .amt { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* ─── TOAST ──────────────────────────────────────────────── */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(8px);
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--header);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 200;
    box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-ok { background: var(--accent); }
.toast-err { background: var(--danger); }

/* ─── NAV ────────────────────────────────────────────────── */
.nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    z-index: 25;
}
.nav-item {
    position: relative;
    flex: 1 1 0;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 54px;
    padding: 6px 4px 4px;
    border-radius: 10px;
    color: #6b6b6b;
    font-size: 12px;
    font-weight: 600;
}
.nav-item:active { transform: scale(0.95); }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
}
.nav-icon { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.nav-icon svg { width: 22px; height: 22px; display: block; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-label { line-height: 1.1; font-weight: 700; }

/* ─── MISC ───────────────────────────────────────────────── */
.empty { color: var(--muted); font-size: 15px; padding: 6px 0; }

/* ─── BANQUE ─────────────────────────────────────────────── */
.banque-available {
    padding: 14px 16px;
    border: 1.5px solid rgba(11, 110, 79, 0.28);
    background: var(--accent-soft);
    border-radius: var(--radius);
    margin: 8px 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-secondary);
}
.banque-available strong {
    color: var(--accent);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.banque-year strong { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ─── OUTILS / MORE ──────────────────────────────────────── */
.more-list { display: flex; flex-direction: column; gap: 10px; }
.more-list button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    font-weight: 700;
    color: var(--ink);
    font-size: 16px;
}
.more-list button:active:not(:disabled) { background: var(--line-light); }
.more-list button:disabled { opacity: 0.45; cursor: not-allowed; }
.more-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.more-icon svg { width: 22px; height: 22px; display: block; }
.more-list button:disabled .more-icon {
    background: var(--line-light);
    color: var(--muted);
}
.more-text { min-width: 0; flex: 1; }
.more-list button span span,
.more-text span {
    display: block;
    font-weight: 500;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}
.more-divider {
    margin: 18px 0 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.more-logout-wrap {
    display: flex;
    justify-content: center;
    margin: 28px 0 8px;
    padding: 0 8px;
}
.logout-btn {
    width: auto;
    min-width: 200px;
    max-width: 280px;
    background: #fff;
    color: var(--danger);
    border: 1.5px solid rgba(180, 35, 24, 0.35);
    box-shadow: none;
    font-weight: 700;
}
.logout-btn:hover:not(:disabled) {
    background: var(--danger-soft);
    box-shadow: none;
}
.logout-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.page-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0 0 12px;
    padding: 8px 6px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
    width: auto;
    min-height: auto;
    border-radius: 8px;
}
.page-back svg { width: 18px; height: 18px; display: block; }
.page-back:hover { background: var(--accent-soft); }
.page-title-with-icon { display: flex; align-items: center; gap: 10px; }
.page-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}
.page-title-icon svg { width: 18px; height: 18px; display: block; }

/* ─── DASHBOARD ──────────────────────────────────────────── */
.page-dash { max-width: 1280px; }
.dash-hello { text-align: center; margin: 0 0 22px; }
.dash-hello h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.dash-hello p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.dash-hello h3 { margin: 12px 0 0; font-size: 17px; font-weight: 700; color: var(--ink-secondary); }

.ht-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    user-select: none;
}
.ht-switch .on { color: var(--ink); }
.ht-switch input {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    border-radius: 99px;
    background: #c5c5c5;
    position: relative;
    cursor: pointer;
    border: 0;
    padding: 0;
    flex: 0 0 44px;
}
.ht-switch input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: left 150ms ease;
}
.ht-switch input:checked { background: var(--accent); }
.ht-switch input:checked::after { left: 23px; }

.dash-urg {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
}
.dash-urg.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(180, 35, 24, 0.15); }
.dash-urg.warning { background: #fff6e8; color: var(--warn); border: 1px solid rgba(161, 92, 0, 0.15); }
.dash-urg.info { background: #eef4ff; color: #1d4ed8; border: 1px solid rgba(29, 78, 216, 0.12); }

.cards-container { display: grid; grid-template-columns: 1fr; gap: 14px; }
.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 16px 16px;
    text-align: center;
}
.stat-header {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-date { font-size: 14px; color: var(--accent); margin: 6px 0 12px; font-weight: 600; }
.stat-amount {
    font-size: 32px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 14px;
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    font-variant-numeric: tabular-nums;
}
.unit-label { font-size: 16px; color: var(--accent); font-weight: 800; }
.modes-title {
    display: block;
    text-align: left;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.modes { list-style: none; padding: 0; margin: 0 0 12px; text-align: left; }
.modes li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-light);
    font-size: 15px;
}
.modes li:last-child { border-bottom: 0; }
.stat-evolution {
    font-size: 14px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 12px;
    text-align: left;
}
.stat-date-old { font-size: 13px; color: #4338ca; margin: 4px 0 8px; font-weight: 600; }
.evo-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-variant-numeric: tabular-nums;
}
.evo-line .up { color: var(--ok); font-weight: 800; }
.evo-line .down { color: var(--danger); font-weight: 800; }

.chart-container {
    margin-top: 14px;
    padding: 12px 8px 6px;
    border-radius: var(--radius);
    background: var(--line-light);
    overflow-x: auto;
}
.bars { width: 100%; height: 118px; display: block; }
.bar-val { font-size: 10px; font-weight: 800; fill: var(--ink); }
.bar-lbl { font-size: 10px; fill: var(--muted); font-weight: 600; }

@media (min-width: 900px) { .cards-container { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .cards-container { grid-template-columns: repeat(4, 1fr); } }

/* ─── ADMIN ──────────────────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 0;
    margin: 12px 0;
    background: #fff;
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--line);
}
.admin-tab {
    flex: 1;
    padding: 11px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
}
.admin-tab.active {
    background: var(--accent);
    color: #fff;
}
.admin-content { padding: 16px; }
.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-light);
    font-size: 15px;
}
.admin-row:last-child { border-bottom: 0; }
.admin-user-row { flex-wrap: wrap; }
.admin-user-row > div { min-width: 0; flex: 1; }
.admin-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.admin-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.admin-inline-form input,
.admin-inline-form select {
    flex: 1;
    min-width: 90px;
    height: 42px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}
.admin-form-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.admin-form-block input,
.admin-form-block select {
    height: 44px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}
.admin-form-block select[multiple] { height: 96px; }
.admin-details summary {
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
    padding: 10px 0;
}
.admin-ent-list { display: flex; flex-direction: column; gap: 8px; }
.admin-ent-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    text-align: left;
}
.admin-ent-btn:active { background: var(--line-light); }
.admin-ent-btn strong { font-size: 16px; font-weight: 700; }
.admin-ent-btn small { color: var(--muted); font-size: 13px; }
.admin-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 20px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-section-title::before {
    content: "";
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--accent);
    flex-shrink: 0;
}
.admin-section-title:first-of-type { border-top: 0; margin-top: 4px; padding-top: 0; }

.admin-user-btn {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line-light);
    background: transparent;
    cursor: pointer;
    text-align: left;
    border-radius: 0;
}
.admin-user-btn:hover { background: var(--line-light); }
.admin-edit-hint {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}
.admin-user-edit {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}
.admin-user-edit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.admin-user-edit-head .page-back { margin: 0; }
.admin-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 4px 0 6px;
}
.admin-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-secondary);
    cursor: pointer;
}
.admin-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.admin-edit-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

/* ─── MODE / PILLS ───────────────────────────────────────── */
.mode {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid var(--line-light);
    font-size: 15px;
}
.mode:first-of-type { border-top: 0; padding-top: 0; }
.urg { padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.urg:first-of-type { border-top: 0; padding-top: 0; }
.pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--line-light);
    margin-right: 6px;
}
.pill.critique { background: var(--danger-soft); color: var(--danger); }
.pill.eleve { background: #fff6e8; color: var(--warn); }

/* ─── RÉCAP ──────────────────────────────────────────────── */
.recap-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.recap-nav-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.recap-nav-label { flex: 1; text-align: center; position: relative; }
.recap-nav-label strong { display: block; font-size: 17px; font-weight: 800; }
.recap-nav-label input[type="month"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    border: 0;
}
.recap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.recap-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    padding: 4px 0 8px;
}
.recap-day {
    aspect-ratio: 1;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    color: var(--muted);
}
.recap-day.empty { visibility: hidden; pointer-events: none; }
.recap-day.has {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}
.recap-day.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.recap-day.low .recap-day-amt { color: var(--danger); }
.recap-day.medium .recap-day-amt { color: var(--warn); }
.recap-day.high .recap-day-amt { color: var(--ok); }
.recap-day-num { font-size: 13px; font-weight: 700; line-height: 1; }
.recap-day-amt { font-size: 11px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.recap-day:disabled { cursor: default; opacity: 0.5; }

/* ─── STATS ──────────────────────────────────────────────── */
.stats-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}
.stats-chip {
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-secondary);
    font-size: 13px;
    font-weight: 700;
}
.stats-chip:active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.stats-filter { display: flex; flex-direction: column; gap: 10px; }
.stats-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats-dates label { display: flex; flex-direction: column; gap: 6px; }
.stats-dates input {
    height: 44px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
}
.stats-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.stats-kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.stats-kpi span {
    display: block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.stats-kpi strong {
    display: block;
    margin-top: 6px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* ─── COMPTA ─────────────────────────────────────────────── */
.compta-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 16px;
}
.compta-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}
.compta-step.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.compta-step.done {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.compta-step-sep {
    width: 28px;
    height: 2px;
    background: var(--line);
    border-radius: 2px;
}
.compta-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
}
.compta-actions .btn { width: auto; flex: 1; min-width: 140px; }
.compta-prime-card h2 { font-size: 16px; margin-bottom: 8px; }
.compta-sal-edit {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

/* ─── MON COMPTE ─────────────────────────────────────────── */
.compte-hero {
    display: flex;
    align-items: center;
    gap: 14px;
}
.compte-hero h2 { margin: 0 0 4px; font-size: 20px; }
.compte-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--line);
    background: var(--line-light);
}
.compte-photo-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(11, 110, 79, 0.25);
}
