/* M3 · 1Bit design system.
 * Source: m1_brand_guideline_kv.html (Foundations, Shell, Tables, Tokens)
 * and m1_wireframe_full.html (Global layout, Forms, Responsive).
 * Shared values retain M3 component names to preserve existing interactions.
 */
:root {
 --primary:#5747f2; --primary-dark:#4836d6; --primary-light:#eeecff; --primary-bg:#eeecff; --primary-line:#cbc6ff; --primary-2:#7558ff;
 --success:#0b8f78; --success-bg:#edf9f6; --danger:#ef4056; --danger-bg:#fff0f3;
 --warning:#f27a24; --warning-bg:#fff6ee; --info:#1599e7; --info-bg:#eaf4fc;
 --purple:#7558ff; --purple-bg:#f0efff; --pink:#ef4056; --pink-bg:#fff0f3;
 --blue:#1599e7; --teal:#0b8f78; --green:#119b70; --amber:#f59e0b; --orange:#f27a24; --rose:#ef4056;
 --bg-body:#f6f8fc; --bg-sidebar:#f7f9fd; --bg-card:#fff; --bg-header:#fbfcff; --bg-input:#fff;
 --bg-hover:#eeecff; --bg-selected:#eeecff; --bg-subtle:#fbfcff; --bg-secondary:#f6f8fc;
 --text-primary:#111827; --text-secondary:#314158; --text-muted:#71829d;
 --border:#d8e1ef; --border-color:#d8e1ef; --border-subtle:#d8e1ef; --border-strong:#cbd6e6; --border-focus:#5747f2;
 --radius:12px; --radius-xs:8px; --radius-sm:12px; --radius-md:18px; --radius-lg:20px; --radius-xl:24px; --radius-full:9999px;
 --shadow-xs:none; --shadow-sm:0 8px 24px -20px rgba(31,51,89,.28); --shadow-md:0 20px 54px -42px rgba(31,51,89,.3);
 --shadow-lg:0 20px 54px -32px rgba(31,51,89,.3); --shadow-inset:none;
 --transition-fast:.15s ease; --transition-base:.2s ease;
 --sidebar-width:236px; --header-height:76px;
 --facebook:#1877f2; --facebook-soft:#eaf2ff;
}
[data-theme="dark"] {
 color-scheme:dark;
 --bg-body:#080b16; --bg-card:#111625; --bg-subtle:#0d1220; --bg-sidebar:#0d1220; --bg-header:#0d1220; --bg-input:#111625; --bg-secondary:#0d1220;
 --border:#273047; --border-color:#273047; --border-subtle:#273047; --border-strong:#37435f;
 --text-primary:#f8fafc; --text-secondary:#d5dcec; --text-muted:#8996b0;
 --primary-light:#24204a; --primary-bg:#24204a; --primary-line:#4f46a4; --primary-2:#9373ff; --bg-hover:#24204a; --bg-selected:#24204a;
 --purple-bg:#211e43; --success-bg:#122c2b; --warning-bg:#322419; --danger-bg:#351d27; --pink-bg:#351d27; --info-bg:#122638; --facebook-soft:#14243e;
 --blue:#38bdf8; --teal:#2dd4bf; --green:#34d399; --amber:#fbbf24; --orange:#fb923c; --rose:#f43f5e;
 --shadow-sm:0 10px 28px -20px rgba(0,0,0,.8); --shadow-md:0 24px 70px -44px rgba(0,0,0,.9); --shadow-lg:0 24px 70px -34px rgba(0,0,0,.9);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.55;
    transition: background-color 0.3s ease, color 0.3s ease;
}

input, textarea, select, button, a, th, td, label, span, div, p, h1, h2, h3, h4, h5, h6, li {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.sidebar, .header, .card, .stat-card, .dropdown-menu, .form-control {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-dark);
}

