/* ── Base ────────────────────────────────────────────────── */
html, body {
    font-family: 'DM Sans', 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background: #0d0f14;
}

/* ── Sidebar / Drawer ───────────────────────────────────── */
.mud-drawer-content {
    background: linear-gradient(180deg, #111318 0%, #161922 100%);
    border-right: 1px solid #1e2132;
}

.mud-drawer-header {
    border-bottom: 1px solid #1e2132;
}

/* ── Nav links ──────────────────────────────────────────── */

/* Niveau 1 : liens directs (hors groupe) */
.mud-nav-link {
    color: #c8cad4 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    margin: 2px 8px !important;
    transition: all 0.2s ease !important;
    background-color: transparent !important;
}

.mud-nav-link:hover {
    color: #f0f2f7 !important;
    background-color: rgba(232, 138, 60, 0.12) !important;
}

.mud-nav-link.active {
    color: #f0f2f7 !important;
    background-color: rgba(232, 138, 60, 0.20) !important;
    font-weight: 600 !important;
}

/* Niveau 1 : en-tête des groupes */
.mud-navgroup-header {
    color: #c8cad4 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    margin: 2px 8px !important;
    transition: all 0.2s ease !important;
    background-color: transparent !important;
}

.mud-navgroup-header:hover {
    background-color: rgba(232, 138, 60, 0.08) !important;
}

/* Conteneur interne du groupe : pas de fond parasite */
.mud-navgroup-content,
.mud-collapse-container,
.mud-navgroup .mud-collapse-container-inner {
    background-color: transparent !important;
}

/* Niveau 2 : liens à l'intérieur d'un groupe */
.mud-navgroup .mud-nav-link {
    padding-left: 3rem !important;
    font-size: 0.8rem !important;
    font-weight: 400 !important;
    color: #8b8fa8 !important;
    border-radius: 6px !important;
    margin: 1px 8px 1px 20px !important;
    background-color: transparent !important;
    border-left: 2px solid transparent;
}

.mud-navgroup .mud-nav-link:hover {
    color: #f0f2f7 !important;
    background-color: rgba(232, 138, 60, 0.07) !important;
    border-left-color: rgba(232, 138, 60, 0.4);
}

.mud-navgroup .mud-nav-link.active {
    color: #e88a3c !important;
    background-color: rgba(232, 138, 60, 0.12) !important;
    font-weight: 500 !important;
    border-left-color: #e88a3c;
}

/* ── Nav section label ──────────────────────────────────── */
.nav-section-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: rgba(232, 138, 60, 0.6);
    padding: 1.2rem 1.5rem 0.4rem;
    text-transform: uppercase;
    border-top: 1px solid #1e2132;
}

.nav-section-label:first-child {
    border-top: none;
}

