/* assets/styles/shell.css
 *
 * Styles extracted from the inline \3c style> block in templates/shell.html.twig.
 * The shell (Sanctum authenticated area) has its own small set of UI primitives
 * (sanctum-link, kpi-card, tier badges, status pills, data tables, action
 * buttons) used by every page that extends shell.html.twig.
 *
 * These styles are NOT in home.css (public shell) — clean boundary.
 *
 * Also defines the SHELL LAYOUT: persistent sidebar (256px) + content column.
 * On screens <=1024px the sidebar collapses to a 64px icon rail with hover
 * tooltips (JS-driven, see templates/shell.html.twig).
 */

/* ─── Data tables ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--outline-elev);
    border-bottom: 1px solid var(--outline-variant-elev);
}
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--outline-variant-elev);
    font-size: 0.875rem;
}
.data-table tr:hover td {
    background: var(--glass-bg-elev);
}

/* ─── Utility: hidden (toggle by JS, e.g. notification badges) ─── */
.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   SHELL LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.sanctum-layout {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

/* TNSVT V1-style — nebula overlay on top of the WebGL background.
   Adds depth with two soft radial gradients (violet + gold) drifting
   behind the content. Pure visual ambience, pointer-events: none. */
.sanctum-layout::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 18% 22%, rgba(138, 60, 255, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse 50% 45% at 82% 78%, rgba(242, 202, 80, 0.06) 0%, transparent 65%),
        radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.25) 100%);
    animation: sanctum-nebula-drift 60s ease-in-out infinite alternate;
}
@keyframes sanctum-nebula-drift {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.05) translate(2%, -1.5%);
    }
}
@media (prefers-reduced-motion: reduce) {
    .sanctum-layout::before {
        animation: none;
    }
}

#sanctum-sidebar {
    width: 256px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: width 0.18s ease;
}

/* Internal nav scrolls independently of the brand/user-card rows.
   This keeps the active link visible even when the menu grows past
   100vh on small viewports. The brand stays pinned at top and the
   user-card stays pinned at bottom by virtue of flex column + the
   .sanctum-nav being a flex item with min-height:0. */
#sanctum-sidebar .sanctum-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
#sanctum-sidebar .sidebar-brand,
#sanctum-sidebar .sidebar-user-card {
    flex: 0 0 auto;
}

#sanctum-sidebar.sidebar-manual-collapsed {
    width: 64px;
}
#sanctum-sidebar.sidebar-manual-collapsed .sanctum-link-label,
#sanctum-sidebar.sidebar-manual-collapsed .sidebar-brand-text,
#sanctum-sidebar.sidebar-manual-collapsed .sanctum-section-title,
#sanctum-sidebar.sidebar-manual-collapsed .sidebar-user-meta {
    display: none;
}
#sanctum-sidebar.sidebar-manual-collapsed .sidebar-brand {
    padding: 1rem 0;
}
#sanctum-sidebar.sidebar-manual-collapsed .sidebar-brand .flex {
    justify-content: center;
}
#sanctum-sidebar.sidebar-manual-collapsed .sanctum-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 0.625rem;
    right: 0.5rem;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--glass-border-elev, rgba(255, 255, 255, 0.08));
    background: var(--glass-bg-elev, rgba(255, 255, 255, 0.04));
    color: var(--on-surface-elev);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.55;
    transition:
        opacity 0.15s ease,
        background 0.15s ease;
}
.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus-visible {
    opacity: 1;
    background: var(--glass-bg-strong-elev, rgba(255, 255, 255, 0.08));
}
.sidebar-toggle-btn .material-symbols-elev {
    font-size: 1.1rem;
}
#sanctum-sidebar.sidebar-manual-collapsed .sidebar-toggle-btn {
    /* Collapsed bar is 64px wide: park the toggle BELOW the brand icon,
       centered and fully opaque, or users can never find it to reopen.
       (Previously it overlapped the brand at 0.55 opacity.) */
    top: 84px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    opacity: 1;
}

@media (max-width: 640px) {
    #sanctum-sidebar.sidebar-manual-collapsed {
        width: 0;
        padding: 0;
        overflow: hidden;
        border: none;
    }
    #sanctum-sidebar.sidebar-manual-collapsed .sidebar-toggle-btn {
        right: 0.5rem;
    }
}