/* --- Typography Scale --- */
h1, h2, h3, h4, h5, h6, .page-title {
    letter-spacing: -0.025em;
    color: var(--text-primary);
    font-weight: 700;
}
.page-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.3;
}

/* --- Layout --- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s ease;
}
.app-content {
    flex: 1;
    padding: 28px 36px;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-x: hidden;
    box-shadow: none;
}
[data-theme="dark"] .sidebar {
    box-shadow: none;
}
.sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.sidebar-logo svg {
    color: var(--primary);
    filter: none;
}
.sidebar-toggle {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.1);
}
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}
.sidebar-menu {
    list-style: none;
}
.menu-heading {
    padding: 16px 14px 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.menu-item {
    margin-bottom: 4px;
}
.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}
.menu-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: none;
}
.menu-link.active {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 600;
    border-color: rgba(87, 71, 242, 0.12);
    box-shadow: none;
}
[data-theme="dark"] .menu-link.active {
    background: var(--primary-bg);
    border-color: rgba(87, 71, 242, 0.15);
}
.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(45, 52, 54, 0.04);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}
[data-theme="dark"] .menu-icon {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}
.menu-link:hover .menu-icon {
    color: var(--primary);
    background: rgba(87, 71, 242, 0.12);
    transform: none;
}
.menu-link.active .menu-icon {
    color: #ffffff;
    background: var(--primary);
    box-shadow: none;
}

/* --- Header --- */
.header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: none;
}
[data-theme="dark"] .header {
    box-shadow: none;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
}
.breadcrumb a {
    color: var(--text-muted);
    transition: color 0.2s ease;
}
.breadcrumb a:hover {
    color: var(--primary);
}
.breadcrumb .separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* User Dropdown */
.user-dropdown { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: none;
}
.user-btn:hover {
    background: var(--bg-hover);
    box-shadow: none;
    transform: none;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    box-shadow: none;
}
.user-info { text-align: left; }
.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
}
.user-role {
    font-size: 0.6875rem;
    color: var(--text-muted);
}
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-width: 200px;
    box-shadow: none;
    display: none;
    z-index: 200;
    padding: 6px;
    animation: panelIn 0.25s ease;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: none;
}

/* Quota Badge */
.quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--primary-bg);
    box-shadow: none;
}

