/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variables CSS */
:root {
    --sidebar-w: 560px; /* Duplicado de 280px a 560px */
}

/* Scroll único en html/body */
/* Scroll global en html/body - no height fijo */
html, body {
    height: auto !important;
    overflow-y: auto !important;
}

html {
    width: 100%;
    margin: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Cuando body tiene sidebar, usar flex layout */
body.has-sidebar {
    display: flex;
    align-items: stretch;
    min-height: 100%;
    padding-left: 0; /* Eliminado: ahora usamos flex layout */
}

/* Asegurar que app-container también use flex cuando está dentro de body.has-sidebar */
body.has-sidebar > .app-container {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}


/* Contenedor principal */
.app-container {
    display: flex;
    align-items: stretch;     /* clave: estira hijos en altura */
    min-height: 100vh;        /* mínimo viewport, pero puede crecer */
    height: auto !important;
    max-height: none !important;
    overflow: visible;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

/* Sidebar */
.sidebar, .menu-lateral, .nav-lateral {
    position: sticky;
    top: 0;
    align-self: stretch;
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    height: auto;
    background: #1e40af;
    color: white;
    padding: 0;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Header del sidebar - franja blanca */
.sidebar .logo {
    width: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 12px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    text-align: center;
}

.sidebar .logo-img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    margin: 0 0 10px 0;
    padding: 0;
}

.sidebar .logo-text {
    font-size: 22px;
    font-weight: 700;
    color: #1f3b8a;
    line-height: 1.1;
    text-align: center;
    margin: 0;
}

/* Mantener compatibilidad con h1 si existe */
.sidebar .logo h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: #1f3b8a;
    line-height: 1.1;
}

/* Bloque usuario / granja / cerrar sesión (debajo del logo en sidebar; columna) */
.pf-sidebar-user-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    padding: 10px 12px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Menú */
.menu {
    padding: 40px 0;
}

/* Botón principal CARGAR PRESUPUESTO */
.menu-main-button {
    padding: 0 20px 15px 20px;
}

.btn-cargar-presupuesto {
    width: 100%;
    background: #60a5fa;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.btn-cargar-presupuesto:hover {
    background: #3b82f6;
}

.btn-text {
    font-weight: 600;
}

.btn-arrow {
    font-size: 1.2rem;
}


/* Secciones del menú */
.menu-section {
    margin-bottom: 5px;
}

.menu-header {
    padding: 24px 40px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-header:hover {
    background-color: rgba(255,255,255,0.1);
}

.menu-title {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: normal;
}

.menu-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
    transform: scale(2);
    transform-origin: center;
}

.menu-section[data-expanded="true"] .menu-arrow {
    transform: rotate(180deg) scale(2);
    transform-origin: center;
}

.menu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.menu-section[data-expanded="true"] .menu-items {
    max-height: var(--menu-max, 500px);
    overflow: auto;
}

/* Asegurar que el botón del extractor automático sea visible */
.menu-item[data-route="/datos/extractor-automatico"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Asegurar que todos los elementos del menú DATOS sean visibles (opacidad: disabled puede atenuar) */
[data-key="datos"] .menu-item {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
[data-key="datos"] .menu-item.menu-item-disabled {
    opacity: 0.4 !important;
}

.menu-item {
    padding: 20px 40px 20px 80px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item:hover {
    background-color: rgba(255,255,255,0.1);
}

.menu-item.active {
    background-color: rgba(255,255,255,0.2);
    font-weight: 600;
}

.menu-item-text {
    font-size: 1.8rem;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

/* Botón destacado: Variación de Costos - más grande y en negrita */
.menu-item-featured {
    font-size: 2.06rem; /* Duplicado de 1.03rem */
    font-weight: 700; /* Negrita */
}

.menu-item-featured .menu-item-text {
    font-size: 2.06rem;
    font-weight: 700; /* Negrita */
    line-height: 1.3;
}

.menu-item-featured .menu-item-arrow {
    font-size: 1.84rem; /* Duplicado de 0.92rem */
    transform: scale(2);
    transform-origin: center;
}

.menu-item-arrow {
    font-size: 0.8rem;
    opacity: 0.7;
    transform: scale(2);
    transform-origin: center;
}

/* Botón de descarga */
.menu-download {
    padding: 20px;
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-download {
    width: 100%;
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-download:hover {
    background: rgba(255,255,255,0.1);
}

/* Workspace */
.workspace {
    display: flex;
    flex-direction: column;
    background: white;
    min-height: 100vh;
    overflow-y: visible !important;
    overflow-x: visible;
    height: auto !important;
    max-height: none !important;
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    min-width: 0;
    box-sizing: border-box;
}

.workspace-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.workspace-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e40af;
    margin: 0;
}

/* Contenedor de vistas: simple y predecible */
.workspace-content {
    flex: 1;
    padding: 30px;
    overflow: visible;
    position: relative;
    display: block;
    min-height: 0;
    max-width: none;
    margin: 0;
    height: auto;
    box-sizing: border-box;
}

/* Título principal del contenido */
.content-title {
    margin-bottom: 30px;
}

/* Centrado y límite de ancho (aplicar a TODOS los posibles contenedores, excepto .workspace y .app-container que tienen layouts específicos) */
.content, .workspace-content, main, .page-content, .section-root {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
    box-sizing: border-box;
}

/* .app-container y .workspace tienen layouts específicos, no aplicar reglas genéricas */
.app-container {
    margin: 0 !important;
    padding: 0 !important;
}

.workspace {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    gap: 0 !important;
    top: 0 !important;
    left: 0 !important;
    position: relative !important;
}

/* Centrar y limitar ancho de las secciones/formularios */
.section, .card, .form-wrapper, .calculation-options, .form-content {
    max-width: 100%;
    margin: 0 auto 24px auto;
    overflow-x: auto;
}

/* Fallback para casos tercos */
#app, .content, .workspace, .workspace-content, main, .app-container, .page-content, .section-root {
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    height: auto;
}

.content-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
}

/* Opciones de cálculo */
.calculation-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.calculation-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.calculation-item:hover {
    border-color: #1e40af;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.calculation-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 5px;
}

.calculation-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Formularios */
.form-container {
    max-width: 1000px;
    margin: 0 auto;
}

.presupuesto-form {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    overflow: hidden;
}

.form-section {
    padding: 30px;
    border-bottom: 1px solid #e2e8f0;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3b82f6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:invalid {
    border-color: #ef4444;
}

.form-group small {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-actions {
    padding: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    background: #f8fafc;
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* Resultados */
.resultados-container {
    margin-top: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    overflow: hidden;
}

.resultados-container h3 {
    padding: 20px 30px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
}

.resultados-table {
    padding: 30px;
}

.presupuesto-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.presupuesto-table th {
    background: #f8fafc;
    color: #1e40af;
    font-weight: 600;
    padding: 15px 20px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.9rem;
}

.presupuesto-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.presupuesto-table tr:hover {
    background: #f8fafc;
}

.resultado-numero {
    font-weight: 700;
    color: #1e40af;
    text-align: right;
    font-size: 1.1rem;
}

.resultado-separador {
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.resultado-separador td {
    padding: 12px 8px;
    font-size: 1.1em;
    color: #495057;
}

.resultados-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
}

.resultado-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.resultado-label {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.resultado-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
}

.resultados-actions {
    padding: 20px 30px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    word-wrap: break-word;
    opacity: 1;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.toast.info {
    background: #3b82f6;
}

/* Responsive */
@media (max-width: 992px) {
    :root {
        --sidebar-w: 240px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar, .menu-lateral, .nav-lateral {
        position: fixed;
        width: 100%;
        height: auto;
        z-index: 1000;
    }
    
    body.has-sidebar {
        padding-left: 0;
        padding-top: 64px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .resultados-grid {
        grid-template-columns: 1fr;
    }
    
    .workspace-content {
        padding: 20px;
    }
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}

/* Estilos para Presupuesto de Alimentos */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.fases-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.fases-table th {
    background: #1e40af;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}

.fases-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.fases-table tbody tr:hover {
    background-color: #f8fafc;
}

.fases-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
}

.fases-table input:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

.fases-table .kg-input {
    background-color: #f0f9ff;
    font-weight: 600;
    color: #1e40af;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.total-info {
    font-size: 1rem;
    color: #1e40af;
}

.btn-remove-fase {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

.btn-remove-fase:hover {
    background: #dc2626;
}

.btn-calcular-consumo {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s;
    margin-left: 5px;
}

.btn-calcular-consumo:hover {
    background: #059669;
}

/* Estilos para filas de resumen */
.resumen-row {
    background-color: #f1f5f9;
}

.total-row {
    background-color: #1e40af;
    color: white;
    font-weight: bold;
}

.total-row .resultado-numero {
    color: white;
    font-weight: bold;
}

/* Estilos para datos guardados */
.datos-controls {
    margin-bottom: 20px;
    margin-top: 0px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Asegurar que el contenido aparezca arriba cuando esté visible */
#datos-presupuesto-productivo-container,
#datos-presupuesto-alimentos-container,
#presupuesto-visualizar-container {
    margin-top: 0px !important;
    padding-top: 0px !important;
    position: relative !important;
    top: 0px !important;
}

/* Composición de dietas - forzar posición arriba */
#composicion-dietas-container {
    margin-top: 0px !important;
    padding-top: 0px !important;
    position: relative !important;
    top: 0px !important;
    display: none;
    clear: both !important;
    float: left !important;
    width: 100% !important;
}

/* Contrato mínimo y claro para TODAS las vistas/paneles */
.form-container { 
    display: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    margin: 0 0 24px 0;
    padding: 20px;
    float: none; 
    order: 0; 
    z-index: auto; 
    position: relative; 
    top: auto;
}
.form-container.active { 
    display: block;
}

/* Estilos específicos para contenido interno */
.rubros-content,
.importacion-content {
    position: relative;
}

/* Forzar que aparezca al inicio del workspace */
.workspace-content {
    position: relative;
    display: flex !important;
    flex-direction: column !important;
}

#composicion-dietas-container.active {
    order: -1 !important;
    flex: 0 0 auto !important;
}

/* Forzar que los elementos de datos aparezcan arriba */
.datos-lista {
    margin-top: 0px !important;
    padding-top: 0px !important;
    position: relative !important;
    top: 0px !important;
}

.datos-item {
    margin-top: 0px !important;
    padding-top: 0px !important;
    position: relative !important;
    top: 0px !important;
}

/* Forzar posicionamiento específico para datos guardados */
#datos-presupuesto-productivo-container .datos-lista,
#datos-presupuesto-alimentos-container .datos-lista,
#presupuesto-visualizar-container .datos-lista {
    margin-top: 0px !important;
    padding-top: 0px !important;
    position: relative !important;
    top: 0px !important;
}

/* Asegurar que el contenedor principal esté en la parte superior */
.workspace-content {
    position: relative !important;
    top: 0px !important;
}

/* Estilos para Composición de Dietas */
.ingredientes-section, .formulas-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.ingredientes-section h3, .formulas-section h3 {
    color: #495057;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.ingredientes-controls, .formulas-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.formulario-ingrediente {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.ingredientes-lista {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 150px;
    border: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    box-sizing: border-box;
}

.ingredientes-empty {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
}

.ingrediente-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.ingrediente-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.ingrediente-nombre {
    font-weight: 600;
    color: #495057;
}

.ingrediente-precio {
    color: #007bff;
    font-weight: 600;
}

.ingrediente-actions {
    display: flex;
    gap: 5px;
}

/* Estilos para selección de dietas */
.seleccion-dieta {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.dietas-disponibles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.dieta-disponible {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dieta-disponible:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.dieta-disponible.selected {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

/* Estilos para formulación de dietas */
.formulacion-dieta {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/* Estilos para importación de datos */
.importacion-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.importacion-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.importacion-section h5 {
    color: #007bff;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Drag & drop: mismo criterio que ImportarExcel (inline #007bff / #e3f2fd) */
.pf-file-drop-target.pf-file-drop-target--active {
    border-color: #007bff !important;
    background-color: #e3f2fd !important;
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.file-name {
    color: #28a745;
    font-weight: 500;
}

.file-info {
    color: #6c757d;
    font-size: 0.9em;
}

.column-config {
    margin-bottom: 15px;
}

.column-config label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.rubros-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.rubros-lista {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
}

.rubro-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s;
}

.rubro-item:hover {
    background-color: #f8f9fa;
}

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

.rubro-nombre {
    flex: 1;
    font-weight: 500;
    color: #495057;
}

.rubro-actions {
    display: flex;
    gap: 5px;
}

.rubro-actions button {
    padding: 4px 8px;
    font-size: 0.8em;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit {
    background: #ffc107;
    color: #212529;
}

.btn-edit:hover {
    background: #e0a800;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.table-responsive {
    max-height: 300px;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.table-responsive table {
    margin-bottom: 0;
}

.table-responsive th,
.table-responsive td {
    padding: 8px 12px;
    font-size: 0.9em;
}

.table-responsive th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dieta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.dieta-actions {
    display: flex;
    gap: 10px;
}

.formulacion-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.formulacion-controls .form-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.formulacion-controls .form-group {
    margin-bottom: 0;
}

.tabla-composicion {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tabla-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tabla-header h5 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.tabla-info {
    color: #6c757d;
    font-size: 0.9em;
}

.tabla-wrapper {
    overflow-x: auto;
}

.composicion-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.composicion-table th {
    background: #007bff;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border: none;
}

.composicion-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.composicion-table tbody tr:hover {
    background: #f8f9fa;
}

.composicion-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-row td {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 30px;
}

.resumen-dieta {
    background: #e3f2fd;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
}

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

.resumen-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resumen-label {
    font-weight: 600;
    color: #495057;
    font-size: 1em;
}

.resumen-valor {
    font-size: 1.1em;
    font-weight: 700;
    color: #007bff;
}

.composicion-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.composicion-table th,
.composicion-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.composicion-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.composicion-table tbody tr:hover {
    background: #f8f9fa;
}

.resumen-dieta {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.resumen-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resumen-label {
    font-weight: 600;
    color: #495057;
    font-size: 1.1em;
}

.resumen-valor {
    font-size: 1.2em;
    font-weight: 700;
    color: #007bff;
}

.dietas-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dietas-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dietas-item-title {
    font-weight: 600;
    color: #495057;
}

.dietas-item-actions {
    display: flex;
    gap: 5px;
}

.dietas-item-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.dietas-nutriente {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #f8f9fa;
}

.dietas-nutriente:last-child {
    border-bottom: none;
}

.dietas-nutriente-label {
    font-weight: 500;
    color: #495057;
}

.dietas-nutriente-value {
    color: #007bff;
    font-weight: 600;
}

/* Estilos para Presupuesto Financiero */
#presupuesto-financiero-container .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

#presupuesto-financiero-container .form-group {
    margin-bottom: 0;
}

#presupuesto-financiero-container .form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

#resultados-financiero .resultados-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

#resultados-financiero .resultado-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

#resultados-financiero .resultado-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

#resultados-financiero .resultado-valor {
    display: block;
    font-size: 1.2em;
    font-weight: 700;
    color: #007bff;
}

#resultados-financiero .resultados-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.datos-lista {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
}

.datos-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.datos-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.datos-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.datos-item-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.datos-item-date {
    color: #6c757d;
    font-size: 14px;
}

.datos-item-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.datos-metric {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.datos-metric-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.datos-metric-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.datos-item-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.datos-empty {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
}

.datos-loading {
    text-align: center;
    color: #007bff;
    padding: 40px 20px;
}

.datos-error {
    text-align: center;
    color: #dc3545;
    padding: 40px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

/* Estilos para vista consolidada */
.vista-consolidada {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
}

.presupuesto-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.presupuesto-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.presupuesto-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.presupuesto-section-actions {
    display: flex;
    gap: 10px;
}

.presupuesto-section-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.presupuesto-metric {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    border-left: 4px solid #007bff;
}

.presupuesto-metric-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.presupuesto-metric-value {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.presupuesto-fases {
    margin-top: 15px;
}

.presupuesto-fases h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 14px;
}

.fases-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.fases-table th,
.fases-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.fases-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.fases-table tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px dashed #dee2e6;
}

/* Estilos para la sección de dietas guardadas */
.dietas-guardadas-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.dietas-guardadas-section h4 {
    color: #495057;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.lista-dietas-guardadas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.dieta-guardada-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.dieta-guardada-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.dieta-guardada-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dieta-guardada-nombre {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.dieta-guardada-costo {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
}

.dieta-guardada-fecha {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.dieta-guardada-acciones {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.btn-dieta-guardada {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ver-dieta {
    background: #007bff;
    color: white;
}

.btn-ver-dieta:hover {
    background: #0056b3;
}

.btn-eliminar-dieta {
    background: #dc3545;
    color: white;
}

.btn-eliminar-dieta:hover {
    background: #c82333;
}

/* Estilos para el presupuesto financiero */
.info-section {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-section h4 {
    color: #1976d2;
    margin-bottom: 15px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.info-label {
    font-weight: 500;
    color: #424242;
}

.info-value {
    font-weight: bold;
    color: #1976d2;
}

.rubros-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.rubros-controls h4 {
    color: #495057;
    margin-bottom: 15px;
}

.rubros-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tabla-presupuesto-financiero {
    margin-bottom: 20px;
    overflow-x: auto;
}

.presupuesto-financiero-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
}

.presupuesto-financiero-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.presupuesto-financiero-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
    font-size: 14px;
}

.presupuesto-financiero-table tbody tr {
    transition: all 0.2s ease;
}

.presupuesto-financiero-table tbody tr:hover {
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.presupuesto-financiero-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.presupuesto-financiero-table tfoot {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    font-weight: bold;
}

.total-row td {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
    color: white;
    font-size: 16px;
    padding: 20px 16px;
    font-weight: 700;
}

.rubro-financiero-row {
    transition: all 0.3s ease;
}

.rubro-financiero-row.editing {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.rubro-nombre-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.rubro-nombre-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rubro-monto-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.rubro-monto-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rubro-monto-input[readonly] {
    background: #e8f4fd;
    border-color: #4facfe;
    color: #1976d2;
    font-weight: 700;
}

.rubro-porcentaje {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.rubro-porcentaje.valid {
    color: #28a745;
    background: #d4edda;
    border-color: #c3e6cb;
}

.rubro-porcentaje.invalid {
    color: #dc3545;
    background: #f8d7da;
    border-color: #f5c6cb;
}

.rubro-porcentaje-actual {
    font-size: 13px;
    color: #495057;
    font-weight: 600;
    background: #e3f2fd;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid #bbdefb;
}

.rubro-costo-kg {
    font-size: 14px;
    font-weight: 600;
    color: #1976d2;
    background: #e8f5e8;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
    text-align: right;
}

.rubro-acciones {
    display: flex;
    gap: 5px;
}

.btn-rubro-financiero {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-editar-rubro-financiero {
    background: #ffc107;
    color: #212529;
}

.btn-editar-rubro-financiero:hover {
    background: #e0a800;
}

.btn-guardar-rubro-financiero {
    background: #28a745;
    color: white;
}

.btn-guardar-rubro-financiero:hover {
    background: #218838;
}

.btn-eliminar-rubro-financiero {
    background: #dc3545;
    color: white;
}

.btn-eliminar-rubro-financiero:hover {
    background: #c82333;
}

.resumen-presupuesto-financiero {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.resumen-presupuesto-financiero .resumen-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.resumen-presupuesto-financiero .resumen-item:last-child {
    margin-bottom: 0;
}

.resumen-presupuesto-financiero .resumen-label {
    font-weight: 600;
    color: #155724;
    font-size: 16px;
}

.resumen-presupuesto-financiero .resumen-valor {
    font-weight: bold;
    color: #155724;
    font-size: 18px;
}

/* Estilos para el modal de agregar rubro */
.modal-rubro-financiero {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content-rubro {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header-rubro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header-rubro h3 {
    margin: 0;
    color: #495057;
}

.close-modal-rubro {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

.close-modal-rubro:hover {
    color: #dc3545;
}

.form-group-rubro {
    margin-bottom: 15px;
}

.form-group-rubro label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group-rubro input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.form-group-rubro input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.modal-actions-rubro {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Limpieza de reglas conflictivas */
.content, .workspace, .workspace-content, main { 
    margin-left: 0 !important; 
} 
/* El desplazamiento lo da body.has-sidebar via padding-left */

/* ===== DISEÑO PRINCIPAL MEJORADO ===== */

/* Panel principal */
.main-content {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 24px;
    padding-top: 24px; /* Mantener padding superior normal */
    position: relative;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

/* Estilos para el título de la sección actual */
.workspace-title {
    display: none !important; /* Ocultar título global duplicado */
}

/* Asegurar que no se muestre el h2 duplicado dentro de main-content */
#main-content > .workspace-title,
#main-content > h2 {
    display: none !important;
}

.workspace-title h2 {
    margin: 0;
    color: #495057;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Asegurar que los formularios activos sean visibles */
.form-container.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 100 !important;
    position: relative !important;
}

/* Estilos para el panel principal de DATOS */
.datos-options {
    padding: 20px;
}

.datos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.datos-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.datos-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.datos-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
}

.datos-card h3 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 1.25rem;
    font-weight: 600;
}

.datos-card p {
    margin: 0;
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Pantalla de bienvenida */
.welcome-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 48px);
    padding: 40px 20px;
}

/* Centrar welcome screen específicamente */
#welcome-screen {
    min-height: calc(100vh - 48px);
    height: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.logo-container {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    animation: fadeInUp 0.8s ease-out;
    margin: 0 auto; /* Centrado horizontal adicional */
}

.main-logo {
    max-width: 400px;
    width: 400px;
    height: auto;
    margin-bottom: 30px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
    object-fit: contain;
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* Animación de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Contenedores de formularios ocultos por defecto */
.form-container {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 20px;
    padding: 30px;
    animation: fadeInUp 0.5s ease-out;
}

.form-container.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .logo-container {
        padding: 40px 20px;
        margin: 20px;
    }
    
    .main-logo {
        max-width: 300px;
        width: 300px;
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .welcome-subtitle {
        font-size: 14px;
    }
}

/* ===== CSS DEFENSIVO PARA NAVEGACIÓN ===== */

/* Contenedor de vistas */
.view-root { 
    min-height: calc(100vh - 120px); 
    padding: 16px; 
    position: relative;
    z-index: 1;
}

/* Placeholder con logo */
.logo-placeholder { 
    display: grid; 
    place-items: center; 
    min-height: 50vh; 
    opacity: 0.9;
}

.logo-placeholder img { 
    max-width: 260px; 
    height: auto; 
    filter: drop-shadow(0 8px 18px rgba(0,0,0,.12)); 
}

/* Título de sección */
.section-title { 
    font-size: 20px; 
    font-weight: 700; 
    margin: 6px 0 14px; 
    color: #1e293b;
}

/* Blindaje: el main no debe tener display:none ni quedar cubierto */
#main, #main-content { 
    position: relative; 
    z-index: 1; 
    min-height: 100vh;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Asegurar que los contenedores de formularios sean visibles cuando están activos */
.form-container.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Estilos específicos para presupuesto financiero */
#presupuesto-financiero-container {
    display: none !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    margin: 20px !important;
    padding: 30px !important;
    min-height: 400px !important;
}

#presupuesto-financiero-container.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Estilos para resultados de presupuesto de alimentos */
#resultados-alimentos-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.resultados-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.resultados-header h3 {
    color: #1e40af;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.resultados-header p {
    color: #64748b;
    font-size: 0.95rem;
}

.resultados-table {
    margin-bottom: 20px;
}

.resultados-table .presupuesto-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.resultados-table .presupuesto-table th {
    background: #f8fafc;
    color: #374151;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.resultados-table .presupuesto-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #374151;
}

.resultados-table .presupuesto-table .separator-row {
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
}

.resultados-table .presupuesto-table .total-row {
    background: #1e40af;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.resultados-table .presupuesto-table .total-row td {
    border-bottom: none;
    padding: 16px;
}

.resultados-actions {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.resultados-actions .btn {
    padding: 10px 24px;
    font-weight: 500;
}

/* ====== ESTILOS PARA MODAL IMPORTAR EXCEL ====== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
}

.modal-large {
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #495057;
    font-size: 1.5rem;
}

.close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.upload-section {
    margin-bottom: 20px;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background-color: #e3f2fd;
    border-radius: 5px;
    margin-top: 10px;
}

.file-name {
    font-weight: 500;
    color: #1976d2;
}

/* Estilos para pestañas */
.tabs-container {
    margin-top: 20px;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

.tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Controles de pestañas */
.tab-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-controls label {
    font-weight: 500;
    margin: 0;
}

.action-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Estilos para tablas de datos */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 10px;
}

.data-table th,
.data-table td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid #dee2e6;
    white-space: nowrap;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table tbody tr.selected {
    background-color: #e3f2fd;
}

.data-table input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.table-container {
    max-height: 400px;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

/* Formato de números */
.data-table .currency {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.data-table .number {
    text-align: right;
}

.data-table .date {
    text-align: center;
}

/* Botones de acción */
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Estilos para el panel principal de navegación */
.main-panel {
    width: 100%;
    min-height: 100vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
}

.panel-header .title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.panel-content {
    padding: 30px;
    min-height: calc(100vh - 100px);
    height: auto;
    overflow: visible;
}

/* Estilos específicos para vistas de Datos */
.datos-index {
    max-width: 1200px;
    margin: 0 auto;
}

.datos-header {
    text-align: center;
    margin-bottom: 40px;
}

.datos-header h2 {
    color: #333;
    margin-bottom: 10px;
}

.datos-header p {
    color: #666;
    font-size: 1.1rem;
}

/* Estilos para vista de Portarex */
.portarex-view {
    max-width: 800px;
    margin: 0 auto;
}

.portarex-header {
    text-align: center;
    margin-bottom: 30px;
}

.portarex-header h2 {
    color: #333;
    margin-bottom: 10px;
}

.portarex-header p {
    color: #666;
    font-size: 1.1rem;
}

.portarex-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.portarex-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
}

.portarex-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.portarex-section p {
    color: #666;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.data-display {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    margin-top: 15px;
}

.data-item {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f3f4;
}

.data-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.data-item strong {
    color: #333;
}

/* Estilos para funcionalidades de DATOS */

/* Rubros */
.rubros-section {
    max-width: 800px;
    margin: 0 auto;
}

.rubros-lista {
    margin-top: 20px;
}

.rubro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.rubro-nombre {
    font-weight: 500;
    color: #333;
}

/* Inputs Mensuales */
.inputs-section {
    max-width: 600px;
    margin: 0 auto;
}

/* Descargar Plantillas */
.descarga-section {
    max-width: 800px;
    margin: 0 auto;
}

.plantillas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.plantilla-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.plantilla-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.1);
    transform: translateY(-2px);
}

.plantilla-card h4 {
    color: #333;
    margin-bottom: 10px;
}

.plantilla-card p {
    color: #666;
    margin: 0;
}

/* Gestión de Impagos */
.impagos-section {
    max-width: 800px;
    margin: 0 auto;
}

.impagos-lista {
    margin-top: 20px;
}

.impago-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
}

.impago-info {
    flex: 1;
}

.impago-item button {
    margin-left: 10px;
}

/* Prorratear Pagos */
.prorrateo-section {
    max-width: 600px;
    margin: 0 auto;
}

.prorrateo-resultado {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.prorrateo-resultado h4 {
    color: #333;
    margin-bottom: 15px;
}

.prorrateo-resultado ul {
    list-style: none;
    padding: 0;
}

.prorrateo-resultado li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.prorrateo-resultado li:last-child {
    border-bottom: none;
}

/* ========================================================================
   REPORTES PRODUCTIVOS - Producción Mensual
   ======================================================================== */

.reportes-produccion-mensual .card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    margin: 20px 0;
}

.reportes-produccion-mensual .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.reportes-produccion-mensual .card-header h2 {
    font-size: 18px;
    margin: 0;
    color: #1f2937;
}

.reportes-produccion-mensual .card-body {
    padding: 20px;
}

.reportes-produccion-mensual .actions {
    display: flex;
    gap: 8px;
}

.reportes-produccion-mensual .actions .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.reportes-produccion-mensual .chart-wrap {
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 20px;
}

.reportes-produccion-mensual .barchart {
    font-family: system-ui, -apple-system, sans-serif;
}

.reportes-produccion-mensual .barchart .bar {
    fill: #4F46E5;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.reportes-produccion-mensual .barchart .bar:hover {
    opacity: 1;
}

.reportes-produccion-mensual .barchart .grid {
    stroke: #e5e7eb;
    stroke-width: 1;
}

.reportes-produccion-mensual .barchart .tick {
    font-size: 11px;
    fill: #6b7280;
}

.reportes-produccion-mensual .table-wrap {
    margin-top: 20px;
    overflow-x: auto;
}

.reportes-produccion-mensual .table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.reportes-produccion-mensual .table th,
.reportes-produccion-mensual .table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.reportes-produccion-mensual .table thead th {
    background: #f9fafb;
    text-align: left;
    font-weight: 600;
    color: #374151;
}

.reportes-produccion-mensual .table tbody tr:hover {
    background: #f9fafb;
}

.reportes-produccion-mensual .table tbody td b {
    color: #4F46E5;
    font-weight: 600;
}

/* Estilos de impresión para PDF */
@media print {
    .reportes-produccion-mensual .actions {
        display: none;
    }
    
    .reportes-produccion-mensual .chart-wrap {
        page-break-inside: avoid;
    }
    
    .reportes-produccion-mensual .table {
        page-break-inside: auto;
    }
    
    .reportes-produccion-mensual .table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ================= PF (PorciFinanzas) estilos locales para Producción Mensual ================= */
.pf-card{background:#fff;border-radius:14px;box-shadow:0 6px 18px rgba(0,0,0,.06);margin:12px 0;border:1px solid #eef2ff;}
.pf-card-head{display:flex;justify-content:space-between;align-items:center;padding:14px 18px;border-bottom:1px solid #eef2ff;background:#f8fafc;border-radius:14px 14px 0 0;}
.pf-title{font-weight:600;font-size:16px;color:#0f172a;}
.pf-actions .pf-btn{background:#eef2ff;border:1px solid #e5e7eb;border-radius:10px;padding:6px 10px;margin-left:8px;color:#1f2937;cursor:pointer}
.pf-actions .pf-btn:hover{background:#e0e7ff}
.pf-card-body{padding:16px;}
.pf-empty{color:#64748b;padding:12px 6px}

.pf-table-wrap{overflow:auto;border-radius:12px;border:1px solid #e5e7eb;}
.pf-table{width:100%;border-collapse:separate;border-spacing:0;min-width:620px;}
.pf-table thead th{position:sticky;top:0;background:linear-gradient(180deg,#ecf3ff,#e6eeff);color:#334155;font-weight:700;
  text-transform:none;font-size:12px;letter-spacing:.3px;border-bottom:1px solid #dbeafe;padding:10px 12px}
.pf-table tbody td{padding:10px 12px;border-bottom:1px solid #f1f5f9;font-size:13px;color:#0f172a;white-space:nowrap}
.pf-table tbody tr:hover{background:#f8fafc}
.pf-col-mes{font-weight:600;color:#1e293b}

.pf-badge{display:inline-block;padding:4px 8px;border-radius:999px;font-weight:700;font-size:12px}
.pf-badge-ok{background:#ecfdf5;color:#065f46;border:1px solid #a7f3d0}
.pf-badge-warn{background:#fef2f2;color:#991b1b;border:1px solid #fecaca}

.pf-chart-wrap{margin-top:16px;overflow:auto;padding:8px;border:1px dashed #e5e7eb;border-radius:12px;background:#fbfdff}
.pf-barchart{font-family:system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;}
.pf-grid{stroke:#e5e7eb;stroke-width:1}
.pf-axis{stroke:#cbd5e1;stroke-width:1}
.pf-tick{font-size:11px;fill:#64748b}
.pf-tick-x{font-size:11px;fill:#475569}
.pf-axis-title{font-size:12px;fill:#64748b}
.pf-bar-ok{fill:#3b82f6;opacity:.92}
.pf-bar-warn{fill:#ef4444;opacity:.85}

/* imprime prolijo */
@media print{
 .pf-actions{display:none}
 .pf-chart-wrap{border:none}
}

/* ===== PF filtros Producción Mensual ===== */
.pf-filterbar{display:flex;flex-direction:column;gap:8px;margin-bottom:10px}
.pf-filter-row{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end}
.pf-filter-group{display:flex;flex-direction:column;gap:6px;min-width:140px}
.pf-filter-group label{font-size:12px;color:#475569}
.pf-filter-group select{padding:6px 8px;border:1px solid #e5e7eb;border-radius:8px;background:#fff;color:#0f172a}
.pf-filter-group.pf-disabled{opacity:.5}
.pf-filter-actions .pf-btn{background:#eef2ff;border:1px solid #e5e7eb;border-radius:10px;padding:6px 12px;color:#1f2937;cursor:pointer}
.pf-filter-actions .pf-btn:hover{background:#e0e7ff}
.pf-data-wrap{margin-top:6px}

/* ===== Ajustes para labels del gráfico ===== */
.rotated-30 { transform: rotate(-30deg); transform-origin: center; }
.rotate-90 { transform: rotate(-90deg); transform-origin: center; }
.pf-tick-x { font-size: 11px; fill: #334155; }

/* Extractor Automático */
.extractor-section {
    max-width: 600px;
    margin: 0 auto;
}

.progreso-extraccion {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    transition: width 0.3s ease;
}

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert h4 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.alert p {
    margin: 0;
}

/* Panel de trabajo: layout simple y ancho completo para formularios */
#main-panel .panel-content {
    display: block;
}

#main-panel .panel-content .form-container {
    width: 100%;
    max-width: 100%;
    float: none;
    clear: both;
}

/* ====== SISTEMA DE NAVEGACIÓN UNIFICADO ====== */

/* Panel principal - siempre visible */
#main-panel {
    display: block !important;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible;
    min-width: 0;
    box-sizing: border-box;
}

#main-panel .panel-content {
    padding: 20px;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Form containers - ocultos por defecto */
#main-panel .form-container {
    display: none;
}

#main-panel .form-container.active {
    display: block;
}

/* Limpieza de residuos visuales - elementos dentro del panel */
#main-panel .panel-content .form-container,
#main-panel .panel-content .form-container * {
    float: none;
}

#main-panel .panel-content .form-container,
#main-panel .panel-content .excel-toolbar,
#main-panel .panel-content .excel-preview,
#main-panel .panel-content [data-excel-sticky] {
    position: static !important;
    width: auto;
    max-width: 100%;
}

#main-panel .panel-content .excel-preview {
    overflow: auto;
}

/* ====== ESTILOS PARA MODAL DE IMPORTACIÓN EXPANDIDO ====== */

/* Estilos para celdas editables */
.cell-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    font-size: 13px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.cell-input:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
}

.cell-input:focus {
    outline: none;
    border-color: #1e40af;
    background-color: white;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

/* Estilos para filas seleccionadas */
tr.selected {
    background-color: #eff6ff !important;
}

tr.selected td {
    background-color: #eff6ff !important;
}

/* Estilos para checkboxes */
.row-checkbox, #select-all-egresos, #select-all-ingresos {
    cursor: pointer;
}

/* Estilos para botones de acción */
.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-outline {
    background-color: transparent;
    border-color: #6c757d;
    color: #6c757d;
}

.btn-outline:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Estilos para pestañas mejoradas */
.tab-btn {
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background-color: #f8f9fa !important;
}

/* Estilos para modal expandido */
.modal-content {
    max-height: 90vh;
    overflow: hidden;
}

.modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

/* Estilos para tabla responsive */
.table-container {
    overflow-x: auto;
}

.table-container table {
    min-width: 100%;
}

/* Estilos para inputs de fecha */
input[type="date"] {
    font-family: inherit;
}

/* Estilos para inputs numéricos */
input[type="number"] {
    text-align: right;
}

/* Estilos para información de tabla */
.table-info {
    font-size: 14px;
}

/* Estilos para contadores de pestañas */
.tab-btn {
    position: relative;
}

/* Mejoras de accesibilidad */
.cell-input:focus-visible {
    outline: 2px solid #1e40af;
    outline-offset: 1px;
}

/* Estilos para filas vacías */
tr:empty {
    display: none;
}

/* ===== Filtro estilo Power BI ===== */
.pf-filterbox{display:flex;align-items:center;gap:10px;margin-left:auto}
.pf-filter-ui{display:flex;align-items:flex-end;gap:10px}
.pf-filter-item{display:flex;flex-direction:column;gap:6px}
.pf-filter-item label{font-size:12px;color:#475569}
.pf-filter-item select{padding:6px 8px;border:1px solid #e5e7eb;border-radius:8px;background:#fff;color:#0f172a;min-width:120px}

.pf-month-dd{position:relative}
.pf-month-dd.pf-disabled{opacity:.5}
.pf-dd-btn{padding:6px 10px;border:1px solid #e5e7eb;border-radius:8px;background:#fff;cursor:pointer}
.pf-dd-panel{position:absolute;top:100%;left:0;z-index:50;width:260px;max-height:320px;overflow:auto;background:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.08);padding:8px}
.pf-dd-header,.pf-dd-footer{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px}
.pf-mini{background:#f1f5f9;border:1px solid #e5e7eb;border-radius:8px;padding:4px 8px;font-size:12px;cursor:pointer}
.pf-qtr{border:1px dashed #e5e7eb;border-radius:10px;padding:6px;margin-bottom:6px}
.pf-qtr-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;color:#334155;font-weight:600}
.pf-qtr-body{display:grid;grid-template-columns:1fr 1fr;gap:4px}
.pf-check{display:flex;align-items:center;gap:6px;font-size:13px;color:#0f172a}

.pf-filter-actions .pf-btn,
.pf-dd-footer .pf-btn{background:#eef2ff;border:1px solid #e5e7eb;border-radius:10px;padding:6px 12px;color:#1f2937;cursor:pointer}
.pf-filter-actions .pf-btn:hover,
.pf-dd-footer .pf-btn:hover{background:#e0e7ff}

/* ===== PRD-26 Presupuesto sanitario: tabla ≥1400px, cards <1400px =====
   Diagnóstico típico: reglas con solo #presupuesto-sanitario-container .ps-layout-*
   pueden perder ante otra hoja o por orden; anclar a .ps-items-responsive-wrap sube especificidad.
   El listado móvil se crea en JS (ensureResponsiveWrap); sin wrapper no aplican estas reglas. */
#presupuesto-sanitario-container .ps-items-responsive-wrap {
    width: 100%;
}
/* Por defecto (viewport ancho): tabla visible; cards ocultos hasta que aplique max-width */
#presupuesto-sanitario-container .ps-items-responsive-wrap .ps-layout-mobile {
    display: none;
}
#presupuesto-sanitario-container .ps-items-responsive-wrap .ps-layout-desktop {
    display: table;
    width: 100%;
}
/* MOBILE: cards visibles, tabla oculta */
@media (max-width: 1399px) {
    #presupuesto-sanitario-container .ps-items-responsive-wrap .ps-layout-desktop {
        display: none !important;
    }
    #presupuesto-sanitario-container .ps-items-responsive-wrap .ps-layout-mobile {
        display: block !important;
    }
    #presupuesto-sanitario-container .ps-card.ps-sec .ps-sec-body > div:first-child {
        overflow-x: visible !important;
    }
}
/* DESKTOP: tabla visible, cards ocultos */
@media (min-width: 1400px) {
    #presupuesto-sanitario-container .ps-items-responsive-wrap .ps-layout-desktop {
        display: table !important;
        width: 100%;
    }
    #presupuesto-sanitario-container .ps-items-responsive-wrap .ps-layout-mobile {
        display: none !important;
    }
}
#presupuesto-sanitario-container .ps-layout-mobile.ps-items-list {
    padding: 4px 0 8px;
}
#presupuesto-sanitario-container .ps-row {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fff;
    padding: 8px;
}
#presupuesto-sanitario-container .ps-row-main,
#presupuesto-sanitario-container .ps-row-secondary {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
#presupuesto-sanitario-container .ps-producto {
    flex: 1;
    min-width: 160px;
}
#presupuesto-sanitario-container .ps-base-wrap {
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 220px;
}
#presupuesto-sanitario-container .ps-base-wrap select {
    width: 100%;
    font-size: 12px;
    padding: 4px 6px;
}
#presupuesto-sanitario-container .ps-unidad {
    flex: 1;
    min-width: 120px;
}
#presupuesto-sanitario-container .ps-field-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#presupuesto-sanitario-container .ps-field-group label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}
#presupuesto-sanitario-container .ps-field-group .ps-inp {
    width: 100%;
    max-width: 110px;
    font-size: 13px;
    padding: 4px 6px;
}
#presupuesto-sanitario-container .ps-row-secondary .ps-unidad {
    max-width: none;
}
#presupuesto-sanitario-container .ps-row-secondary .ps-field-group .ps-inp {
    max-width: 100%;
}
#presupuesto-sanitario-container .ps-costo-mes.ps-costo-val {
    font-weight: 700;
    color: #1e40af;
    font-size: 14px;
    min-width: 100px;
    text-align: right;
    align-self: flex-end;
    padding-bottom: 4px;
    border: none;
    background: transparent;
}
#presupuesto-sanitario-container .ps-row-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    align-self: flex-end;
}
#presupuesto-sanitario-container .ps-row-hint {
    font-size: 11px;
    color: #64748b;
    padding: 2px 2px 0;
    line-height: 1.35;
}

/* —— Stock sanitario: pedido de cotización (cards por sección) —— */
.ss-pedido-v2-header {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 16px 18px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
}
.ss-pedido-v2-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 14px;
}
.ss-pedido-v2-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
}
.ss-pedido-v2-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.ss-pedido-v2-prov {
    color: #475569;
    line-height: 1.45;
}
.ss-pedido-v2-prov strong {
    color: #334155;
}
.ss-pedido-sec-card {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.ss-pedido-sec-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #0f172a;
    padding: 12px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.ss-pedido-sec-tbl {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
}
.ss-pedido-sec-tbl th,
.ss-pedido-sec-tbl td {
    border-bottom: 1px solid #f1f5f9;
    padding: 10px 12px;
    vertical-align: top;
}
.ss-pedido-sec-tbl thead th {
    background: #fafafa;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: none;
}
.ss-pedido-sec-tbl .ss-pedido-col-prod {
    width: 42%;
}
.ss-pedido-sec-tbl .ss-pedido-col-uni {
    width: 22%;
}
.ss-pedido-sec-tbl .ss-pedido-col-qty {
    width: 18%;
    text-align: center;
}
.ss-pedido-sec-tbl .ss-pedido-col-sub {
    width: 18%;
    text-align: right;
}
.ss-pedido-name {
    font-weight: 700;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.35;
}
.ss-pedido-uni {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}
.ss-pedido-hint {
    font-size: 11px;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.35;
}
.ss-pedido-row--critico td {
    background: #fff5f5;
}
.ss-pedido-row--atencion td {
    background: #fffbeb;
}
.ss-pedido-row--ok td {
    background: #f0fdf4;
}
.ss-pedido-row--sin-consumo td {
    background: #f8fafc;
}
.ss-pedido-qty-inp {
    width: 70px;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    padding: 4px 6px;
}
.ss-pedido-qty-inp.ss-pedido-qty-positive {
    color: #1d4ed8;
    font-weight: 700;
}
.ss-pedido-qty-inp.ss-pedido-qty-zero {
    color: #94a3b8;
    font-weight: 400;
}
.ss-pedido-sec-subrow td {
    background: #f8fafc;
    font-size: 13px;
    border-bottom: none;
}
.ss-pedido-v2-resumen {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 16px 18px;
    margin-bottom: 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: 13px;
}
.ss-pedido-v2-resumen-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    color: #334155;
}
.ss-pedido-v2-resumen-line strong {
    color: #0f172a;
}
.ss-pedido-v2-resumen-hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 10px 0 8px;
}
.ss-pedido-v2-resumen-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    padding-top: 4px;
}
.ss-pedido-sec-tbl .text-end {
    text-align: right;
}
.ss-pedido-v2-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
    margin-bottom: 10px;
}
.ss-pedido-foot-hint {
    font-size: 12px;
    margin-top: 0;
    margin-bottom: 0;
}