:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1d212b;
    --border: #232833;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --accent: #4f8cff;
    --accent-weak: #24314f;
    --danger: #ff6b74;
    --topbar-h: 60px;
    --sidebar-w: 248px;
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt { margin-top: 1.25rem; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ══════════════ Topbar ══════════════ */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 40;
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1rem;
    background: rgba(23, 26, 33, .9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: .5rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; }
.brand-mark {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #7aa7ff); color: #fff; font-weight: 800;
}

.topbar-search {
    position: relative; flex: 1 1 auto; max-width: 520px;
    display: flex; align-items: center;
}
.topbar-search .search-icon { position: absolute; left: .7rem; color: var(--muted); }
.topbar-search input {
    width: 100%; padding: .55rem .8rem .55rem 2.3rem;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
    color: var(--text); font-size: .95rem;
}
.topbar-search input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.topbar-right { display: flex; align-items: center; gap: .35rem; margin-left: auto; }

.icon-btn {
    position: relative; display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: transparent; border: 0; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); }
.badge {
    position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
    font-size: .7rem; line-height: 16px; text-align: center;
}

/* ── User menu ── */
.user-menu { position: relative; }
.user-trigger {
    display: flex; align-items: center; gap: .5rem;
    background: transparent; border: 0; color: var(--text); cursor: pointer;
    padding: .25rem .4rem; border-radius: 10px;
}
.user-trigger:hover { background: var(--panel-2); }
.chevron { width: 16px; height: 16px; color: var(--muted); }
.avatar {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent-weak); color: #cfe0ff; font-size: .8rem; font-weight: 700;
}
.avatar-lg { width: 42px; height: 42px; font-size: 1rem; }

