/* ============================================================
   JP Preparation — Design System
   Tema: sidebar oscuro + contenido claro
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --sidebar-width:   240px;
    --navbar-h:         64px;

    /* Fondos */
    --bg-app:          #f1f5f9;
    --bg-sidebar:      #0f172a;
    --bg-sidebar-item: #1e293b;
    --bg-card:         #ffffff;
    --bg-input:        #f8fafc;

    /* Texto */
    --text-h:          #0f172a;
    --text-body:       #475569;
    --text-muted:      #94a3b8;
    --text-sidebar:    #cbd5e1;

    /* Acentos */
    --accent:          #3b82f6;
    --accent-dark:     #1d4ed8;
    --accent-light:    #eff6ff;

    /* Estados */
    --success:         #10b981;
    --success-light:   #d1fae5;
    --warning:         #f59e0b;
    --warning-light:   #fef3c7;
    --danger:          #ef4444;
    --danger-light:    #fee2e2;

    /* UI */
    --border:          #e2e8f0;
    --border-dark:     #cbd5e1;
    --shadow-sm:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:       0 4px 16px rgba(0,0,0,.08);
    --radius:          10px;
    --radius-sm:        6px;

    /* Aliases de compatibilidad (usados en vistas) */
    --card-bg:         #ffffff;
    --bg-secondary:    #f1f5f9;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    background: var(--bg-app);
    color: var(--text-body);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ── Layout principal ───────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #1e293b;
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 15px;
    color: #f1f5f9;
    letter-spacing: .2px;
}

.sidebar-logo-text span {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-top: 1px;
}

/* Sección nav */
.sidebar-section {
    padding: 16px 12px 4px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #475569;
    padding: 0 8px;
    margin-bottom: 6px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.sidebar-nav-link:hover {
    background: #1e293b;
    color: #f1f5f9;
}

.sidebar-nav-link.active {
    background: var(--accent);
    color: #fff;
}

.cfg-tab:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-nav-link i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* Bottom del sidebar */
.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid #1e293b;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    text-decoration: none;
}

.sidebar-user:hover {
    background: #1e293b;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: #64748b;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s, color .15s;
}

.sidebar-logout:hover {
    background: #1e293b;
    color: var(--danger);
}

/* ── Main ───────────────────────────────────────────────── */
.main-wrap {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ── Navbar ─────────────────────────────────────────────── */
.topbar {
    height: var(--navbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-h);
    margin: 0;
    line-height: 1.2;
}

.topbar-title p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-body);
    position: relative;
    transition: background .15s;
}

.topbar-btn:hover { background: var(--bg-app); }

.topbar-notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 1.5px solid #fff;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.topbar-user-info { text-align: right; }
.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-h);
}
.topbar-user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Contenido de página ─────────────────────────────────── */
.page-body {
    padding: 28px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-text h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-h);
    margin: 0 0 2px;
}

