/* ============================================
   SALDOS INICIALES DE INVENTARIO
   ============================================ */

.sdi-container {
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sdi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.sdi-header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

/* Botones */
.sdi-btn-primary {
    padding: 7px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #1A4480;
    color: #fff;
    transition: background 0.2s;
}

.sdi-btn-primary:hover {
    background: #153670;
}

.sdi-btn-secondary {
    padding: 7px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    color: #475569;
    transition: background 0.2s;
}

.sdi-btn-secondary:hover {
    background: #f1f5f9;
}

.sdi-btn-success {
    padding: 7px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #10B981;
    color: #fff;
}

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

.sdi-btn-danger {
    padding: 7px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #dc2626;
    color: #fff;
}

.sdi-btn-danger:hover {
    background: #b91c1c;
}

.sdi-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s;
    font-size: 0.78rem;
}

.sdi-action-btn:hover {
    background: #f1f5f9;
}

/* Filtros */
.sdi-filtros {
    display: flex;
    gap: 8px;
    padding: 8px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
}

/* Tabla */
.sdi-tabla-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px;
}

.sdi-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.sdi-tabla thead th {
    background: #1A4480;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    padding: 8px 10px;
    text-align: left;
    position: sticky !important;
    top: 0;
    z-index: 1;
    letter-spacing: 0.5px;
}
.sdi-tabla thead tr th:first-child { border-radius: 6px 0 0 0; }
.sdi-tabla thead tr th:last-child { border-radius: 0 6px 0 0; }

.sdi-tabla tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.7rem;
}

.sdi-tabla tbody tr:hover {
    background: #f8fafc;
}

/* Paginación */
.sdi-paginacion {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 8px 24px;
}

.sdi-page-btn {
    padding: 4px 10px;
    font-size: 0.72rem;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    color: #475569;
    transition: background 0.15s;
}

.sdi-page-btn:hover {
    background: #f1f5f9;
}

.sdi-page-btn.active {
    background: #1A4480;
    color: #fff;
    border-color: #1A4480;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

/* Formulario */
#pageSaldosIniciales #sdiFormulario {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sdi-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.sdi-form-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.sdi-form-cab {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 18px;
    margin: 12px 24px;
    flex-shrink: 0;
}

.sdi-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    gap: 8px 14px;
    align-items: end;
}

.sdi-form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sdi-form-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
}

.sdi-form-group input,
.sdi-form-group select {
    padding: 6px 10px;
    font-size: 0.78rem;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.sdi-form-group input:focus,
.sdi-form-group select:focus {
    outline: none;
    border-color: #1A4480;
    box-shadow: 0 0 0 2px rgba(26, 68, 128, 0.15);
}

/* Detalle */
.sdi-form-detalle {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 0 24px 12px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sdi-detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.sdi-detalle-header h4 {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: #1e293b;
}

.sdi-detalle-table-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sdi-detalle-tabla {
    font-size: 0.84rem;
}

.sdi-detalle-tabla thead th {
    position: sticky !important;
    top: 0;
    padding: 7px 8px;
    background: #1A4480;
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sdi-detalle-tabla tbody td {
    padding: 4px 6px;
    font-size: 0.7rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.sdi-detalle-tabla input,
.sdi-detalle-tabla select {
    padding: 4px 7px;
    font-size: 0.72rem;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    width: 100%;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.sdi-detalle-tabla input:focus,
.sdi-detalle-tabla select:focus {
    outline: none;
    border-color: #1A4480;
}

.sdi-detalle-totales {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    padding: 7px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.78rem;
    color: #475569;
}

.sdi-detalle-totales strong {
    color: #1e293b;
    font-weight: 700;
}

/* Autocomplete */
.sdi-articulo-wrap {
    position: relative;
}

.sdi-autocomplete-dd {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

.sdi-ac-item {
    padding: 6px 10px;
    font-size: 0.72rem;
    cursor: pointer;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.sdi-ac-item:hover {
    background: #eef2ff;
    color: #1A4480;
}

/* Acciones del formulario */
.sdi-form-acciones {
    display: flex;
    gap: 8px;
    padding: 8px 24px 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.sdi-detalle-tabla input:focus,
.sdi-detalle-tabla select:focus {
    outline: none;
    border-color: #1A4480;
    box-shadow: 0 0 0 2px rgba(26,68,128,0.2);
}

#pageSaldosIniciales input:focus,
#pageSaldosIniciales select:focus,
#pageSaldosIniciales textarea:focus {
    border-color: var(--azul-400);
    box-shadow: 0 0 0 3px rgba(37,99,160,0.12);
    outline: none;
}
#pageSaldosIniciales *:focus:not(input):not(select):not(textarea):not(button),
#pageSaldosIniciales *:focus-visible:not(input):not(select):not(textarea):not(button) {
    outline: none !important;
}
