html {
    font-size: 14px;
}

body {
    font-size: 1rem;
    line-height: 1.6;
    color: #1f2937;
}

.content,
.sidebar,
.navbar,
.card,
.table,
.form-control,
.form-select,
.btn,
.dropdown-menu {
    font-size: 1rem;
}

.table th,
.table td {
    padding: .85rem .75rem;
}

.card-title {
    font-size: 1.08rem;
}

.form-label {
    font-size: .98rem;
    font-weight: 600;
}

.badge {
    font-size: .9rem;
}

.small,
small {
    font-size: .9rem;
}

.btn-sm {
    font-size: .92rem;
    padding: .35rem .6rem;
}

.h3,
h1.h3 {
    font-size: 1.65rem;
}

.sidebar-link,
.sidebar-brand {
    font-size: 1rem;
}

.sidebar-brand {
    background: rgba(0, 0, 0, .12);
}

.text-break {
    white-space: normal;
    word-break: break-word;
}

.text-ellipsis {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .94rem;
}

/* Login */
.login-simple-bg {
    min-height: 100vh;
    background: #eef2f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-simple-wrap {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-simple-card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 2.4rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
}

.login-simple-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: #3b7ddd;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: .04em;
    margin: 0 auto 1.2rem;
}

.login-simple-card h1 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: .3rem;
    font-weight: 800;
    color: #111827;
}

.login-subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 1.6rem;
}

.login-simple-foot {
    font-size: .86rem;
    color: #6c757d;
    text-align: center;
    margin-top: 1rem;
}

.login-simple-card .form-control {
    background: #f9fafb;
    border-color: #d1d5db;
}

.login-simple-card .form-control:focus {
    background: #fff;
}

.login-simple-card .btn {
    font-weight: 700;
}

/* Dashboard */
.stat-card .card-body {
    min-height: 132px;
}

.stat-card h1 {
    font-size: 2.1rem;
    margin: .35rem 0;
}

.stat-card span {
    color: #6c757d;
}

.chart-card canvas {
    max-width: 100%;
    height: auto;
}

.chart-card h2 {
    font-size: 1.65rem;
}

.system-info-table th {
    width: 150px;
    color: #4b5563;
}

.system-info-table td {
    word-break: break-all;
    color: #111827;
}

/* Topbar */
.admin-topbar-v8 {
    min-height: 58px;
    padding: .45rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .04);
}

.admin-menu-toggle-v8 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: .55rem;
    color: #495057;
    margin-right: 1rem;
}

.admin-menu-toggle-v8:hover {
    background: #f3f4f6;
}

.admin-navbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .45rem;
}

.admin-icon-item {
    display: flex;
    align-items: center;
}

.nav-icon-link {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
    color: #5f6b7a;
}

.nav-icon-link:hover {
    background: #f3f6fb;
    color: #3b7ddd;
}

.nav-icon-link svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
}

.admin-notify-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #3b7ddd;
    color: #fff;
    font-size: 11px;
    line-height: 17px;
    text-align: center;
    font-weight: 700;
}

.admin-user-dropdown {
    display: flex;
    align-items: center;
    margin-left: .15rem;
}

.admin-user-toggle {
    display: flex !important;
    align-items: center;
    gap: .55rem;
    padding: .25rem .35rem .25rem .45rem !important;
    color: #1f2937 !important;
    border-radius: .55rem;
}

.admin-user-toggle:hover {
    background: #f3f6fb;
}

.admin-avatar {
    width: 38px;
    height: 38px;
    border-radius: .35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b7ddd, #6f42c1);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .12);
}

.admin-user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: #1f2937;
}

.admin-user-menu {
    min-width: 140px;
}

/* Page title */
.page-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
}

