/* ═══════════════════════════════════════════
       THEMES
    ═══════════════════════════════════════════ */
[data-theme="dark"] {
    --bg: #0A0F1E;
    --bg2: #0D1526;
    --sidebar: #080D1A;
    --card-bg: #111827;
    --border: #1E2D45;
    --border2: #152038;
    --accent: #00D4FF;
    --accent2: #00B4A0;
    --muted: #8A99B3;
    --text: #F0F6FF;
    --topbar-bg: rgba(8, 13, 26, .92);
    --grid-line: rgba(0, 212, 255, .025);
    --dropdown: #0D1526;
    --hover: rgba(255, 255, 255, .04);
    --sub-tint: rgba(0, 212, 255, .05);
}

[data-theme="light"] {
    --bg: #F4F7FB;
    --bg2: #FFFFFF;
    --sidebar: #FFFFFF;
    --card-bg: #FFFFFF;
    --border: #D7E1EC;
    --border2: #E6EDF5;
    --accent: #1668E3;
    --accent2: #14B8A6;
    --muted: #64748B;
    --text: #0F172A;
    --topbar-bg: rgba(255, 255, 255, .88);
    --grid-line: rgba(15, 23, 42, .03);
    --dropdown: #FFFFFF;
    --hover: rgba(15, 23, 42, .04);
    --sub-tint: rgba(22, 104, 227, .08);
}



/* ═══════════════════════════════════════════
       BASE
    ═══════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background .3s, color .3s;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 50px 50px;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ═══════════════════════════════════════════
       LAYOUT
    ═══════════════════════════════════════════ */
.layout {
    display: flex;
    height: 100vh;
    position: relative;
}

/* ═══════════════════════════════════════════
       SIDEBAR
    ═══════════════════════════════════════════ */
.sidebar {
    width: 240px;
    background: var(--sidebar);
    border-right: 1px solid var(--border2);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .3s cubic-bezier(.4, 0, .2, 1),
        opacity .3s, border-color .3s;
    position: relative;
    z-index: 100;
}

/* ① Desktop hide — width → 0 */
.sidebar.hidden {
    width: 0 !important;
    opacity: 0;
    border-right-color: transparent;
    pointer-events: none;
}

/* Mobile */
@media(max-width:768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 240px !important;
        opacity: 1 !important;
        transform: translateX(-100%);
        z-index: 500;
        transition: transform .3s cubic-bezier(.4, 0, .2, 1);
        pointer-events: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 499;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* Logo */
.sidebar-logo {
    padding: 1rem 1rem 1rem 1.2rem;
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 60px;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
}

.logo-mark {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Mono', monospace;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Space Mono', monospace;
    font-size: .88rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
}

.logo-text small {
    display: block;
    font-size: .48rem;
    color: var(--muted);
    letter-spacing: .15em;
    text-transform: uppercase;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
}

/* Nav */
.sidebar-section {
    padding: .75rem 0 .5rem;
    flex: 1;
}

.sidebar-label {
    font-size: .56rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
    padding: .8rem 1.2rem .3rem;
    white-space: nowrap;
    overflow: hidden;
    font-family: 'Space Mono', monospace;
    opacity: .55;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .54rem 1.2rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .81rem;
    font-weight: 500;
    border-left: 2px solid transparent;
    transition: all .18s;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    user-select: none;
}

button.nav-item {
    width: 100%;
    background: transparent;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    text-align: left;
    font: inherit;
    appearance: none;
}

.nav-item:hover {
    color: var(--text);
    background: var(--hover);
    border-left-color: var(--border);
}

.nav-item.active {
    color: var(--accent);
    background: var(--sub-tint);
    border-left-color: var(--accent);
}

.nav-item .ni {
    width: 15px;
    text-align: center;
    flex-shrink: 0;
    font-size: .8rem;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .57rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    padding: 0 4px;
}

.nav-badge.red {
    background: #EF4444;
}

.nav-badge.amber {
    background: #FBBF24;
    color: #111;
}

.nav-chevron {
    font-size: .58rem;
    color: var(--muted);
    transition: transform .25s;
    flex-shrink: 0;
}

.nav-item.open .nav-chevron {
    transform: rotate(90deg);
}

/* ② Sub menus */
.sub-menu {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s cubic-bezier(.4, 0, .2, 1);
}

.sub-menu.open {
    max-height: 220px;
}

.sub-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .42rem 1.2rem .42rem 2.75rem;
    color: var(--muted);
    font-size: .77rem;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s, background .15s;
    border-left: 2px solid transparent;
    white-space: nowrap;
}

