body {
    margin: 0;
    padding: 0;
    background: #f4f6f9;
}

/* SOLO LOGIN */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    width: 400px;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0px 0px 15px rgba(50, 146, 12, .6);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 20px;
}

/* Mensaje emergente */

.toast-mensaje {

    position: fixed;
    top: 20px;
    right: 20px;

    background: #1B5E20;
    color: white;

    padding: 15px 25px;

    border-radius: 10px;

    box-shadow: 0 0 15px rgba(0, 0, 0, .3);

    opacity: 0;

    transform: translateX(100px);

    transition: all .5s ease;

    z-index: 9999;

}

.toast-mensaje.mostrar {

    opacity: 1;

    transform: translateX(0);

}

.toast-error {

    background: #d32f2f;
}

/* Dashboard */
.mi-navbar {
    background: linear-gradient(90deg, #06550c, #4a794c);
}

.navbar {
    width: 100%;
}

.container {
    margin-top: 20px;
}

.card {
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(72, 255, 0, 0.534);
}

.eliminar-btn {

    width: 35px;
    height: 35px;

    padding: 0;

    border-radius: 50%;

    transition: 0.3s;

}

.eliminar-btn:hover {

    transform: scale(1.1);

}



.editar-btn {

    width: 35px;
    height: 35px;

    padding: 0;

    border-radius: 50%;

    margin-right: 5px;

    transition: .3s;

}

.editar-btn:hover {

    transform: scale(1.1);

}

.mi-navbar {

    background: linear-gradient(90deg,
            #06550c,
            #4a794c);

    padding: 12px;

}


/* Flecha */

.btn-outline-light {

    border-radius: 50%;

    width: 40px;

    height: 40px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 20px;

    padding: 0;

}


/* Animación suave */

.btn {

    transition: .3s;

}

.btn:hover {

    transform: translateY(-2px);

}

/* Scroll para materiales dashboard */

.tabla-scroll {

    max-height: 320px;

    overflow-y: auto;

    border-radius: 10px;

}

/* Mantener encabezado fijo */

.tabla-scroll thead {

    position: sticky;

    top: 0;

    z-index: 1;

}

/* MODO OSCURO */

.dark-mode {

    background-color: #1a1a1a;
    color: white;

}

.dark-mode .card {

    background-color: #2c2c2c;
    color: white;
    border: 1px solid #444;

}

.dark-mode .table {

    color: white;

}

.dark-mode .table thead {

    background: #333;

}

.dark-mode input,
.dark-mode select {

    background: #2c2c2c;
    color: white;
    border: 1px solid #555;

}

.dark-mode .navbar {

    background: #111 !important;

}

/* ======================
   TABLAS MODO OSCURO
====================== */

.dark-mode table {

    background-color: #2b2b2b !important;
    color: white !important;

}

.dark-mode table thead {

    background-color: #333 !important;
    color: white !important;

}

.dark-mode table tbody {

    background-color: #2b2b2b !important;

}

.dark-mode table tr {

    background-color: #2b2b2b !important;
    color: white !important;

}

.dark-mode table td,
.dark-mode table th {

    background-color: #2b2b2b !important;
    color: white !important;
    border-color: #555 !important;

}

/* Hover tabla */

.dark-mode .table tbody tr:hover {

    background-color: #3b3b3b !important;

}

.table-scroll{
    max-height:300px;
    overflow-y:auto;
    border-radius:10px;
}

.table-scroll thead{
    position:sticky;
    top:0;
    z-index:10;
    background:#fff;
}

.tarjeta-tecnico{

    border:none;

    border-radius:20px;

    transition:.30s;

    cursor:pointer;

}

.tarjeta-tecnico:hover{

    transform:translateY(-8px);

    box-shadow:0px 15px 35px rgba(0,0,0,.25);

}

.icono-verde{

    width:90px;

    height:90px;

    margin:auto;

    border-radius:50%;

    background:#198754;

    color:white;

    font-size:45px;

    display:flex;

    align-items:center;

    justify-content:center;

    margin-bottom:20px;

}

.icono-azul{

    width:90px;

    height:90px;

    margin:auto;

    border-radius:50%;

    background:#0d6efd;

    color:white;

    font-size:45px;

    display:flex;

    align-items:center;

    justify-content:center;

    margin-bottom:20px;

}

.scroll-registros{

    max-height:520px;

    overflow:auto;

    border-radius:10px;

    border: 1px solid #dee2e6;

}

.scroll-registros thead,
.scroll-lotes thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.scroll-registros::-webkit-scrollbar,
.scroll-lotes::-webkit-scrollbar{
    width:8px;
    height:8px;
}

.scroll-registros::-webkit-scrollbar-thumb,
.scroll-lotes::-webkit-scrollbar-thumb{
    background:#c9c9c9;
    border-radius:10px;
}

/*==============================
SCROLL ALERTAS DASHBOARD
==============================*/

.scroll-alertas{

    max-height: 380px;

    overflow-y: auto;

    padding-right: 8px;

}

/* Scroll moderno */

.scroll-alertas::-webkit-scrollbar{

    width:8px;

}

.scroll-alertas::-webkit-scrollbar-track{

    background:#f1f1f1;

    border-radius:20px;

}

.scroll-alertas::-webkit-scrollbar-thumb{

    background:#198754;

    border-radius:20px;

}

.scroll-alertas::-webkit-scrollbar-thumb:hover{

    background:#157347;

}

/* ==========================
   MODO OSCURO CONFIGURACIÓN
========================== */

body.dark-mode{
    background: #121212;
    color: #fff;
}

/* Fondo principal */
body.dark-mode .container-fluid,
body.dark-mode .row,
body.dark-mode .col-md-9,
body.dark-mode #contenido{
    background:#121212 !important;
    color:#fff;
}

/* Menú izquierdo */
body.dark-mode .col-md-3{
    background:#1c1c1c !important;
    border-right:1px solid #333 !important;
}

/* Títulos y textos */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode p,
body.dark-mode label,
body.dark-mode span,
body.dark-mode td,
body.dark-mode th{
    color:#fff !important;
}

/* Tablas */
body.dark-mode table{
    background:#1f1f1f;
    color:#fff;
}

body.dark-mode thead{
    background:#2b2b2b;
}

body.dark-mode tbody tr{
    background:#1f1f1f;
}

body.dark-mode tbody tr:hover{
    background:#2a2a2a;
}

/* Cards */
body.dark-mode .card,
body.dark-mode .modal-content{
    background:#1f1f1f;
    color:#fff;
}

/* Inputs */
body.dark-mode .form-control,
body.dark-mode .form-select{
    background:#2a2a2a;
    color:#fff;
    border-color:#444;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus{
    background:#2a2a2a;
    color:#fff;
}

/* ===== KÁRDEX MODO OSCURO ===== */

body.dark-mode .table {
    color: #fff;
}

body.dark-mode .table thead {
    background: #2b2b2b;
    color: white;
}

body.dark-mode .table tbody tr {
    background: #1f1f1f;
    color: white;
}

body.dark-mode .table tbody tr:hover {
    background: #303030;
}

body.dark-mode .card {
    background: #2b2b2b;
    color: white;
}

body.dark-mode .form-select,
body.dark-mode .form-control {
    background: #3a3a3a;
    color: white;
    border-color: #666;
}

body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode label {
    color: white;
}

body.dark-mode .navbar{
    background:#111 !important;
}

body.dark-mode .navbar .navbar-brand{
    color:white;
}

.scroll-lotes {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.scroll-lotes thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

#bienvenidaUsuario {
    font-size: 4.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.text-muted {
    font-size: 1.5rem;
}

.titulo-entrada {
    font-size: 2.5rem;
    font-weight: 600;
    margin-top: 35px;
    margin-bottom: 30px;
}

/* =====================================================
   SELECTORES BUSCABLES - ENTRADA
===================================================== */

.selector-buscable {
    position: relative;
}

.resultados-selector {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;

    background: white;

    border: 1px solid #ced4da;

    border-top: none;

    max-height: 220px;

    overflow-y: auto;

    display: none;

    z-index: 1050;

    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.resultados-selector.mostrar {
    display: block;
}

.resultado-selector {
    padding: 10px 12px;

    cursor: pointer;

    border-bottom: 1px solid #eeeeee;

    background: white;
}

.resultado-selector:hover {
    background: #f1f1f1;
}

/* ==========================================
   FILTRO COMBINADO
   BUSCADOR + BOTÓN ▼
========================================== */

.filtro-combinado {
    position: relative;
    width: 100%;
}


/* ==========================================
   INPUT
========================================== */

.filtro-input {
    width: 100%;
    height: 38px;
    padding: 8px 45px 8px 12px;

    border: 1px solid #ced4da;
    border-radius: 6px;

    background-color: #fff;

    font-size: 0.95rem;

    outline: none;
}


.filtro-input:focus {
    border-color: #86b7fe;

    box-shadow:
        0 0 0 0.25rem
        rgba(13, 110, 253, 0.25);
}


/* ==========================================
   BOTÓN ▼
========================================== */

.filtro-toggle {
    position: absolute;

    top: 0;
    right: 0;

    width: 42px;
    height: 38px;

    border: none;
    border-left: 1px solid #ced4da;

    background: #f8f9fa;

    border-radius: 0 6px 6px 0;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;

    z-index: 3;
}


.filtro-toggle:hover {
    background: #e9ecef;
}


/* ==========================================
   SELECT ORIGINAL OCULTO
========================================== */

.filtro-select-hidden {
    display: none;
}


/* ==========================================
   LISTA DESPLEGABLE
========================================== */

.filtro-dropdown {
    position: absolute;

    top: 100%;
    left: 0;
    right: 0;

    display: none;

    max-height: 220px;

    overflow-y: auto;

    background: #fff;

    border: 1px solid #ced4da;
    border-top: none;

    border-radius: 0 0 6px 6px;

    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.12);

    z-index: 1000;
}


/* ==========================================
   OPCIONES
========================================== */

.filtro-opcion {
    width: 100%;

    padding: 9px 12px;

    border: none;

    background: #fff;

    text-align: left;

    cursor: pointer;

    font-size: 0.95rem;
}


.filtro-opcion:hover {
    background: #f1f3f5;
}


.filtro-opcion.activo {
    background: #e9ecef;
}


/* ==========================================
   CUANDO ESTÁ ABIERTO
========================================== */

.filtro-combinado.abierto .filtro-input {
    border-radius: 6px 6px 0 0;
}

.filtro-combinado.abierto .filtro-toggle {
    border-radius: 0 6px 0 0;
}

.filtro-combinado.abierto .filtro-dropdown {
    display: block;
}

/* ==========================================
   ANCHO DE TARJETAS DE DESMANTELAMIENTO
========================================== */

.container > .card {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   TARJETAS PRINCIPALES DE DESMANTELAMIENTO
========================================== */

.container.mt-4 > .card {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* =========================================
   BUSCAR LOTE
========================================= */

.buscar-lote-contenido {
    width: 70%;
    max-width: 800px;
    margin: 0 auto;
}

.buscar-lote-contenido h5 {
    text-align: left;
}

.buscar-lote-input {
    width: 100%;
}

/* =====================================================
   MODO OSCURO: CONTROLES Y TEXTO GENERADO DINÁMICAMENTE
===================================================== */

body.dark-mode {
    color: #f1f5f9;
}

body.dark-mode small,
body.dark-mode strong,
body.dark-mode legend,
body.dark-mode .card-body,
body.dark-mode .card-header,
body.dark-mode .card-footer,
body.dark-mode .modal-header,
body.dark-mode .modal-body,
body.dark-mode .modal-footer,
body.dark-mode .offcanvas,
body.dark-mode .offcanvas-header,
body.dark-mode .offcanvas-body {
    color: #f1f5f9;
}

body.dark-mode .text-muted {
    color: #b8c2cc !important;
}

body.dark-mode .form-control::placeholder,
body.dark-mode .filtro-input::placeholder {
    color: #b8c2cc;
    opacity: 1;
}

body.dark-mode .form-control:disabled,
body.dark-mode .form-select:disabled {
    background: #242b33;
    color: #9ea9b4;
}

body.dark-mode .form-select option {
    background: #2a2a2a;
    color: #f1f5f9;
}

body.dark-mode .list-group-item,
body.dark-mode .dropdown-menu,
body.dark-mode .dropdown-item,
body.dark-mode .resultados-selector,
body.dark-mode .resultado-selector,
body.dark-mode .filtro-dropdown,
body.dark-mode .filtro-opcion,
body.dark-mode .filtro-input,
body.dark-mode .filtro-toggle {
    background: #242b33;
    color: #f1f5f9;
    border-color: #4b5563;
}

body.dark-mode .list-group-item:hover,
body.dark-mode .dropdown-item:hover,
body.dark-mode .resultado-selector:hover,
body.dark-mode .filtro-opcion:hover,
body.dark-mode .filtro-opcion.activo,
body.dark-mode .filtro-toggle:hover {
    background: #374151;
    color: #ffffff;
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer,
body.dark-mode .card-header,
body.dark-mode .card-footer,
body.dark-mode hr {
    border-color: #4b5563;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode .alert-info {
    background: #12384a;
    border-color: #1a5a78;
    color: #d9f3ff;
}

body.dark-mode .alert-warning {
    background: #4b3511;
    border-color: #87621d;
    color: #fff0c2;
}

body.dark-mode .alert-success {
    background: #153d2a;
    border-color: #287c50;
    color: #d7f8e5;
}

body.dark-mode .alert-danger {
    background: #4a1d24;
    border-color: #8f3443;
    color: #ffe0e4;
}

body.dark-mode .alert-info *,
body.dark-mode .alert-warning *,
body.dark-mode .alert-success *,
body.dark-mode .alert-danger * {
    color: inherit !important;
}

body.dark-mode .scroll-lotes,
body.dark-mode .scroll-registros,
body.dark-mode .scroll-alertas {
    border-color: #4b5563;
}

/* Acciones en los encabezados de los modales */
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-shrink: 0;
}

.modal-header-actions .btn-close {
    margin: 0;
}

/* Filtro compacto de materiales y precios en el dashboard */
.seccion-precios-encabezado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.filtro-precios-dashboard {
    width: min(360px, 100%);
}

.scroll-precios-dashboard {
    margin-top: 0.9rem;
}

.scroll-precios-dashboard thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
}

body.dark-mode .scroll-precios-dashboard thead th {
    background: #2b2b2b;
}

@media (max-width: 575.98px) {
    .modal-header-actions {
        gap: 0.6rem;
    }

    .modal-header-actions .btn {
        padding: 0.35rem 0.55rem;
        font-size: 0.85rem;
    }

    .seccion-precios-encabezado {
        align-items: stretch;
        flex-direction: column;
    }

    .filtro-precios-dashboard {
        width: 100%;
    }
}
