/* Tema global día / noche - Plataforma STEAM */

html[data-theme="dark"] {
    color-scheme: dark;
    --steam-body-bg: #0b1220;
    --steam-bg-header: #101827;
    --steam-hover: #e5edf7;
    --steam-active-bg: #173b46;
    --steam-ui-text: #eef5fb;
    --steam-ui-text-secondary: #d3dde8;
    --steam-ui-muted: #9fb0c2;
    --steam-ui-border: #263447;
    --steam-ui-border-strong: #3a4b60;
    --steam-ui-surface: #111b2b;
    --steam-ui-surface-subtle: #0e1826;
    --steam-ui-action: #159ca2;
    --steam-ui-action-hover: #21b5bb;
    --steam-ui-shadow: 0 8px 26px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] body {
    background: #0b1220 !important;
    color: #e6eef7 !important;
}

html[data-theme="dark"] body > header {
    background: #101827 !important;
    border-bottom-color: #263447 !important;
    box-shadow: 0 2px 16px rgba(0,0,0,.32) !important;
}

html[data-theme="dark"] main.container {
    color: #e6eef7;
}

html[data-theme="dark"] .nav-menu .menu-link {
    color: #7edce0 !important;
}

html[data-theme="dark"] .nav-menu .menu-link:hover {
    color: #fff !important;
    background: #263447 !important;
}

html[data-theme="dark"] .nav-menu .menu-link.active {
    color: #fff !important;
    background: #174e58 !important;
}

html[data-theme="dark"] .user-pill-btn,
html[data-theme="dark"] .user-dropdown-menu,
html[data-theme="dark"] .dropdown-header {
    background: #111b2b !important;
    border-color: #2d3c50 !important;
    color: #e7eef7 !important;
}

html[data-theme="dark"] .user-pill-btn > span:first-child {
    color: #e7eef7 !important;
}

html[data-theme="dark"] .user-role-badge {
    background: #263447 !important;
    color: #c9d5e2 !important;
}

html[data-theme="dark"] .dropdown-item {
    color: #dce6f1 !important;
}

html[data-theme="dark"] .dropdown-item:hover {
    background: #1b293b !important;
}

html[data-theme="dark"] .dropdown-divider {
    background: #263447 !important;
}

html[data-theme="dark"] .site-footer {
    background: #0d3440 !important;
    color: #eefafa !important;
}

/* Switch día / noche */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
    padding: 4px 7px;
    border: 1px solid #dbe4ea;
    border-radius: 999px;
    background: #f8fafc;
    color: #536173;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.theme-toggle:hover {
    border-color: #9bdcde;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .08);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(21,156,162,.28);
    outline-offset: 2px;
}

.theme-toggle-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    line-height: 1;
}

.theme-toggle-track {
    position: relative;
    width: 34px;
    height: 18px;
    border-radius: 999px;
    background: #dbe4ea;
    transition: background .18s ease;
}

.theme-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15,23,42,.28);
    transition: transform .18s ease;
}

.theme-toggle[aria-checked="true"] .theme-toggle-track {
    background: #159ca2;
}

.theme-toggle[aria-checked="true"] .theme-toggle-knob {
    transform: translateX(16px);
}

html[data-theme="dark"] .theme-toggle {
    background: #172235;
    border-color: #34445a;
    color: #d8e3ef;
}

html[data-theme="dark"] .theme-toggle-track {
    background: #34445a;
}

/* Superficies generales */
html[data-theme="dark"] .card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .profile-header-card,
html[data-theme="dark"] .recommend-form,
html[data-theme="dark"] .recommend-card,
html[data-theme="dark"] .capsule-card,
html[data-theme="dark"] .capsule-activity,
html[data-theme="dark"] .capsule-material-card,
html[data-theme="dark"] .ecosystem-card,
html[data-theme="dark"] .event-card,
html[data-theme="dark"] .calendar-modal-content,
html[data-theme="dark"] .member-card,
html[data-theme="dark"] .faq-item,
html[data-theme="dark"] .bo-card,
html[data-theme="dark"] .bo-table-wrap,
html[data-theme="dark"] .bo-filters,
html[data-theme="dark"] .papers-card,
html[data-theme="dark"] .paper-card,
html[data-theme="dark"] .home-feature-card,
html[data-theme="dark"] .home-dashboard,
html[data-theme="dark"] .home-action-card {
    background: #111b2b !important;
    border-color: #29384b !important;
    color: #e6eef7 !important;
    box-shadow: 0 8px 26px rgba(0,0,0,.22) !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] strong {
    color: #eef5fb;
}