.page-header-text p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ── Cards de métricas ───────────────────────────────────── */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.metric-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-label {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.metric-icon.blue   { background: #eff6ff; color: var(--accent); }
.metric-icon.green  { background: #d1fae5; color: var(--success); }
.metric-icon.orange { background: #fff7ed; color: #f97316; }
.metric-icon.red    { background: #fee2e2; color: var(--danger); }
.metric-icon.purple { background: #f5f3ff; color: #7c3aed; }

.metric-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-h);
    line-height: 1;
    margin-bottom: 8px;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.badge-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
}

.badge-trend.up   { background: var(--success-light); color: var(--success); }
.badge-trend.down { background: var(--danger-light);  color: var(--danger); }
.badge-trend.neutral { background: #f1f5f9; color: var(--text-muted); }

.metric-footer-label {
    font-size: 12px;
    color: var(--text-muted);
}

.metric-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin-top: 12px;
    overflow: hidden;
}

.metric-progress-bar {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
}

/* ── Tarjeta genérica ────────────────────────────────────── */
.card-jp {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-jp-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-jp-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-h);
    margin: 0;
}

.card-jp-body {
    padding: 20px 22px;
}

/* ── Tabla ───────────────────────────────────────────────── */
.table-jp {
    width: 100%;
    border-collapse: collapse;
}

.table-jp th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.table-jp td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-body);
    font-size: 13.5px;
}

.table-jp tbody tr:hover { background: #f8fafc; }
.table-jp tbody tr:last-child td { border-bottom: none; }

.td-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.td-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.td-name { font-weight: 600; color: var(--text-h); font-size: 13.5px; }
.td-sub  { font-size: 12px; color: var(--text-muted); }

/* ── Badges de estado ─────────────────────────────────────── */
.badge-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.badge-status.active   { background: var(--success-light); color: var(--success); }
.badge-status.inactive { background: #f1f5f9; color: var(--text-muted); }
.badge-status.pending  { background: var(--warning-light); color: #92400e; }
.badge-status.banned   { background: var(--danger-light);  color: var(--danger); }
.badge-status.done     { background: var(--success-light); color: var(--success); }

/* ── Búsqueda / filtros ──────────────────────────────────── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.input-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}

.input-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.input-search input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-size: 13.5px;
    color: var(--text-h);
    outline: none;
    transition: border-color .15s;
}

.input-search input:focus { border-color: var(--accent); }

/* ── Botones ─────────────────────────────────────────────── */
.btn-jp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
}

.btn-jp-primary {
    background: var(--accent);
    color: #fff;
}

.btn-jp-primary:hover {
    background: var(--accent-dark);
    color: #fff;
}

.btn-jp-secondary {
    background: transparent;
    color: var(--text-body);
    border: 1px solid var(--border);
}

.btn-jp-secondary:hover {
    background: var(--bg-app);
}

.btn-jp-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-jp-danger:hover { background: #fecaca; }

.btn-jp-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-jp-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 14px;
    display: block;
    color: #cbd5e1;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
    max-width: 300px;
    margin: 0 auto 20px;
}

/* ── Calendario placeholder ──────────────────────────────── */
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-nav button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-body);
    transition: background .15s;
}

.calendar-nav button:hover { background: var(--bg-app); }
.calendar-nav-label { font-weight: 600; font-size: 13.5px; color: var(--text-h); min-width: 140px; text-align: center; }

.calendar-view-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.calendar-view-tab {
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: background .15s, color .15s;
}

.calendar-view-tab.active {
    background: var(--bg-card);
    color: var(--text-h);
    box-shadow: var(--shadow-sm);
}

/* ── Items de lista (torneos, clases, etc.) ──────────────── */
.list-item-jp {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.list-item-jp:last-child { border-bottom: none; }

.list-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.list-item-info { flex: 1; min-width: 0; }
.list-item-title { font-size: 13.5px; font-weight: 600; color: var(--text-h); }
.list-item-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.list-item-action {
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
}

/* ── Progreso ────────────────────────────────────────────── */
.progress-jp {
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    overflow: hidden;
}

.progress-jp-bar {
    height: 100%;
    border-radius: 4px;
}

/* ── Perfil ──────────────────────────────────────────────── */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.profile-name { font-size: 20px; font-weight: 700; color: var(--text-h); margin-bottom: 3px; }
.profile-email { font-size: 13px; color: var(--text-muted); }

/* ── Formularios ─────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-control-jp {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-size: 13.5px;
    color: var(--text-h);
    outline: none;
    transition: border-color .15s;
}

.form-control-jp:focus { border-color: var(--accent); }

select.form-control-jp { cursor: pointer; }
textarea.form-control-jp { resize: vertical; min-height: 90px; }

.form-control-jp.is-invalid { border-color: var(--danger); }
.form-control-jp.is-invalid:focus { border-color: var(--danger); }
.field-error-msg {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--danger);
}

/* ── Alertas ─────────────────────────────────────────────── */
.alert-jp {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-jp.success { background: var(--success-light); color: #065f46; }
.alert-jp.error,
.alert-jp.danger  { background: var(--danger-light);  color: #991b1b; }
.alert-jp.warning { background: var(--warning-light); color: #92400e; }

/* ── Overflow containment para tablas ────────────────────────── */
/* Las tablas hacen scroll internamente; no afectan al layout global */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile & Tablet
   ══════════════════════════════════════════════════════════════ */

/* ── Botón hamburger (oculto por defecto, visible solo en móvil) */
.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-body);
    font-size: 20px;
    flex-shrink: 0;
    transition: background .15s;
    padding: 0;
}
.mobile-menu-btn:hover { background: var(--bg-app); }

/* ── Overlay backdrop del sidebar en móvil ────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99;
    cursor: pointer;
}
.sidebar-overlay.active { display: block; }

/* ── Avatar tamaño medio (dashboard player) ─────────────────── */
.profile-avatar-md {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    object-fit: cover;
}

/* ── Tablet (≤ 1024px) ───────────────────────────────────────── */
@media (max-width: 1024px) {

    /* Sidebar: off-canvas — se desliza desde la izquierda */
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }

    /* Main: ocupa todo el ancho */
    .main-wrap { margin-left: 0; }

    /* Hamburger visible en tablet */
    .mobile-menu-btn { display: flex; }

    .topbar-user-info { display: none; }
    .sidebar-logo-text span { display: none; }

    /* Métricas */
    .metric-value { font-size: 22px; }
    .metric-card  { padding: 14px 16px; }

    /* Overflow prevention — inputs y contenedores flex */
    .input-search { min-width: 150px; flex: 1; }
    .page-body    { min-width: 0; }
    .card-jp      { min-width: 0; }

    /* Bootstrap .row con gutters puede tener márgenes negativos;
       el overflow-x:hidden del body los absorbe, pero limitamos también aquí */
    .row { --bs-gutter-x: 1rem; }
}

/* ══════════════════════════════════════════════════════════════
   TABLET PURO (769 px – 1024 px)
   Sin sidebar → área completa; tipografía mayor y diseño vertical.
   Sobreescribe las reducciones aplicadas por max-width:1024px.
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {

    /* ── Tipografía base ──────────────────────────────────────── */
    body { font-size: 15px; }

    /* ── Topbar ───────────────────────────────────────────────── */
    .topbar         { padding: 0 24px; }
    .topbar-title h1 { font-size: 20px; }
    .topbar-title p  { font-size: 12px; }

    /* ── Cuerpo ───────────────────────────────────────────────── */
    .page-body { padding: 24px; }

    /* ── Cabecera de página ───────────────────────────────────── */
    .page-header-text h2 { font-size: 21px; }
    .page-header-text p  { font-size: 13.5px; }

    /* ── Métricas: compensamos la reducción de max-width:1024px ── */
    .metric-value  { font-size: 26px; }
    .metric-card   { padding: 18px 20px; }
    .metric-label  { font-size: 12px; }
    .metric-icon   { width: 36px; height: 36px; font-size: 17px; }

    /* ── Cards ────────────────────────────────────────────────── */
    .card-jp-title  { font-size: 16px; }
    .card-jp-header { padding: 16px 20px 12px; }
    .card-jp-body   { padding: 18px 20px; }

    /* ── Botones ──────────────────────────────────────────────── */
    .btn-jp    { padding: 10px 18px; font-size: 14px; }
    .btn-jp-sm { padding: 7px 14px;  font-size: 13px; }

    /* ── Tabla ────────────────────────────────────────────────── */
    .table-jp th { font-size: 12px;   padding: 12px 16px; }
    .table-jp td { font-size: 14px;   padding: 14px 16px; }

    /* ── Formularios ──────────────────────────────────────────── */
    .form-control-jp  { font-size: 14px; padding: 11px 14px; }
    .input-search input { font-size: 14px; }
    .form-label       { font-size: 13px; }

    /* ── Perfil: apilado vertical en tablet ───────────────────── */
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }

    /* ── Badges ───────────────────────────────────────────────── */
    .badge-status { font-size: 12px; padding: 4px 12px; }

    /* ── Sidebar nav (visible cuando está abierto) ────────────── */
    .sidebar-nav-link { font-size: 14px; padding: 10px 12px; }

    /* ── Dropdown notificaciones ──────────────────────────────── */
    .notif-dropdown { width: 320px; }

    /* ── Chat: ajuste altura con nuevo padding ────────────────── */
    .chat-layout { height: calc(100vh - var(--navbar-h) - 48px); }
}

/* ── Móvil (≤ 768px) ────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Topbar */
    .topbar {
        padding: 0 12px;
        height: auto;
        min-height: 54px;
        padding-top: 8px;
        padding-bottom: 8px;
        gap: 8px;
    }
    .topbar-title h1 { font-size: 15px; }
    .topbar-title p { display: none; }
    .topbar-user-info { display: none; }
    .topbar-right { gap: 8px; }

    /* Notification dropdown */
    .notif-dropdown {
        width: calc(100vw - 16px);
        right: -48px;
        max-width: none;
    }

    /* Page body */
    .page-body { padding: 12px; }

    /* Cards */
    .card-jp-header {
        padding: 12px 14px 10px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .card-jp-body { padding: 14px; }

    /* Profile header: columna en móvil */
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    /* Search bar: columna en móvil */
    .search-bar { flex-direction: column; align-items: stretch; }
    .input-search { max-width: 100%; min-width: 0; }
    .search-bar .form-control-jp {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Page header */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .d-flex { flex-wrap: wrap; }

    /* Tablas: scroll interno, no afectan el layout */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Search bar: selects con min-width inline → forzar stretch */
    .search-bar select,
    .search-bar .form-control-jp {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Calendar view tabs */
    .card-jp-header .d-flex.align-items-center.gap-2 { flex-wrap: wrap; }
    .calendar-view-tabs { flex-wrap: wrap; }
}

/* ── Móvil pequeño (≤ 480px) ────────────────────────────────── */
@media (max-width: 480px) {
    .page-body { padding: 10px; }
    .card-jp-header { padding: 10px 12px; }
    .card-jp-body { padding: 12px; }
    .btn-jp { padding: 8px 14px; font-size: 13px; }
    .metric-value { font-size: 18px; }
    .metric-card { padding: 12px; }
    .metric-label { font-size: 10.5px; }
    .metric-icon { width: 32px; height: 32px; font-size: 15px; }
    .profile-avatar-lg { width: 64px; height: 64px; font-size: 22px; }
    .topbar-title h1 { font-size: 13px; }
    .topbar-btn { width: 32px; height: 32px; }
    .topbar-avatar { width: 32px; height: 32px; font-size: 12px; }
}



.color-red{
    color: red !important;
}

/* ── Forzar formato 24h en inputs de tiempo (ignorar locale del SO) ── */
input[type="time"]::-webkit-datetime-edit-ampm-field {
    display: none !important;
    width: 0 !important;
}
input[type="time"]::-webkit-inner-spin-button {
    display: none;
}
input[type="time"] {
    -webkit-appearance: none;
}


/* ════════════════════════════════════════════════════════════
   NOTIFICACIONES & MENSAJES
   ════════════════════════════════════════════════════════════ */

/* ── Badge universal de la topbar ──────────────────────────── */
.topbar-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    font-size: 9px; font-weight: 700;
    background: var(--danger);
    color: #fff;
    border-radius: 8px;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.topbar-btn-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Dropdown notificaciones ────────────────────────────────── */
.topbar-notif-wrap {
    position: relative;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .15s, transform .15s;
}

.notif-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.notif-dropdown-link {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
}
.notif-dropdown-link:hover { text-decoration: underline; }

.notif-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.notif-dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.notif-dd-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
    position: relative;
}
.notif-dd-item:last-child { border-bottom: none; }
.notif-dd-item:hover { background: var(--bg-app); }
.notif-dd-item--unread { background: var(--accent-light); }
.notif-dd-item--unread:hover { background: #dbeafe; }

.notif-dd-group {
    color: var(--accent);
    font-size: 14px;
    margin-top: 2px;
}

.notif-dd-body { flex: 1; min-width: 0; }
.notif-dd-title {
    font-size: 13px; font-weight: 600;
    color: var(--text-h);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-dd-sender { font-size: 11px; color: var(--text-muted); }
.notif-dd-time   { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.notif-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border);
}

/* ── Centro de notificaciones (página /notificaciones) ──────── */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-app); }
.notif-unread { background: var(--accent-light); }
.notif-unread:hover { background: #dbeafe; }

.notif-avatar-wrap { position: relative; flex-shrink: 0; }

.notif-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    object-fit: cover;
}

.notif-group-badge {
    position: absolute;
    bottom: -2px; right: -2px;
    width: 18px; height: 18px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px;
    border: 2px solid #fff;
}

.notif-body { flex: 1; min-width: 0; }
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}
.notif-sender { font-size: 12px; font-weight: 600; color: var(--accent); }
.notif-time   { font-size: 11px; color: var(--text-muted); }
.notif-title  { font-size: 14px; font-weight: 700; color: var(--text-h); }
.notif-text   { font-size: 13px; color: var(--text-body); margin-top: 4px; }

