/* ================== VARIABLES ================== */
:root{
  --primary:#10580e;
  --primary-dark:#0b3f0a;
  --white:#ffffff;
  --bg:#eaf4ea;
  --text:#1f2d1f;
  --error:#8e1e1e;
  --warning:#b9770e;
  --success:#1e8449;
}

/* ================== RESET ================== */
*{
  box-sizing:border-box;
  font-family:Arial, Helvetica, sans-serif;
  margin:0;
  padding:0;
}
body{
  margin:0;
  color:var(--text);
}

/* ================== LOGIN ================== */
body.login{
  height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
  background:url('../img/fondo-login.jpg') no-repeat center center;
  background-size:cover;
  position:relative;
}
body.login::before{
  content:"";
  position:absolute;
  inset:0;
  background:rgba(16,88,14,0.5);
  z-index:0;
}
.card{
  background:var(--white);
  padding:32px;
  width:90%;
  max-width:400px;
  border-radius:12px;
  text-align:center;
  box-shadow:0 10px 25px rgba(0,0,0,0.25);
  position:relative;
  z-index:1;
}
h2{
  color:var(--primary);
  margin-bottom:15px;
  font-size:2em;
}
input, select{
  width:100%;
  padding:12px;
  margin:8px 0;
  border:1px solid #cfd8cf;
  border-radius:8px;
  font-size:1em;
}
.btn{
  display:block;
  margin-top:15px;
  padding:12px;
  background:var(--primary);
  color:white;
  border:none;
  border-radius:8px;
  cursor:pointer;
  font-weight:bold;
}
.btn:hover{
  background:var(--primary-dark);
}

/* ================== ALERTAS ================== */
.alerta{
  padding:10px;
  border-radius:8px;
  color:white;
  margin-bottom:10px;
  font-size:0.9em;
}
.alerta.error{background:var(--error);}
.alerta.warning{background:var(--warning);}
.alerta.success{background:var(--success);}
.oculto{display:none;}

/* ================== PANEL ================== */
body.panel{
  display:flex;
  min-height:100vh;
  background:var(--bg);
}

/* ===== MENÚ LATERAL ===== */
.menu-lateral{
  width:220px;
  background:var(--primary);
  color:white;
  flex-shrink:0;
  display:flex;
  flex-direction:column;
  padding-top:20px;
}
.menu-lateral a{
  padding:15px 20px;
  color:white;
  text-decoration:none;
  display:flex;
  align-items:center;
  font-weight:bold;
  transition:0.2s;
}
.menu-lateral a i{
  margin-right:10px;
}
.menu-lateral a:hover,
.menu-lateral a.active{
  background:var(--primary-dark);
}

/* ===== CONTENIDO ===== */
.contenido{
  flex:1;
  padding:20px;
}

.input-readonly {
    padding: 10px 12px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    background-color: #f5f5f5;
    font-weight: bold;
    color: #2e7d32;
    min-width: 220px;
}


/* ================== TABLAS ================== */
table{
  width:100%;
  border-collapse:collapse;
  background:white;
}
table, th, td{
  border:1px solid #cfd8cf;
}
th{
  background:var(--primary);
  color:white;
}
th, td{
  padding:10px;
  text-align:left;
}
table tr:nth-child(even){
  background:#f5faf5;
}
table button{
  margin-right:5px;
  padding:5px 10px;
  border:none;
  border-radius:5px;
  cursor:pointer;
}
table button.edit{
  background:var(--primary);
  color:white;
}
table button.delete{
  background:var(--error);
  color:white;
}



/* ================== RESPONSIVE ================== */
@media(max-width:1100px){
  #form-pedidos{
    grid-template-columns:repeat(2, 1fr);
  }
}
@media(max-width:768px){
  body.panel{
    flex-direction:column;
  }
  .menu-lateral{
    width:100%;
    flex-direction:row;
    overflow-x:auto;
  }
  .menu-lateral a{
    flex:1;
    justify-content:center;
  }
}
@media(max-width:700px){
  #form-pedidos{
    grid-template-columns:1fr;
  }
}



