/* ============================================================
   IDENTITY — Couche 3 (composants Fineas)
   Bibliothèque de composants utilisant uniquement des tokens.
   Fichier unique : aucun autre fichier composant n'est chargé.

   Sections :
   1. Base (body, page, global resets)
   2. Gradient text
   3. Boutons
   4. Cartes
   5. Formulaires
   5b. Input groups (prepend / append — inner / outer)
   6. Checkbox custom
   7. Custom select
   8. Toggle switch
   9. Toast / notification chip
   10. Validation messages
   11. Confirm card
   12. Close button
   13. Sidebar
   14. Page header
   15. Notifications panel
   16. Help popup
   17. Drawer (slide-in panel)
   17b. Editor panel (inner formatting — drawer content)
   18. Logo picker
   19. Placeholder (empty state)
   20. Badge
   21. Modal / Overlay
   22. Table
   23. Amount calculator
   24. Status utilities
   25. Scrollbar
   26. Case selector / multi-case
   27. Number input — hide spinners
   29. Info-tip (tooltip)
   30. Content-block (shared container)
   31. Trend (up / down coloring)
   32. Placeholder (empty state — dashed card)
   34. Calendar-grid (7-column calendar)
   35. Section-header (border-left accent)
   ============================================================ */

/* ================================================================
   1. BASE (body / page / global resets)
   ================================================================ */

* {
    box-sizing: border-box;
    font-family: var(--font-heading);
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base-size);
    color: var(--text-primary);
    background-color: var(--bg-body);
    display: flex;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

body::-webkit-scrollbar {
    display: none;
}

a {
    text-decoration: none;
    color: unset;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page {
    position: relative;
    display: flex;
    margin: auto;
    justify-content: space-around;
    margin-top: 10vh;
    width: 100%;
    z-index: 2;
}

/* ================================================================
   2. GRADIENT TEXT
   ================================================================ */

.gradient-text {
    background: var(--gradient-accent-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================================================================
   3. BOUTONS
   ================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Variantes ────────────────────────────────────────────── */

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    box-shadow: var(--shadow-primary-strong);
}

.btn-accent {
    background: var(--gradient-accent);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
    background: var(--gradient-accent-hover);
    box-shadow: var(--shadow-primary);
}

.btn-accent.disabled,
.btn-accent:disabled {
    background: var(--gradient-disabled);
}

.btn-secondary {
    background: var(--color-primary);
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-primary);
}

.btn-accent {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
}

.btn-accent:hover {
    background-color: var(--color-primary-dark);
}

.btn-danger {
    background: var(--gradient-danger);
    color: var(--text-on-primary);
}

.btn-danger:hover {
    box-shadow: var(--shadow-danger);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.btn-cancel:hover {
    background: var(--bg-subtle-hover);
    color: var(--text-primary);
}

.delete-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-success {
    background-color: var(--color-success);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-success);
}

.btn-success:hover {
    background-color: var(--color-success-bright);
}

.btn-ghost {
    background: var(--bg-subtle-hover);
    color: var(--text-dim);
    border: 1px solid var(--border-light);
}

.btn-ghost:hover {
    background: var(--bg-subtle-active);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--bg-nav-active);
}

.btn-link-bank {
    background: var(--gradient-accent);
    color: var(--text-on-primary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    display: inline-block;
}

.btn-link-bank:hover {
    background: var(--gradient-accent-hover);
    box-shadow: var(--shadow-primary);
}

.btn-link-bank.disabled {
    background: var(--gradient-disabled);
}

/* ── Tailles ──────────────────────────────────────────────── */

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-pill {
    border-radius: var(--radius-pill);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    font-size: 1rem;
}

/* ── Bouton icône compact ─────────────────────────────────── */

.icon-btn {
    padding: 6px 10px;
    font-size: 12px;
    box-shadow: var(--shadow-lg);
    background: var(--bg-subtle-hover);
    color: var(--text-dim);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--bg-subtle-active);
}

.icon-btn.danger {
    border-color: var(--border-danger);
    background: var(--color-danger-bg);
}

/* ================================================================
   4. CARTES
   ================================================================ */

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
}

.card-dark {
    background-color: var(--bg-card-dark);
}

.card-gradient {
    background: var(--gradient-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
}

.card-glass {
    background: var(--gradient-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 14px;
    transition: var(--transition-fast);
}

.card-elevated {
    border-radius: var(--radius-xl);
    padding: 22px;
    box-shadow: var(--shadow-lg);
}

.card-elevated:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2xl);
    border-color: var(--color-primary-glow);
}

/* Accent bar (bottom gradient line) */
.card-accent::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    background: var(--gradient-accent-teal);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    opacity: 0.6;
    transition: var(--transition-normal);
}

.card-accent:hover::after {
    width: 80%;
    opacity: 1;
}

.card h3 {
    color: var(--color-primary);
}

/* ================================================================
   5. FORMULAIRES
   ================================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition-fast);
}

.form-select {
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 6px;
    cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Select variants ──────────────────────────────────────── */

/** Outline: fond transparent, bordure primaire, flèche primaire */
.form-select-outline {
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--text-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237c3aed' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-select-outline:focus {
    background-color: var(--bg-nav-active);
}

/** Ghost: fond subtil, bordure légère, discret */
.form-select-ghost {
    background-color: var(--bg-subtle-hover);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
}

