:root {
    --bg: #f3f6fb;
    --bg-strong: #eaf0f8;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-solid: #ffffff;
    --panel-muted: #f8fbff;
    --panel-border: rgba(148, 163, 184, 0.22);
    --panel-border-strong: rgba(100, 116, 139, 0.22);
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --primary: #0f172a;
    --primary-2: #1d4ed8;
    --primary-3: #2563eb;
    --accent: #38bdf8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --sidebar: #08101f;
    --sidebar-2: #111b31;
    --sidebar-soft: rgba(255,255,255,.07);
    --shadow-xs: 0 8px 24px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 18px 45px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 24px 60px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 36px 90px rgba(15, 23, 42, 0.16);
    --radius-lg: 1.4rem;
    --radius-xl: 1.75rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, input, select, textarea, button {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.app-body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 24%),
        radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.08), transparent 28%),
        linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
}
body.sidebar-open { overflow: hidden; }

a {
    color: inherit;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease, opacity .2s ease;
}
a:hover { text-decoration: none; }
button { transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease; }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }

.app-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.app-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    z-index: 35;
}
.app-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar fixe avec menu interne scrollable.
   Important : height + overflow hidden sur le parent, min-height:0 sur le body. */
.app-sidebar {
    width: 300px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 28%),
        linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #fff;
    border-right: 1px solid rgba(255,255,255,.07);
    position: sticky;
    top: 0;
    z-index: 40;
    overflow: hidden;
    flex: 0 0 300px;
}

.app-sidebar-head,
.app-sidebar-foot {
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.05);
    backdrop-filter: blur(14px);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    flex: 0 0 auto;
}

.app-sidebar-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: .35rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
}
.app-sidebar-body::-webkit-scrollbar { width: 7px; }
.app-sidebar-body::-webkit-scrollbar-track { background: transparent; }
.app-sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42);
    border-radius: 999px;
}
.app-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.72);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .9rem;
    text-decoration: none;
    color: #fff;
}
.app-brand-mark {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 70%);
    font-size: 1.15rem;
    font-weight: 900;
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.38);
}
.app-brand-name {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .02em;
}
.app-brand-subtitle {
    display: block;
    margin-top: .1rem;
    font-size: .78rem;
    line-height: 1.4;
    color: rgba(255,255,255,.72);
}
.app-brand-chip {
    margin-top: .9rem;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.05);
    padding: .55rem .8rem;
    font-size: .76rem;
    color: rgba(255,255,255,.88);
}

.nav-group {
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 1.25rem;
    background: rgba(255,255,255,.035);
    padding: .85rem;
}
.nav-group-title {
    padding: 0 .35rem .65rem;
    font-size: .7rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255,255,255,.5);
    font-weight: 700;
}
.nav-group-links {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 2.85rem;
    padding: .72rem .9rem;
    border-radius: 1rem;
    text-decoration: none;
    color: rgba(255,255,255,.82);
    font-weight: 600;
}
.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
    transform: translateX(2px);
}
.nav-link-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(59,130,246,.28), rgba(37,99,235,.12));
    border: 1px solid rgba(96,165,250,.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 24px rgba(15, 23, 42, 0.22);
}
.nav-link-icon {
    width: 1.06rem;
    height: 1.06rem;
    opacity: .96;
}
.sidebar-tip-title {
    font-size: .92rem;
    font-weight: 800;
}
.sidebar-tip-text {
    margin-top: .3rem;
    font-size: .79rem;
    line-height: 1.55;
    color: rgba(255,255,255,.72);
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 1.35rem;
}
.app-content {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.app-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    border-radius: 1.9rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.78));
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}
.app-topbar-hero {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    min-width: 0;
}
.mobile-toggle {
    width: 2.9rem;
    height: 2.9rem;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .26rem;
    border-radius: .95rem;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,.76);
    box-shadow: var(--shadow-xs);
}
.mobile-toggle span {
    width: 1.2rem;
    height: 2px;
    border-radius: 999px;
    background: var(--primary);
}
.app-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .45rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.09);
    color: var(--primary-2);
    padding: .42rem .78rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.app-page-title {
    margin: 0;
    font-size: clamp(1.75rem, 2.5vw, 2.4rem);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -.03em;
}
.app-page-subtitle {
    margin: .5rem 0 0;
    max-width: 42rem;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.65;
}
.app-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .7rem;
}
.app-topbar-date,
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    min-height: 3rem;
    padding: .52rem .9rem;
    border-radius: 1.1rem;
    background: rgba(255,255,255,.78);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow-xs);
}
.app-topbar-date {
    color: var(--text-soft);
    font-size: .88rem;
    font-weight: 700;
}
.user-chip-avatar {
    width: 2.3rem;
    height: 2.3rem;
    border-radius: .95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #334155);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}
.user-chip-name {
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.05;
}
.user-chip-role {
    margin-top: .14rem;
    font-size: .74rem;
    color: var(--muted);
}

.app-flash {
    border-radius: 1.25rem;
    padding: .95rem 1rem;
    border: 1px solid transparent;
    box-shadow: var(--shadow-xs);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 3rem;
    border-radius: 1rem;
    padding: 0 1.05rem;
    border: 1px solid transparent;
    font-size: .92rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    box-shadow: 0 18px 35px rgba(30, 58, 138, 0.18);
}
.btn-primary:hover {
    box-shadow: 0 22px 44px rgba(30, 58, 138, 0.22);
}
.btn-light {
    color: var(--text);
    background: rgba(255,255,255,.92);
    border-color: var(--panel-border);
    box-shadow: var(--shadow-xs);
}
.btn-light:hover { background: #fff; }
.btn-danger-soft {
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.14);
    background: rgba(254, 242, 242, 0.95);
}
.btn-danger-soft:hover { background: #fff1f2; }

.rounded-2xl.bg-white,
.rounded-2xl.bg-white.p-5,
.rounded-2xl.bg-white.p-6,
.rounded-2xl.bg-white.p-6.shadow-sm,
.rounded-2xl.bg-white.p-5.shadow-sm,
.rounded-2xl.bg-white.p-6.shadow-sm.max-w-3xl,
.rounded-2xl.border.border-slate-200.bg-slate-50,
.rounded-2xl.border.border-slate-200.p-4,
.rounded-2xl.border.border-slate-200.p-5,
.rounded-2xl.border.border-slate-200.p-6,
.rounded-xl.border.border-slate-200.p-4,
.rounded-xl.border.border-slate-200.p-3 {
    background: var(--panel) !important;
    border: 1px solid var(--panel-border) !important;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
}

.app-content > .rounded-2xl.bg-white,
.app-content > .rounded-2xl.bg-white.p-5,
.app-content > .rounded-2xl.bg-white.p-6 {
    position: relative;
    overflow: hidden;
}
.app-content > .rounded-2xl.bg-white::before,
.app-content > .rounded-2xl.bg-white.p-5::before,
.app-content > .rounded-2xl.bg-white.p-6::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 9rem;
    height: 9rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(56,189,248,.12), transparent 65%);
    transform: translate(-30%, -30%);
    pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.34) !important;
    background: rgba(255,255,255,.94);
    color: var(--text);
    box-shadow: inset 0 1px 2px rgba(15,23,42,.03);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
