/* =====================================================
   BOOSTY PLATFORM — DESIGN SYSTEM
   Dark premium / Consulting SaaS
   ===================================================== */

/* --- TOKENS --- */
:root {
    --bg:           #07041a;
    --bg-card:      #110d2e;
    --bg-elevated:  #1a1440;
    --sidebar:      #0c0924;
    --accent:       #6c47ff;
    --accent-light: #a78bfa;
    --accent-glow:  rgba(108, 71, 255, 0.25);
    --text:         #f0ecff;
    --muted:        #8b82aa;
    --muted-2:      #5a5278;
    --border:       rgba(108, 71, 255, 0.2);
    --border-hover: rgba(108, 71, 255, 0.5);
    --green:        #34d399;
    --green-bg:     rgba(52, 211, 153, 0.08);
    --yellow:       #fbbf24;
    --yellow-bg:    rgba(251, 191, 36, 0.08);
    --red:          #f87171;
    --red-bg:       rgba(248, 113, 113, 0.08);
    --grad:         linear-gradient(135deg, #6c47ff 0%, #a78bfa 100%);
    --grad-subtle:  linear-gradient(135deg, rgba(108,71,255,0.15) 0%, rgba(167,139,250,0.05) 100%);

    --radius-sm:    8px;
    --radius-md:    14px;
    --radius-lg:    20px;
    --radius-xl:    28px;

    --shadow-card:  0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px var(--border);
    --shadow-glow:  0 8px 32px rgba(108,71,255,0.3);

    --topbar-h:     64px;
    --sidebar-w:    240px;

    --font-body:    'DM Sans', sans-serif;
    --font-display: 'Syne', sans-serif;
}

/* --- RESET --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted-2); border-radius: 4px; }

/* =====================================================
   TOPBAR
   ===================================================== */
.topbar {
    height: var(--topbar-h);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}
.logo {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.logo-accent { color: var(--accent-light); }

.topbar-right { position: relative; display: flex; align-items: center; }

.topbar-user-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    user-select: none;
}
.topbar-user-wrap:hover { background: var(--bg-elevated); color: var(--text); }

.avatar {
    width: 32px;
    height: 32px;
    background: var(--grad);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    z-index: 200;
}
.dropdown-menu.open { display: block; animation: fadeSlideDown 0.15s ease; }
.dropdown-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dropdown-item:hover { background: rgba(255,255,255,0.05); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-bg); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* =====================================================
   LAYOUT
   ===================================================== */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.sidebar.hidden { display: none; }

.sidebar-module-label {
    padding: 24px 20px 8px;
    font-size: 9px;
    letter-spacing: 3px;
    font-weight: 700;
    color: var(--muted-2);
    text-transform: uppercase;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 10px; }

.nav-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--text); background: rgba(108,71,255,0.15); }

.nav-section-label {
    padding: 16px 14px 6px;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--muted-2);
    font-weight: 700;
    text-transform: uppercase;
}

.nav-item-special {
    margin: 8px 0;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(108,71,255,0.08);
    border: 1px solid rgba(108,71,255,0.2);
    transition: all 0.25s;
}
.nav-item-special:hover {
    background: rgba(108,71,255,0.15);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.sidebar-footer {
    padding: 16px 10px;
    border-top: 1px solid var(--border);
}
.sidebar-back-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 12px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    width: 100%;
    text-align: left;
    transition: color 0.2s, background 0.2s;
}
.sidebar-back-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.view-content {
    flex: 1;
    overflow-y: auto;
    padding: 36px 40px;
    animation: fadeIn 0.3s ease;
}

/* =====================================================
   HUB / HOME
   ===================================================== */
.hub-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--topbar-h));
    gap: 52px;
    padding: 40px;
}
.hub-greeting {
    text-align: center;
}
.hub-eyebrow {
    font-size: 10px;
    letter-spacing: 4px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    font-weight: 600;
}
.hub-title {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 10px;
}
.hub-role {
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--accent-light);
    font-weight: 700;
    text-transform: uppercase;
}
.module-grid {
    display: flex;
    flex-direction: row;
    gap: 24px;
    justify-content: center;
}
.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 36px;
    min-width: 260px;
    max-width: 300px;
    flex: 1;
    text-align: center;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}
