* { box-sizing: border-box; }
body { margin: 0; font-family: Segoe UI, Arial, sans-serif; background: #f2f4f7; color: #1d2733; }
.caja { max-width: 420px; margin: 8vh auto; background: #fff; padding: 28px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
h1 { margin: 0 0 20px; font-size: 1.4rem; }
label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: .9rem; }
input { width: 100%; padding: 9px 10px; border: 1px solid #c3cbd5; border-radius: 5px; font-size: 1rem; }
button { margin-top: 18px; width: 100%; padding: 10px; border: 0; border-radius: 5px; background: #1f5fa8; color: #fff; font-size: 1rem; cursor: pointer; }
button.secundario { background: #6b7684; }
.aviso { background: #fdecea; color: #8a1c13; padding: 10px; border-radius: 5px; }
.nota { color: #6b7684; font-size: .85rem; }
.apps { list-style: none; padding: 0; }
.apps li { padding: 10px 0; border-bottom: 1px solid #e3e7ec; }
.apps a { color: #1f5fa8; text-decoration: none; }
.apps span { color: #6b7684; font-size: .9rem; }
.apps-cat { margin: 22px 0 4px; font-size: 1rem; color: #1b3a5c; border-bottom: 2px solid #e3e7ec; padding-bottom: 4px; }
.apps-cat:first-of-type { margin-top: 12px; }
@media (max-width: 480px) { .vista-login .caja { margin: 0; border-radius: 0; min-height: 100vh; } }

/* ============================================================
   Menú del panel (vista-menu): cabecera a lo ancho + rejilla de
   tarjetas por categoría. Todo aquí (CSP del panel = 'self' sin
   inline). Reemplaza la lista angosta anterior.
   ============================================================ */
.topbar { background: #1b3a5c; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.topbar-in { max-width: 1200px; width: 94%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 1.25rem; color: #fff; }
.topbar .usuario { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar .saludo { font-size: .92rem; }
.topbar .userid { color: #b9cde2; }
.topbar .link-perm { color: #fff; text-decoration: none; font-size: .88rem; border: 1px solid rgba(255,255,255,.4); padding: 6px 12px; border-radius: 5px; }
.topbar .link-perm:hover { background: rgba(255,255,255,.12); }
.topbar form { margin: 0; }
.topbar .btn-salir { width: auto; margin: 0; padding: 7px 14px; font-size: .88rem; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.4); }
.topbar .btn-salir:hover { background: rgba(255,255,255,.26); }

.panel-wrap { max-width: 1200px; width: 94%; margin: 24px auto 56px; }
.panel-wrap .aviso { margin: 0 0 18px; }
.cat { margin: 0 0 28px; }
.cat-tit { margin: 0 0 12px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: #1b3a5c; border-bottom: 2px solid #e3e7ec; padding-bottom: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.app-card { display: flex; align-items: flex-start; gap: 12px; background: #fff; border: 1px solid #e3e7ec; border-left: 4px solid #1f5fa8; border-radius: 8px; padding: 14px 16px; text-decoration: none; color: #1d2733; box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: transform .08s ease, box-shadow .08s ease; }
.app-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.app-card .ini { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: #1f5fa8; color: #fff; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; }
.app-card .txt { display: flex; flex-direction: column; min-width: 0; }
.app-card .txt strong { font-size: 1rem; color: #1b3a5c; }
.app-card .desc { color: #6b7684; font-size: .85rem; margin-top: 3px; line-height: 1.3; }
.vacio { color: #6b7684; }

/* Realce e insignia por categoría */
.cat-cartera     { border-left-color: #1f5fa8; } .cat-cartera     .ini { background: #1f5fa8; }
.cat-apertura    { border-left-color: #2e7d32; } .cat-apertura    .ini { background: #2e7d32; }
.cat-expedientes { border-left-color: #b26a00; } .cat-expedientes .ini { background: #b26a00; }
.cat-pld         { border-left-color: #8e24aa; } .cat-pld         .ini { background: #8e24aa; }
.cat-utilerias   { border-left-color: #546e7a; } .cat-utilerias   .ini { background: #546e7a; }
.cat-otras       { border-left-color: #6b7684; } .cat-otras       .ini { background: #6b7684; }

@media (max-width: 560px) { .topbar-in { justify-content: center; text-align: center; } .topbar .usuario { justify-content: center; } }

/* ---- Pantalla de permisos (/panel/permisos.php): tarjeta ancha + matriz ----
   Van aquí (no en un <style> en línea) porque la CSP del panel es default-src 'self'
   sin 'unsafe-inline', que bloquea los estilos embebidos. Estas reglas están acotadas
   a .ancho / clases propias, así no afectan al login ni al menú. */
main.caja.ancho { max-width: 1100px; width: 94%; margin: 24px auto; }
.ancho input[type="checkbox"] { width: auto; margin: 0; }
.ancho select { width: auto; max-width: 100%; padding: 8px 10px; border: 1px solid #c3cbd5; border-radius: 5px; font-size: .95rem; }
.ancho button { width: auto; margin-top: 0; padding: 9px 14px; }
.ancho h2 { font-size: 1.05rem; margin-top: 26px; }
.reglas { font-size: .82rem; color: #4a5a6a; }
.scroll { overflow-x: auto; max-width: 100%; max-height: 62vh; border: 1px solid #d6dde5; border-radius: 6px; }
table.matriz { border-collapse: collapse; width: 100%; font-size: 12px; }
table.matriz th, table.matriz td { border: 1px solid #d6dde5; padding: 6px 8px; text-align: center; }
table.matriz thead th { background: #1b3a5c; color: #fff; position: sticky; top: 0; white-space: nowrap; }
table.matriz td.app { text-align: left; white-space: nowrap; font-weight: 600; }
table.matriz td.app small { font-weight: 400; color: #6b7684; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 10px 0; }
.fila > div { display: flex; flex-direction: column; }
.fila label { margin: 0 0 4px; font-size: .8rem; }
.tabla-exc { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 8px; }
.tabla-exc th, .tabla-exc td { border: 1px solid #d6dde5; padding: 6px 8px; text-align: left; }
.tabla-exc form { margin: 0; }
.tabla-exc button { padding: 5px 10px; font-size: .85rem; }
.deny { color: #a11; font-weight: 600; }
.allow { color: #161; font-weight: 600; }