input::placeholder,
textarea::placeholder { color: var(--muted-2); }
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, .58) !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11), inset 0 1px 2px rgba(15,23,42,.03);
}
input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-3);
}
label { color: var(--text-soft); }

form[method="get"],
.ui-filterbar {
    position: relative;
    padding: .95rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(148, 163, 184, .2);
    background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.75));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
form[method="get"] .btn,
.ui-filterbar .btn { min-height: 3.2rem; }

.overflow-x-auto {
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,116,139,.4) transparent;
}
.overflow-x-auto::-webkit-scrollbar { height: 10px; }
.overflow-x-auto::-webkit-scrollbar-thumb {
    background: rgba(100,116,139,.35);
    border-radius: 999px;
}
.overflow-x-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-x-auto table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.overflow-x-auto thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(248,250,252,.96), rgba(241,245,249,.92));
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}
.overflow-x-auto tbody td {
    color: var(--text-soft);
}
.overflow-x-auto tbody td.font-medium,
.overflow-x-auto tbody td .font-medium,
.overflow-x-auto tbody td strong {
    color: var(--text);
}
.overflow-x-auto tbody tr {
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.overflow-x-auto tbody tr:hover {
    background: rgba(248, 250, 252, .72);
}

.ui-inline-label {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}
.ui-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
    stroke-width: 1.9;
}
.btn .ui-icon,
a .ui-icon,
button .ui-icon {
    width: 1rem;
    height: 1rem;
}
.table-action-links,
.inline-action-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
.table-action-links form,
.inline-action-links form { display: inline-flex; }
.table-action-links a,
.table-action-links button,
.inline-action-links a,
.inline-action-links button {
    min-height: 2.3rem;
    padding: .46rem .72rem !important;
    border-radius: .85rem;
    border: 1px solid rgba(148, 163, 184, .2) !important;
    background: rgba(248,250,252,.85) !important;
    box-shadow: none !important;
    text-decoration: none;
    font-weight: 700;
}
.table-action-links a:hover,
.table-action-links button:hover,
.inline-action-links a:hover,
.inline-action-links button:hover {
    background: #fff !important;
    border-color: rgba(37,99,235,.22) !important;
}
.module-toolbar,
.module-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
}
.module-toolbar > div:last-child,
.module-actions > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
}

.table-scroll-hint {
    display: none;
    margin-top: .7rem;
    font-size: .78rem;
    color: var(--muted);
}
.empty-state-inline {
    border: 1px dashed rgba(148, 163, 184, .32);
    border-radius: 1rem;
    padding: 1rem;
    color: var(--muted);
    background: rgba(248,250,252,.7);
}

.premium-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr);
    gap: 1.15rem;
    padding: 1.25rem;
    border-radius: 2rem;
    border: 1px solid rgba(148, 163, 184, .18);
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 30%),
        linear-gradient(135deg, rgba(15,23,42,.98), rgba(15,23,42,.92) 45%, rgba(30,64,175,.86) 100%);
    color: #fff;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.premium-hero-copy,
