/* ============================================
   RESET BASE
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* ============================================
   BODY
============================================ */
body {
    background: #7A8E27;
    padding: 30px 0;
}

/* ============================================
   CONTENEDOR PRINCIPAL
============================================ */
.contenedor-premium {
    background: white;
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 24px;
    border-radius: 14px;
    box-shadow: 0 0 25px rgba(0,0,0,0.25);
}

/* ============================================
   HEADER
============================================ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.logo {
    height: 120px;
}

.tarifas-img {
    height: 150px;
    object-fit: contain;
}

/* ============================================
   TÍTULO
============================================ */
.titulo-centrado {
    text-align: center;
    margin-bottom: 30px;
    font-size: 36px;
    font-weight: bold;
}

/* ============================================
   SISTEMAS
============================================ */
#categorias {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
}

#categorias .categoria {
    padding: 12px 28px;
    font-size: 18px;
    background: #e8e8e8;
    border-radius: 10px;
    border: 2px solid #ccc;
    cursor: pointer;
    transition: 0.2s;
}

#categorias .categoria.activa {
    background: #B8C320;
    border-color: #B8C320;
    color: white;
}

/* ============================================
   SUBCATEGORÍAS
============================================ */
#subcategorias {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

#subcategorias button {
    padding: 8px 20px;
    background: #f4f4f4;
    border: 1px solid #888;
    border-radius: 8px;
    cursor: pointer;
}

#subcategorias button.activa {
    background: #007bff;
    color: white;
    border-color: #0056c7;
}

/* ============================================
   BUSCADOR (BLINDADO)
============================================ */
.buscador {
    display: grid;
    grid-template-columns:
        2fr
        0.6fr
        0.6fr
        0.6fr
        0.8fr
        auto
        auto
        auto;
    gap: 8px;
    align-items: center;
}

.buscador input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

.buscador input[type="number"],
#dtoTotal {
    max-width: 90px;
    text-align: center;
}

/* Botones buscador */
.buscador button {
    background: #B8C320;
    border: none;
    color: white;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.buscador button:hover {
    filter: brightness(1.1);
}

/* ============================================
   TABLAS BASE
============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

/* ============================================
   TABLA TARIFA
============================================ */
#tabla-tarifa {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}

#tabla-tarifa th {
    background: #B8C320;
    color: white;
    font-weight: bold;
    padding: 10px 5px;
    position: sticky;
    top: 0;
    z-index: 5;
    text-align: center;
}

#tabla-tarifa td {
    padding: 12px 5px;
    font-size: 15px;
    border-bottom: 1px solid #e5e5e5;
}

#tabla-tarifa tr:hover {
    background: #fafafa;
}

/* Columnas */
#tabla-tarifa th:nth-child(1),
#tabla-tarifa td:nth-child(1) { width: 18%; text-align: left; padding-left: 10px; }

#tabla-tarifa th:nth-child(2),
#tabla-tarifa td:nth-child(2) {
    width: 50%;
    text-align: left;
    padding-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tabla-tarifa th:nth-child(3),
#tabla-tarifa td:nth-child(3),
#tabla-tarifa th:nth-child(4),
#tabla-tarifa td:nth-child(4) {
    width: 10%;
    text-align: right;
    padding-right: 10px;
}

#tabla-tarifa th:nth-child(5),
#tabla-tarifa td:nth-child(5) {
    width: 12%;
    text-align: center;
}

/* Botón añadir */
.btnAdd {
    background: #B8C320;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
}

/* ============================================
   PRESUPUESTO
============================================ */
#presupuesto-container {
    max-height: 450px;
    overflow: auto;
    padding-right: 8px;
    margin-top: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}

#presupuesto-container table {
    min-width: 1100px;
}

/* Botones presupuesto */
#volverPresupuesto,
#portesBtn,
#observacionesBtn,
#lineaManualBtn {
    background: #B8C320;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

#borrarPresupuesto {
    background: #d40000;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   FOOTER
============================================ */
footer {
    margin-top: 25px;
    text-align: left;
    color: #333;
    font-size: 14px;
}

/* ============================================
   TOAST
============================================ */
#toastOferta {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f1f1f;
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    display: none;
    z-index: 9999;
}
/* ============================================
   COLUMNA ACCIÓN (MODIFICAR + ELIMINAR)
============================================ */
#presupuesto-container td:last-child {
    text-align: center;
    vertical-align: middle; /* 👈 CLAVE */
}

