/*
    Estilos compartidos por TODAS las páginas del Taller Rodríguez. Es la
    misma base de Apiarios, con los colores cambiados a tonos de madera.
    Los colores principales están como variables aquí arriba: cambiando
    uno aquí, cambia en todo el sistema.
*/

:root {
    --madera-oscura: #2b1f16;     /* fondo del menú */
    --madera-media: #3d2d20;      /* líneas y hover del menú */
    --acento: #c8782a;            /* color principal (botones, menú activo) */
    --acento-claro: #fbefe1;      /* fondos suaves del acento */
    --acento-texto: #8a4e12;      /* texto sobre fondos claros */
    --texto-menu: #e3d5c3;
    --texto-menu-suave: #b39f88;
    --verde: #16a35f;
    --rojo: #d63c3c;
    --azul: #3b5bfd;
    /* Colores de las gráficas (validados para daltonismo: azul y naranja) */
    --serie-1: #2a78d6;
    --serie-2: #eb6834;
}

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

/* ---------- Menú lateral ---------- */
.menu {
    width: 245px; background-color: var(--madera-oscura); 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 18px 20px; border-bottom: 1px solid var(--madera-media); }
.menu .logo {
    width: 36px; height: 36px; border-radius: 8px; background: var(--acento);
    display: flex; align-items: center; justify-content: center; font-size: 20px; color: white;
}
.menu .marca h1 { font-size: 15px; margin: 0; letter-spacing: 0.5px; }
.menu .marca p { font-size: 11px; margin: 0; color: var(--texto-menu-suave); }
.menu nav { flex: 1; padding-top: 6px; }
.menu nav .grupo { font-size: 10px; letter-spacing: 1.2px; color: var(--texto-menu-suave); padding: 14px 20px 4px 20px; text-transform: uppercase; }
.menu nav a { display: flex; align-items: center; gap: 12px; color: var(--texto-menu); text-decoration: none; padding: 10px 20px; font-size: 14px; }
.menu nav a:hover { background-color: var(--madera-media); }
.menu nav a.activo {
    background-color: var(--acento); color: white; font-weight: bold; border-radius: 6px;
    margin: 0 10px; padding: 10px; box-shadow: 0 0 14px rgba(200,120,42,0.45);
}
.menu nav a i.ti { font-size: 18px; width: 20px; text-align: center; }
.menu .usuario { padding: 15px 20px; border-top: 1px solid var(--madera-media); font-size: 13px; }
.menu .usuario .nombre { font-weight: bold; }
.menu .usuario .rol { color: var(--texto-menu-suave); font-size: 12px; }
.menu .usuario .enlaces { display: flex; gap: 14px; margin-top: 8px; }
.menu .usuario .enlaces a { text-decoration: none; font-size: 13px; color: var(--texto-menu); }
.menu .salir { color: #ff8a7a !important; }

/* Aviso a pantalla completa cuando no hay permiso */
.sin-permiso { text-align: center; padding: 80px 20px; color: #888; }
.sin-permiso i.ti { font-size: 48px; color: var(--acento); }
.sin-permiso h2 { color: #1f1a16; margin: 12px 0 6px 0; }

/* ---------- Contenido ---------- */
.contenido { flex: 1; padding: 25px 30px; min-width: 0; }
.encabezado { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.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; font-family: inherit; }
.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; flex-wrap: wrap; }
.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-principal { background: var(--acento); color: white; font-weight: bold; }
.btn-principal:hover { filter: brightness(1.07); }
.btn-secundario { background: #eef0f4; color: #333; }
.btn-secundario:hover { background: var(--acento-claro); }
.btn-pequeno { padding: 6px 10px; font-size: 12px; border-radius: 6px; }

/* Pestañas (ej. Madera / Herramientas / Materiales) */
.pestanas { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pestanas button { background: white; border: 1px solid #e3ddd5; padding: 9px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; font-family: inherit; color: #555; }
.pestanas button.activa { background: var(--acento); border-color: var(--acento); color: white; font-weight: bold; }
.pestanas button .cuenta { opacity: 0.75; margin-left: 4px; }

/* ---------- 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: 13px 16px; font-size: 14px; border-bottom: 1px solid #f2f2f2; vertical-align: top; }
tbody tr:hover { background: #fdf8f2; }
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: var(--verde); font-weight: bold; }
.monto-egreso { color: var(--rojo); font-weight: bold; }
.monto-pendiente { color: var(--acento-texto); font-weight: bold; }
.descripcion-celda { color: #555; max-width: 380px; }
.secundario { font-size: 12px; color: #888; margin-top: 3px; }
.acciones-fila { display: flex; gap: 12px; }
.acciones-fila span { cursor: pointer; color: #666; font-size: 17px; }
.acciones-fila span:hover { color: var(--acento); }
.sin-resultados { padding: 30px; text-align: center; color: #999; }
.registrado-por { font-size: 11px; color: #999; margin-top: 3px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; background: var(--acento-claro); color: var(--acento-texto); }
.badge-verde { background: #e4f8ec; color: #0f7a46; }
.badge-rojo { background: #fdecec; color: #b42323; }
.badge-azul { background: #eaf0fe; color: #2d48d6; }
.badge-gris, .badge-inactivo { background: #eee; color: #777; }

/* ---------- 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: 500px; max-width: 100%; max-height: 92vh; 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; min-width: 0; }
.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; }
.campo input:disabled { background: #f5f5f5; }
.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; flex-wrap: wrap; }
.btn-cancelar { background: #eef0f4; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.btn-guardar { background: var(--verde); color: white; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.btn-guardar:disabled { opacity: 0.6; cursor: default; }
.mensaje-error { color: var(--rojo); background: #fdecec; border-radius: 6px; font-size: 13px; padding: 8px 12px; margin-bottom: 12px; display: none; }
.resumen-calculo { background: var(--acento-claro); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 15px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.aviso {
    background: var(--acento-claro); color: #6b3c0c; border-radius: 8px; padding: 12px 16px;
    font-size: 14px; margin-bottom: 18px; display: none;
}
.aviso a { color: #6b3c0c; font-weight: bold; }

/* ---------- Tarjetas ---------- */
.tarjetas-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 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: 21px; }
.tarjeta-resumen .detalle { font-size: 12px; color: #999; margin-top: 2px; }
.icono-ingreso { background: #e4f8ec; color: var(--verde); }
.icono-egreso { background: #fdecec; color: var(--rojo); }
.icono-balance { background: var(--acento-claro); color: var(--acento-texto); }
.icono-azul { background: #eaf0fe; color: var(--azul); }

.tarjeta { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; min-width: 0; }
.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; background: var(--acento); }
.barra-porcentaje span { font-size: 12px; color: #888; width: 42px; text-align: right; }

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

/* 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; min-width: 0; padding: 9px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; font-family: inherit; }
.agregar-linea button { padding: 9px 14px; }

/* Tabla de permisos (pantalla de Usuarios) */
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; }
.permisos-resumen { font-size: 12px; color: #666; white-space: normal; }
.plantillas-permisos { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- Buscador de clientes (Ventas) ---------- */
.selector-cliente { position: relative; }
.selector-cliente .caja-busqueda { position: relative; }
.selector-cliente .caja-busqueda i.ti { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #999; }
.selector-cliente .caja-busqueda input { padding-left: 34px; }
.lista-clientes {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
    background: white; border: 1px solid #e3ddd5; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 260px; overflow-y: auto;
}
.lista-clientes.abierta { display: block; }
.opcion-cliente { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; border-bottom: 1px solid #f5f2ee; }
.opcion-cliente:last-child { border-bottom: none; }
.opcion-cliente:hover, .opcion-cliente.marcada { background: var(--acento-claro); }
.opcion-cliente .secundario { margin: 0; }
.opcion-cliente mark { background: #ffe6b8; color: inherit; border-radius: 2px; padding: 0 1px; }
.opcion-nuevo { color: var(--acento-texto); font-weight: bold; justify-content: flex-start; }
.lista-clientes .vacia { padding: 12px; color: #999; font-size: 13px; text-align: center; }
.cliente-elegido {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e3ddd5;
    border-radius: 6px; background: #fffcf8; min-height: 40px;
}
.cliente-elegido .icono-cliente { width: 30px; height: 30px; border-radius: 50%; background: var(--acento); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 13px; flex-shrink: 0; }
.cliente-elegido .datos { flex: 1; min-width: 0; line-height: 1.3; }
.cliente-elegido .datos strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cliente-elegido button { background: none; border: none; color: var(--acento-texto); cursor: pointer; font-size: 13px; font-family: inherit; white-space: nowrap; }

/* Horario de una actividad: [08:00 AM] a [01:00 PM] */
.horario { display: flex; align-items: center; gap: 6px; }
.horario input { flex: 1; min-width: 0; }
.horario span { color: #888; font-size: 13px; }

/* ---------- Fotos de las actividades ---------- */
.miniaturas { display: flex; gap: 6px; flex-wrap: wrap; }
.miniaturas img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; cursor: zoom-in; border: 1px solid #eee; background: #f3f3f3; }
.miniaturas .mas { width: 48px; height: 48px; border-radius: 6px; background: var(--acento-claro); color: var(--acento-texto); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; cursor: pointer; }

.zona-fotos { border: 2px dashed #e0d4c4; border-radius: 10px; padding: 16px; text-align: center; color: #8a7a68; cursor: pointer; background: #fffcf8; font-size: 14px; }
.zona-fotos.encima { border-color: var(--acento); background: var(--acento-claro); }
.zona-fotos i.ti { font-size: 28px; display: block; margin-bottom: 4px; color: var(--acento); }
.rejilla-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 10px; }
.foto-previa { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #f3f3f3; }
.foto-previa img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.foto-previa .quitar { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.65); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.foto-previa .etiqueta-nueva { position: absolute; left: 4px; bottom: 4px; background: var(--acento); color: white; font-size: 10px; padding: 1px 6px; border-radius: 8px; }

/* Visor de fotos a pantalla completa */
.visor { display: none; position: fixed; inset: 0; background: rgba(10,8,6,0.94); z-index: 200; align-items: center; justify-content: center; flex-direction: column; }
.visor.abierto { display: flex; }
.visor img { max-width: 94vw; max-height: 82vh; border-radius: 6px; box-shadow: 0 6px 30px rgba(0,0,0,0.5); }
.visor .pie-visor { color: #ddd; margin-top: 12px; font-size: 14px; text-align: center; padding: 0 20px; }
.visor button { position: absolute; background: rgba(255,255,255,0.12); border: none; color: white; font-size: 26px; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; }
.visor button:hover { background: rgba(255,255,255,0.25); }
.visor .cerrar { top: 18px; right: 18px; }
.visor .anterior { left: 18px; top: 50%; transform: translateY(-50%); }
.visor .siguiente { right: 18px; top: 50%; transform: translateY(-50%); }

/* ---------- Gráficas (Reportes) ---------- */
.grafica { position: relative; width: 100%; }
.grafica svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafica .eje { font-size: 11px; fill: #888; }
.grafica .linea-guia { stroke: #eee; stroke-width: 1; }
.grafica .linea-base { stroke: #ccc; stroke-width: 1; }
.grafica rect.barra { transition: opacity 0.15s; }
.grafica .zona-hover { fill: transparent; cursor: pointer; }
.grafica .zona-hover:hover { fill: rgba(0,0,0,0.035); }
.leyenda { display: flex; gap: 16px; font-size: 13px; color: #555; margin-bottom: 10px; flex-wrap: wrap; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tooltip { position: absolute; pointer-events: none; background: #1f1a16; color: white; border-radius: 8px; padding: 9px 12px; font-size: 12px; line-height: 1.6; white-space: nowrap; display: none; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
.tooltip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* Lista de alertas (Reportes: poco material, herramientas dañadas...) */
.lista-alertas { display: flex; flex-direction: column; gap: 8px; }
.alerta { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: #fafafa; }
.alerta i.ti { font-size: 18px; }
.alerta .derecha { margin-left: auto; font-weight: bold; white-space: nowrap; }
.alerta-roja { background: #fdf0f0; }
.alerta-roja i.ti { color: var(--rojo); }
.alerta-naranja { background: var(--acento-claro); }
.alerta-naranja i.ti { color: var(--acento-texto); }

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

/* ---------- Impresión (Reportes -> Imprimir / PDF) ---------- */
.solo-impresion { display: none; }
@media print {
    body { background: white; }
    .menu, .no-imprimir, .barra-superior, .presets { display: none !important; }
    .solo-impresion { display: block; }
    .contenido { padding: 0; }
    .tarjeta, .tarjeta-resumen { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .rejilla-2, .rejilla-3 { display: block; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- 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 .grupo { display: none; }
    .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; }
    .modal { padding: 20px 18px; }
}