.form-select-ghost:hover {
    background-color: var(--bg-subtle-active);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

/** Filled-primary: fond primaire, texte clair (pour toolbars / headers) */
.form-select-filled {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-on-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-select-filled:hover {
    background-color: var(--color-primary-dark);
}

.form-select-filled:focus {
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* ── Select tailles ───────────────────────────────────────── */

.form-select-sm {
    padding: 5px 28px 5px 10px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    background-position: right 8px center;
    background-size: 8px 5px;
}

.form-select-lg {
    padding: 14px 40px 14px 18px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
    background-position: right 14px center;
    background-size: 12px 7px;
}

/* ── Select inline (pas full-width, pour barres de filtres) ── */

.form-select-inline {
    width: auto;
    display: inline-block;
}

/* ── Input variants ───────────────────────────────────────── */

/** Outline: fond transparent, bordure primaire */
.form-input-outline,
.form-textarea-outline {
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--text-primary);
}

.form-input-outline:focus,
.form-textarea-outline:focus {
    background-color: var(--bg-nav-active);
}

.form-input-outline::placeholder,
.form-textarea-outline::placeholder {
    color: var(--text-slate);
}

/** Ghost: fond subtil, bordure légère, discret */
.form-input-ghost,
.form-textarea-ghost {
    background-color: var(--bg-subtle-hover);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
}

.form-input-ghost:hover,
.form-textarea-ghost:hover {
    background-color: var(--bg-subtle-active);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.form-input-ghost::placeholder,
.form-textarea-ghost::placeholder {
    color: var(--text-muted);
}

/** Filled-primary: fond primaire, texte clair */
.form-input-filled,
.form-textarea-filled {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-on-primary);
}

.form-input-filled:hover,
.form-textarea-filled:hover {
    background-color: var(--color-primary-dark);
}

.form-input-filled:focus,
.form-textarea-filled:focus {
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-input-filled::placeholder,
.form-textarea-filled::placeholder {
    color: var(--text-very-dim);
}

/* ── Input tailles ────────────────────────────────────────── */

.form-input-sm,
.form-textarea-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.form-input-lg,
.form-textarea-lg {
    padding: 14px 18px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
}

/* ── Input inline (pas full-width) ────────────────────────── */

.form-input-inline {
    width: auto;
    display: inline-block;
}


.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.form-error {
    font-size: 0.78rem;
    color: var(--color-danger);
}

/* ================================================================
   5b. INPUT GROUPS (prepend / append — inner / outer)
   Vuetify-like input field with icon slots.
   - .input-group               : wrapper (flex row)
   - .input-group-prepend-outer : icon OUTSIDE border, left
   - .input-group-append-outer  : icon OUTSIDE border, right
   - .input-group-field          : contains the input + inner icons
   - .input-group-prepend-inner : icon INSIDE border, left
   - .input-group-append-inner  : icon INSIDE border, right
   - .input-group-field .form-input : the actual <input>
   ================================================================ */

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Outer icons (outside border) */
.input-group-prepend-outer,
.input-group-append-outer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-subtle-active);
    border: 1px solid var(--border-input);
    transition: var(--transition-fast);
}

.input-group:focus-within .input-group-prepend-outer,
.input-group:focus-within .input-group-append-outer {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Field wrapper (contains input + inner icons) */
.input-group-field {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.input-group-field .form-input {
    width: 100%;
}

/* Inner icons (inside border, absolutely positioned) */
.input-group-prepend-inner,
.input-group-append-inner {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
    transition: var(--transition-fast);
    z-index: 1;
}

.input-group-prepend-inner {
    left: 0;
}

.input-group-append-inner {
    right: 0;
}

/* Clickable inner icons (buttons, toggles) */
.input-group-append-inner.clickable,
.input-group-prepend-inner.clickable {
    pointer-events: auto;
    cursor: pointer;
}

.input-group-append-inner.clickable:hover,
.input-group-prepend-inner.clickable:hover {
    color: var(--color-primary);
}

/* Padding on input when inner icons are present */
.input-group-field:has(.input-group-prepend-inner) .form-input {
    padding-left: 36px;
}

.input-group-field:has(.input-group-append-inner) .form-input {
    padding-right: 36px;
}

/* Both inner icons simultaneously */
.input-group-field:has(.input-group-prepend-inner):has(.input-group-append-inner) .form-input {
    padding-left: 36px;
    padding-right: 36px;
}

/* Focus coloring for inner icons */
.input-group-field:focus-within .input-group-prepend-inner,
.input-group-field:focus-within .input-group-append-inner {
    color: var(--color-primary);
}

/* ── Input group sizes ───────────────────────── */

.input-group-sm .input-group-prepend-outer,
.input-group-sm .input-group-append-outer {
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
}

.input-group-sm .input-group-prepend-inner,
.input-group-sm .input-group-append-inner {
    width: 30px;
    font-size: 0.78rem;
}

.input-group-sm .input-group-field:has(.input-group-prepend-inner) .form-input {
    padding-left: 30px;
}

.input-group-sm .input-group-field:has(.input-group-append-inner) .form-input {
    padding-right: 30px;
}

.input-group-lg .input-group-prepend-outer,
.input-group-lg .input-group-append-outer {
    width: 44px;
    height: 44px;
    font-size: 1.15rem;
}

.input-group-lg .input-group-prepend-inner,
.input-group-lg .input-group-append-inner {
    width: 44px;
    font-size: 1.05rem;
}

.input-group-lg .input-group-field:has(.input-group-prepend-inner) .form-input {
    padding-left: 44px;
}

.input-group-lg .input-group-field:has(.input-group-append-inner) .form-input {
    padding-right: 44px;
}

/* ── Input group states ──────────────────────── */

.input-group:has(.form-input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.input-group.has-error .form-input {
    border-color: var(--color-danger);
}

.input-group.has-error .input-group-prepend-inner,
.input-group.has-error .input-group-append-inner,
.input-group.has-error .input-group-prepend-outer,
.input-group.has-error .input-group-append-outer {
    color: var(--color-danger);
}

.input-group.has-error .input-group-prepend-outer,
.input-group.has-error .input-group-append-outer {
    border-color: var(--color-danger);
}

.input-group.has-success .form-input {
    border-color: var(--color-success);
}

.input-group.has-success .input-group-prepend-inner,
.input-group.has-success .input-group-append-inner {
    color: var(--color-success);
}

/* ── Input group with text addon ─────────────── */

.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    height: 100%;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-subtle-active);
    border: 1px solid var(--border-input);
    white-space: nowrap;
}

.input-group>.input-group-text:first-child {
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group>.input-group-text:last-child {
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group>.input-group-text:first-child+.input-group-field .form-input,
.input-group>.input-group-text:first-child+.form-input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group:has(> .input-group-text:last-child)>.input-group-field .form-input,
.input-group:has(> .input-group-text:last-child)>.form-input:not(:last-child) {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* ================================================================
   6. CHECKBOX CUSTOM
   ================================================================ */

.checkbox-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: relative;
    width: 16px;
    height: 16px;
    background-color: var(--bg-input);
    border: 2px solid var(--border-input);
    border-radius: var(--radius-xs);
    flex-shrink: 0;
}

.checkbox-container:hover .checkmark {
    border-color: var(--color-primary);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-container input:checked~.checkmark::after {
    content: '';
    display: block;
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid var(--text-on-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container:has(input:checked) {
    font-weight: 500;
    color: var(--color-primary);
}

.checkbox-container:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.checkbox-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.checkbox-primary {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

/* ================================================================
   7. CUSTOM SELECT
   ================================================================ */

.custom-select {
    position: relative;
    font-size: 0.92em;
    font-weight: 600;
    align-self: center;
    width: 200px;
    max-width: 200px;
    padding-right: 5px;
}

.custom-select select {
    display: none;
}

.select-selected {
    background-color: var(--color-primary);
    border-radius: var(--radius-pill);
    color: var(--text-on-primary);
    padding: 8px 30px 8px 16px;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.select-selected::after {
    position: absolute;
    content: '';
    top: 12px;
    right: 10px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-color: var(--text-on-primary) transparent transparent transparent;
}

.select-selected.select-arrow-active::after {
    border-color: transparent transparent var(--text-on-primary) transparent;
    top: 7px;
}

.select-items {
    position: absolute;
    background-color: var(--bg-card);
    font-weight: 400;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    padding: 5px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
}

.select-hide {
    display: none;
}

.select-items div {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
}

.select-items div:hover:not(.same-as-selected) {
    background-color: var(--bg-subtle-hover);
}

.select-items .same-as-selected {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
}

/* ================================================================
   8. TOGGLE SWITCH
   ================================================================ */

.toggle-switch {
    display: inline-flex;
    background-color: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: 3px;
    gap: 2px;
}

.toggle-switch button {
    border: none;
    padding: 6px 14px;
    border-radius: inherit;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--duration-normal) var(--easing-default);
    font-size: 14px;
}

.toggle-switch button:hover {
    background-color: var(--bg-subtle-hover);
    color: var(--text-primary);
}

.toggle-switch button.active {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
    font-weight: bold;
}

/* ================================================================
   8b. CHECKBOX SWITCH  (.switch / .slider)
   ================================================================ */

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-pill);
    transition: background-color var(--duration-fast) var(--easing-default);
}

.slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--text-on-primary);
    border-radius: 50%;
    transition: transform var(--duration-fast) var(--easing-default);
    box-shadow: var(--shadow-sm);
}

.switch input:checked+.slider {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.switch input:checked+.slider::before {
    transform: translate(20px, -50%);
}

/* Size variant: small (budget-style 36×20) */
.switch.switch-sm {
    width: 36px;
    height: 20px;
}

.switch.switch-sm .slider::before {
    height: 14px;
    width: 14px;
}

.switch.switch-sm input:checked+.slider::before {
    transform: translate(16px, -50%);
}

/* Size variant: large (powens-style 50×24) */
.switch.switch-lg {
    width: 50px;
}

.switch.switch-lg .slider::before {
    left: 4px;
    height: 16px;
    width: 16px;
}

.switch.switch-lg input:checked+.slider::before {
    transform: translate(26px, -50%);
}

/* Disabled */
.switch:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ================================================================
   9. TOAST / NOTIFICATION CHIP
   ================================================================ */

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 12px 18px;
    margin-top: 8px;
    border-radius: var(--radius-lg);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-smooth);
    font-size: 0.9rem;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(8px);
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ================================================================
   10. VALIDATION MESSAGES
   ================================================================ */

.validation-errors {
    background: var(--color-danger-bg);
    border-left: 4px solid var(--color-danger-light);
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem 0;
    border-radius: var(--radius-xs);
    color: var(--color-danger-light);
    line-height: 1.4;
}

.validation-errors ul {
    margin: 0;
    padding-left: 1.2rem;
}

.validation-errors li {
    list-style: disc;
    font-size: 0.96em;
}

.validation-errors.info-message {
    background-color: var(--color-info-bg);
    border-left: 4px solid var(--color-info);
    color: var(--color-info);
    margin-top: 0.5rem;
    font-size: 0.9em;
    display: block;
}

.validation-errors.info-message li {
    list-style: 'ℹ️ ';
    font-size: 0.76em;
}

.validation-errors.success {
    background: var(--color-success-bg);
    border-left-color: var(--color-success);
    color: var(--color-success-light);
}

.validation-errors.pending {
    background: var(--bg-subtle-active);
    border-left-color: var(--text-soft);
    color: var(--text-secondary);
}

/* ================================================================
   11. CONFIRM CARD
   ================================================================ */

.confirm-card {
    margin: 12px 0;
    padding: 12px 14px;
    background: var(--bg-card-darker);
    border: 1px solid var(--border-card-inner);
    border-radius: var(--radius-md);
}

.confirm-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.confirm-head .fa-triangle-exclamation {
    color: var(--color-warning-icon);
    font-size: 1.1em;
    margin-top: 2px;
}

.confirm-title {
    font-weight: 600;
    font-size: 0.88em;
    color: var(--text-primary);
}

.confirm-sub {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 4px;
}

.confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
}

.same-size {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

.confirm-actions .btn-cancel:hover {
    border-color: var(--border-strong);
}

.confirm-actions .save-case {
    background: var(--color-success);
    color: var(--text-on-primary);
    font-weight: 600;
}

/* ================================================================
   12. CLOSE BUTTON (panels, modals)
   ================================================================ */

.close-btn {
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--text-soft);
    background: none;
    border: none;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* ================================================================
   13. SIDEBAR
   ================================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    padding: 20px 10px;
    height: 100vh;
    transition: width var(--duration-normal) var(--easing-default);
    font-size: 15px;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed span {
    color: transparent;
    transition: color var(--duration-normal) var(--easing-default);
}

.sidebar.collapsed img {
    height: 45px;
    transition: var(--transition-normal);
}

.sidebar h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2rem;
    background: var(--gradient-accent-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--color-primary-dark);
    margin-left: 8px;
}

/* ── Main content ─────────────────────────────────────────── */

.main {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--duration-normal) var(--easing-default);
    width: 100%;
}

.sidebar.collapsed~.main {
    margin-left: var(--sidebar-collapsed);
    transition: margin-left var(--duration-normal) var(--easing-default);
}

/* ── Nav items ────────────────────────────────────────────── */

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    transition: background var(--duration-fast) var(--easing-default);
    cursor: pointer;
    white-space: nowrap;
}

.nav-item svg {
    min-width: 24px;
    min-height: 24px;
}

.nav-item:hover {
    background-color: var(--bg-nav-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--bg-nav-hover);
    color: var(--text-primary);
    font-weight: bold;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--bg-nav-hover);
    border-left: 3px solid var(--color-primary-dark);
    padding-left: 7px;
}