.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); width: 240px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: .4rem; z-index: 50;
}
.dropdown-head { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; }
.dropdown-head strong { display: block; }
.dropdown-sep { height: 1px; background: var(--border); margin: .35rem 0; }
.dropdown-item {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    padding: .55rem .6rem; border-radius: 9px; color: var(--text);
    background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.dropdown-item:hover { background: var(--panel-2); }
.dropdown-item .icon { color: var(--muted); }

/* ══════════════ Body / Sidebar / Content ══════════════ */
.app-body { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }

.sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 30;
    display: flex; flex-direction: column; justify-content: space-between;
    background: var(--panel); border-right: 1px solid var(--border);
    padding: .75rem; overflow-y: auto;
}
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .7rem; border-radius: 10px; color: var(--text); font-weight: 500;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.is-active { background: var(--accent-weak); color: #dbe7ff; }
.nav-item.is-active .icon { color: var(--accent); }
.nav-item .icon { color: var(--muted); }
.nav-item.is-disabled { color: var(--muted); cursor: default; }
.nav-item.is-disabled:hover { background: transparent; }
.pill {
    margin-left: auto; font-size: .68rem; padding: .1rem .45rem; border-radius: 999px;
    background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.sidebar-foot { border-top: 1px solid var(--border); padding-top: .5rem; margin-top: .5rem; }

.sidebar-backdrop {
    position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 25;
    background: rgba(0,0,0,.5);
}

.content {
    flex: 1 1 auto; min-width: 0;
    margin-left: var(--sidebar-w);
    padding: 1.5rem;
    max-width: 1100px;
}
.content:focus { outline: none; }

/* ══════════════ Cards / Hero ══════════════ */
.campus-hero {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 2rem;
}
.campus-hero h1 { margin: 0 0 .5rem; font-size: 1.8rem; }
.btn-ghost {
    padding: .6rem 1rem; border-radius: 9px; border: 1px solid var(--border);
    background: transparent; color: var(--text); cursor: pointer;
}

/* ══════════════ Páginas / Mis cursos ══════════════ */
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { margin: 0 0 .25rem; font-size: 1.6rem; }

.btn-primary {
    display: inline-block; padding: .6rem 1.1rem; border-radius: 9px; border: 0;
    background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
    text-align: center;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary.is-disabled { background: var(--panel-2); color: var(--muted); cursor: default; }

.empty-state {
    text-align: center; max-width: 460px; margin: 3rem auto;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 16px; padding: 2.5rem 1.5rem;
}
.empty-emoji { font-size: 3rem; opacity: .5; margin-bottom: .5rem; }
.empty-state h3 { margin: 0 0 .5rem; }
.empty-state .btn-primary { margin-top: 1.25rem; }

.course-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.course-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
    transition: border-color .15s, transform .15s;
}
.course-card:hover { border-color: #33405a; transform: translateY(-2px); }

.course-thumb {
    position: relative; display: block; aspect-ratio: 16 / 9; background: var(--panel-2);
}
.course-thumb.is-static { cursor: default; }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge-state {
    position: absolute; top: .6rem; left: .6rem;
    font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px;
    background: rgba(15,17,21,.8); color: #fff; backdrop-filter: blur(4px);
}
.badge-state.is-done { background: rgba(45,120,70,.9); }
.badge-state.is-progress { background: rgba(79,140,255,.9); }
.badge-state.is-new { background: rgba(90,96,110,.9); }
.badge-state.is-soon { background: rgba(150,120,40,.9); }

.course-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.course-title { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.course-prof { margin: 0; }

.progress {
    height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.course-meta { display: flex; justify-content: space-between; }

.course-actions {
    margin-top: auto; display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; padding-top: .4rem;
}
.course-links { display: flex; gap: .35rem; }
.chip {
    font-size: .72rem; padding: .25rem .55rem; border-radius: 999px;
    border: 1px solid var(--border); color: var(--muted);
}
.chip.is-disabled { opacity: .7; cursor: default; }

/* ══════════════ Chat ══════════════ */
.chat-wrap {
    max-width: 640px; margin: 0 auto;
    display: flex; flex-direction: column;
    height: calc(100vh - var(--topbar-h) - 3rem);
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.chat-head { padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.chat-head h1 { margin: .1rem 0; font-size: 1.15rem; }
.chat-status.ok { color: #7fdc9b; }
.chat-status.error { color: var(--danger); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.chat-empty { text-align: center; margin: auto; }
.chat-msg { max-width: 80%; align-self: flex-start; }
.chat-msg--mine { align-self: flex-end; text-align: right; }
.chat-msg-meta { font-size: .78rem; margin-bottom: .1rem; }
.chat-msg-body {
    display: inline-block; padding: .5rem .8rem; border-radius: 12px;
    background: var(--panel-2); word-wrap: break-word; text-align: left;
}
.chat-msg--mine .chat-msg-body { background: var(--accent-weak); }
.chat-msg--profe .chat-msg-meta strong { color: var(--accent); }
.chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border); }
.chat-form input {
    flex: 1; padding: .6rem .8rem; border-radius: 999px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font: inherit;
}
.chat-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* ══════════════ Presentación obligatoria ══════════════ */
.intro-card {
    width: 100%; max-width: 560px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 16px; padding: 2rem; text-align: center;
}
.intro-card .avatar-lg { margin: 0 auto .75rem; }
.intro-card h1 { margin: 0 0 .5rem; font-size: 1.5rem; }
.intro-card form { text-align: left; margin-top: 1.25rem; }
.intro-card textarea {
    width: 100%; padding: .8rem; border-radius: 10px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font: inherit; resize: vertical;
}
.intro-card textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.intro-meta { display: flex; justify-content: space-between; margin-top: .4rem; }
.intro-preview {
    margin-top: 1rem; padding: .8rem 1rem; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 10px;
}
.intro-preview h3 { margin: 0 0 .4rem; }
.intro-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ══════════════ Progreso ══════════════ */
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 1.75rem; }
.stat-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.1rem; display: flex; flex-direction: column; gap: .2rem;
}
.stat-card--wide { grid-column: span 2; }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-card--wide .progress { margin-top: .5rem; }

.next-objective { margin-bottom: 1.75rem; }
.next-objective h2, .progress-list-section h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
.next-card {
    display: flex; align-items: center; gap: 1rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem;
}
.next-card img { width: 90px; height: 60px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.next-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }

.progress-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.progress-row {
    display: grid; grid-template-columns: 1fr auto 120px 44px; align-items: center; gap: .8rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .9rem;
}
.progress-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-mini .progress { width: 120px; }
.progress-pct { text-align: right; }
@media (max-width: 560px) {
    .progress-row { grid-template-columns: 1fr 44px; }
    .progress-row .badge-state, .progress-mini { display: none; }
}

/* ══════════════ Calendario ══════════════ */
.cal-add summary { list-style: none; cursor: pointer; display: inline-block; }
.cal-add summary::-webkit-details-marker { display: none; }
.cal-add[open] summary { margin-bottom: .75rem; }
.cal-form { max-width: 480px; margin-top: .5rem; }
.cal-form input[type=text], .cal-form input[type=datetime-local], .cal-form textarea {
    padding: .6rem .75rem; border-radius: 9px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font: inherit; width: 100%;
}
.cal-agenda { display: flex; flex-direction: column; gap: 1.5rem; max-width: 640px; }
.cal-day-label { font-size: 1rem; margin: 0 0 .6rem; color: var(--accent); }
.cal-items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.cal-item {
    display: flex; align-items: center; gap: .8rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem;
}
.cal-item--vivo { border-left: 3px solid var(--danger); }
.cal-time { font-variant-numeric: tabular-nums; font-weight: 700; width: 46px; flex-shrink: 0; }
.cal-ico { flex-shrink: 0; }
.cal-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cal-title { font-weight: 600; }

/* ══════════════ Buscador ══════════════ */
.search-page-form { display: flex; gap: .5rem; margin-top: .75rem; max-width: 560px; }
.search-page-form input {
    flex: 1; padding: .6rem .9rem; border-radius: 999px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font: inherit;
}
.search-page-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.search-section { margin-bottom: 1.75rem; }
.search-section h2 { font-size: 1.05rem; margin: 0 0 .7rem; }
.search-people { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.search-person, .search-item {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
}
.search-person:hover, .search-item:hover { border-color: #33405a; }
.search-person span, .search-item span { display: flex; flex-direction: column; min-width: 0; }
.search-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.search-avatar--initials { display: grid; place-items: center; background: var(--accent-weak); color: #cfe0ff; font-weight: 700; }
.search-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.search-thumb { width: 56px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.search-extract { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item--post { display: block; }

/* ══════════════ Profesores / Seguir ══════════════ */
.prof-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.prof-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.2rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.prof-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.prof-avatar--initials { display: grid; place-items: center; background: var(--accent-weak); color: #cfe0ff; font-weight: 700; font-size: 1.5rem; }
.prof-info { flex: 1; }
.prof-name { margin: 0; font-size: 1.05rem; }
.btn-follow {
    padding: .5rem 1.2rem; border-radius: 999px; border: 1px solid var(--accent);
    background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.btn-follow.is-following { background: transparent; color: var(--text); border-color: var(--border); }
.btn-follow:hover { filter: brightness(1.08); }

/* ══════════════ Feed ══════════════ */
.feed { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.as-link { background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; padding: 0; }
.as-link.danger { color: var(--danger); }
.inline { display: inline; }

.composer { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; }
.composer-top { display: flex; gap: .7rem; }
.composer-top textarea {
    flex: 1; border: 0; background: var(--panel-2); color: var(--text);
    border-radius: 10px; padding: .6rem .8rem; font: inherit; resize: vertical;
}
.composer-top textarea:focus { outline: 2px solid var(--accent); }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: .7rem; }
.composer-attach { cursor: pointer; color: var(--muted); font-size: .9rem; }
.composer-attach:hover { color: var(--text); }

.post { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; }
.post-head { display: flex; align-items: center; gap: .7rem; }
.post-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.post-avatar--initials { display: grid; place-items: center; background: var(--accent-weak); color: #cfe0ff; font-weight: 700; }
.post-author { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.post-name { font-weight: 600; }
.post-date { text-decoration: none; }
.post-menu { position: relative; }
.post-menu summary { list-style: none; cursor: pointer; padding: 0 .5rem; color: var(--muted); font-size: 1.3rem; }
.post-menu summary::-webkit-details-marker { display: none; }
.post-menu-list {
    position: absolute; right: 0; top: 100%; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 10px; padding: .4rem; min-width: 140px; z-index: 5;
    display: flex; flex-direction: column; gap: .2rem;
}
.post-menu-list a, .post-menu-list button { padding: .4rem .6rem; border-radius: 7px; text-align: left; }
.post-menu-list a:hover, .post-menu-list button:hover { background: var(--panel); }

.post-text { margin: .7rem 0; white-space: normal; word-wrap: break-word; }
.post-media { display: grid; gap: 4px; margin: .5rem 0; border-radius: 10px; overflow: hidden; }
.post-media.count-1 { grid-template-columns: 1fr; }
.post-media.count-2, .post-media.count-4 { grid-template-columns: 1fr 1fr; }
.post-media.count-3 { grid-template-columns: 1fr 1fr 1fr; }
.post-media img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; display: block; }
.post-actions { display: flex; gap: 1.25rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.post-action {
    background: none; border: 0; cursor: pointer; color: var(--muted); font: inherit;
    display: inline-flex; align-items: center; gap: .35rem; text-decoration: none;
}
.post-action:hover { color: var(--text); }
.post-action.is-on { color: var(--accent); font-weight: 600; }
.feed-more { text-align: center; }

.course-feed-head {
    display: flex; align-items: center; gap: 1rem;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 1rem;
}
.course-feed-head img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; }
.course-feed-head h1 { margin: .1rem 0; font-size: 1.3rem; }
a.chip { text-decoration: none; }
a.chip:hover { border-color: var(--accent); color: var(--text); }

/* Comentarios */
.feed--detail { max-width: 640px; }
.edit-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: .5rem 1rem; }
.edit-box summary { cursor: pointer; color: var(--muted); }
.comments { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; }
.comments-title { font-size: 1.05rem; margin: 0 0 .8rem; }
.comment-form { display: flex; gap: .6rem; margin-bottom: 1rem; }
.comment-form textarea { flex: 1; border-radius: 10px; border: 1px solid #2c3340; background: #0f1218; color: var(--text); padding: .5rem .7rem; font: inherit; }
.comment { display: flex; gap: .6rem; margin-top: .8rem; }
.comment-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-avatar--initials { display: grid; place-items: center; background: var(--accent-weak); color: #cfe0ff; font-weight: 700; font-size: .8rem; }
.comment-body { flex: 1; min-width: 0; }
.comment-bubble { background: var(--panel-2); border-radius: 12px; padding: .5rem .8rem; }
.comment-name { font-weight: 600; display: block; }
.comment-meta { display: flex; align-items: center; gap: .8rem; margin: .2rem 0 0 .3rem; }
.comment-children { margin-top: .6rem; padding-left: .8rem; border-left: 2px solid var(--border); }

/* ══════════════ Perfil público ══════════════ */
.public-topbar {
    height: var(--topbar-h); display: flex; align-items: center; padding: 0 1.25rem;
    border-bottom: 1px solid var(--border); background: var(--panel);
}
.public-shell { max-width: 760px; margin: 0 auto; padding: 1.75rem 1.25rem; }

.profile-hero {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.25rem;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 16px; padding: 1.5rem;
}
.profile-avatar {
    width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
    background: var(--panel-2);
}
.profile-avatar--initials {
    display: grid; place-items: center; font-size: 2rem; font-weight: 700;
    color: #cfe0ff; background: var(--accent-weak);
}
.profile-id h1 { margin: 0; font-size: 1.5rem; }
.profile-titulo { margin: .25rem 0 0; font-weight: 600; }
.profile-edit { align-self: start; }
.profile-section { margin-top: 1.5rem; }
.profile-section h2 { font-size: 1.05rem; margin: 0 0 .6rem; }

.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
    padding: .3rem .7rem; border-radius: 999px; font-size: .85rem;
    background: var(--panel-2); border: 1px solid var(--border);
}
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.link-list a { color: var(--accent); }
.cert-mini { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.cert-mini li {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .8rem; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.cert-mini li > span:nth-child(2) { flex: 1; font-weight: 600; }

@media (max-width: 560px) {
    .profile-hero { grid-template-columns: auto 1fr; }
    .profile-edit { grid-column: 1 / -1; }
}

/* ══════════════ Perfil edición ══════════════ */
.profile-edit-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; max-width: 720px; }
.avatar-form { text-align: center; }
.avatar-preview { display: flex; justify-content: center; margin-bottom: .5rem; }
.avatar-preview img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; }
.avatar-xl { width: 110px; height: 110px; font-size: 2.4rem; }
.form-card input[type=text], .form-card input[type=url], .form-card input[type=file] {
    padding: .6rem .75rem; border-radius: 9px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font: inherit; width: 100%;
}
.form-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.input-prefix { display: flex; align-items: center; gap: .35rem; }
.input-prefix > span { color: var(--muted); font-size: 1.1rem; }
.redes-fieldset, .privacy-fieldset {
    border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem; margin-top: 1rem;
}
.redes-fieldset legend, .privacy-fieldset legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
.check-inline { display: flex; align-items: center; gap: .5rem; margin: .4rem 0; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ══════════════ Notificaciones ══════════════ */
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.notif-item {
    display: flex; align-items: flex-start; gap: .8rem;
    padding: .85rem 1rem; background: var(--panel);
    border: 1px solid var(--border); border-radius: 12px;
}
.notif-item.is-unread { border-left: 3px solid var(--accent); background: #151a24; }
.notif-icon {
    display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 10px; background: var(--panel-2); color: var(--muted);
}
.notif-item.is-unread .notif-icon { color: var(--accent); }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.notif-title { font-weight: 600; }
.notif-body { margin: 0; }
.notif-read { flex-shrink: 0; }
.link-btn {
    background: transparent; border: 1px solid var(--border); color: var(--muted);
    width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
}
.link-btn:hover { color: var(--text); border-color: var(--accent); }

.prefs-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.25rem; max-width: 680px;
}
.prefs-head, .prefs-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 0;
}
.prefs-head { color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--border); }
.prefs-row { border-bottom: 1px solid var(--border); }
.prefs-info { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.prefs-info > div { display: flex; flex-direction: column; }
.prefs-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); color: var(--muted); flex-shrink: 0; }
.prefs-cols { display: grid; grid-template-columns: repeat(3, 44px); text-align: center; gap: 0; }
.prefs-cols input { width: 18px; height: 18px; accent-color: var(--accent); }

.push-box {
    margin-top: 1.5rem; max-width: 680px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem;
}
.push-box h2 { font-size: 1.05rem; margin: 0 0 .4rem; }
.push-box .btn-ghost { margin-top: .6rem; }

/* ══════════════ Soporte ══════════════ */
.page-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.alert-ok { background: #16301f; border: 1px solid #2f5c3d; color: #a9e9bf; }

.ticket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.ticket-item {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 1rem; background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; transition: border-color .15s;
}
.ticket-item:hover { border-color: #33405a; }
.ticket-item.is-unread { border-left: 3px solid var(--accent); }
.ticket-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ticket-asunto { font-weight: 600; }
.ticket-side { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.thread-head { display: flex; align-items: center; gap: .75rem; }
.thread-head h1 { margin: 0; font-size: 1.4rem; }
.thread { display: flex; flex-direction: column; gap: .75rem; margin: 1.25rem 0; }
.msg {
    max-width: 80%; padding: .7rem .9rem; border-radius: 12px;
    background: var(--panel); border: 1px solid var(--border);
}
.msg--user { align-self: flex-end; background: var(--accent-weak); border-color: #33405a; }
.msg--staff { align-self: flex-start; }
.msg-meta { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .25rem; }
.msg-body { white-space: normal; word-wrap: break-word; }
.thread-closed { text-align: center; margin: 1rem 0; }

.form-card, .reply-form {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.25rem;
}
.form-card { display: flex; flex-direction: column; gap: .35rem; max-width: 620px; }
.form-card label { font-size: .85rem; color: var(--muted); margin-top: .6rem; }
.form-card select, .form-card textarea, .reply-form textarea {
    padding: .65rem .8rem; border-radius: 9px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font: inherit; width: 100%;
}
.form-card select:focus, .form-card textarea:focus, .reply-form textarea:focus {
    outline: 2px solid var(--accent); border-color: transparent;
}
.form-actions { margin-top: 1rem; }
.reply-form { display: flex; gap: .6rem; align-items: flex-end; }
.reply-form textarea { flex: 1; }

/* ══════════════ Certificados ══════════════ */
.cert-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.cert-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
}
.cert-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--panel-2); }
.cert-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cert-ribbon {
    position: absolute; top: .6rem; right: .6rem; font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
.cert-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.cert-title { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.cert-body .btn-primary { margin-top: .6rem; }

/* ══════════════ Clases en vivo ══════════════ */
.live-section { margin-bottom: 2rem; }
.live-h2 { font-size: 1.15rem; margin: 0 0 .9rem; }
.live-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.live-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
    transition: border-color .15s, transform .15s;
}
.live-card:hover { border-color: #33405a; transform: translateY(-2px); }
.live-card.is-highlight { border-color: #6b2b34; box-shadow: 0 0 0 1px rgba(255,107,116,.25); }
.live-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--panel-2); }
.live-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.live-title { margin: 0; font-size: 1rem; line-height: 1.3; }
.live-when { color: var(--accent); margin: 0; }
.live-body .btn-primary { margin-top: .5rem; }

.badge-state.is-live {
    background: rgba(220,50,60,.95);
    display: inline-flex; align-items: center; gap: .35rem;
}
.badge-state.is-live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff;
    animation: live-pulse 1.4s infinite;
}
.badge-state.is-rec { background: rgba(90,96,110,.9); }
.btn-live { background: #d8323c; }
.btn-live:hover { filter: brightness(1.1); }
@keyframes live-pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .badge-state.is-live::before { animation: none; } }

/* ══════════════ Utilidades de visibilidad ══════════════ */
.only-mobile { display: none; }
.only-desktop { display: inline-flex; }

/* ══════════════ Responsive ══════════════ */
@media (max-width: 1023px) {
    .only-mobile { display: grid; }
    .only-desktop { display: none; }

    .content { margin-left: 0; max-width: none; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 40px rgba(0,0,0,.5);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body:not(.sidebar-open) .sidebar-backdrop { display: none; }
}

@media (max-width: 640px) {
    .topbar-search { display: none; }
    .content { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
}

/* ══════════════ Login (layout guest) ══════════════ */
.guest-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 2rem;
}
.auth-card h1 { margin: 0 0 .25rem; }
.auth-card form { display: flex; flex-direction: column; gap: .35rem; margin-top: 1rem; }
.auth-card label { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.auth-card input {
    padding: .7rem .8rem; border-radius: 9px; border: 1px solid #2c3340;
    background: #0f1218; color: var(--text); font-size: 1rem;
}
.auth-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.auth-card button {
    margin-top: 1rem; padding: .7rem 1rem; border-radius: 9px; border: 0;
    background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.alert { padding: .7rem .9rem; border-radius: 9px; margin-top: 1rem; font-size: .9rem; }
.alert-error { background: #3a1d22; border: 1px solid #6b2b34; color: #ffb4bd; }