.ver-password{
  position:relative;
}

.ver-password span{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  cursor:pointer;
  font-size:1.1em;
  user-select:none;
}
.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
}

.panel-header i {
    font-size: 30px;
    color: #2e7d32;
}
/* ===== SUBSECCIONES PEDIDOS ===== */
.pedido-subseccion{
  background:white;
  padding:15px;
  border-radius:8px;
  box-shadow:0 4px 10px rgba(0,0,0,0.08);
}
/* ===== BOTONES PEDIDOS EN FILA ===== */
.pedidos-botones{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;        /* Para que bajen en pantallas pequeñas */
  margin-bottom: 15px;
}

.pedidos-botones .btn{
  margin-top: 0;          /* Quita el margen vertical del botón */
  width: auto;            /* Evita que se estiren */
}
/* ===== PESTAÑAS PEDIDOS ===== */
.tabs-pedidos {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
}

.tabs-pedidos .tab-btn {
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: #e6f3e6;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.tabs-pedidos .tab-btn.active {
    background: #2e7d32;
    color: #fff;
}


.tab-btn{
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-weight: bold;
  cursor: pointer;
  color: var(--text);
  border-bottom: 3px solid transparent;
  transition: 0.2s;
}

.tab-btn:hover{
  color: var(--primary);
}

.tab-btn.active{
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
}

/* Contenido */
.pedido-tab{
  background: white;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}


.tab-btn{
  padding:10px 16px;
  border:none;
  border-radius:8px 8px 0 0;
  background:#dfeee0;
  cursor:pointer;
  font-weight:bold;
}

.tab-btn.active{
  background:#ffffff;
  border-bottom:2px solid transparent;
}

.tab-contenido{
  background:white;
  padding:20px;
  border-radius:0 8px 8px 8px;
  box-shadow:0 4px 10px rgba(0,0,0,0.1);
}

.bloque-form{
  max-width:500px;
}

.bloque-form label{
  display:block;
  margin-top:10px;
  font-weight:bold;
}

.bloque-form textarea{
  width:100%;
  min-height:60px;
}
/* ================== FORMULARIO PEDIDOS PLANTA FRANCA ================== */

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.campo {
  display: flex;
  flex-direction: column;
}

.campo label {
  font-weight: 600;
  font-size: 0.85em;
  color: var(--primary);
  margin-bottom: 4px;
}

.campo-full {
  grid-column: 1 / -1;
}

.centro {
  text-align: center;
}

textarea {
  resize: vertical;
  min-height: 70px;
}

/* fila cliente + botón */
.fila {
  display: flex;
  gap: 8px;
}
/* ===== FIX FILA EN MÓVIL ===== */
@media (max-width: 600px) {
    .fila {
        flex-direction: column;
        align-items: stretch;
    }

    .fila > * {
        width: 100%;
    }
}
@media (max-width: 600px) {
    .input-readonly {
        min-width: 0;
        width: 100%;
        font-size: 0.9em;
        text-align: left;
    }
}


/* botón pequeño */
.btn-mini {
  padding: 6px 10px;
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 6px;
  font-size: 0.8em;
  cursor: pointer;
  white-space: nowrap;
}

.btn-mini:hover {
  background: var(--primary);
  color: white;
}

/* bloque nuevo cliente */
.bloque {
  margin-top: 20px;
  background: #eef8ee;
  padding: 15px;
  border-radius: 10px;
  border-left: 5px solid var(--primary);
}

/* responsive */
@media (max-width: 900px) {
  .form-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}