/* ── Sidebar toggle ──────────────────────────────────────── */

.sidebar-toggle {
    background: var(--bg-nav-hover);
    border: none;
    color: var(--text-secondary);
    font-size: 26px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: color var(--duration-fast) var(--easing-default);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    color: var(--text-primary);
}

/* ── Sidebar footer ──────────────────────────────────────── */

.sidebar footer {
    text-align: center;
    color: var(--text-dim);
    padding: 5px 0;
    margin: auto;
    width: 250px;
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
}

.sidebar.collapsed footer {
    display: none;
}

/* ── Page footer (layouts/footer.php) ─────────────────────── */

body>footer {
    text-align: center;
    color: var(--text-dim);
    padding: 20px 0;
    position: fixed;
    bottom: 0;
    right: 0;
    width: calc(100% - 240px);
    background-color: var(--bg-body);
    z-index: -1;
}

/* ── Logo ─────────────────────────────────────────────────── */

.sidebar img {
    height: 50px;
    align-self: center;
    transition: var(--transition-normal);
}

.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-bottom: 22px;
    height: 60px;
}

.close-btn-header {
    display: none;
}

/* ── Burger button (desktop: hidden) ──────────────────────── */

.burger-btn {
    display: none;
}

/* ── Sidebar responsive ≤ 1100px ──────────────────────────── */