.sanctum-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Page-enter transition (Fase E — CSS-only, no JS behavior change) */
@keyframes sanctum-page-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.sanctum-main > .sanctum-content {
    animation: sanctum-page-in 220ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
    .sanctum-main > .sanctum-content {
        animation: none;
    }
}

.sanctum-topbar {
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: linear-gradient(180deg, rgba(34, 29, 46, 0.85) 0%, rgba(22, 17, 33, 0.85) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--outline-variant-elev);
    box-shadow:
        0 1px 0 rgba(242, 202, 80, 0.05),
        0 8px 24px rgba(0, 0, 0, 0.15);
    gap: 1rem;
    position: relative;
    z-index: 10;
}
.sanctum-topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(242, 202, 80, 0.3) 50%,
        transparent 100%
    );
    pointer-events: none;
}
.sanctum-topbar .flex {
    display: flex;
}
.sanctum-topbar .items-center {
    align-items: center;
}
.sanctum-topbar .gap-3 {
    gap: 0.75rem;
}

.sanctum-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}
@media (max-width: 1024px) {
    .sanctum-content {
        padding: 1rem;
    }
}
@media (max-width: 640px) {
    .sanctum-content {
        padding: 0.75rem;
    }
}

/* ─── Sidebar internals ─── */

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--outline-variant-elev);
}
.sidebar-brand .flex {
    display: flex;
}
.sidebar-brand .items-center {
    align-items: center;
}
.sidebar-brand .gap-3 {
    gap: 0.75rem;
}
.sidebar-brand .w-10 {
    width: 2.5rem;
}
.sidebar-brand .h-10 {
    height: 2.5rem;
}
.sidebar-brand .rounded-lg {
    border-radius: 0.5rem;
}
.sidebar-brand .flex.items-center.justify-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-brand .justify-center {
    justify-content: center;
}
.sidebar-brand .w-10.h-10 {
    background: linear-gradient(135deg, var(--gold-elev), var(--gold-bright-elev));
    color: var(--on-primary-elev);
}
.sidebar-brand .material-symbols-elev {
    color: inherit;
}

.sidebar-brand-text h1 {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.3;
}
.sidebar-brand-text p {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--outline-elev);
}

.sanctum-nav {
    flex: 1;
    min-height: 0;
    overflow: hidden auto;
    padding: 0.75rem 0;
}

.sanctum-section-title {
    padding: 1rem 1.5rem 0.4rem;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold-elev);
    font-weight: 600;
    opacity: 0.85;
    position: relative;
    border-top: 1px solid var(--outline-variant-elev);
    margin-top: 0.75rem;
}
.sanctum-section-title:first-child {
    border-top: none;
    margin-top: 0;
}
.sanctum-section-title-sub {
    color: var(--outline-elev);
    opacity: 0.4;
    font-size: 0.5625rem;
    padding-left: 2.5rem;
    padding-top: 0.375rem;
}

.sidebar-user-card {
    padding: 1rem;
    border-top: 1px solid var(--outline-variant-elev);
    flex-shrink: 0;
}
.sidebar-user-card .glass-card-elev {
    padding: 0.75rem;
}
.sidebar-user-card .glass-card-elev > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.sidebar-user-card #user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--gold-elev), var(--gold-bright-elev));
    color: var(--on-primary-elev);
    font-weight: 700;
}
.sidebar-user-card .sidebar-user-meta {
    flex: 1;
    min-width: 0;
}
.sidebar-user-card #user-name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--on-surface-elev);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-card #logout-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    background: var(--glass-bg-elev);
    border: 1px solid var(--outline-variant-elev);
    color: var(--on-surface-variant-elev);
    cursor: pointer;
    transition: background 0.2s ease;
}
.sidebar-user-card #logout-btn:hover {
    background: var(--glass-bg-strong-elev);
}