/* ── AppBar ─────────────────────────────────────────────── */
.mud-appbar {
    background: #111318 !important;
    border-bottom: 1px solid #1e2132 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

/* ── Cards & Paper ──────────────────────────────────────── */
.mud-paper {
    background-color: #161922 !important;
    border: 1px solid #252836;
}

.mud-paper.mud-elevation-0 {
    border: none;
}

/* ── DataGrid ───────────────────────────────────────────── */
.mud-table {
    background-color: #161922 !important;
}

.mud-table .mud-table-head .mud-table-cell {
    background-color: #0d0f14 !important;
    color: #4a4d5e !important;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #252836 !important;
}

.mud-table .mud-table-body .mud-table-row {
    transition: background-color 0.15s ease;
}

.mud-table .mud-table-body .mud-table-row:hover {
    background-color: rgba(232, 138, 60, 0.05) !important;
}

.mud-table .mud-table-cell {
    border-bottom: 1px solid #1e2132 !important;
}

/* ── Page header ────────────────────────────────────────── */
.page-header {
    background: linear-gradient(135deg, rgba(232, 138, 60, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    border: 1px solid rgba(232, 138, 60, 0.15);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.page-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(232, 138, 60, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Stat cards ─────────────────────────────────────────── */
.stat-card {
    border-radius: 12px !important;
    padding: 2rem !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    min-height: 180px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.success { background: rgba(34, 197, 94, 0.15); }
.stat-icon.error   { background: rgba(239, 68, 68, 0.15); }
.stat-icon.warning { background: rgba(234, 179, 8, 0.15); }
.stat-icon.info    { background: rgba(59, 130, 246, 0.15); }
.stat-icon.default { background: rgba(148, 163, 184, 0.15); }

/* ── Chips ──────────────────────────────────────────────── */
.mud-chip {
    font-weight: 500 !important;
}

/* ── Alert ──────────────────────────────────────────────── */
.mud-alert {
    border-radius: 10px !important;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.35);
}

/* ── Low stock row ──────────────────────────────────────── */
.low-stock-row {
    background-color: rgba(239, 68, 68, 0.06);
}

/* ── Shortcut cards ─────────────────────────────────────── */
.shortcut-card {
    border-radius: 12px !important;
    padding: 1rem 1.25rem !important;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    border: 1px solid rgba(148, 163, 184, 0.08) !important;
    height: 100%;
    display: flex;
    align-items: center;
}

.shortcut-card:hover {
    border-color: rgba(232, 138, 60, 0.4) !important;
    background-color: rgba(232, 138, 60, 0.06) !important;
}

.shortcut-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(232, 138, 60, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 599px) {
    /* Reduce container padding on small screens */
    .mud-main-content .mud-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-top: 12px !important;
    }

    /* Page header: compact on mobile */
    .page-header {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }

    /* Action bars with multiple buttons: wrap and stack */
    .mud-stack.flex-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Better separation between elements in mobile grid/table */
    .mud-table-body .mud-table-row {
        display: block !important;
        border: 1px solid rgba(232, 138, 60, 0.3) !important;
        border-top: 4px solid #e88a3c !important;
        border-left: none !important;
        margin-top: 16px !important;
        margin-bottom: 24px !important;
        border-radius: 8px !important;
        background: rgba(30, 33, 58, 0.8) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        position: relative !important;
        overflow: hidden !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    }

    .mud-table-body .mud-table-row:active {
        transform: scale(0.98);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
    }

    /* Make mobile cell labels slightly brighter */
    .mud-table-body .mud-table-cell::before {
        font-weight: 600 !important;
        color: #e88a3c !important;
    }

    /* Increase button size in mobile tables for better tap targets */
    .mud-table-body .mud-table-cell .mud-icon-button {
        padding: 12px !important;
        background-color: rgba(232, 138, 60, 0.1) !important;
        margin: 4px !important;
    }
    
    .mud-table-body .mud-table-cell .mud-icon-root {
        font-size: 1.5rem !important;
    }

    /* Enable horizontal scroll within table root only on mobile */
    .mud-table-root {
        overflow-x: auto;
    }
}

/* ── Tables: avoid horizontal scrollbar on desktop ──────── */
@media (min-width: 600px) {
    .mud-table-root {
        overflow-x: visible;
        overflow-y: hidden;
    }
}

/* Price change indicators */
.price-increase {
    background-color: rgba(251, 146, 60, 0.15) !important;
    border-left: 3px solid #fb923c;
}

.price-decrease {
    background-color: rgba(74, 222, 128, 0.15) !important;
    border-left: 3px solid #4ade80;
}

.price-new {
    background-color: rgba(96, 165, 250, 0.15) !important;
    border-left: 3px solid #60a5fa;
}

.price-old-invoice {
    background-color: rgba(148, 163, 184, 0.1) !important;
    border-left: 3px solid #94a3b8;
}

.price-change-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.price-change-badge.increase {
    background-color: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.price-change-badge.decrease {
    background-color: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.price-change-badge.new-price {
    background-color: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.price-change-badge.old-invoice {
    background-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

/* ── Role avatars (Attendance) ──────────────────────────── */
.role-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.role-avatar.cuisine  { background: rgba(232,138,60,0.18);  color: #e88a3c; }
.role-avatar.caisse       { background: rgba(34,198,122,0.18);  color: #22c67a; }
.role-avatar.livreur      { background: rgba(29,78,216,0.18);   color: #1d4ed8; }
.role-avatar.nettoyage    { background: rgba(6,182,212,0.18);   color: #06b6d4; }
.role-avatar.gestionnaire { background: rgba(236,72,153,0.18);  color: #ec4899; }
.role-avatar.default      { background: rgba(139,143,168,0.18); color: #8b8fa8; }

/* ── Role badge (inline pill pour multi-rôles) ──────────── */
.role-badge { display:inline-flex; align-items:center; padding:1px 6px; border-radius:4px; font-size:0.65rem; font-weight:600; line-height:1.4; }
.role-badge.cuisine  { background: rgba(232,138,60,0.15);  color: #e88a3c; }
.role-badge.caisse       { background: rgba(34,198,122,0.15);  color: #22c67a; }
.role-badge.livreur      { background: rgba(29,78,216,0.15);   color: #1d4ed8; }
.role-badge.nettoyage    { background: rgba(6,182,212,0.15);   color: #06b6d4; }
.role-badge.gestionnaire { background: rgba(236,72,153,0.15);  color: #ec4899; }
.role-badge.default      { background: rgba(139,143,168,0.15); color: #8b8fa8; }

/* ── KPI card compact (Dashboard Attendance) ────────────── */
.kpi-card-compact {
    background: #161922;
    border: 1px solid #252836;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

/* ── Status block (Dashboard Attendance) ────────────────── */
.status-block {
    background: #161922;
    border: 1px solid #252836;
    border-radius: 12px;
    padding: 12px;
    overflow: hidden;
}

/* ── Timeline shifts (Dashboard Attendance) ─────────────── */
.timeline-block {
    background: #161922;
    border: 1px solid #252836;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
    position: relative;
}

.timeline-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
}

.timeline-header {
    margin-bottom: 6px;
    height: 18px;
}

.timeline-label-col {
    color: #8b8fa8;
    font-size: 0.78rem;
    font-weight: 500;
    padding-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-track {
    position: relative;
    height: 22px;
}

.timeline-header .timeline-track {
    height: 14px;
}

.timeline-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    color: #6b6f85;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.timeline-rows {
    position: relative;
    margin-top: 4px;
}

.timeline-row {
    height: 28px;
    margin-bottom: 4px;
}

.timeline-row .timeline-track {
    background: rgba(37,40,54,0.4);
    border-radius: 6px;
    height: 24px;
}

.timeline-bar {
    position: absolute;
    top: 0;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-now-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: stretch;
    pointer-events: none;
    z-index: 5;
}

.timeline-now-track {
    position: relative;
}

.timeline-now {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e88a3c;
    box-shadow: 0 0 6px rgba(232,138,60,0.6);
    transform: translateX(-1px);
}

/* ── Alert row (Dashboard Attendance) ───────────────────── */
.alert-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #d8dae6;
}
