/*
    Estilos compartidos por TODAS las páginas. En Sky Networks cada página
    tenía su propio <style> con casi lo mismo; aquí está una sola vez, así
    que un cambio de color o tamaño se hace en un solo lugar.
*/

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f6f8;
    color: #1a1a2e;
}
.contenedor { display: flex; min-height: 100vh; }

/* ---------- Menú lateral ---------- */
.menu {
    width: 240px; background-color: #1f1a10; color: white;
    display: flex; flex-direction: column; padding: 20px 0; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.menu .marca { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px 20px; border-bottom: 1px solid #3a3122; }
.menu .logo {
    width: 34px; height: 34px; border-radius: 8px; background: #f2a516;
    display: flex; align-items: center; justify-content: center; font-size: 20px; color: #1f1a10;
}
.menu .marca h1 { font-size: 16px; margin: 0; }
.menu .marca p { font-size: 11px; margin: 0; color: #b3a68c; }
.menu nav { flex: 1; padding-top: 10px; }
.menu nav a { display: flex; align-items: center; gap: 12px; color: #d9cfbb; text-decoration: none; padding: 12px 20px; font-size: 14px; }
.menu nav a:hover { background-color: #2c2516; }
.menu nav a.activo {
    background-color: #f2a516; color: #1f1a10; font-weight: bold; border-radius: 6px;
    margin: 0 10px; width: calc(100% - 20px); box-shadow: 0 0 14px rgba(242,165,22,0.45);
}
.menu nav a i.ti { font-size: 18px; width: 20px; text-align: center; }
.menu .usuario { padding: 15px 20px; border-top: 1px solid #3a3122; font-size: 13px; }
.menu .usuario .nombre { font-weight: bold; }
.menu .usuario .rol { color: #b3a68c; font-size: 12px; }
.menu .salir { color: #ff8a7a; text-decoration: none; font-size: 13px; display: inline-block; margin-top: 8px; }

/* Aviso a pantalla completa cuando el usuario no tiene permiso de ver una sección */
.sin-permiso { text-align: center; padding: 80px 20px; color: #888; }
.sin-permiso i.ti { font-size: 48px; color: #f2a516; }
.sin-permiso h2 { color: #1a1a2e; margin: 12px 0 6px 0; }

/* Tabla de permisos (pantalla de Usuarios) */
table.tabla-permisos { margin-bottom: 6px; }
table.tabla-permisos th { padding: 8px; font-size: 12px; text-align: center; }
table.tabla-permisos th:first-child { text-align: left; }
table.tabla-permisos td { padding: 9px 8px; font-size: 13px; text-align: center; border-bottom: 1px solid #f2f2f2; }
table.tabla-permisos td:first-child { text-align: left; font-weight: bold; }
table.tabla-permisos input { width: auto; cursor: pointer; transform: scale(1.15); }
table.tabla-permisos .no-aplica { color: #ccc; }
.badge-admin { background: #e4f8ec; color: #16a35f; }
.badge-operador { background: #eaf0fe; color: #3b5bfd; }
.permisos-resumen { font-size: 12px; color: #666; white-space: normal; }

/* ---------- Contenido ---------- */
.contenido { flex: 1; padding: 25px 30px; min-width: 0; }
.encabezado { margin-bottom: 20px; }
.encabezado h2 { margin: 0; font-size: 22px; }
.encabezado p { margin: 2px 0 0 0; color: #888; font-size: 13px; }

.barra-superior { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.buscador { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; background: white; border: 1px solid #ddd; border-radius: 8px; padding: 10px 14px; }
.buscador input { border: none; outline: none; flex: 1; font-size: 14px; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filtros select, .filtros input { padding: 10px 14px; border-radius: 8px; border: 1px solid #ddd; background: white; font-size: 14px; font-family: inherit; }
.filtros input[type="number"] { width: 95px; }
.lado-derecho { display: flex; align-items: center; gap: 16px; }
.total-lista { font-size: 14px; }

.btn-nuevo { color: white; border: none; padding: 12px 18px; border-radius: 8px; font-size: 14px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.btn-ingreso { background: #16a35f; }
.btn-egreso { background: #d63c3c; }
.btn-principal { background: #f2a516; color: #1f1a10; font-weight: bold; }

/* ---------- Tablas ---------- */
.tabla-contenedor { background: white; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 13px; color: #666; padding: 14px 16px; border-bottom: 1px solid #eee; white-space: nowrap; }
tbody td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #f2f2f2; }
tbody tr:hover { background: #fffbf2; }
tfoot td { padding: 14px 16px; font-size: 14px; font-weight: bold; border-top: 2px solid #eee; }
.numero { text-align: right; white-space: nowrap; }
.monto-ingreso { color: #16a35f; font-weight: bold; }
.monto-egreso { color: #d63c3c; font-weight: bold; }
.descripcion-celda { color: #555; max-width: 380px; }
.acciones-fila { display: flex; gap: 12px; }
.acciones-fila span { cursor: pointer; color: #666; }
.acciones-fila span:hover { color: #f2a516; }
.sin-resultados { padding: 30px; text-align: center; color: #999; }

.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; background: #fdf3df; color: #a86d00; }
.badge-inactivo { background: #eee; color: #888; }

/* ---------- Modales ---------- */
.fondo-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.fondo-modal.abierto { display: flex; }
.modal { background: white; border-radius: 10px; padding: 25px 30px; width: 480px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-encabezado { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.modal-encabezado h3 { margin: 0; }
.cerrar-x { cursor: pointer; font-size: 18px; color: #888; border: none; background: none; }
.fila-doble { display: flex; gap: 15px; }
.campo { flex: 1; margin-bottom: 15px; }
.campo label { display: block; font-size: 13px; margin-bottom: 6px; font-weight: bold; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; font-family: inherit; }
.ayuda { font-size: 12px; color: #888; margin-top: 5px; }
.separador { border: none; border-top: 1px solid #eee; margin: 15px 0; }
.botones-modal { display: flex; justify-content: flex-end; gap: 10px; }
.btn-cancelar { background: #eef0f4; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.btn-guardar { background: #16a35f; color: white; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.mensaje-error { color: #d63c3c; background: #fdecec; border-radius: 6px; font-size: 13px; padding: 8px 12px; margin-bottom: 12px; display: none; }

.aviso {
    background: #fdf3df; color: #7a5200; border-radius: 8px; padding: 12px 16px;
    font-size: 14px; margin-bottom: 18px; display: none;
}
.aviso a { color: #7a5200; font-weight: bold; }

/* ---------- Tarjetas (Reportes y Configuración) ---------- */
.tarjetas-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tarjeta-resumen { background: white; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); display: flex; gap: 14px; align-items: center; }
.tarjeta-resumen .icono { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.tarjeta-resumen p { margin: 0; font-size: 13px; color: #888; }
.tarjeta-resumen h3 { margin: 4px 0 0 0; font-size: 22px; }
.icono-ingreso { background: #e4f8ec; color: #16a35f; }
.icono-egreso { background: #fdecec; color: #d63c3c; }
.icono-balance { background: #fdf3df; color: #a86d00; }

.tarjeta { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }
.tarjeta h3 { margin: 0 0 4px 0; font-size: 16px; }
.tarjeta .subtitulo { margin: 0 0 14px 0; font-size: 13px; color: #888; }
.tarjeta .tabla-contenedor { box-shadow: none; border: 1px solid #f0f0f0; }
.rejilla-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
.rejilla-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* Barrita horizontal para mostrar el % de cada tipo */
.barra-porcentaje { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.fondo-barra { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.relleno-barra { height: 100%; border-radius: 4px; }
.barra-porcentaje span { font-size: 12px; color: #888; width: 42px; text-align: right; }

.presets { display: flex; gap: 6px; }
.presets button { background: #eef0f4; border: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; }
.presets button:hover { background: #fdf3df; }

/* Formulario de una sola línea para agregar en Configuración */
.agregar-linea { display: flex; gap: 8px; margin-bottom: 12px; }
.agregar-linea input { flex: 1; padding: 9px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; font-family: inherit; }
.agregar-linea button { padding: 9px 14px; }

/* ---------- Dividir en partes y compartir (formulario del admin) ---------- */
.seccion-form { border: 1px solid #f0e6d2; background: #fffcf5; border-radius: 8px; padding: 12px 14px; margin-bottom: 15px; }
.check-linea { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 6px; cursor: pointer; }
.check-linea input { width: auto !important; margin: 0; cursor: pointer; }
.tabla-partes { width: 100%; border-collapse: collapse; }
.tabla-partes td { padding: 5px 0; font-size: 14px; }
.tabla-partes input[type="text"] { width: 100%; padding: 7px 9px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; text-align: right; font-family: inherit; }
.tabla-partes input[type="text"]:disabled { background: #f3f3f3; }
.pie-partes { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; font-size: 13px; }
.pie-partes .btn-cancelar { padding: 8px 12px; font-size: 13px; }
.lista-compartir { padding-left: 24px; transition: opacity 0.15s; }

/* ---------- Indicadores en la tabla ---------- */
.badge-dividido { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #eaf0fe; color: #3b5bfd; cursor: help; }
.tu-parte { font-size: 12px; color: #a86d00; font-weight: bold; margin-top: 3px; }
.registrado-por { font-size: 11px; color: #999; margin-top: 3px; }
.icono-visibilidad { color: #3b5bfd; margin-left: 4px; cursor: help; }
.personas-trabajo { line-height: 2; min-width: 160px; } /* los nombres de quienes fueron, uno tras otro */

/* ---------- Saldos entre hermanos (Reportes) ---------- */
.fila-deuda { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid #f2f2f2; font-size: 14px; flex-wrap: wrap; }
.fila-deuda:last-child { border-bottom: none; }
.fila-deuda .flecha { color: #a86d00; }
.fila-deuda .monto-deuda { margin-left: auto; font-weight: bold; color: #a86d00; }

i.ti { vertical-align: -2px; }

/* ---------- Celular: el menú pasa arriba ---------- */
@media (max-width: 800px) {
    .contenedor { flex-direction: column; }
    .menu { width: 100%; height: auto; position: static; padding: 12px 0; }
    .menu nav { display: flex; flex-wrap: wrap; padding: 8px 10px 0 10px; }
    .menu nav a, .menu nav a.activo { width: auto; margin: 2px; padding: 9px 12px; border-radius: 6px; }
    .contenido { padding: 18px 14px; }
    .fila-doble { flex-direction: column; gap: 0; }
    .rejilla-2, .rejilla-3 { grid-template-columns: 1fr; }
}