#presupuesto-container td:last-child .acciones {
    display: flex;          /* 👈 cambiar inline-flex → flex */
    align-items: center;    /* centra vertical */
    justify-content: center;/* centra horizontal */
    gap: 8px;
    height: 100%;           /* ocupa toda la celda */
}

/* BOTÓN MODIFICAR */
.btnEdit {
    background-color: #e5e5e5;
    color: #000;
    border: 1px solid #bbb;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btnEdit:hover {
    background-color: #d5d5d5;
}

/* BOTÓN ELIMINAR */
.btnDelete {
    background-color: #d40000;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btnDelete:hover {
    background-color: #a00000;
}
/* ============================================
   RESALTADO BÚSQUEDA
============================================ */
.resaltadoABN {
    background: #B8C320;
    color: white;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: bold;
}
table {
    font-size: 9px;
    line-height: 1.4;
    font-family: Arial, Helvetica, sans-serif;
}

table th,
table td {
    padding: 7px 10px;
}
table td:nth-child(4),
table th:nth-child(4) {
    text-align: center;
    width: 50px;
}
/* ============================================
   ALINEACIÓN PERFECTA CABECERA / CUERPO PRESUPUESTO
============================================ */

/* ============================================
   PRESUPUESTO — MODO ERP ULTRA COMPACTO
============================================ */

#presupuesto-container table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

/* Cabeceras */
#presupuesto-container th {
    text-align: center;
    font-weight: 700;
    padding: 4px 4px;
    background: #f2f2f2;
}

/* Celdas */
#presupuesto-container td {
    padding: 4px 4px;
    line-height: 1.2;
    vertical-align: middle;
}

/* Código */
#presupuesto-container th:nth-child(1),
#presupuesto-container td:nth-child(1) {
    width: 12%;
    text-align: left;
}

#presupuesto-container th:nth-child(2),
#presupuesto-container td:nth-child(2) {
    width: 40%;
    text-align: left;

    white-space: normal;
    word-break: break-word;
    line-height: 1.25;

    max-height: 2.5em;
    overflow: hidden;
}

/* Cantidad */
#presupuesto-container th:nth-child(3),
#presupuesto-container td:nth-child(3) {
    width: 6%;
    text-align: right;
}

/* U.M. */
#presupuesto-container th:nth-child(4),
#presupuesto-container td:nth-child(4) {
    width: 4%;
    text-align: center;
}

/* PVP */
#presupuesto-container th:nth-child(5),
#presupuesto-container td:nth-child(5) {
    width: 5.5%;
    text-align: right;
}

/* Dto */
#presupuesto-container th:nth-child(6),
#presupuesto-container td:nth-child(6) {
    width: 5.5%;
    text-align: center;
}

/* Neto */
#presupuesto-container th:nth-child(7),
#presupuesto-container td:nth-child(7) {
    width: 5%;
    text-align: right;
}

/* Total */
#presupuesto-container th:nth-child(8),
#presupuesto-container td:nth-child(8) {
    width: 7%;
    text-align: right;
    font-weight: 700;
}

/* Acción */
#presupuesto-container th:nth-child(9),
#presupuesto-container td:nth-child(9) {
    width: 17%;
    text-align: center;
}

/* Botones ultra compactos */
#presupuesto-container .btnEdit,
#presupuesto-container .btnDelete {
    padding: 3px 8px;
    font-size: 12px;
}

#presupuesto-container th {
    text-align: center;
    font-weight: 700;
}

#presupuesto-container table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

#presupuesto-container th {
    text-align: center;
    font-weight: 700;
    padding: 8px 6px;
}

#presupuesto-container td {
    padding: 8px 6px;
    vertical-align: top;
}

#presupuesto-container th:nth-child(1),
#presupuesto-container td:nth-child(1) { width: 13%; text-align: left; }

#presupuesto-container th:nth-child(2),
#presupuesto-container td:nth-child(2) {
    width: 40%;
    text-align: left;

    white-space: normal;     /* permite salto de línea */
    word-break: break-word; /* corta palabras largas */
    line-height: 1.3;        /* interlineado limpio ERP */
}

#presupuesto-container th:nth-child(3),
#presupuesto-container td:nth-child(3) { width: 7%; text-align: right; }

#presupuesto-container th:nth-child(4),
#presupuesto-container td:nth-child(4) { width: 5%; text-align: center; }

#presupuesto-container th:nth-child(5),
#presupuesto-container td:nth-child(5) { width: 7%; text-align: right; }

#presupuesto-container th:nth-child(6),
#presupuesto-container td:nth-child(6) { width: 7%; text-align: center; }