.notif-file-link {
    display: inline-flex; align-items: center;
    margin-top: 6px; font-size: 12px;
    color: var(--accent); text-decoration: none;
}
.notif-file-link:hover { text-decoration: underline; }

.notif-read-btn {
    flex-shrink: 0;
    background: none; border: none;
    color: var(--accent); cursor: pointer;
    font-size: 10px; padding: 4px;
    opacity: .7; transition: opacity .12s;
}
.notif-read-btn:hover { opacity: 1; }

/* ── Badge en sidebar ───────────────────────────────────────── */
.sidebar-badge {
    margin-left: auto;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    border-radius: 9px;
    font-size: 10px; font-weight: 700;
    line-height: 18px;
    text-align: center;
}

/* ════════════════════════════════════════════════════════════
   CHAT — layout
   ════════════════════════════════════════════════════════════ */

.chat-layout {
    position: relative;
    display: flex;
    height: calc(100vh - var(--navbar-h) - 32px);
    gap: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ── Panel izquierdo ────────────────────────────────────────── */
.chat-sidebar {
    width: 300px;
    min-width: 260px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    flex-shrink: 0;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.chat-search-wrap {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.chat-search {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    background: var(--bg-app);
    outline: none;
    font-family: inherit;
    color: var(--text-h);
}
.chat-search:focus { border-color: var(--accent); background: #fff; }

/* Lista de conversaciones */
.conv-list {
    list-style: none; margin: 0; padding: 0;
    flex: 1; overflow-y: auto;
}

.conv-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px; text-align: center;
    gap: 8px;
}

.conv-item {
    display: flex; align-items: center;
    gap: 12px; padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.conv-item:hover { background: var(--bg-app); }
.conv-item.active { background: var(--accent-light); }

.conv-avatar-wrap { flex-shrink: 0; }

.conv-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 15px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    object-fit: cover;
}

.conv-info { flex: 1; min-width: 0; }
.conv-name-row {
    display: flex; justify-content: space-between;
    align-items: baseline; margin-bottom: 2px;
}
.conv-name  { font-size: 13px; font-weight: 600; color: var(--text-h); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time  { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.conv-preview-row { display: flex; justify-content: space-between; align-items: center; }
.conv-preview {
    font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-unread-badge {
    flex-shrink: 0; margin-left: 6px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: #fff;
    border-radius: 9px;
    font-size: 10px; font-weight: 700;
    line-height: 18px; text-align: center;
}

/* ── Panel derecho ──────────────────────────────────────────── */
.chat-main {
    flex: 1;
    display: flex; flex-direction: column;
    min-width: 0;
    background: var(--bg-app);
}

.chat-empty {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-muted);
}

.chat-header {
    display: flex; align-items: center;
    gap: 12px; padding: 12px 18px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-header-avatar-img {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    object-fit: cover;
}

.chat-header-info { flex: 1; }
.chat-header-name { font-size: 14px; font-weight: 700; color: var(--text-h); }
.chat-header-role { font-size: 11px; color: var(--text-muted); }

/* Mensajes */
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column;
}

.chat-messages-inner {
    display: flex; flex-direction: column;
    gap: 4px; min-height: 100%;
    justify-content: flex-end;
}

.chat-loading {
    display: flex; justify-content: center;
    padding: 20px;
}

/* Burbujas */
.chat-msg-wrap {
    display: flex;
    margin-bottom: 2px;
}
.chat-msg-wrap.mine    { justify-content: flex-end; }
.chat-msg-wrap.theirs  { justify-content: flex-start; }

.chat-msg-inner { max-width: 70%; display: flex; flex-direction: column; }
.mine  .chat-msg-inner { align-items: flex-end; }
.theirs .chat-msg-inner { align-items: flex-start; }

.chat-bubble {
    padding: 9px 14px;
    border-radius: 16px;
    font-size: 13px; line-height: 1.5;
    word-break: break-word;
    max-width: 100%;
}
.mine   .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.theirs .chat-bubble { background: var(--bg-card); color: var(--text-h); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }

.chat-bubble-file { padding: 10px 14px; }
.chat-img-preview { max-width: 200px; max-height: 200px; border-radius: 10px; display: block; cursor: pointer; }
.chat-file-link {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; text-decoration: none;
}
.mine .chat-file-link   { color: rgba(255,255,255,.9); }
.theirs .chat-file-link { color: var(--accent); }
.msg-file-size { font-size: 10px; opacity: .7; }

.chat-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    padding: 0 4px;
}

/* ── Barra de input ─────────────────────────────────────────── */
.chat-input-bar {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    flex-shrink: 0;
}

.msg-file-preview { margin-bottom: 8px; }
.msg-file-badge {
    display: inline-flex; align-items: center;
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
}
.btn-close-sm { font-size: 10px; }

.chat-input-row {
    display: flex; align-items: flex-end;
    gap: 10px;
}

.chat-attach-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer;
    color: var(--text-muted); font-size: 18px;
    transition: color .12s, background .12s;
    flex-shrink: 0;
}
.chat-attach-btn:hover { color: var(--accent); background: var(--accent-light); }

.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 9px 16px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    background: var(--bg-app);
    color: var(--text-h);
    line-height: 1.5;
    min-height: 38px;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color .15s;
}
.chat-input:focus { border-color: var(--accent); background: #fff; }

.chat-send-btn {
    width: 38px; height: 38px;
    border-radius: 50%; border: none;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 16px;
    flex-shrink: 0;
    transition: background .12s, transform .1s;
}
.chat-send-btn:hover   { background: var(--accent-dark); }
.chat-send-btn:active  { transform: scale(.93); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Modal contactos ────────────────────────────────────────── */
.contact-list {
    list-style: none; margin: 0; padding: 0;
    max-height: 360px; overflow-y: auto;
}

.contact-item {
    display: flex; align-items: center;
    gap: 12px; padding: 10px 4px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background .12s;
}
.contact-item:hover { background: var(--bg-app); }

.contact-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    object-fit: cover;
    flex-shrink: 0;
}

.contact-info { flex: 1; }
.contact-name { font-size: 13px; font-weight: 600; color: var(--text-h); }
.contact-role { font-size: 11px; color: var(--text-muted); }

/* ── Responsive chat ────────────────────────────────────────── */
@media (max-width: 768px) {
    .chat-layout { height: calc(100vh - var(--navbar-h)); border-radius: 0; border: none; }
    .chat-sidebar { width: 100%; border-right: none; position: absolute; z-index: 10; top: 0; left: 0; height: 100%; }
    .chat-sidebar-hidden { display: none; }
    .chat-main { display: none; }
    .chat-main-active { display: flex; position: absolute; z-index: 10; top: 0; left: 0; width: 100%; height: 100%; }
    .chat-msg-inner { max-width: 85%; }
}

/* ══════════════════════════════════════════════════════════════
   COMPRAS — Lista de solicitudes de compra
   ══════════════════════════════════════════════════════════════ */

/* ── Badge de estado ──────────────────────────────────────── */
.compra-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.compra-status-pendiente   { background: #f1f5f9;              color: #475569; }
.compra-status-en_revision { background: var(--warning-light); color: #92400e; }
.compra-status-aprobado    { background: var(--success-light);  color: #065f46; }
.compra-status-denegado    { background: var(--danger-light);   color: #991b1b; }
.compra-status-comprado    { background: #eff6ff;               color: #1d4ed8; }
.compra-status-cancelado   { background: #f8fafc;               color: #94a3b8; }

/* ── Badge de prioridad ───────────────────────────────────── */
.compra-pri-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.compra-pri-alta  { background: var(--danger-light);   color: var(--danger); }
.compra-pri-media { background: var(--warning-light);  color: #92400e; }
.compra-pri-baja  { background: var(--success-light);  color: var(--success); }

/* ── Badge de categoría ───────────────────────────────────── */
.compra-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--bg-app);
    color: var(--text-body);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ── Badge contador en tabs de filtro ─────────────────────── */
.compra-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    margin-left: 4px;
    vertical-align: middle;
}

/* ════════════════════════════════════════════════════════════════
   RADIX-UI.JS — Dialog / DropdownMenu / Tabs
   Componentes propios en JS vanilla con los mismos patrones de
   accesibilidad que Radix Primitives (ver public/assets/js/radix-ui.js)
   ════════════════════════════════════════════════════════════════ */

/* ── Dialog ──────────────────────────────────────────────── */
.ru-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    transition: opacity .15s ease;
}

.ru-overlay.ru-open { opacity: 1; }

.ru-dialog {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transform: translateY(8px) scale(.98);
    transition: transform .15s ease;
}

.ru-overlay.ru-open .ru-dialog { transform: translateY(0) scale(1); }

.ru-dialog-sm { max-width: 400px; }
.ru-dialog-lg { max-width: 680px; }

.ru-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 4px;
}

.ru-dialog-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-h);
    margin: 0;
}

.ru-dialog-header [data-ru-dialog-close] {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.ru-dialog-header [data-ru-dialog-close]:hover { background: var(--bg-app); color: var(--text-h); }

.ru-dialog-body {
    padding: 10px 22px 20px;
    font-size: 13.5px;
    color: var(--text-body);
    line-height: 1.55;
}

.ru-confirm-desc { padding-top: 0; }

.ru-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px 20px;
}

/* ── DropdownMenu ────────────────────────────────────────── */
.ru-dropdown { position: relative; display: inline-block; }

.ru-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 200;
}

.ru-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-body);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.ru-dropdown-item:hover,
.ru-dropdown-item:focus {
    background: var(--accent-light);
    color: var(--accent-dark);
    outline: none;
}

/* ── Tabs ────────────────────────────────────────────────── */
.ru-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px;
    box-shadow: var(--shadow-sm);
}

.ru-tabs [role="tab"] {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background .13s, color .13s;
}

.ru-tabs [role="tab"]:hover:not(.active) { background: var(--bg-app); color: var(--text-h); }
.ru-tabs [role="tab"].active { background: var(--accent); color: #fff; }
.ru-tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ru-tab-count {
    font-size: 10.5px;
    font-weight: 700;
    background: rgba(255,255,255,.25);
    border-radius: 20px;
    padding: 1px 7px;
}
.ru-tabs [role="tab"]:not(.active) .ru-tab-count { background: var(--bg-app); color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   AUTH — login / recuperar / restablecer contraseña
   ════════════════════════════════════════════════════════════ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--bg-sidebar), var(--accent-dark));
}