/* Bell badge (sidebar) */
.sanctum-bell-badge {
    margin-left: auto;
    min-width: 18px;
    text-align: center;
    background: linear-gradient(135deg, #d4af37 0%, #ffd700 50%, #d4af37 100%);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.15rem 0.4rem;
    border-radius: 9999px;
    box-shadow: var(--glow-gold-elev);
}

/* ═══════════════════════════════════════════════════════════════
   RAIL MODE (sidebar collapsed, icons only) — <=1024px
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    #sanctum-sidebar {
        width: 64px;
    }

    .sidebar-brand {
        padding: 1rem 0;
    }
    .sidebar-brand .flex {
        justify-content: center;
    }
    .sidebar-brand-text {
        display: none !important;
    }

    .sanctum-nav {
        padding: 0.5rem 0;
    }

    .sanctum-section-title {
        display: none !important;
    }
    .sanctum-link-label {
        display: none !important;
    }

    .sanctum-link {
        justify-content: center;
        gap: 0;
        padding: 0.75rem 0;
        margin: 0.125rem 0.5rem;
    }
    .sanctum-link.active::after {
        right: 0.375rem;
    }

    .sidebar-user-card {
        padding: 0.625rem 0.25rem;
    }
    .sidebar-user-card .glass-card-elev {
        padding: 0.375rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .sidebar-user-card .glass-card-elev > div:first-child {
        justify-content: center;
    }
    .sidebar-user-card .sidebar-user-meta {
        display: none !important;
    }
    .sidebar-user-card #logout-btn {
        width: 40px;
        height: 40px;
        margin-top: 0.375rem;
        padding: 0;
        font-size: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        flex-shrink: 0;
    }
    .sidebar-user-card #logout-btn::after {
        content: 'logout';
        font-family: 'Material Symbols Outlined'; /* icon, no token needed */
        font-size: 20px;
        line-height: 1;
        color: var(--on-surface-variant-elev);
    }

    .sanctum-topbar {
        padding: 0 1rem;
        height: 56px;
    }
    .sanctum-topbar .topbar-title {
        font-size: 0.9rem;
    }
    .sanctum-topbar .topbar-subtitle {
        display: none;
    }
    .sanctum-content {
        padding: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RAIL TOOLTIP (JS-driven single element)
   ═══════════════════════════════════════════════════════════════ */

#sanctum-rail-tooltip {
    position: fixed;
    z-index: 1000;
    padding: 0.4rem 0.75rem;
    border-radius: 0.375rem;
    background: #0b0716;
    border: 1px solid var(--outline-variant-elev);
    color: var(--gold-elev);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%) scale(0.95);
    transition:
        opacity 0.12s ease,
        transform 0.12s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
#sanctum-rail-tooltip.visible {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* ═══════════════════════════════════════════════════════════════
   TOPBAR NOTIFICATION BELL (header badge + popover)
   ═══════════════════════════════════════════════════════════════ */

#header-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #d4af37 0%, #ffd700 50%, #d4af37 100%);
    color: #000;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: var(--glow-gold-elev);
}

.notif-wrap {
    position: relative;
}

.notif-wrap .btn-elev-ghost {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.notif-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 320px;
    max-width: calc(100vw - 2rem);
    background: linear-gradient(160deg, var(--surface-elev) 0%, rgba(12, 8, 22, 0.98) 100%);
    border: 1px solid var(--glass-border-gold-elev);
    border-radius: 0.75rem;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(138, 60, 255, 0.15);
    z-index: 80;
    overflow: hidden;
    animation: v2-slide-up 0.2s ease-out;
}

.notif-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gold-elev);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--glass-border-gold-elev);
}

.notif-popover-markall {
    background: transparent;
    border: none;
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--on-surface-variant-elev);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: color 0.15s ease;
}
.notif-popover-markall:hover {
    color: var(--gold-elev);
}

.notif-popover-list {
    max-height: 320px;
    overflow-y: auto;
}

.notif-popover-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    text-decoration: none;
    border-bottom: 1px solid var(--outline-variant-elev);
    transition: background 0.15s ease;
}
.notif-popover-item:hover {
    background: var(--glass-bg-elev);
}
.notif-popover-item-unread {
    background: rgba(242, 202, 80, 0.05);
    box-shadow: inset 3px 0 0 var(--gold-elev);
}

