:root {
  --abn-green: #B8C320;
  --abn-green-dark: #9aa31a;
  --abn-olive-bg: #e9e9e9;
  --abn-text: #111;
  --abn-muted: rgba(0, 0, 0, .70);
  --abn-border: rgba(0, 0, 0, .14);
  --abn-soft: rgba(0, 0, 0, .06);
  --abn-shadow: 0 18px 40px rgba(0, 0, 0, .18);
  --abn-radius: 18px;
  --abn-radius-sm: 12px;
  --abn-typewriter: "Special Elite", "Courier Prime", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--abn-typewriter);
}

body * {
  font-family: var(--abn-typewriter);
}

body {
  margin: 0;
  padding: 16px 0;
  background: var(--abn-olive-bg);
  color: var(--abn-text);
}

.contenedor-premium {
  width: min(1460px, 96vw);
  margin: 0 auto;
  background: #fff;
  border-radius: 28px;
  box-shadow: var(--abn-shadow);
  padding: 20px 22px 18px;
}

.header, .header-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.header-center {
  display: flex;
  justify-content: center;
  width: 100%;
}

.logo-ofertool {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.section-lead {
  margin-bottom: 14px;
  text-align: center;
}

.section-kicker {
  letter-spacing: .06em;
  font-weight: bold;
  font-size: 1.1rem;
}

.section-helper {
  font-size: 0.9rem;
  color: var(--abn-muted);
  margin-top: 4px;
}

/* =========================
   CATEGORÍAS / SUBCATS
========================= */
#categorias, #subcategorias {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

#categorias {
  margin: 10px 0;
}

#subcategorias {
  margin: 10px 0 18px;
  gap: 12px;
}

.categoria, .subcat {
  border: 1px solid rgba(0, 0, 0, .22);
  background: #efefef;
  color: #111;
  padding: 12px 26px;
  border-radius: var(--abn-radius-sm);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .35px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 6px 14px rgba(0, 0, 0, .12);
  transition: background 0.2s ease;
}

.subcat {
  padding: 10px 18px;
  min-width: 140px;
}

.categoria:hover, .subcat:hover {
  filter: brightness(1.01);
}

.categoria.activa, .subcat.activa {
  background: var(--abn-green);
  border-color: rgba(0, 0, 0, .30);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 10px 18px rgba(0, 0, 0, .14);
}

.categoria-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .10);
  font-size: .92em;
  line-height: 1.1;
}

.categoria.activa .categoria-count {
  background: rgba(255, 255, 255, .22);
}

.subcat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.subcat-ficha-slot {
  min-height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.abn-ficha-btn {
  border: 1px solid rgba(0, 0, 0, .20);
  background: #efefef;
  color: #111;
  padding: 4px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 3px 8px rgba(0, 0, 0, .10);
}

/* =========================
   BUSCADOR Y BLOQUE DE DESCUENTOS
========================= */
.buscador {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
  padding: 0 18px;
}

#buscar, #dto1, #dto2, #dto3, #dtoTotal {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--abn-border);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  box-shadow: 0 1px 0 var(--abn-soft);
}

#buscar {
  flex: 0 1 340px;
  max-width: 340px;
  min-width: 240px;
}

.control-search {
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-label {
  font-size: 0.95rem;
  color: var(--abn-text);
  font-weight: bold;
}

.descuentos-bloque {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.discount-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: .06em;
}

#dto1, #dto2, #dto3 { width: 76px; text-align: center; font-weight: 700; }
#dtoTotal { width: 110px; text-align: center; font-weight: 700; background: #f5f5f5; }

.buscador button {
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, .20);
  background: #efefef;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 6px 14px rgba(0, 0, 0, .12);
}

#limpiarBusqueda, #limpiarDescuentos {
  background: #dc3545 !important;
  color: #fff !important;
  border-color: rgba(0, 0, 0, .25) !important;
}

/* =========================
   TABLA TARIFA (ANCHO BLINDADO)
========================= */
#tabla-tarifa {
  width: 100%;
  border: 1px solid var(--abn-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  margin-top: 12px;
}

#tabla-tarifa table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#tabla-tarifa thead th {
  background: var(--abn-green);
  color: #fff;
  font-weight: 900;
  text-align: center;
  padding: 8px 10px;
  font-size: 14px;
  white-space: nowrap;
}

#tabla-tarifa td {
  padding: 6px 10px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  font-size: 13px;
  line-height: 1.2;
}

#tabla-tarifa tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, .02);
}

/* Forzado estricto de columnas segun especificación senior */
#tabla-tarifa col.col-codigo, #tabla-tarifa thead th:nth-child(1) { width: 17% !important; }
#tabla-tarifa col.col-descripcion, #tabla-tarifa thead th:nth-child(2) { width: 45% !important; }
#tabla-tarifa col.col-pvp, #tabla-tarifa thead th:nth-child(3) { width: 13% !important; }
#tabla-tarifa col.col-neto, #tabla-tarifa thead th:nth-child(4) { width: 13% !important; }
#tabla-tarifa col.col-img, #tabla-tarifa thead th:nth-child(5), #tabla-tarifa tbody td:nth-child(5) { 
  width: 12% !important; 
  text-align: center !important;
  vertical-align: middle !important;
}

.img-thumbnail {
  max-width: 60px;
  height: auto;
  object-fit: contain;
}

footer {
  text-align: center;
  margin-top: 18px;
  padding-top: 10px;
  color: rgba(0,0,0,.65);
  font-size: 13px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1020px) {
  .buscador { flex-wrap: wrap; }
  #buscar { flex: 1 1 100%; max-width: 100%; }
}
@media (max-width: 920px) {
  .titulo-centrado { font-size: 34px; }
}
.compat-hidden { display: none !important; }