.premium-hero-panel { position: relative; z-index: 1; }
.premium-chip {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.08);
    padding: .5rem .82rem;
    color: rgba(255,255,255,.92);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.premium-hero h2 {
    margin: 1rem 0 .55rem;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: .98;
    letter-spacing: -.05em;
    font-weight: 900;
}
.premium-hero p {
    margin: 0;
    max-width: 42rem;
    color: rgba(255,255,255,.78);
    font-size: 1rem;
    line-height: 1.8;
}
.premium-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    margin-top: 1.2rem;
}
.premium-hero-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(10px);
}
.premium-metric-ring {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
    border-radius: 1.5rem;
    background:
        radial-gradient(circle at center, rgba(255,255,255,.08) 0 36%, transparent 36%),
        conic-gradient(from 200deg, #60a5fa 0%, #38bdf8 35%, #1d4ed8 70%, rgba(255,255,255,.14) 70%, rgba(255,255,255,.14) 100%);
}
.premium-metric-ring::after {
    content: "";
    position: absolute;
    inset: 24px;
    border-radius: 50%;
    background: rgba(6, 12, 24, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.premium-metric-ring-value,
.premium-metric-ring-label { position: relative; z-index: 1; }
.premium-metric-ring-value {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -.05em;
}
.premium-metric-ring-label {
    margin-top: .25rem;
    color: rgba(255,255,255,.72);
    font-size: .86rem;
}
.premium-hero-kpis {
    display: grid;
    gap: .7rem;
}
.premium-hero-kpis div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .8rem;
    padding: .82rem .95rem;
    border-radius: 1rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
}
.premium-hero-kpis span {
    color: rgba(255,255,255,.72);
    font-size: .8rem;
}
.premium-hero-kpis strong {
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
}

.stats-strip {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.05rem 1.1rem;
    border-radius: 1.5rem;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.84));
    border: 1px solid rgba(148, 163, 184, .18);
    box-shadow: var(--shadow-sm);
}
.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -12% -35% auto;
    width: 9rem;
    height: 9rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.14), transparent 64%);
}
.stat-card-head {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}
.stat-card-value {
    position: relative;
    z-index: 1;
    margin-top: .75rem;
    font-size: clamp(1.55rem, 2vw, 2.2rem);
    line-height: 1;
    letter-spacing: -.04em;
    font-weight: 900;
}
.stat-card-meta {
    position: relative;
    z-index: 1;
    margin-top: .45rem;
    color: var(--muted);
    font-size: .82rem;
}
.stat-card-accent {
    background: linear-gradient(135deg, rgba(30,64,175,.96), rgba(37,99,235,.92));
    color: #fff;
}
.stat-card-accent .stat-card-head,
.stat-card-accent .stat-card-meta { color: rgba(255,255,255,.74); }
.stat-card-dark {
    background: linear-gradient(135deg, rgba(15,23,42,.98), rgba(30,41,59,.95));
    color: #fff;
}
.stat-card-dark .stat-card-head,
.stat-card-dark .stat-card-meta { color: rgba(255,255,255,.72); }

.dashboard-grid {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, .92fr);
}
.dashboard-grid.secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.section-card {
    border-radius: 1.8rem;
    border: 1px solid rgba(148, 163, 184, .18);
    background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.84));
    box-shadow: var(--shadow-sm);
    padding: 1.15rem;
}
.section-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.section-card-head.compact { margin-bottom: .9rem; }
.section-kicker {
    color: var(--primary-2);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 800;
}
.section-card h2 {
    margin: .18rem 0 0;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -.02em;
}
.stack-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.stack-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .95rem 1rem;
    border-radius: 1.15rem;
    border: 1px solid rgba(148, 163, 184, .16);
    background: linear-gradient(180deg, rgba(248,250,252,.8), rgba(255,255,255,.8));
}
.stack-item-title {
    color: var(--text);
    font-weight: 700;
}
.stack-item-meta {
    margin-top: .2rem;
    color: var(--muted);
    font-size: .82rem;
}
.comments-list .stack-item {
    display: block;
}

