﻿:root {
    --primary: #4797c0;
    --accent: #ccb775;
    --ink: #1e2a33;
    --muted: #6b7a86;
    --bg: #f7f8fa;
    --card: #ffffff;
    --border: #e2e6ea;
    --shadow: 0 10px 30px rgba(30, 42, 51, 0.08);
    --radius: 14px;
    --sidebar-bg: #ffffff;
    --surface: #f9fafb;
    --input-bg: #f7f8fa;
}

[data-theme="dark"] {
    --ink:        #e2eaf5;
    --muted:      #6b8aad;
    --bg:         #0e1520;
    --card:       #131e2e;
    --border:     #1e2d42;
    --sidebar-bg: #131e2e;
    --surface:    #131e2e;
    --input-bg:   #1a2840;
    --shadow:     0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Sora", "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 20%, rgba(71, 151, 192, 0.12), transparent 50%),
        radial-gradient(circle at 90% 0%, rgba(204, 183, 117, 0.14), transparent 40%),
        var(--bg);
}

[data-theme="dark"] body {
    background:
        radial-gradient(circle at 10% 20%, rgba(71, 151, 192, 0.06), transparent 50%),
        radial-gradient(circle at 90% 0%, rgba(204, 183, 117, 0.05), transparent 40%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    padding: 16px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #3c7a99);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-title {
    font-weight: 700;
}

.brand-sub {
    color: var(--muted);
    font-size: 12px;
}

.menu {
    display: grid;
    gap: 5px;
}

.menu-link-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.menu-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #d65a5a;
    display: none;
}

.menu-dot.show {
    display: inline-block;
}

.menu-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}

.menu-group-title {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--muted);
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.15s;
}

.menu-group-title:hover {
    background: rgba(71, 151, 192, 0.07);
}

.menu-group-title::after {
    content: none;
}

.menu-group[open] .menu-group-title::after {
    content: none;
}

.menu-chevron {
    margin-left: auto;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transition: transform 0.22s ease;
    stroke: var(--muted);
}

.menu-group.open .menu-chevron {
    transform: rotate(90deg);
}

.menu-group-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
}

.menu-group.open .menu-group-body {
    max-height: 500px;
}

.menu-group-links {
    display: grid;
    gap: 4px;
    padding: 4px 8px 8px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font-weight: 400;
    font-size: 13.5px;
    border: 0;
    cursor: pointer;
}

.menu-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.8;
}

.menu-link:hover {
    background: rgba(71, 151, 192, 0.12);
}

.menu-link.active {
    background: rgba(71, 151, 192, 0.22);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(71, 151, 192, 0.35);
}

.menu-link.accent {
    background: var(--accent);
    color: #3b3320;
    box-shadow: 0 10px 20px rgba(204, 183, 117, 0.25);
    font-weight: 600;
}

.menu-link.accent:hover {
    background: #c4ad63;
}

.menu-badge {
    display: none;
    margin-left: auto;
    background: #d65454;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

.menu-badge.show {
    display: inline-block;
}

.sidebar-footer {
    margin-top: auto;
}

.hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--ink);
}

.hamburger:hover {
    background: rgba(71, 151, 192, 0.12);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 42, 51, 0.4);
    z-index: 199;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
    display: block;
}

@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -230px;
        top: 0;
        height: 100vh;
        width: 220px;
        z-index: 200;
        transition: left 0.28s ease;
        box-shadow: 4px 0 24px rgba(30, 42, 51, 0.14);
    }

    .sidebar.open {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .main {
        padding: 16px;
    }
}

.team-link {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 10px 0 14px;
    color: var(--ink);
}

.team-avatar {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, rgba(71, 151, 192, 0.25), rgba(204, 183, 117, 0.2));
    border: 2px solid rgba(71, 151, 192, 0.25);
    display: grid;
    place-items: center;
    color: #2f5f76;
}

.team-avatar svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.team-label {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.3px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.team-hero {
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.team-hero-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-hero-logo {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #3c7a99);
    color: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.team-hero-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-hero-title {
    font-weight: 700;
}

.team-hero-sub {
    font-size: 12px;
    color: var(--muted);
}

.team-hero-text h3 {
    margin: 0 0 4px;
}

.team-hero-text p {
    margin: 0;
    color: var(--muted);
}

.team-card {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 16px;
    display: grid;
    gap: 12px;
    align-content: start;
    box-shadow: var(--shadow);
}

.team-avatar-round {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(71, 151, 192, 0.2), rgba(204, 183, 117, 0.2));
    border: 2px solid rgba(71, 151, 192, 0.25);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #2f5f76;
    overflow: hidden;
}

.team-avatar-round img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-meta {
    display: grid;
    gap: 4px;
}

.team-name {
    font-weight: 700;
}

.team-role {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.team-phone {
    font-size: 13px;
    color: var(--ink);
}

.main {
    padding: 16px 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

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

.topbar-title {
    font-size: 17px;
    font-weight: 700;
}

.topbar-user {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--muted);
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 10px;
    color: var(--ink);
}

.user-menu-trigger:hover {
    background: rgba(71, 151, 192, 0.12);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-toggle-track {
    position: relative;
    display: flex;
    align-items: center;
    width: 56px;
    height: 28px;
    border-radius: 999px;
    background: #2c2c2c;
    border: 1px solid rgba(255,255,255,0.08);
    transition: background 0.3s ease;
    overflow: hidden;
}

[data-theme="dark"] .theme-toggle-track {
    background: #1a2840;
    border-color: var(--border);
}

/* Thumb (le cercle glissant) — z-index bas, les icônes passent dessus */
.theme-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f5a623;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    z-index: 1;
}

[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(28px);
    background: #c8d4e8;
}

/* Icônes — z-index 2 pour passer au-dessus du thumb */
.theme-toggle-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    z-index: 2;
    transition: color 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

/* Mode clair : soleil actif (sur thumb orange) → blanc contrasté */
.theme-toggle-icon--sun {
    left: 3px;
    color: #fff;
    opacity: 1;
}

/* Lune inactive (sur track sombre) → blanc semi-transparent */
.theme-toggle-icon--moon {
    right: 3px;
    color: rgba(255, 255, 255, 0.45);
    opacity: 1;
}

/* Mode sombre : lune active (sur thumb clair) → gris foncé contrasté */
[data-theme="dark"] .theme-toggle-icon--moon {
    color: #2c3e55;
    opacity: 1;
}

/* Soleil inactif (sur track bleu nuit) → blanc semi-transparent */
[data-theme="dark"] .theme-toggle-icon--sun {
    color: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

.user-menu-caret {
    font-size: 11px;
    color: var(--muted);
}

.user-menu {
    position: absolute;
    top: 58px;
    right: 28px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px;
    display: none;
    min-width: 260px;
    z-index: 50;
}

.user-menu.open {
    display: grid;
    gap: 6px;
}

.user-menu-notif-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.user-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d65454;
    display: none;
    box-shadow: 0 0 0 2px rgba(214, 84, 84, 0.15);
}

.user-notif-dot.show {
    display: inline-block;
}

.notif-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 60;
}

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

.notif-panel {
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 14px;
    width: min(720px, 92vw);
    max-height: 82vh;
    display: grid;
    gap: 10px;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.notif-header h3 {
    margin: 0;
}

.notif-list {
    display: grid;
    gap: 8px;
    overflow: auto;
    padding-right: 4px;
}

.notif-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    background: var(--surface);
    display: grid;
    gap: 6px;
}

.notif-card.unread {
    background: rgba(71, 151, 192, 0.08);
    box-shadow: inset 0 0 0 1px rgba(71, 151, 192, 0.2);
}

.notif-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.notif-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.notif-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.notif-date {
    font-size: 11px;
    color: var(--muted);
}

.notif-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.notif-body {
    color: var(--muted);
    font-size: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-header-actions .btn.active {
    background: rgba(71, 151, 192, 0.15);
    color: #1c5f8a;
    border-color: rgba(71, 151, 192, 0.4);
}

.notif-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.notif-toast-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    font-size: 13px;
    max-width: 300px;
    pointer-events: auto;
    animation: notif-toast-in 0.25s ease;
    cursor: pointer;
}

.notif-toast-item.hiding {
    animation: notif-toast-out 0.3s ease forwards;
}

.notif-toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.notif-toast-body {
    color: var(--muted);
    font-size: 12px;
}

@keyframes notif-toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes notif-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(12px); }
}

