:root {
    --app-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --app-shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --app-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --app-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --app-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --app-radius-sm: 4px;
    --app-radius: 6px;
    --app-radius-md: 8px;
    --app-radius-lg: 12px;
    /* fallback font (sera surchargé par le territoire) */
    --app-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

html, body {
    font-family: var(--app-font);
    background-color: var(--app-background);
    color: var(--app-text-primary);
}

.mud-nav-link.active {
    background-color: rgba(var(--app-primary-rgb), 0.10);
    color: var(--app-primary);
}

.mud-table-row.mud-primary-lighten {
    background-color: rgba(var(--app-primary-rgb), 0.08) !important;
    border-left: 3px solid var(--app-primary);
}

/* Force AppBar + Drawer à suivre les tokens CSS */
.mud-appbar {
    background-color: var(--app-primary) !important;
    color: #fff !important;
}

.mud-drawer {
    background-color: var(--app-surface) !important;
    color: var(--app-text-primary) !important;
}

/* === Page Header (robuste) === */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    /* soulignement */
    border-bottom: 2px solid var(--pageheader-underline, var(--app-primary));
}

.page-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--pageheader-icon-from, var(--app-primary)) 0%, var(--pageheader-icon-to, var(--app-primary-light)) 100% );
    border-radius: var(--app-radius-md);
    color: #fff;
    flex-shrink: 0;
}

.page-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.page-header-title {
    color: var(--app-text-primary);
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    line-height: 1.2 !important;
    margin: 0 !important;
}

.page-header-subtitle {
    color: var(--app-text-secondary);
    margin: 0 !important;
    /* italique + un peu plus “premium” */
    font-style: var(--pageheader-subtitle-style, italic);
    opacity: 0.95;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions {
        justify-content: flex-start;
    }

    .page-header-icon {
        width: 40px;
        height: 40px;
    }
}

/* === Mobile FAB === */
.mobile-fab {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

@media (min-width: 960px) {
    .mobile-fab {
        display: none !important;
    }
}