.notif-popover-icon {
    color: var(--gold-elev);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.notif-popover-main {
    flex: 1;
    min-width: 0;
}

.notif-popover-text {
    display: block;
    color: var(--on-surface-elev);
    font-size: 0.8125rem;
    line-height: 1.35;
}

.notif-popover-time {
    display: block;
    margin-top: 0.25rem;
    color: var(--outline-elev);
    font-size: 0.6875rem;
}

.notif-popover-new {
    flex-shrink: 0;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--gold-elev);
    letter-spacing: 0.05em;
}

.notif-popover-placeholder {
    padding: 1.5rem 0.875rem;
    text-align: center;
    color: var(--outline-elev);
    font-size: 0.8125rem;
}

.notif-popover-footer {
    display: block;
    padding: 0.625rem 0.875rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-elev);
    text-decoration: none;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border-elev);
    transition: background 0.15s ease;
}
.notif-popover-footer:hover {
    background: var(--glass-bg-strong-elev);
}

/* ═══════════════════════════════════════════════════════════════
   PROTOCOL MODAL (Invocar Protocolo → Guardian)
   ═══════════════════════════════════════════════════════════════ */

.protocol-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(3, 1, 10, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: v2-fade-in 0.2s ease-out;
}

/* The hidden HTML attribute must win over the display:flex above
   so the modal stays dismissed after a page reload. Without this
   rule, the user-agent stylesheet's [hidden] { display:none } has
   the same specificity as .protocol-overlay and loses on tie-break. */
.protocol-overlay[hidden] {
    display: none;
}

.protocol-modal {
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(135deg, var(--surface-elev) 0%, rgba(16, 11, 28, 0.98) 100%);
    border: 1px solid var(--glass-border-gold-elev);
    border-radius: 1rem;
    box-shadow:
        0 0 60px rgba(138, 60, 255, 0.2),
        var(--shadow-lg-elev);
    animation: v2-slide-up 0.3s ease-out;
}

.protocol-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--glass-border-gold-elev);
}
.protocol-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.protocol-dismiss-24h {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.4rem;
    color: var(--outline-elev);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.protocol-dismiss-24h > span {
    font-size: 0.95rem;
}
.protocol-dismiss-24h:hover {
    background: rgba(242, 202, 80, 0.1);
    border-color: var(--gold-elev);
    color: var(--gold-elev);
}
.protocol-dismiss-24h-label {
    font-weight: 600;
    letter-spacing: 0.02em;
}
@media (max-width: 520px) {
    .protocol-dismiss-24h-label {
        display: none;
    }
    .protocol-dismiss-24h {
        padding: 0.4rem 0.5rem;
    }
}

.protocol-modal-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display-elev);
    font-size: 1.125rem;
    letter-spacing: 0.04em;
    color: var(--on-surface-elev);
}

.protocol-modal-icon {
    color: var(--gold-elev);
}

/* ──────── TNSVT Sprint B.5 — Badge de alerts en el botón Guardian ──────── */
.protocol-alert-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 0.4rem;
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9px;
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
    animation: protocol-alert-pulse 2s infinite;
}
@keyframes protocol-alert-pulse {
    0%,
    100% {
        box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
    }
    50% {
        box-shadow: 0 0 16px rgba(248, 113, 113, 0.9);
    }
}

.protocol-close {
    background: transparent;
    border: none;
    color: var(--on-surface-elev);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}
.protocol-close:hover {
    background: var(--glass-bg-elev);
    color: var(--gold-elev);
}

.protocol-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.protocol-loading,
.protocol-error {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--outline-elev);
    font-size: 0.875rem;
}

.protocol-error {
    color: #f87171;
}
.protocol-error .material-symbols-elev {
    font-size: 2rem;
}

.protocol-score {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.protocol-score-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: var(--glass-bg-elev);
    border: 1px solid var(--outline-variant-elev);
    border-radius: 0.75rem;
}

.protocol-score-label {
    margin: 0 0 0.5rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--outline-elev);
}

.protocol-score-value {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--gold-elev);
}

.protocol-score-sub {
    font-size: 0.75rem;
    color: var(--outline-elev);
    margin-top: 0.25rem;
}