.notif-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.notif-meta strong {
    color: var(--text);
    font-weight: 600;
}

.notif-actions {
    display: none;
}

.notif-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #1f2b35;
    background: #e8eef5;
}

.notif-pill.success {
    background: rgba(111, 191, 115, 0.2);
    color: #1f7a4b;
}

.notif-pill.primary {
    background: rgba(71, 151, 192, 0.2);
    color: #1c5f8a;
}

.notif-pill.warning {
    background: rgba(204, 183, 117, 0.28);
    color: #7b6116;
}

.notif-pill.info {
    background: rgba(95, 108, 175, 0.18);
    color: #43507b;
}

.notif-pill.danger {
    background: rgba(214, 84, 84, 0.2);
    color: #8d2b2b;
}

.notif-pill.violet {
    background: rgba(125, 74, 199, 0.18);
    color: #5c3093;
}

.notif-pill.neutral {
    background: rgba(99, 111, 126, 0.16);
    color: #3c4650;
}

.user-menu-link {
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--ink);
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-align: left;
    width: 100%;
    display: block;
}

.user-menu .logout-form {
    margin: 0;
}

.user-menu-link:hover {
    background: rgba(71, 151, 192, 0.12);
}

.user-menu-link.active {
    background: rgba(71, 151, 192, 0.22);
    box-shadow: inset 0 0 0 1px rgba(71, 151, 192, 0.35);
}

.user-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.charter-alert {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d65454;
    display: none;
    margin-left: 6px;
    box-shadow: 0 0 0 2px rgba(214, 84, 84, 0.15);
}

.charter-alert.show {
    display: inline-block;
}

.content {
    display: grid;
    gap: 20px;
}

.notice-banner {
    background: rgba(204, 183, 117, 0.18);
    border: 1px solid rgba(204, 183, 117, 0.35);
    color: #5b4b1f;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.mairie-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mairie-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
}

.mairie-content {
    white-space: pre-wrap;
    color: var(--ink);
}

.mairie-vehicles {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.vehicle-roles {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.vehicle-role-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vehicle-role-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: #e6f0f7;
    color: #2f6b8c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.vehicle-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.vehicle-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.vehicle-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(71, 151, 192, 0.15);
    color: #2f5f76;
    display: grid;
    place-items: center;
}

.vehicle-plate-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vehicle-plate-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    opacity: 0.7;
}

.vehicle-plate {
    font-weight: 700;
    color: var(--muted);
}

.vehicle-plate--secondary {
    margin-top: 4px;
}

.table-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.table-filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 1 1 140px;
    min-width: 120px;
    max-width: 220px;
}

.table-filter-bar input,
.table-filter-bar select {
    font-size: 13px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
}

.table-filter-bar .filter-reset {
    align-self: flex-end;
}

.organisation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}


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

.divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.card h3 {
    margin: 0 0 8px;
}

.collapsible > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    position: relative;
    padding-right: 18px;
}

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

.collapsible > summary::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    position: absolute;
    right: 2px;
    top: 50%;
    margin-top: -4px;
    transition: transform 0.2s ease;
}

.collapsible[open] > summary::after {
    transform: rotate(-135deg);
}

.collapsible-body {
    margin-top: 12px;
}

.card-icon {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(71, 151, 192, 0.15);
    color: #2f5f76;
    font-weight: 700;
    margin-right: 8px;
    font-size: 13px;
}

