﻿/* =====================================================
   FlexiERP UI Global Style
   Dùng chung cho Login, MainLayout, NavMenu, List Pages
   ===================================================== */

:root {
    --erp-primary: #2563eb;
    --erp-primary-dark: #1e40af;
    --erp-secondary: #4f46e5;
    --erp-info: #0ea5e9;
    --erp-success: #16a34a;
    --erp-warning: #f59e0b;
    --erp-error: #dc2626;
    --erp-bg: #f8fafc;
    --erp-bg-soft: #eef2ff;
    --erp-surface: rgba(255, 255, 255, .88);
    --erp-surface-solid: #ffffff;
    --erp-border: rgba(226, 232, 240, .95);
    --erp-text: #0f172a;
    --erp-muted: #64748b;
    --erp-muted-light: #94a3b8;
    --erp-shadow: 0 1px 3px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.04);
    --erp-shadow-md: 0 2px 8px rgba(15,23,42,.07), 0 8px 24px rgba(15,23,42,.05);
    --erp-shadow-strong: 0 4px 16px rgba(15,23,42,.09), 0 16px 48px rgba(15,23,42,.07);
    --erp-shadow-blue: 0 4px 24px rgba(37,99,235,.18);
    --erp-radius-lg: 28px;
    --erp-radius-md: 22px;
    --erp-radius-sm: 16px;
    --erp-radius-xs: 12px;
    --erp-topbar-height: 68px;
}

/* =====================================================
   Global Background / Page
   ===================================================== */

.erp-page {
    padding: 0;
}

.erp-page-bg,
.app-layout {
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 28%), radial-gradient(circle at bottom right, rgba(79, 70, 229, .10), transparent 30%), linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

/* =====================================================
   MainLayout - Topbar
   ===================================================== */

.app-topbar {
    height: var(--erp-topbar-height);
    padding: 0 22px;
    background: rgba(255, 255, 255, .95) !important;
    color: var(--erp-text) !important;
    border-bottom: 1px solid var(--erp-border);
    backdrop-filter: blur(12px);
    box-shadow: none;
}

.topbar-menu-button {
    border-radius: 14px;
    margin-right: 10px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-icon {
    /*width: 60px;*/
    height: 60px;
    /*border-radius: 10px;*/
    display: flex;
    align-items: center;
    justify-content: center;
    /*color: white;
    background: linear-gradient(135deg, var(--erp-primary), var(--erp-secondary));
    box-shadow: 0 2px 8px rgba(37, 99, 235, .28);*/
    overflow: hidden;
    flex-shrink: 0;
}

/* Khi có logo: bỏ gradient, nền trong suốt để giữ alpha của ảnh PNG */
.brand-icon--logo {
    background: transparent;
    /*box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
    border: 1px solid var(--erp-border);*/
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-text {
    line-height: 1.1;
    min-width: 0;
}

.brand-name {
    font-weight: 800;
    letter-spacing: -.035em;
    color: var(--erp-text);
    line-height: 1.1;
}

.brand-subtitle {
    color: var(--erp-muted);
    font-weight: 600;
}

/* =====================================================
   MainLayout - User Menu
   ===================================================== */

.user-menu-activator {
    border: 1px solid var(--erp-border);
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--erp-surface-solid);
    color: var(--erp-text);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    box-shadow: none;
}

    .user-menu-activator:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
    }

.user-avatar {
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .20);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
    max-width: 190px;
    min-width: 0;
}

.user-name {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .875rem;
    font-weight: 700;
}

.user-role {
    font-size: .72rem;
    color: var(--erp-muted);
    margin-top: 2px;
}

.user-arrow {
    color: var(--erp-muted);
}

.logout-form {
    width: 100%;
    margin: 0;
}