/* Notification Dropdown */
.notification-dropdown {
    position: relative;
}
.notification-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.notification-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger, #ef4444);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9999px;
    padding: 0 4px;
    box-shadow: 0 0 0 2px var(--bg-card);
}
.notification-menu {
    position: absolute;
    right: -60px;
    top: calc(100% + 10px);
    width: 440px;
    max-width: calc(100vw - 32px);
    padding: 0;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 14px);
    box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 200;
    display: none;
    animation: panelIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.notification-menu.show {
    display: block;
}
.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
}
.notification-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.notification-title {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}
.notification-count-tag {
    font-size: 0.6875rem;
    background: var(--primary-bg, rgba(24, 119, 242, 0.1));
    color: var(--primary);
    padding: 2px 7px;
    border-radius: 9999px;
    font-weight: 600;
}
.notification-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8125rem;
    cursor: pointer;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.notification-mark-all:hover {
    background: rgba(24, 119, 242, 0.08);
    text-decoration: none;
}
.notification-list {
    max-height: 380px;
    overflow-y: auto;
}
.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    position: relative;
    align-items: flex-start;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background: var(--bg-hover);
}
.notification-item.unread {
    background: rgba(24, 119, 242, 0.04);
}
.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 20px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
.notification-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-bg, rgba(24, 119, 242, 0.1));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    margin-top: 1px;
}
.notification-item-body {
    flex: 1;
    min-width: 0;
}
.notification-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}
.notification-item-title {
    font-weight: 600;
    font-size: 0.84375rem;
    color: var(--text-primary);
    line-height: 1.35;
}
.notification-item-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.notification-item-msg {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.notification-empty {
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
}
.notification-empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--bg-subtle, rgba(0, 0, 0, 0.03));
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 22px;
}
.notification-empty-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}
.notification-empty-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}
.notification-loading {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
    text-align: center;
}
.notification-footer-link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}
.notification-footer-link:hover {
    color: var(--primary-hover, #1565c0);
}

@media (max-width: 576px) {
    .notification-menu {
        width: calc(100vw - 24px);
        right: -50px;
    }
}

/* --- Cards & Containers --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: none;
    overflow: hidden;
    transition: all 0.3s ease;
}
.card:hover {
    box-shadow: none;
    transform: none;
}
.card-header {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}
.card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}
.card-body {
    padding: 24px;
}
.card-body.p-0 { padding: 0; }
.card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    background: transparent;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 22px 24px;
    box-shadow: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.stat-card:hover {
    box-shadow: none;
    transform: none;
}
.stat-card:hover::before {
    opacity: 1;
}
[data-theme="dark"] .stat-card:hover {
    border-color: rgba(87, 71, 242, 0.15);
}
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin-top: 12px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}
.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

/* Compact Professional Metric Cards */
.metrics-grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (max-width: 1240px) {
    .metrics-grid-6 {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}
@media (max-width: 640px) {
    .metrics-grid-6 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* 8 Metric Cards Grid (Balanced 4x2 on standard desktop, 8x1 on wide) */
.metrics-grid-8 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (min-width: 1440px) {
    .metrics-grid-8 {
        grid-template-columns: repeat(8, 1fr);
    }
}
@media (max-width: 960px) {
    .metrics-grid-8 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}
@media (max-width: 480px) {
    .metrics-grid-8 {
        grid-template-columns: 1fr;
    }
}

.metric-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 13px 15px;
    box-shadow: none;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 102px;
}
.metric-box:hover {
    box-shadow: none;
    transform: none;
    border-color: rgba(87, 71, 242, 0.25);
}
.metric-box-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.metric-box-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.metric-box-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.metric-box-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 4px 0 2px;
    letter-spacing: -0.02em;
}
.metric-box-sub {
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Database Tables --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
thead th {
    padding: 12px 16px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    background: var(--bg-subtle);
}
thead th:first-child {
    border-top-left-radius: var(--radius-md);
}
thead th:last-child {
    border-top-right-radius: var(--radius-md);
}
tbody td {
    padding: 13px 16px;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr {
    transition: all 0.15s ease;
}
tbody tr:hover {
    background: var(--bg-hover);
}
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-name { font-weight: 600; font-size: 0.8125rem; }
.user-cell-email { font-size: 0.75rem; color: var(--text-muted); }

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}
.table-responsive::-webkit-scrollbar {
    height: 8px;
}
.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-subtle);
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- Forms --- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.form-label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.25s ease;
    outline: none;
    box-shadow: none;
}
.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: none;
}
.form-control::placeholder {
    color: var(--text-muted);
}
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}
select.form-control {
    cursor: pointer;
    appearance: none;
    padding-right: 36px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636E72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px 12px !important;
}

/* Checkbox */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"], input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: var(--radius-xs);
}

/* Password Toggle Wrapper */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.password-wrapper .form-control {
    padding-right: 42px;
}
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: color 0.2s ease, background-color 0.2s ease;
    z-index: 2;
}
.password-toggle:hover {
    color: var(--primary);
    background: var(--bg-hover);
}
.password-toggle:focus {
    outline: none;
    color: var(--primary);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    line-height: 1.4;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}