.module-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad-subtle);
    opacity: 0;
    transition: opacity 0.3s;
}
.module-card:hover { transform: translateY(-10px); border-color: var(--accent); box-shadow: var(--shadow-glow); }
.module-card:hover::before { opacity: 1; }
.module-icon { font-size: 56px; margin-bottom: 20px; display: block; }
.module-card h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 8px; }
.module-card p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* =====================================================
   LOGIN
   ===================================================== */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--topbar-h));
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h2 { font-family: var(--font-display); font-size: 28px; margin-bottom: 8px; }
.login-card .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.login-error {
    background: var(--red-bg);
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.form-input:focus { border-color: var(--accent); background: rgba(108,71,255,0.06); }
.form-input::placeholder { color: var(--muted); }
.form-input option { background: var(--bg-elevated); color: var(--text); }

.form-label {
    display: block;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-group { margin-bottom: 18px; }

/* =====================================================
   BOTONES
   ===================================================== */
.btn-primary {
    background: var(--grad);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 16px rgba(108,71,255,0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108,71,255,0.4); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Alias para compatibilidad con código viejo */
.btn-premium { background: var(--grad); color: #fff; border: none; padding: 11px 22px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.25s; box-shadow: 0 4px 16px rgba(108,71,255,0.25); display: inline-flex; align-items: center; gap: 8px; }
.btn-premium:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108,71,255,0.4); }

.btn-secondary {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-hover); background: rgba(255,255,255,0.08); }

.btn-icon {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    line-height: 1;
}
.btn-icon:hover { background: var(--red-bg); border-color: rgba(248,113,113,0.3); color: var(--red); }

/* =====================================================
   TABLAS
   ===================================================== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 14px 20px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    text-align: left;
    background: rgba(0,0,0,0.2);
}
thead th:last-child { text-align: right; }
tbody td {
    padding: 16px 20px;
    font-size: 13px;
    border-bottom: 1px solid rgba(108,71,255,0.06);
    color: var(--text);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
td:last-child { text-align: right; }

.empty-row td {
    text-align: center !important;
    padding: 48px 20px;
    color: var(--muted);
    font-size: 14px;
}

/* =====================================================
   STAT CARDS
   ===================================================== */
.stat-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 28px;
}
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 24px;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--grad);
    opacity: 0.06;
    transform: translate(15px, -15px);
}
.stat-val {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
}
.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    font-weight: 600;
}
.stat-trend {
    font-size: 12px;
    margin-top: 8px;
    font-weight: 500;
}

/* =====================================================
   PAGE HEADER
   ===================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.page-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    text-transform: capitalize;
}
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* =====================================================
   BADGES / PILLS
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(52,211,153,0.2);  }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2);  }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(248,113,113,0.2); }
.badge-purple { background: var(--accent-glow); color: var(--accent-light); border: 1px solid var(--border); }

/* =====================================================
   MODAL / FORM PANEL
   ===================================================== */
.form-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}
.form-panel h2 {
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 28px;
}

/* =====================================================
   PROGRESS BAR
   ===================================================== */
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}
.progress-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--grad);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.warning { background: linear-gradient(90deg, var(--yellow), #f59e0b); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--red), #ef4444); }

/* =====================================================
   SPINNER
   ===================================================== */
.spinner-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =====================================================
   TOAST
   ===================================================== */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 9999;
    max-width: 320px;
    backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: rgba(52,211,153,0.15); border: 1px solid rgba(52,211,153,0.3); color: var(--green); }
.toast.error   { background: var(--red-bg);  border: 1px solid rgba(248,113,113,0.3); color: var(--red);   }
.toast.info    { background: var(--accent-glow); border: 1px solid var(--border); color: var(--accent-light); }

/* =====================================================
   ALERTAS INLINE
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-warning { background: var(--yellow-bg); border: 1px solid rgba(251,191,36,0.2); color: var(--yellow); }
.alert-danger  { background: var(--red-bg);    border: 1px solid rgba(248,113,113,0.2); color: var(--red);   }
.alert-info    { background: var(--accent-glow); border: 1px solid var(--border); color: var(--accent-light); }

/* =====================================================
   KPI / ESTRATEGIA
   ===================================================== */
.kpi-section-title {
    font-family: var(--font-display);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.profitability-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(108,71,255,0.08);
}
.profitability-row:last-child { border-bottom: none; }

/* =====================================================
   ANIMACIONES
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* =====================================================
   REGISTRO — Planes y self-signup
   ===================================================== */
.reg-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    min-height: calc(100vh - var(--topbar-h));
    gap: 40px;
}
.reg-header { text-align: center; }

