* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    background: #f5f7fa;
}

/* ============================================
   Layout
   ============================================ */
:root {
    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
}
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #1a1d2e;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(102,126,234,.18), transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(118,75,162,.12), transparent 50%);
    color: #cbd5e0;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}
.sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .sidebar-menu { padding: 14px 8px; }
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 11px 0;
    border-radius: 10px;
}
.sidebar.collapsed .menu-item:hover { transform: translateX(0) scale(1.05); }
.sidebar.collapsed .menu-text,
.sidebar.collapsed .menu-caret,
.sidebar.collapsed .menu-badge,
.sidebar.collapsed .submenu,
.sidebar.collapsed .brand-text {
    display: none !important;
}
.sidebar.collapsed .menu-group > .menu-item.parent {
    justify-content: center;
}
.sidebar.collapsed .menu-item.active::before {
    left: 0;
    width: 3px;
}
.sidebar.collapsed .sidebar-footer-inner span { display: none; }
.sidebar.collapsed .sidebar-footer-inner { justify-content: center; }
.sidebar.collapsed .brand-inner { justify-content: center; width: 100%; }
.sidebar.collapsed .sidebar-brand { padding: 18px 12px; justify-content: center; }
.sidebar.collapsed .menu-item { position: relative; }
.sidebar.collapsed .menu-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: #2d3748;
    color: #fff;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all .18s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    z-index: 300;
}
.sidebar.collapsed .menu-item::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px) rotate(45deg);
    width: 8px; height: 8px;
    background: #2d3748;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
    z-index: 300;
}
.sidebar.collapsed .menu-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.sidebar.collapsed .menu-item:hover::before {
    opacity: 1;
}