.sub-item::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background .15s;
}

.sub-item:hover {
    color: var(--text);
    background: var(--hover);
}

.sub-item:hover::before {
    background: var(--accent);
}

.sub-item.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--sub-tint);
}

.sub-item.active::before {
    background: var(--accent);
}

/* Sidebar footer */
.sidebar-footer {
    padding: .85rem;
    border-top: 1px solid var(--border2);
    flex-shrink: 0;
    position: relative;
}

.user-card {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem;
    border-radius: 8px;
    background: var(--hover);
    border: 1px solid var(--border2);
    cursor: pointer;
    transition: border-color .2s;
}

.user-card:hover {
    border-color: var(--border);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    overflow: hidden;
    flex: 1;
}

.user-name {
    font-size: .77rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: .61rem;
    color: var(--muted);
}

/* ═══════════════════════════════════════════
       TOPBAR
    ═══════════════════════════════════════════ */
.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    min-width: 0;
}

.topbar {
    height: 60px;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: .75rem;
    flex-shrink: 0;
    transition: background .3s;
    position: relative;
    z-index: 200;
}

.topbar-toggle {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    font-size: .82rem;
    flex-shrink: 0;
}

.topbar-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.topbar-breadcrumb .sep {
    color: var(--border);
}

.topbar-breadcrumb .current {
    color: var(--text);
}

.topbar-search {
    margin-left: auto;
    position: relative;
}

.topbar-search input {
    background: var(--hover);
    border: 1px solid var(--border2);
    border-radius: 6px;
    color: var(--text);
    font-size: .77rem;
    padding: .37rem .75rem .37rem 2rem;
    width: 185px;
    transition: border-color .2s, width .3s;
    font-family: 'DM Sans', sans-serif;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--accent);
    width: 240px;
}

.topbar-search input::placeholder {
    color: var(--muted);
    opacity: .5;
}

.topbar-search i {
    position: absolute;
    left: .6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .67rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.topbar-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 6px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    font-size: .77rem;
    position: relative;
    flex-shrink: 0;
}

.topbar-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Pagination */
.admin-pagination-wrap .pagination {
    gap: .45rem;
    margin: 0;
    align-items: center;
    flex-wrap: wrap;
}

.admin-pagination-wrap .page-item {
    list-style: none;
}

.admin-pagination-wrap .page-link {
    min-width: 40px;
    height: 40px;
    padding: 0 .95rem;
    border-radius: 12px;
    border: 1px solid var(--border2);
    background: #fff;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .9rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
    transition: all .18s ease;
}

.admin-pagination-wrap .page-link:hover {
    background: rgba(22, 104, 227, .06);
    border-color: rgba(22, 104, 227, .24);
    color: var(--accent);
    transform: translateY(-1px);
}

.admin-pagination-wrap .page-item.active .page-link {
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 24px rgba(22, 104, 227, .28);
}

.admin-pagination-wrap .page-item.disabled .page-link {
    background: #f8fafc;
    color: #94a3b8;
    border-color: var(--border2);
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
}

.admin-pagination-wrap nav {
    display: inline-flex;
}

@media (max-width: 768px) {
    .topbar-breadcrumb {
        display: none !important;
    }

    .admin-pagination-wrap {
        justify-content: center !important;
    }

    .admin-pagination-wrap .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0 .75rem;
        border-radius: 10px;
        font-size: .85rem;
    }
}

.topbar-btn .dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EF4444;
    border: 1.5px solid var(--bg);
}

.theme-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 6px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    font-size: .77rem;
    flex-shrink: 0;
}

.theme-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: .42rem;
    padding: .28rem .6rem;
    border: 1px solid var(--border2);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .2s;
    font-size: .75rem;
    color: var(--text);
    background: transparent;
    flex-shrink: 0;
}

.topbar-user:hover {
    border-color: var(--border);
}

.topbar-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .57rem;
    font-weight: 700;
    color: #fff;
}

/* ═══════════════════════════════════════════
       ③④ DROPDOWNS
    ═══════════════════════════════════════════ */
.dp-wrap {
    position: relative;
}