.btn:hover {
    transform: none;
    box-shadow: none;
}
.btn:active {
    transform: none;
    box-shadow: none;
}
.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: none;
}
.btn-primary:hover {
    background: var(--primary);
    color: #ffffff;
    box-shadow: none;
}
.btn-success {
    background: var(--success);
    color: #ffffff;
    box-shadow: none;
}
.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: none;
}
.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
    box-shadow: none;
}
.btn-outline {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    box-shadow: none;
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
    box-shadow: none;
}
[data-theme="dark"] .btn-outline:hover {
    border-color: var(--primary);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: none;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 0.75rem;
    border-radius: var(--radius-xs);
}
.btn-xs {
    padding: 4px 10px;
    font-size: 0.6875rem;
    border-radius: var(--radius-xs);
}
.btn-lg {
    padding: 12px 24px;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
}
.w-100 { width: 100%; justify-content: center; }
.btn:disabled, .btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none;
}

/* --- Soft Pastel Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: none;
}
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }

/* --- Alerts --- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 0.8125rem;
    line-height: 1.5;
    border: none;
    box-shadow: none;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* --- Avatars --- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: none;
}
.avatar-xs { width: 26px; height: 26px; font-size: 0.625rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.6875rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 0.9375rem; }
.avatar-xl { width: 56px; height: 56px; font-size: 1.125rem; }

/* --- Grid System --- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Utilities --- */
.d-flex { display: flex; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary) !important; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.p-0 { padding: 0; }

/* Sidebar Overlay */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(4px); z-index: 99; }

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 15, 15, 0.40);
    backdrop-filter: blur(8px) saturate(150%);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: none;
    animation: panelIn 0.3s ease;
}
.modal-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: none;
}
.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    transform: none;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

/* --- Tabs Component --- */
.tab-navigation {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: none;
    padding: 4px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}
.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    border-bottom: none;
    margin-bottom: 0;
    cursor: pointer;
    transition: all 0.25s ease;
    border-radius: var(--radius-sm);
}
.tab-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}
[data-theme="dark"] .tab-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.tab-item.active {
    color: var(--primary);
    background: var(--bg-card);
    font-weight: 700;
    box-shadow: none;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: contentIn 0.3s ease;
}

/* --- Pagination --- */
nav:has(.pagination),
.pagination,
ul.pagination {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
}
ul.pagination li {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-block;
}
.pagination a,
.pagination span,
ul.pagination li a,
ul.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    box-shadow: none;
}
.pagination a:hover,
ul.pagination li a:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: rgba(87, 71, 242, 0.2);
    transform: none;
    box-shadow: none;
}
.pagination .active a,
.pagination .active span,
ul.pagination li.active a,
ul.pagination li.active span {
    background: var(--primary);
    color: #ffffff !important;
    border-color: transparent !important;
    font-weight: 700;
    box-shadow: none;
}
.pagination .disabled a,
.pagination .disabled span,
ul.pagination li.disabled a,
ul.pagination li.disabled span {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
/* Reset span inside a (prevent double button styling on nav buttons like Sau/Trước) */
.pagination a > span,
ul.pagination li a > span {
    display: inline;
    min-width: unset;
    height: auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: inherit;
    white-space: nowrap;
}

/* --- Animations --- */
@keyframes contentIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes panelIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* --- Theme Toggle --- */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: none;
}
.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
    transform: none;
    box-shadow: none;
}
.theme-toggle .icon-sun, .theme-toggle .icon-moon {
    position: absolute;
    transition: all 0.35s ease;
}
.theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* --- Responsive --- */
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .app-main { margin-left: 0; }
    .mobile-menu-toggle { display: flex; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .header { padding: 0 16px; }
    .app-content { padding: 16px; }
    table { font-size: 0.75rem; }
    thead th, tbody td { padding: 10px 12px; }
    .tab-navigation { overflow-x: auto; flex-wrap: nowrap; }
    .tab-item { white-space: nowrap; flex-shrink: 0; }
}

/* --- Auth Layout --- */
.auth-page {
    background: var(--bg-body);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
}
.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: transparent;
    pointer-events: none;
}
[data-theme="dark"] .auth-page {
    background: var(--bg-body);
}
[data-theme="dark"] .auth-page::before {
    background: transparent;
}
.auth-theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
}
.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: none;
    padding: 40px 36px;
}
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}
.auth-logo-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: none;
}
.auth-logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}
.auth-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: -0.03em;
}
.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    text-align: center;
    line-height: 1.5;
}
.auth-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}
.auth-footer a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(87, 71, 242, 0.2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(87, 71, 242, 0.35); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(87, 71, 242, 0.2); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(87, 71, 242, 0.35); }