.planes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1100px;
}
@media (max-width: 900px) {
    .planes-grid { grid-template-columns: repeat(2, 1fr); }
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}
.plan-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}
.plan-destacado {
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-glow);
}
.plan-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--grad);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}
.plan-nombre {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
}
.plan-precio {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 4px 0;
}
.plan-monto {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    color: var(--accent-light);
}
.plan-periodo {
    font-size: 12px;
    color: var(--muted);
}
.plan-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
}
.plan-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
    padding: 8px 0;
    border-top: 1px solid var(--border);
}
.plan-features li {
    font-size: 13px;
    color: var(--muted);
}
.plan-features li b { color: var(--text); }

.btn-secondary-outline {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    box-shadow: none !important;
}
.btn-secondary-outline:hover {
    border-color: var(--accent) !important;
    background: rgba(108,71,255,0.08) !important;
}

/* =====================================================
   REGISTRO / PLANES
   ===================================================== */
.plan-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    width: 240px;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    position: relative;
}
.plan-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow);
}
.plan-card.destacado {
    border-color: var(--accent);
    box-shadow: 0 0 40px rgba(108,71,255,0.3);
    transform: translateY(-8px);
}

/* =====================================================
   RESPONSIVE — Mobile First
   ===================================================== */

/* ── TABLET (≤ 1024px) ── */
@media (max-width: 1024px) {
    .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .module-grid { flex-wrap: wrap; }
    .module-card { min-width: 200px; }
    .hub-title { font-size: 38px; }
}

/* ── MOBILE (≤ 768px) ── */
@media (max-width: 768px) {

    /* Body — permitir scroll en mobile */
    body { overflow: auto; height: auto; min-height: 100vh; }

    /* Topbar */
    .topbar { padding: 0 16px; height: 56px; }
    .logo { font-size: 15px; letter-spacing: 2px; }
    #user-name-display { display: none; }
    #org-name-display { display: none !important; }
    --topbar-h: 56px;

    /* Layout — sidebar se convierte en drawer */
    .app-layout { flex-direction: column; overflow: visible; }

    /* Sidebar — oculto por defecto, se abre con botón hamburguesa */
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
        overflow: visible;
    }
    .sidebar.hidden { display: none; }

    /* Sidebar nav — horizontal scroll en mobile */
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        gap: 4px;
        flex: unset;
    }
    .sidebar-module-label { display: none; }
    .nav-section-label { display: none; }
    .nav-item {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 12px;
        padding: 8px 12px;
    }
    .nav-item-special {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 12px;
        padding: 8px 12px;
        margin: 0;
    }
    .sidebar-footer { display: none; }

    /* Content */
    .view-content { padding: 20px 16px; overflow-y: visible; }

    /* Hub */
    .hub-wrap { padding: 24px 16px; gap: 32px; min-height: auto; }
    .hub-title { font-size: 30px; }
    .hub-eyebrow { font-size: 9px; }
    .module-grid { flex-direction: column; gap: 14px; }
    .module-card { width: 100%; max-width: 100%; padding: 28px 20px; }
    .module-icon { font-size: 40px; margin-bottom: 12px; }
    .module-card h3 { font-size: 18px; }

    /* Stats */
    .stat-grid { gap: 12px; }
    .stat-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .stat-val { font-size: 28px; }
    .stat-card { padding: 18px 16px; }

    /* Tablas — scroll horizontal */
    .table-card { border-radius: var(--radius-md); }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
    th, td { padding: 12px 14px; font-size: 12px; }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header > div:last-child {
        width: 100%;
        flex-wrap: wrap;
    }
    .page-title { font-size: 20px; }

    /* Formularios */
    .form-panel { padding: 24px 16px; border-radius: var(--radius-lg); }
    .form-row { flex-direction: column; gap: 0; }

    /* Login */
    .login-wrap { padding: 16px; min-height: calc(100vh - 56px); }
    .login-card { padding: 28px 20px; border-radius: var(--radius-lg); }
    .login-card h2 { font-size: 22px; }

    /* Planes / Registro */
    .module-grid { flex-direction: column; }

    /* Botones */
    .btn-primary { font-size: 13px; padding: 10px 16px; }

    /* Toast */
    .toast { bottom: 16px; right: 16px; left: 16px; max-width: none; font-size: 13px; }

    /* Dropdown menu */
    .dropdown-menu { right: -8px; }

    /* Buscador en tabla */
    #tabla-buscar { width: 140px !important; }

    /* Ocultar columnas menos importantes en mobile */
    .hide-mobile { display: none !important; }
}

