*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Mismo ancho que .menu-grid: única fuente de verdad para que la barra superior
   quede alineada con el borde izquierdo/derecho de las tarjetas del menú */
:root { --content-width: 740px; }

body {
    min-height: 100vh;
    background: linear-gradient(160deg, #f4f4f5 0%, #d4d4d8 55%, #a1a1aa 100%);
    font-family: 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

/* El fondo de color va de borde a borde de la ventana (::before), pero el contenido
   (logo, cerrar sesión) se centra al mismo ancho que .menu-grid para que ambos
   queden alineados en el mismo borde izquierdo/derecho. */
.topbar {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 14px 32px;
}
.topbar::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: #3f3f46;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: -1;
}


.brand-logo { height: 80px; width: auto; display: block; }

.topbar-left { display: flex; align-items: center; gap: 10px; }
.btn-back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.25); color: #f1f1f1;
    background: rgba(255,255,255,0.1); transition: background .2s;
}
.btn-back:hover { background: rgba(255,255,255,0.2); }
.btn-back svg { width: 18px; height: 18px; }

/* ── Menú de cambio rápido de panel (reemplaza la antigua flecha "volver") ── */
.panel-switch { position: relative; }
.panel-switch-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,.25);
    min-width: 170px;
    padding: 6px;
    z-index: 300;
    flex-direction: column;
    gap: 2px;
}
.panel-switch-menu.open { display: flex; }
.panel-switch-item {
    display: block;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: background .15s;
}
.panel-switch-item:hover { background: #fff7ed; color: #c2410c; }
.panel-switch-item.active { background: #fff7ed; color: #f97316; }

/* margin-left:auto además de justify-content:space-between: si el header no entra en
   una sola línea (celulares angostos) y topbar-right pasa a su propia fila, esto lo
   sigue empujando al borde derecho en vez de quedar pegado a la izquierda */
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.topbar-right span { color: #d4d4d8; font-size: 0.9rem; overflow-wrap: anywhere; }

.btn-logout, .btn-nav {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    background: rgba(255,255,255,0.1);
    transition: background .2s;
}
.btn-logout:hover, .btn-nav:hover { background: rgba(255,255,255,0.2); }

.main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 16px;
}

h1 {
    color: #27272a;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}
h1 span { color: #f97316; }

p.sub {
    color: #71717a;
    font-size: 0.95rem;
    margin-bottom: 48px;
}

.menu-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.menu-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 32px 48px;
    text-align: center;
    text-decoration: none;
    color: #3f3f46;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.menu-card:hover {
    border-color: #f97316;
    box-shadow: 0 10px 24px rgba(249,115,22,0.18);
    transform: translateY(-3px);
}

@media (max-width: 640px) {
    .topbar { padding: 12px 16px; max-width: 100%; }
    .main { padding: 40px 16px; }
    h1 { font-size: 1.5rem; }
    .menu-grid { flex-direction: column; width: 100%; max-width: 100%; }
    .menu-card { width: 100%; padding: 22px 24px; box-sizing: border-box; }
}