.auth-shell {
    display: grid;
    width: min(1180px, 100%);
    overflow: hidden;
    border-radius: 2rem;
    border: 1px solid rgba(148,163,184,.18);
    background: rgba(255,255,255,.88);
    box-shadow: var(--shadow-lg);
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
}
.auth-aside {
    position: relative;
    overflow: hidden;
    padding: 2.25rem;
    background:
        radial-gradient(circle at top left, rgba(96,165,250,.28), transparent 28%),
        radial-gradient(circle at bottom right, rgba(56,189,248,.2), transparent 30%),
        linear-gradient(135deg, #07111f 0%, #0f172a 55%, #1d4ed8 100%);
    color: #fff;
}
.auth-aside::after {
    content: "";
    position: absolute;
    inset: auto -8% -18% auto;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.14), transparent 62%);
}
.auth-panel {
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-panel-inner {
    width: 100%;
    max-width: 29rem;
}
.auth-kpis {
    margin-top: 1.35rem;
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(2, minmax(0,1fr));
}
.auth-kpi {
    padding: .95rem 1rem;
    border-radius: 1.15rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
}
.auth-kpi strong {
    display: block;
    font-size: .92rem;
    font-weight: 800;
}
.auth-kpi span {
    display: block;
    margin-top: .22rem;
    font-size: .82rem;
    color: rgba(255,255,255,.72);
}
.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .85rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.92);
    font-size: .8rem;
    font-weight: 700;
}
.auth-badge .app-brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: .8rem;
    font-size: .9rem;
    box-shadow: 0 10px 22px rgba(37,99,235,.28);
}
.auth-panel-title {
    margin: .75rem 0 0;
    font-size: 2rem;
    line-height: 1.02;
    font-weight: 900;
    letter-spacing: -.04em;
}
.auth-panel-lead,
.auth-aside p {
    color: var(--muted);
    line-height: 1.75;
}
.auth-aside p { color: rgba(255,255,255,.78); }
.auth-form {
    margin-top: 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.auth-panel .btn { width: 100%; }
.auth-link-row {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .8rem;
    font-size: .88rem;
}
.auth-note {
    margin-top: 1rem;
    padding: .95rem 1rem;
    border-radius: 1.15rem;
    background: rgba(248,250,252,.9);
    border: 1px solid var(--panel-border);
    color: var(--muted);
    font-size: .88rem;
}

.pagination-shell,
.app-content .mt-5.flex.flex-col.gap-3.border-t.border-slate-200.pt-4 {
    margin-top: 1rem;
}

@media (max-width: 1400px) {
    .stats-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1199px) {
    .app-topbar {
        grid-template-columns: 1fr;
    }
    .premium-hero,
    .dashboard-grid,
    .dashboard-grid.secondary,
    .auth-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1023px) {
    .mobile-toggle { display: inline-flex; }
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: auto;
        width: min(300px, calc(100vw - 1rem));
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        transform: translateX(-105%);
        transition: transform .24s ease;
        box-shadow: 0 30px 80px rgba(2, 6, 23, 0.4);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-main { width: 100%; padding: 1rem; }
    .app-topbar-actions { justify-content: flex-start; }
}

@media (max-width: 767px) {
    .app-main { padding: .8rem; }
    .app-page-title { font-size: 1.6rem; }
    .app-topbar { padding: .95rem; border-radius: 1.4rem; }
    .app-topbar-actions,
    .premium-hero-actions,
    .module-toolbar > div:last-child,
    .module-actions > div:last-child,
    .auth-link-row {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .app-topbar-actions > *,
    .premium-hero-actions > *,
    .module-toolbar > div:last-child > *,
    .module-actions > div:last-child > * { width: 100%; }
    .btn,
    .user-chip,
    .app-topbar-date { width: 100%; }
    .premium-hero,
    .section-card,
    .stat-card { border-radius: 1.35rem; }
    .stats-strip { grid-template-columns: 1fr; }
    .auth-panel,
    .auth-aside { padding: 1.4rem; }
    .auth-kpis { grid-template-columns: 1fr; }

    .overflow-x-auto { margin: 0 -.2rem; padding: 0 .2rem .35rem; }
    .overflow-x-auto table,
    .overflow-x-auto thead,
    .overflow-x-auto tbody,
    .overflow-x-auto tr,
    .overflow-x-auto th,
    .overflow-x-auto td { display: block; }
    .overflow-x-auto thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        white-space: nowrap;
        border: 0;
    }
    .overflow-x-auto table { min-width: 0 !important; }
    .overflow-x-auto tbody {
        display: flex;
        flex-direction: column;
        gap: .8rem;
    }
    .overflow-x-auto tbody tr {
        border: 1px solid rgba(148,163,184,.18) !important;
        border-radius: 1.15rem;
        background: rgba(255,255,255,.92);
        box-shadow: var(--shadow-xs);
        overflow: hidden;
    }
    .overflow-x-auto tbody td {
        display: flex;
        justify-content: space-between;
        gap: .9rem;
        padding: .8rem 1rem !important;
        border-bottom: 1px solid rgba(226,232,240,.75);
        text-align: right;
    }
    .overflow-x-auto tbody td:last-child { border-bottom: 0; }
    .overflow-x-auto tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: .76rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .08em;
        text-align: left;
    }
    .overflow-x-auto tbody td > * { text-align: right; }
    .table-action-links,
    .inline-action-links { justify-content: flex-end; }
    .table-scroll-hint { display: none !important; }
}


.auto-stats-grid {
    display: grid;
    gap: 1rem;
}
.auto-stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.05rem 1.1rem !important;
}
.auto-stat-card > div:first-child {
    color: var(--muted) !important;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}
.auto-stat-card > div:nth-child(2) {
    font-size: clamp(1.55rem, 2vw, 2.15rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -.04em;
    color: var(--text) !important;
}
.form-actions-row .btn,
.module-actions .btn { min-height: 3rem; }

.personal-os-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.2rem;
}
.personal-os-card {
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.96));
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 1.6rem;
    padding: 1.2rem 1.15rem;
    box-shadow: var(--shadow-xs);
}
.personal-os-head {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.personal-os-card h3 {
    margin: .8rem 0 .5rem;
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--text);
}
.personal-os-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}
.compact-hero {
    margin-bottom: 1rem;
}
.premium-hero-kpis.single-column {
    display: grid;
    grid-template-columns: 1fr;
}
.stack-item-tail {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
}
.routine-days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .65rem;
}
.routine-day-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 3rem;
    border-radius: 1rem;
    border: 1px solid rgba(148,163,184,.22);
    background: rgba(255,255,255,.96);
    padding: .75rem;
    color: var(--text);
    font-weight: 600;
}
.routine-day-pill input {
    accent-color: var(--brand-600);
}
.routine-grid {
    margin-bottom: 1rem;
}