.sidebar-brand {
    padding: 20px 22px;
    background: rgba(0,0,0,.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 10px;
}
.brand-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.brand-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    transition: opacity .2s;
}
.brand-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.sidebar-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    background: rgba(255,255,255,.06);
    border: none;
    color: #a0aec0;
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
}
.sidebar-collapse:hover {
    background: rgba(102,126,234,.25);
    color: #a5b4fc;
}
.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
    flex-shrink: 0;
}
.sidebar-close {
    display: none;
    background: none; border: none; color: #a0aec0;
    font-size: 20px; cursor: pointer; padding: 4px 8px;
    line-height: 1;
}
.sidebar-close:hover { color: #fff; }

.sidebar-menu {
    list-style: none;
    padding: 18px 10px;
    flex: 1;
    overflow-y: auto;
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 3px;
    color: #a0aec0;
    text-decoration: none;
    border-radius: 10px;
    transition: all .22s cubic-bezier(.4,0,.2,1);
    position: relative;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
}
.menu-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
    transform: translateX(3px);
}
.menu-item.active {
    background: linear-gradient(135deg, rgba(102,126,234,.38), rgba(118,75,162,.28));
    color: #fff;
    border-color: rgba(139,92,246,.55);
    box-shadow: 0 4px 16px rgba(102,126,234,.25), inset 0 0 0 1px rgba(255,255,255,.06);
    font-weight: 600;
}
.menu-item.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 26px;
    border-radius: 3px;
    background: linear-gradient(180deg, #818cf8, #a855f7);
    box-shadow: 0 0 14px rgba(139,92,246,.7);
}
.menu-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(255,255,255,.04);
    flex-shrink: 0;
    color: #a0aec0;
    transition: all .22s;
}
.menu-item:hover .menu-icon {
    background: rgba(102,126,234,.22);
    color: #a5b4fc;
    transform: scale(1.06);
}
.menu-item.active .menu-icon {
    background: linear-gradient(135deg, rgba(102,126,234,.55), rgba(118,75,162,.45));
    color: #fff;
    box-shadow: 0 4px 12px rgba(102,126,234,.5);
}
.menu-text { flex: 1; }
.menu-caret {
    font-size: 10px;
    color: #718096;
    transition: transform .25s cubic-bezier(.4,0,.2,1), color .2s;
    display: inline-block;
    line-height: 1;
    margin-left: 2px;
}
.menu-item.parent:hover .menu-caret { color: #c7d2fe; }
.menu-group.open > .menu-item.parent .menu-caret {
    transform: rotate(180deg);
    color: #a5b4fc;
}

.menu-group { list-style: none; }
.menu-group > .menu-item.parent {
    cursor: pointer;
}
.menu-group > .menu-item.parent.active-parent {
    background: linear-gradient(135deg, rgba(102,126,234,.38), rgba(118,75,162,.28));
    color: #fff;
    border-color: rgba(139,92,246,.55);
    box-shadow: 0 4px 16px rgba(102,126,234,.25), inset 0 0 0 1px rgba(255,255,255,.06);
    font-weight: 600;
}
.menu-group > .menu-item.parent.active-parent::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 26px;
    border-radius: 3px;
    background: linear-gradient(180deg, #818cf8, #a855f7);
    box-shadow: 0 0 14px rgba(139,92,246,.7);
}
.menu-group > .menu-item.parent.active-parent .menu-icon {
    background: linear-gradient(135deg, rgba(102,126,234,.55), rgba(118,75,162,.45));
    color: #fff;
    box-shadow: 0 4px 12px rgba(102,126,234,.5);
}
.menu-group > .menu-item.parent.active-parent .menu-caret {
    transform: rotate(180deg);
    color: #a5b4fc;
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s cubic-bezier(.4,0,.2,1), padding .25s ease;
}
.menu-group.open > .submenu {
    max-height: 500px;
}
.submenu > li {
    position: relative;
}
.submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px 9px 56px;
    margin: 1px 6px;
    color: #a0aec0;
    text-decoration: none;
    border-radius: 8px;
    font-size: 12.5px;
    transition: all .2s ease;
    position: relative;
}
.submenu-item::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255,255,255,.06);
    pointer-events: none;
}
.submenu-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4a5568;
    flex-shrink: 0;
    transition: all .2s;
    position: relative;
    z-index: 1;
}
.submenu-item:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    padding-left: 60px;
}
.submenu-item:hover .submenu-dot { background: #a5b4fc; transform: scale(1.3); }
.submenu-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(102,126,234,.3), rgba(118,75,162,.2));
    font-weight: 600;
}
.submenu-item.active .submenu-dot {
    background: linear-gradient(135deg, #818cf8, #a855f7);
    box-shadow: 0 0 10px rgba(139,92,246,.7);
    transform: scale(1.4);
}
.submenu-item.active::before {
    background: linear-gradient(180deg, #818cf8, transparent);
}

.menu-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}
.badge-users {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
}

.sidebar-footer {
    padding: 14px 20px;
    background: rgba(0,0,0,.2);
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,.05);
}
.sidebar-footer-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #718096;
    font-size: 12px;
}
.footer-status {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #48bb78;
    box-shadow: 0 0 0 3px rgba(72,187,120,.2);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 3px rgba(72,187,120,.2); }
    50%      { box-shadow: 0 0 0 5px rgba(72,187,120,.08); }
}

.main { flex: 1; display: flex; flex-direction: column; margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .3s cubic-bezier(.4,0,.2,1); }
.navbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    position: sticky;
    top: 0;
    z-index: 50;
}
.navbar-left {
    color: #718096; font-size: 13px;
    display: flex; align-items: center; gap: 12px;
}
.navbar-right { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
    display: none;
    background: none; border: none;
    width: 36px; height: 36px;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: space-around;
}
.menu-toggle span {
    display: block;
    height: 2px; width: 100%;
    background: #4a5568;
    border-radius: 2px;
    transition: all .3s;
}

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 150;
    opacity: 0;
    transition: opacity .3s;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

/* ============================================
   User Dropdown
   ============================================ */
