:root {
  --primary: #f5a623;
  --primary-dark: #d98708;
  --primary-soft: #fff1d7;
  --dark: #17212b;
  --dark-2: #23313d;
  --text: #24313b;
  --light: #f5f7f8;
  --white: #ffffff;
  --gray: #68737c;
  --border: #e4e8eb;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--white);
}
a { color: inherit; text-decoration: none; -webkit-text-size-adjust: 100%; }
button { -webkit-appearance: none; appearance: none; touch-action: manipulation; }
.container { width: min(1120px, 90%); margin: 0 auto; }

/* HEADER */
header {
  background: var(--dark);
  color: var(--white);
  position: sticky; top: 0; z-index: 20;
}
.navbar {
  position: relative;
  min-height: 76px;
  display: flex; justify-content: space-between; align-items: center; gap: 30px;
}
.logo {
  display: flex; align-items: center; gap: 12px; font-weight: bold; font-size: 1.2rem;
}
.logo-sl { color: var(--primary); font-size: 1rem; }
.logo-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  color: var(--dark); background: var(--primary);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  font-size: 1.3rem;
}
.logo-img {
  height: 48px; width: auto; border-radius: 6px; display: block;
  background: #fff;
  padding: 2px;
}
.logo-text {
  color: var(--white); font-weight: 800; font-size: 1.15rem; line-height: 1.1;
  text-transform: none;
}
.logo-sl {
  color: var(--primary); font-size: .8rem; letter-spacing: 3px;
}
nav { display: flex; gap: 25px; align-items: center; font-size: .95rem; }
nav > a:not(.btn) { color: #dce3e8; transition: color .2s ease; }
nav > a:not(.btn):hover { color: var(--primary); }
.btn-nav {
  background: var(--primary); color: var(--dark) !important; font-weight: 700;
  padding: 9px 16px; border-radius: 5px;
}
.burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.burger span { width: 26px; height: 3px; background: var(--white); border-radius: 2px; }
.burger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* BUTTONS */
.btn {
  display: inline-block; padding: 13px 23px; border-radius: 5px; font-weight: bold;
  border: 2px solid transparent; transition: .2s ease; cursor: pointer; font-size: 1rem;
}
.btn-primary { background: var(--primary); color: var(--dark); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: var(--dark); }
.btn-cta { background: var(--dark); color: var(--white); }
.btn-cta:hover { background: #0d151c; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent; color: var(--gray); border: 1px solid var(--border);
  padding: 13px 16px; border-radius: 5px; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { background: var(--light); }

/* HERO */
.hero {
  min-height: 590px; display: flex; align-items: center; color: var(--white);
  background:
    linear-gradient(90deg, rgba(17, 27, 36, .96), rgba(17, 27, 36, .70)),
    url("https://images.unsplash.com/photo-1504307651254-35680f356dfd?auto=format&fit=crop&w=1800&q=85")
    center/cover;
}
.hero-content { max-width: 700px; padding: 90px 0; }
.eyebrow {
  color: var(--primary); text-transform: uppercase; letter-spacing: 2px;
  font-weight: bold; font-size: .85rem; margin-bottom: 15px;
}
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.8rem); line-height: 1.08; margin-bottom: 23px; }
.hero p { max-width: 600px; color: #e0e7eb; font-size: 1.15rem; margin-bottom: 32px; }
.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; }

/* SECTIONS */
section { padding: 85px 0; }
.section-header { max-width: 650px; margin-bottom: 45px; }
.section-header h2 { color: var(--dark); font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin-bottom: 13px; }
.section-header p { color: var(--gray); }

