[v-cloak] { display: none !important; }

:root {
    --n-primary: #2563eb;
    --n-primary-dark: #1d4ed8;
    --n-sidebar-bg: #1e293b;
    --n-sidebar-text: #cbd5e1;
    --n-sidebar-text-active: #ffffff;
    --n-sidebar-active: #2563eb;
    --n-content-bg: #f1f5f9;
}

/* ===== Login ===== */
.login-body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.login-wrap { width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}
.login-header i {
    font-size: 2.5rem;
    color: var(--n-primary);
}
.login-header h3 { margin: 0.5rem 0 0.25rem; font-weight: 700; }
.login-header p { margin: 0; color: #64748b; font-size: 0.9rem; }
.login-footer { text-align: center; }

/* ===== App shell ===== */
.app-body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--n-content-bg);
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--n-sidebar-bg);
    color: var(--n-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.2s;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-user {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.85rem;
}
.sidebar-user .name { color: #fff; font-weight: 600; font-size: 0.95rem; }
.sidebar-user .role { color: #94a3b8; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}
.sidebar-nav .nav-section {
    padding: 0.75rem 1.5rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 1px;
}
.sidebar-nav .nav-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.sidebar-nav .nav-section-toggle:hover { color: #94a3b8; }
.sidebar-nav .nav-section-toggle i { font-size: 0.75rem; }
.sidebar-nav .nav-submenu {
    overflow: hidden;
    border-left: 2px solid rgba(255,255,255,0.06);
    margin-left: 1.25rem;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: var(--n-sidebar-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    cursor: pointer;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-nav a.active {
    background: rgba(37,99,235,0.15);
    color: var(--n-sidebar-text-active);
    border-left-color: var(--n-sidebar-active);
}
.sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #fff;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.topbar h5 { margin: 0; font-weight: 600; }

.page {
    padding: 1.5rem;
    flex: 1;
}

.card-tile {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.tile-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.tile-stat .icon {
    width: 48px; height: 48px;
    border-radius: 0.5rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}
.tile-stat .val { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.tile-stat .lbl { color: #64748b; font-size: 0.85rem; }

.badge-perm { font-size: 0.7rem; font-weight: 500; }

.perm-table .perm-cell {
    cursor: pointer;
    transition: background 0.15s;
}
.perm-table .perm-cell:hover { background: #f0f9ff; }

/* Inline user permission row */
.perm-expand-row td { background: #f8fafc; border-top: none; }
.perm-inline-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
}
.perm-inline-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.perm-inline-item:hover { background: #f0f9ff; border-color: #bfdbfe; }

/* Modal permission grid */
.perm-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.perm-modal-item {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
    user-select: none;
}
.perm-modal-item:hover { background: #eff6ff; border-color: #bfdbfe; }

@media (max-width: 576px) {
    .perm-modal-grid { grid-template-columns: repeat(2, 1fr); }
}

/* tighter table */
.table-sm-x th, .table-sm-x td {
    padding: 0.55rem 0.6rem;
    font-size: 0.875rem;
    vertical-align: middle;
}
.table-sm-x thead th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

/* notification toast */
.n-toast {
    position: fixed; top: 1rem; right: 1rem; z-index: 9999;
    min-width: 280px;
}

.sidebar-overlay {
    display: none;
}

.hamburger-btn { border: none; }

@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: 260px;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }
    .sidebar.sidebar-mobile-open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 1049;
    }
    .main {
        width: 100%;
    }
    .page {
        padding: 1rem;
    }
}