@media screen and (max-width: 1100px) {
    h1 {
        font-size: 1.6rem;
    }

    .nav-item span {
        font-size: 0.85rem;
    }
}

/* ── Sidebar responsive mobile ≤ 768px ────────────────────── */

@media screen and (max-width: 768px) {
    .sidebar {
        left: -100%;
        width: 100%;
        max-width: 100%;
        transition: left var(--duration-normal) var(--easing-default);
        z-index: 10000;
        padding: 20px;
    }

    .sidebar.open {
        left: 0;
    }

    .burger-btn {
        display: flex;
        position: fixed;
        top: 15px;
        left: 15px;
        background: var(--bg-nav-hover);
        border: none;
        border-radius: var(--radius-sm);
        width: 42px;
        height: 42px;
        color: var(--text-on-primary);
        font-size: 20px;
        z-index: 100;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .sidebar.open~.burger-btn {
        display: none;
    }

    .sidebar .close-btn-header {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 28px;
        cursor: pointer;
        display: inline-block;
    }

    .sidebar.collapsed {
        width: 100% !important;
    }

    .sidebar.collapsed span {
        color: inherit !important;
    }

    .sidebar.collapsed img {
        height: 50px !important;
    }

    .main {
        margin-left: 0 !important;
    }

    .sidebar .logo {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 30px;
    }

    .sidebar .logo h2 {
        font-size: 1.2rem;
    }

    .sidebar-toggle {
        display: none;
    }

    .nav-item {
        padding: 14px 12px;
        font-size: 1rem;
        border-radius: var(--radius-lg);
    }

    .nav-item span {
        font-size: 1rem;
    }

    .sidebar footer {
        position: relative;
        bottom: 0;
        width: 100%;
        text-align: center;
        margin-top: 40px;
        font-size: 0.7rem;
    }
}

/* ================================================================
   14. PAGE HEADER / DASHBOARD HEADER
   ================================================================ */


/* ── Page header (gradient title) ─────────────────────────── */

.page-header {
    text-align: center;
    margin: 20px auto;
    padding: 15px 0;
}

.page-header h1 {
    font-size: 40px;
    font-weight: 800;
    background: var(--gradient-accent-dark);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -1px;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 12px;
    color: var(--color-primary-light);
    font-weight: 500;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 30px;
    }
}

/* ================================================================
   15. NOTIFICATIONS PANEL
   ================================================================ */

/* ── Bouton cloche ────────────────────────────────────────── */

#notif-bell {
    position: fixed;
    top: 15px;
    right: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-primary);
    z-index: 10;
}

#notif-bell:hover {
    color: var(--color-primary-dark);
    border-color: rgba(var(--base-color-for-glow), 0.5);
    background: rgba(var(--base-color-for-glow), 0.15);
}

/* ── Badge rouge ──────────────────────────────────────────── */

#notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--color-danger);
    color: var(--text-on-primary);
    font-size: .65rem;
    font-weight: 600;
    border-radius: 50%;
    padding: 2px 5px;
    line-height: 1;
    display: none;
}

/* ── Panneau (désormais un .drawer — le positionnement est géré par §17) ── */

#notifications-panel {
    background: var(--bg-glass-heavy);
    border-left: 1px solid var(--color-primary-glow);
    box-shadow: var(--shadow-xl);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