/* --- Modern Custom Popup Modal & Toast --- */
.custom-alert-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 15, 15, 0.40);
    backdrop-filter: blur(8px) saturate(150%);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.custom-alert-overlay.show {
    display: flex;
    opacity: 1;
}
.custom-alert-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    padding: 32px 28px;
    box-shadow: none;
    text-align: center;
    transform: scale(0.92);
    transition: transform 0.3s ease;
}
.custom-alert-overlay.show .custom-alert-box {
    transform: scale(1);
}
.custom-alert-icon {
    width: 62px;
    height: 62px;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 18px;
    box-shadow: none;
}
.custom-alert-icon.success {
    background: var(--primary);
    color: var(--success);
}
.custom-alert-icon.error {
    background: var(--primary);
    color: var(--danger);
}
.custom-alert-icon.warning {
    background: var(--primary);
    color: var(--warning);
}
.custom-alert-icon.info {
    background: var(--primary);
    color: var(--info);
}
.custom-alert-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.custom-alert-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 24px;
    word-break: break-word;
}
.custom-alert-btn {
    width: 100%;
    padding: 13px 20px;
    font-size: 0.9375rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: all 0.25s ease;
    box-shadow: none;
}
.custom-alert-btn:hover {
    background: var(--primary);
    transform: none;
    box-shadow: none;
}

/* --- Standardized Waiting Popup Modal --- */
body.modal-open {
    overflow: hidden !important;
}
.waiting-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 29, 0.72);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: all;
    user-select: none;
}
.waiting-modal-overlay.show {
    display: flex;
    opacity: 1;
}
.waiting-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 24px);
    width: 100%;
    max-width: 480px;
    padding: 36px 32px 30px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}