.user-dropdown { position: relative; }
.user-dropdown-trigger {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 6px 10px; border-radius: 6px;
    transition: background .2s; color: #4a5568;
}
.user-dropdown-trigger:hover { background: #f7fafc; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px;
    flex-shrink: 0;
}
.dropdown-caret {
    width: 0; height: 0; border-left: 4px solid transparent;
    border-right: 4px solid transparent; border-top: 5px solid #a0aec0;
    margin-left: 4px; transition: transform .2s;
}
.user-dropdown.open .dropdown-caret { transform: rotate(180deg); }
.user-dropdown-menu {
    position: absolute; right: 0; top: 46px;
    min-width: 160px; background: #fff;
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 6px 0; list-style: none;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: all .18s ease; z-index: 100;
}
.user-dropdown.open .user-dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.user-dropdown-menu::before {
    content: ''; position: absolute; top: -6px; right: 20px;
    width: 10px; height: 10px; background: #fff;
    transform: rotate(45deg); box-shadow: -2px -2px 4px rgba(0,0,0,.06);
}
.user-dropdown-menu li a, .user-dropdown-menu li button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 18px; border: none;
    background: none; text-align: left; font-size: 13px;
    color: #4a5568; cursor: pointer; text-decoration: none;
    transition: background .15s;
}
.user-dropdown-menu li a:hover, .user-dropdown-menu li button:hover {
    background: #f7fafc; color: #667eea;
}
.user-dropdown-menu li.divider {
    height: 1px; background: #edf2f7; margin: 6px 0;
}
.user-dropdown-menu li.danger button:hover { color: #e53e3e; }

/* ============================================
   Content / Card / Alert
   ============================================ */
.content { padding: 24px; flex: 1; }

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 24px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf2f7;
}

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }
.alert-error { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .2s ease;
    line-height: 1;
    user-select: none;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-lg { padding: 12px 34px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 5px; }

.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; box-shadow: 0 2px 6px rgba(102,126,234,.25); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(102,126,234,.4); }

.btn-default { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-default:hover { background: #e2e8f0; color: #334155; box-shadow: 0 2px 6px rgba(0,0,0,.06); }

.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }

.btn-danger { background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); color: #fff; box-shadow: 0 2px 6px rgba(239,68,68,.25); }
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239,68,68,.4); }

