/* Estructura: barra lateral (escritorio), barra inferior (móvil), pantallas de acceso. */
.app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.main { min-width: 0; flex: 1; display: flex; flex-direction: column; outline: none; }

/* ── Barra lateral ── */
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--s3); background: var(--bg-sunken); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: var(--s2) var(--s2) var(--s4); font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--text-on-accent); flex: none; }
.brand-mark .icon { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.brand-sub { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: var(--s4) var(--s3) var(--s1); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.nav-link { display: flex; align-items: center; gap: var(--s3); min-height: 38px; padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--text-2); font-weight: 550; font-size: var(--fs-md); }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-current { background: var(--surface-3); color: var(--text); }
.nav-link.is-current .icon { color: var(--accent); }
.nav-link .nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--text-on-accent); }
.nav-link .nav-count.is-danger { background: var(--danger); color: #fff; }
.nav-link .nav-text { flex: 1; min-width: 0; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--border); }
.system-pill { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-sm); font-size: var(--fs-xs); color: var(--text-2); }
.system-pill:hover { background: var(--surface-2); text-decoration: none; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: var(--s2); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.user-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: var(--fs-xs); color: var(--text-3); }

/* ── Barra superior móvil ── */
.topbar { display: none; }
.bottomnav { display: none; }

/* Aviso de modo prueba */
.banner { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s8); font-size: var(--fs-sm); background: var(--warning-soft); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); }
.banner .icon { color: var(--warning); }
.banner a { font-weight: 600; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; gap: var(--s3); height: var(--topbar-h); padding: 0 var(--s4); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
  .topbar .brand { padding: 0; font-size: var(--fs-md); }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg-sunken) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
  .bottomnav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: var(--r-sm); color: var(--text-3); font-size: 11px; font-weight: 600; }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav a.is-current { color: var(--accent-text); }
  .bottomnav .nav-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full); font-size: 10px; display: grid; place-items: center; background: var(--accent); color: var(--text-on-accent); }
  .banner { padding: 10px var(--s4); }
}

/* ── Pantallas de acceso ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s6) var(--s4);
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: var(--s5); padding: var(--s8); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.auth-card .brand { padding: 0; }
.auth-title { font-size: var(--fs-xl); }
.auth-lead { color: var(--text-2); font-size: var(--fs-sm); margin-top: calc(-1 * var(--s3)); }
.auth-form { display: flex; flex-direction: column; gap: var(--s4); }
.auth-foot { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
@media (max-width: 480px) { .auth-card { padding: var(--s6) var(--s5); } }

/* ── Selector de cuenta ── */
.acct-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: var(--s2) var(--s3); margin-bottom: var(--s3);
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); text-align: left; transition: border-color 0.15s, background 0.15s; }
.acct-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.acct-btn.is-filtered { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.acct-btn > .icon { margin-left: auto; color: var(--text-3); }
.acct-badges { display: inline-flex; gap: 3px; flex: none; }
.acct-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.acct-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.acct-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn-compact { width: auto; min-height: 34px; margin: 0; padding: 0 var(--s2); gap: 6px; }
.acct-all { display: inline-grid; place-items: center; width: 28px; height: 20px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); }