.dp {
    position: absolute;
    background: var(--dropdown);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px) scale(.98);
    transition: opacity .18s, transform .18s;
}

.dp.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.dp-right {
    top: calc(100% + 7px);
    right: 0;
}

.dp-above {
    bottom: calc(100% + 7px);
    left: 0;
    right: 0;
}

.dp-notif {
    width: 310px;
}

.dp-task {
    width: 290px;
}

.dp-theme {
    width: 210px;
}

.dp-user {
    width: 195px;
}

.dp-head {
    padding: .7rem 1rem .5rem;
    border-bottom: 1px solid var(--border2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dp-head-title {
    font-size: .77rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

.dp-head-act {
    font-size: .65rem;
    color: var(--accent);
    cursor: pointer;
}

.dp-head-act:hover {
    opacity: .75;
}

.dp-badge-new {
    font-size: .58rem;
    padding: .08rem .4rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, .15);
    color: #EF4444;
    font-weight: 700;
}

.dp-badge-open {
    font-size: .58rem;
    padding: .08rem .4rem;
    border-radius: 8px;
    background: var(--sub-tint);
    color: var(--accent);
    font-weight: 700;
}

.dp-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.dp-foot {
    padding: .48rem 1rem;
    border-top: 1px solid var(--border2);
    font-size: .7rem;
    color: var(--accent);
    text-align: center;
    cursor: pointer;
}

.dp-foot:hover {
    opacity: .75;
}

/* Notif items */
.notif-item {
    display: flex;
    gap: .65rem;
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: background .15s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--hover);
}

.notif-item.unread {
    background: var(--sub-tint);
}

.ni-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    flex-shrink: 0;
    margin-top: .1rem;
}

.ni-body {
    flex: 1;
}

.ni-text {
    font-size: .75rem;
    line-height: 1.4;
    color: var(--text);
}

.ni-time {
    font-size: .61rem;
    color: var(--muted);
    margin-top: .12rem;
    font-family: 'Space Mono', monospace;
}

.ni-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: .5rem;
}

/* Task items */
.task-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: background .15s;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    background: var(--hover);
}

.task-cb {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .54rem;
    color: transparent;
    transition: all .15s;
}

.task-item.done .task-cb {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.task-item.done .task-text {
    text-decoration: line-through;
    color: var(--muted);
}

.task-text {
    font-size: .74rem;
    flex: 1;
    line-height: 1.35;
}

.task-pri {
    font-size: .57rem;
    padding: .08rem .38rem;
    border-radius: 3px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    flex-shrink: 0;
}

.tp-h {
    background: rgba(239, 68, 68, .12);
    color: #EF4444;
}

.tp-m {
    background: rgba(251, 191, 36, .12);
    color: #FBBF24;
}

.tp-l {
    background: rgba(163, 230, 53, .12);
    color: #A3E635;
}

/* User dropdown */
.dp-user-hd {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border2);
}

.dp-av {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.dp-uname {
    font-size: .8rem;
    font-weight: 600;
}

.dp-email {
    font-size: .62rem;
    color: var(--muted);
    margin-top: .05rem;
}

.dp-mi {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .52rem 1rem;
    font-size: .78rem;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.dp-mi:hover {
    background: var(--hover);
    color: var(--text);
}

.dp-mi i {
    width: 13px;
    text-align: center;
    font-size: .78rem;
}

.dp-mi.danger:hover {
    color: #EF4444;
}

.dp-div {
    border: none;
    border-top: 1px solid var(--border2);
    margin: .2rem 0;
}

/* ⑤ Theme panel */
.t-opt {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .9rem;
    cursor: pointer;
    transition: background .15s;
    border-radius: 7px;
    margin: .2rem .4rem;
}

.t-opt:hover {
    background: var(--hover);
}

.t-opt.active {
    background: var(--sub-tint);
}

.t-swatch {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    flex-shrink: 0;
}

.t-name {
    font-size: .77rem;
    flex: 1;
}

.t-check {
    color: var(--accent);
    font-size: .72rem;
    opacity: 0;
}

.t-opt.active .t-check {
    opacity: 1;
}

.t-desc {
    font-size: .6rem;
    color: var(--muted);
    display: block;
    margin-top: .05rem;
}

/* ═══════════════════════════════════════════
       CONTENT
    ═══════════════════════════════════════════ */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 1.3rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-family: 'Space Mono', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.page-sub {
    font-size: .73rem;
    color: var(--muted);
    margin-top: .2rem;
}

.page-actions {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
}

.btn-cta {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: .4rem .85rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: transform .15s, box-shadow .15s;
}

.btn-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: .4rem .85rem;
    font-size: .72rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: all .2s;
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .9rem;
    margin-bottom: 1.1rem;
}

@media(max-width:900px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width:500px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.05rem;
    position: relative;
    overflow: hidden;
    transition: border-color .25s, transform .25s;
    animation: fsUp .5s ease both;
}

.kpi-card:nth-child(1) {
    animation-delay: .04s
}

.kpi-card:nth-child(2) {
    animation-delay: .08s
}

.kpi-card:nth-child(3) {
    animation-delay: .12s
}

.kpi-card:nth-child(4) {
    animation-delay: .16s
}

@keyframes fsUp {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.kpi-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    opacity: 0;
    transition: opacity .25s;
}

.kpi-card:hover::after {
    opacity: 1;
}

.kpi-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: .55rem;
}