.btn-warning { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: #fff; box-shadow: 0 2px 6px rgba(245,158,11,.25); }
.btn-warning:hover { box-shadow: 0 4px 14px rgba(245,158,11,.4); }

.btn-info { background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%); color: #fff; box-shadow: 0 2px 6px rgba(59,130,246,.25); }
.btn-info:hover { box-shadow: 0 4px 14px rgba(59,130,246,.4); }

.btn-success { background: linear-gradient(135deg, #34d399 0%, #10b981 100%); color: #fff; box-shadow: 0 2px 6px rgba(16,185,129,.25); }
.btn-success:hover { box-shadow: 0 4px 14px rgba(16,185,129,.4); }

/* ============================================
   Forms
   ============================================ */
.form-box { max-width: 560px; }
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 13px; color: #4a5568;
    margin-bottom: 6px; font-weight: 500;
}
.form-group label .required { color: #e53e3e; margin-left: 2px; }
.form-group input, .form-group select {
    width: 100%; padding: 10px 14px;
    border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 14px; outline: none;
    transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}
.form-group .hint { font-size: 12px; color: #a0aec0; margin-top: 4px; }
.form-group .error { font-size: 12px; color: #e53e3e; margin-top: 4px; }
.form-group .radio-group { display: flex; gap: 20px; padding-top: 6px; }
.form-group .radio-group label { margin-bottom: 0; cursor: pointer; font-weight: normal; }
.form-group .radio-group input { width: auto; margin-right: 4px; }
.readonly { background: #f7fafc; color: #a0aec0; }

.option-editor {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    background: #fafbfc;
}
.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all .2s ease;
}
.option-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.option-item:last-child { margin-bottom: 0; }
.option-correct {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #667eea;
}
.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.option-content {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 8px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    border-bottom: 1px dashed transparent;
    transition: border-color .2s;
}
.option-content:focus {
    border-bottom-color: #667eea;
}
.option-item.is-correct .option-content {
    color: #15803d;
    font-weight: 500;
}
.option-remove {
    flex-shrink: 0;
}
.option-editor-footer {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.option-editor-hint {
    font-size: 12px;
    color: #64748b;
}

/* ============================================
   Index Page (toolbar / table)
   ============================================ */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 14px;
    flex-wrap: wrap;
}
.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.search-form input, .search-form select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    min-width: 160px;
}
.search-form input:focus, .search-form select:focus { border-color: #667eea; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
thead th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid #edf2f7;
}
tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
}
tbody tr:hover { background: #fafbfc; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-row td { text-align: center; color: #a0aec0; padding: 40px 0; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #c6f6d5; color: #276749; }
.badge-danger { background: #fed7d7; color: #c53030; }

.pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding: 14px 0 4px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 14px;
}
.pagination-info {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}
.pagination-info strong {
    color: #334155;
    font-weight: 600;
}

.pagination {
    display: flex;
    justify-content: flex-end;
    margin: 0;
    gap: 4px;
    list-style: none;
    padding: 0;
}
.pagination li { display: inline-flex; }
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    background: #fff;
    transition: all .22s cubic-bezier(.4,0,.2,1);
    line-height: 1;
    box-sizing: border-box;
}
.pagination li a:hover {
    border-color: #818cf8;
    color: #667eea;
    background: #f5f3ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(102,126,234,.22);
}
.pagination li.active span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(102,126,234,.35), 0 0 0 3px rgba(102,126,234,.12);
    font-weight: 600;
    transform: translateY(-1px);
}
.pagination li.disabled span,
.pagination li.disabled a {
    color: #cbd5e1;
    pointer-events: none;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #f1f5f9;
    transform: none;
    box-shadow: none;
}
.pagination li.ellipsis span {
    border: none;
    background: transparent;
    color: #94a3b8;
    box-shadow: none;
    min-width: auto;
    padding: 0 6px;
    transform: none;
}
.pagination li.previous a,
.pagination li.next a {
    padding: 0 16px;
    font-weight: 500;
}
.pagination li.previous a::before { content: '\003C\003C'; margin-right: 4px; font-size: 11px; opacity: .75; }
.pagination li.next a::after { content: '\003E\003E'; margin-left: 4px; font-size: 11px; opacity: .75; }

.current-user-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #667eea;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 6px;
}

/* ============================================
   Home Page
   ============================================ */
.welcome-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    padding: 28px;
    margin-bottom: 24px;
}
.welcome-box h2 { font-size: 22px; margin-bottom: 8px; }
.welcome-box p { opacity: .85; font-size: 14px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border-left: 4px solid #667eea;
}
.stat-card .label { color: #718096; font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #2d3748; }
.stat-card.purple { border-left-color: #9f7aea; }
.stat-card.green  { border-left-color: #48bb78; }
.stat-card.orange { border-left-color: #ed8936; }

.info-list { list-style: none; }
.info-list li {
    padding: 10px 0;
    border-bottom: 1px dashed #edf2f7;
    display: flex;
    justify-content: space-between;
}
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: #718096; }
.info-list .value { color: #2d3748; font-weight: 500; }

/* ============================================
   Login Page (standalone)
   ============================================ */
body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    width: 400px;
    max-width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
    overflow: hidden;
}
.login-header {
    background: #2d3748;
    padding: 30px 20px;
    text-align: center;
    color: #fff;
}
.login-header h1 { font-size: 22px; font-weight: 600; }
.login-header p { font-size: 13px; opacity: .7; margin-top: 6px; }
.login-body { padding: 35px 40px; }
body.login-page .form-group input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.15); }
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
    color: #718096;
}
.form-check input { margin-right: 8px; }
body.login-page .btn-primary { width: 100%; padding: 12px; font-size: 15px; }
.error-list { list-style: none; }
.error-list li { padding: 3px 0; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
    .sidebar.open { transform: translateX(0); }
    .sidebar.collapsed { width: var(--sidebar-w); }
    .sidebar-close { display: block; }
    .main { margin-left: 0; }
    .menu-toggle { display: flex; }
}

@media (max-width: 768px) {
    .navbar { padding: 0 14px; height: 52px; }
    .navbar-left .breadcrumb-text { display: none; }
    .user-dropdown-trigger span { display: none; }
    .user-dropdown-trigger { padding: 4px; }
    .dropdown-caret { display: none; }
    .content { padding: 14px; }
    .card { padding: 16px; border-radius: 8px; }
    .user-dropdown-menu { right: -40px; top: 48px; min-width: 180px; }
    .user-dropdown-menu::before { right: 28px; }

    .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .search-form { width: 100%; }
    .search-form input, .search-form select { flex: 1; min-width: 0; }
    .btn-primary:last-child { display: block; text-align: center; }

    table { font-size: 12px; min-width: 760px; }
    thead th, tbody td { padding: 10px 10px; }
    .table-actions { gap: 4px; }
    .pagination-wrap { justify-content: center; padding-top: 12px; }
    .pagination-info { width: 100%; text-align: center; font-size: 12px; }
    .pagination { justify-content: center; flex-wrap: wrap; gap: 4px; }
    .pagination li a, .pagination li span { min-width: 32px; height: 32px; padding: 0 10px; font-size: 12px; }
    .pagination li.previous a::before,
    .pagination li.next a::after { display: none; }

    .login-body { padding: 28px 24px; }
    .welcome-box { padding: 22px; }
    .welcome-box h2 { font-size: 18px; }
    .stat-card { padding: 18px; }
    .stat-card .value { font-size: 22px; }
}

@media (max-width: 480px) {
    body { font-size: 13px; }
    .content { padding: 12px; }
    .card { padding: 14px; border-radius: 6px; }
    .navbar-right { gap: 8px; }
    .user-avatar { width: 32px; height: 32px; font-size: 13px; }
    .form-box { max-width: 100%; }
}

/* ============================================
   User Cell (table)
   ============================================ */
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-img {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0; background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    color: #718096; font-weight: 600; font-size: 14px;
}
.avatar-img.big { width: 90px; height: 90px; font-size: 36px; border-radius: 12px; }
.user-cell-info { min-width: 0; }
.user-name { font-weight: 500; color: #2d3748; }
.user-openid { font-family: monospace; font-size: 11px; }

/* ============================================
   Form Sections
   ============================================ */
.form-section-title {
    font-size: 13px; font-weight: 600; color: #4a5568;
    margin: 18px 0 10px; padding-left: 10px;
    border-left: 3px solid #4a7cf7;
}
.form-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
}
.form-grid .full { grid-column: 1 / -1; }
textarea {
    width: 100%; padding: 10px 14px;
    border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 14px; outline: none; resize: vertical;
    transition: border-color .2s; font-family: inherit;
}
textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

/* ============================================
   User Detail Page
   ============================================ */
.user-detail-top {
    display: flex; gap: 24px; align-items: center;
    flex-wrap: wrap; margin-bottom: 16px;
}
.user-detail-avatar img,
.user-detail-avatar .default-avatar {
    width: 100px; height: 100px; border-radius: 12px;
    object-fit: cover; background: #edf2f7;
    display: flex; align-items: center; justify-content: center;
    font-size: 42px; color: #a0aec0; font-weight: 600;
}
.user-detail-info { flex: 1; min-width: 200px; }
.user-detail-info h2 { margin-bottom: 8px; }
.user-detail-meta { margin-bottom: 6px; font-size: 13px; color: #718096; }
.user-detail-meta .divider { margin: 0 8px; color: #cbd5e0; }
.user-bio {
    margin-top: 8px; color: #4a5568; font-size: 13px;
    padding: 8px 12px; background: #f7fafc;
    border-radius: 6px; max-width: 500px;
}
.user-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.action-block {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 0; border-bottom: 1px dashed #e2e8f0;
    flex-wrap: wrap;
}
.action-block:last-child { border-bottom: none; }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form input[type=number] {
    padding: 5px 10px; border: 1px solid #d1d5db;
    border-radius: 4px; font-size: 13px;
}
.mono { font-family: 'Courier New', monospace; font-size: 12px; }

.badge-warning { background: #fefcbf; color: #975a16; }
.badge-info { background: #bee3f8; color: #2c5282; }
.text-muted { color: #a0aec0; }
.small { font-size: 12px; }

@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .user-detail-top { flex-direction: column; align-items: flex-start; }
}

/* ============================================
   Avatar Upload & Cropping
   ============================================ */
.avatar-upload-wrap {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.avatar-preview {
    width: 96px; height: 96px; border-radius: 50%;
    background: #edf2f7; border: 2px solid #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview .avatar-placeholder {
    font-size: 36px; color: #a0aec0; font-weight: 600;
}
.avatar-actions { display: flex; flex-direction: column; gap: 8px; }
.avatar-actions .btn { margin: 0; }
.avatar-url-input { margin-top: 10px; }

.cropper-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.65);
    display: none; align-items: center; justify-content: center;
    z-index: 9999;
}
.cropper-modal-backdrop.show { display: flex; }
.cropper-modal {
    background: #fff; border-radius: 12px; padding: 20px;
    width: 90%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.cropper-modal h3 { margin: 0 0 14px; font-size: 16px; color: #2d3748; }
.cropper-canvas-wrap {
    width: 100%; max-height: 360px; overflow: hidden;
    background: #f7fafc; border-radius: 8px; margin-bottom: 16px;
}
.cropper-canvas-wrap img { max-width: 100%; display: block; }
.cropper-modal-actions {
    display: flex; gap: 10px; justify-content: flex-end;
}
.cropper-modal-actions .btn { margin: 0; }