.card-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.subsidy-card .filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.subsidy-lines {
    display: grid;
    gap: 8px;
    margin: 10px 0;
}
.subsidy-lines-actions {
    display: none;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
}
.subsidy-lines-actions .btn {
    padding: 6px 10px;
}
.invoice-lines-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
}
.invoice-lines-actions .btn {
    padding: 6px 10px;
}
.invoice-lines-head {
    display: grid;
    grid-template-columns: 1fr 320px 140px;
    gap: 8px;
    align-items: center;
    margin: 6px 0 4px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.invoice-lines-head span:nth-child(2) {
    text-align: left;
}
.invoice-lines-head span:nth-child(3) {
    text-align: center;
}
.invoice-line-row {
    display: grid;
    grid-template-columns: 1fr 320px 140px;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(71, 151, 192, 0.04);
}
.invoice-line-row input {
    height: 34px;
    margin: 0;
}
.invoice-col-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.invoice-col-actions .btn {
    padding: 6px 10px;
    min-height: 32px;
}
@media (max-width: 1100px) {
    .invoice-lines-head,
    .invoice-line-row {
        grid-template-columns: 1fr;
    }
    .invoice-col-actions {
        justify-content: flex-start;
    }
}
.subsidy-exception-row {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 0.6fr 0.5fr 110px auto;
    gap: 8px;
    align-items: end;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(71, 151, 192, 0.18);
    background: rgba(71, 151, 192, 0.04);
}
.subsidy-exception-row input {
    height: 30px;
    padding: 6px 8px;
    background: var(--input-bg);
    color: var(--ink);
}
.subsidy-exception-row .qty-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}
.subsidy-exception-row .line-total {
    font-weight: 600;
    text-align: right;
    color: var(--ink);
}
.subsidy-panel {
    display: none;
    margin-top: 8px;
}
.subsidy-panel.open {
    display: block;
}
.ent-select-wrap { position: relative; }
.ent-select-trigger { width: 100%; height: 41px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); font-family: inherit; font-size: 1rem; text-align: left; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; box-sizing: border-box; }
.ent-select-trigger:focus { outline: 2px solid var(--accent, #4797c0); outline-offset: 1px; }
.ent-select-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted, #888); font-size: .95rem; }
.ent-select-label.has-value { color: var(--ink, #222); }
.ent-select-icons { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ent-chevron { font-size: .8rem; color: var(--muted, #888); transition: transform .15s; }
.ent-select-wrap.open .ent-chevron { transform: rotate(180deg); }
.ent-clear-btn { cursor: pointer; color: var(--muted, #888); font-size: 1rem; line-height: 1; padding: 0 2px; }
.ent-clear-btn:hover { color: var(--ink, #222); }
.ent-select-dropdown { position: absolute; top: calc(100% + 4px); left: 0; width: 100%; z-index: 50; background: var(--surface, #fff); border: 1px solid var(--border, #e5e5e5); border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.1); overflow: hidden; }
.ent-search-wrap { padding: 8px; border-bottom: 1px solid var(--border, #e5e5e5); }
.ent-search-wrap input { width: 100%; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--input-bg); color: var(--ink); font-family: inherit; font-size: .9rem; }
.ent-select-results { max-height: 180px; overflow-y: auto; }
.ent-result-item { padding: 8px 12px; font-size: .9rem; cursor: pointer; color: var(--ink); }
.ent-result-item:hover { background: var(--hover, #f0f4f8); }
[data-theme="dark"] .ent-result-item:hover { background: rgba(71, 151, 192, 0.12); }
.ent-no-result { padding: 8px 12px; font-size: .85rem; color: var(--muted, #888); }
.yt-input-wrap { display: flex; gap: 4px; align-items: center; }
.yt-input-wrap input[type="url"] { flex: 1; padding: 7px 10px; font-size: .88rem; }
.yt-fetch-btn { flex-shrink: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); cursor: pointer; font-size: .95rem; color: var(--muted, #888); line-height: 1; }
.yt-fetch-btn:hover { color: var(--ink, #222); background: var(--hover, #f0f4f8); }
.yt-auto-display { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.yt-auto-badge { font-size: .72rem; background: #e8f5e9; color: #2e7d32; border-radius: 4px; padding: 1px 5px; font-weight: 600; }
.subsidy-total {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    color: #2c3a48;
    font-weight: 600;
}
[data-theme="dark"] .subsidy-total {
    color: var(--ink);
}

.label-fields {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(71, 151, 192, 0.05);
    border: 1px solid var(--border);
}

.label-fields.active {
    display: grid;
}

.label-fields .label-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.label-fields .label-help {
    grid-column: 1 / -1;
    font-size: 12px;
}

.label-tracks {
    grid-column: 1 / -1;
    display: grid;
    gap: 6px;
}

.label-track-row {
    display: grid;
    grid-template-columns: 1.2fr 140px 120px 110px 100px auto;
    gap: 6px;
    align-items: center;
    background: var(--card);
    border: 1px solid rgba(71, 151, 192, 0.12);
    border-radius: 10px;
    padding: 6px 8px;
}

.label-track-row .muted {
    font-size: 10px;
}

.label-track-row .track-metric {
    font-size: 11px;
    font-weight: 600;
    text-align: right;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    color: var(--muted);
    cursor: pointer;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.icon-btn.danger {
    color: #c53030;
    border-color: rgba(197, 48, 48, 0.3);
}

.icon-btn:hover {
    box-shadow: 0 6px 14px rgba(31, 43, 53, 0.12);
}

.label-total {
    grid-column: 1 / -1;
    text-align: right;
    font-weight: 600;
}

.label-track-row label span {
    display: none;
}

.subsidy-label-rules {
    display: grid;
    gap: 8px;
}

.subsidy-label-rules .rule-block {
    display: grid;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px dashed rgba(71, 151, 192, 0.25);
    background: var(--surface);
    font-size: 12px;
}

.subsidy-label-rules .rule-title {
    font-weight: 600;
    color: var(--ink);
}

.subsidy-label-rules .rule-item {
    color: var(--muted);
}

.subsidy-type-info {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
    display: none;
}

.subsidy-type-info strong {
    color: var(--ink);
    display: block;
    margin-bottom: 6px;
}

.subsidy-line-row {
    display: grid;
    grid-template-columns: 1fr 120px 140px;
    gap: 10px;
    align-items: end;
}

.subsidy-line-row.compact {
    grid-template-columns: 1fr 320px 110px;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(71, 151, 192, 0.04);
}

.subsidy-line-row.compact .line-main {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: nowrap;
}

.subsidy-line-row.compact .line-title {
    font-weight: 600;
    color: var(--ink);
}

.subsidy-line-row.compact .line-meta {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subsidy-line-row.compact .qty-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.subsidy-line-row.compact .qty-right span {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 0;
}
.subsidy-line-row.compact .line-help {
    font-size: 11px;
}

.subsidy-line-row.compact .line-total-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.subsidy-line-row.compact .qty-col {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.subsidy-line-row.compact .line-comment-inline {
    font-size: 10px;
    color: var(--muted);
    text-align: right;
    max-width: 220px;
    white-space: normal;
}

.subsidy-line-row.compact:focus-within {
    border-color: rgba(71, 151, 192, 0.35);
    box-shadow: 0 6px 16px rgba(71, 151, 192, 0.12);
    background: rgba(71, 151, 192, 0.08);
}

.subsidy-line-row.compact label span {
    font-size: 10px;
    color: var(--muted);
}

.subsidy-line-row.compact input {
    height: 30px;
    padding: 6px 8px;
    background: var(--input-bg);
}

.subsidy-line-row .line-help {
    font-size: 10px;
    color: var(--muted);
}

.subsidy-line-row .line-help.total {
    text-align: right;
    font-weight: 600;
    color: var(--ink);
}

.subsidy-line-row .line-note {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

@media (max-width: 900px) {
    .subsidy-line-row.compact .line-main {
        flex-direction: column;
        align-items: flex-start;
    }
    .subsidy-line-row.compact .line-meta {
        white-space: normal;
    }
}

.subsidy-line-admin .line-help {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.subsidy-admin-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

.subsidy-type-list {
    display: grid;
    gap: 8px;
}

.subsidy-type-item {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink);
    font-family: inherit;
    text-align: left;
    width: 100%;
    cursor: pointer;
}

.subsidy-type-item.active {
    box-shadow: inset 0 0 0 1px rgba(71, 151, 192, 0.4);
    background: rgba(71, 151, 192, 0.12);
}

.subsidy-lines-admin {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.subsidy-lines-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 600;
}

.subsidy-lines-list {
    display: grid;
    gap: 8px;
}

.subsidy-line-admin {
    display: grid;
    grid-template-columns: 120px 1.2fr 0.9fr 1fr 0.7fr 0.7fr 110px 90px 0.6fr 0.6fr auto;
    gap: 8px;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
}

.subsidy-line-admin input,
.subsidy-line-admin select {
    width: 100%;
}

.subsidy-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.subsidy-status.pending {
    background: rgba(204, 183, 117, 0.22);
    color: #7b6116;
}

.subsidy-status.validated {
    background: rgba(71, 151, 192, 0.2);
    color: #1c5f8a;
}

.subsidy-status.paid {
    background: rgba(111, 191, 115, 0.2);
    color: #1f7a4b;
}
.subsidy-status.refused {
    background: rgba(222, 66, 91, 0.18);
    color: #9b2033;
}
.table td:last-child {
    white-space: nowrap;
}

.subsidy-modal .modal-panel {
    width: min(520px, 92vw);
}

.documents-modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 36, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: 20px;
}

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

.reimburse-modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 36, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: 20px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 36, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-panel {
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 18px;
    width: min(520px, 92vw);
    display: grid;
    gap: 14px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.reimburse-panel {
    width: min(520px, 92vw);
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 22px;
    display: grid;
    gap: 16px;
}

.reimburse-type-detail {
    display: none;
}

.reimburse-type-detail.show {
    display: grid;
}

.reimburse-radio {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--muted);
}

.reimburse-radio label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
}

.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.rich-editor {
    min-height: 140px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--input-bg);
    color: var(--ink);
    outline: none;
    line-height: 1.5;
    position: relative;
}

.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.rich-editor:focus {
    border-color: rgba(71, 151, 192, 0.4);
    box-shadow: 0 8px 18px rgba(71, 151, 192, 0.12);
}

.rich-editor h2 {
    font-size: 18px;
    margin: 10px 0 6px;
}

.rich-editor h3 {
    font-size: 15px;
    margin: 8px 0 6px;
}

.rich-editor ul,
.rich-editor ol {
    margin: 6px 0;
    padding-left: 18px;
}

.rich-editor p {
    margin: 0 0 8px;
}

.rich-editor li {
    margin: 3px 0;
}

.mairie-content {
    line-height: 1.6;
    color: var(--ink);
}

.mairie-content h2 {
    font-size: 20px;
    margin: 18px 0 8px;
}

.mairie-content h3 {
    font-size: 16px;
    margin: 14px 0 6px;
}

.mairie-content p {
    margin: 0 0 10px;
}

.mairie-content ul,
.mairie-content ol {
    margin: 8px 0 12px 0;
    padding-left: 20px;
}

.mairie-content li {
    margin: 4px 0;
}

.mairie-content li p,
.rich-editor li p {
    margin: 0;
}

.mairie-content p:empty,
.rich-editor p:empty,
.mairie-content div:empty,
.rich-editor div:empty {
    display: none;
}

.documents-panel {
    width: min(720px, 92vw);
    background: var(--card);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 22px;
    display: grid;
    gap: 16px;
}

.documents-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.documents-panel-header h3 {
    margin: 0;
}

.documents-sections {
    display: grid;
    gap: 16px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.documents-section {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: var(--surface);
}

.documents-section:nth-child(1) {
    background: rgba(71, 151, 192, 0.12);
    border-color: rgba(71, 151, 192, 0.25);
}

.documents-section:nth-child(2) {
    background: rgba(204, 183, 117, 0.18);
    border-color: rgba(204, 183, 117, 0.3);
}

.documents-section:nth-child(3) {
    background: rgba(111, 191, 115, 0.12);
    border-color: rgba(111, 191, 115, 0.25);
}

.documents-section:nth-child(4) {
    background: rgba(214, 90, 90, 0.12);
    border-color: rgba(214, 90, 90, 0.25);
}

.documents-section:nth-child(5) {
    background: rgba(95, 108, 175, 0.12);
    border-color: rgba(95, 108, 175, 0.25);
}

.documents-section-title {
    font-weight: 700;
    margin-bottom: 10px;
}

.documents-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.doc-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(71, 151, 192, 0.3);
    background: rgba(71, 151, 192, 0.12);
    color: #22506a;
    font-weight: 600;
}

.doc-button:hover {
    background: rgba(71, 151, 192, 0.2);
}
[data-theme="dark"] .doc-button {
    color: #7ec8e3;
    border-color: rgba(71, 151, 192, 0.4);
    background: rgba(71, 151, 192, 0.15);
}
[data-theme="dark"] .doc-button:hover {
    background: rgba(71, 151, 192, 0.25);
    color: #a8ddf0;
}

.roles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0 4px;
}

.documents-card {
    cursor: pointer;
}

.week-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.week-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bilan-chart-wrap {
    width: 100%;
    overflow-x: clip;
    overflow-y: visible;
    position: relative;
}

.bilan-chart-wrap canvas {
    display: block;
    max-width: 100%;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.kpi {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
}

.kpi-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 18px;
    font-weight: 700;
}

.kpi-value.positive {
    color: #1f8f5f;
}

.kpi-value.negative {
    color: #c0392b;
}

.kpis-blur .kpi-value {
    filter: blur(6px);
    -webkit-user-select: none;
    user-select: none;
}

.budget-balance {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    display: grid;
    gap: 16px;
}

.budget-balance-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.budget-balance-title {
    font-weight: 700;
}

.budget-balance-sub {
    font-size: 12px;
    color: var(--muted);
}

.budget-bars {
    display: grid;
    gap: 12px;
}

.budget-bar-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.budget-bar-value {
    font-weight: 600;
    color: var(--ink);
}

.budget-bar-track {
    height: 10px;
    background: #e8edf1;
    border-radius: 999px;
    overflow: hidden;
}

.budget-bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 0.2s ease;
}

.budget-bar-fill.positive {
    background: linear-gradient(90deg, #6fbf73, #4f9f57);
}

.budget-bar-fill.negative {
    background: linear-gradient(90deg, #d65a5a, #b13939);
}

.recap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.recap-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--surface);
}

.recap-panel-income {
    background: rgba(111, 191, 115, 0.08);
}

.recap-panel-expense {
    background: rgba(214, 90, 90, 0.08);
}

.recap-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 10px;
}

.recap-totals {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.recap-total {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
}

.delta.positive {
    color: #1f8f5f;
    font-weight: 600;
}

.delta.negative {
    color: #c0392b;
    font-weight: 600;
}

.chart {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.chart-bar {
    position: relative;
    background: #eef2f6;
    border-radius: 999px;
    height: 18px;
    overflow: hidden;
}
[data-theme="dark"] .chart-bar {
    background: #1a2840;
}

.chart-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
}

.chart-fill.income {
    background: linear-gradient(90deg, var(--primary), #3c7a99);
}

.chart-fill.expense {
    background: linear-gradient(90deg, #d65a5a, #b73d3d);
}

.chart-label {
    position: absolute;
    inset: 0;
    font-size: 11px;
    color: var(--ink);
    display: grid;
    place-items: center;
    font-weight: 600;
}

.chart-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
    align-items: center;
    position: relative;
}

.chart-pie {
    display: block;
    margin: 0 auto;
}

.chart-legend {
    display: grid;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.chart-grid-duo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.chart-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    position: relative;
}

.chart-block-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--ink);
}

.chart-tooltip {
    position: absolute;
    padding: 8px 10px;
    border-radius: 10px;
    background: #1f2b35;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 10px 25px rgba(16, 24, 40, 0.2);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -120%);
    transition: opacity 0.12s ease;
    white-space: nowrap;
    z-index: 5;
}

.chart-tooltip.visible {
    opacity: 1;
}

.top-list {
    display: grid;
    gap: 16px;
}

.top-list-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.top-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.top-list-items li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 13px;
}

.top-list-value {
    font-weight: 700;
    color: var(--ink);
}

.legend-item {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 8px;
    align-items: center;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.calendar-popup {
    position: absolute;
    z-index: 2000;
    min-width: 220px;
    max-width: 320px;
    background: var(--card);
    border: 1px solid rgba(71, 151, 192, 0.22);
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(31, 43, 53, 0.14);
    padding: 12px 14px;
    border-top: 3px solid rgba(71, 151, 192, 0.45);
    display: none;
}

.modal-panel.modal-wide {
    width: min(1100px, 94vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-panel.modal-wide .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.modal-panel.modal-wide .table-wrap {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.drawer {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 36, 0.45);
    display: none;
    justify-content: flex-end;
    z-index: 200;
}

.drawer.open {
    display: flex;
}

.drawer-panel {
    background: var(--card);
    width: min(744px, 96vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(20, 28, 36, 0.13);
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-header h3 {
    margin: 0 0 6px;
}

.drawer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.drawer-week-banner {
    padding: 10px 24px;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-week-banner.banner-late {
    background: #fef2f2;
    color: #b91c1c;
    border-bottom: 2px solid #fca5a5;
}

.drawer-week-banner.banner-advance {
    background: #f0fdf4;
    color: #15803d;
    border-bottom: 2px solid #86efac;
}

.drawer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.drawer-body h4 {
    margin-bottom: 12px;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: var(--surface);
}

.acq-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}
.acq-badge--paid   { background: #d1fae5; color: #065f46; }
.acq-badge--unpaid { background: #fed7aa; color: #9a3412; }
[data-theme="dark"] .acq-badge--paid   { background: rgba(63, 151, 98, 0.18); color: #5ec98a; }
[data-theme="dark"] .acq-badge--unpaid { background: rgba(245, 158, 11, 0.18); color: #f0b429; }

.housing-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-bottom: 18px;
}

.housing-card .card h4 {
    margin-bottom: 12px;
}

.section-toggle-header {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.housing-card .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.housing-card .table {
    table-layout: fixed;
}

.housing-card table[data-housing-leases] {
    table-layout: auto;
}

.housing-card table[data-housing-leases] th:last-child {
    text-align: right;
}

.housing-card table[data-housing-leases] td:last-child {
    justify-content: flex-end;
    align-items: center;
}

.housing-card .table th,
.housing-card .table td {
    padding: 8px 10px;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
}

.housing-card .table td:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    white-space: normal;
}

.housing-card .table td:last-child .btn {
    padding: 4px 8px;
    font-size: 11px;
}

.housing-card table[data-housing-leases] td:nth-child(7) {
    width: 90px;
    white-space: nowrap;
}

.housing-card .table td:last-child {
    justify-content: flex-start;
}

.housing-lease-row.housing-status-paid {
    background: #edf8f1;
}

.housing-lease-row.housing-status-rappel {
    background: #fdf8e1;
}

.housing-lease-row.housing-status-exclusion_proche {
    background: #fdeeee;
}

.housing-lease-row.housing-status-pending {
    background: #f7f4e7;
}

.housing-lease-row.housing-status-ended {
    background: var(--surface);
}

.housing-lease-row.housing-status-exclusion {
    background: #fff3e0;
}

.housing-lease-row.housing-status-resiliation {
    background: #f0e9fb;
}

/* .housing-status-ended already uses var(--surface) which handles both themes. */
[data-theme="dark"] .housing-lease-row.housing-status-paid             { background: rgba(63, 151, 98, 0.12); }
[data-theme="dark"] .housing-lease-row.housing-status-rappel           { background: rgba(204, 183, 117, 0.12); }
[data-theme="dark"] .housing-lease-row.housing-status-exclusion_proche { background: rgba(214, 90, 90, 0.12); }
[data-theme="dark"] .housing-lease-row.housing-status-pending          { background: rgba(204, 183, 117, 0.10); }
[data-theme="dark"] .housing-lease-row.housing-status-exclusion        { background: rgba(245, 158, 11, 0.10); }
[data-theme="dark"] .housing-lease-row.housing-status-resiliation      { background: rgba(137, 96, 190, 0.12); }

.drawer-exclusion-banner {
    padding: 12px 24px;
    font-size: 0.93rem;
    flex-shrink: 0;
    background: #fff3e0;
    border-bottom: 2px solid #fb923c;
    color: #9a3412;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subsidy-detail-body {
    display: grid;
    gap: 14px;
    font-size: 14px;
}

.detail-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px 16px;
}

.detail-section {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.detail-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.detail-list {
    display: grid;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #2a3a46;
}
[data-theme="dark"] .detail-row {
    color: var(--ink);
}

.detail-block {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.fisc-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.fisc-tabs {
    padding: 10px 16px;
}

.fisc-tabs .tab-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fisc-tabs .tab-buttons .btn.active {
    background: #e8f1f7;
    border-color: rgba(71, 151, 192, 0.4);
}
[data-theme="dark"] .fisc-tabs .tab-buttons .btn.active {
    background: rgba(71, 151, 192, 0.18);
    border-color: rgba(71, 151, 192, 0.5);
    color: var(--primary);
}

.fisc-panel {
    display: grid;
    gap: 18px;
}

.fisc-preview {
    max-width: 920px;
    margin: 0 auto;
}

.fisc-form .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.fisc-preview {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f7fbff, #fff7ec);
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 12px;
}

.fisc-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.fisc-preview-title {
    font-weight: 700;
    font-size: 16px;
}

.fisc-preview-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.fisc-preview-logo img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.fisc-preview-body {
    background: var(--card);
    border-radius: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    display: grid;
    gap: 6px;
    position: relative;
}

.fisc-preview-body::after {
    content: '';
    position: absolute;
    inset: 12px;
    background-image: var(--fisc-watermark);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.07;
    filter: saturate(1.25) blur(0.7px);
    pointer-events: none;
}

.fisc-preview-body > * {
    position: relative;
    z-index: 1;
}

.fisc-preview-title-line {
    font-weight: 700;
    color: #1e2f3b;
    margin-bottom: 4px;
}

.fisc-preview-row {
    font-size: 14px;
    color: #2a3a46;
}

/* Le bloc de prévisualisation reste toujours en mode clair — c'est un aperçu du document imprimable.
   En forçant ici les variables thème sur leurs valeurs claires, toutes les règles internes
   qui utilisent var(--ink/--muted/--border/--surface) redeviennent automatiquement claires,
   ce qui évite de dupliquer chaque sous-règle. */
[data-theme="dark"] .fisc-preview {
    color-scheme: light;
    background: linear-gradient(135deg, #f7fbff, #fff7ec);
    color: #1e2a33;
    --ink: #1e2a33;
    --muted: #6b7a86;
    --card: #ffffff;
    --border: #e2e6ea;
    --surface: #f9fafb;
}

.fisc-preview-footer {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}

.fisc-copy {
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--card);
    display: grid;
    gap: 8px;
}

.fisc-copy-header {
    font-weight: 600;
    color: #233341;
    font-size: 13px;
}

.fisc-copy-body {
    margin: 0;
    white-space: pre-wrap;
    font-size: 13px;
    color: #2a3a46;
}

.fisc-admin-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin-bottom: 16px;
}

.calendar-popup.open {
    display: block;
}

.popup-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.popup-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
    background: rgba(71, 151, 192, 0.08);
    padding: 4px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.popup-time {
    font-weight: 700;
    color: var(--ink);
}

.popup-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.popup-pill.warning {
    background: rgba(204, 126, 45, 0.2);
    color: #9a4f00;
}

.popup-pill.success {
    background: rgba(111, 191, 115, 0.2);
    color: #1f7a4b;
}

.popup-row {
    font-size: 12px;
    color: var(--ink);
    margin-bottom: 4px;
}

.popup-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    background: rgba(71, 151, 192, 0.06);
    border-radius: 8px;
    padding: 8px;
}

.popup-note.private-note {
    background: rgba(204, 183, 117, 0.2);
    color: #7b6116;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.popup-row.is-blurred,
.popup-note.is-blurred {
    filter: blur(5px);
    -webkit-user-select: none;
    user-select: none;
}

.popup-title .is-blurred {
    filter: blur(5px);
    -webkit-user-select: none;
    user-select: none;
}

.calendar-marker.private {
    box-shadow: 0 0 0 2px rgba(204, 183, 117, 0.25);
}

.popup-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.calendar-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
}

.calendar-sidebar {
    display: grid;
    gap: 16px;
    align-content: start;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow: auto;
}

.calendar-sidebar .card:first-child {
    padding: 14px 16px;
}

.calendar-sidebar .card:first-child .week-header {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.calendar-sidebar .card:first-child h3 {
    margin-bottom: 4px;
    font-size: 16px;
}

.calendar-sidebar .card:first-child p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.calendar-sidebar .card:first-child .week-actions {
    gap: 6px;
}

.calendar-sidebar .card:first-child .calendar-toggle {
    margin-top: 10px;
}

.calendar-sidebar .card:first-child .week-actions .btn.small {
    padding: 4px 8px;
    font-size: 11px;
}

.calendar-sidebar .card:first-child .calendar-toggle .btn.small {
    padding: 5px 8px;
    font-size: 11px;
}

.calendar-board {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: calc(100vh - 40px);
    overflow-y: auto;
}

.calendar-header {
    display: grid;
    grid-template-columns: 80px 1fr;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.calendar-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    height: 768px;
    overflow: auto;
}

.calendar-time-col {
    border-right: 1px solid var(--border);
    background: var(--surface);
    font-size: 11px;
    color: var(--muted);
    position: relative;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    border-right: 1px solid var(--border);
    position: relative;
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-day-title {
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    padding: 10px 6px;
}

.calendar-day.is-today .calendar-day-title {
    color: #1c5f8a;
}

.calendar-day.is-today {
    background: #e7f2fb;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(71, 151, 192, 0.35);
}

.calendar-grid .calendar-day.is-today {
    background: rgba(71, 151, 192, 0.08);
    box-shadow: inset 0 0 0 1px rgba(71, 151, 192, 0.2);
    border-radius: 0;
}

.calendar-slot {
    height: 20px;
    border-bottom: 1px solid rgba(226, 230, 234, 0.6);
}
[data-theme="dark"] .calendar-slot {
    border-bottom-color: rgba(30, 45, 66, 0.7);
}

.calendar-hour {
    position: absolute;
    left: 6px;
    transform: translateY(-50%);
}

.calendar-divider {
    padding: 8px 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.calendar-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.calendar-owners {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-owners-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.calendar-marker {
    position: absolute;
    left: 6px;
    width: 16px;
    border-radius: 999px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    overflow: hidden;
}

.calendar-marker.mine {
    background: #2f7ab3;
}

.calendar-marker.other {
    background: #2f9c6a;
}

.calendar-marker.important {
    background: #c0392b;
}

.calendar-marker.event {
    background: #7d4ac7;
}

.calendar-marker.mandatory {
    background: #d4a017;
}

.calendar-marker.completed {
    opacity: 0.6;
}

.calendar-marker.rdv-pending {
    background: rgba(249, 115, 22, 0.65);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(255,255,255,0.2) 3px,
        rgba(255,255,255,0.2) 5px
    );
    cursor: default;
}

.calendar-marker.availability {
    width: 5px;
    background: rgba(235, 215, 135, 0.7);
    box-shadow: none;
}

.calendar-marker.availability.unavailable {
    background: rgba(221, 112, 112, 0.6);
}

.calendar-selection {
    position: absolute;
    left: 2px;
    right: 2px;
    background: rgba(204, 183, 117, 0.2);
    border: 1px dashed rgba(204, 183, 117, 0.6);
    border-radius: 8px;
    pointer-events: none;
}

.calendar-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ccb775;
    box-shadow: 0 0 0 1px rgba(204, 183, 117, 0.25);
}

.calendar-now-line::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 8px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #ccb775;
    box-shadow: 0 0 0 2px rgba(204, 183, 117, 0.2);
}

.calendar-marker.tiny {
    font-size: 0;
}

.filters-list {
    display: grid;
    gap: 8px 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 220px;
    overflow: auto;
    padding-right: 6px;
}

.filters-list label {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 8px;
    line-height: 1.2;
}

.filter-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

.filter-name {
    font-weight: 600;
    color: var(--ink);
}

.legend-list {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.legend-dot.mine {
    background: #2f7ab3;
}

.legend-dot.other {
    background: #2f9c6a;
}

.legend-dot.important {
    background: #c0392b;
}

.legend-dot.event {
    background: #7d4ac7;
}

.legend-dot.mandatory {
    background: #d4a017;
}

.legend-dot.availability {
    background: rgba(235, 215, 135, 0.7);
}

.legend-dot.availability.unavailable {
    background: rgba(221, 112, 112, 0.6);
}

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

.check input {
    width: auto;
}

@media (max-width: 1100px) {
    .calendar-shell {
        grid-template-columns: 1fr;
    }
    .calendar-grid {
        height: 600px;
    }
}

.legend-value {
    font-weight: 600;
    color: var(--ink);
}

.status {
    font-weight: 600;
}

.status.paid {
    color: #1f8f5f;
}

.status.partial {
    color: #b9851d;
}

.inline-meta {
    display: inline-block;
    margin-right: 10px;
}

.availability-grid {
    display: grid;
    gap: 10px;
}

.availability-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 10px;
    align-items: center;
    font-size: 13px;
}

.availability-name {
    font-weight: 700;
}

.availability-hours {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
}

.availability-card {
    border-left: 4px solid var(--primary);
}

.availability-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.availability-section h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

@media (max-width: 1100px) {
    .availability-split {
        grid-template-columns: 1fr;
    }
}

.availability-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

@media (max-width: 1100px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

.stats-card {
    border-left: 4px solid var(--accent);
}

.stats-grid {
    display: grid;
    gap: 12px;
    padding-top: 6px;
}

.notes-card .card-header {
    align-items: flex-start;
}

.notes-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.notes-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.note-tab {
    border: 1px solid transparent;
    background: var(--surface);
    color: #50606f;
    padding: 8px 14px;
    border-radius: 10px 10px 0 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    position: relative;
}

.note-tab.active {
    border-color: var(--border);
    color: #0f1f2c;
}

.note-tab.sand { background: #f6edd8; }
.note-tab.sky { background: #e2f0fb; }
.note-tab.mint { background: #e3f6ed; }
.note-tab.rose { background: #f9e2ea; }
.note-tab.violet { background: #eee7fb; }
.note-tab.slate { background: #eef1f5; }

[data-theme="dark"] .note-tab { color: #9ab2cc; }
[data-theme="dark"] .note-tab.active { color: #c8d8ea; }
[data-theme="dark"] .note-tab.sand   { background: #2a2318; }
[data-theme="dark"] .note-tab.sky    { background: #172233; }
[data-theme="dark"] .note-tab.mint   { background: #152a20; }
[data-theme="dark"] .note-tab.rose   { background: #2a1820; }
[data-theme="dark"] .note-tab.violet { background: #1e1a30; }
[data-theme="dark"] .note-tab.slate  { background: #1a2130; }
[data-theme="dark"] .note-tab-dot    { box-shadow: 0 0 0 2px #131e2e; }

.note-tab-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #d65a5a;
    box-shadow: 0 0 0 2px #fff;
}

.note-tab-dot.updated {
    background: #e6a24d;
}

.note-view {
    border: 1px solid var(--border);
    border-radius: 0 16px 16px 16px;
    padding: 14px 16px;
    background: var(--card);
    max-height: 260px;
    overflow: hidden;
    display: grid;
    gap: 8px;
}

.note-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.note-view-title {
    font-weight: 700;
    color: var(--ink);
}

.note-content {
    padding: 14px 16px;
    display: grid;
    gap: 8px;
}

.note-body {
    color: var(--ink);
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.note-body.clamp {
    max-height: 130px;
    overflow: hidden;
}

.note-body.has-more {
    position: relative;
}

.note-body.has-more::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
}

.note-more {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    display: flex;
    justify-content: flex-end;
    padding-top: 6px;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.note-actions {
    display: flex;
    gap: 8px;
}

.note-card.sand .note-strip { background: #f3ead7; }
.note-card.sky .note-strip { background: #dbeaf6; }
.note-card.mint .note-strip { background: #dff4ea; }
.note-card.rose .note-strip { background: #f7e0e7; }
.note-card.violet .note-strip { background: #e7e0f5; }
.note-card.slate .note-strip { background: #e7edf3; }

[data-theme="dark"] .note-card.sand .note-strip   { background: #3a2e18; }
[data-theme="dark"] .note-card.sky .note-strip    { background: #1a2d40; }
[data-theme="dark"] .note-card.mint .note-strip   { background: #1a3028; }
[data-theme="dark"] .note-card.rose .note-strip   { background: #351a26; }
[data-theme="dark"] .note-card.violet .note-strip { background: #26203a; }
[data-theme="dark"] .note-card.slate .note-strip  { background: #1f2a38; }

.notes-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 30, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 40;
}

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

.notes-panel {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    max-width: 760px;
    width: 100%;
    box-shadow: 0 24px 48px rgba(20, 40, 60, 0.25);
    display: grid;
    gap: 12px;
}

.permits-card .card-actions .btn.icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    padding: 0;
}

.permits-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.permit-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 10px;
    background: var(--card);
    display: grid;
    gap: 4px;
}

.permit-line {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
}

.permit-line-left {
    display: flex;
    align-items: center;
}

.permit-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
}

.permit-title-text {
    font-weight: 700;
}

.permit-time {
    font-weight: 500;
    color: var(--muted);
}

.permit-meta {
    color: var(--muted);
    font-size: 11.5px;
}

.permit-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* ─── Badge générique ─── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-orange { background: #fed7aa; color: #9a3412; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-grey   { background: #f1f5f9; color: #64748b; }

[data-theme="dark"] .badge-green  { background: #0d3326; color: #4ade80; }
[data-theme="dark"] .badge-red    { background: #2d1010; color: #f87171; }
[data-theme="dark"] .badge-yellow { background: #2d2208; color: #fcd34d; }
[data-theme="dark"] .badge-orange { background: #2d1a08; color: #fb923c; }
[data-theme="dark"] .badge-blue   { background: #0d1f3d; color: #60a5fa; }
[data-theme="dark"] .badge-grey   { background: #1a2130; color: #94a3b8; }

.permit-pill {
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    background: #eef2f6;
    color: #3e5566;
}

.permit-pill.pending { background: #f7f0df; color: #9a6b1b; }
.permit-pill.approved { background: #e3f5ea; color: #1f7a52; }
.permit-pill.refused { background: #fde7e7; color: #a13a3a; }
.permit-pill.veil { background: #ffe5b5; color: #a05d12; }
.permit-pill.not-communicated { background: #fdecc8; color: #a76812; }
.permit-pill.communicated { background: #e7f4ff; color: #2f6fa4; }
.permit-pill.to-communicate { background: #ffe0e0; color: #a33838; }

.permit-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.permit-actions .btn.small {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 8px;
}

.permit-actions .btn.icon {
    width: auto;
    height: auto;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 8px;
}

.permits-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.permits-page-info {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.permits-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 30, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 40;
}

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

.permits-panel {
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    max-width: 640px;
    width: 100%;
    box-shadow: 0 24px 48px rgba(20, 40, 60, 0.25);
    display: grid;
    gap: 12px;
}

.permits-comm textarea {
    width: 100%;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.4;
}

.permit-photo-preview {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    display: block;
}

.note-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12px;
    color: var(--muted);
}

.note-color-option {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--ink);
}

.note-color-option input {
    margin: 0;
}

.note-color-option.sand { background: #f8f1e3; }
.note-color-option.sky { background: #e8f2fb; }
.note-color-option.mint { background: #e7f6ef; }
.note-color-option.rose { background: #f9e7ee; }
.note-color-option.violet { background: #eee7fb; }
.note-color-option.slate { background: #eef1f5; }

[data-theme="dark"] .note-color-option.sand   { background: #2a2318; }
[data-theme="dark"] .note-color-option.sky    { background: #172233; }
[data-theme="dark"] .note-color-option.mint   { background: #152a20; }
[data-theme="dark"] .note-color-option.rose   { background: #2a1820; }
[data-theme="dark"] .note-color-option.violet { background: #1e1a30; }
[data-theme="dark"] .note-color-option.slate  { background: #1a2130; }

.availability-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 10px 0 14px;
}

.summary-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 12px 0 6px;
}

.summary-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.summary-value {
    font-weight: 700;
    font-size: 18px;
}

.availability-pill {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(71, 151, 192, 0.15);
    color: #2f5f76;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.availability-pill.unavailable {
    background: rgba(221, 112, 112, 0.18);
    color: #a03434;
}

.history-row {
    display: none;
}

.history-row.open {
    display: table-row;
}

.history-panel {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
}

.history-list {
    display: grid;
    gap: 6px;
}

.history-item {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 110px 120px 140px;
    gap: 10px;
    font-size: 13px;
    color: var(--ink);
}

.prime-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.prime-cell input {
    max-width: 120px;
}

.prime-actions {
    display: inline-flex;
    gap: 6px;
}

.prime-cell input:disabled {
    background: #eef2f6;
    color: #6b7c8b;
}

@media (max-width: 900px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

/* ── Dashboard cards ─────────────────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.dash-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.dash-card-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.dash-card-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(71, 151, 192, 0.12);
    color: var(--primary);
    flex-shrink: 0;
}

.dash-card-icon .menu-icon {
    width: 17px;
    height: 17px;
    stroke: var(--primary);
}

.card-desc {
    font-size: 12.5px;
    color: var(--muted);
    margin: 0 0 2px;
    line-height: 1.45;
}

.dash-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(71, 151, 192, 0.08);
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.dash-chip:hover {
    background: rgba(71, 151, 192, 0.18);
}

.dash-chip.accent {
    background: rgba(204, 183, 117, 0.22);
    color: #7a5c10;
    font-weight: 600;
}

.dash-chip.accent:hover {
    background: rgba(204, 183, 117, 0.38);
}

.dashboard-alert {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    border-radius: 16px;
    border: 1px solid rgba(204, 183, 117, 0.45);
    background: linear-gradient(135deg, rgba(204, 183, 117, 0.16), rgba(71, 151, 192, 0.12));
    text-align: center;
    box-shadow: var(--shadow);
}

.dashboard-alert-title {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.dashboard-alert-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.dashboard-alert-meta {
    font-size: 12px;
    color: var(--muted);
}

.btn {
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 20px rgba(71, 151, 192, 0.2);
}

.btn.accent {
    background: var(--accent);
    color: #3b3320;
    box-shadow: 0 10px 20px rgba(204, 183, 117, 0.3);
}

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

.btn.ghost.danger {
    color: #c0392b;
    border-color: rgba(192, 57, 43, 0.3);
}

.btn.ghost.warning {
    color: #d89a45;
    border-color: rgba(216, 154, 69, 0.4);
}

.btn.small {
    padding: 6px 10px;
    font-size: 12px;
}

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

.form {
    display: grid;
    gap: 12px;
}

.section-title {
    font-weight: 600;
    color: var(--ink);
    margin-top: 6px;
}

.compact-form {
    gap: 10px;
}

.compact-form label span {
    font-size: 11px;
    margin-bottom: 4px;
}

.compact-form input,
.compact-form select {
    padding: 8px 10px;
}

.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.check-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.role-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 16px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.role-options > span {
    grid-column: 1 / -1;
    font-weight: 600;
    color: var(--ink);
}

.role-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--ink);
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink);
}

.check-inline input[type="checkbox"] {
    width: auto;
}

.check-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.check-field input[type="checkbox"] {
    width: auto;
    align-self: flex-start;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

label span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-family: inherit;
}

textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-family: inherit;
    resize: vertical;
}

.time-picker {
    position: relative;
}

.time-picker input[data-time-input] {
    cursor: pointer;
}

.time-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 240px;
    overflow: auto;
    display: none;
    z-index: 1200;
}

.time-menu.open {
    display: block;
}

.time-option {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: .875rem;
    color: var(--ink);
    cursor: pointer;
    transition: background .1s;
}

.time-option:hover {
    background: rgba(47, 122, 179, .12);
    color: var(--ink);
}

.time-option.selected {
    background: rgba(47, 122, 179, .18);
    color: #2f7ab3;
    font-weight: 600;
}

.form-message {
    font-size: 13px;
    color: #c0392b;
}

.form-message.ok {
    color: #1f8f5f;
}

.readonly-field {
    background: var(--surface);
    color: #7a8794;
    border-color: #e0e6eb;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table-link {
    color: #1c5f8a;
    text-decoration: underline;
    word-break: break-all;
}

.pill {
    background: rgba(204, 183, 117, 0.25);
    color: #6a5a28;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.pill.success {
    background: rgba(63, 151, 98, 0.2);
    color: #2b6b47;
}

.pill.danger {
    background: rgba(214, 90, 90, 0.2);
    color: #9b3a3a;
}

.pill.accent {
    background: rgba(204, 183, 117, 0.25);
    color: #6c5a25;
}

.pill.violet {
    background: rgba(137, 96, 190, 0.2);
    color: #5e3a8e;
}

/* .pill.accent inherits the default .pill dark rule (same palette). */
[data-theme="dark"] .pill,
[data-theme="dark"] .pill.accent { background: rgba(204, 183, 117, 0.18); color: #d4b96a; }
[data-theme="dark"] .pill.success { background: rgba(63, 151, 98, 0.20);  color: #5ec98a; }
[data-theme="dark"] .pill.danger  { background: rgba(214, 90, 90, 0.20);  color: #e07a7a; }
[data-theme="dark"] .pill.violet  { background: rgba(137, 96, 190, 0.20); color: #b08de0; }

.avatar-mini {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
}

.avatar-mini.placeholder {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #eef1f4;
    color: var(--muted);
}

.profile-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
    align-items: start;
}

.avatar {
    display: grid;
    gap: 12px;
}

.avatar img,
.avatar-placeholder {
    width: 140px;
    height: 140px;
    border-radius: 16px;
    background: #eef1f4;
    object-fit: cover;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.auth-shell {
    width: min(440px, 92vw);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    text-align: center;
}

.auth-brand .brand-mark {
    width: 88px;
    height: 88px;
    border-radius: 18px;
    font-size: 22px;
}

.auth-brand .brand-mark img {
    width: 72px;
    height: 72px;
}

.auth-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-header {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    align-items: center;
}

.auth-header h1 {
    margin: 0 0 6px;
    font-size: 20px;
}

.auth-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--muted);
}

.charter-content {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: var(--surface);
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    align-items: end;
}

.filters-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 14px;
}
.hidden {
    display: none !important;
}

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

.comm-card .card-header h3 {
    margin-bottom: 4px;
}

.comm-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 10px 0 16px;
}

.comm-controls {
    margin-bottom: 14px;
}

.comm-controls .comm-save {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.comm-controls .comm-save label {
    display: grid;
    gap: 6px;
    min-width: 200px;
}

.comm-message-field {
    flex: 1 1 320px;
}

.comm-message-field textarea {
    min-height: 64px;
    resize: vertical;
}

.comm-capture {
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(204, 183, 117, 0.18), rgba(255, 255, 255, 0.96));
    border: 1px solid rgba(204, 183, 117, 0.5);
    padding: 18px;
    box-shadow: 0 18px 40px rgba(28, 46, 74, 0.08);
    width: min(100%, 794px);
    min-height: 561px;
}
/* Le communiqué hebdomadaire reste toujours en mode clair — document imprimable.
   On rebascule les variables thème sur leurs valeurs claires : toutes les sous-règles
   qui consomment var(--card/--border/--surface/etc.) redeviennent claires automatiquement. */
[data-theme="dark"] .comm-capture {
    color-scheme: light;
    background: #fdf8ef;
    border-color: rgba(204, 183, 117, 0.5);
    color: #1e2a33;
    --ink: #1e2a33;
    --muted: #6b7a86;
    --card: #ffffff;
    --border: #e2e6ea;
    --surface: #f9fafb;
}
/* Les cartes internes sont blanches (et non pas gris clair) pour mieux ressortir sur le fond beige. */
[data-theme="dark"] .comm-capture .comm-finance,
[data-theme="dark"] .comm-capture .comm-bottom-card,
[data-theme="dark"] .comm-capture .metric-card {
    background: #ffffff;
}

.comm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.comm-title-main {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.comm-title-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.comm-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: 2fr 1.3fr;
}

.comm-finance {
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 18px;
    display: grid;
    gap: 14px;
}

.comm-finance-body {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
    align-items: center;
}

.comm-metrics {
    display: grid;
    gap: 14px;
}

.comm-bottom {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
}

.comm-bottom-card {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 14px 16px;
    display: grid;
    gap: 12px;
}

.comm-expense-chart {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: center;
    gap: 12px;
}

.comm-expense-legend {
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    max-height: 140px;
    overflow: auto;
    padding-right: 4px;
}

.comm-expense-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.comm-budget-pill {
    border-radius: 14px;
    border: 1px dashed rgba(71, 151, 192, 0.35);
    background: rgba(71, 151, 192, 0.08);
    padding: 18px;
    display: grid;
    gap: 8px;
}

.comm-budget-pill .budget-label {
    font-size: 12px;
    color: var(--muted);
}

.comm-budget-pill .budget-value {
    font-size: 22px;
    font-weight: 700;
    color: #1c5f8a;
}

.metric-card {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #eef3f8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #2b4a66;
}

.metric-icon svg {
    width: 20px;
    height: 20px;
}

.metric-label {
    font-size: 12px;
    color: var(--muted);
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: #1c2a3a;
}

.metric-sub {
    font-size: 12px;
    color: #7a8a9b;
}

.metric-note {
    font-size: 12px;
    color: #6b7a8a;
    margin-top: 6px;
}

.net-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.net-indicator {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: #cbd5e1;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.net-indicator.pos {
    background: #4ea776;
}

.net-indicator.neg {
    background: #d56c6c;
}

.net-indicator.mid {
    background: #e0a24a;
}

.net-indicator.neutral {
    background: #cbd5e1;
}

.comm-finance-status {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    padding: 12px 14px;
    display: grid;
    gap: 6px;
}

.comm-finance-status .label {
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--muted);
}

.status-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #1c2a3a;
}

.status-text {
    font-size: 15px;
}


.comm-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.comm-chip {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.6px;
    background: rgba(71, 151, 192, 0.2);
    color: #1c5f8a;
    font-weight: 700;
}

.comm-block.events .comm-chip {
    background: rgba(204, 183, 117, 0.3);
    color: #6f5510;
}

.comm-block.associations .comm-chip {
    background: rgba(112, 180, 130, 0.25);
    color: #2c6b3f;
}

.comm-title-text {
    font-size: 14px;
    color: #1c2a3a;
}

.comm-chart {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    align-items: center;
}

.comm-chart-legend {
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

.legend-item .dot.income {
    background: #4ea776;
}

.legend-item .dot.expense {
    background: #d56c6c;
}

.comm-icon {
    width: 48px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(71, 151, 192, 0.2);
    color: #1c5f8a;
    font-size: 11px;
    font-weight: 700;
}

.comm-values {
    display: grid;
    gap: 8px;
}

.comm-values .label {
    font-size: 12px;
    color: var(--muted);
}

.comm-values .value {
    font-size: 18px;
    font-weight: 700;
    color: #1c2a3a;
}

.comm-bar {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.comm-bar .bar {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
}

.comm-bar .bar.income {
    left: 0;
    background: #4ea776;
}

.comm-bar .bar.expense {
    right: 0;
    background: #d56c6c;
}

.comm-adjust {
    display: grid;
    gap: 8px;
}

.comm-adjust label {
    display: grid;
    gap: 6px;
}

.comm-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.comm-inline input {
    width: 100px;
}

.comm-brand .brand-title {
    font-weight: 700;
}

.comm-brand .brand-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.comm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    text-align: right;
}

.comm-brand-text {
    display: grid;
    gap: 2px;
    text-align: right;
}

.comm-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(204, 183, 117, 0.6);
    margin-bottom: 6px;
}

.comm-logo img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        flex-direction: row;
        align-items: center;
        gap: 16px;
        flex-wrap: wrap;
    }
    .menu {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }
    .profile-row {
        grid-template-columns: 1fr;
    }
}

/* Audit badges */
.audit-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.audit-badge-connexion  { background: #d1fae5; color: #065f46; }
.audit-badge-create     { background: #dbeafe; color: #1d4ed8; }
.audit-badge-update     { background: #fef3c7; color: #b45309; }
.audit-badge-delete     { background: #fee2e2; color: #dc2626; }
.audit-badge-validate   { background: #ede9fe; color: #6d28d9; }
.audit-badge-refuse     { background: #fce7f3; color: #9d174d; }
.audit-badge-paiement   { background: #f0fdf4; color: #15803d; }
.audit-badge-module     { background: #f3f4f6; color: #374151; font-weight: 500; }
.audit-badge-other      { background: #f3f4f6; color: #374151; }

/* ============================================
   AUDIT PAGE — enhanced layout
   ============================================ */
.audit-page .card-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Filters form — two rows */
.audit-filters-form {
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.audit-filters-row1 {
    display: grid;
    grid-template-columns: 180px 180px 1fr;
    gap: 10px;
}

.audit-filters-row2 {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.audit-filters-row1 label,
.audit-filters-row2 label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.audit-filters-form label span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}

.audit-filters-form select,
.audit-filters-form input[type="date"] {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s;
    min-width: 120px;
}

.audit-filters-form select:focus,
.audit-filters-form input[type="date"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71,151,192,0.12);
}

.audit-filters-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-left: auto;
}

/* Sticky dark thead */
.audit-page .table-wrap {
    max-height: 72vh;
    overflow-y: auto;
    overflow-x: auto;
}
.audit-page .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #1e2a33;
    color: rgba(255,255,255,0.75);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-bottom: none;
    padding: 11px 10px;
}

/* Row hover accent */
.audit-page .table tbody tr {
    transition: background 0.12s;
}
.audit-page .table tbody tr:hover {
    background: rgba(71, 151, 192, 0.05);
    box-shadow: inset 3px 0 0 var(--primary);
}
.audit-page .table tbody td {
    padding: 11px 10px;
    vertical-align: middle;
}

/* Date cell — stacked date + time */
.audit-date-main {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    display: block;
}
.audit-date-time {
    font-size: 11px;
    color: var(--muted);
    font-family: monospace;
    display: block;
    margin-top: 1px;
}

/* Actor / target */
.audit-actor-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    display: block;
}
.audit-actor-role {
    font-size: 11px;
    color: var(--muted);
    display: block;
    margin-top: 1px;
}

/* IP */
.audit-ip {
    font-family: monospace;
    font-size: 12px;
    color: var(--muted);
}

/* Row enter animation */
@keyframes auditRowIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}
.audit-row-enter {
    animation: auditRowIn 0.22s ease both;
}

/* Skeleton shimmer */
@keyframes auditSkelShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.audit-skel {
    height: 13px;
    border-radius: 5px;
    background: linear-gradient(90deg, #eceef1 25%, #f6f7f9 50%, #eceef1 75%);
    background-size: 200% 100%;
    animation: auditSkelShimmer 1.5s infinite;
    display: block;
}
.audit-skel-short { width: 60%; }
.audit-skel-long  { width: 90%; }
.audit-skel-mid   { width: 75%; }

/* Empty state */
.audit-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--muted);
}
.audit-empty-icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 12px;
    opacity: 0.4;
}
.audit-empty p {
    font-size: 14px;
    margin: 0;
}

/* Pagination improvements */
.audit-page .pagination {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 0;
}
.audit-page .pagination-info strong {
    color: var(--ink);
}