.kpi-lbl {
    font-size: .63rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.kpi-ico {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
}

.kpi-val {
    font-family: 'Space Mono', monospace;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: .22rem;
}

.kpi-ch {
    font-size: .65rem;
    display: inline-flex;
    align-items: center;
    gap: .2rem;
}

.ch-up {
    color: #A3E635
}

.ch-down {
    color: #EF4444
}

.ch-warn {
    color: #FBBF24
}

.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 22px;
    margin-top: .6rem;
}

.spark {
    flex: 1;
    border-radius: 2px 2px 0 0;
    background: var(--border);
    min-width: 4px;
}

.spark.hi {
    background: var(--sub-tint);
}

.spark.pk {
    background: var(--accent);
}

/* Charts row */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: .9rem;
    margin-bottom: 1.1rem;
}

@media(max-width:800px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    animation: fsUp .5s ease both;
    transition: background .3s, border-color .3s;
}

.panel-head {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: .77rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

.panel-sub {
    font-size: .61rem;
    color: var(--muted);
    margin-top: .08rem;
}

.panel-body {
    padding: .95rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 110px;
    margin-bottom: .38rem;
}

.bc-group {
    flex: 1;
    height: 100%;
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.bc-bar {
    flex: 1;
    border-radius: 3px 3px 0 0;
    transition: opacity .2s;
    cursor: pointer;
    min-width: 5px;
}

.bc-bar:hover {
    opacity: .7;
}

.bc-bar.b1 {
    background: var(--accent);
}

.bc-bar.b2 {
    background: var(--accent2);
    opacity: .5;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    margin-top: .55rem;
}

.leg-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .63rem;
    color: var(--muted);
}

.leg-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.bar-labels {
    display: flex;
    gap: 5px;
}

.bl-grp {
    flex: 1;
    text-align: center;
    font-size: .57rem;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.donut-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.donut-svg {
    position: relative;
}

svg.donut {
    transform: rotate(-90deg);
}

.donut-ctr {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-num {
    font-family: 'Space Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.donut-lbl {
    font-size: .57rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .1em;
}

.dl-legend {
    width: 100%;
    margin-top: .6rem;
}

.dl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .28rem 0;
    border-bottom: 1px solid var(--border2);
    font-size: .68rem;
}

.dl-item:last-child {
    border-bottom: none;
}

.dl-left {
    display: flex;
    align-items: center;
    gap: .42rem;
    color: var(--muted);
}

.dl-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.dl-val {
    font-family: 'Space Mono', monospace;
    color: var(--text);
}

/* Tables row */
.tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
    margin-bottom: 1.1rem;
}

@media(max-width:800px) {
    .tables-row {
        grid-template-columns: 1fr;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    font-size: .59rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    padding: .42rem .7rem;
    border-bottom: 1px solid var(--border2);
    text-align: left;
    font-family: 'Space Mono', monospace;
}

.data-table td {
    padding: .48rem .7rem;
    font-size: .75rem;
    border-bottom: 1px solid var(--border2);
    color: var(--text);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--hover);
}

.badge {
    display: inline-flex;
    align-items: center;
    font-size: .58rem;
    padding: .1rem .48rem;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
}

.bok {
    background: rgba(163, 230, 53, .12);
    color: #A3E635;
}

.bwarn {
    background: rgba(251, 191, 36, .12);
    color: #FBBF24;
}

.berr {
    background: rgba(239, 68, 68, .12);
    color: #EF4444;
}

.binfo {
    background: rgba(0, 212, 255, .12);
    color: #00D4FF;
}

.td-mono {
    font-family: 'Space Mono', monospace;
    font-size: .69rem;
}

.td-muted {
    color: var(--muted);
    font-size: .69rem;
}

.td-act {
    color: var(--muted);
    cursor: pointer;
    font-size: .76rem;
    transition: color .15s;
}

.td-act:hover {
    color: var(--accent);
}

.act-item {
    display: flex;
    gap: .65rem;
    padding: .58rem 0;
    border-bottom: 1px solid var(--border2);
}

.act-item:last-child {
    border-bottom: none;
}

.act-ico {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .67rem;
    flex-shrink: 0;
}

.act-text {
    font-size: .74rem;
    line-height: 1.4;
}

.act-text .hl {
    color: var(--accent);
    font-weight: 600;
}

.act-time {
    font-size: .6rem;
    color: var(--muted);
    margin-top: .1rem;
    font-family: 'Space Mono', monospace;
}

/* Bottom row */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: .9rem;
    margin-bottom: 1rem;
}