.tabs-catalogo {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tabs-catalogo .tab-btn.active {
    background: #2e7d32;
    color: white;
}



.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.tabs-catalogos {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-cat {
    padding: 8px 14px;
    border: none;
    background: #e4e6eb;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
}

.tab-cat.active {
    background: #2e7d32;
    color: #fff;
}

.catalogo-contenido.oculto {
    display: none;
}


.check-linea {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
}

.check-linea label {
    cursor: pointer;
}


.catalogo-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-catalogo {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #e6f3e6;
    font-weight: 600;
}

.tab-catalogo.active {
    background: #2e7d32;
    color: #fff;
}

.check-linea {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0;
}




.estado-off {
    color: #c62828;
    font-weight: bold;
}



.radio-grupo {
    display: flex;
    gap: 16px;          /* distancia entre No y Sí */
    align-items: center;
}

.radio-grupo label {
    display: flex;
    align-items: center;
    gap: 6px;           /* distancia entre radio y texto */
    cursor: pointer;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* tablets */
@media (max-width: 1100px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* móviles */
@media (max-width: 600px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

.tabla-responsive {
    width: 100%;
    overflow-x: auto;
}

/* ==========================
   MODO MÓVIL
========================== */
@media (max-width: 768px) {

    .tabla {
        border: 0;
    }

    .tabla thead {
        display: none;
    }

    .tabla tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #ddd;
        border-radius: 10px;
        padding: 10px;
        background: #fafafa;
    }

    .tabla td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        font-size: 0.9em;
    }

    .tabla td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        padding-right: 10px;
    }

    .tabla td:last-child {
        justify-content: flex-end;
        gap: 8px;
    }
}


@media (max-width: 768px) {

    .tabs-pedidos {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tabs-pedidos .tab-btn {
        width: 100%;
        padding: 12px;
        font-size: 0.9em;
        text-align: center;
    }
}

@media (max-width: 480px) {

    .tabs-pedidos {
        grid-template-columns: 1fr;
    }

    .tabs-pedidos .tab-btn {
        font-size: 0.95em;
        padding: 14px;
    }
}



.tabs-pedidos .tab-btn {
    white-space: normal;
    line-height: 1.2;
}
/* ===== FORM USUARIOS EN GRID ===== */
.form-usuarios-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.form-usuarios-grid input,
.form-usuarios-grid select {
    width: 100%;
    padding: 10px;
    font-size: 0.95rem;
}

/* 📱 Responsive */
@media (max-width: 900px) {
    .form-usuarios-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .form-usuarios-grid {
        grid-template-columns: 1fr;
    }
}

#usuarios .btn {
    margin-top: 10px;
}

@media (max-width: 600px) {
    .btn-mini {
        width: 100%;
        justify-content: center;
    }
}


/* ===== VALIDACIONES VISUALES ===== */

.input-error {
    border: 2px solid #e53935;
    background-color: #ffebee;
}

.error-text {
    color: #e53935;
    font-size: 0.75rem;
    margin-top: 4px;
    display: none;
}

/* opcional: que los campos tengan separación */
.campo {
    display: flex;
    flex-direction: column;
}


/* ===== VER / OCULTAR CONTRASEÑA ===== */

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 1.1rem;
    opacity: 0.7;
}

.toggle-password:hover {
    opacity: 1;
}

/* ===== ROLES USUARIOS ===== */

.rol-administrador {
    color: #c62828;
    font-weight: bold;
}

.rol-atencion_cliente {
    color: #ef6c00;
    font-weight: 600;
}

.rol-vendedor {
    color: #2e7d32;
    font-weight: 600;
}

.rol-ingeniero {
    color: #1565c0;
    font-weight: 600;
}

.rol-jefe_germinacion {
    color: #6a1b9a;
    font-weight: 600;
}

.rol-jefe_vivero {
    color: #2e7d32;
    font-weight: 600;
}

.rol-jefe_injertos {
    color: #4e342e;
    font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.oculto { display: none; }

.modal-contenido {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  width: 100%;
  max-width: 420px;
}


.btn-toggle {
    font-size: 1.2em;
    cursor: pointer;
    color: #999;
}

.btn-toggle.activo {
    color: #2e7d32; /* verde */
}

.btn-toggle:not(.activo) {
    color: #c62828; /* rojo */
}

.btn-superadmin {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: #fff;
    box-shadow: 0 6px 18px rgba(142, 36, 170, 0.4);
}

.btn-superadmin:hover {
    box-shadow: 0 10px 28px rgba(142, 36, 170, 0.55);
    transform: translateY(-2px);
}

.limite {
    color: #c62828;
    font-weight: bold;
}
.limite-rojo {
    color: #c62828;
    font-weight: bold;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}






.btn-mini {
    padding: 4px 8px;
    margin-right: 5px;
    cursor: pointer;
}

.btn-rojo {
    background: #e53935;
    color: white;
}

.btn-verde {
    background: #43a047;
    color: white;
}


/* ===============================
   TABLA BASE
================================ */
.tabla {
    width: 100%;
    border-collapse: collapse;
}

.tabla th {
    background: #0b4f0b;
    color: #fff;
    text-align: left;
    padding: 10px;
}

.tabla td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

/* ===============================
   ESTADOS
================================ */
.estado {
    font-weight: bold;
}





/* ===============================
   BOTONES
================================ */
.btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.btn-success {
    background: #1b7e1b;
    color: #fff;
}

.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-icon {
    background: #0b4f0b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    margin-right: 6px;
    cursor: pointer;
}

/* ===============================
   ACCIONES
================================ */
.acciones-sede {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===============================
   🔥 RESPONSIVE MOBILE
================================ */
@media (max-width: 768px) {

    .tabla thead {
        display: none;
    }

    .tabla,
    .tabla tbody,
    .tabla tr,
    .tabla td {
        display: block;
        width: 100%;
    }

    .tabla tr {
        margin-bottom: 15px;
        background: #fff;
        border-radius: 10px;
        padding: 10px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    }

    .tabla td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none;
    }

    .tabla td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #0b4f0b;
    }

    .acciones-sede {
        justify-content: flex-end;
    }
}




@media (max-width: 768px) {

    .tabla thead {
        display: none;
    }

    .tabla tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 8px;
    }

    .tabla td {
        display: flex;
        justify-content: space-between;
        padding: 6px 8px;
    }

    .tabla td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #555;
    }
}