@media (max-width: 1199px) {
    .personal-os-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .routine-days-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stack-item-tail {
        width: 100%;
        align-items: flex-start;
    }
}


.premium-hero-panel-intel {
  gap: 1rem;
}

.premium-score-card {
  display: grid;
  place-items: center;
  gap: .25rem;
  min-width: 140px;
  padding: 1rem;
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(30,41,59,.96));
  color: #fff;
  box-shadow: 0 18px 40px rgba(15,23,42,.16);
}

.premium-score-card.compact {
  min-width: 128px;
  padding: .9rem;
}

.premium-score-value {
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
}

.premium-score-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.72);
}

.premium-score-status {
  font-size: .9rem;
  font-weight: 700;
}

.premium-intel-note {
  margin: 0;
  font-size: .92rem;
  color: #475569;
}

.priority-auto-list,
.domain-progress-list,
.time-block-items {
  display: grid;
  gap: .9rem;
}

.priority-auto-item,
.time-block-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .85rem;
  padding: 1rem;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 1rem;
  background: rgba(248,250,252,.9);
}

.time-block-item {
  text-decoration: none;
  color: inherit;
}

.priority-auto-level {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: .6rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
}

.domain-progress-item {
  display: grid;
  gap: .5rem;
}

.domain-progress-head,
.time-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

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

.time-block-card {
  padding: 1rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(148,163,184,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}

.stack-item-extended {
  align-items: flex-start;
}

@media (max-width: 860px) {
  .priority-auto-item,
  .time-block-item,
  .domain-progress-head,
  .time-block-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .premium-score-card {
    width: 100%;
  }
}


.weekly-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1rem;
}

.weekly-day-card {
  display: grid;
  gap: .8rem;
  padding: 1rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(148,163,184,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: 0 18px 40px rgba(15,23,42,.06);
}

.weekly-day-card-today {
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 24px 45px rgba(37,99,235,.14);
}

.weekly-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}

.weekly-day-score {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(30,41,59,.96));
  color: #fff;
  font-weight: 800;
}

.weekly-day-label {
  font-size: .84rem;
  font-weight: 700;
  color: var(--muted);
}

.weekly-day-stats {
  display: grid;
  gap: .55rem;
}

.weekly-day-stats .ui-inline-label {
  justify-content: flex-start;
}

.weekly-day-alert {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border-radius: 999px;
  background: rgba(254,242,242,.96);
  color: #b91c1c;
  padding: .45rem .75rem;
  font-size: .78rem;
  font-weight: 700;
}

.weekly-domain-item {
  padding: .25rem 0;
}

@media (max-width: 1280px) {
  .weekly-days-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .weekly-days-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .weekly-days-grid {
    grid-template-columns: 1fr;
  }

  .weekly-day-head {
    flex-direction: column;
  }
}

/* Production mobile + charts */
.app-topbar {
  position: sticky;
  top: .8rem;
  z-index: 20;
}
.app-main {
  min-width: 0;
}
.app-content > * {
  min-width: 0;
}
.app-topbar-actions {
  flex-wrap: wrap;
}
.app-topbar-actions .btn,
.module-toolbar .btn,
.module-actions .btn,
.premium-hero-actions .btn {
  min-height: 2.95rem;
}

.dashboard-charts-grid,
.analytics-grid,
.list-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1rem;
}

.app-chart-card {
  overflow: hidden;
}
.app-chart {
  min-height: 260px;
}
.chart-shell {
  display: grid;
  gap: .75rem;
}
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart-grid-line {
  stroke: rgba(148,163,184,.2);
  stroke-width: 1;
}
.chart-axis-label {
  fill: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem 1rem;
}
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
.chart-legend-item i {
  width: .75rem;
  height: .75rem;
  border-radius: 999px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
}
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed rgba(148,163,184,.35);
  border-radius: 1rem;
  color: var(--muted);
  background: rgba(248,250,252,.7);
}