/* ── MOBILE CHICO (≤ 480px) ── */
@media (max-width: 480px) {
    .stat-grid-3 { grid-template-columns: 1fr; }
    .stat-grid-4 { grid-template-columns: 1fr 1fr; }
    .hub-title { font-size: 26px; }
    .login-card { padding: 24px 16px; }
    #tabla-buscar { width: 110px !important; }
}

/* ── FIXES MOBILE ADICIONALES ── */
@media (max-width: 768px) {

    /* Fix stats cortadas — forzar ancho completo */
    .stat-grid { width: 100%; }
    .stat-card { min-width: 0; overflow: hidden; }
    .stat-val { font-size: 26px !important; word-break: break-all; }

    /* Fix view-content — permitir scroll vertical */
    .view-content {
        overflow-y: auto !important;
        overflow-x: hidden;
        height: auto;
        min-height: calc(100vh - 56px);
    }

    /* Fix app-layout — no cortar contenido */
    .app-layout {
        overflow: visible;
        height: auto;
    }

    /* Fix body overflow */
    body {
        overflow-y: auto !important;
        height: auto !important;
    }

    /* Fix tabla de asignaciones en equipo */
    .table-card { overflow: hidden; }
    .table-wrap { overflow-x: auto; width: 100%; }

    /* Fix page-header botón */
    .page-header .btn-primary { width: 100%; justify-content: center; }

    /* Fix estrategia — contenido vacío */
    #view-container {
        min-height: calc(100vh - 56px);
        overflow-y: auto;
    }
}

/* =====================================================
   AYUDA / WIKI
   ===================================================== */
.ayuda-container { max-width: 820px; padding: 0 8px; }
.ayuda-header { margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.ayuda-titulo { font-family: var(--font-display); font-size: 28px; font-weight: 800; margin: 0; }
.ayuda-content h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 32px 0 12px; color: var(--text); }
.ayuda-content h4 { font-size: 14px; font-weight: 700; margin: 20px 0 8px; color: var(--accent-light); }
.ayuda-content p { font-size: 14px; line-height: 1.7; color: var(--muted); margin: 0 0 12px; }
.ayuda-content ul, .ayuda-content ol { font-size: 14px; line-height: 1.8; color: var(--muted); padding-left: 20px; margin: 0 0 16px; }
.ayuda-content li { margin-bottom: 4px; }
.ayuda-content b { color: var(--text); }

.ayuda-tip {
    background: rgba(108,71,255,0.08);
    border: 1px solid rgba(108,71,255,0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 13px;
    color: var(--accent-light);
    margin: 16px 0;
    line-height: 1.6;
}
.ayuda-warning {
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 13px;
    color: var(--yellow);
    margin: 16px 0;
    line-height: 1.6;
}
.ayuda-formula {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text);
    margin: 16px 0;
}

.ayuda-steps { display: flex; flex-direction: column; gap: 16px; margin: 16px 0; }
.ayuda-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.ayuda-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grad);
    color: white;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ayuda-step p { margin: 4px 0 0; font-size: 13px; }