/* ── Header du panneau ────────────────────────────────────── */

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.notif-header h2 {
    font-size: 1.1rem;
    background: var(--gradient-accent-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* ── Liste ────────────────────────────────────────────────── */

.notif-list {
    flex-grow: 1;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.notif-list::-webkit-scrollbar {
    display: none;
}

/* ── Items ────────────────────────────────────────────────── */

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: .7rem;
    margin-bottom: .6rem;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.notif-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(var(--base-color-for-glow), 0.2);
    border-color: rgba(var(--base-color-for-glow), 0.5);
}

.notif-item.unread {
    background: linear-gradient(135deg, rgba(var(--base-color-for-glow), 0.18), rgba(59, 130, 246, 0.12));
    border: 1px solid rgba(var(--base-color-for-glow), 0.5);
}

.notif-icon {
    font-size: 1.2rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.notif-content {
    flex: 1;
}

.notif-title {
    margin: 0;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-message {
    margin: .15rem 0 .3rem;
    font-size: .75rem;
    color: var(--text-soft-light);
    line-height: 1.3;
}

.notif-date {
    margin: 0;
    font-size: .65rem;
    color: var(--text-slate);
}

/* ── Actions (CTA dans notifs) ────────────────────────────── */

.notif-actions {
    margin-top: .4rem;
    display: flex;
    gap: .4rem;
}

.notif-actions a,
.notif-actions button {
    background: var(--gradient-accent-blue);
    color: var(--text-on-primary);
    font-size: .65rem;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--easing-default), background var(--duration-normal) var(--easing-default);
}

.notif-actions a:hover,
.notif-actions button:hover {
    transform: translateY(-1px);
    background: var(--gradient-accent-dark);
}

/* ── Groupes de date ──────────────────────────────────────── */

.notif-group {
    margin-bottom: 1.2rem;
}

.notif-group h3 {
    font-size: .8rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin: 0 0 .5rem 0;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: .2rem;
}

/* ── Notifications responsive mobile ──────────────────────── */

@media screen and (max-width: 768px) {
    #notifications-panel {
        background: var(--bg-glass-heavy)
    }

    .notif-header h2 {
        font-size: 1.2rem;
    }

    #notifications-panel .close-btn {
        font-size: 1.6rem;
        color: var(--text-primary);
    }

    .notif-item {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        border-radius: var(--radius-md);
    }

    .notif-title {
        font-size: 0.85rem;
    }

    .notif-message {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .notif-date {
        font-size: 0.7rem;
    }

    .notif-actions a,
    .notif-actions button {
        font-size: 0.75rem;
        padding: 6px 10px;
        border-radius: var(--radius-sm);
    }

    .notif-group h3 {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
    }
}

/* ================================================================
   16. HELP POPUP
   ================================================================ */

.ft-popup {
    position: fixed;
    bottom: 18px;
    right: 18px;
    width: 420px;
    max-width: calc(100% - 36px);
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 16px 14px 16px;
    box-shadow: var(--shadow-2xl);
    z-index: 90000;
    display: none;
    line-height: 1.45;
}

.ft-popup h4 {
    margin: 0 0 10px 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.ft-popup p {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.ft-popup ul {
    margin: 6px 0 10px 18px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.ft-popup li {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.ft-popup .ft-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.ft-popup .ft-actions button {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.92rem;
}

.ft-popup .ft-actions .ft-dismiss {
    background: transparent;
    color: var(--text-dim);
}

.ft-popup .ft-actions .ft-ok {
    background: var(--gradient-accent-dark);
    color: var(--text-on-primary);
}

/* ── Bouton help (?) ──────────────────────────────────────── */

#ft-help {
    position: fixed;
    bottom: 18px;
    right: 24px;
    z-index: 90001;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-subtle-active);
    border: 1px solid var(--border-medium);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--duration-fast) var(--easing-default), color var(--duration-fast) var(--easing-default);
}

#ft-help:hover {
    background: var(--bg-subtle-extra);
    color: var(--text-on-primary);
}

/* ── Help popup responsive ≤ 800px ────────────────────────── */

@media (max-width: 800px) {
    .ft-popup {
        width: 92%;
        right: 4%;
        left: 4%;
        bottom: 12px;
        padding: 10px;
    }

    .ft-popup h4 {
        font-size: 0.98rem;
    }
}

/* ── Help popup responsive ≤ 1300px ───────────────────────── */

@media (max-width: 1300px) {
    .ft-popup {
        max-height: unset;
    }

    .ft-popup p {
        font-size: 0.75rem;
    }

    .ft-popup ul {
        font-size: 0.75rem;
    }

    .ft-popup li {
        font-size: 0.75rem;
    }

    .ft-popup .ft-actions button {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* ================================================================
   17. DRAWER (slide-in panel)
   Generic reusable drawer: positioning, backdrop, push-mode.
   Shared by: case, account, budget, recurrence, operation, savings.

   .drawer                      – base container (fixed, slides in)
   .drawer--right  (default)    – slides from right
   .drawer--left                – slides from left
   .drawer--sm / --lg / --full  – width variants
   .drawer.open                 – visible state
   .drawer-backdrop             – optional overlay behind drawer
   .drawer-backdrop.open        – visible backdrop
   body.drawer-push--right      – shifts main content left when drawer opens
   body.drawer-push--left       – shifts main content right when drawer opens
   ================================================================ */

/* ── Backdrop overlay ────────────────────────────── */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 999;
    pointer-events: none;
    transition: background var(--duration-smooth) var(--easing-smooth);
}

.drawer-backdrop.open {
    background: var(--bg-overlay-light);
    pointer-events: auto;
}

/* ── Drawer container ────────────────────────────── */

.drawer {
    position: fixed;
    top: 0;
    height: 100%;
    width: 480px;
    background-color: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1),
        box-shadow 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.drawer::-webkit-scrollbar {
    display: none;
}

/* ── Position: right (default) ───────────────────── */

.drawer,
.drawer--right {
    right: 0;
    transform: translateX(100%);
}

.drawer.open,
.drawer--right.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
}

/* ── Position: left ──────────────────────────────── */

.drawer--left {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}

.drawer--left.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
}

/* ── Width variants ──────────────────────────────── */

.drawer--sm {
    width: 360px;
}

.drawer--lg {
    width: 640px;
}

.drawer--full {
    width: 100%;
}

/* ── Push mode (shifts main content) ─────────────── */

body.drawer-push--right {
    overflow-x: hidden;
}

body.drawer-push--right>.main,
body.drawer-push--right>.uikit-shell {
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    transform: translateX(-480px);
}

body.drawer-push--left {
    overflow-x: hidden;
}

body.drawer-push--left>.main,
body.drawer-push--left>.uikit-shell {
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    transform: translateX(480px);
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 768px) {
    .drawer {
        width: 100%;
    }

    body.drawer-push--right>.main,
    body.drawer-push--right>.uikit-shell,
    body.drawer-push--left>.main,
    body.drawer-push--left>.uikit-shell {
        transform: none;
    }
}

/* ================================================================
   17b. EDITOR PANEL (inner formatting — used inside drawers)
   Shared header, tabs, scrollable content, save button, utilities.
   These classes are NOT part of the drawer shell — they are
   optional inner building blocks used by the existing editors.
   ================================================================ */

/* ── Header ──────────────────────────────────────── */

.drawer-editor-header {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
}

.drawer-editor-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem 0.75rem;
}

