:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;

    --text: #0f172a;
    --text-soft: #64748b;

    --border: #e2e8f0;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar: #eaf2ff;
    --sidebar-text: #0f172a;

    --success: #16a34a;
    --danger: #dc2626;

    --radius: 18px;
    --radius-sm: 12px;

    --sidebar-width: 270px;
    --header-height: 78px;

    --mbi-bg: #f5f7fb;
    --mbi-card: #ffffff;
    --mbi-text: #17324d;
    --mbi-muted: #6b7280;
    --mbi-line: #dbe3ee;
    --mbi-primary: #0b6ef3;
    --mbi-primary-dark: #0956c7;
    --mbi-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --mbi-radius: 16px;
    --mbi-max: 1280px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================
   SITE PUBLIC
========================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--mbi-line);
}

.site-header-inner {
    max-width: var(--mbi-max);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.site-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b6ef3, #17324d);
    color: #fff;
    font-size: 20px;
    box-shadow: var(--mbi-shadow);
    flex-shrink: 0;
}

.site-brand-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
}

.site-brand-subtitle {
    font-size: 12px;
    color: var(--mbi-muted);
    margin-top: 2px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.site-nav a {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mbi-text);
    transition: 0.2s ease;
}

.site-nav a:hover {
    background: #eef4ff;
    color: var(--mbi-primary);
}

.site-nav .btn-primary {
    background: var(--mbi-primary);
    color: #fff;
}

.site-nav .btn-primary:hover {
    background: var(--mbi-primary-dark);
    color: #fff;
}

.site-nav .btn-outline {
    border: 1px solid var(--mbi-line);
    background: #fff;
}

.site-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--mbi-line);
    border-radius: 999px;
}

.site-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e8f0fd;
    color: var(--mbi-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.site-user-name {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
}

.site-user-role {
    color: var(--mbi-muted);
    font-size: 12px;
}

.page-shell {
    max-width: var(--mbi-max);
    margin: 0 auto;
    padding: 24px 20px;
}

.site-footer {
    margin-top: 40px;
    background: #17324d;
    color: #fff;
}

.site-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.site-footer-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.site-footer-title {
    font-size: 16px;
    font-weight: 700;
}

.site-footer-text {
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
}

.site-footer-nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.site-footer-nav a {
    color: #fff;
    opacity: 0.9;
    font-size: 14px;
}

.site-footer-nav a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* =========================
   LAYOUT APPLICATION
========================= */

.app-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.sidebar-inner {
    padding: 20px 16px;
}

.sidebar-top {
    margin-bottom: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.6);
}

.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: var(--shadow);
    font-size: 22px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-text strong {
    font-size: 18px;
}

.brand-text span {
    font-size: 12px;
    color: var(--text-soft);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: block;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--sidebar-text);
    transition: 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(2px);
}

.sidebar-bottom {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.logout {
    color: var(--danger);
}

.main-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* =========================
   TOPBAR INTERNE
========================= */

.topbar {
    min-height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.topbar-left h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.1;
}

.topbar-left p {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 999px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-meta strong {
    font-size: 14px;
}

.user-meta span {
    font-size: 12px;
    color: var(--text-soft);
}

/* =========================
   CONTENU
========================= */

.content-wrapper {
    padding: 24px;
}

/* =========================
   ACTIONBAR
========================= */

.actionbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    margin-bottom: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 20;
}

.actionbar-left,
.actionbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn:hover {
    background: #eef2f7;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

/* =========================
   DROPDOWN
========================= */

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 8px;
    z-index: 9999;
}

.dropdown-menu-right {
    left: auto;
    right: 0;
}

.dropdown-menu a {
    display: block;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--text);
}

.dropdown-menu a:hover {
    background: var(--surface-soft);
}

.dropdown.open .dropdown-menu {
    display: block;
}

/* =========================
   CARDS
========================= */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .site-header-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 980px) {
    .sidebar {
        width: 88px;
    }

    .sidebar-inner {
        padding: 14px 10px;
    }

    .brand {
        justify-content: center;
        padding: 10px;
    }

    .brand-text {
        display: none;
    }

    .nav-item {
        font-size: 0;
        text-align: center;
        padding: 12px 10px;
    }

    .sidebar-bottom .nav-item {
        font-size: 0;
    }
}

@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .sidebar-inner {
        padding: 14px;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-item {
        font-size: 14px;
        text-align: left;
    }

    .sidebar-bottom {
        padding: 14px;
    }

    .topbar {
        height: auto;
        padding: 16px;
        align-items: flex-start;
        flex-direction: column;
    }

    .content-wrapper {
        padding: 16px;
    }

    .actionbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .actionbar-left,
    .actionbar-right {
        width: 100%;
    }

    .site-user {
        width: 100%;
        justify-content: flex-start;
    }
}