.logout-button {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

/* =====================================================
   MainLayout - Drawer
   ===================================================== */

.app-drawer {
    background: transparent !important;
    border-right: 0 !important;
}

.drawer-shell {
    height: 100%;
    margin: 10px 8px 10px 10px;
    padding: 8px 10px;
    border-radius: 20px;
    background: var(--erp-surface-solid);
    border: 1px solid var(--erp-border);
    box-shadow: 0 2px 12px rgba(15,23,42,.06);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.drawer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(226, 232, 240, .75);
}

.drawer-logo {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: linear-gradient(135deg, var(--erp-primary), var(--erp-secondary));
    box-shadow: 0 12px 30px rgba(37, 99, 235, .24);
}

.drawer-title {
    font-weight: 800;
    letter-spacing: -.035em;
    color: var(--erp-text);
    line-height: 1.1;
}

.drawer-subtitle {
    color: var(--erp-muted);
    font-weight: 600;
}

.app-main {
    min-height: 100vh;
    padding-top: var(--erp-topbar-height);
}

.app-content {
    padding: 20px;
}

/* =====================================================
   NavMenu
   ===================================================== */

.modern-nav {
    padding: 8px 4px 18px;
}

.nav-section-title {
    margin: 18px 10px 8px;
    font-size: .72rem;
    font-weight: 800;
    color: var(--erp-muted-light);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.modern-nav .mud-nav-link {
    margin: 4px 4px;
    min-height: 44px;
    border-radius: 16px;
    color: #334155;
    font-weight: 600;
    transition: .18s ease;
}

    .modern-nav .mud-nav-link:hover {
        background: rgba(37, 99, 235, .08);
        color: #1d4ed8;
        transform: translateX(2px);
    }

    .modern-nav .mud-nav-link.active,
    .modern-nav .mud-nav-link.mud-nav-link-active {
        background: linear-gradient(135deg, rgba(37, 99, 235, .14), rgba(79, 70, 229, .12));
        color: #1d4ed8;
        font-weight: 800;
        box-shadow: inset 3px 0 0 var(--erp-primary);
    }

    .modern-nav .mud-nav-link .mud-icon-root {
        color: inherit;
    }

.modern-nav-group {
    margin: 4px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(248, 250, 252, .75);
    border: 1px solid rgba(226, 232, 240, .75);
}

    .modern-nav-group .mud-nav-group-button {
        min-height: 46px;
        border-radius: 16px;
        color: #334155;
        font-weight: 800;
    }

        .modern-nav-group .mud-nav-group-button:hover {
            background: rgba(37, 99, 235, .08);
            color: #1d4ed8;
        }

.modern-nav .child-link {
    margin-left: 10px;
    min-height: 40px;
    font-size: .92rem;
    border-radius: 14px;
}

/* =====================================================
   ERP Page Header / Hero
   Dùng cho ErpPageHeader.razor
   ===================================================== */

.erp-hero {
    margin-bottom: 20px;
    padding: 22px 26px;
    border-radius: var(--erp-radius-sm);
    color: white;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
    box-shadow: var(--erp-shadow-blue);
}

.erp-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.erp-title-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.erp-title-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .24);
    backdrop-filter: blur(14px);
}

.erp-title {
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: 1.1;
}

.erp-subtitle {
    margin-top: 6px;
    color: rgba(255, 255, 255, .82);
    line-height: 1.5;
}

.erp-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =====================================================
   Cards / Toolbar
   ===================================================== */

.erp-card {
    padding: 18px;
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow);
    backdrop-filter: blur(18px);
    overflow: hidden;
}

.erp-card-sm {
    padding: 16px;
    border-radius: var(--erp-radius-md);
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow-md);
}

.erp-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 6px 6px 18px;
}

.erp-section-title {
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--erp-text);
}

.erp-search {
    max-width: 360px;
    max-width: 100%;
}

    .erp-search .mud-input-root {
        border-radius: 16px;
        background: #ffffff;
    }

/* =====================================================
   Filter Bar
   ===================================================== */

.erp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--erp-border, rgba(226,232,240,.9));
    margin-bottom: 4px;
}

/* =====================================================
   DataGrid / Table
   ===================================================== */