.protocol-score-cell .tier-badge-elev {
    margin-top: 0.625rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.protocol-score-breakdown {
    padding: 0.25rem 0.125rem;
}

.protocol-score-breakdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.protocol-breakdown-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--outline-variant-elev);
}
.protocol-breakdown-item:last-child {
    border-bottom: none;
}

.protocol-icon-danger {
    flex-shrink: 0;
    font-size: 1.125rem;
    color: #f87171;
    margin-top: 0.125rem;
}

.protocol-breakdown-text {
    flex: 1;
    min-width: 0;
}
.protocol-breakdown-text p {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--on-surface-elev);
}
.protocol-breakdown-source {
    font-size: 0.6875rem !important;
    color: var(--outline-elev) !important;
    margin-top: 0.125rem !important;
}

.protocol-breakdown-delta {
    flex-shrink: 0;
    font-family: var(--font-body-elev, monospace);
    font-size: 0.8125rem;
    color: #f87171;
}

.protocol-breakdown-clear {
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    color: var(--outline-elev);
}

.protocol-score-computed {
    margin: 0.75rem 0 0;
    font-size: 0.6875rem;
    color: var(--outline-elev);
}

.protocol-signals {
    padding-top: 0.5rem;
    border-top: 1px solid var(--outline-variant-elev);
}

.protocol-signals-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.protocol-signals-head .protocol-score-label {
    margin: 0;
}

.protocol-count {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: var(--glass-bg-elev);
    border: 1px solid var(--outline-variant-elev);
    color: var(--outline-elev);
}

.protocol-signals ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.protocol-signal {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--glass-bg-elev);
    border: 1px solid var(--outline-variant-elev);
    border-radius: 0.625rem;
}

.protocol-signal-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    font-variation-settings: 'FILL' 1;
}

.protocol-signal-body {
    flex: 1;
    min-width: 0;
}

.protocol-signal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.protocol-signal-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--on-surface-elev);
}

.protocol-signal-message {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--on-surface-variant-elev);
}

.protocol-signal-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-elev);
    text-decoration: none;
}
.protocol-signal-action:hover {
    text-decoration: underline;
}

.protocol-signal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    padding: 1.5rem 0.75rem;
    color: #4ade80;
}
.protocol-signal-empty .material-symbols-elev {
    font-size: 2rem;
}
.protocol-signal-empty p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--on-surface-elev);
}
.protocol-signal-empty-sub {
    font-weight: 400 !important;
    font-size: 0.75rem !important;
    color: var(--outline-elev) !important;
}

.protocol-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border-elev);
}

.protocol-footer-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-elev);
    text-decoration: none;
}
.protocol-footer-link:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .protocol-score {
        grid-template-columns: 1fr;
    }
    .notif-popover {
        right: -80px;
        width: 300px;
    }
}

/* ══════ Empty State (reusable) ══════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}
.empty-state-icon {
    font-size: 3rem;
    color: var(--violet, #8a3cff);
    opacity: 0.5;
    margin-bottom: 1rem;
}
.empty-state-message {
    font-size: 1rem;
    font-weight: 600;
    color: var(--on-surface-elev);
    margin: 0 0 0.25rem;
}
.empty-state-description {
    font-size: 0.875rem;
    color: var(--outline-elev);
    margin: 0 0 1rem;
    max-width: 320px;
}
.empty-state-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gold-elev);
    color: var(--on-surface-elev);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.empty-state-cta:hover {
    opacity: 0.9;
}
.empty-state-sm .empty-state-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.empty-state-sm .empty-state-message {
    font-size: 0.875rem;
}
.empty-state-sm .empty-state-description {
    font-size: 0.75rem;
}
.empty-state-lg .empty-state-icon {
    font-size: 4rem;
}
.empty-state-lg .empty-state-message {
    font-size: 1.25rem;
}
/* Compact: inline row inside cards/lists (Fase B) */
.empty-state-compact {
    flex-direction: row;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-align: left;
}
.empty-state-compact .empty-state-icon {
    font-size: 1.5rem;
    margin-bottom: 0;
}
.empty-state-compact .empty-state-message {
    font-size: 0.8rem;
    margin: 0;
}
.empty-state-compact .empty-state-description {
    font-size: 0.75rem;
    margin: 0;
}
/* Illustrated: decorative glow ring behind the icon (no new assets) */
.empty-state-illustrated .empty-state-icon {
    position: relative;
    font-size: 3.5rem;
    opacity: 1;
    color: var(--gold-elev);
    filter: drop-shadow(0 0 12px rgba(242, 202, 80, 0.35));
}
.empty-state-illustrated .empty-state-icon::before {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    pointer-events: none;
}

