/* Navbar (Invision Community style) */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-top: 3px solid var(--accent);
    z-index: 1000;
    box-shadow: var(--shadow-md);
    transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    min-width: 0;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.navbar-logo:hover {
    opacity: 0.8;
}

.navbar-logo-img{
    width:42px;
    height:42px;
    object-fit:contain;
    display:block;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(47,215,215,0.25);
}

.logo-text-nav {
    font-size: 18px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.navbar-logo-mini {
    margin-right: 20px;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}
.navbar-logo-mini .navbar-logo-img {
    width: 32px;
    height: 32px;
}
.navbar-logo-mini .logo-text-nav {
    font-size: 15px;
}
@media (max-width: 768px) {
    .navbar-logo-mini .logo-text-nav { display: none; }
    .navbar-logo-mini { margin-right: 10px; padding-right: 10px; }
}

.nav-links,
.navbar-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.nav-link i {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.badge-pm-nav,
.badge-pm-dropdown {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.user-dropdown-toggle:hover {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.user-dropdown-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.user-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown-avatar span {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.user-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: var(--transition);
}

.user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
    z-index: 1001;
    overflow: hidden;
}

.user-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-username {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.dropdown-role {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.dropdown-item-danger {
    color: var(--danger) !important;
}

.dropdown-item-danger:hover {
    background: rgba(240,71,71,0.1) !important;
    color: var(--danger) !important;
}

.badge-pm-dropdown {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.auth-buttons {
    display: flex;
    gap: 8px;
}

.auth-buttons .btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Mobile menu overlay */
.navbar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.navbar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.navbar-overlay.open + .top-navbar .navbar-left {
    transform: translateX(0);
}

/* Main content offset for fixed navbar */
.app-wrapper {
    padding-top: 64px;
}

.main-content {
    flex: 1;
    min-height: 100vh;
}

.top-bar {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .separator { font-size: 10px; color: var(--text-muted); }
.breadcrumb span { color: var(--text-primary); font-weight: 500; }

.top-bar-actions {
    margin-top: 12px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: rgba(67, 181, 129, 0.15);
    border: 1px solid rgba(67, 181, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(240, 71, 71, 0.15);
    border: 1px solid rgba(240, 71, 71, 0.3);
    color: var(--danger);
}

.content-area {
    padding: 30px;
}

/* Responsive */
@media (max-width: 1024px) {
    .navbar-links {
        position: fixed;
        top: 128px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 999;
        box-shadow: var(--shadow-lg);
    }
    
    .navbar-links.open {
        transform: translateX(0);
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }
    
    .navbar-toggle {
        display: flex;
    }
    
    .logo-text-nav {
        display: none;
    }
    
    .navbar-right .user-dropdown-name {
        display: none;
    }
    
    .navbar-right .auth-buttons .btn-outline {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .navbar-inner {
        padding: 0 16px;
    }
    
    .top-bar {
        padding: 16px;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .dropdown-menu {
        right: -16px;
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .navbar-logo .logo-text-nav {
        display: none;
    }
    
    .user-dropdown-name {
        display: none;
    }
    
    .auth-buttons .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}/* Chivil Forum - Invision-inspired Dark Theme (paleta tomada del logo: cian/turquesa) */
:root {
    --bg-primary: #0a1420;
    --bg-secondary: #0f1e2e;
    --bg-card: #122436;
    --bg-card-hover: #16293d;
    --bg-sidebar: #08121c;
    --bg-input: #0d1c2b;
    --border-color: #1c3346;
    --border-hover: #2a4b61;
    --text-primary: #eaf6f7;
    --text-secondary: #9db4c0;
    --text-muted: #62808f;
    --accent: #2fd7d7;
    --accent-hover: #24bcbc;
    --accent-glow: rgba(47, 215, 215, 0.15);
    --success: #34d399;
    --warning: #f5b942;
    --danger: #f1556c;
    --danger-hover: #d43e57;
    --gradient-1: linear-gradient(135deg, #2fd7d7 0%, #0ea5b7 100%);
    --gradient-2: linear-gradient(135deg, #5ee7df 0%, #2fd7d7 100%);
    --gradient-3: linear-gradient(135deg, #38bdf8 0%, #2fd7d7 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(47,215,215,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}
a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--accent-hover); }

/* Layout */
.app-wrapper {
    min-height: 100vh;
}

/* FIX: estas dos clases (usadas por includes/header.php) no tenían ninguna
   regla, así que el contenido no dejaba espacio para la barra de marca +
   el navbar fijos y quedaba tapado debajo de ellos. */
.app-container {
    min-height: 100vh;
}
.main-layout {
    padding-top: 64px; /* alto del navbar (única barra fija) */
    transition: padding-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* La barra de marca separada (logo + nombre) fue eliminada: el logo ahora
   vive dentro del propio .top-navbar (ver .navbar-logo-mini), que es la
   única barra fija y siempre queda estática arriba de la página. */

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--gradient-1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(47,215,215,0.25);
}
.logo-text {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-card); }

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-section {
    padding: 16px 12px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.badge-pm {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}
.user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.user-mini:hover { background: var(--bg-card); }
.user-mini-avatar span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}
.user-mini-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.user-mini-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-mini-role { font-size: 11px; font-weight: 600; }
.user-mini-logout {
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.user-mini-logout:hover { color: var(--danger); background: rgba(240,71,71,0.1); }
.auth-buttons {
    display: flex;
    gap: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.top-bar {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .separator { font-size: 10px; color: var(--text-muted); }
.breadcrumb span { color: var(--text-primary); font-weight: 500; }

.content-area {
    flex: 1;
    min-height: 0;
    padding: 30px;
    display: flex;
    flex-direction: column;
}
.footer {
    padding: 16px 30px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}
.footer-version { color: var(--text-muted); font-size: 12px; }
.footer-social {
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-social a {
    color: var(--text-muted);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.02);
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.footer-social a:hover {
    color: #fff;
    border-color: transparent;
    background: var(--accent, #8b5cf6);
    transform: translateY(-2px);
}
@media (max-width: 640px) {
    .footer-content { flex-wrap: wrap; row-gap: 10px; justify-content: center; text-align: center; }
    .footer-social { order: 3; width: 100%; justify-content: center; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}
.btn-primary {
    background: var(--gradient-1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(47,215,215,0.25);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(47,215,215,0.35);
    color: #fff;
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
    color: #fff;
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent);
}
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control.error { border-color: var(--danger); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { cursor: pointer; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 2px solid transparent;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); border-top-color: var(--accent); }
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.card-body { padding: 20px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success {
    background: rgba(67, 181, 129, 0.15);
    border: 1px solid rgba(67, 181, 129, 0.3);
    color: var(--success);
}
.alert-error {
    background: rgba(240, 71, 71, 0.15);
    border: 1px solid rgba(240, 71, 71, 0.3);
    color: var(--danger);
}

/* Category Cards */
.category-list { display: flex; flex-direction: column; gap: 12px; }
.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}
.category-card:hover {
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}
.category-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    cursor: pointer;
}
.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.category-info { flex: 1; }
.category-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.category-desc {
    font-size: 13px;
    color: var(--text-muted);
}
.category-stats {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.category-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.category-stats i { font-size: 14px; }
.category-card-body {
    padding: 0 20px 16px 84px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.last-topic {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}
.last-topic-info {
    flex: 1;
    min-width: 0;
}
.last-topic-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.last-topic-meta {
    font-size: 12px;
    color: var(--text-muted);
}
.last-topic-avatar {
    flex-shrink: 0;
}
.last-topic-avatar span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

/* Topic List */
.topic-list { display: flex; flex-direction: column; gap: 2px; }
.topic-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 3px;
}
.topic-row:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.topic-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.topic-icon.pinned { background: rgba(250,166,26,0.15); color: var(--warning); }
.topic-icon.closed { background: rgba(240,71,71,0.15); color: var(--danger); }
.topic-icon.default { background: var(--accent-glow); color: var(--accent); }
.topic-main { flex: 1; min-width: 0; }
.topic-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topic-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.topic-meta a { color: var(--text-secondary); }
.topic-meta a:hover { color: var(--accent); }
.topic-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}
.topic-stat {
    text-align: center;
}
.topic-stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.topic-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.topic-last {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 140px;
}
.topic-last-avatar span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}
.topic-last-info { min-width: 0; }
.topic-last-user {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topic-last-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Post View */
.topic-view { display: flex; flex-direction: column; gap: 20px; }
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}
.post-card:hover { border-color: var(--border-hover); }
.post-card.highlighted { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.post-avatar {
    flex-shrink: 0;
}
.post-avatar span {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}
.post-author-info { flex: 1; }
.post-author-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.post-author-role {
    font-size: 11px;
    font-weight: 600;
}
.post-date {
    font-size: 12px;
    color: var(--text-muted);
}
.post-body {
    padding: 20px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
}
.post-body strong { color: var(--text-primary); }
.post-body code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}
.post-body pre {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border: 1px solid var(--border-color);
}
.post-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.post-actions {
    display: flex;
    gap: 8px;
}
.post-number {
    font-size: 12px;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------
   Vista de Tema: recuadros estilo foro clásico (sidebar de usuario
   + contenido), más compactos que un post-card genérico.
   Clases usadas en topic.php: post-card-forum, post-sidebar,
   forum-avatar, forum-badge, user-stats-box, post-main-content,
   post-meta-top, post-body, post-footer.
   --------------------------------------------------------------- */
.topic-view { gap: 10px; }

.post-card-forum {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
}
.post-card-forum:hover { border-color: var(--border-hover); }

.post-sidebar {
    width: 130px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px;
    padding: 14px 10px;
    background: var(--bg-input);
    border-right: 1px solid var(--border-color);
}

.forum-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}
.forum-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.forum-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    line-height: 1.6;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.user-stats-box {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

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

.post-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: rgba(255,255,255,0.015);
}

.post-card-forum .post-body {
    padding: 14px;
    font-size: 14px;
    line-height: 1.65;
    flex: 1;
}

.post-card-forum .post-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
}
.post-card-forum .post-footer .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

@media (max-width: 640px) {
    .post-card-forum { flex-direction: column; }
    .post-sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px 12px;
    }
    .forum-avatar { width: 36px; height: 36px; font-size: 14px; }
    .user-stats-box { display: none; }
}

/* Profile */
.profile-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}
.profile-cover {
    height: 200px;
    background: var(--gradient-1);
    position: relative;
}
.profile-info {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    padding: 0 30px 24px;
    margin-top: -60px;
}
.profile-avatar {
    border: 4px solid var(--bg-card);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    position: relative;
    background: var(--bg-secondary);
}
.profile-avatar img,
.profile-avatar span:not(.profile-online-dot) {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    color: #fff;
    object-fit: cover;
}
.profile-online-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
}
.profile-online-dot.is-online { background: var(--success); }
.profile-online-dot.is-offline { background: var(--text-muted); }
.profile-details { flex: 1; padding-top: 60px; min-width: 0; }
.profile-actions { padding-top: 60px; }
.profile-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin: 6px 0 4px;
}
.profile-meta-item {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-meta-item.is-online-text,
.profile-meta-item.is-online-text i { color: var(--success); }
.profile-signature {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 13px;
    border-left: 3px solid var(--border-color);
    padding-left: 10px;
    margin-top: 8px;
}
.profile-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.profile-name .badge {
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
}
.profile-role {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}
.profile-stats {
    display: flex;
    gap: 32px;
    margin-top: 12px;
}
.profile-stat {
    text-align: center;
}
.profile-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.profile-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 28px;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}
.auth-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--border-color);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Search */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.search-box .form-control { flex: 1; }

/* Members Grid */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.member-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.member-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
.member-avatar span,
.member-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    object-fit: cover;
    flex-shrink: 0;
}
.member-info { flex: 1; }
.member-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.member-role {
    font-size: 12px;
    font-weight: 600;
}
.member-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Admin Panel */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.stat-info { flex: 1; }
.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tables */
.table-container {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-input);
}
.table tr:hover td {
    background: var(--bg-card-hover);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.pagination .active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 800;
}
.page-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid currentColor;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 { font-size: 20px; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Avatar colors */
.avatar-1 { background: linear-gradient(135deg, #2fd7d7 0%, #0ea5b7 100%); }
.avatar-2 { background: linear-gradient(135deg, #38bdf8 0%, #2fd7d7 100%); }
.avatar-3 { background: linear-gradient(135deg, #5ee7df 0%, #0ea5b7 100%); }
.avatar-4 { background: linear-gradient(135deg, #34d399 0%, #2fd7d7 100%); }
.avatar-5 { background: linear-gradient(135deg, #818cf8 0%, #2fd7d7 100%); }
.avatar-6 { background: linear-gradient(135deg, #2fd7d7 0%, #38bdf8 100%); }
.avatar-7 { background: linear-gradient(135deg, #f5b942 0%, #2fd7d7 100%); }
.avatar-8 { background: linear-gradient(135deg, #94a3b8 0%, #2fd7d7 100%); }
.avatar-9 { background: linear-gradient(135deg, #f1556c 0%, #2fd7d7 100%); }
.avatar-10 { background: linear-gradient(135deg, #0ea5b7 0%, #0a1420 100%); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.open { display: block; }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 16px;
    }
    .category-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .category-stats {
        width: 100%;
        justify-content: space-around;
    }
    .category-card-body {
        padding-left: 20px;
    }
    .topic-row {
        flex-wrap: wrap;
    }
    .topic-stats {
        width: 100%;
        justify-content: space-around;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
    }
    .topic-last {
        display: none;
    }
    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-details {
        padding-top: 0;
    }
    .profile-actions {
        padding-top: 0;
    }
    .profile-meta-row {
        justify-content: center;
    }
    .profile-stats {
        justify-content: center;
    }
    .auth-card {
        padding: 24px;
    }
    .members-grid {
        grid-template-columns: 1fr;
    }
    .page-header {
        flex-direction: column;
        gap: 12px;
    }
    .search-box {
        flex-direction: column;
    }
}

/* ============================================
   Chatbox (Inicio)
   ============================================ */
.chatbox-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--accent);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow: hidden;
}
.chatbox-header {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chatbox-header h3 {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chatbox-header h3 i { color: var(--accent); }
.chatbox-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: chatbox-pulse 1.8s infinite;
}
@keyframes chatbox-pulse {
    0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.6); }
    70% { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
    100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.chatbox-messages {
    height: 260px;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chatbox-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: chatbox-fade-in 0.25s ease;
}
@keyframes chatbox-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.chatbox-msg-avatar span,
.chatbox-msg-avatar img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    object-fit: cover;
    flex-shrink: 0;
}
.chatbox-msg-body { flex: 1; min-width: 0; }
.chatbox-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.chatbox-msg-user {
    font-size: 13px;
    font-weight: 700;
}
.chatbox-msg-time {
    font-size: 11px;
    color: var(--text-muted);
}
.chatbox-msg-del {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition);
    line-height: 1;
}
.chatbox-msg-del:hover {
    color: var(--danger);
    background: rgba(255,255,255,0.06);
}
.chatbox-msg-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    word-break: break-word;
    line-height: 1.5;
}
.chatbox-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 30px 10px;
}
.chatbox-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.chatbox-form input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    transition: var(--transition);
}
.chatbox-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.chatbox-form button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.chatbox-form button:hover { transform: scale(1.06); }
.chatbox-form button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.chatbox-login-hint {
    padding: 14px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.chatbox-login-hint a { color: var(--accent); font-weight: 600; }

/* ============================================
   Editor de permisos por rol
   ============================================ */
.perm-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.perm-group {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}
.perm-group h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}
.perm-row:last-child { border-bottom: none; }
.perm-row-label {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 500;
}
.perm-row-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 1px;
}
.perm-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.perm-switch input { opacity: 0; width: 0; height: 0; }
.perm-switch-track {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-color);
    border-radius: 999px;
    transition: var(--transition);
}
.perm-switch-track::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}
.perm-switch input:checked + .perm-switch-track {
    background: var(--accent);
}
.perm-switch input:checked + .perm-switch-track::before {
    transform: translateX(18px);
}
.role-color-input {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 34px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    padding: 2px;
}

/* -------------------- Página de Servidores (chivil_servers) -------------------- */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.server-card {
    background: linear-gradient(145deg, rgba(15, 20, 25, 0.85), rgba(5, 8, 12, 0.95));
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00f0ff, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.server-card:hover {
    border-color: rgba(0, 240, 255, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 240, 255, 0.08);
}

.server-card:hover::before {
    opacity: 1;
}

.server-card .card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge-online {
    background: rgba(0, 240, 255, 0.1);
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.badge-offline {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
}

.server-card .card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
}

.server-card .server-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(5, 10, 15, 0.4));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #00f0ff;
    flex-shrink: 0;
    border: 1px solid rgba(0, 240, 255, 0.15);
}

.server-card .server-name {
    flex: 1;
    min-width: 0;
}

.server-card .server-name h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-card .server-name .server-ip {
    font-size: 0.8rem;
    color: #667788;
    font-family: 'Courier New', monospace;
}

.server-card .server-name .server-ip i {
    margin-right: 4px;
    font-size: 0.7rem;
}

.player-bar {
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 12px 15px;
}

.player-bar .player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.player-bar .player-count {
    font-size: 1.1rem;
    font-weight: 700;
}

.player-bar .player-count .current { color: #fff; }
.player-bar .player-count .separator { color: #333; }
.player-bar .player-count .max { color: #00f0ff; }

.player-bar .player-percent {
    font-size: 0.8rem;
    color: #667788;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease, background 0.3s ease;
    background: linear-gradient(90deg, #00b8d4, #00f0ff);
}

.server-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.server-details .detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #8899aa;
}

.server-details .detail-item i {
    width: 16px;
    text-align: center;
    color: #00f0ff;
    font-size: 0.8rem;
}

.server-details .detail-item .detail-label {
    color: #667788;
    flex-shrink: 0;
}

.server-details .detail-item .detail-value {
    color: #ccd;
    font-weight: 500;
    margin-left: auto;
}

.server-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.server-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-connect {
    background: linear-gradient(135deg, #008b9b, #00b8d4);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 184, 212, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-connect:hover {
    background: linear-gradient(135deg, #00a2b4, #00ccff);
    transform: translateY(-2px);
}

.btn-copy-ip {
    background: rgba(255, 255, 255, 0.03);
    color: #ccd;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-copy-ip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.3);
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .server-grid { grid-template-columns: 1fr; }
}

/* ===== Mensajes Privados (PMs) — chat layout ===== */
.pm-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex: 1;
    min-height: 480px;
}

.pm-conv-list {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: var(--bg-secondary);
    min-height: 0;
}

.pm-conv-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.pm-conv-item:hover {
    background: var(--bg-card-hover);
}

.pm-conv-item.active {
    background: var(--accent-glow);
    border-left: 3px solid var(--accent);
}

.pm-conv-item-body {
    flex: 1;
    min-width: 0;
}

.pm-conv-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.pm-conv-item-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-conv-item-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.pm-conv-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.pm-conv-item-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-unread-badge {
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
}

.pm-thread-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.pm-thread-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 10px;
}

.pm-thread-empty i {
    font-size: 42px;
    opacity: 0.4;
}

.pm-thread-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.pm-thread-back {
    display: none;
    color: var(--text-secondary);
    font-size: 18px;
    text-decoration: none;
}

.pm-thread-header-name {
    font-weight: 600;
    font-size: 15px;
}

.pm-thread-header-role {
    font-size: 12px;
    color: var(--text-muted);
}

.pm-thread-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pm-thread-subject-divider {
    text-align: center;
    margin: 10px 0;
}

.pm-thread-subject-divider span {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.pm-bubble-row {
    display: flex;
    justify-content: flex-start;
}

.pm-bubble-row.mine {
    justify-content: flex-end;
}

.pm-bubble {
    max-width: 65%;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

.pm-bubble-row.mine .pm-bubble {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.pm-bubble-text {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
    white-space: pre-wrap;
}

.pm-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.pm-bubble-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 11px;
}

.pm-bubble-delete:hover {
    color: var(--danger);
}

.pm-composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.pm-composer-input {
    flex: 1;
    min-height: 42px;
    max-height: 120px;
    resize: none;
}

.pm-composer-send {
    flex-shrink: 0;
    height: 42px;
    width: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive: en mobile mostramos solo lista o solo hilo, nunca ambos */
@media (max-width: 768px) {
    .pm-layout {
        grid-template-columns: 1fr;
    }

    .pm-conv-list {
        display: block;
        border-right: none;
    }

    .pm-thread-panel {
        display: none;
    }

    .pm-thread-back {
        display: inline-block;
    }

    /* Cuando hay una conversación activa (?user=X), ocultamos la lista y mostramos el hilo */
    .pm-layout.pm-show-thread .pm-conv-list {
        display: none;
    }

    .pm-layout.pm-show-thread .pm-thread-panel {
        display: flex;
    }
}

/* Estilos para la celda de jugador en la tabla de baneos */
.ban-player-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ban-player-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #1e1e2d;
}

.ban-player-info {
    display: flex;
    flex-direction: column;
}

.ban-player-name-link,
.ban-player-name {
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
}

.ban-player-name-link:hover {
    color: #8b5cf6;
}

.ban-steam-id {
    font-size: 11px;
    color: #a1a1aa;
    font-family: monospace;
}