.erp-grid {
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, .9);
    background: #ffffff;
}

    .erp-grid .mud-table-head {
        background: #f8fafc;
    }

        .erp-grid .mud-table-head .mud-table-cell {
            color: #64748b;
            font-size: .78rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: .045em;
            border-bottom: 1px solid rgba(226, 232, 240, .95);
        }

    .erp-grid .mud-table-row {
        transition: .16s ease;
    }

        .erp-grid .mud-table-row:hover {
            background: rgba(37, 99, 235, .035) !important;
        }

    .erp-grid .mud-table-cell {
        border-bottom: 1px solid rgba(226, 232, 240, .75);
        padding-top: 14px;
        padding-bottom: 14px;
    }

/* Giao việc — hạn quá hạn */
.task-overdue {
    color: var(--mud-palette-error, #d32f2f);
    font-weight: 600;
}

/* Giao việc — bảng Kanban */
.task-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    align-items: flex-start;
}

.task-board-col {
    flex: 1 1 0;
    min-width: 260px;
    background: rgba(148, 163, 184, .08);
    border-radius: 12px;
    padding: 10px;
}

.task-board-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 10px;
}

.task-board-zone {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .task-card:hover {
        box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    }

.task-card-title {
    font-weight: 600;
}

.task-checklist-row {
    padding-top: 2px;
    padding-bottom: 2px;
}

.task-comment {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(148, 163, 184, .08);
    margin-bottom: 8px;
}

/* =====================================================
   Buttons / Avatar / Chip
   ===================================================== */

.erp-primary-button {
    height: 46px;
    border-radius: 16px;
    text-transform: none;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
}

.erp-soft-button {
    border-radius: 16px;
    text-transform: none;
    font-weight: 700;
}

.erp-avatar {
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}

.erp-chip {
    border-radius: 999px;
    font-weight: 700;
}

.status-chip,
.role-chip {
    border-radius: 999px;
    font-weight: 700;
}

/* =====================================================
   Empty / Loading State
   ===================================================== */

.erp-empty-state,
.erp-loading-state,
.empty-state,
.loading-state {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    text-align: center;
}

/* =====================================================
   Login Page
   ===================================================== */

.login-page {
    min-height: 100vh;
    padding: 0;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, .20), transparent 32%), radial-gradient(circle at bottom right, rgba(79, 70, 229, .18), transparent 34%), linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    overflow-x: hidden;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
}

.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 72px;
    color: white;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(30, 64, 175, .96), rgba(49, 46, 129, .94)), radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .28), transparent 30%);
}

    .login-hero::before {
        content: "";
        position: absolute;
        width: 420px;
        height: 420px;
        right: -120px;
        top: -120px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .12);
    }

    .login-hero::after {
        content: "";
        position: absolute;
        width: 320px;
        height: 320px;
        left: -90px;
        bottom: -90px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .10);
    }

.hero-badge {
    position: relative;
    z-index: 1;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    backdrop-filter: blur(12px);
    font-size: .875rem;
    font-weight: 600;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin-top: 48px;
}

.hero-title {
    font-weight: 900;
    letter-spacing: -0.055em;
    line-height: 1.05;
}

.hero-subtitle {
    max-width: 620px;
    margin-top: 22px;
    color: rgba(255, 255, 255, .86);
    line-height: 1.7;
    font-weight: 400;
}

.hero-stats {
    max-width: 520px;
    margin-top: 36px;
}

.hero-stat-card {
    height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    backdrop-filter: blur(14px);
}

    .hero-stat-card strong {
        font-size: 1rem;
    }

    .hero-stat-card span {
        color: rgba(255, 255, 255, .76);
        font-size: .875rem;
    }

.hero-chips {
    margin-top: 32px;
    flex-wrap: wrap;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    padding: 42px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(255, 255, 255, .80);
    box-shadow: var(--erp-shadow-strong);
    backdrop-filter: blur(20px);
}

.mobile-brand {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.mobile-brand-title {
    font-weight: 800;
    letter-spacing: -.03em;
}

.login-heading {
    margin-bottom: 28px;
}

.login-title {
    font-weight: 800;
    letter-spacing: -.04em;
    color: var(--erp-text);
}

.login-options {
    margin: 8px 0 22px;
    gap: 12px;
}

.forgot-link {
    font-weight: 600;
    white-space: nowrap;
}

.login-button {
    height: 52px;
    border-radius: 16px;
    text-transform: none;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .24);
}

