/* ESTILOS GENERALES */
body { font-family: 'Segoe UI', Roboto, sans-serif; background-color: #f0f2f5; margin: 0; padding-bottom: 80px; display: flex; flex-direction: column; align-items: center; color: #333; }

/* HEADER */
.app-header { width: 100%; background: #0d47a1; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; box-sizing: border-box; color: white; box-shadow: 0 2px 10px rgba(0,0,0,0.2); position: sticky; top: 0; z-index: 100; }
.logo-area { display: flex; align-items: center; gap: 10px; text-decoration: none; color: white; cursor: pointer; }
.logo-img { height: 40px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.3); }
.app-info { display: flex; flex-direction: column; }
.app-name { font-weight: 800; font-size: 1.1rem; line-height: 1.1; }
.app-sub { font-size: 0.75rem; color: #90caf9; }

.user-badge { text-align: right; cursor: pointer; } 
.user-email { font-size: 0.75rem; color: #e3f2fd; font-weight: bold; text-decoration: underline; }
.status-badge { font-size: 0.7rem; padding: 3px 10px; border-radius: 12px; font-weight: bold; display: inline-block; cursor: pointer; border: 1px solid rgba(255,255,255,0.5); margin-top: 2px; }
.status-badge.free { background: #757575; color: #fff; }
.status-badge.pro { background: #ffd700; color: #000; border-color: #ffab00; box-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
.status-badge.expired { background: #d32f2f; color: #fff; animation: pulse 2s infinite; }

/* VISTAS Y TABS */
.tabs { 
    display: flex; 
    width: 95%; 
    max-width: 1000px; 
    margin: 15px auto 5px; 
    background: #fff; 
    border-radius: 8px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    overflow: hidden; 
    flex-wrap: wrap;
    
    /* FIJAR PESTAÑAS AL HACER SCROLL */
    position: sticky;
    top: 62px; /* Se fija justo debajo del Header */
    z-index: 99;
}

.tab { flex: 1; padding: 12px; text-align: center; cursor: pointer; color: #666; font-weight: 600; border-bottom: 3px solid transparent; font-size: 0.9rem; white-space: nowrap; }
.tab.active { color: #0d47a1; border-bottom: 3px solid #0d47a1; background: #e3f2fd; }

.view { display: none; width: 95%; max-width: 1000px; margin: 0 auto; flex-direction: column; gap: 10px; }
.view.active { display: flex; }

/* TARJETAS */
.card { background: #fff; border-radius: 8px; padding: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-left: 4px solid #0d47a1; position: relative; margin-bottom: 10px; }
.card h3 { margin: 0 0 10px 0; color: #1565c0; font-size: 1rem; display: flex; justify-content: space-between; align-items: center; }

.company-selector { background: #fff; padding: 10px; border-radius: 8px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 10px; }

/* FORMULARIOS */
input, select { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 0.95rem; }
.row-inputs { display: flex; gap: 10px; }
.row-inputs > div { flex: 1; }
label { font-size: 0.8rem; color: #666; font-weight: bold; display: block; margin-bottom: 3px; }

.btn { padding: 10px; border-radius: 5px; border: none; font-weight: bold; cursor: pointer; width: 100%; font-size: 0.9rem; transition: 0.2s; text-align: center; }
.btn-primary { background: #0d47a1; color: white; }
.btn-sec { background: #e0e0e0; color: #333; }
.btn-success { background: #2e7d32; color: white; }
.btn-danger { background: #d32f2f; color: white; }
.btn-warning { background: #ff9800; color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; width: auto; }

/* CONFIGURACION COLUMNAS */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; background: #f9f9f9; padding: 10px; border-radius: 5px; margin-bottom: 10px; border: 1px dashed #ccc; }
.config-item label { font-size: 0.7rem; color: #0d47a1; }
.config-item input { margin-bottom: 0; padding: 5px; font-size: 0.85rem; }

/* TABLAS */
.table-container { overflow-x: auto; border-radius: 8px; border: 1px solid #eee; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.85rem; }
th { background: #f5f5f5; padding: 10px; text-align: left; border-bottom: 2px solid #ddd; color: #555; white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #eee; vertical-align: middle; white-space: nowrap; }
tr:hover { background: #f9f9f9; }

/* ESTILO TABLA COMPACTA (PARA RETENCIONES) */
.compact-table th, .compact-table td { padding: 6px 8px; font-size: 0.8rem; }
.compact-table input[type="number"] { padding: 4px; font-size: 0.8rem; height: auto; margin-bottom: 0; }

/* FILTER BOX */
.filter-box { background: #eceff1; padding: 10px; border-radius: 5px; margin-bottom: 10px; border: 1px solid #cfd8dc; }
.filter-grid { display: flex; gap: 5px; flex-wrap: wrap; align-items: flex-end; }
.filter-item { flex: 1; min-width: 135px; }
.filter-item label { font-size: 0.7rem; color: #546e7a; margin-bottom: 2px; }
.filter-item input, .filter-item select { margin: 0; padding: 5px; font-size: 0.8rem; height: 30px; }

/* SIMULACION CALCULO */
.sim-box { background: #f8fbff; border: 1px solid #cce5ff; border-radius: 8px; padding: 15px; margin-top: 15px; }
.sim-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; font-size: 0.9rem; }
.sim-item { display: flex; flex-direction: column; }
.sim-item span:first-child { font-size: 0.75rem; color: #666; }
.sim-item strong { color: #333; }
.sim-total { grid-column: span 2; border-top: 2px solid #ddd; padding-top: 10px; margin-top: 5px; display: flex; justify-content: space-between; align-items: center; }
.sim-result { font-size: 1.3rem; color: #0d47a1; font-weight: bold; }
.tag-art29 { font-size: 0.7rem; background: #fff3cd; color: #856404; padding: 2px 5px; border-radius: 4px; border: 1px solid #ffeeba; }

/* HISTORIAL */
details.history-group { background: #fff; border: 1px solid #eee; margin-bottom: 5px; border-radius: 5px; }
details.history-group summary { padding: 10px; cursor: pointer; font-weight: bold; background: #fafafa; display: flex; justify-content: space-between; }
details.history-group[open] summary { border-bottom: 1px solid #eee; color: #0d47a1; }
details.history-group table { margin: 0; }
details.history-group tr { background: #fff !important; }

/* MODALES */
#authScreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0d47a1; z-index: 2000; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; }
.google-btn { background: white; color: #333; display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-radius: 50px; font-weight: bold; cursor: pointer; border: none; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 3000; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal-content { background: white; padding: 20px; border-radius: 10px; width: 90%; max-width: 900px; max-height: 90vh; overflow-y: auto; position: relative; }
.close-btn { position: absolute; top: 10px; right: 10px; cursor: pointer; font-size: 1.2rem; color: #999; }

/* ESTILO PARA SELECTS LARGOS */
.select-long option { font-size: 0.8rem; padding: 5px; border-bottom:1px solid #eee; }

.tag-warning { font-size: 0.65rem; background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; padding: 2px 5px; border-radius: 4px; display: inline-block; margin-right: 3px; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

/* SWEETALERT SOBRE AUTH SCREEN */
.swal2-container {
    z-index: 10000 !important;
}