/* WEBCOMUNICA SOLUTIONS - Estilos */

:root {
    --principal: #4a8ac7;
    --principal-oscuro: #3a7ab7;
    --secundario: #6b7280;
    --exito: #059669;
    --aviso: #d97706;
    --peligro: #dc2626;
    --oscuro: #1f2937;
    --menu-fondo: #4a8ac7;
    --claro: #f9fafb;
    --borde: #e5e7eb;
    --sombra: 0 1px 2px rgba(0,0,0,0.05);
    --menu-ancho: 240px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    /* DISEÑO ORIGINAL - Descomentar para volver */
    /* background: #f3f4f6; */
    /* color: var(--oscuro); */

    /* DISEÑO VIBRANTE - Comentar para volver al original */
    background: linear-gradient(135deg, #E8F0FE 0%, #F0F4FF 50%, #E8F0FE 100%);
    color: #1f2937;
    line-height: 1.6;
    font-size: 18px;
}

a {
    color: var(--principal);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Estructura */
.contenedor-app {
    display: flex;
    min-height: 100vh;
}

/* Menu lateral */
.menu-lateral {
    width: var(--menu-ancho);
    background: white;
    color: #1f2937;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
}

.menu-cabecera {
    padding: 20px;
    background: white;
    border-bottom: 3px solid var(--empresa-color, #0028A1);
    margin-bottom: 0;
}

.menu-logo {
    text-align: center;
}

.menu-logo img {
    max-width: 100%;
    height: auto;
    display: block;
}

.menu-nav {
    list-style: none;
}

.menu-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #4b5563;
    transition: all 0.15s;
    font-size: 15px;
}

.menu-nav a:hover {
    background: #f9fafb;
    color: var(--empresa-color, #0028A1);
    text-decoration: none;
}

.menu-nav a.activo {
    background: #f3f4f6;
    color: var(--empresa-color, #0028A1);
    border-left: 3px solid var(--empresa-color, #0028A1);
    font-weight: 600;
}

.menu-nav svg {
    width: 18px;
    height: 18px;
}

.menu-pie {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.info-usuario {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-usuario {
    width: 32px;
    height: 32px;
    background: var(--empresa-color, #0028A1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    border-radius: 50%;
}

.datos-usuario {
    flex: 1;
}

.nombre-usuario {
    font-weight: 500;
    font-size: 13px;
    color: #1f2937;
}

.rol-usuario {
    font-size: 11px;
    color: #6b7280;
}

/* Contenido principal */
.contenido-principal {
    flex: 1;
    margin-left: var(--menu-ancho);
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.contenido-wrapper {
    flex: 1;
    padding: 24px;
}

/* Cabecera de pagina */
.cabecera-pagina {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.titulo-pagina {
    font-size: 24px;
    font-weight: 600;
}

.subtitulo-pagina {
    color: var(--secundario);
    font-size: 15px;
    margin-top: 4px;
}

/* Botones */
.boton {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--borde);
    background: white;
    color: var(--oscuro);
    transition: all 0.15s;
}

.boton:hover {
    background: var(--claro);
    text-decoration: none;
}

.boton-principal {
    background: var(--principal);
    border-color: var(--principal);
    color: white;
}

.boton-principal:hover {
    background: var(--principal-oscuro);
    color: white;
}

.boton-peligro {
    background: var(--peligro);
    border-color: var(--peligro);
    color: white;
}

.boton-peligro:hover {
    background: #b91c1c;
}

.boton-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Tarjetas */
.tarjeta {
    background: white;
    border: none;
    /* DISEÑO ORIGINAL */
    /* box-shadow: var(--sombra); */

    /* DISEÑO VIBRANTE - Sombras más elegantes */
    box-shadow: 0 4px 20px rgba(0, 40, 161, 0.08), 0 2px 8px rgba(0, 40, 161, 0.04);
    overflow: hidden;
    max-width: 100%;
    border-radius: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tarjeta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 40, 161, 0.12), 0 4px 12px rgba(0, 40, 161, 0.08);
}

.tarjeta-cabecera {
    padding: 14px 18px;
    border-bottom: 1px solid var(--borde);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tarjeta-titulo {
    font-size: 17px;
    font-weight: 600;
}

.tarjeta-cuerpo {
    padding: 20px;
}

/* Grid clientes */
.grid-clientes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tarjeta-cliente {
    background: white;
    border: 1px solid var(--borde);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.tarjeta-cliente:hover {
    border-color: var(--principal);
}

.cliente-cabecera {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.cliente-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.cliente-nombre {
    font-size: 14px;
    font-weight: 600;
}

.cliente-empresa {
    font-size: 12px;
    color: var(--secundario);
}

.cliente-info {
    font-size: 12px;
    color: var(--secundario);
}

.etiqueta-estado {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.estado-activo {
    background: #d1fae5;
    color: #065f46;
}

.estado-inactivo {
    background: #fee2e2;
    color: #991b1b;
}

/* Formularios */
.grupo-campo {
    margin-bottom: 16px;
}

.etiqueta-campo {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 15px;
}

.campo {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--borde);
    font-size: 16px;
    background: white;
}

.campo:focus {
    outline: none;
    border-color: var(--principal);
}

textarea.campo {
    min-height: 80px;
    resize: vertical;
}

.fila-campos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.fila-campos-3 {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 16px;
}

.fila-campos-3-igual {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Tablas */
.contenedor-tabla {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--borde);
    font-size: 15px;
}

th {
    background: var(--claro);
    font-weight: 600;
    font-size: 13px;
    color: var(--secundario);
    text-transform: uppercase;
}

tr:hover {
    background: var(--claro);
}

/* Pestanas */
.pestanas {
    display: flex;
    border-bottom: 1px solid var(--borde);
    margin-bottom: 16px;
}

.pestana {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--secundario);
    font-weight: 500;
    font-size: 13px;
}

.pestana:hover {
    color: var(--oscuro);
}

.pestana.activa {
    color: var(--principal);
    border-bottom-color: var(--principal);
}

/* Pestanas movil - oculto por defecto en desktop */
.pestanas-movil {
    display: none;
}

/* Grid estadisticas 4 columnas */
.grid-estadisticas-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.estadistica-item {
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    border-radius: 0;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.estadistica-item:hover {
    border-color: rgba(250, 229, 0, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 40, 161, 0.1);
}

.estadistica-valor {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--empresa-color, #0028A1) 0%, #0052CC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.estadistica-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Avisos lista movil - oculto en desktop */
.tiquets-lista-movil {
    display: none;
}

.tiquet-tarjeta-movil {
    display: block;
    background: white;
    border: 1px solid var(--borde);
    padding: 14px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
}

.tiquet-tarjeta-movil:hover {
    border-color: var(--principal);
    text-decoration: none;
}

.tiquet-movil-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tiquet-movil-id {
    font-size: 12px;
    color: var(--secundario);
}

.tiquet-movil-titulo {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
    color: var(--oscuro);
}

.tiquet-movil-detalles {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--secundario);
    margin-bottom: 6px;
}

.tiquet-movil-importe {
    font-weight: 600;
    color: var(--exito);
}

.tiquet-movil-fecha {
    font-size: 12px;
    color: var(--secundario);
}

.tiquet-total-movil {
    display: flex;
    justify-content: space-between;
    background: var(--claro);
    padding: 14px;
    font-weight: 600;
    border: 1px solid var(--borde);
}

/* Clientes lista movil - oculto en desktop */
.clientes-lista-movil {
    display: none;
}

.cliente-tarjeta-movil {
    background: white;
    border: 1px solid var(--borde);
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
}

.cliente-tarjeta-movil:hover {
    border-color: var(--principal);
}

.cliente-movil-cabecera {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.cliente-movil-info {
    flex: 1;
    min-width: 0;
}

.cliente-movil-nombre {
    font-weight: 600;
    font-size: 15px;
    color: var(--oscuro);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cliente-movil-comercial {
    font-size: 12px;
    color: var(--secundario);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cliente-movil-detalles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--secundario);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--borde);
}

.cliente-movil-acciones {
    display: flex;
    gap: 8px;
}

.cliente-movil-acciones .boton {
    flex: 1;
    justify-content: center;
}

/* Historial fichajes movil - oculto en desktop */
.historial-lista-movil {
    display: none;
}

.fichaje-tarjeta-movil {
    background: white;
    border: 1px solid var(--borde);
    border-top: none;
    padding: 14px;
}

.fichaje-tarjeta-movil:last-child {
    border-bottom: 1px solid var(--borde);
}

.fichaje-movil-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.fichaje-movil-fecha {
    font-weight: 600;
    font-size: 14px;
    color: var(--oscuro);
    display: flex;
    align-items: center;
    gap: 8px;
}

.fichaje-movil-tiempo {
    font-size: 18px;
    font-weight: 700;
    color: var(--principal);
}

.fichaje-movil-detalles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.fichaje-movil-item {
    text-align: center;
    padding: 8px 4px;
    background: var(--claro);
    border-radius: 4px;
}

.fichaje-movil-label {
    display: block;
    font-size: 10px;
    color: var(--secundario);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.fichaje-movil-valor {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--oscuro);
}

/* Credenciales */
.tarjeta-credencial {
    background: var(--claro);
    border: 1px solid var(--borde);
    padding: 14px;
    margin-bottom: 10px;
}

.credencial-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.credencial-titulo {
    font-weight: 600;
    font-size: 14px;
}

.credencial-categoria {
    font-size: 10px;
    background: var(--principal);
    color: white;
    padding: 2px 6px;
    text-transform: uppercase;
}

.credencial-campo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.credencial-campo label {
    color: var(--secundario);
    min-width: 60px;
    font-size: 12px;
}

.credencial-campo .valor {
    flex: 1;
    font-family: monospace;
    background: white;
    padding: 4px 8px;
    border: 1px solid var(--borde);
    font-size: 12px;
}

/* Notas */
.grid-notas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.tarjeta-nota {
    background: white;
    border: 1px solid var(--borde);
    padding: 14px;
}

.tarjeta-nota.fijada {
    border-left: 3px solid var(--aviso);
}

.nota-titulo {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.nota-contenido {
    font-size: 13px;
    color: var(--secundario);
    line-height: 1.4;
}

.nota-pie {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--borde);
    font-size: 11px;
    color: var(--secundario);
}

/* Login */
.contenedor-login {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #012D9A 0%, #30309D 50%, #1a1a6b 100%);
}

.caja-login {
    background: white;
    padding: 50px 45px;
    width: 100%;
    max-width: 480px;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    border-radius: 16px;
}

.caja-login .grupo-campo {
    margin-bottom: 24px;
}

.caja-login .etiqueta-campo {
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.caja-login .campo {
    width: 100%;
    padding: 16px 18px;
    font-size: 17px;
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.caja-login .campo:focus {
    border-color: #30309D;
    box-shadow: 0 0 0 4px rgba(48,48,157,0.15);
    outline: none;
}

.caja-login .boton-principal {
    padding: 18px 24px;
    font-size: 18px;
    font-weight: 700;
    margin-top: 10px;
    background: #FFCD0D;
    border: none;
    color: #000000;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(255,205,13,0.3);
    border-radius: 8px;
}

.caja-login .boton-principal:hover {
    background: #e6b800;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,205,13,0.4);
}

.caja-login .alerta-peligro {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 15px;
}

.caja-login .texto-secundario {
    color: #6b7280;
}

.login-logo {
    text-align: center;
    background: #FFFFFF;
    padding: 35px 30px 25px 30px;
    margin: -50px -45px 20px -45px;
    border-radius: 16px 16px 0 0;
}

.login-logo img {
    max-width: 350px;
    width: 100%;
    height: auto;
}

/* Footer del login */
.login-footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    width: 100%;
    max-width: 480px;
}

.login-footer-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
}

.login-footer-link {
    color: #FFCD0D;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.login-footer-link:hover {
    color: #ffffff;
}

/* Modal */
.fondo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.fondo-modal.activo {
    display: flex;
}

.modal {
    background: white;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--borde);
}

.modal-cabecera {
    padding: 16px 18px;
    border-bottom: 1px solid var(--borde);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-titulo {
    font-size: 16px;
    font-weight: 600;
}

.modal-cerrar {
    cursor: pointer;
    font-size: 20px;
    color: var(--secundario);
    line-height: 1;
}

.modal-cuerpo {
    padding: 18px;
}

.modal-pie {
    padding: 14px 18px;
    border-top: 1px solid var(--borde);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Alertas */
.alerta {
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 15px;
    border: 1px solid;
}

.alerta-exito {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.alerta-peligro {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.alerta-aviso {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

/* Buscador */
.caja-busqueda {
    position: relative;
}

.caja-busqueda input {
    padding-left: 36px;
}

.caja-busqueda svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secundario);
}

/* Estado vacio */
.estado-vacio {
    text-align: center;
    padding: 48px 16px;
    color: var(--secundario);
}

.estado-vacio svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.estado-vacio h3 {
    font-size: 16px;
    color: var(--oscuro);
    margin-bottom: 6px;
}

/* Avisos */
.prioridad-urgente { background: #fef2f2; border-left: 3px solid #dc2626; }
.prioridad-alta { background: #fff7ed; border-left: 3px solid #ea580c; }
.prioridad-media { background: #fefce8; border-left: 3px solid #ca8a04; }
.prioridad-baja { background: #f0fdf4; border-left: 3px solid #16a34a; }

.etiqueta-prioridad {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.etiqueta-prioridad-muy_urgente { background: #991b1b; color: white; font-weight: 700; }
.etiqueta-prioridad-urgente { background: #dc2626; color: white; }
.etiqueta-prioridad-alta { background: #ea580c; color: white; }
.etiqueta-prioridad-media { background: #ca8a04; color: white; }
.etiqueta-prioridad-baja { background: #16a34a; color: white; }

.etiqueta-ticket {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.ticket-abierto { background: #dbeafe; color: #1e40af; }
.ticket-revision { background: #fef3c7; color: #92400e; }
.ticket-progreso { background: #e0e7ff; color: #4338ca; }
.ticket-completado { background: #d1fae5; color: #065f46; }
.ticket-facturado { background: #f0fdf4; color: #166534; border: 1px solid #16a34a; }
.ticket-cancelado { background: #fee2e2; color: #991b1b; }

/* Filtros */
.filtros-rapidos {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filtro-boton {
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--borde);
    font-size: 14px;
    cursor: pointer;
    color: var(--oscuro);
    text-decoration: none;
}

.filtro-boton:hover {
    background: var(--claro);
    text-decoration: none;
}

.filtro-boton.activo {
    background: var(--principal);
    color: white;
    border-color: var(--principal);
}

.filtro-contador {
    background: rgba(0,0,0,0.1);
    padding: 1px 6px;
    margin-left: 4px;
    font-size: 10px;
}

.filtro-boton.activo .filtro-contador {
    background: rgba(255,255,255,0.2);
}

/* Banner bienvenida */
.banner-bienvenida {
    background: var(--principal);
    color: white;
    padding: 20px;
    margin-bottom: 20px;
}

.banner-bienvenida h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.banner-bienvenida p {
    opacity: 0.9;
    font-size: 16px;
}

/* Indicador de empresa */
.indicador-empresa {
    background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    padding: 16px 24px;
    border-radius: 0;
    /* DISEÑO ORIGINAL */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); */

    /* DISEÑO VIBRANTE */
    box-shadow: 0 4px 20px rgba(0, 40, 161, 0.15), 0 2px 8px rgba(250, 229, 0, 0.1);
    border: 2px solid rgba(250, 229, 0, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s ease;
}

.indicador-empresa:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 40, 161, 0.2), 0 3px 10px rgba(250, 229, 0, 0.15);
    border-color: rgba(250, 229, 0, 0.5);
}

.indicador-empresa-texto {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #6b7280;
    text-transform: uppercase;
}

.indicador-empresa-nombre {
    font-size: 18px;
    font-weight: 800;
    color: var(--empresa-color, #0028A1);
    letter-spacing: 0.5px;
}

/* Acciones principales dashboard */
.acciones-principales {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.boton-grande {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
}

.boton-grande svg {
    width: 20px;
    height: 20px;
}

.grid-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Buscador principal */
.buscador-principal {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--borde);
    padding: 0 20px;
    margin-bottom: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.buscador-principal:focus-within {
    border-color: var(--principal);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.buscador-icono {
    color: var(--secundario);
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.buscador-principal:focus-within .buscador-icono {
    color: var(--principal);
}

.buscador-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    padding: 18px 0;
    background: transparent;
    color: var(--oscuro);
}

.buscador-input::placeholder {
    color: var(--secundario);
}

.buscador-atajo {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--secundario);
    font-size: 12px;
}

.buscador-atajo span {
    background: var(--claro);
    border: 1px solid var(--borde);
    padding: 2px 6px;
    font-family: monospace;
    font-size: 11px;
}

.resultados-busqueda {
    display: none;
    position: absolute;
    top: 100%;
    left: -2px;
    right: -2px;
    background: white;
    border: 2px solid var(--principal);
    border-top: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 101;
}

.resultados-busqueda.activo {
    display: block;
}

a.resultado-item {
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--borde);
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}

a.resultado-item:last-child {
    border-bottom: none;
}

a.resultado-item:hover,
a.resultado-item:focus {
    background: var(--claro);
    text-decoration: none;
}

a.resultado-item.seleccionado {
    background: #e0e7ff;
}

.resultado-avatar {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.resultado-info {
    flex: 1;
    min-width: 0;
}

.resultado-nombre {
    font-weight: 600;
    font-size: 15px;
    color: var(--oscuro);
    margin-bottom: 2px;
}

.resultado-empresa {
    font-size: 13px;
    color: var(--secundario);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resultado-flecha {
    color: var(--secundario);
    opacity: 0;
    transition: opacity 0.1s;
}

a.resultado-item:hover .resultado-flecha {
    opacity: 1;
}

.sin-resultados {
    padding: 24px;
    text-align: center;
    color: var(--secundario);
    font-size: 14px;
}

.resultados-titulo {
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secundario);
    background: var(--claro);
    border-bottom: 1px solid var(--borde);
}

/* Avatar mini para tablas */
.avatar-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

/* Filas clickables */
.fila-clickable {
    cursor: pointer;
    transition: background-color 0.15s;
}

.fila-clickable:hover {
    background-color: #f0f9ff;
}

/* Textos auxiliares */
.texto-principal {
    font-weight: 500;
    color: var(--texto);
}

.texto-sm {
    font-size: 12px;
}

/* Etiquetas de plan */
.etiqueta-plan {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.plan-premium {
    background: #fef3c7;
    color: #92400e;
}

.plan-profesional {
    background: #e0e7ff;
    color: #3730a3;
}

.plan-clasico {
    background: #d1fae5;
    color: #065f46;
}

.plan-sin_plan {
    background: #f3f4f6;
    color: #374151;
}

/* Paginacion */
.paginacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--borde);
    flex-wrap: wrap;
    gap: 12px;
}

.paginacion-info {
    font-size: 13px;
    color: var(--secundario);
}

.paginacion-controles {
    display: flex;
    align-items: center;
    gap: 8px;
}

.paginacion-paginas {
    font-size: 13px;
    color: var(--secundario);
    padding: 0 8px;
}

/* Filtros de clientes */
.filtros-clientes {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Filas de contacto */
.contacto-fila {
    display: flex;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--claro);
    border-radius: 6px;
}

/* ============================================
   RESPONSIVE - MOVIL
   ============================================ */

/* Boton hamburguesa */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background: var(--principal);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.menu-toggle svg {
    width: 28px;
    height: 28px;
}

/* Overlay oscuro */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.menu-overlay.activo {
    display: block;
}

/* Responsive tablets (769px - 1024px) - Menu lateral visible, contenido adaptado */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --menu-ancho: 200px;
    }

    .menu-nav a {
        padding: 10px 14px;
        font-size: 13px;
        gap: 8px;
    }

    .menu-nav svg {
        width: 16px;
        height: 16px;
    }

    .menu-cabecera {
        padding: 14px;
    }

    .menu-pie {
        padding: 12px 14px;
    }

    .nombre-usuario {
        font-size: 12px;
    }

    .contenido-wrapper {
        padding: 20px 16px;
    }

    .grid-dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .banner-bienvenida {
        padding: 16px;
        margin-bottom: 16px;
    }

    .banner-bienvenida h2 {
        font-size: 18px;
    }

    .banner-bienvenida p {
        font-size: 13px;
    }

    .banner-bienvenida > div {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .acciones-principales {
        gap: 8px;
    }

    .boton-grande {
        padding: 12px 16px;
        font-size: 14px;
    }

    .buscador-principal {
        margin-bottom: 16px;
    }

    .buscador-atajo {
        display: none;
    }

    .tarjeta-cabecera {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .tarjeta-titulo {
        font-size: 14px;
    }

    table {
        font-size: 13px;
    }

    td, th {
        padding: 8px 10px;
    }
}

/* Responsive 768px - Moviles */
@media (max-width: 768px) {
    /* Mostrar boton hamburguesa */
    .menu-toggle {
        display: flex;
    }

    /* Menu lateral oculto por defecto */
    .menu-lateral {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    /* Menu visible cuando tiene clase .activo */
    .menu-lateral.activo {
        left: 0;
    }

    /* Contenido principal ocupa todo el ancho */
    .contenido-principal {
        margin-left: 0;
        padding: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .contenido-wrapper {
        padding: 70px 10px 10px 10px;
    }

    /* Evitar desbordamiento */
    .tarjeta,
    .info-seccion,
    .cobro-tarjeta,
    .tarjeta-credencial,
    .tarjeta-nota {
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    /* URLs largas que no rompan layout */
    a, .info-valor, .credencial-campo .valor {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Grids a una columna */
    .fila-campos,
    .fila-campos-3,
    .fila-campos-3-igual {
        grid-template-columns: 1fr;
    }

    .grid-clientes {
        grid-template-columns: 1fr;
    }

    /* Acciones principales en movil */
    .acciones-principales {
        flex-direction: column;
        gap: 8px;
    }

    .boton-grande {
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }

    .grid-dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Tablas en movil - scroll horizontal */
    .contenedor-tabla {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tarjetas */
    .tarjeta {
        margin-bottom: 12px;
    }

    .tarjeta-cabecera {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .tarjeta-titulo {
        font-size: 13px;
    }

    .tarjeta-cuerpo {
        padding: 12px;
    }

    /* Banner bienvenida */
    .banner-bienvenida {
        padding: 14px 12px;
        margin-bottom: 12px;
    }

    .banner-bienvenida h2 {
        font-size: 16px;
    }

    .banner-bienvenida p {
        font-size: 12px;
    }

    .banner-bienvenida > div {
        flex-direction: column !important;
        gap: 16px !important;
    }

    .indicador-empresa {
        justify-content: center;
        width: 100%;
    }

    .indicador-empresa-nombre {
        font-size: 16px;
    }

    /* Buscador principal */
    .buscador-principal {
        padding: 0 12px;
        margin-bottom: 12px;
    }

    .buscador-input {
        font-size: 14px;
        padding: 12px 8px;
    }

    .buscador-atajo {
        display: none;
    }

    /* Etiquetas mas compactas */
    .etiqueta-prioridad,
    .etiqueta-ticket,
    .etiqueta-estado {
        padding: 2px 5px;
        font-size: 9px;
        white-space: nowrap;
    }

    /* Contactos en columna */
    .contacto-fila {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .contacto-fila .grupo-campo {
        flex: 1 1 100% !important;
        margin-bottom: 10px !important;
    }

    .contacto-fila button {
        align-self: flex-end;
    }

    /* Cabecera pagina en columna */
    .cabecera-pagina {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        margin-bottom: 16px;
    }

    .cabecera-pagina h1,
    .titulo-pagina {
        font-size: 16px;
        word-break: break-word;
    }

    .subtitulo-pagina {
        font-size: 12px;
    }

    /* Cabecera cliente avatar */
    .cabecera-pagina .flex.alinear-centro.gap-2 {
        flex-wrap: wrap;
    }

    .cabecera-pagina .cliente-avatar {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
    }

    /* Botones cabecera en fila */
    .cabecera-pagina > .flex.gap-1 {
        width: 100%;
        flex-wrap: wrap;
    }

    .cabecera-pagina > .flex.gap-1 .boton {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 8px 10px;
    }

    /* Grids estadisticas a 2 columnas */
    div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    /* Resumen cobros */
    .resumen-cobros {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .resumen-cobros .tarjeta {
        padding: 12px !important;
    }

    .resumen-valor {
        font-size: 18px !important;
    }

    /* Cobros tarjetas */
    .cobro-cabecera {
        flex-direction: column;
        gap: 12px;
    }

    .cobro-cabecera > div:last-child {
        text-align: left !important;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .cobro-info {
        flex-direction: column;
        gap: 8px !important;
    }

    /* Info grid cliente */
    .info-grid {
        grid-template-columns: 1fr !important;
    }

    .info-fila {
        flex-direction: column;
    }

    .info-etiqueta {
        width: 100% !important;
        padding: 8px 12px !important;
        font-size: 11px !important;
    }

    .info-valor {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }

    /* Mapa Google mas pequeño */
    .info-seccion iframe {
        height: 150px !important;
    }

    /* Grid estadisticas a 2 columnas en movil */
    .grid-estadisticas-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .estadistica-item {
        padding: 12px;
    }

    .estadistica-valor {
        font-size: 18px;
    }

    .estadistica-label {
        font-size: 11px;
    }

    /* Avisos: ocultar tabla, mostrar tarjetas */
    .tiquets-tabla-desktop {
        display: none !important;
    }

    .tiquets-lista-movil {
        display: block !important;
    }

    /* Clientes: ocultar tabla, mostrar tarjetas */
    .clientes-tabla-desktop {
        display: none !important;
    }

    .clientes-lista-movil {
        display: block !important;
    }

    /* Fichajes: ocultar tabla, mostrar tarjetas */
    .historial-tabla-desktop {
        display: none !important;
    }

    .historial-lista-movil {
        display: block !important;
    }

    .fichaje-movil-detalles {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Paginacion */
    .paginacion {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .paginacion-controles {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Filtros en columna */
    .filtros-clientes,
    .filtros-rapidos {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filtros-clientes .caja-busqueda,
    .caja-busqueda {
        min-width: 100% !important;
        width: 100% !important;
    }

    .filtros-clientes select,
    select.campo {
        width: 100% !important;
        font-size: 14px;
        padding: 10px 8px;
    }

    /* Filtros de clientes en columna */
    .filtros-clientes {
        flex-direction: column;
        gap: 8px;
    }

    .filtros-clientes .boton {
        width: 100%;
        justify-content: center;
    }

    .filtro-boton {
        text-align: center;
        padding: 8px 10px;
        font-size: 11px;
    }

    /* Pestanas en movil - ocultar desktop, mostrar select */
    .pestanas-desktop {
        display: none !important;
    }

    .pestanas-movil {
        display: block !important;
        margin-bottom: 16px;
    }

    .pestanas-movil select {
        width: 100%;
        padding: 12px;
        font-size: 15px;
        font-weight: 500;
        border: 2px solid var(--principal);
        background: white;
        color: var(--oscuro);
    }

    /* Tabs de filtros */
    .tabs-filtros {
        flex-wrap: wrap;
        gap: 6px;
    }

    .tabs-filtros .boton {
        flex: 1 1 45%;
        justify-content: center;
        font-size: 11px;
        padding: 8px 8px;
    }

    /* Botones de accion */
    .acciones-pagina {
        flex-wrap: wrap;
        gap: 8px;
    }

    .acciones-pagina .boton {
        flex: 1 1 100%;
        justify-content: center;
    }

    /* Botones generales */
    .boton {
        padding: 10px 12px;
        font-size: 13px;
    }

    .boton-sm {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Estadisticas dashboard */
    .grid-estadisticas {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Fichajes */
    .fichaje-estado {
        flex-direction: column;
        text-align: center;
    }

    .fichaje-botones {
        flex-direction: column;
        gap: 8px;
    }

    .fichaje-botones .boton {
        width: 100%;
        justify-content: center;
    }

    /* Credenciales */
    .tarjeta-credencial {
        padding: 10px;
    }

    .tarjeta-credencial h4 {
        font-size: 13px;
    }

    /* Notas */
    .tarjeta-nota {
        padding: 10px;
    }

    /* Modal en movil */
    .modal {
        max-width: calc(100vw - 24px);
        margin: 12px;
        max-height: calc(100vh - 24px);
    }

    .modal-cabecera {
        padding: 12px;
    }

    .modal-cuerpo {
        padding: 12px;
    }

    .modal-pie {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    /* Texto secundario */
    .texto-secundario {
        font-size: 11px;
    }

    /* Links dentro de tablas */
    table a {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Alertas */
    .alerta {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Login responsive */
    .contenedor-login {
        padding: 20px 10px;
        align-items: flex-start;
    }

    .caja-login {
        padding: 30px 20px;
        margin: 10px;
        max-width: calc(100vw - 20px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }

    .login-logo {
        margin: -30px -20px 24px -20px;
        padding: 25px 15px;
    }

    .login-logo img {
        max-width: 240px;
    }

    .caja-login .campo {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 14px 16px;
    }

    .caja-login .boton-principal {
        padding: 16px 20px;
        font-size: 16px;
    }

    .login-footer {
        padding: 15px 10px;
        margin-top: 15px;
    }

    .login-footer-text {
        font-size: 12px;
    }
}

/* Responsive 480px - Moviles pequenos */
@media (max-width: 480px) {
    .contenido-principal {
        padding: 0;
    }

    .contenido-wrapper {
        padding: 65px 10px 10px 10px;
    }

    .menu-toggle {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
    }

    .menu-toggle svg {
        width: 24px;
        height: 24px;
    }

    .campo {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 10px 8px;
    }

    /* Login en móviles pequeños */
    .caja-login {
        padding: 25px 15px;
        margin: 5px;
        border-radius: 12px;
    }

    .login-logo {
        margin: -25px -15px 20px -15px;
        padding: 20px 10px;
        border-radius: 12px 12px 0 0;
    }

    .login-logo img {
        max-width: 200px;
    }

    .caja-login .etiqueta-campo {
        font-size: 14px;
    }

    .caja-login .grupo-campo {
        margin-bottom: 18px;
    }

    .login-footer-text {
        font-size: 11px;
        line-height: 1.5;
    }

    /* Estadisticas a una columna */
    .grid-estadisticas {
        grid-template-columns: 1fr;
    }

    /* Cabecera mas compacta */
    .cabecera-pagina h1,
    .titulo-pagina {
        font-size: 16px;
    }

    /* Tabs a ancho completo */
    .tabs-filtros .boton {
        flex: 1 1 100%;
    }

    /* Banner aun mas compacto */
    .banner-bienvenida {
        padding: 12px 10px;
    }

    .banner-bienvenida h2 {
        font-size: 14px;
    }

    /* Tarjetas compactas */
    .tarjeta-cabecera {
        padding: 10px;
    }

    .tarjeta-cuerpo {
        padding: 10px;
    }

    th, td {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* Utilidades */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.texto-centro { text-align: center; }
.texto-derecha { text-align: right; }
.texto-secundario { color: var(--secundario); }
.texto-peligro { color: var(--peligro); }
.texto-exito { color: var(--exito); }
.flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.alinear-centro { align-items: center; }
.justificar-entre { justify-content: space-between; }
.justificar-fin { justify-content: flex-end; }

/* Selector de Empresa - Mejorado */
.selector-empresa {
    margin: 20px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 20px;
}

.selector-empresa-titulo {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.selector-empresa-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f9fafb;
    border: 2px solid var(--empresa-color, #0028A1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
}

.selector-empresa-toggle:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.selector-empresa-nombre {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
    text-transform: uppercase;
}

.selector-empresa-icono {
    width: 18px;
    height: 18px;
    color: var(--empresa-color, #0028A1);
    transition: transform 0.2s;
}

.selector-empresa-toggle.activo .selector-empresa-icono {
    transform: rotate(180deg);
}

.selector-empresa-dropdown {
    display: none;
    margin-top: 10px;
    animation: slideDown 0.2s ease-out;
}

.selector-empresa-dropdown.visible {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selector-empresa-form {
    margin: 0;
}

.selector-empresa-opcion {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    margin-bottom: 8px;
}

.selector-empresa-opcion:hover {
    background: #f3f4f6;
    border-color: var(--empresa-color, #0028A1);
    transform: translateX(4px);
}

.selector-empresa-opcion-nombre {
    flex: 1;
    font-weight: 600;
    text-transform: uppercase;
}

.selector-empresa-arrow {
    color: var(--empresa-color, #0028A1);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.selector-empresa-opcion:hover .selector-empresa-arrow {
    opacity: 1;
}

/* Footer de la aplicación */
.app-footer {
    width: 100%;
    padding: 24px 20px;
    text-align: center;
    background: white;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

.footer-text {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.footer-link {
    color: var(--empresa-color, #2563eb);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--principal-oscuro, #1d4ed8);
    text-decoration: underline;
}

@media (max-width: 640px) {
    .app-footer {
        padding: 16px 12px;
    }

    .footer-text {
        font-size: 12px;
    }
}