.page-subtitle {
    margin-top: .25rem;
    color: #6b7280;
    font-size: .95rem;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.action-btn {
    min-width: 112px;
    font-weight: 700;
    border-radius: .45rem;
}

.btn-danger.action-btn {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.btn-danger.action-btn:hover {
    background: #bb2d3b;
    border-color: #b02a37;
    color: #fff;
}

.admin-tip {
    border: 1px solid #ffe8a1;
    background: #fff8db;
    color: #5f4700;
    border-radius: .65rem;
    margin-bottom: 1rem;
}

/* Card */
.admin-card {
    border: 0;
    border-radius: .75rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
    margin-bottom: 1.15rem;
}

.admin-card-header {
    background: #fff;
    border-bottom: 1px solid #edf0f5;
    padding: 1rem 1.1rem;
}

.card.page-card-narrow {
    width: 100%;
}

/* Filter */
.filter-card .card-body {
    padding: 1.1rem;
}

.filter-card .form-label {
    font-weight: 700;
    color: #374151;
    margin-bottom: .35rem;
}

.filter-buttons {
    display: flex;
    gap: .6rem;
}

.filter-buttons .btn {
    min-width: 76px;
    font-weight: 700;
}

/* Table base */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table thead th {
    font-weight: 700;
    color: #374151;
    background: #f3f6fb;
}

.data-table tbody td {
    color: #1f2937;
}

.data-table .actions-col,
.data-table .actions-cell {
    text-align: right;
}

.action-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    white-space: nowrap;
}

.action-buttons form {
    margin: 0;
}

.admin-list-table {
    min-width: 1050px;
    table-layout: fixed;
}

/* User table: important */
.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #e5e7eb;
    border-radius: .65rem;
    background: #fff;
}

.users-table {
    min-width: 2200px;
    width: 2200px;
    table-layout: fixed;
    margin-bottom: 0;
}

.users-table th,
.users-table td {
    white-space: nowrap;
    vertical-align: middle;
    padding: .85rem .75rem;
    border-color: #edf0f5;
}

.users-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f3f6fb;
    color: #1f2937;
    font-weight: 800;
    font-size: .93rem;
    border-bottom: 1px solid #dfe5ef;
}

.users-table tbody td {
    color: #1f2937;
}

.users-table tbody tr:hover {
    background: #f8fbff;
}

/* Do NOT use display:inline-block on td. It breaks table alignment. */
.users-table td.table-long-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    min-width: 64px;
    padding: .42rem .55rem;
    font-weight: 700;
}

.empty-table {
    text-align: center;
    color: #6b7280;
    padding: 2.2rem !important;
}

.admin-table-wrap::-webkit-scrollbar {
    height: 10px;
}

.admin-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.admin-table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
}

/* Pagination */
.pagination-bar {
    border-top: 1px solid #eef0f3;
    padding-top: 1rem;
}

.pagination .page-link {
    font-size: 16px;
    padding: .45rem .75rem;
}

.admin-pagination {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-pagination-info {
    color: #6b7280;
    font-size: .95rem;
    white-space: nowrap;
}

.admin-pagination-info strong {
    color: #111827;
    font-weight: 700;
}

.admin-pagination-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-page-size {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: #6b7280;
    font-size: .95rem;
    white-space: nowrap;
}

.admin-page-size-options {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .18rem;
    border: 1px solid #dbe2ea;
    border-radius: .55rem;
    background: #f8fafc;
}

.admin-page-size-link {
    min-width: 38px;
    height: 30px;
    padding: 0 .55rem;
    border-radius: .4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
}

.admin-page-size-link:hover {
    background: #eaf1ff;
    color: #3b7ddd;
    text-decoration: none;
}

.admin-page-size-link.active {
    background: #3b7ddd;
    color: #fff;
}

.admin-page-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    flex-wrap: wrap;
}

.admin-page-list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-page-link {
    min-width: 38px;
    height: 34px;
    padding: 0 .75rem;
    border: 1px solid #dbe2ea;
    border-radius: .5rem;
    background: #fff;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
}

.admin-page-link:hover {
    background: #eaf1ff;
    border-color: #bcd3ff;
    color: #3b7ddd;
    text-decoration: none;
}

.admin-page-link.active {
    background: #3b7ddd;
    border-color: #3b7ddd;
    color: #fff;
}

.admin-page-link.disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-topbar-v8 {
        padding: .45rem .75rem;
    }

    .admin-user-name {
        display: none;
    }

    .admin-navbar-actions {
        gap: .25rem;
    }

    .nav-icon-link {
        width: 34px;
        height: 34px;
    }

    .admin-avatar {
        width: 34px;
        height: 34px;
    }

    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .action-btn {
        min-width: 104px;
    }

    .filter-buttons {
        width: 100%;
    }

    .admin-pagination {
        align-items: flex-start;
    }

    .admin-pagination-right {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .admin-page-size {
        width: 100%;
    }

    .admin-page-list {
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .login-simple-card {
        padding: 1.5rem;
        border-radius: 14px;
    }

    .login-simple-wrap {
        padding: 1rem;
    }

    .logout-btn {
        padding: .3rem .5rem;
    }
}