.drawer-editor-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ── Close button ────────────────────────────────── */

.drawer .close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--easing-default);
}

.drawer .close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-subtle-hover);
    border-color: var(--border-input);
    transform: rotate(90deg);
}

/* ── Tabs (integrated header tabs) ───────────────── */

.drawer-editor-tabs {
    display: flex;
    gap: 4px;
    padding: 0 1.25rem 0.75rem;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: var(--bg-card);
}

.drawer-editor-tabs::-webkit-scrollbar {
    display: none;
}

.editor-tab {
    flex: 1 1 0;
    min-width: 0;
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-body);
    white-space: nowrap;
    transition: all var(--duration-fast) var(--easing-default);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-overflow: ellipsis;
    overflow: hidden;
}

.editor-tab i {
    font-size: 0.72rem;
    flex-shrink: 0;
}

.editor-tab:hover {
    color: var(--text-primary);
    background: var(--bg-subtle-hover);
    border-color: var(--border-subtle);
}

/* Active tab */
.editor-tab.active {
    color: var(--color-primary-light);
    background: var(--bg-nav-active);
    border-color: var(--color-primary-glow);
    font-weight: 600;
}

.editor-tab-content {
    display: none;
    gap: 16px;
    flex-direction: column;
}

.editor-tab-content.active {
    animation: panelFadeIn 0.25s var(--easing-smooth);
    display: flex;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Scrollable content ──────────────────────────── */

.drawer-editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
    position: relative;
}

.drawer-editor-content::-webkit-scrollbar {
    width: 4px;
}

.drawer-editor-content::-webkit-scrollbar-track {
    background: transparent;
}

.drawer-editor-content::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: var(--radius-pill);
}

/* ── Save button ─────────────────────────────────── */

.save-case {
    margin-top: 1.25rem;
    padding: 0.7rem 1.25rem;
    background: var(--gradient-accent-blue);
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all var(--duration-fast) var(--easing-default);
    box-shadow: var(--shadow-sm);
}

.save-case:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.save-case:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}

.save-case:disabled,
.save-case.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Panel utilities ─────────────────────────────── */

.panel-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 18px 0;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: -2px 0 8px;
    line-height: 1.35;
}

.validation-errors {
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger-bright);
    font-size: 0.82rem;
    line-height: 1.4;
}

.validation-errors:empty {
    display: none;
}

/* ================================================================
   18. LOGO PICKER
   ================================================================ */

.form-group.logo-group {
    margin-top: .5rem;
    position: relative;
}

.form-group.logo-group label {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.form-group.logo-group label small {
    opacity: .6;
    font-weight: 400;
}

.logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    position: relative;
}

.logo-preview {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    background: var(--bg-subtle-active);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    padding: 2px;
}

.logo-preview i {
    font-size: 1.15rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-summary {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-very-dim);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
    white-space: nowrap;
}

.logo-summary:hover {
    border-color: var(--border-strong);
    color: var(--text-soft-light);
}

.logo-summary::-webkit-details-marker {
    display: none;
}

.logo-summary .caret {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: auto;
    transition: transform var(--duration-fast) var(--easing-default);
}

.logo-details[open] .logo-summary .caret {
    transform: rotate(180deg);
}

details[open] .logo-summary {
    background: var(--bg-nav-active);
    border-color: var(--color-primary-glow);
    color: var(--color-primary);
}


.logo-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-card-darker);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 10px;
    z-index: 20;
}

.logo-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-hint);
    margin: 8px 0 6px 4px;
}

/* ── Slider de navigation horizontale ─────────────────────── */

.row-slider {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 48px;
}

.row-track {
    flex: 1;
    overflow: hidden;
}

.row-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-subtle-hover);
    color: var(--text-very-dim);
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.row-btn:hover {
    background: var(--bg-subtle-strong);
    color: var(--text-primary);
}

.row-btn[disabled] {
    opacity: 0.2;
    cursor: default;
}

.row-btn.prev {
    order: -1;
}

.row-btn.next {
    order: 1;
}

/* ── Chips (icônes cliquables) ────────────────────────────── */

.logo-chip-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
}

.logo-chip-row::-webkit-scrollbar {
    display: none;
}

#create-logo-details,
#modify-logo-details {
    position: relative;
}

.logo-chip {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    background: var(--bg-subtle-hover);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    padding: 0;
    overflow: hidden;
}

.logo-chip img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    padding: 3px;
}


.logo-chip:hover {
    border-color: color-mix(in srgb, var(--color-primary) 50%, transparent);
    background: var(--bg-nav-active);
}

.logo-chip.icon {
    background: var(--bg-subtle);
}

.logo-chip.icon i {
    font-size: 1.1rem;
    color: var(--text-dim);
}

/* ── Popover (alternative au details) ─────────────────────── */

.logo-picker {
    position: relative;
}

.logo-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-very-dim);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.logo-trigger:hover {
    border-color: var(--border-strong);
    color: var(--text-soft-light);
}

.logo-trigger .caret {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform var(--duration-fast) var(--easing-default);
}

.logo-trigger[aria-expanded="true"] .caret {
    transform: rotate(180deg);
}

.logo-popover {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
}

.logo-popover.open {
    display: block;
}

.logo-details {
    position: relative;
}

/* ================================================================
   18b. BALANCE CARD (shared balance-sheet / intérêts-impôts)
   ================================================================ */

.balance-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    color: var(--text-lavender);
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.balance-card:hover {
    background: var(--gradient-card-hover);
}

.balance-card .left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance-card .icon {
    font-size: 20px;
    color: var(--color-primary);
    min-width: 22px;
}

.balance-card .meta {
    font-size: 0.8rem;
    color: var(--text-cool);
}

.balance-card .amount {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--color-primary);
}

.balance-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.balance-info i {
    font-size: 20px;
    color: var(--color-primary);
}

.balance-info .label {
    color: var(--text-primary);
    font-weight: bolder;
}

.balance-info .sub {
    font-size: 13px;
    color: var(--text-muted);
}