html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .bo-topbar p,
html[data-theme="dark"] .bo-section-head p,
html[data-theme="dark"] .capsule-summary-text,
html[data-theme="dark"] .capsule-detail-section p,
html[data-theme="dark"] .home-feature-card p,
html[data-theme="dark"] .home-action-card span {
    color: #aab9ca !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #0d1725 !important;
    color: #e8f0f8 !important;
    border-color: #3a4b60 !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #73869a !important;
}

/* Autenticación: login / registro / recuperación */
html[data-theme="dark"] .auth-card {
    background: #111b2b !important;
    border-color: #304156 !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.28) !important;
}

html[data-theme="dark"] .auth-tabs {
    background: #0e1826 !important;
    border-bottom-color: #304156 !important;
}

html[data-theme="dark"] .auth-tab-btn {
    background: #0e1826 !important;
    color: #9fb0c2 !important;
    border-bottom-color: transparent !important;
}

html[data-theme="dark"] .auth-tab-btn:hover {
    background: #162438 !important;
    color: #eef5fb !important;
}

html[data-theme="dark"] .auth-tab-btn.active {
    background: #111b2b !important;
    color: #63d9dd !important;
    border-bottom-color: #21c5ca !important;
}

html[data-theme="dark"] .auth-body {
    background: #111b2b !important;
}

html[data-theme="dark"] .auth-form .form-group label {
    color: #cbd6e1 !important;
}

html[data-theme="dark"] .auth-form input,
html[data-theme="dark"] .auth-form select {
    background-color: #17243a !important;
    border-color: #3a4b60 !important;
    color: #f0f5fa !important;
}

html[data-theme="dark"] .auth-form input:focus,
html[data-theme="dark"] .auth-form select:focus {
    border-color: #21b5bb !important;
    box-shadow: 0 0 0 3px rgba(33,181,187,.18) !important;
}

html[data-theme="dark"] .auth-form select option {
    background: #17243a !important;
    color: #f0f5fa !important;
}

html[data-theme="dark"] .auth-form .form-hint {
    color: #91a4b7 !important;
}

html[data-theme="dark"] .auth-form a,
html[data-theme="dark"] #link-forgot-password {
    color: #63d9dd !important;
}

html[data-theme="dark"] .toggle-password-btn {
    color: #d8e3ef !important;
}

html[data-theme="dark"] .password-strength-track {
    background: #26364a !important;
}

html[data-theme="dark"] .btn-auth-submit {
    background: #159ca2 !important;
    color: #fff !important;
}

html[data-theme="dark"] .btn-auth-submit:hover {
    background: #0f7f84 !important;
}

html[data-theme="dark"] #btn-cancel-forgot {
    background: #26364a !important;
    color: #dce6ef !important;
    border: 1px solid #3a4b60 !important;
}

html[data-theme="dark"] .auth-alert.success {
    background: #0d2c26 !important;
    border-color: #1d6654 !important;
    color: #8ee7cb !important;
}

html[data-theme="dark"] .auth-alert.info {
    background: #10263c !important;
    border-color: #28557a !important;
    color: #a9d7f5 !important;
}

html[data-theme="dark"] .auth-alert.error {
    background: #35191d !important;
    border-color: #74333a !important;
    color: #f5b8be !important;
}

/* Cápsulas: el buscador es un label contenedor, no sólo un input. */
html[data-theme="dark"] .capsules-search-wrap {
    background: #0d1725 !important;
    border-color: #3a4b60 !important;
    color: #e8f0f8 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .capsules-search-wrap > span {
    background: transparent !important;
    color: #8ea0b2 !important;
}

