:root {
    --gold: #C9A84C;
    --blue-dark: #1A1B38;
    --blue-sidebar: #0D1F3C;
    --blue-darker: #0a0f1e;
    --white: #FFFFFF;
    --text-color: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.6);
    --bg-body: #0a0f1e;
    --bg-card: #0f1729;
    --bg-input: #0f1729;
    --bg-main: #070d1a;
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-border: rgba(201, 168, 76, 0.2);
    --border-color: rgba(255, 255, 255, 0.1);
    --logo-url: url('/assets/logowhite.png');
}

body.light-mode {
    --bg-body: #f0f4fa;
    --bg-card: #FFFFFF;
    --bg-input: #f1f4f9;
    --bg-main: #f0f2f8;
    --blue-sidebar: #FFFFFF;
    --blue-darker: #f0f4fa;
    --text-color: #0D1F3C;
    --text-muted: rgba(13, 31, 60, 0.6);
    --input-bg: #f8f9fc;
    --input-border: rgba(0, 0, 0, 0.12);
    --border-color: rgba(0, 0, 0, 0.1);
    --logo-url: url('/assets/logoblue.png');
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; transition: background-color 0.3s, color 0.3s; }

body {
    background: linear-gradient(160deg, #0a0f1e 0%, #0D1F3C 100%);
    background-attachment: fixed;
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    top: -80px; right: -80px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    bottom: -80px; left: -80px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201,168,76,0.04) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.hidden { display: none !important; }
.flex { display: flex; }
.w-full { width: 100%; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn { padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; border: none; font-size: 0.9rem; font-family: 'Poppins', sans-serif; transition: all 0.2s ease; }
.btn-primary { background: linear-gradient(135deg, #C9A84C 0%, #a8853a 100%); color: #0D1F3C; box-shadow: 0 4px 15px rgba(201,168,76,0.3); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 4px 20px rgba(201,168,76,0.5); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }
.btn-outline:hover { border-color: rgba(201,168,76,0.4); color: var(--text-color); background: rgba(201,168,76,0.05); }
.btn-success { background-color: rgba(76, 217, 100, 0.2); color: #4cd964; border: 1px solid #4cd964; }
.btn-danger { background-color: rgba(255, 59, 48, 0.2); color: #ff3b30; border: 1px solid #ff3b30; }
.btn-small { padding: 6px 12px; font-size: 0.8rem; }

/* ── Forms ───────────────────────────────────────────────────────────── */
input, select, textarea {
    width: 100%;
    padding: 12px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-color);
    margin-bottom: 10px;
    outline: none;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(201,168,76,0.12);
}
/* Opciones del dropdown en dark-mode: fondo oscuro sólido + texto claro.
   Sin esto el navegador pinta el popup en blanco con texto blanco (invisible).
   El light-mode tiene su propia regla con !important más abajo. */
select option, select optgroup {
    background-color: #0f1729;
    color: #FFFFFF;
}
label { display: block; margin-bottom: 4px; font-size: 0.85rem; font-weight: 500; opacity: 0.9; }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-wrapper {
    height: 100vh; width: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #0a0f1e 0%, #0D1F3C 100%);
    position: relative; overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute; top: -80px; right: -80px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201,168,76,0.07) 0%, transparent 65%);
    pointer-events: none;
}
.login-wrapper::after {
    content: '';
    position: absolute; bottom: -80px; left: -80px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201,168,76,0.05) 0%, transparent 65%);
    pointer-events: none;
}
.login-card {
    background: linear-gradient(160deg, #0f1729 0%, #0D1F3C 100%);
    padding: 40px;
    border-radius: 20px;
    width: 100%; max-width: 400px;
    border: 1px solid rgba(201,168,76,0.25);
    text-align: center;
    box-shadow: 0 0 40px rgba(201,168,76,0.1), 0 20px 60px rgba(0,0,0,0.5);
    position: relative; z-index: 1;
}
.logo-login { content: var(--logo-url); max-width: 140px; display: block; margin: 0 auto 20px auto; }

/* ── Logo fix — sin fondo cuadrado ───────────────────────────────────────── */
.logo-sidebar, .logo-login, img[src*="logo"] {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    mix-blend-mode: lighten;
}
/* En modo claro el sidebar es blanco: lighten sobre blanco = invisible.
   Se usa normal para que logoblue.png se vea correctamente. */
body.light-mode .logo-sidebar,
body.light-mode .logo-login,
body.light-mode img[src*="logo"] {
    mix-blend-mode: normal;
}

/* ── Dashboard Layout ────────────────────────────────────────────────── */
.dashboard-wrapper { display: flex; height: 100vh; position: relative; z-index: 1; }

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0D1F3C 0%, #070d1a 100%);
    border-right: 1px solid rgba(201,168,76,0.15);
    display: flex; flex-direction: column;
    padding: 20px 0; overflow-y: auto; flex-shrink: 0;
}
.logo-sidebar { content: var(--logo-url); max-width: 100px; display: block; margin: 0 auto 30px auto; }

/* ── Sidebar Menu ────────────────────────────────────────────────────── */
.menu-toggle {
    display: flex; align-items: center;
    padding: 12px 25px;
    color: var(--gold); font-weight: 600; cursor: pointer;
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
    justify-content: space-between; margin-top: 10px;
    transition: background 0.2s;
}
.menu-toggle:hover { background: rgba(201, 168, 76, 0.05); }
.menu-toggle .arrow { font-size: 0.7rem; transition: transform 0.3s; }
.menu-toggle.open .arrow { transform: rotate(180deg); }

.submenu { display: flex; flex-direction: column; background: rgba(0, 0, 0, 0.15); }

.menu-item.sub-item {
    padding-left: 45px !important;
    font-size: 0.85rem !important;
    border-left: 3px solid transparent !important;
    color: var(--text-muted);
    transition: all 0.2s ease;
}
.menu-item.sub-item:hover {
    background: rgba(201, 168, 76, 0.07) !important;
    border-left-color: rgba(201,168,76,0.45) !important;
    color: rgba(201,168,76,0.88) !important;
}
.menu-item.sub-item.active {
    background: linear-gradient(90deg, rgba(201,168,76,0.13) 0%, rgba(201,168,76,0.03) 100%) !important;
    border-left-color: #C9A84C !important;
    color: #C9A84C !important;
}

.menu-item {
    display: flex; align-items: center;
    padding: 12px 25px;
    color: var(--text-muted); text-decoration: none;
    font-size: 0.9rem; cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.menu-item.active, .menu-item:hover {
    background: rgba(201, 168, 76, 0.08);
    color: var(--text-color);
    border-left-color: var(--gold);
}
.menu-icon { margin-right: 12px; width: 20px; text-align: center; opacity: 0.8; }

.main-content { flex-grow: 1; display: flex; flex-direction: column; background: transparent; overflow: hidden; }

.top-bar {
    height: 70px;
    background: rgba(10,20,45,0.97);
    border-bottom: 1px solid rgba(201,168,76,0.15);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
}
.top-bar h2 {
    text-shadow: 0 0 30px rgba(201,168,76,0.2);
}

.content-area { padding: 30px; overflow-y: auto; height: 100%; }

/* ── Summary Cards ───────────────────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 25px; }
.summary-card {
    background: var(--bg-card);
    padding: 15px; border-radius: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.summary-card:hover {
    border-color: rgba(201,168,76,0.3);
    box-shadow: 0 0 18px rgba(201,168,76,0.1);
}
.summary-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--gold); }
.summary-label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs-container { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); overflow-x: auto; }
.tab-btn { background: none; border: none; padding: 10px 15px; color: var(--text-muted); font-size: 0.95rem; cursor: pointer; white-space: nowrap; font-family: 'Poppins', sans-serif; transition: color 0.2s; }
.tab-btn.active { color: var(--gold); font-weight: 600; border-bottom: 2px solid var(--gold); }

/* ── Tables ──────────────────────────────────────────────────────────── */
.table-wrapper {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    box-shadow: 0 0 20px rgba(201,168,76,0.05);
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { color: var(--gold); font-size: 0.85rem; text-transform: uppercase; }
td { font-size: 0.9rem; color: var(--text-muted); }
tr:hover td { background: rgba(201,168,76,0.03); }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-active   { background: rgba(76, 217, 100, 0.2); color: #4cd964; }
.status-inactive { background: rgba(255, 59, 48, 0.2);  color: #ff3b30; }
.status-expiring { background: rgba(255, 149, 0, 0.2);  color: #ff9500; }
.status-warning  { background: rgba(255, 204, 0, 0.2);  color: #ffcc00; }

/* ── User Profile ────────────────────────────────────────────────────── */
.search-container {
    background: var(--bg-card); padding: 20px; border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px; display: flex; gap: 15px; align-items: flex-end;
}
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
.info-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.info-card:hover {
    border-color: rgba(201,168,76,0.25);
    box-shadow: 0 0 20px rgba(201,168,76,0.07);
}
.info-card h4 { color: var(--gold); font-weight: 600; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.info-row { display: flex; justify-content: space-between; font-size: 0.9rem; }
.info-label { color: var(--text-muted); }
.info-val { font-weight: 600; color: var(--text-color); }
.sponsor-highlight { border-color: var(--gold); background: rgba(201, 168, 76, 0.05); }

/* ── Comments & Chat ─────────────────────────────────────────────────── */
.comments-section { background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border-color); padding: 25px; }
.comment-input-area { display: flex; gap: 10px; margin-bottom: 20px; align-items: flex-start; }
.comment-list { display: flex; flex-direction: column; gap: 15px; max-height: 400px; overflow-y: auto; }
.comment-item { background: var(--input-bg); border-radius: 8px; padding: 15px; border-left: 3px solid var(--gold); }
.comment-meta { font-size: 0.8rem; color: var(--gold); margin-bottom: 5px; display: flex; justify-content: space-between; }
.comment-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.4; }

.chat-section { background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border-color); padding: 20px; height: 500px; display: flex; flex-direction: column; }
.chat-history { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; margin-bottom: 15px; padding-right: 5px; }
.chat-bubble { max-width: 70%; padding: 12px 16px; border-radius: 12px; font-size: 0.9rem; line-height: 1.4; position: relative; }
.bubble-admin { align-self: flex-end; background: linear-gradient(135deg, #C9A84C 0%, #a8853a 100%); color: #0D1F3C; border-bottom-right-radius: 2px; }
.bubble-user  { align-self: flex-start; background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--border-color); border-bottom-left-radius: 2px; }
.bubble-time  { font-size: 0.7rem; opacity: 0.7; margin-top: 5px; display: block; text-align: right; }

.chat-container { display: flex; height: calc(100vh - 100px); background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.chat-sidebar   { width: 320px; border-right: 1px solid var(--border-color); display: flex; flex-direction: column; background: rgba(0,0,0,0.1); }
.chat-search    { padding: 15px; border-bottom: 1px solid var(--border-color); }
.chat-list      { overflow-y: auto; flex-grow: 1; }
.chat-item      { display: flex; padding: 15px; cursor: pointer; border-bottom: 1px solid var(--border-color); transition: background 0.2s; }
.chat-item:hover, .chat-item.active { background: rgba(201, 168, 76, 0.1); border-left: 3px solid var(--gold); }
.chat-avatar    { width: 45px; height: 45px; background: linear-gradient(135deg, #C9A84C 0%, #a8853a 100%); color: #0D1F3C; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 12px; position: relative; }
.online-dot     { width: 10px; height: 10px; background: #4cd964; border-radius: 50%; position: absolute; bottom: 0; right: 0; border: 2px solid var(--bg-card); }
.chat-info      { flex-grow: 1; overflow: hidden; }
.chat-name      { font-weight: 600; font-size: 0.95rem; color: var(--text-color); display: flex; justify-content: space-between; }
.chat-time      { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.chat-preview   { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.unread-badge   { background: var(--gold); color: #0D1F3C; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; font-weight: bold; margin-left: 5px; }
.chat-main      { flex-grow: 1; display: flex; flex-direction: column; background: var(--bg-card); }
.chat-header    { padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); }
.chat-messages  { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.message        { max-width: 70%; padding: 12px 16px; border-radius: 12px; font-size: 0.95rem; line-height: 1.4; position: relative; }
.msg-in         { align-self: flex-start; background: var(--input-bg); border: 1px solid var(--border-color); border-bottom-left-radius: 2px; }
.msg-out        { align-self: flex-end; background: linear-gradient(135deg, #C9A84C 0%, #a8853a 100%); color: #0D1F3C; border-bottom-right-radius: 2px; }
.msg-time       { font-size: 0.7rem; opacity: 0.7; display: block; text-align: right; margin-top: 5px; }
.chat-input-area { padding: 15px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; align-items: flex-end; background: rgba(0,0,0,0.2); }

.campaign-options { display: flex; gap: 10px; margin-bottom: 15px; }
.camp-chip { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 20px; font-size: 0.85rem; cursor: pointer; color: var(--text-muted); transition: all 0.2s; }
.camp-chip:hover { border-color: rgba(201,168,76,0.3); color: var(--text-color); }
.camp-chip.selected { background: linear-gradient(135deg, #C9A84C 0%, #a8853a 100%); color: #0D1F3C; border-color: var(--gold); font-weight: 600; }

/* ── Modals ──────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: linear-gradient(160deg, #0f1729 0%, #0D1F3C 100%);
    width: 95%; max-width: 900px;
    border-radius: 16px;
    border: 1px solid rgba(201,168,76,0.25);
    display: flex; flex-direction: column; max-height: 90vh;
    box-shadow: 0 0 40px rgba(201,168,76,0.1), 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header { padding: 20px 25px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-body   { padding: 25px; overflow-y: auto; }
.modal-body.grid-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.modal-footer { padding: 20px 25px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

.form-section-title { grid-column: span 2; color: var(--gold); font-size: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; margin-bottom: 10px; margin-top: 10px; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 15px; }
.multiplier-card { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-color); padding: 15px; border-radius: 8px; }
.multiplier-info { font-size: 0.85rem; color: var(--text-muted); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc-total { grid-column: span 2; background: rgba(201, 168, 76, 0.1); border: 1px solid var(--gold); padding: 15px; border-radius: 8px; text-align: right; margin-top: 10px; }

.rank-progress { margin-bottom: 20px; }
.progress-bar  { background: var(--input-bg); border-radius: 10px; height: 10px; width: 100%; position: relative; overflow: hidden; margin-top: 8px; }
.progress-fill { background: linear-gradient(90deg, #C9A84C, #ffd700); height: 100%; width: 24%; transition: width 0.5s; }
.rank-label    { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
.details-section-title { color: var(--gold); font-size: 0.95rem; margin-bottom: 10px; margin-top: 20px; text-transform: uppercase; letter-spacing: 1px; }
.mini-table th { font-size: 0.75rem; padding: 10px; }
.mini-table td { font-size: 0.8rem; padding: 10px; }

/* ── Sidebar Badge ───────────────────────────────────────────────────── */
.sidebar-badge { background: #ff3b30; color: #fff; font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 10px; margin-left: auto; flex-shrink: 0; }

/* ── Alert Cards ─────────────────────────────────────────────────────── */
.alert-section-title { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; padding: 8px 12px; border-radius: 8px; }
.alert-red    { background: rgba(255,59,48,0.15);  color: #ff3b30; }
.alert-orange { background: rgba(255,149,0,0.15);  color: #ff9500; }
.alert-gray   { background: rgba(255,255,255,0.07); color: var(--text-muted); }
.alert-card   { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; transition: border-color 0.2s; }
.alert-card.urgent      { border-left: 4px solid #ff3b30; }
.alert-card.warning     { border-left: 4px solid #ff9500; }
.alert-card.recoverable { border-left: 4px solid var(--text-muted); }
.alert-card-info { flex: 1; min-width: 180px; }
.alert-card-info .name { font-weight: 600; font-size: 0.95rem; }
.alert-card-info .meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.alert-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Event Cards ─────────────────────────────────────────────────────── */
.event-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: 16px; margin-bottom: 12px; display: flex; gap: 16px; align-items: flex-start; transition: border-color 0.2s, box-shadow 0.2s; }
.event-card:hover { border-color: rgba(201,168,76,0.3); box-shadow: 0 0 18px rgba(201,168,76,0.08); }
.event-date-box { min-width: 52px; height: 52px; background: rgba(201,168,76,0.15); border: 1px solid var(--gold); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.event-date-box .day   { font-size: 1.3rem; font-weight: 700; color: var(--gold); line-height: 1; }
.event-date-box .month { font-size: 0.6rem; text-transform: uppercase; color: var(--text-muted); }
.event-info        { flex: 1; }
.event-info .title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.event-info .details { font-size: 0.8rem; color: var(--text-muted); }
.event-type-badge { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 12px; }
.ev-live    { background: rgba(76,217,100,0.2);  color: #4cd964; }
.ev-webinar { background: rgba(90,200,250,0.2);  color: #5ac8fa; }
.ev-meeting { background: rgba(201,168,76,0.2);  color: var(--gold); }

/* ── Signal Cards ────────────────────────────────────────────────────── */
.signal-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 18px; margin-bottom: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
.signal-card:hover { border-color: rgba(201,168,76,0.3); box-shadow: 0 0 20px rgba(201,168,76,0.08); }
.signal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.signal-asset  { font-size: 1.3rem; font-weight: 700; color: var(--gold); }
.sig-long  { background: rgba(76,217,100,0.2);  color: #4cd964; padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; }
.sig-short { background: rgba(255,59,48,0.2);   color: #ff3b30; padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; }
.signal-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 10px; margin: 12px 0; }
.level-box     { background: var(--input-bg); border-radius: 8px; padding: 10px; text-align: center; }
.level-box .lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.level-box .val { font-size: 1rem; font-weight: 600; margin-top: 2px; }
.level-box.entry { border: 1px solid var(--gold); }
.level-box.sl    { border: 1px solid #ff3b30; }
.level-box.tp    { border: 1px solid #4cd964; }
.signal-status { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 12px; }
.sig-active { background: rgba(90,200,250,0.2);  color: #5ac8fa; }
.sig-tp1    { background: rgba(76,217,100,0.2);  color: #4cd964; }
.sig-tp2    { background: rgba(76,217,100,0.35); color: #4cd964; }
.sig-tp3    { background: rgba(76,217,100,0.5);  color: #4cd964; }
.sig-sl     { background: rgba(255,59,48,0.2);   color: #ff3b30; }
.sig-closed { background: rgba(255,255,255,0.1); color: var(--text-muted); }

/* ── Wallet & Commission Badges ──────────────────────────────────────── */
.wallet-type  { font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: rgba(201,168,76,0.2); color: var(--gold); }
.comm-paid    { background: rgba(76,217,100,0.2);  color: #4cd964; font-size: 0.75rem; padding: 3px 9px; border-radius: 10px; font-weight: 700; }
.comm-pending { background: rgba(255,149,0,0.2);   color: #ff9500; font-size: 0.75rem; padding: 3px 9px; border-radius: 10px; font-weight: 700; }
.comm-cancel  { background: rgba(255,59,48,0.2);   color: #ff3b30; font-size: 0.75rem; padding: 3px 9px; border-radius: 10px; font-weight: 700; }

/* ── Referral Tree ───────────────────────────────────────────────────── */
.tree-node { margin-left: 20px; border-left: 2px solid var(--border-color); padding-left: 14px; margin-bottom: 4px; }
.tree-root { margin-left: 0; border-left: none; padding-left: 0; }
.tree-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 14px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; transition: border-color 0.2s; }
.tree-item:hover { border-color: rgba(201,168,76,0.25); }
.tree-item .tree-name { font-weight: 600; font-size: 0.9rem; }
.tree-item .tree-meta { font-size: 0.78rem; color: var(--text-muted); }


/* ════════════════════════════════════════════════════════════════════════
   LIGHT MODE — overrides completos
   ════════════════════════════════════════════════════════════════════════ */

body.light-mode {
    background: linear-gradient(160deg, #f0f4fa 0%, #e8edf8 100%) !important;
    background-attachment: fixed !important;
}
body.light-mode::before,
body.light-mode::after { display: none !important; }

/* Sidebar */
body.light-mode .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fc 100%) !important;
    border-right: 1px solid rgba(201,168,76,0.25) !important;
}
body.light-mode .menu-item.sub-item.active {
    background: linear-gradient(90deg, rgba(201,168,76,0.18) 0%, rgba(201,168,76,0.05) 100%) !important;
    border-left-color: #C9A84C !important;
    color: #7a5c1e !important;
}
body.light-mode .menu-item.sub-item:hover {
    background: rgba(201,168,76,0.1) !important;
    border-left-color: rgba(201,168,76,0.5) !important;
    color: #8a6b2a !important;
}
body.light-mode .menu-item.active,
body.light-mode .menu-item:hover {
    background: rgba(201,168,76,0.1) !important;
    color: #0D1F3C !important;
}
body.light-mode .menu-toggle { color: #7a5c1e !important; }
body.light-mode .menu-icon { filter: grayscale(1) opacity(0.45); }
body.light-mode .menu-item.active .menu-icon,
body.light-mode .menu-item:hover .menu-icon,
body.light-mode .menu-item.sub-item.active .menu-icon,
body.light-mode .menu-item.sub-item:hover .menu-icon { filter: grayscale(0) opacity(0.85); }

/* Top bar */
body.light-mode .top-bar {
    background: rgba(255,255,255,0.97) !important;
    border-bottom: 1px solid rgba(201,168,76,0.2) !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06) !important;
}
body.light-mode .top-bar h2 { text-shadow: none !important; }

/* Summary cards */
body.light-mode .summary-card {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.1) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
}
body.light-mode .summary-card:hover {
    border-color: rgba(201,168,76,0.3) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 0 12px rgba(201,168,76,0.08) !important;
}

/* Info cards */
body.light-mode .info-card {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.1) !important;
}
body.light-mode .info-card:hover {
    border-color: rgba(201,168,76,0.3) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
}
body.light-mode .info-card h4 { border-bottom-color: rgba(0,0,0,0.1) !important; }

/* Tables */
body.light-mode .table-wrapper {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.1) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05) !important;
}
body.light-mode th { color: #7a5c1e !important; }
body.light-mode td { color: rgba(13,31,60,0.75) !important; }
body.light-mode th, body.light-mode td { border-bottom-color: rgba(0,0,0,0.07) !important; }
body.light-mode tr:hover td { background: rgba(201,168,76,0.04) !important; }

/* Search container */
body.light-mode .search-container {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.1) !important;
}

/* Chat */
body.light-mode .chat-container,
body.light-mode .chat-main { background: #ffffff !important; border-color: rgba(0,0,0,0.1) !important; }
body.light-mode .chat-header  { background: rgba(0,0,0,0.03) !important; }
body.light-mode .chat-input-area { background: rgba(0,0,0,0.02) !important; }
body.light-mode .chat-sidebar { background: rgba(0,0,0,0.02) !important; }
body.light-mode .chat-item:hover, body.light-mode .chat-item.active { background: rgba(201,168,76,0.1) !important; }
body.light-mode .chat-name { color: #0D1F3C !important; }
body.light-mode .online-dot { border-color: #ffffff !important; }

/* Modals */
body.light-mode .modal-overlay { background: rgba(0,0,0,0.4) !important; }
body.light-mode .modal-content {
    background: #ffffff !important;
    border-color: rgba(201,168,76,0.2) !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15) !important;
}

/* Event cards */
body.light-mode .event-card { background: #ffffff !important; border-color: rgba(0,0,0,0.1) !important; }
body.light-mode .event-card:hover { border-color: rgba(201,168,76,0.3) !important; box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important; }

/* Signal cards */
body.light-mode .signal-card { background: #ffffff !important; border-color: rgba(0,0,0,0.1) !important; }
body.light-mode .signal-card:hover { border-color: rgba(201,168,76,0.3) !important; box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important; }
body.light-mode .level-box { background: rgba(0,0,0,0.04) !important; }

/* Alert cards */
body.light-mode .alert-card { background: #ffffff !important; border-color: rgba(0,0,0,0.1) !important; }
body.light-mode .alert-gray { background: rgba(0,0,0,0.05) !important; color: rgba(13,31,60,0.6) !important; }

/* Referral tree */
body.light-mode .tree-item { background: #ffffff !important; border-color: rgba(0,0,0,0.1) !important; }
body.light-mode .tree-node { border-left-color: rgba(0,0,0,0.1) !important; }
body.light-mode .tree-item:hover { border-color: rgba(201,168,76,0.3) !important; }

/* Buttons */
body.light-mode .btn-outline {
    border-color: rgba(0,0,0,0.2) !important;
    color: rgba(13,31,60,0.7) !important;
}
body.light-mode .btn-outline:hover {
    border-color: rgba(201,168,76,0.4) !important;
    color: #0D1F3C !important;
    background: rgba(201,168,76,0.08) !important;
}

/* Forms */
body.light-mode input, body.light-mode select, body.light-mode textarea {
    background: #f8f9fc !important;
    border-color: rgba(0,0,0,0.12) !important;
    color: #0D1F3C !important;
}
body.light-mode input:focus, body.light-mode select:focus, body.light-mode textarea:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 2px rgba(201,168,76,0.12) !important;
}
body.light-mode input::placeholder, body.light-mode textarea::placeholder {
    color: rgba(13,31,60,0.4) !important;
}
body.light-mode select option { background: #ffffff !important; color: #0D1F3C !important; }

/* Comments */
body.light-mode .comment-item { background: rgba(0,0,0,0.03) !important; }
body.light-mode .comment-text { color: rgba(13,31,60,0.75) !important; }
body.light-mode .comments-section { background: #ffffff !important; border-color: rgba(0,0,0,0.1) !important; }

/* Misc */
body.light-mode .tabs-container { border-bottom-color: rgba(0,0,0,0.1) !important; }
body.light-mode .tab-btn { color: rgba(13,31,60,0.6) !important; }
body.light-mode .camp-chip { color: rgba(13,31,60,0.6) !important; border-color: rgba(0,0,0,0.15) !important; }
body.light-mode .camp-chip.selected { color: #0D1F3C !important; }
body.light-mode .multiplier-card { background: rgba(0,0,0,0.03) !important; border-color: rgba(0,0,0,0.1) !important; }
body.light-mode .login-wrapper { background: linear-gradient(160deg, #f0f4fa 0%, #e8edf8 100%) !important; }
body.light-mode .login-card {
    background: #ffffff !important;
    border-color: rgba(201,168,76,0.2) !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.1) !important;
}
body.light-mode .msg-in { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.1) !important; color: #0D1F3C !important; }
body.light-mode .bubble-user { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.1) !important; color: #0D1F3C !important; }

/* ─── University — light mode fixes ─────────────────────────────────────── */
body.light-mode .classroom-sidebar { background: #f8f9fa; border-right: 1px solid #e0e0e0; color: #1A1B38; }
body.light-mode .lesson-item { color: #1A1B38; border-color: #e0e0e0; }
body.light-mode .lesson-item:hover { background: rgba(196,165,109,0.1); }
body.light-mode .lesson-item.active { background: rgba(196,165,109,0.15); border-left-color: #C4A56D; color: #1A1B38; }
body.light-mode .module-header { color: #1A1B38; background: #f0f0f0; }
body.light-mode .video-container { background: #ffffff; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
body.light-mode .lesson-title-header { color: #1A1B38; background: #ffffff; }
body.light-mode .university-grid .course-card { background: #ffffff !important; border: 1px solid #e0e0e0 !important; color: #1A1B38 !important; }
body.light-mode .course-card-title { color: #1A1B38 !important; }
body.light-mode .course-card-desc { color: rgba(13,31,60,0.6) !important; }
body.light-mode .classroom-container { background: #f0f4fa; }
body.light-mode .classroom-content { background: #ffffff; }
body.light-mode .lesson-notes { background: #f8f9fa; border: 1px solid #e0e0e0; color: #1A1B38; }
body.light-mode .lesson-notes::placeholder { color: rgba(13,31,60,0.35); }

/* ════════════════════════════════════════════════════════════════════════
   RESPONSIVE / MÓVIL — capa aditiva. SOLO aplica en pantallas ≤ 768px, así
   que el escritorio queda EXACTAMENTE igual. El sidebar se vuelve un drawer
   deslizable que se abre con el botón hamburguesa (inyectado por sidebar.js).
   ════════════════════════════════════════════════════════════════════════ */

/* Controles del menú móvil: ocultos en escritorio */
.mobile-menu-btn { display: none; }
.mobile-sidebar-overlay { display: none; }

/* Inbox WhatsApp: el botón "← Volver" solo existe en móvil (ver media query) */
.inbox-back { display: none; }

@media (max-width: 768px) {
  /* ── Sidebar como drawer deslizable ── */
  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100%; width: 250px; max-width: 82vw;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: 4px 0 28px rgba(0,0,0,0.45);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* Overlay oscuro detrás del drawer */
  .mobile-sidebar-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1050; opacity: 0; pointer-events: none;
    transition: opacity 0.28s ease;
  }
  .mobile-sidebar-overlay.show { opacity: 1; pointer-events: auto; }

  /* Botón hamburguesa en el top-bar */
  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex-shrink: 0; padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    color: var(--gold); font-size: 1.4rem; line-height: 1;
    cursor: pointer;
  }

  /* El contenido ocupa todo el ancho (sidebar fuera de flujo) */
  .main-content { width: 100%; min-width: 0; }

  /* ── Top bar compacta ── */
  .top-bar { padding: 0 12px !important; height: 60px; gap: 10px; }
  .top-bar h2 { font-size: 1rem !important; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .view-as-member-btn { display: none !important; }

  /* ── Área de contenido ── */
  .content-area { padding: 16px 12px !important; overflow-x: hidden; }

  /* Áreas táctiles más cómodas en el menú */
  .menu-item { padding: 14px 22px; }

  /* ── Tablas: scroll horizontal cómodo ── */
  .table-wrapper { -webkit-overflow-scrolling: touch; }
  th, td { padding: 12px 14px; }

  /* ── Buscador de usuarios apilado ── */
  .search-container { flex-direction: column !important; align-items: stretch !important; padding: 16px; gap: 10px; }
  .search-container > div { width: 100% !important; min-width: 0 !important; }

  /* ── Tarjetas resumen ── */
  .summary-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
  .summary-num { font-size: 1.3rem; }

  /* ── Modales a casi pantalla completa ── */
  .modal-content { width: 96% !important; max-width: 96% !important; max-height: 92vh; }
  .modal-header { padding: 16px !important; }
  .modal-footer { padding: 16px !important; flex-wrap: wrap; }
  .modal-body { padding: 16px !important; }
  .modal-body.grid-layout { grid-template-columns: 1fr !important; gap: 18px; }
  .form-section-title { grid-column: span 1 !important; }
  .calc-total { grid-column: span 1 !important; }

  /* ── Cards con acciones: que envuelvan en vez de desbordar ── */
  .alert-card, .tree-item, .signal-header { flex-wrap: wrap; }

  /* ── Chat genérico (clases compartidas): apilar en una columna ── */
  .chat-container { flex-direction: column; height: auto; }
  .chat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); max-height: 40vh; }

  /* ── Inbox WhatsApp: una sola columna a la vez (lista ↔ hilo) ──
     En móvil se ve la lista a pantalla completa; al abrir una conversación
     se oculta la lista y el hilo ocupa todo, con botón "← Volver".
     Escritorio queda intacto (esto solo aplica ≤768px). */
  #inbox-layout { gap: 0 !important; height: calc(100vh - 124px) !important; min-height: 0 !important; }
  #inbox-layout .inbox-list-pane { width: 100% !important; }
  #inbox-layout .inbox-thread-pane { display: none !important; }
  #inbox-layout.thread-open .inbox-list-pane { display: none !important; }
  #inbox-layout.thread-open .inbox-thread-pane { display: flex !important; }
  .inbox-back { display: inline-flex !important; align-items: center; }
}

/* Teléfonos pequeños */
@media (max-width: 480px) {
  .profile-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .chat-bubble, .message { max-width: 86%; }
  .top-bar h2 { font-size: 0.92rem !important; }
}