.balance-amount {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-cool-light);
    white-space: nowrap;
}

.balance-amount.negative {
    color: var(--color-danger-light);
}

.balance-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-input);
    font-size: 15px;
    color: var(--text-secondary);
}

.balance-item strong {
    color: var(--text-primary);
}

.balance-card.case-card {
    flex-direction: column;
    height: max-content;
    overflow: hidden;
}

.case-card {
    cursor: pointer;
    transition: var(--transition-normal);
    height: max-content;
}

.case-card .visible-part {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.case-card .balance-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ================================================================
   19. PLACEHOLDER (empty state)
   ================================================================ */

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--bg-subtle-hover), var(--bg-subtle));
    border: 1px dashed var(--border-medium);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    transition: var(--transition-normal);
    margin: 20px auto;
    width: 80%;
}

.placeholder:hover {
    border-color: var(--border-strong);
    background: linear-gradient(135deg, var(--bg-subtle-active), var(--bg-subtle));
}

.placeholder>i {
    font-size: 32px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.placeholder strong {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ================================================================
   20. BADGE
   ================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.badge-lg {
    padding: 4px 10px;
    font-size: 0.78rem;
}

.badge-sm {
    padding: 1px 6px;
    font-size: 0.65rem;
}

.badge-xs {
    padding: 0.5px 4px;
    font-size: 0.6rem;
}

.badge-xl {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.badge-primary {
    background: var(--color-primary-glow);
    color: var(--color-primary-light);
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success-light);
}

.badge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-bright);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-light);
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info-light);
}

.badge-neutral {
    background: var(--bg-subtle-active);
    color: var(--text-muted);
}

/* ================================================================
   21. MODAL / OVERLAY
   ================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slide-up 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow: auto;
    padding: 0px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    gap: 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-top: 24px;
    padding-left: 24px;
    padding-right: 24px;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 24px 24px;
}

/* ================================================================
   22. TABLE
   ================================================================ */

.table-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.table-container table {
    width: 100%;
}

.table-container th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.table-container td {
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.table-container tbody tr:hover {
    background: var(--bg-subtle-hover);
}

/* ================================================================
   22b. AMOUNT DISCREPANCY INDICATOR
   ================================================================ */

#amount-discrepancy {
    font-size: 0.9rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    transition: var(--transition-normal);
}

#amount-discrepancy::before {
    margin-right: 0.4em;
    font-size: 1.1rem;
    line-height: 1;
}

#amount-discrepancy.error {
    color: var(--color-danger-light);
}

#amount-discrepancy.success {
    color: var(--color-success-light);
}

#amount-discrepancy.success::before {
    opacity: 0.7;
}

/* ================================================================
   23. AMOUNT CALCULATOR (global tool)
   ================================================================ */

.amount-calculated {
    animation: amount-calc-flash 0.3s ease-out;
}

@keyframes amount-calc-flash {
    0% {
        background-color: var(--color-primary-glow);
        box-shadow: 0 0 8px var(--color-primary-glow);
    }

    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

.amount-calc-preview {
    display: none;
    position: fixed;
    padding: 3px 8px;
    background: var(--color-primary);
    border-radius: var(--radius-xs);
    font-size: 0.7em;
    color: var(--text-dim);
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    box-shadow: var(--shadow-sm);
}

.amount-calc-preview.visible {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.amount-calc-preview .equals {
    color: var(--text-very-dim);
}

.amount-calc-preview .result {
    color: var(--text-primary);
    font-weight: 600;
}

.amount-calc-preview .hint {
    color: var(--text-hint);
    font-size: 0.85em;
}

.amount-calc-preview .clamped {
    color: var(--color-warning-light);
    font-size: 0.9em;
    margin-left: 2px;
}

/* ================================================================
   24. DISABLE-ON-ERROR & STATUS UTILITIES
   ================================================================ */

.disable-on-error.disabled,
.disable-on-error:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.text-success {
    color: var(--color-success);
}

.text-danger {
    color: var(--color-danger);
}

.text-warning {
    color: var(--color-warning);
}

.text-info {
    color: var(--color-info);
}

.text-primary-c {
    color: var(--color-primary);
}

.text-muted-c,
.text-muted {
    color: var(--text-muted);
}

.text-secondary-c {
    color: var(--text-secondary);
}

.bg-primary {
    background-color: var(--color-primary);
}

.bg-success {
    background-color: var(--color-success-bg);
}

.bg-danger {
    background-color: var(--color-danger-bg);
}

.bg-warning {
    background-color: var(--color-warning-bg);
}

.bg-info {
    background-color: var(--color-info-bg);
}

/* ================================================================
   25. SCROLLBAR (themed)
   ================================================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-subtle-strong);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-subtle-extra);
}

/* ================================================================
   26. CASE SELECTOR / MULTI-CASE
   ================================================================ */

.checkbox-multi-cases {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.checkbox-multi-cases label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input-alt);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.checkbox-multi-cases input.amount-calculable {
    max-width: 70px;
    margin-left: auto;
    background-color: var(--bg-body-deep);
}

.checkbox-multi-cases input[type="checkbox"] {
    transform: scale(1.1);
}

#single-case-select {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: var(--bg-input-alt);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
}

.stylized-cases .case-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-input-alt);
    border: 1px solid var(--border-card-inner);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: background var(--duration-normal) var(--easing-default), border var(--duration-normal) var(--easing-default);
}

.stylized-cases .case-line input.amount-calculable {
    width: 100px;
    margin-left: auto;
    background-color: var(--bg-card);
    text-align: right;
    padding: 8px;
}

.stylized-cases .case-line input[type="checkbox"]:checked+.case-label,
.stylized-cases .case-line input.amount-calculable:not(:placeholder-shown)+.case-label {
    font-weight: bold;
    color: var(--color-primary);
}

.stylized-cases .case-label {
    flex-grow: 1;
    color: var(--text-secondary);
    transition: color var(--duration-normal) var(--easing-default), font-weight var(--duration-normal) var(--easing-default);
}

.stylized-cases .case-line input[type="checkbox"] {
    display: none;
}

.stylized-cases .case-line.selected {
    border-color: var(--color-primary);
}

#multi-cases-group {
    display: none;
}