.insight-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.insight-kpi {
  padding: 1rem 1rem 1.05rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(148,163,184,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: var(--shadow-xs);
}
.insight-kpi-label {
  color: var(--muted);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}
.insight-kpi-value {
  margin-top: .35rem;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.04em;
}
.insight-kpi-meta {
  margin-top: .45rem;
  color: var(--muted);
  font-size: .84rem;
}

.list-shell,
.report-shell {
  display: grid;
  gap: 1rem;
}
.filter-panel {
  padding: 1rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(248,250,252,.72);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .8rem;
}
.filter-grid .span-2 { grid-column: span 2; }
.filter-grid .span-3 { grid-column: span 3; }
.filter-grid .actions { display: flex; gap: .7rem; align-items: stretch; }
.filter-grid .actions > * { flex: 1; }

.section-card .overflow-x-auto {
  margin-top: .35rem;
}

@media (max-width: 1280px) {
  .dashboard-charts-grid,
  .analytics-grid,
  .list-insights-grid,
  .insight-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-grid .span-2,
  .filter-grid .span-3 { grid-column: span 2; }
}

@media (max-width: 767px) {
  .app-topbar {
    top: .4rem;
  }
  .dashboard-charts-grid,
  .analytics-grid,
  .list-insights-grid,
  .insight-kpis,
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .filter-grid .span-2,
  .filter-grid .span-3 {
    grid-column: span 1;
  }
  .filter-grid .actions {
    flex-direction: column;
  }
  .chart-axis-label {
    font-size: 10px;
  }
  .app-chart {
    min-height: 220px;
  }
  .section-card,
  .filter-panel,
  .insight-kpi {
    padding: 1rem;
  }
}


.action-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.45rem;
    height: 2.45rem;
    padding: 0 !important;
    border-radius: .95rem;
    border: 1px solid rgba(148, 163, 184, .22) !important;
    background: rgba(248,250,252,.96) !important;
    color: #334155 !important;
    text-decoration: none;
    box-shadow: none !important;
    transition: transform .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease;
}
.action-icon-btn:hover {
    transform: translateY(-1px);
    background: #fff !important;
}
.action-icon-btn .ui-icon {
    width: 1rem !important;
    height: 1rem !important;
}
.action-icon-view { color: #2563eb !important; }
.action-icon-edit { color: #d97706 !important; }
.action-icon-complete { color: #16a34a !important; }
.action-icon-postpone { color: #7c3aed !important; }
.action-icon-delete { color: #dc2626 !important; }
.action-icon-ghost { color: #475569 !important; }
.treasury-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.treasury-period-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 1.25rem;
    padding: 1.15rem;
    box-shadow: var(--card-shadow);
}
.treasury-period-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}
.treasury-period-label {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.treasury-period-values {
    display: grid;
    gap: .7rem;
}
.treasury-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .72rem .8rem;
    border-radius: 1rem;
    background: rgba(255,255,255,.76);
    border: 1px solid rgba(226,232,240,.8);
}
.treasury-metric-label { color: var(--muted); font-size: .83rem; font-weight: 700; }
.treasury-metric-value { font-size: 1rem; font-weight: 800; color: var(--text); }
.treasury-metric-value.positive { color: #15803d; }
.treasury-metric-value.negative { color: #b91c1c; }
.treasury-actions { display:flex; flex-wrap:wrap; gap:.75rem; }
.movement-badge { display:inline-flex; align-items:center; gap:.4rem; padding:.22rem .55rem; border-radius:999px; font-size:.72rem; font-weight:800; }
.movement-income { background:#dcfce7; color:#166534; }
.movement-expense { background:#fee2e2; color:#991b1b; }
@media (max-width: 1024px) {
    .treasury-grid { grid-template-columns: 1fr; }
}


/* V6.21.8 — Menu mobile uniquement : afficher / cacher la sidebar sans modifier le desktop */
.mobile-toggle {
    display: none !important;
    flex: 0 0 auto;
    position: relative;
}
.mobile-toggle.is-active {
    background: rgba(37, 99, 235, 0.10);
    border-color: rgba(37, 99, 235, 0.30);
}
.mobile-toggle:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

@media (min-width: 1024px) {
    .mobile-toggle {
        display: none !important;
    }
    .app-sidebar {
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        margin-left: 0 !important;
    }
    .app-overlay {
        display: none !important;
    }
    body.sidebar-open {
        overflow: auto !important;
        touch-action: auto !important;
    }
}

@media (max-width: 1023px) {
    .mobile-toggle {
        display: inline-flex !important;
        z-index: 45;
    }
    .app-topbar {
        position: sticky;
        top: .65rem;
        z-index: 30;
    }
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: auto;
        width: min(300px, calc(100vw - .75rem));
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        transform: translateX(-106%) !important;
        transition: transform .24s ease;
        box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
        z-index: 40;
    }
    .app-sidebar.is-open {
        transform: translateX(0) !important;
    }
    .app-overlay.is-visible {
        opacity: 1;
        pointer-events: auto;
    }
    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }
}

@media (max-width: 420px) {
    .mobile-toggle {
        width: 2.65rem;
        height: 2.65rem;
        border-radius: .85rem;
    }
    .app-topbar-hero {
        gap: .65rem;
    }
}

/* V6.21.9 — Bandeau supérieur mobile affichable / cachable.
   Objectif : garder un petit en-tête fixe et masquer le grand bandeau sur téléphone. */
.app-topbar-compact {
    display: none;
}
.app-topbar-body {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}
.topbar-toggle {
    width: 2.65rem;
    height: 2.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .95rem;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,.82);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
    flex: 0 0 auto;
}
.topbar-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.15;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s ease;
}
.topbar-toggle:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

@media (max-width: 1199px) {
    .app-topbar-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1023px) {
    .app-topbar {
        display: block !important;
        padding: .75rem !important;
        border-radius: 1.25rem !important;
        top: .5rem !important;
    }
    .app-topbar-compact {
        display: flex;
        align-items: center;
        gap: .65rem;
        min-width: 0;
    }
    .app-topbar-compact-title {
        min-width: 0;
        flex: 1 1 auto;
        line-height: 1.15;
    }
    .app-topbar-compact-title strong,
    .app-topbar-compact-title span {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .app-topbar-compact-title strong {
        font-size: .98rem;
        font-weight: 900;
        color: var(--text);
    }
    .app-topbar-compact-title span {
        margin-top: .18rem;
        font-size: .72rem;
        font-weight: 700;
        color: var(--muted);
    }
    .app-topbar-body {
        display: grid;
        grid-template-columns: 1fr;
        gap: .85rem;
        margin-top: .85rem;
        padding-top: .85rem;
        border-top: 1px solid var(--panel-border);
    }
    .app-topbar.is-collapsed .app-topbar-body {
        display: none !important;
    }
    .app-topbar.is-collapsed .topbar-toggle svg {
        transform: rotate(-90deg);
    }
    .app-topbar.is-collapsed {
        margin-bottom: .7rem;
    }
    .app-page-title {
        font-size: 1.32rem !important;
    }
    .app-page-subtitle {
        display: none;
    }
    .app-breadcrumb {
        margin-bottom: .35rem;
        max-width: 100%;
    }
    .app-topbar-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: .55rem;
        align-items: stretch;
        width: 100%;
    }
    .app-topbar-actions > *,
    .app-topbar-actions .btn,
    .app-topbar-date,
    .user-chip {
        width: 100% !important;
        min-width: 0;
    }
    .app-topbar-date,
    .user-chip,
    .app-topbar-actions .btn {
        min-height: 2.75rem;
        padding: .48rem .62rem;
        border-radius: .9rem;
        font-size: .8rem;
    }
    .user-chip-name,
    .user-chip-role {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 420px) {
    .app-topbar {
        padding: .62rem !important;
    }
    .app-topbar-compact {
        gap: .48rem;
    }
    .app-topbar-actions {
        grid-template-columns: 1fr;
    }
    .topbar-toggle {
        width: 2.55rem;
        height: 2.55rem;
    }
}

/* V6.22 — Cacher / afficher le grand bandeau sur ordinateur ET mobile.
   Le petit bandeau de contrôle reste visible pour pouvoir rouvrir le bloc. */
.app-topbar-compact {
    display: flex !important;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}
.app-topbar-compact-title {
    min-width: 0;
    flex: 1 1 auto;
    line-height: 1.15;
}
.app-topbar-compact-title strong,
.app-topbar-compact-title span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-topbar-compact-title strong {
    font-size: .98rem;
    font-weight: 900;
    color: var(--text);
}
.app-topbar-compact-title span {
    margin-top: .18rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
}
.app-topbar.is-collapsed .app-topbar-body {
    display: none !important;
}
.app-topbar.is-collapsed .topbar-toggle svg {
    transform: rotate(-90deg);
}
.app-topbar.is-collapsed {
    padding: .72rem .85rem !important;
    margin-bottom: .85rem;
}

@media (min-width: 1024px) {
    /* Sur ordinateur, le bouton existe aussi, mais sans changer la sidebar. */
    .app-topbar {
        position: relative;
    }
    .app-topbar-compact {
        justify-content: flex-end;
        margin-bottom: .75rem;
    }
    .app-topbar-compact .mobile-toggle {
        display: none !important;
    }
    .app-topbar:not(.is-collapsed) .app-topbar-compact-title {
        display: none !important;
    }
    .app-topbar.is-collapsed .app-topbar-compact {
        justify-content: space-between;
        margin-bottom: 0;
    }
    .app-topbar.is-collapsed .app-topbar-compact-title {
        display: block !important;
    }
}

@media (max-width: 1023px) {
    .app-topbar-compact {
        margin-bottom: 0;
    }
    .app-topbar:not(.is-collapsed) .app-topbar-body {
        margin-top: .85rem;
        padding-top: .85rem;
        border-top: 1px solid var(--panel-border);
    }
}

/* V6.25.1 — Bandeau supérieur ergonomique web + mobile.
   Correction du grand espace vide et des actions mal positionnées. */
.app-topbar.app-topbar-clean {
    display: block !important;
    position: sticky;
    top: .85rem;
    z-index: 30;
    width: 100%;
    min-width: 0;
    margin: 0 0 1rem !important;
    padding: .9rem 1rem !important;
    border-radius: 1.35rem !important;
    border: 1px solid rgba(148, 163, 184, 0.18) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08) !important;
    backdrop-filter: blur(18px);
}

.app-topbar-clean .app-topbar-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
    min-width: 0;
}

.app-topbar-clean .app-topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: .8rem !important;
    min-width: 0;
    flex: 1 1 auto;
}

.app-topbar-clean .app-topbar-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: .65rem !important;
    flex: 0 0 auto;
}

.app-mini-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: .45rem !important;
    min-height: 2rem;
    padding: .35rem .7rem !important;
    border-radius: 999px !important;
    color: #1d4ed8 !important;
    background: rgba(37, 99, 235, .10) !important;
    border: 1px solid rgba(37, 99, 235, .10) !important;
    font-size: .76rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    flex: 0 0 auto;
}

