/* SOFA · Layout de la aplicación */
.app { display: grid; grid-template-columns: 1fr; min-height: 100%; }
@media (min-width: 1000px) { .app { grid-template-columns: var(--sidebar) minmax(0, 1fr); } }

.sidebar { background: var(--navy); color: var(--on-navy); position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .2s ease; z-index: 40; overflow-y: auto; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); display: flex; flex-direction: column; }
.sidebar.open { transform: none; }
@media (min-width: 1000px) { .sidebar { position: sticky; top: 0; height: 100vh; width: auto; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.brand img { width: 34px; height: 34px; border-radius: 7px; }
.brand img.logo-full { width: 100%; max-width: 210px; height: auto; border-radius: 0; }
.brand { border-bottom: 3px solid var(--red); }
.brand b { display: block; font-size: 16px; letter-spacing: .03em; }
.brand small { display: block; font-size: 11.5px; opacity: .75; }
.nav { padding: 8px 10px 20px; flex: 1; }
.nav h6 { margin: 16px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .6; }
.nav a { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; padding: 9px 10px; border-radius: var(--r); font-size: 14px; min-height: 40px; }
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a[aria-current="page"] { background: #FFFFFF; color: #1A365D; font-weight: 600; box-shadow: inset 4px 0 0 var(--red); }
.nav a .soon { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.nav a[aria-current="page"] .soon { background: #E4ECF6; }
.side-foot { padding: 12px 16px 16px; font-size: 12px; opacity: .7; border-top: 1px solid rgba(255, 255, 255, .12); }
.scrim { position: fixed; inset: 0; background: rgba(10, 20, 35, .5); z-index: 30; display: none; }
.scrim.show { display: block; }
@media (min-width: 1000px) { .scrim { display: none !important; } }

.topbar { position: sticky; top: 0; z-index: 20; min-height: var(--topbar); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.topbar .menu-btn { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font-size: 18px; }
@media (min-width: 1000px) { .topbar .menu-btn { display: none; } }
.topbar h1 { flex: 1; min-width: 0; margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-chip { font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-select { max-width: 240px; min-height: 36px; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; background: var(--surface); }
@media (max-width: 640px) { .org-chip, .org-select { display: none; } }
.user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; min-height: 40px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-btn .nm { font-size: 13px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .user-btn .nm { display: none; } .user-btn { padding: 3px; } }
.menu-pop { position: absolute; right: 16px; top: calc(var(--topbar) + env(safe-area-inset-top, 0px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 240px; padding: 6px; z-index: 50; }
.menu-pop .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-pop .who b { display: block; font-size: 14px; } .menu-pop .who span { font-size: 12.5px; color: var(--ink-2); }
.menu-pop a, .menu-pop button { display: flex; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: var(--r); cursor: pointer; font-size: 14px; color: var(--ink); text-decoration: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.banner { font-size: 13px; padding: 7px 16px; border-bottom: 1px solid var(--line); }
.banner.offline { background: var(--warn-bg); color: var(--warn); }
main.page { padding: 20px 16px 72px; max-width: 1200px; width: 100%; margin: 0 auto; min-width: 0; }
@media (min-width: 760px) { main.page { padding: 26px 28px 80px; } }
main.page:focus { outline: none; }
.page-head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .t { flex: 1; min-width: 220px; }
.page-head h2 { margin: 0; font-size: 22px; color: var(--heading); }
.page-head .t { border-left: 4px solid var(--red); padding-left: 12px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }

/* Pantallas de acceso */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 52%, var(--red) 52.1%, var(--red) 54%, var(--bg) 54.1%); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .18); padding: 28px 24px; }
.auth-card .logo { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.auth-card .logo img { width: 46px; height: 46px; border-radius: 10px; }
.auth-card .logo img.logo-full { width: 100%; max-width: 300px; height: auto; border-radius: 0; margin: 0 auto 4px; display: block; }
.auth-card .logo { justify-content: center; }
.auth-card { border-top: 4px solid var(--red); }
.auth-card .logo b { display: block; font-size: 20px; letter-spacing: .03em; }
.auth-card .logo span { font-size: 13px; color: var(--ink-2); }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card .lead { color: var(--ink-2); font-size: 14px; margin: 0 0 18px; }
.auth-foot { margin-top: 16px; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--info); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px; }
.boot { min-height: 100%; display: grid; place-items: center; color: var(--ink-2); gap: 10px; }

/* Impresión de reportes: solo el contenido */
@media print {
  .sidebar, .topbar, .scrim, .toasts, .banner, .no-print, .skip { display: none !important; }
  .app { display: block; }
  main.page { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 12px; }
  .card, .kpi, .table-wrap { border-color: #bbb; box-shadow: none; break-inside: avoid; }
  table.t th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; text-decoration: none; }
}