.toggle-multi-case {
    display: inline-flex;
    background-color: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: 3px;
    gap: 2px;
}

.toggle-multi-case button {
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-2xl);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--duration-normal) var(--easing-default);
    font-size: 14px;
}

.toggle-multi-case button.active {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
    font-weight: bold;
}

/* ================================================================
   27. NUMBER INPUT — hide spinners
   ================================================================ */

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* ================================================================
   28. INFO-TIP (tooltip on hover)   (ex-§29)
   ================================================================ */

.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 1000;
    text-transform: none;
    font-weight: normal;
    font-size: .9rem;
}

.info-tip .ico {
    display: inline-flex;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: rgba(56, 199, 242, .15);
    color: var(--color-cyan);
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(56, 199, 242, .35);
    font-size: .8rem;
    cursor: default;
}

.info-tip .bubble {
    position: absolute;
    top: 100%;
    right: 40%;
    transform: translateY(-6px);
    background: var(--bg-body-deep);
    border: 1px solid var(--border-muted);
    color: var(--text-cool-light);
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    min-width: 260px;
    max-width: 320px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 1000;
}

.info-tip:hover .bubble,
.info-tip:focus-within .bubble {
    opacity: 1;
}

.info-tip .bubble h6 {
    margin: 0 0 .25rem;
    font-size: .9rem;
    color: var(--text-cool-light);
}

.info-tip .bubble p {
    margin: 0;
    font-size: .85rem;
    color: var(--text-soft-light);
}

/* ================================================================
   30. CONTENT-BLOCK (shared container — settings, bilan, fiscalité)
   ================================================================ */

.content-block {
    flex: 1;
    min-width: 300px;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 30px;
    box-shadow: var(--shadow-md);
    max-width: 1200px;
    margin: auto;
    width: 90%;
    overflow: hidden;
    position: relative;
}

.content-block h2 {
    color: var(--color-primary);
    margin: 0 auto 16px;
    font-size: 1.125rem;
    width: max-content;
}

@media (max-width: 768px) {
    .content-block {
        width: 100%;
        padding: 20px 15px;
    }

    .content-block h2 {
        font-size: 0.875rem;
        margin-bottom: 10px;
    }
}

/* ================================================================
   31. TREND (up / down coloring with optional tooltip)
   ================================================================ */

.trend {
    font-weight: 700;
    position: relative;
}

.trend.up {
    color: var(--color-success);
}

.trend.down {
    color: var(--color-danger);
}

.trend[title]:hover::after {
    content: attr(title);
    position: absolute;
    background-color: var(--border-card-inner);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    top: -1.8rem;
    left: 0;
    transform: translateX(-25%);
    opacity: 1;
}

@media (max-width: 768px) {
    .trend {
        font-size: 0.5rem;
    }

    .trend[title]:hover::after {
        right: 0;
        left: unset;
        transform: unset;
        font-size: 0.7rem;
    }
}

/* ================================================================
   32. PLACEHOLDER (empty state — dashed card)
   ================================================================ */

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    border-radius: var(--radius-xl);
    background: var(--gradient-card-subtle);
    border: 1px dashed var(--border-medium);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    transition: var(--transition-normal);
    height: 90%;
}

.placeholder:hover {
    border-color: var(--color-primary-glow);
    box-shadow: var(--shadow-primary-strong);
}

.placeholder>i {
    font-size: 2.125rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.placeholder strong {
    color: var(--text-primary);
}

/* ================================================================
   32. CALENDAR-GRID (7-column calendar — dashboard, recurrences, fiscalité)   (ex-§34)
   ================================================================ */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.calendar-header-cell {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.calendar-cell {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 8px 10px;
    min-height: 90px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 0 5px var(--bg-subtle);
    position: relative;
    transition: var(--transition-fast);
}

.calendar-cell:hover {
    transform: scale(1.025);
    box-shadow: 0 0 10px var(--color-primary-glow);
    z-index: 2;
}

.calendar-cell:not(.empty) {
    cursor: pointer;
}

.day-number {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.7;
    color: var(--text-slate-light);
    margin-bottom: auto;
}

.cell-amount {
    text-align: right;
    margin-top: auto;
}

.big-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
    line-height: 1.2;
}

.big-amount.negative {
    color: var(--color-danger);
}

.big-amount.positive {
    color: var(--color-success-bright);
}

.cat-label {
    font-size: 0.75rem;
    color: var(--color-info);
    font-style: italic;
    margin-top: 2px;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.bar-ratio {
    height: 4px;
    border-radius: var(--radius-xs, 2px);
    margin-top: 6px;
    background: var(--bg-subtle-extra);
}

.bar-ratio>div {
    height: 100%;
    background: var(--color-cyan);
    border-radius: var(--radius-xs, 2px);
}

/* Calendar intensity levels */
.calendar-cell.low {
    background: var(--gradient-calendar-low);
    box-shadow: 0 0 6px rgba(57, 125, 186, 0.25);
}

.calendar-cell.medium {
    background: var(--gradient-calendar-medium);
    box-shadow: 0 0 8px rgba(66, 170, 255, 0.35);
}

.calendar-cell.high {
    background: var(--gradient-calendar-high);
    box-shadow: 0 0 10px rgba(110, 240, 240, 0.45);
}

.calendar-cell.today {
    border: 2px solid var(--color-primary);
}

.calendar-cell.expense {
    border: 1px solid var(--color-danger-border);
    box-shadow: var(--shadow-danger);
}

.calendar-cell.income {
    border: 1px solid var(--color-success-border);
    box-shadow: var(--shadow-success);
}

@media (max-width: 768px) {
    .calendar-grid {
        gap: 2px;
    }

    .calendar-cell {
        min-height: 60px;
        padding: 8px 5px;
        border-radius: var(--radius-lg);
    }

    .day-number {
        font-size: 0.5rem;
    }

    .big-amount {
        font-size: 0.55rem;
    }

    .cat-label {
        font-size: 0.45rem;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }

    .cell-amount {
        margin-top: 0;
    }
}

/* ================================================================
   35. SECTION-HEADER (border-left accent — h2 titles)
   ================================================================ */

.section-header {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 5px solid var(--color-primary);
    padding-left: 10px;
}