#presupuesto-container th:nth-child(7),
#presupuesto-container td:nth-child(7) { width: 7%; text-align: right; }

#presupuesto-container th:nth-child(8),
#presupuesto-container td:nth-child(8) { width: 8%; text-align: right; }

#presupuesto-container th:nth-child(9),
#presupuesto-container td:nth-child(9) {
    width: 12%;
    text-align: center;
    overflow: visible;
}

/* =================================================
   PRESUPUESTO — MODO ERP (ULTRA COMPACTO)
   ACTIVADO CON: body.erp
================================================= */

body.erp #presupuesto-container table {
    font-size: 12px;
}

body.erp #presupuesto-container th {
    padding: 4px 4px;
    background: #f2f2f2;
}

body.erp #presupuesto-container td {
    padding: 4px 4px;
    line-height: 1.2;
}

/* Anchos ERP */
body.erp #presupuesto-container th:nth-child(1),
body.erp #presupuesto-container td:nth-child(1) { width: 12%; }

body.erp #presupuesto-container th:nth-child(2),
body.erp #presupuesto-container td:nth-child(2) { width: 36%; }

body.erp #presupuesto-container th:nth-child(3),
body.erp #presupuesto-container td:nth-child(3) { width: 6%; }

body.erp #presupuesto-container th:nth-child(4),
body.erp #presupuesto-container td:nth-child(4) { width: 4%; }

body.erp #presupuesto-container th:nth-child(5),
body.erp #presupuesto-container td:nth-child(5) { width: 6%; }

body.erp #presupuesto-container th:nth-child(6),
body.erp #presupuesto-container td:nth-child(6) { width: 6%; }

body.erp #presupuesto-container th:nth-child(7),
body.erp #presupuesto-container td:nth-child(7) { width: 6%; }

body.erp #presupuesto-container th:nth-child(8),
body.erp #presupuesto-container td:nth-child(8) {
    width: 7%;
    font-weight: 700;
}

body.erp #presupuesto-container th:nth-child(9),
body.erp #presupuesto-container td:nth-child(9) { width: 17%; }

/* Botones compactos ERP */
body.erp #presupuesto-container .btnEdit,
body.erp #presupuesto-container .btnDelete {
    padding: 3px 8px;
    font-size: 12px;
}
/* =================================================
   TABLA TARIFA — MISMA TIPOGRAFÍA Y ESPACIADO
   QUE PRESUPUESTO (EFECTO SUITE PROFESIONAL)
================================================= */

#tabla-tarifa {
    font-size: 14px;
}

/* CABECERAS */
#tabla-tarifa th {
    font-size: 14px;          /* igual que presupuesto */
    font-weight: 700;
    text-align: center;
    padding: 8px 6px;
    background: #B8C320;      /* mismo verde corporativo */
    color: #fff;
}

/* CELDAS */
#tabla-tarifa td {
    font-size: 14px;
    padding: 8px 6px;
    vertical-align: middle;
}

/* ANCHOS Y ALINEACIONES (MISMO CRITERIO) */

/* Código */
#tabla-tarifa th:nth-child(1),
#tabla-tarifa td:nth-child(1) {
    width: 18%;
    text-align: left;
    padding-left: 10px;
}

/* Descripción */
#tabla-tarifa th:nth-child(2),
#tabla-tarifa td:nth-child(2) {
    width: 50%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* PVP */
#tabla-tarifa th:nth-child(3),
#tabla-tarifa td:nth-child(3) {
    width: 10%;
    text-align: right;
    padding-right: 10px;
}

/* Neto */
#tabla-tarifa th:nth-child(4),
#tabla-tarifa td:nth-child(4) {
    width: 10%;
    text-align: right;
    padding-right: 10px;
}

/* Añadir */
#tabla-tarifa th:nth-child(5),
#tabla-tarifa td:nth-child(5) {
    width: 12%;
    text-align: center;
}
/* ============================================
   BOTÓN EDITAR — VERDE CORPORATIVO
============================================ */
.btnEdit {
    background-color: #B8C320;   /* verde corporativo */
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btnEdit:hover {
    filter: brightness(0.9);
}
/* ============================================
   PRESUPUESTO — REAJUSTE DE ANCHOS
   PRIORIDAD A DESCRIPCIÓN
============================================ */

#presupuesto-container table {
    table-layout: fixed;
    width: 100%;
}