/* ===============================
   FIX UNIFICADO TABLAS + ESTADOS
================================ */

/* estados */
.estado-activo {
    color: #2e7d32;
    font-weight: bold;
}

.estado-inactivo {
    color: #c62828;
    font-weight: bold;
}

/* toggle iconos */
.btn-toggle {
    font-size: 1.2em;
    cursor: pointer;
    background: none;
    border: none;
}

.btn-toggle.activo {
    color: #2e7d32;
}

.btn-toggle:not(.activo) {
    color: #c62828;
}

/* acciones */
.acciones-sede {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* responsive tabla */
@media (max-width: 768px) {

    .tabla thead {
        display: none;
    }

    .tabla tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #ddd;
        border-radius: 10px;
        padding: 10px;
        background: #fafafa;
    }

    .tabla td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border: none;
    }

    .tabla td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #2e7d32;
    }

    .acciones-sede {
        justify-content: flex-end;
    }
}

/* ===============================
   ACCIONES SEDES
================================ */
.acciones-sede {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* botón icono editar */
.btn-icon {
    background: #0b4f0b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
}

.btn-icon i {
    font-size: 1rem;
}

/* botones estado */
.btn-danger {
    background: #c62828;
    color: #fff;
}

.btn-success {
    background: #2e7d32;
    color: #fff;
}
#graficoPrecio {
    max-height: 260px;
}



/* 📱 Móvil */
@media (max-width: 768px) {
    #contenedor-grafico-precio {
        display: none !important;
    }
}

/* 💻 Escritorio */
@media (min-width: 769px) {
    #resumen-precio-movil {
        display: none !important;
    }
}


@media (max-width: 768px) {
    #contenedor-rollback {
        display: none !important;
    }
}