.app-mini-brand .ui-inline-label,
.app-mini-brand .ui-inline-label span {
    font-size: .76rem !important;
    font-weight: 900 !important;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
}

.app-mini-brand .ui-icon {
    width: .9rem !important;
    height: .9rem !important;
}

.app-title-block {
    min-width: 0;
    flex: 1 1 auto;
}

.app-topbar-clean .app-page-title {
    margin: 0 !important;
    font-size: clamp(1.45rem, 2.2vw, 2.15rem) !important;
    line-height: 1.05 !important;
    font-weight: 900 !important;
    letter-spacing: -.035em !important;
    color: var(--text) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-clean .app-page-subtitle {
    margin: .28rem 0 0 !important;
    max-width: 52rem !important;
    color: var(--muted) !important;
    font-size: .88rem !important;
    line-height: 1.45 !important;
}

.app-topbar-clean .app-topbar-body {
    display: block !important;
    margin-top: .82rem !important;
    padding-top: .82rem !important;
    border-top: 1px solid rgba(148, 163, 184, .18) !important;
}

.app-topbar-clean.is-collapsed .app-topbar-body {
    display: none !important;
}

.app-topbar-clean.is-collapsed {
    padding-top: .72rem !important;
    padding-bottom: .72rem !important;
}

.app-topbar-clean.is-collapsed .topbar-toggle svg {
    transform: rotate(-90deg) !important;
}

.app-quick-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: wrap !important;
    gap: .65rem !important;
    min-width: 0;
}