/* Código — un poco más estrecho */
#presupuesto-container th:nth-child(1),
#presupuesto-container td:nth-child(1) {
    width: 11%;
    text-align: left;
}

/* Descripción — MÁS ESPACIO */
#presupuesto-container th:nth-child(2),
#presupuesto-container td:nth-child(2) {
    width: 40%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cantidad — más compacta */
#presupuesto-container th:nth-child(3),
#presupuesto-container td:nth-child(3) {
    width: 6%;
    text-align: right;
}

/* U.M. — más compacta */
#presupuesto-container th:nth-child(4),
#presupuesto-container td:nth-child(4) {
    width: 4%;
    text-align: center;
}

/* PVP — más cerca de Cantidad/U.M. */
#presupuesto-container th:nth-child(5),
#presupuesto-container td:nth-child(5) {
    width: 6%;
    text-align: right;
}

/* Dto */
#presupuesto-container th:nth-child(6),
#presupuesto-container td:nth-child(6) {
    width: 6%;
    text-align: center;
}

/* Neto */
#presupuesto-container th:nth-child(7),
#presupuesto-container td:nth-child(7) {
    width: 6%;
    text-align: right;
}

/* Total */
#presupuesto-container th:nth-child(8),
#presupuesto-container td:nth-child(8) {
    width: 7%;
    text-align: right;
}

/* Acción */
#presupuesto-container th:nth-child(9),
#presupuesto-container td:nth-child(9) {
    width: 14%;
    text-align: center;
}
/* ============================================
   FILA TOTAL OFERTA — AISLADA DE REGLAS TABLA
============================================ */
#presupuesto-container .fila-total-oferta td {
    white-space: nowrap !important;
    line-height: 1.2;
    background: #f8f8f8;
    font-weight: 700;
}
/* SOLO líneas normales (NO total oferta) */
#presupuesto-container tr:not(.fila-total-oferta) td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}
.total{
  width: 120px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* ============================================
   COMPACTAR INTERLINEADO TABLAS (TARIFA + PRESUPUESTO)
============================================ */

/* TARIFA */
#tabla-tarifa td,
#tabla-tarifa th {
    padding: 2px 6px !important;
    line-height: 1.05 !important;
}

/* PRESUPUESTO */
#presupuesto-container td,
#presupuesto-container th {
    padding: 2px 6px !important;
    line-height: 1.05 !important;
}

#tabla-tarifa tbody tr:hover,
#presupuesto-container tbody tr:hover {
    background-color: #e3eaa0 !important;
    color: #000;
    cursor: pointer;
}

/* Mantener botones legibles */
#tabla-tarifa tbody tr:hover button,
#presupuesto-container tbody tr:hover button {
    filter: brightness(0.95);
}

/* Transición suave */
#tabla-tarifa tbody tr,
#presupuesto-container tbody tr {
    transition: background-color 0.15s ease-in-out;
}
/* ============================================
   MODAL NUEVA OFERTA — DISEÑO LIMPIO ABN
============================================ */

#modalNuevaOferta {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;
}

/* Caja del modal */
#modalNuevaOferta > div {
    background: #ffffff;
    width: 420px;
    padding: 24px 26px;
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

/* Título */
#modalNuevaOferta h3 {
    margin-bottom: 18px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}

/* Labels */
#modalNuevaOferta label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
}

/* Inputs */
#modalNuevaOferta input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    margin-bottom: 14px;
}

/* Contenedor botones */
#modalNuevaOferta div[style*="text-align:right"] {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Botón cancelar */
#modalNuevaOferta button:first-child {
    background: #e0e0e0;
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* Botón crear */
#modalNuevaOferta button:last-child {
    background: #B8C320;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

#modalNuevaOferta button:hover {
    filter: brightness(0.95);
}

#presupuesto-container .btnDelete {
    border: 1px solid transparent;
}
/* Igualar alineación texto ↔ botones en TODAS las filas */
#presupuesto-container td {
    vertical-align: middle;
}

/* Forzar mismo contexto visual para botones en observaciones */
#presupuesto-container tr.fila-observaciones .acciones {
    align-items: center;
}
/* ===== FIX: presupuesto sin recorte lateral ===== */
#presupuesto-container table{
  min-width: 0 !important;   /* quita el “forzado” a 1100px */
  width: 100% !important;    /* que se ajuste al contenedor */
}

#presupuesto-container{
  overflow-x: hidden !important; /* evita que recorte por scroll horizontal */
}

/* (opcional) si alguna fila necesita respirar */
#presupuesto-container button{
  white-space: nowrap;
}