/* boton actualizar datos*/

.btn-actualizar {
    background: #067b1b;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-width: 160px; /* 🔑 evita que se “estire” */
    height: 42px;

    transition: background 0.2s ease, opacity 0.2s ease;
}

.btn-actualizar:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* 🔄 Spinner real */
.spinner {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.oculto {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.alerta-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.alerta-box {
    background: #fff;
    border-radius: 14px;
    padding: 24px 28px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
    animation: scaleIn 0.25s ease;
}

.alerta-icono {
    font-size: 42px;
    margin-bottom: 12px;
}

.alerta-mensaje {
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alerta-btn {
    background: #2e7d32;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.alerta-btn:hover {
    opacity: 0.9;
}

.alerta-overlay.oculto {
    display: none;
}

/* Estados */
.alerta-success .alerta-icono { color: #2e7d32; }
.alerta-error   .alerta-icono { color: #c62828; }

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); }
    to   { transform: scale(1); }
}




.estado-on {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

.estado-off {
    background: #ffebee;
    color: #c62828;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}


/* 💲 Precio unitario destacado */
.precio-unitario {
    font-weight: bold;
    font-size: 1.05em;
    color: var(--primary);          /* verde de tu paleta */
    background-color: #f1f8f4;      /* verde suave */
    border: 2px solid var(--primary);
    text-align: center;
}


.precio-unitario {
    user-select: none;
    cursor: default;
}




.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;                 /* clave para que las líneas coincidan */
    border: 1px solid #dcdcdc;
}

.form-grid-4 .campo {
    padding: 12px;
    border-right: 1px solid #dcdcdc;
    border-bottom: 1px solid #dcdcdc;
}

/* Quitar borde derecho a la última columna */
.form-grid-4 .campo:nth-child(4n) {
    border-right: none;
}

/* Campos que ocupan todo el ancho */
.form-grid-4 .campo-full {
    grid-column: 1 / -1;
    border-right: none;
}

/* Responsive */
@media (max-width: 1200px) {
    .form-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    .form-grid-4 .campo:nth-child(4n) {
        border-right: 1px solid #dcdcdc;
    }
    .form-grid-4 .campo:nth-child(3n) {
        border-right: none;
    }
}

@media (max-width: 900px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-grid-4 .campo:nth-child(3n) {
        border-right: 1px solid #dcdcdc;
    }
    .form-grid-4 .campo:nth-child(2n) {
        border-right: none;
    }
}

@media (max-width: 600px) {
    .form-grid-4 {
        grid-template-columns: 1fr;
    }
    .form-grid-4 .campo {
        border-right: none;
    }
}


.dropdown-capacidades {
    position: relative;
}

.lista-capacidades {
    position: absolute;
    top: 40px;
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-form-sede{
    background: #f5f9f4;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #dfe6dc;
}

.grid-form-sede{
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: end;
}

.grid-form-sede label{
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.acciones-sede-form{
    margin-top: 15px;
    text-align: right;
}




/* ===== Planta Franca – SaaS limpio profesional ===== */

.pf-layout{
    display:grid;
    grid-template-columns: repeat(4, 1fr);
    gap:18px;
    margin-top:25px;
}

/* Tarjetas limpias */
.pf-card{
    background:#ffffff;
    border-radius:12px;
    padding:20px 18px;
    border:1px solid #e6e6e6;
    box-shadow:0 4px 12px rgba(0,0,0,0.06);
    display:flex;
    flex-direction:column;
    gap:14px;
}

/* Títulos elegantes con acento */
.pf-card h5{
    margin:0 0 10px 0;
    font-size:15px;
    font-weight:700;
    letter-spacing:.4px;
    padding-bottom:8px;
    border-bottom:1px solid #eee;
}

/* Acentos por bloque SOLO en el título */
.pf-cliente h5{ color:#1976d2; }
.pf-producto h5{ color:#2e7d32; }
.pf-totales h5{ color:#ef6c00; }
.pf-abono h5{ color:#6a1b9a; }

/* Inputs */
.pf-card input,
.pf-card select,
.pf-card textarea{
    width:100%;
    border:1px solid #dcdcdc;
    border-radius:8px;
    padding:8px 10px;
    font-size:14px;
    background:#fafafa;
}

.pf-card label{
    font-size:12px;
    font-weight:600;
    color:#444;
}

.input-readonly{
    background:#f1f3f5;
    border:1px solid #dcdcdc;
    padding:8px 10px;
    border-radius:8px;
    font-weight:600;
    color:#333;
}

/* Botones sobrios */
.pf-card .btn,
.pf-card .btn-mini{
    background:#f5f5f5;
    color:#333;
    border:1px solid #ddd;
    border-radius:8px;
    font-weight:600;
}

/* Responsive */
@media(max-width:1200px){
    .pf-layout{ grid-template-columns: repeat(2, 1fr); }
}
@media(max-width:700px){
    .pf-layout{ grid-template-columns: 1fr; }
}



/* Botón dinámico Crear Pedido */
/* BOTÓN PRINCIPAL PLANTA FRANCA */
.btn-pf-crear{
    width:100%;
    padding:14px;
    border-radius:12px;
    border:none;
    background:linear-gradient(135deg,#2e7d32,#1b5e20);
    color:#fff;
    font-weight:800;
    font-size:16px;
    letter-spacing:.5px;
    cursor:pointer;
    box-shadow:0 10px 25px rgba(46,125,50,.35);
    transition:all .25s ease;
}

.btn-pf-crear:hover{
    transform:translateY(-2px);
    box-shadow:0 14px 30px rgba(46,125,50,.45);
}


/* Estado listo */
.btn-pf-crear.activo{
    background:#2e7d32;
    color:#fff;
    border-color:#2e7d32;
    cursor:pointer;
    box-shadow:0 6px 14px rgba(46,125,50,.25);
}


/* Loading */
.btn-pf-crear.loading{
    background:#1565c0;
    border-color:#1565c0;
    cursor:wait;
}

/* 🔥 Forzar estilo del botón Crear Pedido aunque esté disabled */
.btn-pf-crear:disabled{
    opacity: 1 !important;
    background: linear-gradient(135deg,#2e7d32,#1b5e20) !important;
    color:#fff !important;
    cursor:not-allowed;
    box-shadow:0 10px 25px rgba(46,125,50,.35) !important;
}


/* ===== OVERLAY MODALES SaaS ===== */

.modal-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn .25s ease;
}

.modal-box{
    background: #ffffff;
    border-radius: 14px;
    width: 520px;
    max-width: 92%;
    padding: 28px 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    animation: subir .25s ease;
    font-family: 'Segoe UI', sans-serif;
}

.modal-box h3{
    margin-bottom: 18px;
    color: #1b5e20;
    font-size: 20px;
}

.modal-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    margin-bottom: 18px;
}

.modal-grid .campo{
    display: flex;
    flex-direction: column;
}

.modal-grid input{
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #cfd8dc;
    font-size: 14px;
}

.modal-actions{
    text-align: right;
}

.btn-modal{
    background: #1b5e20;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

@keyframes fadeIn{
    from{opacity:0}
    to{opacity:1}
}

@keyframes subir{
    from{transform: translateY(20px); opacity:0}
    to{transform: translateY(0); opacity:1}
}


/* 🔥 Caja real del modal */
.modal-box{
    position: relative;
}

/* 🔥 Botón cerrar */
.modal-close{
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #e53935;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    z-index: 2;
}

.modal-close:hover{
    background:#c62828;
    transform: scale(1.1);
}

/* 🔥 Evita que SweetAlert quede detrás */
.swal2-container{
    z-index: 10000 !important;
}


.oculto{
    display: none !important;
}

.swal2-container{
    z-index: 999999 !important;
}