.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 36px 30px;
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.auth-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.auth-title {
    text-align: center;
    font-size: 19px;
    font-weight: 800;
    color: var(--text-h);
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 13px;
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   LOGIN — Aura Gradient "Neon Grid": retícula + halos con blend modes
   ════════════════════════════════════════════════════════════ */

.login-stage {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow: hidden;
    /* El color base vive aquí (no en .login-aura-layer): las capas de
       blend mode (screen) componen contra esto. .login-stage ocupa toda
       la página de login, así que hace las veces de "body" del patrón
       Aura sin tener que tocar el <body> global (compartido por toda
       la app — un fondo oscuro ahí afectaría al resto de páginas). */
    background: #060a10;
}

.login-aura-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: translateZ(0);
    will-change: transform;
}

.login-aura-grid {
    background:
        linear-gradient(rgba(59,130,246,.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,.14) 1px, transparent 1px);
    background-size: 60px 60px;
    mix-blend-mode: normal;
}

.login-aura-glow-primary {
    background: radial-gradient(circle at 50% 38%, rgba(59,130,246,.55) 0%, transparent 55%);
    mix-blend-mode: screen;
    filter: blur(200px);
}

.login-aura-glow-secondary {
    background: radial-gradient(circle at 22% 82%, rgba(132,204,22,.35) 0%, transparent 45%);
    mix-blend-mode: screen;
    filter: blur(150px);
}