.app-topbar-clean .app-topbar-date,
.app-topbar-clean .user-chip,
.app-topbar-clean .btn {
    width: auto !important;
    min-height: 2.65rem !important;
    border-radius: .95rem !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055) !important;
}

.app-topbar-clean .btn {
    padding: 0 .95rem !important;
    font-size: .86rem !important;
}

.app-topbar-clean .user-chip {
    max-width: 260px;
    padding: .42rem .72rem !important;
}

.app-topbar-clean .user-chip-text {
    min-width: 0;
}

.app-topbar-clean .user-chip-name,
.app-topbar-clean .user-chip-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-only { display: none !important; }
.desktop-only { display: inline-flex !important; }

.topbar-toggle {
    width: 2.55rem !important;
    height: 2.55rem !important;
    min-width: 2.55rem !important;
    border-radius: .95rem !important;
    flex: 0 0 auto !important;
}

@media (min-width: 1024px) {
    .app-topbar-clean .mobile-toggle {
        display: none !important;
    }
    .app-topbar-clean .app-topbar-body {
        margin-left: 0 !important;
    }
}

@media (max-width: 1023px) {
    .app-main {
        padding: .75rem !important;
    }

    .app-topbar.app-topbar-clean {
        top: .55rem !important;
        padding: .68rem !important;
        border-radius: 1.1rem !important;
        margin-bottom: .75rem !important;
    }

    .app-topbar-clean .app-topbar-head {
        gap: .55rem !important;
    }

    .app-topbar-clean .app-topbar-left {
        gap: .55rem !important;
    }

    .app-topbar-clean .mobile-toggle {
        display: inline-flex !important;
        width: 2.55rem !important;
        height: 2.55rem !important;
        min-width: 2.55rem !important;
        border-radius: .9rem !important;
        background: rgba(255,255,255,.92) !important;
    }

    .app-mini-brand {
        min-height: 1.85rem !important;
        padding: .32rem .58rem !important;
        font-size: .72rem !important;
    }

    .app-topbar-clean .app-page-title {
        font-size: 1.22rem !important;
        max-width: 100% !important;
    }

    .app-topbar-clean .app-page-subtitle {
        display: none !important;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: inline-flex !important; }

    .app-topbar-clean .app-topbar-body {
        margin-top: .65rem !important;
        padding-top: .65rem !important;
    }

    .app-quick-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: .5rem !important;
        align-items: stretch !important;
    }

    .app-topbar-clean .app-topbar-date,
    .app-topbar-clean .btn,
    .app-topbar-clean .user-chip {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 2.45rem !important;
        padding: .42rem .55rem !important;
        font-size: .78rem !important;
    }

    .app-topbar-clean .user-chip-avatar {
        width: 2rem !important;
        height: 2rem !important;
        border-radius: .78rem !important;
        flex: 0 0 auto;
    }

    .app-topbar-clean .btn .ui-inline-label,
    .app-topbar-clean .app-topbar-date .ui-inline-label {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .app-topbar-clean .app-topbar-left {
        gap: .42rem !important;
    }

    .app-mini-brand .ui-inline-label span {
        display: none !important;
    }

    .app-mini-brand {
        width: 2.2rem !important;
        height: 2.2rem !important;
        min-height: 2.2rem !important;
        padding: 0 !important;
        justify-content: center !important;
    }

    .app-topbar-clean .app-page-title {
        font-size: 1.08rem !important;
    }

    .topbar-toggle,
    .app-topbar-clean .mobile-toggle {
        width: 2.38rem !important;
        height: 2.38rem !important;
        min-width: 2.38rem !important;
    }

    .app-quick-actions {
        grid-template-columns: 1fr !important;
    }
}