/* ABOUT */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 65px; align-items: center; }
.about-image {
  min-height: 420px;
  background:
    linear-gradient(0deg, rgba(21, 32, 42, .15), rgba(21, 32, 42, .15)),
    url("https://images.unsplash.com/photo-1541888946425-d81bb19240f5?auto=format&fit=crop&w=1000&q=85")
    center/cover; border-radius: 8px; position: relative;
}
.experience-card {
  position: absolute; right: -25px; bottom: 25px; background: var(--primary);
  color: var(--dark); padding: 22px; width: 180px; text-align: center; border-radius: 5px;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
}
.experience-card strong { display: block; font-size: 2.5rem; line-height: 1; }
.about-text h3 { color: var(--dark); font-size: 1.8rem; margin-bottom: 17px; }
.about-text p { color: var(--gray); margin-bottom: 18px; }
.check-list { list-style: none; margin: 24px 0; }
.check-list li { margin: 12px 0; font-weight: bold; position: relative; padding-left: 30px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--primary-dark); font-size: 1.2rem; font-weight: bold; }

/* SERVICES */
.services { background: var(--light); }
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.service-card {
  background: var(--white); padding: 30px 25px; border-bottom: 4px solid transparent;
  box-shadow: 0 5px 18px rgba(22, 35, 45, .06); transition: transform .2s ease, border-color .2s ease;
}
.service-card:hover { transform: translateY(-5px); border-color: var(--primary); }
.service-icon {
  width: 54px; height: 54px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-dark); border-radius: 50%;
  font-size: 1.5rem; margin-bottom: 20px;
}
.service-card h3 { color: var(--dark); margin-bottom: 10px; font-size: 1.2rem; }
.service-card p { color: var(--gray); font-size: .95rem; }

/* CTA */
.cta { background: var(--primary); color: var(--dark); text-align: center; }
.cta h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 12px; }
.cta p { margin-bottom: 25px; }

