        :root {
            --bg: #0a0a0a;
            --surface: #111114;
            --surface-solid: #111114;
            --surface2: #1a1a1f;
            --surface2-solid: #1a1a1f;
            --border: #232329;
            --border-hover: #34343d;
            --accent: #6366f1;
            --accent2: #818cf8;
            --accent-glow: rgba(99,102,241,0.35);
            --green: #3fb950;
            --red: #f85149;
            --yellow: #d29922;
            --text: #ededed;
            --muted: #8b8b96;
            --card: var(--surface);
            --primary: var(--accent);
            --radius: 12px;
            --radius-sm: 8px;
            --radius-xs: 6px;
            --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
            --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
            --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);
            --hover-glow: 0 0 0 1px rgba(99,102,241,0.25), 0 4px 20px rgba(99,102,241,0.10);
            --transition: 0.15s ease;
            /* Glass — reservado a la home/War Room */
            --glass-bg: rgba(var(--fg-rgb),0.03);
            --glass-border: rgba(var(--fg-rgb),0.08);
            --glass-blur: 16px;
            --orb-1: rgba(99,102,241,0.18);
            --orb-2: rgba(14,165,233,0.14);
            /* Tema (27-sep-2026): estos cuatro permiten que el mismo CSS valga en claro.
               --fg-rgb = el color "de tinta" en RGB para rgba(var(--fg-rgb), a): blanco en
               oscuro, negro en claro. --text-strong = el blanco puro de titulares.
               --on-accent = texto sobre el índigo (siempre blanco). */
            --fg-rgb: 255,255,255;
            --bg-rgb: 0,0,0;
            --text-strong: #fff;
            --on-accent: #fff;
            --text-secondary: #94a3b8;
        }
        /* ── Tema claro: mismos tokens, otros valores. Se activa con
              <html data-theme="light"> (base.html lo pone antes de pintar). ── */
        :root[data-theme="light"] {
            color-scheme: light;
            --bg: #f4f4f6;
            --surface: #ffffff;
            --surface-solid: #ffffff;
            --surface2: #f1f1f4;
            --surface2-solid: #f1f1f4;
            --border: #e3e3e9;
            --border-hover: #c8c8d2;
            --accent: #5b5fe6;
            --accent2: #4338ca;
            --accent-glow: rgba(91,95,230,0.28);
            --green: #1a7f37;
            --red: #c62828;
            --yellow: #9a6700;
            --text: #17171c;
            --muted: #676773;
            --text-secondary: #4b5563;
            --text-strong: #0b0b0f;
            --on-accent: #fff;
            --fg-rgb: 0,0,0;
            --bg-rgb: 255,255,255;
            --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
            --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
            --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
            --hover-glow: 0 0 0 1px rgba(91,95,230,0.25), 0 4px 20px rgba(91,95,230,0.10);
            --glass-bg: rgba(255,255,255,0.65);
            --glass-border: rgba(0,0,0,0.08);
            --orb-1: rgba(99,102,241,0.14);
            --orb-2: rgba(14,165,233,0.10);
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }

        /* Scrollbar global */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(var(--fg-rgb),0.08); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(var(--fg-rgb),0.14); }
        * { scrollbar-width: thin; scrollbar-color: rgba(var(--fg-rgb),0.08) transparent; }

        /* Animations */
        @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
        @keyframes flashIn { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }

        /* Layout */
        .layout { display: flex; min-height: 100vh; }

        /* Sidebar */
        .sidebar {
            width: 210px;
            flex-shrink: 0;
            background: var(--surface-solid);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            padding: 24px 0;
            position: sticky;
            top: 0;
            height: 100vh;
            overflow-y: auto;
            z-index: 50;
        }
        .sidebar-brand {
            padding: 0 20px 16px;
            font-size: 0.68rem;
            font-weight: 700;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 2px;
        }
        .sidebar a {
            display: flex;
            align-items: center;
            gap: 9px;
            padding: 6px 20px;
            color: var(--muted);
            text-decoration: none;
            font-size: 0.82rem;
            font-weight: 400;
            transition: color var(--transition);
            border-left: none;
            margin: 0;
        }
        .sidebar-group-label {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 18px 20px 4px;
            background: none;
            border: none;
            font: inherit;
            font-size: 0.65rem;
            font-weight: 700;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 2px;
            text-align: left;
            cursor: pointer;
            transition: color var(--transition);
        }
        .sidebar-group-label:hover { color: var(--text); }
        .sidebar-chevron { opacity: 0.6; transition: transform var(--transition), opacity var(--transition); }
        .sidebar-group.collapsed .sidebar-chevron { transform: rotate(-90deg); }
        .sidebar-group.collapsed .sidebar-group-items { display: none; }
        .sidebar-footer .sidebar-group-label { padding-top: 8px; }
        /* Selector de espacios: texto discreto bajo la marca + menú propio */
        .sidebar-espacios { position: relative; margin: -12px 14px 4px; }
        .esp-trigger {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 4px 6px; border: 0; border-radius: var(--radius-xs);
            background: none; font: inherit; font-size: 0.74rem;
            color: var(--muted); cursor: pointer;
            transition: color var(--transition), background var(--transition);
        }
        .esp-trigger:hover, .sidebar-espacios.open .esp-trigger { color: var(--text); background: var(--surface2); }
        .esp-trigger:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
        .esp-chev { opacity: .6; transition: transform var(--transition); }
        .sidebar-espacios.open .esp-chev { transform: rotate(180deg); }
        .esp-menu {
            position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
            min-width: 176px; padding: 4px;
            background: var(--surface); border: 1px solid var(--border);
            border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
        }
        .esp-menu[hidden] { display: none; }
        .esp-menu button, .esp-menu a {
            display: flex; align-items: center; gap: 9px; width: 100%;
            padding: 7px 9px; border: 0; border-radius: var(--radius-xs);
            background: none; font: inherit; font-size: 0.8rem;
            color: var(--muted); text-align: left; cursor: pointer; text-decoration: none;
        }
        .esp-menu button span, .esp-menu a span { flex: 1; }
        .esp-menu button:hover, .esp-menu button:focus-visible, .esp-menu a:hover, .esp-menu a:focus-visible { background: var(--surface2); color: var(--text); outline: none; }
        .esp-menu button.on, .esp-menu a.on { color: var(--text-strong); }
        .esp-check { visibility: hidden; color: var(--accent); }
        .esp-menu button.on .esp-check, .esp-menu a.on .esp-check { visibility: visible; }
        .sidebar a[hidden], .sidebar-group[hidden] { display: none; }
        .sidebar a:hover {
            color: var(--text);
        }
        .sidebar a.active {
            color: var(--text-strong);
            font-weight: 600;
            background: var(--accent-soft, rgba(99,102,241,0.14));
            border-left: 2px solid var(--accent);
            padding-left: 18px;
        }
        .main-content { flex: 1; overflow: hidden; min-width: 0; }

        /* Sidebar toggle (mobile) */
        .sidebar-toggle {
            display: none;
            position: fixed;
            top: 14px;
            left: 14px;
            z-index: 200;
            background: var(--surface-solid);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            color: var(--text);
            padding: 8px 10px;
            font-size: 1.1rem;
            cursor: pointer;
            backdrop-filter: blur(8px);
        }

        /* Header */
        .header {
            background: var(--surface);
            padding: 16px 28px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .header-left { display: flex; align-items: center; gap: 14px; }
        .logo { font-size: 1.4rem; font-weight: 700; color: var(--text-strong); }
        .logo span { color: var(--text-strong); }
        .live-badge {
            background: rgba(16,185,129,0.1);
            border: 1px solid rgba(16,185,129,0.25);
            color: var(--green);
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.7rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 6px;
            backdrop-filter: blur(4px);
        }
        .live-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; box-shadow: 0 0 8px rgba(16,185,129,0.5); }
        .clock { font-size: 0.85rem; color: var(--muted); font-weight: 500; }

        /* Stats */
        .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 18px 28px; }
        .stat {
            background: var(--surface);
            backdrop-filter: blur(12px);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 16px 18px;
            display: flex;
            align-items: center;
            gap: 14px;
            transition: border-color var(--transition);
        }
        .stat:hover { border-color: var(--border-hover); box-shadow: var(--hover-glow); }
        .stat-icon { font-size: 1.5rem; }
        .stat-num { font-size: 1.6rem; font-weight: 700; color: var(--text-strong); line-height: 1; }
        .stat-label { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

        /* Grid */
        .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0 28px 28px; }
        .grid-wide { grid-column: span 2; }

        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 20px;
            transition: border-color var(--transition);
            display: flex;
            flex-direction: column;
            gap: 14px;
        }
        .card:hover { border-color: var(--border-hover); box-shadow: var(--hover-glow); }

        .card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .card-title {
            font-size: 0.72rem;
            font-weight: 600;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 7px;
        }
        .card-body { flex: 1; overflow: hidden; }

        pre {
            font-size: 0.78rem;
            white-space: pre-wrap;
            line-height: 1.7;
            color: var(--muted);
        }

        /* Tasks */
        .task-item {
            background: var(--surface2);
            border-radius: var(--radius);
            padding: 14px 18px;
            margin-bottom: 8px;
            border-left: 3px solid var(--accent);
            transition: all var(--transition);
        }
        .task-item:hover { transform: translateX(4px); background: var(--surface2); }
        .task-item.urgent { border-left-color: var(--red); }
        .task-item.soon { border-left-color: var(--yellow); }
        .task-name { font-size: 0.85rem; font-weight: 500; color: var(--text); }
        .task-meta { font-size: 0.7rem; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; }
        .badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: var(--radius-xs);
            font-size: 0.62rem;
            font-weight: 600;
            text-transform: uppercase;
            margin-left: 6px;
        }
        .badge.academico { background: rgba(99,102,241,0.15); color: var(--accent2); }
        .badge.trabajo { background: rgba(16,185,129,0.15); color: var(--green); }
        .badge.personal { background: rgba(245,158,11,0.15); color: var(--yellow); }
        .badge.alta { background: rgba(239,68,68,0.15); color: var(--red); }
        .badge.media { background: rgba(245,158,11,0.15); color: var(--yellow); }
        .badge.baja { background: rgba(16,185,129,0.15); color: var(--green); }

        /* Docs */
        .doc-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.82rem;
            transition: color var(--transition);
            cursor: default;
        }
        .doc-item:last-child { border-bottom: none; }
        .doc-item:hover { color: var(--accent2); }
        .doc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 75%; }
        .doc-time {
            font-size: 0.68rem;
            color: var(--muted);
            background: var(--surface2);
            padding: 3px 8px;
            border-radius: var(--radius-xs);
            flex-shrink: 0;
        }

        /* Services */
        .service-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.83rem;
        }
        .service-item:last-child { border-bottom: none; }
        .service-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
        .service-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.6); }
        .service-dot.off { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.6); }
        .service-name { flex: 1; }
        .service-status { font-size: 0.68rem; color: var(--muted); }

        .chart-wrap { margin-top: 10px; height: 130px; position: relative; }

        /* Brief sections */
        .brief-section { margin-bottom: 14px; }
        .brief-header { font-size: 0.82rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
        .brief-section ul { list-style: none; padding: 0; margin: 0; }
        .brief-section li { font-size: 0.84rem; color: var(--text-secondary, #94a3b8); padding: 3px 0; }
        .brief-section li::before { content: "›"; color: var(--accent); margin-right: 6px; }
        .brief-section span { font-size: 0.84rem; color: var(--text-secondary, #94a3b8); }

        /* Review cards */
        .review-card { background: var(--surface2); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; border-left: 3px solid var(--yellow); transition: all var(--transition); }
        .review-card:hover { background: var(--surface2); }
        .review-card .review-title { font-size: 0.88rem; font-weight: 500; margin-bottom: 6px; }
        .review-card .review-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 10px; }
        .review-actions { display: flex; gap: 8px; margin-top: 8px; }

        /* Buttons */
        .btn {
            padding: 7px 16px;
            border-radius: var(--radius-sm);
            border: 1px solid rgba(var(--fg-rgb),0.12);
            cursor: pointer;
            font-size: 0.78rem;
            font-weight: 600;
            transition: all var(--transition);
            background: rgba(var(--fg-rgb),0.06);
            color: var(--text);
        }
        .btn:hover { background: rgba(var(--fg-rgb),0.10); }
        .btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
        .btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
        .btn-danger { background: var(--red); color: white; border-color: var(--red); }
        .btn-danger:hover { background: #e5443d; }

        /* Forms */
        .correction-form { display: none; margin-top: 10px; }
        .correction-form textarea { width: 100%; background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 10px; font-size: 0.8rem; resize: vertical; min-height: 80px; font-family: inherit; transition: border-color var(--transition), box-shadow var(--transition); }
        .correction-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

        /* Global input/select focus */
        input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-glow); }

        /* Task cards (tareas.html) */
        .task-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 18px 20px;
            margin-bottom: 12px;
            transition: border-color var(--transition);
        }
        .task-card:hover { border-color: var(--border-hover); }

        footer {
            text-align: center;
            color: var(--muted);
            font-size: 0.7rem;
            padding: 20px 28px 28px;
            border-top: 1px solid var(--border);
        }

        /* Responsive */
        @media (max-width: 1100px) {
            .grid { grid-template-columns: repeat(2, 1fr); }
            .grid-wide { grid-column: span 1; }
            .stats { grid-template-columns: repeat(2, 1fr); }
            .sidebar { width: 170px; }
        }
        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: -260px;
                width: 240px;
                transition: left var(--transition);
                box-shadow: var(--shadow-lg);
            }
            .sidebar.open { left: 0; }
            .sidebar-toggle { display: block; }
            .sidebar-overlay {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0,0,0,0.5);
                z-index: 40;
            }
            .sidebar.open ~ .sidebar-overlay { display: block; }
            .main-content { width: 100%; }
            .stats { grid-template-columns: repeat(2, 1fr); padding: 12px 16px; }
            .grid { grid-template-columns: 1fr; padding: 0 16px 16px; }
            .header { padding: 14px 16px 14px 52px; }
        }

        /* Sidebar collapse */
        .sidebar {
            transition: width 0.22s ease, padding 0.22s ease;
        }
        .sidebar.collapsed {
            width: 0;
            padding: 0;
            overflow: hidden;
        }
        .sidebar-footer {
            margin-top: auto;
            border-top: 1px solid var(--border);
            padding-top: 8px;
        }
        .sidebar-collapse-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 20px;
            width: 100%;
            background: none;
            border: none;
            color: var(--muted);
            font-size: 0.82rem;
            cursor: pointer;
            text-align: left;
            transition: color var(--transition);
            white-space: nowrap;
        }
        .sidebar-collapse-btn:hover { color: var(--text); }

        /* «Ocultar panel»: icono junto al título de la barra */
        .sidebar-brand { display: flex; align-items: center; gap: 4px; padding-right: 12px; }
        .sidebar-brand > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .sidebar-hide-btn {
            display: flex; align-items: center; justify-content: center;
            margin-left: auto; padding: 4px; flex-shrink: 0;
            background: none; border: none; border-radius: var(--radius-xs);
            color: var(--muted); cursor: pointer;
            transition: color var(--transition), background var(--transition);
        }
        .sidebar-hide-btn:hover { color: var(--text); background: var(--surface2); }

        /* Settings gear icon — in sidebar footer */
        .settings-gear {
            display: flex;
            align-items: center;
            gap: 9px;
            padding: 6px 20px;
            color: var(--muted);
            text-decoration: none;
            font-size: 0.82rem;
            transition: color var(--transition);
            white-space: nowrap;
        }
        .settings-gear:hover { color: var(--text); }

        /* ── Iconos SVG (macro _macros/icons.html) ── */
        .icon { flex-shrink: 0; vertical-align: -2px; }
        .icon--fallback { font-style: normal; font-size: 0.95em; line-height: 1; }
        .sidebar-icon { opacity: 0.7; transition: opacity var(--transition); }
        .sidebar a:hover .sidebar-icon { opacity: 1; }
        .sidebar a.active .sidebar-icon { opacity: 1; color: var(--accent2); }
        /* Logo propio de una entrada (sub-cuentas de Daya): pastilla blanca, sin atenuar */
        .icon-logo { flex-shrink: 0; border-radius: 4px; background: #fff; object-fit: contain; padding: 1px; box-shadow: 0 0 0 1px var(--border); }
        .sidebar-icon.icon-logo { opacity: 0.85; }
        .sidebar a:hover .icon-logo, .sidebar a.active .icon-logo { opacity: 1; }

        /* ── Banner "viendo como" (impersonación admin) ── */
        .view-as-banner {
            background: #b8860b;
            color: #fff;
            padding: 8px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.84rem;
            gap: 12px;
            flex-wrap: wrap;
        }
        .view-as-banner span { display: flex; align-items: center; gap: 8px; }
        .view-as-banner form { margin: 0; }
        .view-as-banner button {
            background: rgba(var(--bg-rgb),0.25);
            color:var(--text-strong);
            border: 1px solid rgba(var(--fg-rgb),0.4);
            padding: 4px 12px;
            border-radius: var(--radius-xs);
            cursor: pointer;
            font-size: 0.8rem;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        /* ── Tab navigation (shared across modules) ── */
        .tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
        .tab-btn { padding: 10px 18px; color: var(--muted); text-decoration: none; font-size: 0.85rem; font-weight: 500; border-bottom: 2px solid transparent; transition: all 0.2s; }
        .tab-btn:hover { color: var(--text); }
        .tab-btn.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

        /* ── Module cards (simple block, no flex column) ── */
        .m-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
        .m-card + .m-card { margin-top: 0; }
        .section-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; font-weight: 600; }

        /* ── Buttons ── */
        .btn-action { background: var(--accent); border: none; border-radius: 8px; padding: 10px 20px; color: var(--on-accent); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
        .btn-action:hover { opacity: 0.9; }
        .btn-action:disabled { opacity: 0.5; cursor: not-allowed; }
        .btn-action.full { width: 100%; }
        .btn-ghost { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; color: var(--text); font-size: 0.82rem; cursor: pointer; text-decoration: none; display: inline-block; transition: border-color 0.15s; font-family: inherit; }
        .btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

        /* ── Form elements ── */
        .f-row { margin-bottom: 14px; }
        .f-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; display: block; }
        .f-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; color: var(--text); box-sizing: border-box; font-family: inherit; }

        /* ── Modal ── */
        .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
        .modal-overlay.open { display: flex; }
        .modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 90%; max-width: 500px; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
        .modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }

        /* ── Rating stars ── */
        .star-row { display: flex; gap: 4px; }
        .star-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface2); cursor: pointer; font-size: 0.75rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
        .star-btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

        /* ── Chat bubbles (shared: chat module + live session panels) ── */
        .chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 260px); min-height: 400px; }
        .chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px 0; margin-bottom: 12px; }
        .bubble { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; }
        .bubble.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
        .bubble.ai { align-self: flex-start; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
        .chat-row { display: flex; gap: 8px; }
        .chat-textarea { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 0.85rem; color: var(--text); resize: none; min-height: 40px; max-height: 120px; font-family: inherit; }
        .chat-send { background: var(--accent); border: none; border-radius: 10px; padding: 10px 16px; color: var(--bg); font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
        .chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

        /* Desplegables nativos: en Chrome de Windows la lista de opciones sale blanca aunque
           el <select> esté pintado oscuro. color-scheme + fondo explícito en <option>. */
        :root { color-scheme: dark; }
        select { color-scheme: dark; }
        select option, select optgroup { background-color: var(--surface2-solid); color: var(--text); }
        select option:checked { background-color: var(--accent); color: #fff; }

        /* ── Tema claro: los tintes claros de las etiquetas no se leen sobre fondo pálido ── */
        :root[data-theme="light"] .badge.academico { color: #4338ca; }
        :root[data-theme="light"] .badge.trabajo,
        :root[data-theme="light"] .badge.baja { color: #047857; }
        :root[data-theme="light"] .badge.personal,
        :root[data-theme="light"] .badge.media { color: #b45309; }
        :root[data-theme="light"] .badge.alta { color: #b91c1c; }
        :root[data-theme="light"] .doc-item:hover { color: var(--accent2); }
        :root[data-theme="light"] .sidebar { background: var(--surface-solid); }
        :root[data-theme="light"] .view-as-banner { background: #c9970f; }
        /* Los <select> se pintan oscuros a propósito más abajo (color-scheme + fondo del
           <option>); en claro tienen que volver al esquema claro. */
        :root[data-theme="light"] select { color-scheme: light; }
        :root[data-theme="light"] select option { background: var(--surface); color: var(--text); }