@media(max-width:900px) {
    .bottom-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media(max-width:600px) {
    .bottom-row {
        grid-template-columns: 1fr;
    }
}

.g-bar {
    height: 5px;
    background: var(--border2);
    border-radius: 3px;
    overflow: hidden;
    margin: .55rem 0 .3rem;
}

.g-fill {
    height: 100%;
    border-radius: 3px;
}

/* Alert banner */
.alert-bar {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: rgba(251, 191, 36, .06);
    border: 1px solid rgba(251, 191, 36, .2);
    border-radius: 8px;
    padding: .6rem .85rem;
    margin-bottom: 1.1rem;
    font-size: .74rem;
    animation: fsUp .5s ease both;
}

.alert-bar i {
    color: #FBBF24;
    flex-shrink: 0;
}

.alert-bar span {
    color: var(--muted);
}

.alert-bar strong {
    color: var(--text);
}

.close-x {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .76rem;
    transition: color .2s;
}

.close-x:hover {
    color: var(--text);
}

/* ── PAGINATION ── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .85rem;
    border-top: 1px solid var(--border2);
    flex-wrap: wrap;
    gap: .5rem;
}

.pagination-info {
    font-size: .65rem;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.pagination-info span {
    color: var(--text);
}

.pagination-btns {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.pg-btn {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    border: 1px solid var(--border2);
    background: transparent;
    color: var(--muted);
    font-size: .7rem;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    transition: all .18s;
    padding: 0 .35rem;
    text-decoration: none;
}

.pg-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pg-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    pointer-events: none;
}

.pg-btn.disabled {
    opacity: .3;
    pointer-events: none;
    cursor: not-allowed;
}

.pg-ellipsis {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.pg-size {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .65rem;
    color: var(--muted);
}

.pg-size select {
    background: var(--hover);
    border: 1px solid var(--border2);
    border-radius: 5px;
    color: var(--text);
    font-size: .65rem;
    padding: .18rem .4rem;
    font-family: 'Space Mono', monospace;
    cursor: pointer;
}

.pg-size select:focus {
    outline: none;
    border-color: var(--accent);
}

.pagination {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    min-width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .7rem .95rem;
    border-radius: 14px;
    border: 1px solid rgba(15, 34, 57, 0.08);
    background: #ffffff;
    color: #43576b;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.pagination .page-link:hover {
    background: #f8fbff;
    border-color: rgba(15, 111, 214, 0.22);
    color: #0f6fd6;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.pagination .page-item.active .page-link {
    background: #0f6fd6;
    border-color: #0f6fd6;
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 111, 214, 0.2);
}

.pagination .page-item.disabled .page-link {
    background: #f8fbff;
    color: #94a3b8;
    border-color: rgba(15, 34, 57, 0.05);
    box-shadow: none;
    pointer-events: none;
}

@media (max-width: 576px) {
    .pagination .page-link {
        min-width: 40px;
        height: 40px;
        padding: .55rem .8rem;
        border-radius: 12px;
    }
}