/* === PRESUPUESTO — diseño factura (web02) === */
.pu-container {
  width: min(1200px, 92%); margin: 20px auto;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(22,35,45,.12);
  overflow: hidden;
}
.pu-cabecera {
  background: var(--dark);
  color: white;
  padding: 26px 30px;
  display: flex; justify-content: space-between; align-items: center; gap: 25px;
}
.pu-empresa h1 { margin: 0 0 6px; font-size: 1.7rem; }
.pu-empresa p { margin: 0; color: #d7dfe4; font-size: .95rem; }
.pu-numup { text-align: right; }
.pu-numup span { display: block; color: #cbd5db; font-size: .85rem; }
.pu-numup strong { display: block; color: var(--primary); font-size: 1.4rem; margin-top: 4px; font-weight: 800; }
.pu-contenido { padding: 30px; }

.pu-datos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.pu-campo { display: flex; flex-direction: column; gap: 6px; }
.pu-campo label { font-weight: 700; font-size: .85rem; color: var(--dark); }
.pu-campo input, .pu-campo select { width: 100%; border: 1px solid var(--border); padding: 10px 12px; border-radius: 5px; font: inherit; color: #26333d; background: white; }
.pu-campo input:focus, .pu-campo select:focus { outline: 2px solid rgba(245,166,35,.35); border-color: var(--primary); }
.pu-campo textarea { width: 100%; border: 1px solid var(--border); padding: 10px 12px; border-radius: 5px; font: inherit; min-height: 90px; resize: vertical; }
.pu-info { padding: 10px 12px; border-radius: 5px; background: var(--primary-soft); color: var(--dark); font-size: .9rem; font-weight: 700; border: 1px dashed var(--primary); }

.pu-seccion { margin-bottom: 18px; }
.pu-search { margin-bottom: 10px; }
.pu-search input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 5px; font: inherit; outline: none; }
.pu-search input:focus { border-color: var(--primary); }
.pu-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.pu-tab { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--white); font-size: .8rem; cursor: pointer; white-space: nowrap; }
.pu-tab:hover { border-color: var(--primary); }
.pu-tab.active { background: var(--primary); color: var(--dark); border-color: var(--primary); font-weight: 700; }
.pu-list { border: 1px solid var(--border); border-radius: 6px; max-height: 220px; overflow-y: auto; margin-bottom: 8px; }
.pu-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.pu-item:hover { background: var(--light); }
.pu-item:last-child { border-bottom: 0; }
.pu-item .pi-name { font-weight: 600; font-size: .9rem; }
.pu-item .pi-name small { display: block; color: var(--gray); font-weight: 400; font-size: .78rem; }
.pu-item .pi-price { color: var(--dark); font-weight: 700; white-space: nowrap; }
.pu-item .pi-add { padding: 6px 12px; border: 0; border-radius: 5px; background: var(--primary); color: var(--dark); font-weight: 700; cursor: pointer; }
.pu-item .pi-add:hover { background: var(--primary-dark); color: white; }

.pu-seccion-titulo { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 22px 0 12px; }
.pu-seccion-titulo h2 { margin: 0; color: var(--dark); font-size: 1.25rem; }
.boton { border: 0; border-radius: 5px; padding: 10px 16px; font-weight: 700; cursor: pointer; transition: .2s; font-size: .95rem; }
.boton:hover { transform: translateY(-1px); }
.boton-principal { background: var(--primary); color: var(--dark); }
.boton-principal:hover { background: var(--primary-dark); color: white; }
.boton-secundario { background: var(--dark); color: white; }
.boton-secundario:hover { background: #0d151c; }
.boton-verde { background: #198754; color: white; }
.boton-verde:hover { background: #146c43; }
.boton-rojo { background: #dc3545; color: white; padding: 6px 10px; font-size: 1.1rem; line-height: 1; }

.tabla-contenedor { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { background: var(--dark); color: white; text-align: left; padding: 12px 10px; font-size: .82rem; }
td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td input, td select { width: 100%; border: 1px solid var(--border); padding: 8px 9px; border-radius: 5px; font: inherit; background: white; }
td input:focus, td select:focus { outline: 2px solid rgba(245,166,35,.35); border-color: var(--primary); }
.pu-cantidad { width: 110px; }
.pu-precio { width: 140px; }
.pu-importe { font-weight: 700; white-space: nowrap; text-align: right; }
.pu-unidad { width: 100px; }

.pu-resumen { display: flex; justify-content: flex-end; margin-top: 22px; }
.pu-resumen-tabla { width: min(100%, 420px); border-collapse: collapse; }
.pu-resumen-tabla td { padding: 9px 4px; border-bottom: 1px solid var(--border); }
.pu-resumen-tabla td:last-child { text-align: right; font-weight: 700; }
.pu-resumen-tabla td:nth-child(1) { color: #26333d; }
.pu-total-final td { font-size: 1.3rem; color: var(--dark); border-bottom: 0; padding-top: 15px; }
.pu-desglose { color: var(--gray); font-size: .88rem; margin: 10px 0 0; text-align: right; }
.pu-desglose b { font-weight: 700; }

.pu-obs { margin-top: 26px; }
.pu-nota { color: var(--gray); font-size: .82rem; margin: 20px 0; line-height: 1.5; }
.pu-acciones { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.pu-msg { margin-top: 14px; font-size: .9rem; min-height: 18px; font-weight: 600; }
.pu-msg.ok { color: #198754; }
.pu-msg.err { color: #dc3545; }

/* CONTACTO */
.contact { display: grid; grid-template-columns: .9fr 1.1fr; gap: 55px; }
.contact-info { background: var(--dark); color: var(--white); padding: 38px; border-radius: 7px; }
.contact-info h2 { font-size: 2rem; margin-bottom: 18px; }
.contact-info p { color: #cbd5db; margin-bottom: 20px; }
.contact-item { display: flex; gap: 14px; margin: 21px 0; align-items: flex-start; }
.contact-item span:first-child { color: var(--primary); font-size: 1.2rem; }
.contact-item strong { color: var(--white); }
.contact-item a { color: var(--primary); font-weight: 600; }
.contact-form { display: grid; gap: 15px; }
.contact-form h2 { color: var(--dark); font-size: 2rem; margin-bottom: 6px; }
.contact-form p { color: var(--gray); }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: 4px; font: inherit; outline: none;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--primary); }
textarea { min-height: 145px; resize: vertical; }

/* FOOTER */
footer { background: #111a21; color: #aeb9c0; padding: 25px 0; font-size: .9rem; }
.footer-content { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* MENÚ MÓVIL (hamburguesa) — botón fuera del <nav>, dropdown bajo la barra */
@media (max-width: 800px) {
  /* menú desplegable: cerrado = oculto; abierto (nav.open) = visible bajo la barra */
  nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--dark-2);
    padding: 6px 0 12px;
    box-shadow: 0 12px 24px rgba(0,0,0,.25);
    z-index: 50;
  }
  nav.open { display: flex; }
  nav > a:not(.btn) {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 22px; font-size: 1.02rem;
    border-top: 1px solid rgba(255,255,255,.08);
  }
  nav > a.tab-soon { opacity: 1; }
  nav .btn-nav { text-align: center; padding: 12px 16px; margin-top: 8px; }
  .burger { display: flex; padding: 12px 10px; -webkit-tap-highlight-color: transparent; }
}
@media (max-width: 500px) {
  section { padding: 60px 0; }
  .hero { min-height: 560px; }
  .btn { width: 100%; text-align: center; }
  .contact-info { padding: 25px; }
  .pu-grid2 { grid-template-columns: 1fr; }
}

/* MENÚ desplegado en móvil — fuera del media query para que ninguna condición lo rompa */
nav.open { display: flex; }

/* ---- Tabs de página (Inicio / Presupuesto / Ofertas) ---- */
body.pagina-presupuesto section[data-pagina]:not([data-pagina="presupuesto"]) { display: none; }
body.pagina-inicio section[data-pagina="presupuesto"],
body.pagina-inicio section[data-pagina="ofertas"] { display: none; }
body.pagina-ofertas section[data-pagina]:not([data-pagina="ofertas"]) { display: none; }
body.pagina-tarifa section[data-pagina]:not([data-pagina="tarifa"]) { display: none; }

nav a.tab-soon { opacity: .55; }
nav a.active-tab { color: var(--primary) !important; }
nav a.tab-soon small { font-size: .68rem; font-weight: 400; }

/* sección Presupuesto visible solo como tab: sin margen de página completa */
body.pagina-presupuesto #presupuesto { padding-top: 30px; }
body.pagina-presupuesto header { position: sticky; top: 0; z-index: 60; }

/* al imprimir la ficha de presupuesto, ocultar picker de productos y nav */
@media print {
  nav, .pu-picker, .pu-acciones, header .btn-nav { display: none !important; }
  body.pagina-presupuesto section[data-pagina="presupuesto"] { display: block !important; }
}

/* ---- Pestaña Ofertas ---- */
.of-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; margin-top: 10px; }
.of-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease; }
.of-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,24,40,.10); }
.of-foto { aspect-ratio: 4/3; background: #eef1f4; width: 100%; object-fit: cover; display: block; }
.of-foto-placeholder { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #b8c2cc; background: repeating-linear-gradient(45deg,#f3f5f7,#f3f5f7 12px,#edf0f3 12px,#edf0f3 24px); }
.of-info { min-width: 0; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.of-nombre { font-weight: 600; color: var(--dark); font-size: 1rem; line-height: 1.3; overflow-wrap: break-word; min-width: 0; }
.of-uso { color: var(--gray); font-size: .82rem; overflow-wrap: break-word; min-width: 0; }
.of-medida { display: inline-block; align-self: flex-start; background: var(--primary); color: var(--dark); font-weight: 700; font-size: .78rem; padding: 3px 10px; border-radius: 20px; overflow-wrap: anywhere; }
.of-pie { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.of-precio { font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.of-precio small { font-size: .72rem; font-weight: 500; color: var(--gray); }
.of-stock { font-size: .78rem; color: var(--gray); text-align: right; }
.of-stock.disponible { color: #1a7f37; font-weight: 600; }
.of-stock.agotado { color: #b42318; font-weight: 700; }
.of-vacio { grid-column: 1/-1; text-align: center; color: var(--gray); padding: 30px 0; }
.of-badge-agotado { position: absolute; }
@media (max-width: 500px) { .of-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } .of-info { padding: 10px 12px 12px; } .of-precio { font-size: 1.05rem; } }

/* ---- Pestaña Tarifa (vista ligera para móvil) ---- */
.tf-wrap { width: min(860px, 92%); margin: 0 auto; padding-bottom: 40px; }
.tf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; min-height: 34px; }
.tf-back { background: none; border: 0; color: var(--primary-dark); font: inherit; font-weight: 700; cursor: pointer; padding: 8px 4px; display: none; }
.tf-back.visible { display: inline-block; }
.tf-h3 { color: var(--dark); font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; margin: 8px 0 6px; }
.tf-sub2 { color: var(--gray); margin: 0 0 18px; }
.tf-searchbox { position: relative; margin-bottom: 8px; }
.tf-searchbox input {
  width: 100%; padding: 13px 44px 13px 14px; font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; background: var(--white); outline: none;
}
.tf-searchbox input:focus { border-color: var(--primary); outline: 2px solid rgba(245,166,35,.30); }
.tf-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--light); color: var(--gray); border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; display: none; font-size: .95rem;
}
.tf-clear.visible { display: block; }
.tf-hint { color: var(--gray); font-size: .85rem; margin: 0 0 18px; }

/* resultados de búsqueda */
.tf-resultados { display: none; margin-bottom: 20px; }
.tf-resultados.visible { display: block; }
.tf-resultados-title { font-weight: 700; color: var(--dark); margin: 0 0 8px; }

/* familias */
.tf-familias { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tf-fam {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font: inherit; text-align: left; transition: border-color .15s ease, transform .15s ease;
}
.tf-fam:hover { border-color: var(--primary); transform: translateY(-2px); }
.tf-fam-nombre { font-weight: 700; color: var(--dark); line-height: 1.25; overflow-wrap: anywhere; }
.tf-fam-num { flex: none; background: var(--primary-soft); color: var(--primary-dark); border-radius: 20px; font-size: .8rem; font-weight: 700; padding: 3px 10px; }

/* subfamilias */
.tf-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tf-sub {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 16px; background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font: inherit; text-align: left; transition: border-color .15s ease, transform .15s ease;
}
.tf-sub:hover { border-color: var(--primary); transform: translateY(-2px); }
.tf-sub-nombre { font-weight: 600; color: var(--dark); line-height: 1.25; overflow-wrap: anywhere; }
.tf-sub-num { flex: none; background: var(--light); color: var(--gray); border-radius: 20px; font-size: .8rem; font-weight: 700; padding: 3px 10px; }

/* tabla de precios */
.tf-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tf-titulo { margin: 0; padding: 16px 18px 10px; color: var(--dark); font-size: 1.15rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tf-chip { background: var(--primary-soft); color: var(--primary-dark); border-radius: 20px; font-size: .75rem; font-weight: 700; padding: 3px 10px; }
.tf-card .tf-back { display: inline-block; margin: 0 18px 8px; }
.tf-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 11px 18px; border-top: 1px solid var(--border);
}
.tf-name { flex: 1 1 auto; min-width: 0; color: var(--text); font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.tf-name small { display: block; color: var(--gray); font-size: .74rem; }
.tf-ud { flex: none; color: var(--gray); font-size: .8rem; min-width: 34px; }
.tf-precio { flex: none; font-weight: 800; color: var(--dark); white-space: nowrap; }
.tf-vacio { color: var(--gray); padding: 22px 18px; text-align: center; }

@media (max-width: 500px) {
  .tf-familias, .tf-subs { grid-template-columns: 1fr; }
  .tf-h3 { font-size: 1.5rem; }
  .tf-fam { padding: 13px 14px; }
  .tf-sub { padding: 12px 14px; }
  .tf-searchbox input { padding: 12px 40px 12px 12px; }
}
