/* ========================================
   APP LAYOUT
======================================== */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   APP NAVBAR (pill flotante, estilo landing)
======================================== */
.app-nav {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    width: calc(100% - 4rem);
    max-width: 1100px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.07);
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.app-nav.is-scrolled {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 41, 82, 0.18);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}

.app-nav__logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--color-text);
}

.app-nav__logo-name {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.app-nav__links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.app-nav__link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s;
}

.app-nav__link:hover { color: var(--color-text); }

/* ========================================
   MENÚ DE CUENTA (desplegable del nav)
======================================== */
.account-menu { position: relative; }

.account-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.65rem 0.3rem 0.3rem;
    border-radius: 100px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color 0.2s, background 0.2s;
}

.account-menu__trigger::-webkit-details-marker { display: none; }

.account-menu__trigger:hover,
.account-menu[open] .account-menu__trigger {
    color: var(--color-text);
    background: rgba(15, 41, 82, 0.06);
}

.account-menu__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-sky));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.account-menu__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-menu__name {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu__chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.account-menu[open] .account-menu__chevron { transform: rotate(180deg); }

.account-menu__panel {
    position: absolute;
    top: calc(100% + 0.9rem);
    right: 0;
    min-width: 230px;
    max-width: calc(100vw - 2rem);
    padding: 0.4rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.account-menu__header {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.7rem 0.7rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

.account-menu__org {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.account-menu__email {
    font-size: 0.78rem;
    color: var(--color-text-dim);
    overflow-wrap: anywhere;
}

.account-menu__item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: none;
    border-radius: var(--radius-md);
    background: none;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.account-menu__item:hover {
    color: var(--color-text);
    background: rgba(15, 41, 82, 0.06);
}

.account-menu__item--active {
    color: var(--color-text);
    font-weight: 700;
}

.account-menu__tag {
    margin-left: auto;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.account-menu__item:has(.account-menu__tag) { gap: 0.75rem; }

.account-menu__tag--info    { background: #eef2fb; color: #2a4a8a; }
.account-menu__tag--warning { background: #fdf0e3; color: #92400e; }
.account-menu__tag--danger  { background: #fdecec; color: #b3261e; }

.account-menu__item--danger:hover {
    color: var(--color-red);
    background: rgba(220, 38, 38, 0.06);
}

.account-menu__sections { display: none; }

/* Mismo corte que oculta .app-nav__links (responsive.css): el menú pasa a ser la navegación */
@media (max-width: 768px) {
    .account-menu__sections {
        display: block;
        padding-bottom: 0.4rem;
        margin-bottom: 0.4rem;
        border-bottom: 1px solid var(--color-border);
    }
}

@media (max-width: 480px) {
    .account-menu__name { display: none; }
}

/* ========================================
   DASHBOARD BODY
======================================== */
.dashboard-body {
    flex: 1;
    background: var(--color-bg);
    background-image: radial-gradient(circle, rgba(15,41,82,0.12) 1px, transparent 1px);
    background-size: 22px 22px;
}

.dashboard-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5.5rem 1.5rem 4rem;
    animation: fadeUp 0.6s ease both;
}

/* ========================================
   DASHBOARD HEADER
======================================== */
.dashboard-header {
    margin-bottom: 2rem;
    margin-top: 2rem;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-text);
    line-height: 1.2;
}

.dashboard-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-dim);
    margin-top: 0.3rem;
}

.catalog-hint {
    font-size: 0.8125rem;
    color: var(--color-text-dim);
    margin-top: 0.5rem;
    max-width: 46rem;
    line-height: 1.5;
}

/* ========================================
   STAT CARDS
======================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    animation: fadeUp 0.45s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.12s; }
.stat-card:nth-child(3) { animation-delay: 0.19s; }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-sky));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card__icon {
    width: 38px;
    height: 38px;
    background: rgba(15, 41, 82, 0.07);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.stat-card__icon svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    stroke: currentColor;
    fill: none;
}

.stat-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-text-dim);
}

.stat-card__value {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--color-text);
    line-height: 1;
}

/* Una fecha no parte línea: a 2.25rem se sale de la tarjeta en el grid de 2 columnas */
.stat-card__value--date {
    font-size: 1.6rem;
    line-height: 1.4;
}

.stat-card__sub {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

.stat-card__link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--color-border);
    text-underline-offset: 2px;
}

.stat-card__link:hover {
    color: var(--color-text);
    text-decoration-color: currentColor;
}

.stat-card__value-row {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.stat-card__badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: rgba(15, 41, 82, 0.06);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    white-space: nowrap;
}

/* ========================================
   DASHBOARD SECTIONS
======================================== */
.dashboard-section {
    margin-bottom: 2.5rem;
    animation: fadeUp 0.45s ease both;
    animation-delay: 0.25s;
}

.dashboard-section:nth-of-type(2) { animation-delay: 0.35s; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.01em;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--color-accent);
    border-radius: 2px;
    flex-shrink: 0;
}