.ayuda-step b { font-size: 14px; }

.ayuda-table-wrap { overflow-x: auto; margin: 16px 0; }
.ayuda-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ayuda-table th { background: var(--bg); color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.ayuda-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--muted); }
.ayuda-table td:first-child { color: var(--text); }
.ayuda-table tr:hover td { background: rgba(255,255,255,0.02); }

.ayuda-faq { display: flex; flex-direction: column; gap: 12px; }
.ayuda-faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.ayuda-faq-q { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.ayuda-faq-a { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── AYUDA MEJORADO ── */
.ayuda-container { max-width: 760px; }
.ayuda-header { 
    margin-bottom: 36px; 
    padding-bottom: 24px; 
    border-bottom: 1px solid var(--border);
}
.ayuda-titulo { 
    font-family: var(--font-display); 
    font-size: 32px; 
    font-weight: 800; 
    margin: 0 0 8px;
    background: var(--grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ayuda-content { line-height: 1.7; }
.ayuda-content h3 { 
    font-family: var(--font-display); 
    font-size: 17px; 
    font-weight: 700; 
    margin: 36px 0 12px; 
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.ayuda-content h4 { 
    font-size: 13px; 
    font-weight: 700; 
    margin: 20px 0 8px; 
    color: var(--accent-light);
    letter-spacing: 0.5px;
}
.ayuda-content p { 
    font-size: 14px; 
    line-height: 1.8; 
    color: var(--muted); 
    margin: 0 0 14px; 
}
.ayuda-content ul, .ayuda-content ol { 
    font-size: 14px; 
    line-height: 1.9; 
    color: var(--muted); 
    padding-left: 22px; 
    margin: 0 0 16px; 
}
.ayuda-content li { margin-bottom: 6px; }
.ayuda-content b { color: var(--text); font-weight: 600; }
.ayuda-content strong { color: var(--accent-light); }

.ayuda-tip {
    background: rgba(108,71,255,0.06);
    border: 1px solid rgba(108,71,255,0.15);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text);
    margin: 20px 0;
    line-height: 1.7;
}
.ayuda-warning {
    background: rgba(251,191,36,0.05);
    border: 1px solid rgba(251,191,36,0.15);
    border-left: 3px solid var(--yellow);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text);
    margin: 20px 0;
    line-height: 1.7;
}
.ayuda-formula {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    font-family: monospace;
    font-size: 13px;
    line-height: 2;
    color: var(--text);
    margin: 20px 0;
}
.ayuda-steps { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.ayuda-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    transition: border-color 0.2s;
}
.ayuda-step:hover { border-color: rgba(108,71,255,0.3); }
.ayuda-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--grad);
    color: white;
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.ayuda-step p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.ayuda-step b { font-size: 14px; color: var(--text); }
.ayuda-table-wrap { overflow-x: auto; margin: 20px 0; border-radius: var(--radius-md); border: 1px solid var(--border); }
.ayuda-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ayuda-table th { 
    background: var(--bg); 
    color: var(--muted); 
    font-size: 10px; 
    letter-spacing: 1.5px; 
    text-transform: uppercase; 
    padding: 12px 16px; 
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}
.ayuda-table td { 
    padding: 12px 16px; 
    border-bottom: 1px solid rgba(255,255,255,0.04); 
    color: var(--muted); 
    font-size: 13px;
}
.ayuda-table td:first-child { color: var(--text); font-weight: 500; }
.ayuda-table tr:last-child td { border-bottom: none; }
.ayuda-table tr:hover td { background: rgba(255,255,255,0.02); }
.ayuda-faq { display: flex; flex-direction: column; gap: 10px; }
.ayuda-faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    transition: border-color 0.2s;
}
.ayuda-faq-item:hover { border-color: rgba(108,71,255,0.3); }
.ayuda-faq-q { 
    font-weight: 700; 
    font-size: 14px; 
    margin-bottom: 10px; 
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ayuda-faq-q::before { content: '?'; background: var(--grad); color: white; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.ayuda-faq-a { font-size: 13px; color: var(--muted); line-height: 1.7; padding-left: 28px; }