.waiting-modal-overlay.show .waiting-modal-box {
    transform: scale(1);
}
.waiting-spinner-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.waiting-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3.5px solid transparent;
    border-top-color: var(--primary, #5747f2);
    border-right-color: var(--primary, #5747f2);
    animation: waiting-spin 1.1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}
.waiting-spinner-ring:nth-child(2) {
    inset: 7px;
    border: 2.5px solid transparent;
    border-bottom-color: rgba(87, 71, 242, 0.5);
    border-left-color: rgba(87, 71, 242, 0.5);
    animation: waiting-spin 1.6s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite reverse;
}
.waiting-spinner-icon {
    font-size: 24px;
    color: var(--primary, #5747f2);
    animation: waiting-pulse 1.4s ease-in-out infinite;
}
@keyframes waiting-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes waiting-pulse {
    0%, 100% { transform: scale(0.9); opacity: 0.75; }
    50% { transform: scale(1.1); opacity: 1; }
}
.waiting-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 14px;
    letter-spacing: -0.02em;
}
.waiting-notice-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #d97706;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: left;
    line-height: 1.45;
}
[data-theme="dark"] .waiting-notice-banner {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}
.waiting-modal-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 16px;
    word-break: break-word;
}
.waiting-status-wrap {
    margin-bottom: 8px;
}
.waiting-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    font-family: var(--font-mono, monospace);
    font-size: 0.775rem;
    color: var(--text-secondary, #64748b);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.waiting-progress-info {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}
.waiting-progress-detail {
    color: var(--primary);
    font-family: var(--font-mono, monospace);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.01em;
}
.waiting-progress-percent {
    color: var(--text-muted);
    font-family: var(--font-mono, monospace);
    font-weight: 700;
}
.waiting-progress-track {
    width: 100%;
    height: 6px;
    background: var(--border-color, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-top: 6px;
}
.waiting-progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 45%;
    background: linear-gradient(90deg, var(--primary, #5747f2), #818cf8);
    border-radius: 8px;
    animation: waiting-progress-move 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.waiting-progress-bar.determinate {
    animation: none !important;
    left: 0 !important;
}
@keyframes waiting-progress-move {
    0% { left: -45%; }
    100% { left: 100%; }
}

/* Toast Container */
#toastContainer {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}
.custom-toast {
    pointer-events: auto;
    min-width: 320px;
    max-width: 440px;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 13px;
    font-size: 0.875rem;
    color: var(--text-primary);
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.25s ease;
}
.custom-toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    margin-top: 1px;
}
.custom-toast-close:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}
@keyframes toastSlideIn {
    from { transform: translateX(100%) scale(0.9); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}
.custom-toast.hide {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
}

/* Existing page-specific layout and state behavior */

/* app/Views/admin/fanpages.php */
.fp-preview-box {
    background: var(--bg-subtle);
    border: 1.5px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.fp-preview-header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.fp-preview-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.fp-preview-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.fp-preview-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.fp-preview-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 10px;
    line-height: 1.5;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* app/Views/admin/scan_profile.php */
/* Scan Profile Custom Styles */
.scan-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
@media (min-width: 1024px) {
    .scan-container {
        grid-template-columns: 380px 1fr;
        align-items: start;
    }
}
.scan-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}
.scan-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 0;
}
.token-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.token-row input {
    flex: 1;
    padding: 7px 10px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    background: var(--bg-card, #fff);
}
.token-badge-ok {
    background: #dcfce7;
    color: #15803d;
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.token-badge-err {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.log-terminal {
    background: #0f172a;
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 280px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.log-terminal-header {
    background: #1e293b;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #334155;
}
.log-terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.log-terminal-body {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    line-height: 1.6;
}
.log-ok { color: #4ade80; }
.log-warn { color: #facc15; }
.log-err { color: #f87171; }
.log-info { color: #60a5fa; }

.post-item-card {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--bg-card, #fff);
    transition: all 0.15s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.post-item-card:hover {
    border-color: var(--primary, #1877f2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.post-item-card.selected {
    background: rgba(24, 119, 242, 0.03);
    border-color: var(--primary, #1877f2);
}

/* app/Views/admin/config.php */
.config-tab-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    margin-bottom: 24px;
}
.config-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.config-tab-btn:hover {
    color: var(--primary, #3b82f6);
}
.config-tab-btn.active {
    color: var(--primary, #3b82f6);
    border-bottom-color: var(--primary, #3b82f6);
}
.config-tab-pane {
    display: none;
}
.config-tab-pane.active {
    display: block;
}

/* app/Views/admin/fanpage_detail.php */
.crawl-opt-box {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}
.crawl-opt-box:hover {
    border-color: var(--primary-light);
}
.crawl-opt-box.active {
    border-color: var(--primary);
    background: rgba(24, 119, 242, 0.03);
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.08);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* app/Views/admin/fb_accounts.php */
.fb-profile-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fb-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
table .fb-avatar {
    width: 36px !important;
    height: 36px !important;
}
.fb-avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}
.fb-profile-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.fb-profile-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
}
.fb-profile-uid {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: monospace;
}
.fb-credential-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 180px;
}
.credential-mask {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-copy {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-copy:hover {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-copy.copied {
    color: var(--success);
    border-color: var(--success);
}

/* app/Views/user/settings.php */
.settings-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}
.settings-grid > .card:last-child {
    grid-column: 1 / -1;
}
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
.avatar-preview {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto;
    border: 3px solid var(--border);
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}
.avatar-preview:hover {
    border-color: var(--primary);
}
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
}
.avatar-placeholder span {
    font-size: 0.75rem;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.card-body {
    padding: 20px;
}

/* app/Views/user/fanpages.php */
@keyframes spin { to { transform: rotate(360deg); } }