.login-footer {
    margin-top: 28px;
    text-align: center;
}

/* =====================================================
   User List Specific Helpers
   Có thể dùng lại cho Employee/Role List
   ===================================================== */

.user-cell {
    min-width: 220px;
}

.user-list-avatar {
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}

.user-cell-info {
    min-width: 0;
}

.user-fullname {
    font-weight: 800;
    color: var(--erp-text);
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-username {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-text {
    color: #334155;
    word-break: break-word;
}

.role-chip-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 260px;
}

.last-login-text {
    white-space: nowrap;
}

.action-cell {
    text-align: right;
}

.users-pager,
.erp-pager {
    padding: 4px 8px;
    background: #ffffff;
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 1100px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        display: none;
    }

    .login-panel {
        min-height: 100vh;
        padding: 32px 20px;
    }

    .mobile-brand {
        display: flex;
    }
}

@media (max-width: 960px) {
    :root {
        --erp-topbar-height: 64px;
    }

    .app-topbar {
        height: 64px;
        padding: 0 14px;
    }

    .brand-subtitle {
        display: none;
    }

    .user-info,
    .user-arrow {
        display: none;
    }

    .user-menu-activator {
        padding: 4px;
        gap: 0;
    }

    .drawer-shell {
        margin: 10px;
        border-radius: 24px;
    }

    .app-main {
        padding-top: 64px;
    }

    .app-content {
        padding: 14px;
    }

    .modern-nav {
        padding-bottom: 24px;
    }

        .modern-nav .mud-nav-link {
            min-height: 46px;
        }

    .erp-hero {
        border-radius: 24px;
        padding: 20px;
    }

    .erp-hero-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .erp-header-actions {
        width: 100%;
    }

        .erp-header-actions .mud-button-root,
        .erp-primary-button {
            width: 100%;
        }

    .erp-card {
        border-radius: 24px;
        padding: 14px;
    }

    .erp-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .erp-search {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .login-page {
        background: radial-gradient(circle at top left, rgba(37, 99, 235, .22), transparent 36%), linear-gradient(180deg, #eef2ff 0%, #ffffff 100%);
    }

    .login-panel {
        align-items: stretch;
        padding: 18px;
    }

    .login-card {
        max-width: none;
        min-height: calc(100vh - 36px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 28px 22px;
        border-radius: 24px;
        box-shadow: 0 18px 60px rgba(15, 23, 42, .12);
    }

    .login-title {
        font-size: 1.8rem;
    }

    .login-options {
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    .forgot-link {
        margin-left: 4px;
    }

    .erp-hero {
        padding: 18px;
        margin-bottom: 14px;
    }

    .erp-title-wrap {
        align-items: flex-start;
    }

    .erp-title-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 17px;
    }

    .erp-title {
        font-size: 1.55rem;
    }

    .erp-subtitle {
        font-size: .86rem;
    }

    .erp-card {
        padding: 10px;
    }

    .erp-toolbar {
        padding: 4px 4px 14px;
    }

    .erp-grid {
        border-radius: 18px;
    }

    .role-chip-wrap {
        max-width: 180px;
    }

    .user-fullname,
    .user-username {
        max-width: 170px;
    }
}

@media (max-width: 480px) {
    .brand-icon {
        width: 36px;
        height: 36px;
        border-radius: 13px;
    }

    .brand-name {
        max-width: 170px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1.05rem;
    }

    .app-content {
        padding: 10px;
    }
}

@media (max-width: 380px) {
    .login-card {
        padding: 24px 18px;
    }

    .mobile-brand-title {
        font-size: 1.25rem;
    }
}

/* =====================================================
   StatCard Component
   ===================================================== */

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-solid);
    border: 1px solid var(--erp-border);
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.04);
    transition: box-shadow .2s ease, transform .2s ease;
    height: 100%;
    box-sizing: border-box;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(15,23,42,.08), 0 12px 28px rgba(15,23,42,.06);
    transform: translateY(-2px);
}