html[data-theme="dark"] .capsules-search-wrap input {
    background: transparent !important;
    color: #e8f0f8 !important;
    border: 0 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .capsules-search-wrap input::placeholder {
    color: #7f91a4 !important;
}

html[data-theme="dark"] .capsules-filter select,
html[data-theme="dark"] .capsules-filter select option {
    background: #0d1725 !important;
    color: #e8f0f8 !important;
}

html[data-theme="dark"] .capsule-details,
html[data-theme="dark"] .activity-data-row,
html[data-theme="dark"] .bo-publication-fieldset,
html[data-theme="dark"] .bo-subcard,
html[data-theme="dark"] .calendar-status,
html[data-theme="dark"] .calendar-empty,
html[data-theme="dark"] .profile-avatar,
html[data-theme="dark"] .participation-profile-summary {
    background: #0e1826 !important;
    border-color: #263447 !important;
}

html[data-theme="dark"] .capsule-meta > div,
html[data-theme="dark"] .bo-table th,
html[data-theme="dark"] .dropdown-header {
    background: #172235 !important;
}

html[data-theme="dark"] .bo-table td,
html[data-theme="dark"] .bo-table th,
html[data-theme="dark"] .bo-activity,
html[data-theme="dark"] .bo-fieldset,
html[data-theme="dark"] .bo-create {
    border-color: #29384b !important;
    color: #dce6f1 !important;
}

html[data-theme="dark"] .capsules-page,
html[data-theme="dark"] .papers-page,
html[data-theme="dark"] .calendar-page,
html[data-theme="dark"] .faq-page,
html[data-theme="dark"] .contact-page,
html[data-theme="dark"] .profile-page,
html[data-theme="dark"] .recomendador-page,
html[data-theme="dark"] .bo-page {
    color: #e6eef7 !important;
}

html[data-theme="dark"] .home-manifesto {
    background: linear-gradient(100deg,#102534,#132d39) !important;
    border-color: #285263 !important;
    color: #d9f7f8 !important;
}

html[data-theme="dark"] .home-manifesto > a {
    background: #111b2b !important;
    border-color: #346677 !important;
    color: #65dce0 !important;
}

html[data-theme="dark"] .capsule-id,
html[data-theme="dark"] .capsule-stats span,
html[data-theme="dark"] .capsule-resource-list span,
html[data-theme="dark"] .recommend-count,
html[data-theme="dark"] .organizer-tags span {
    background: #15343c !important;
    color: #8fe7ea !important;
}

html[data-theme="dark"] a {
    color: #69d9dd;
}

html[data-theme="dark"] .modal,
html[data-theme="dark"] .participation-modal {
    background: rgba(2,8,17,.72) !important;
}

html[data-theme="dark"] .participation-modal-content {
    background: #111b2b !important;
    color: #e6eef7 !important;
}

/* Backoffice completo: todas las vistas administrativas comparten la misma paleta oscura. */
html[data-theme="dark"] .bo-page,
html[data-theme="dark"] .stats-page,
html[data-theme="dark"] .ua-page,
html[data-theme="dark"] .ue-page {
    color:#e6eef7 !important;
}

html[data-theme="dark"] .bo-page .bo-card,
html[data-theme="dark"] .bo-page .bo-item,
html[data-theme="dark"] .bo-page .bo-filters,
html[data-theme="dark"] .bo-page .bo-table-wrap,
html[data-theme="dark"] .bo-page .bo-fieldset,
html[data-theme="dark"] .bo-page .bo-create,
html[data-theme="dark"] .bo-page .bo-activity,
html[data-theme="dark"] .bo-page .bo-subcard,
html[data-theme="dark"] .bo-page .material-card,
html[data-theme="dark"] .bo-page .file-current,
html[data-theme="dark"] .bo-page .bo-empty,
html[data-theme="dark"] .bo-page .bo-note,
html[data-theme="dark"] .bo-page .bo-comment,
html[data-theme="dark"] .bo-page .bo-detail-grid > div,
html[data-theme="dark"] .bo-page .publication-help,
html[data-theme="dark"] .bo-page .bo-publication-help {
    background:#111b2b !important;
    border-color:#2d3c50 !important;
    color:#dce6ef !important;
    box-shadow:none !important;
}

html[data-theme="dark"] .bo-page .bo-fieldset.publication,
html[data-theme="dark"] .bo-page .bo-publication-fieldset,
html[data-theme="dark"] .bo-page .bo-detail-grid > div,
html[data-theme="dark"] .bo-page .bo-comment,
html[data-theme="dark"] .bo-page .material-card,
html[data-theme="dark"] .bo-page .bo-empty {
    background:#0e1826 !important;
}

html[data-theme="dark"] .bo-page .bo-topbar h1,
html[data-theme="dark"] .bo-page .bo-section-head h2,
html[data-theme="dark"] .bo-page .bo-item h2,
html[data-theme="dark"] .bo-page .bo-card h2,
html[data-theme="dark"] .bo-page .bo-card h3,
html[data-theme="dark"] .stats-page h1,
html[data-theme="dark"] .stats-page h2,
html[data-theme="dark"] .ua-page h1,
html[data-theme="dark"] .ue-page h1,
html[data-theme="dark"] .ue-page h2 {
    color:#f1f6fb !important;
}

html[data-theme="dark"] .bo-page .bo-topbar p,
html[data-theme="dark"] .bo-page .bo-help,
html[data-theme="dark"] .bo-page .bo-note,
html[data-theme="dark"] .bo-page .bo-empty,
html[data-theme="dark"] .bo-page .bo-item-head p,
html[data-theme="dark"] .bo-page .bo-detail-grid p,
html[data-theme="dark"] .bo-page .bo-comment,
html[data-theme="dark"] .bo-page .publication-help,
html[data-theme="dark"] .bo-page .bo-publication-help {
    color:#aab9ca !important;
}

html[data-theme="dark"] .bo-page input,
html[data-theme="dark"] .bo-page select,
html[data-theme="dark"] .bo-page textarea,
html[data-theme="dark"] .ua-page input,
html[data-theme="dark"] .ua-page select,
html[data-theme="dark"] .ue-page input,
html[data-theme="dark"] .ue-page select,
html[data-theme="dark"] .ue-page textarea {
    background:#0d1725 !important;
    border-color:#3a4b60 !important;
    color:#eef5fb !important;
}

html[data-theme="dark"] .bo-page select option,
html[data-theme="dark"] .ua-page select option,
html[data-theme="dark"] .ue-page select option {
    background:#0d1725 !important;
    color:#eef5fb !important;
}

html[data-theme="dark"] .bo-page input:disabled,
html[data-theme="dark"] .ua-page input:disabled,
html[data-theme="dark"] .ue-page input:disabled {
    background:#172235 !important;
    color:#91a4b7 !important;
}

html[data-theme="dark"] .bo-page .bo-secondary,
html[data-theme="dark"] .bo-page .bo-button.secondary,
html[data-theme="dark"] .bo-page .bo-button.ghost {
    background:#26364a !important;
    color:#e2eaf2 !important;
    border-color:#3a4b60 !important;
}

html[data-theme="dark"] .bo-page .bo-button,
html[data-theme="dark"] .ua-page .ua-filters button,
html[data-theme="dark"] .ue-page .ue-primary {
    background:#159ca2 !important;
    color:#fff !important;
}

html[data-theme="dark"] .bo-page .bo-table th,
html[data-theme="dark"] .ua-page .ua-table th {
    background:#172235 !important;
    color:#aebdca !important;
    border-color:#29384b !important;
}

html[data-theme="dark"] .bo-page .bo-table td,
html[data-theme="dark"] .ua-page .ua-table td {
    background:#111b2b !important;
    color:#dce6ef !important;
    border-color:#29384b !important;
}

html[data-theme="dark"] .bo-page .bo-status.borrador,
html[data-theme="dark"] .ua-page .ua-status.pending {
    background:#3a2a15 !important;
    color:#f6c56f !important;
}

html[data-theme="dark"] .bo-page .bo-status.publicado,
html[data-theme="dark"] .ua-page .ua-status.active {
    background:#123329 !important;
    color:#80e2bd !important;
}

html[data-theme="dark"] .bo-page .bo-status.inactivo,
html[data-theme="dark"] .ua-page .ua-status.blocked {
    background:#342128 !important;
    color:#f1aeb8 !important;
}

html[data-theme="dark"] .bo-page .bo-badge,
html[data-theme="dark"] .bo-page .bo-state,
html[data-theme="dark"] .bo-page .student-kit {
    background:#15343c !important;
    color:#8fe7ea !important;
}

html[data-theme="dark"] .bo-page .bo-alert.success,
html[data-theme="dark"] .bo-page .bo-alert.ok,
html[data-theme="dark"] .ua-page .ua-success,
html[data-theme="dark"] .ue-page .ue-success {
    background:#0d2c26 !important;
    border-color:#1d6654 !important;
    color:#8ee7cb !important;
}

html[data-theme="dark"] .bo-page .bo-alert.error,
html[data-theme="dark"] .ua-page .ua-error,
html[data-theme="dark"] .ue-page .ue-error,
html[data-theme="dark"] .stats-page .stats-alert {
    background:#35191d !important;
    border-color:#74333a !important;
    color:#f5b8be !important;
}

html[data-theme="dark"] .bo-page .bo-note.warning {
    background:#332b15 !important;
    border-color:#665321 !important;
    color:#e9cf83 !important;
}

html[data-theme="dark"] .bo-page .file-current {
    background:#10263c !important;
    border-color:#28557a !important;
}

html[data-theme="dark"] .bo-page .bo-check,
html[data-theme="dark"] .ue-page .ue-check {
    background:#0e1826 !important;
    color:#dce6ef !important;
}

html[data-theme="dark"] .stats-page .stats-kpis article,
html[data-theme="dark"] .stats-page .stats-panel,
html[data-theme="dark"] .stats-page .stats-filters a {
    background:#111b2b !important;
    border-color:#2d3c50 !important;
    color:#dce6ef !important;
    box-shadow:none !important;
}

html[data-theme="dark"] .stats-page .stats-filters a.active {
    background:#159ca2 !important;
    border-color:#159ca2 !important;
    color:#fff !important;
}

html[data-theme="dark"] .stats-page .stats-kpis span,
html[data-theme="dark"] .stats-page .stats-panel-title small,
html[data-theme="dark"] .stats-page .stats-bar-row small,
html[data-theme="dark"] .stats-page .stats-empty,
html[data-theme="dark"] .stats-page th {
    color:#9fb0c2 !important;
}

html[data-theme="dark"] .stats-page .stats-bar-track {
    background:#26364a !important;
}

html[data-theme="dark"] .stats-page th,
html[data-theme="dark"] .stats-page td {
    border-color:#29384b !important;
}

html[data-theme="dark"] .stats-page code {
    color:#c9e8ea !important;
}

html[data-theme="dark"] .ua-page .ua-filters,
html[data-theme="dark"] .ua-page .ua-table-wrap {
    background:#111b2b !important;
    border-color:#2d3c50 !important;
}

html[data-theme="dark"] .ua-page .ua-filters label span,
html[data-theme="dark"] .ua-page .ua-table td small,
html[data-theme="dark"] .ua-page .ua-empty {
    color:#9fb0c2 !important;
}

html[data-theme="dark"] .ua-page .ua-table td strong {
    color:#eef5fb !important;
}

html[data-theme="dark"] .ue-page .ue-card {
    background:#111b2b !important;
    border-color:#2d3c50 !important;
    color:#dce6ef !important;
    box-shadow:none !important;
}

html[data-theme="dark"] .ue-page .ue-card fieldset,
html[data-theme="dark"] .ue-page .ue-meta div,
html[data-theme="dark"] .ue-page .ue-history article {
    border-color:#29384b !important;
}

html[data-theme="dark"] .ue-page .ue-card label>span,
html[data-theme="dark"] .ue-page .ue-card legend,
html[data-theme="dark"] .ue-page .ue-meta dt,
html[data-theme="dark"] .ue-page .ue-help,
html[data-theme="dark"] .ue-page .ue-history time,
html[data-theme="dark"] .ue-page .ue-history small {
    color:#9fb0c2 !important;
}

html[data-theme="dark"] .ue-page .ue-meta dd,
html[data-theme="dark"] .ue-page .ue-history strong {
    color:#eef5fb !important;
}

html[data-theme="dark"] .ue-page .ue-check.ue-base-role,
html[data-theme="dark"] .ue-page .ue-check.ue-highlight {
    background:#15343c !important;
}

html[data-theme="dark"] .ue-page .ue-check.ue-danger-check {
    background:#342128 !important;
}

html[data-theme="dark"] .ue-page .ue-state.active {
    background:#123329 !important;
    color:#80e2bd !important;
}

@media (max-width: 1100px) {
    .theme-toggle {
        margin-right: 5px;
    }
    .theme-toggle-icon {
        display: none;
    }
}