/* ══════ Loading State (reusable) ══════ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}
.loading-state-icon {
    font-size: 2rem;
    color: var(--outline-elev);
    animation: loading-pulse 1.5s ease-in-out infinite;
}
.loading-state-message {
    font-size: 0.875rem;
    color: var(--outline-elev);
    margin-top: 0.75rem;
}
@keyframes loading-pulse {
    0%,
    100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* ══════ Skeleton screens (Fase G4 — shimmer placeholders) ══════ */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--glass-bg-elev);
    border: 1px solid var(--glass-border-elev);
    border-radius: 0.5rem;
    min-height: 1rem;
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}
.skeleton-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
}
.skeleton-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.skeleton-line {
    height: 0.7rem;
}
.skeleton-line.w-3-4 {
    width: 75%;
}
.skeleton-line.w-1-2 {
    width: 50%;
}
.skeleton-card {
    padding: 1rem;
}
@media (prefers-reduced-motion: reduce) {
    .skeleton::after {
        animation: none;
    }
}

/* ─── Notification badge: pop animation on count change ─── */
@keyframes badge-pop {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.5);
        box-shadow: 0 0 18px var(--gold-bright-elev, #ffd700);
    }
    60% {
        transform: scale(0.92);
    }
    100% {
        transform: scale(1);
    }
}
#header-notif-badge.is-popping,
#bell-badge.is-popping {
    animation: badge-pop 480ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (prefers-reduced-motion: reduce) {
    #header-notif-badge.is-popping,
    #bell-badge.is-popping {
        animation: none;
    }
}

/* ─── Sidebar: sliding active-state indicator ─── */
.sanctum-nav {
    position: relative;
}
.sanctum-nav-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--gold-elev) 0%, var(--gold-bright-elev) 100%);
    box-shadow: 0 0 12px rgba(242, 202, 80, 0.6);
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition:
        transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1),
        height 200ms ease,
        opacity 200ms ease;
    pointer-events: none;
    will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
    .sanctum-nav-indicator {
        transition: opacity 200ms ease;
    }
}

/* ─── L8: collapsible nav sections ─── */
.sanctum-section-title[data-section-toggle] {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.sanctum-section-title[data-section-toggle]:hover {
    color: var(--gold-elev);
}
.sanctum-section-title[data-section-toggle]::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined';
    font-size: 1rem;
    margin-left: auto;
    transition: transform 0.18s ease;
    /* CRÍTICO: .sanctum-section-title tiene text-transform: uppercase (linea 332).
       Sin este reset, el texto del pseudo-elemento se convierte a
       "EXPAND_MORE" ANTES de que la fuente aplique la ligadura ligature->glifo
       de Material Symbols. La ligadura ya no matchea y el browser pinta el
       nombre del icono en vez del glifo — se veia "EXPAND__MORE" al lado de cada
       titulo de seccion del sidebar en produccion (2026-10-15).

       Cualquier elemento que ponga content con un nombre de icono de Material
       Symbols dentro de un contenedor con text-transform necesita esto. */
    text-transform: none;
    font-variation-settings: 'FILL' 0;
}
.sanctum-section-title[data-section-toggle].is-collapsed::after {
    transform: rotate(-90deg);
}
.sanctum-section-title[data-section-toggle]:focus-visible {
    outline: 2px solid var(--gold-elev);
    outline-offset: -2px;
    border-radius: 4px;
}
#sanctum-sidebar .sanctum-link[hidden] {
    display: none;
}
@media (prefers-reduced-motion: reduce) {
    .sanctum-section-title[data-section-toggle]::after {
        transition: none;
    }
}