@media (min-width: 860px) {
    .login-aura-glow-primary   { filter: blur(260px); }
    .login-aura-glow-secondary { filter: blur(216px); }
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    padding: 40px 32px 32px;
    border-radius: 36px;
    background: rgba(15, 26, 43, .52);
    border: 1px solid rgba(148, 178, 255, .22);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow:
        0 40px 80px -20px rgba(0,0,0,.55),
        0 0 0 1px rgba(255,255,255,.03) inset,
        0 1px 0 rgba(255,255,255,.08) inset;
    animation: loginRise .55s cubic-bezier(.16,1,.3,1) both;
}

@keyframes loginRise {
    from { opacity: 0; transform: translateY(16px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-title {
    font-family: 'Oswald', 'JP Body', sans-serif;
    font-weight: 700;
    font-size: 30px;
    letter-spacing: .01em;
    text-align: center;
    color: #f3f6fb;
    margin: 0 0 6px;
}

.login-subtitle {
    text-align: center;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9fb0cc;
    margin: 0 0 30px;
}

.login-error {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: rgba(248,113,113,.12);
    border: 1px solid rgba(248,113,113,.35);
    color: #fecaca;
    font-size: 12.5px;
    line-height: 1.5;
    padding: 11px 13px;
    border-radius: 12px;
    margin-bottom: 18px;
}
.login-error i { flex-shrink: 0; margin-top: 1px; color: #f87171; }

.login-field { margin-bottom: 14px; }

.login-input-wrap { position: relative; display: flex; align-items: center; }

.login-input-wrap i.icon-leading {
    position: absolute;
    left: 18px;
    color: #9fb0cc;
    pointer-events: none;
    font-size: 15px;
}

.login-input-wrap input {
    width: 100%;
    height: 52px;
    padding: 0 46px 0 46px;
    border: 1.5px solid rgba(148,178,255,.22);
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #f3f6fb;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-input-wrap input::placeholder { color: #9fb0cc; font-weight: 500; }
.login-input-wrap input:focus {
    border-color: var(--accent);
    background: rgba(59,130,246,.08);
    box-shadow: 0 0 0 4px rgba(59,130,246,.16);
}

.login-toggle-pw {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #9fb0cc;
    cursor: pointer;
    border-radius: 10px;
}
.login-toggle-pw:hover { background: rgba(255,255,255,.08); color: #f3f6fb; }

.login-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 10px 0 24px;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 600;
    color: #9fb0cc;
    cursor: pointer;
    user-select: none;
}

.login-remember input { position: absolute; opacity: 0; width: 18px; height: 18px; cursor: pointer; }

.login-check-box {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1.5px solid rgba(148,178,255,.4);
    background: rgba(255,255,255,.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}
.login-remember input:checked ~ .login-check-box {
    background: linear-gradient(180deg, #4c8bfa, var(--accent-dark));
    border-color: var(--accent);
}
.login-check-box svg { opacity: 0; transform: scale(.5); transition: opacity .12s, transform .12s; }
.login-remember input:checked ~ .login-check-box svg { opacity: 1; transform: scale(1); }
.login-remember input:focus-visible ~ .login-check-box { box-shadow: 0 0 0 3px rgba(59,130,246,.35); }

.login-field-row a {
    font-size: 12.5px;
    font-weight: 600;
    color: #9fb0cc;
    text-decoration: none;
}
.login-field-row a:hover { color: #f3f6fb; }

.login-btn-submit {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #5b9dff, var(--accent-dark));
    color: #fff;
    font-family: 'Oswald', 'JP Body', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 8px 16px -6px rgba(4,10,20,.5);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.login-btn-submit:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 20px -6px rgba(4,10,20,.55); }
.login-btn-submit:active { transform: translateY(0); }
.login-btn-submit:disabled { opacity: .75; cursor: default; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .login-card { animation: none; }
    .login-btn-submit { transition: none; }
}

@media (max-width: 460px) {
    .login-card { padding: 34px 24px 26px; border-radius: 28px; }
    .login-title { font-size: 26px; }
}

.auth-links.center { justify-content: center; }