/* ═══════════════════════════════════════════════════════════════════════════
   ARMALL · estructura del panel (layout, navegación, contenido)
   ═══════════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.app {
    background:
        radial-gradient(1200px 600px at 12% -10%, var(--burgundy-soft), transparent 60%),
        var(--midnight);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--fs-md);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
code { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-raised);
    padding: 2px 6px; border-radius: 6px; color: var(--text-soft); }
em { font-style: normal; color: var(--text-muted); font-size: var(--fs-sm); }
.muted { color: var(--text-muted); font-size: var(--fs-sm); }
.subhead { margin: var(--sp-4) 0 var(--sp-2); color: var(--text-soft); }
.skip-link { position: absolute; left: -9999px; }

/* ─────────── Estructura con barra lateral fija ─────────── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    align-items: start;
}

.side {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-4);
    background: linear-gradient(180deg, var(--ink) 0%, var(--midnight) 100%);
    border-right: 1px solid var(--line);
}

.side__brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand__mark {
    display: grid;
    place-items: center;
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--burgundy), var(--burgundy-deep));
    color: var(--champagne);
    font-weight: 700; font-size: 1.15rem;
    box-shadow: inset 0 0 0 1px rgba(231, 211, 168, 0.25);
}
.brand__mark--lg { width: 64px; height: 64px; font-size: 1.7rem; border-radius: 18px; }
.brand__text { display: flex; flex-direction: column; }
.brand__text strong { letter-spacing: var(--tracking-wide); font-size: 1rem; }
.brand__text em { font-size: var(--fs-xs); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav__link {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 10px var(--sp-3);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: var(--fs-sm);
    border: 1px solid transparent;
}
.nav__link:hover { background: var(--surface); color: var(--text); }
.nav__link--active {
    background: var(--champagne-soft);
    border-color: var(--line-strong);
    color: var(--text);
    font-weight: 600;
}

.side__user {
    display: flex; align-items: center; gap: var(--sp-3);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--line);
}
.side__user-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.side__user-info strong { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.avatar {
    display: grid; place-items: center;
    width: 36px; height: 36px; border-radius: var(--radius-pill);
    background: var(--surface-raised); color: var(--champagne);
    font-size: var(--fs-sm); font-weight: 600;
    border: 1px solid var(--line-strong);
}
.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-lg); }

/* ─────────── Contenido ─────────── */
.main { padding: var(--sp-5) var(--sp-6) var(--sp-6); min-width: 0; }

.topbar {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.topbar__titles p { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.topbar__aside { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.content { display: flex; flex-direction: column; gap: var(--sp-5); }

.foot {
    display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
    margin-top: var(--sp-6); padding-top: var(--sp-4);
    border-top: 1px solid var(--line);
    color: var(--text-muted); font-size: var(--fs-xs);
}

.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ─────────── Pantallas sin sesión ─────────── */
.app--guest { display: block; }
.guest { min-height: 100vh; display: grid; place-content: center; gap: var(--sp-5); padding: var(--sp-6) var(--sp-4); }
.guest__card {
    width: min(460px, 92vw);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--sp-6);
    display: flex; flex-direction: column; gap: var(--sp-4);
}
.guest__brand { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; }
.guest__brand h1 { letter-spacing: var(--tracking-wide); }
.guest__brand p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.guest__title { font-size: var(--fs-lg); }
.guest__text { color: var(--text-soft); }
.guest__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.guest__foot { text-align: center; color: var(--text-muted); font-size: var(--fs-xs); }

/* ─────────── Adaptación a móvil ─────────── */
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav__link { flex: 1 1 auto; justify-content: center; }
    .main { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
}