.stat-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon--primary   { background: rgba(37,99,235,.09);  color: #2563eb; }
.stat-icon--secondary { background: rgba(79,70,229,.09);  color: #4f46e5; }
.stat-icon--success   { background: rgba(22,163,74,.09);  color: #16a34a; }
.stat-icon--info      { background: rgba(14,165,233,.09); color: #0ea5e9; }
.stat-icon--warning   { background: rgba(245,158,11,.09); color: #f59e0b; }
.stat-icon--error     { background: rgba(220,38,38,.09);  color: #dc2626; }
.stat-icon--dark      { background: rgba(15,23,42,.07);   color: #334155; }

.stat-card-body {
    min-width: 0;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1;
    color: var(--erp-text);
    letter-spacing: -0.035em;
}

.stat-label {
    margin-top: 5px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--erp-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* =====================================================
   DashboardWidget Component
   ===================================================== */

.dash-widget {
    background: var(--erp-surface-solid);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.04);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--erp-border);
    background: #fafbfc;
}

.dash-widget-title {
    font-weight: 700;
    font-size: .875rem;
    color: var(--erp-text);
    letter-spacing: -.01em;
}

.dash-widget-body {
    padding: 18px;
    flex: 1;
}

.dash-widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

/* =====================================================
   Welcome Banner (Home page)
   ===================================================== */

.welcome-banner {
    padding: 22px 26px;
    border-radius: var(--erp-radius-sm);
    background: linear-gradient(135deg, var(--erp-primary) 0%, var(--erp-secondary) 100%);
    box-shadow: var(--erp-shadow-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.welcome-banner-greeting {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.welcome-banner-date {
    font-size: .85rem;
    color: rgba(255,255,255,.75);
    margin-top: 4px;
    font-weight: 400;
}

.welcome-banner-icon {
    font-size: 2.25rem;
    line-height: 1;
    opacity: .9;
    user-select: none;
}

@media (max-width: 600px) {
    .stat-value {
        font-size: 1.5rem;
    }

    .welcome-banner {
        padding: 18px 20px;
    }

    .welcome-banner-icon {
        display: none;
    }

    .dash-widget-header {
        padding: 12px 14px;
    }

    .dash-widget-body {
        padding: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   PAYROLL PAGES
   CSS gom từ các trang Payroll (trước đây nằm inline trong .razor).
   Các class có prefix riêng theo trang nên không xung đột.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── AttendancePage (bảng chấm công) ── */
.att-grid-wrapper { overflow-x: auto; border-radius: 12px; }

.att-grid {
    border-collapse: collapse;
    min-width: 100%;
    font-size: .8rem;
}

.att-grid th, .att-grid td {
    border: 1px solid #e2e8f0;
    padding: 4px 2px;
    text-align: center;
    white-space: nowrap;
}

.att-col-name {
    min-width: 140px;
    max-width: 160px;
    text-align: left !important;
    padding: 6px 10px !important;
    position: sticky;
    left: 0;
    background: white;
    z-index: 2;
}

.att-col-day { min-width: 38px; max-width: 42px; }
.att-col-sum { min-width: 60px; font-weight: 600; }

.att-weekend { background: #fef9f0; color: #d97706; }

.att-grid thead th {
    background: #f8fafc;
    font-weight: 700;
    font-size: .75rem;
}

.att-cell { cursor: pointer; transition: background .1s; }
.att-cell:hover { background: #f1f5f9; }
.att-cell--empty { background: #fafafa; }

.att-badge {
    display: inline-block;
    border-radius: 6px;
    padding: 2px 4px;
    font-size: .7rem;
    font-weight: 700;
    min-width: 24px;
}

.att-badge--present  { background: #dcfce7; color: #15803d; }
.att-badge--absent   { background: #fee2e2; color: #dc2626; }
.att-badge--leave    { background: #dbeafe; color: #1d4ed8; }
.att-badge--holiday  { background: #f3e8ff; color: #7c3aed; }
.att-badge--halfday  { background: #fef9c3; color: #a16207; }
.att-badge--wfh      { background: #e0f2fe; color: #0369a1; }
.att-badge--empty    { background: transparent; color: #94a3b8; }

.att-sum-val { font-size: .82rem; }

/* ── LeaveRequestsPage (đơn nghỉ phép) ── */
.leave-requests-tabs .mud-tabs-toolbar {
    border-radius: 22px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, .9);
    padding: 6px;
    margin-bottom: 16px;
}

.leave-requests-tabs .mud-tab {
    min-height: 44px;
    border-radius: 16px;
    text-transform: none;
    font-weight: 750;
}

.leave-requests-tabs .mud-tab.mud-tab-active {
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

.lr-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 4px 0;
}

.lr-inline-form {
    padding: 20px;
    border-radius: 20px;
    background: #f8fafc;
    border-color: rgba(226, 232, 240, .95) !important;
}

.lr-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.lr-reason-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.lr-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 4px 0;
}

@media (max-width: 600px) {
    .leave-requests-tabs .mud-tabs-toolbar {
        border-radius: 18px;
        overflow-x: auto;
    }

    .lr-inline-form {
        padding: 14px;
        border-radius: 16px;
    }

    .lr-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .lr-pagination {
        flex-direction: column;
        align-items: center;
    }
}

/* ── PayrollSettingsPage + OvertimePage (dùng chung prefix .ps-) ── */
.payroll-settings-tabs .mud-tabs-toolbar {
    border-radius: 22px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, .9);
    padding: 6px;
    margin-bottom: 16px;
}

.payroll-settings-tabs .mud-tab {
    min-height: 44px;
    border-radius: 16px;
    text-transform: none;
    font-weight: 750;
}

.payroll-settings-tabs .mud-tab.mud-tab-active {
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

.ps-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 4px 0;
}

.ps-inline-form {
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 16px;
    background: #f8fafc;
    border-color: rgba(226, 232, 240, .95) !important;
}

.ps-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

@media (max-width: 600px) {
    .payroll-settings-tabs .mud-tabs-toolbar {
        border-radius: 18px;
        overflow-x: auto;
    }

    .ps-inline-form {
        padding: 14px;
        border-radius: 16px;
    }

    .ps-tab-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── PayrollPeriodsPage (kỳ lương) ── */
.pr-inline-form {
    padding: 20px; border-radius: 20px; background: #f8fafc;
    border-color: rgba(226,232,240,.95) !important;
}

/* ── PayrollPeriodDetailPage (phiếu lương) ── */
.pd-stat-card {
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid rgba(226,232,240,.8);
}
.pd-stat-card--highlight {
    background: rgba(22,163,74,.06);
    border-color: rgba(22,163,74,.2);
}

.payslip-content { font-size: .88rem; }
.payslip-employee { margin-bottom: 4px; }
.section-label { font-size: .7rem; letter-spacing: .08em; color: #94a3b8; font-weight: 700; }

.payslip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}
.payslip-row--bold { font-weight: 700; }
.payslip-row--negative .payslip-amount { color: #dc2626; }
.payslip-row--highlight {
    background: rgba(22,163,74,.08);
    border-radius: 10px;
    padding: 8px 12px;
    margin: 4px -12px;
}
.payslip-row--highlight .payslip-amount {
    color: #15803d;
    font-size: 1.1rem;
}

.payslip-total { background: #f1f5f9; border-radius: 8px; padding: 6px 8px; }
.payslip-actual { margin-top: 8px; }

/* ── PayrollDashboardPage ── */
.pd-kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(226,232,240,.8);
    box-shadow: 0 2px 8px rgba(15,23,42,.05);
}
.pd-kpi-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(15,23,42,.15);
}

/* ── InsuranceReportPage ── */
.bhxh-stat { padding: 14px 16px; background: #f8fafc; border-radius: 14px; border: 1px solid rgba(226,232,240,.8); }
.bhxh-stat--total { background: rgba(37,99,235,.05); border-color: rgba(37,99,235,.2); }

/* ── LeaveBalancesPage ── */
.lb-adjust-panel {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px 24px;
    border-radius: 20px;
    z-index: 999;
    min-width: 600px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .18);
}

@media (max-width: 700px) {
    .lb-adjust-panel {
        min-width: unset;
        width: calc(100vw - 32px);
        left: 16px;
        transform: none;
    }
}

/* ── KioskPage (toàn màn hình, layout EmptyLayout) ──
   Nền + overflow trước đây đặt trên body; chuyển vào .kiosk-root để không
   ảnh hưởng các trang khác (body margin:0 đã có sẵn từ Bootstrap/MudBlazor). */
.kiosk-root {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
}

.kiosk-office-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px;
}

.kiosk-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.kiosk-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 460px;
    padding: 32px 24px;
}

.kiosk-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(15,23,42,.08);
    margin-bottom: 28px;
}

.kiosk-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 32px;
    background: white;
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(15,23,42,.10);
    width: 100%;
}

.kiosk-qr-canvas {
    width: 280px;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
}

.kiosk-instructions {
    margin-top: 24px;
    padding: 16px 24px;
    background: rgba(37,99,235,.06);
    border-radius: 16px;
    width: 100%;
}

/* ── CheckInPage (toàn màn hình, layout EmptyLayout) ──
   Nền gradient chuyển từ body sang .checkin-root (min-height:100vh phủ kín). */
.checkin-root {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

.checkin-card {
    background: white;
    border-radius: 28px;
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 24px 64px rgba(15,23,42,.25);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checkin-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.checkin-header-text { line-height: 1.3; }

.checkin-user {
    text-align: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 16px;
}

.checkin-action {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.checkin-btn {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 32px rgba(37,99,235,.4);
    transition: transform .15s ease, box-shadow .15s ease;
}

.checkin-btn:hover:not(:disabled) {
    transform: scale(1.04);
    box-shadow: 0 16px 40px rgba(37,99,235,.5);
}

.checkin-btn:active:not(:disabled) { transform: scale(0.97); }
.checkin-btn:disabled { opacity: .7; cursor: not-allowed; }

.checkin-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    border-radius: 20px;
    text-align: center;
}

.checkin-result--in  { background: rgba(22,163,74,.1); color: #15803d; }
.checkin-result--out { background: rgba(37,99,235,.1); color: #1d4ed8; }

.checkin-footer { display: flex; justify-content: center; }

/* ── HelpGuidePage (Hướng dẫn sử dụng) ── */
.erp-guide .mud-expand-panel {
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 16px !important;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.erp-guide-steps {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.erp-guide-steps li {
    font-size: .9rem;
    line-height: 1.5;
    color: #334155;
    padding-left: 4px;
}
.erp-guide-steps li::marker {
    color: #2563eb;
    font-weight: 700;
}

/* =====================================================
   Theme — preset cards (Cấu hình → Giao diện) + toggle
   ===================================================== */
.theme-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.theme-preset-card {
    cursor: pointer;
    padding: 14px;
    border-radius: 18px;
    border: 1.5px solid var(--erp-border);
    background: var(--erp-surface-solid);
    text-align: center;
    transition: .18s ease;
}
.theme-preset-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--erp-shadow-md);
}
.theme-preset-card--active {
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 2px var(--erp-primary) inset;
}
.theme-preset-swatch {
    height: 54px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar-theme-toggle { margin-right: 4px; }

@media (max-width: 600px) {
    .theme-preset-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   Dark mode
   Custom CSS dùng biến --erp-* nên chỉ cần override biến +
   vài bề mặt hardcode. Component MudBlazor tự đổi theo PaletteDark.
   ===================================================== */
html[data-theme="dark"] {
    --erp-bg: #0f172a;
    --erp-bg-soft: #1e293b;
    --erp-surface: rgba(30, 41, 59, .92);
    --erp-surface-solid: #1e293b;
    --erp-border: rgba(51, 65, 85, .8);
    --erp-text: #e2e8f0;
    --erp-muted: #94a3b8;
    --erp-muted-light: #64748b;
    --erp-shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
    --erp-shadow-md: 0 2px 8px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.4);
    --erp-shadow-strong: 0 4px 16px rgba(0,0,0,.5), 0 16px 48px rgba(0,0,0,.45);
}

html[data-theme="dark"] .app-layout,
html[data-theme="dark"] .erp-page-bg {
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.16), transparent 30%),
        linear-gradient(135deg, #0b1220 0%, #0f172a 100%);
}

html[data-theme="dark"] .app-topbar { background: rgba(15, 23, 42, .92) !important; }
html[data-theme="dark"] .modern-nav-group { background: rgba(30, 41, 59, .55); border-color: rgba(51,65,85,.7); }
html[data-theme="dark"] .dash-widget-header { background: rgba(15, 23, 42, .45); }
html[data-theme="dark"] .erp-card-sm { background: rgba(30, 41, 59, .9); }

html[data-theme="dark"] .pd-kpi-card,
html[data-theme="dark"] .pd-stat-card,
html[data-theme="dark"] .setting-item,
html[data-theme="dark"] .bhxh-stat,
html[data-theme="dark"] .settings-side-card,
html[data-theme="dark"] .settings-form-card,
html[data-theme="dark"] .settings-group-card,
html[data-theme="dark"] .logo-upload-box {
    background: #1e293b !important;
    border-color: rgba(51, 65, 85, .8) !important;
}

html[data-theme="dark"] .pd-stat-card--highlight { background: rgba(34,197,94,.12) !important; }

html[data-theme="dark"] .settings-tabs .mud-tabs-toolbar {
    background: #0f172a;
    border-color: rgba(51, 65, 85, .7);
}
html[data-theme="dark"] .settings-tabs .mud-tab.mud-tab-active { background: #1e293b; }

/* Menu điều hướng — chữ #334155 quá tối trên nền tối. */
html[data-theme="dark"] .nav-section-title { color: #7c8aa3; }
html[data-theme="dark"] .modern-nav .mud-nav-link,
html[data-theme="dark"] .modern-nav-group .mud-nav-group-button {
    color: #cbd5e1;
}
html[data-theme="dark"] .modern-nav .mud-nav-link:hover,
html[data-theme="dark"] .modern-nav-group .mud-nav-group-button:hover {
    background: rgba(59, 130, 246, .16);
    color: #ffffff;
}
html[data-theme="dark"] .modern-nav .mud-nav-link.active,
html[data-theme="dark"] .modern-nav .mud-nav-link.mud-nav-link-active {
    background: linear-gradient(135deg, rgba(59, 130, 246, .26), rgba(99, 102, 241, .20));
    color: #ffffff;
}

/* Bảng dữ liệu (.erp-grid) — nền + dòng head hardcode màu sáng. */
html[data-theme="dark"] .erp-grid {
    background: #1e293b;
    border-color: rgba(51, 65, 85, .8);
}
html[data-theme="dark"] .erp-grid .mud-table-head {
    background: #0f172a;
}
html[data-theme="dark"] .erp-grid .mud-table-head .mud-table-cell {
    color: #94a3b8;
    border-bottom-color: rgba(51, 65, 85, .8);
}
html[data-theme="dark"] .erp-grid .mud-table-cell {
    border-bottom-color: rgba(51, 65, 85, .6);
}
html[data-theme="dark"] .erp-grid .mud-table-row:hover {
    background: rgba(59, 130, 246, .09) !important;
}

/* Danh sách hướng dẫn — chữ #334155 quá tối. */
html[data-theme="dark"] .erp-guide-steps li { color: #cbd5e1; }
html[data-theme="dark"] .erp-guide-steps li::marker { color: #60a5fa; }

/* Pill tài khoản (góc trên phải) — hover hardcode #f8fafc làm trắng pill,
   chữ sáng trên nền trắng -> mất chữ. Dùng nền tối khi hover. */
html[data-theme="dark"] .user-menu-activator:hover {
    background: rgba(59, 130, 246, .16);
    border-color: rgba(96, 165, 250, .5);
}

/* Bản in luôn nền sáng dù người dùng đang ở chế độ Tối. */
@media print {
    html[data-theme="dark"] {
        --erp-bg: #ffffff;
        --erp-bg-soft: #ffffff;
        --erp-surface: #ffffff;
        --erp-surface-solid: #ffffff;
        --erp-border: #e2e8f0;
        --erp-text: #0f172a;
        --erp-muted: #64748b;
    }
}
