:root{
  --bg:#FAF6EC;
  --paper:#FAF6EC;
  --teal:#0F6E56;
  --teal-light:#E1F5EE;
  --teal-dark:#04342C;
  --teal-deep:#0A3F32;
  --coral:#D85A30;
  --coral-light:#FAECE7;
  --sand:#EFE2C4;
  --sand-line:#E4D4AC;
  --ink:#1B231D;
  --ink-soft:#5B6660;
  --border:#DDD6C4;
  --shadow-card:0 1px 2px rgba(27,35,29,0.04), 0 10px 24px -14px rgba(15,110,86,0.18);
  --radius:14px;
}
*{box-sizing:border-box; margin:0; padding:0;}
html{scroll-behavior:smooth;}
body{
  font-family:'Inter', sans-serif;
  background:var(--paper);
  color:var(--ink);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.brand{font-family:'Space Grotesk', sans-serif;}
a{color:inherit; text-decoration:none;}
.wrap{max-width:1080px; margin:0 auto; padding:0 24px;}
img{max-width:100%;}
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible{
  outline:2px solid var(--coral); outline-offset:2px; border-radius:4px;
}
::selection{background:var(--teal); color:#fff;}

/* HEADER */
header{
  border-bottom:1px solid var(--border);
  background:rgba(250,246,236,0.88);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  position:sticky; top:0; z-index:20;
}
.headerbar{display:flex; align-items:center; justify-content:space-between; padding:16px 24px; max-width:1080px; margin:0 auto; gap:24px;}
.brand{display:flex; align-items:center; gap:10px; font-weight:700; font-size:19px; color:var(--ink); flex-shrink:0;}
.brand .mark{width:32px; height:32px; border-radius:8px; flex-shrink:0; object-fit:contain;}
nav{display:flex; align-items:center; gap:28px; font-size:14px; font-weight:500;}
nav a{color:var(--ink-soft); border-bottom:1px solid transparent; padding-bottom:3px; transition:color .15s ease, border-color .15s ease;}
nav a:hover{color:var(--teal); border-color:var(--teal);}
nav a.nav-cta{
  display:inline-flex; align-items:center; gap:6px;
  color:#fff; background:var(--coral); border:none;
  padding:9px 16px; border-radius:20px; font-weight:600; font-size:13px;
  box-shadow:0 4px 12px -4px rgba(216,90,48,0.55);
  transition:transform .15s ease, box-shadow .15s ease;
}
nav a.nav-cta:hover{transform:translateY(-1px); box-shadow:0 6px 16px -4px rgba(216,90,48,0.6); color:#fff;}
nav a.nav-cta .pip{width:5px; height:5px; border-radius:50%; background:#fff; opacity:.85;}

/* HERO */
.hero{padding:76px 24px 60px; position:relative; overflow:hidden;}
.hero::before{
  content:''; position:absolute; top:-120px; right:-160px; width:420px; height:420px;
  background:radial-gradient(circle, var(--teal-light) 0%, transparent 70%);
  pointer-events:none;
}
.hero-grid{max-width:1080px; margin:0 auto; display:grid; grid-template-columns:1fr 1fr; gap:56px; align-items:center; position:relative;}
.hero h1{font-size:44px; font-weight:700; line-height:1.12; letter-spacing:-0.8px; margin-bottom:18px;}
.hero p.lead{font-size:17px; color:var(--ink-soft); max-width:440px; margin-bottom:28px;}
.trust-row{display:flex; gap:24px; font-size:13px; color:var(--ink-soft); flex-wrap:wrap;}
.trust-row span{display:flex; align-items:center; gap:6px;}
.dot{width:6px; height:6px; border-radius:50%; background:var(--teal);}

/* CALCULATOR CARD — treated like a ticket/invoice */
.calc-card{
  background:#fff; border:1px solid var(--border); border-radius:16px; padding:30px;
  box-shadow:var(--shadow-card);
  position:relative;
}
.calc-card::before{
  content:''; position:absolute; top:0; left:24px; right:24px; height:3px;
  background:repeating-linear-gradient(to right, var(--coral) 0 8px, transparent 8px 16px);
  border-radius:0 0 3px 3px;
}
.calc-card .tag{display:inline-block; font-size:12px; font-weight:600; color:var(--teal-dark); background:var(--teal-light); padding:4px 10px; border-radius:20px; margin-bottom:18px;}
.field{margin-bottom:16px;}
.field label{display:block; font-size:13px; font-weight:500; color:var(--ink-soft); margin-bottom:6px;}
.field input[type="number"], .field input[type="text"]{width:100%; padding:11px 12px; border:1px solid var(--border); border-radius:9px; font-size:15px; font-family:'Inter',sans-serif; color:var(--ink); background:var(--paper); transition:border-color .15s ease, box-shadow .15s ease;}
.field input[type="number"]:focus, .field input[type="text"]:focus{outline:none; border-color:var(--teal); box-shadow:0 0 0 3px var(--teal-light);}
.field input[type="checkbox"]{accent-color:var(--teal); width:16px; height:16px;}
.result{margin-top:20px; padding:16px 18px; background:var(--teal-light); border-radius:10px; border-left:3px solid var(--teal);}
.result .label{font-size:12px; color:var(--teal-dark); font-weight:600; margin-bottom:4px;}
.result .value{font-size:28px; font-weight:700; color:var(--teal-dark); font-family:'Space Grotesk',sans-serif; font-variant-numeric:tabular-nums; letter-spacing:-0.3px;}
.result .sub{font-size:12px; color:var(--teal-dark); opacity:0.75; margin-top:4px;}
.cta-link{display:inline-block; margin-top:14px; font-size:13px; font-weight:600; color:var(--coral);}

/* CATEGORY STRIP */
.categories{padding:36px 24px; border-top:1px solid var(--border); border-bottom:1px solid var(--border);}
.categories .wrap{display:flex; gap:14px; flex-wrap:wrap; align-items:center;}
.cat-label{font-size:13px; color:var(--ink-soft); font-weight:500; margin-right:6px;}
.chip{font-size:13px; font-weight:500; padding:8px 16px; border-radius:20px; border:1px solid var(--border); color:var(--ink-soft); background:#fff; transition:all .15s ease;}
.chip.active{background:var(--ink); color:#fff; border-color:var(--ink);}

/* ARTICLES / CARDS */
.articles{padding:64px 24px;}
.section-head{display:flex; justify-content:space-between; align-items:baseline; margin-bottom:32px;}
.section-head h2{font-size:26px; font-weight:700; letter-spacing:-0.3px;}
.section-head a{font-size:13px; font-weight:600; color:var(--coral);}
.article-grid{display:grid; grid-template-columns:repeat(3, 1fr); gap:24px;}
.article-card{
  border:1px solid var(--border); border-radius:14px; overflow:hidden; background:#fff;
  display:flex; flex-direction:column;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.article-card:hover{transform:translateY(-3px); box-shadow:var(--shadow-card); border-color:#fff;}
.article-thumb{
  height:132px; background:var(--teal-light);
  display:flex; align-items:center; justify-content:center;
  position:relative; overflow:hidden;
}
.article-thumb.coral{background:var(--coral-light);}
.article-thumb.sand{background:var(--sand);}
.article-thumb svg{width:84px; height:84px; position:relative; z-index:1;}
.article-body{padding:20px;}
.article-cat{font-size:11px; font-weight:600; letter-spacing:0.03em; color:var(--teal); margin-bottom:8px;}
.article-card h3{font-size:16px; line-height:1.35; margin-bottom:8px; font-weight:600;}
.article-body p{font-size:13px; color:var(--ink-soft);}

/* ARTICLE PAGE (long-form content) */
.article-page{padding:56px 24px; max-width:720px; margin:0 auto;}
.article-hero{
  height:180px; border-radius:16px; margin-bottom:32px; background:var(--teal-light);
  display:flex; align-items:center; justify-content:center;
  position:relative; overflow:hidden;
}
.article-hero.coral{background:var(--coral-light);}
.article-hero.sand{background:var(--sand);}
.article-hero svg{width:120px; height:120px; position:relative; z-index:1;}
.article-page .eyebrow{font-size:12px; font-weight:600; letter-spacing:0.03em; color:var(--teal); margin-bottom:14px;}
.article-page h1{font-size:33px; line-height:1.18; letter-spacing:-0.5px; margin-bottom:24px;}
.article-page h2{font-size:22px; margin:36px 0 14px; letter-spacing:-0.2px;}
.article-page h3{font-size:17px; margin:24px 0 10px;}
.article-page p{font-size:16px; margin-bottom:16px; color:var(--ink);}
.article-page ul, .article-page ol{margin:0 0 16px 22px; font-size:16px;}
.article-page li{margin-bottom:6px;}
.article-page strong{font-weight:600;}
.article-page code{background:var(--teal-light); padding:2px 6px; border-radius:4px; font-size:14px;}
.article-page pre{background:var(--ink); color:var(--teal-light); padding:16px; border-radius:8px; overflow-x:auto; margin-bottom:16px; font-size:14px;}
.article-page pre code{background:none; padding:0; color:inherit;}
.article-page hr{border:none; border-top:1px solid var(--border); margin:32px 0;}
.article-page em{color:var(--ink-soft);}
.back-link{display:inline-block; margin-bottom:28px; font-size:13px; font-weight:600; color:var(--ink-soft);}
.back-link:hover{color:var(--teal);}

/* RELATED TOOLS */
.related-tools{margin-top:48px; padding-top:32px; border-top:1px solid var(--border);}
.related-tools h3{font-size:16px; margin-bottom:16px;}
.related-grid{display:grid; grid-template-columns:repeat(2, 1fr); gap:12px;}
.related-card{display:block; background:var(--teal-light); color:var(--teal-dark); font-size:14px; font-weight:500; padding:14px 16px; border-radius:10px; border:1px solid transparent; transition:border-color .15s ease, transform .15s ease;}
.related-card:hover{border-color:var(--teal); transform:translateY(-1px);}

/* FAQ */
.faq-section{margin-top:48px;}
.faq-section h2{font-size:20px; margin-bottom:16px;}
.faq-item{border:1px solid var(--border); border-radius:10px; margin-bottom:10px; background:#fff; overflow:hidden;}
.faq-item summary{padding:14px 18px; font-size:14px; font-weight:600; cursor:pointer; color:var(--ink); list-style:none;}
.faq-item summary::-webkit-details-marker{display:none;}
.faq-item summary::after{content:'+'; float:right; color:var(--teal); font-weight:700;}
.faq-item[open] summary::after{content:'\2212';}
.faq-item p{padding:0 18px 16px; font-size:14px; color:var(--ink-soft); margin:0;}

/* Contenido ampliado en páginas de herramientas */
.tool-content{max-width:720px; margin:56px auto 0; padding:0 24px;}
.tool-content h2{font-size:20px; margin-bottom:12px; letter-spacing:-0.2px;}
.tool-content p{font-size:15px; color:var(--ink-soft); margin-bottom:14px;}
.tool-content ul{margin:0 0 14px 20px; font-size:15px; color:var(--ink-soft);}

/* LEGAL PAGES */
.legal-page{padding:56px 24px; max-width:720px; margin:0 auto;}
.legal-page h1{font-size:28px; margin-bottom:24px;}
.legal-page h2{font-size:18px; margin:28px 0 10px;}
.legal-page p{font-size:15px; margin-bottom:14px; color:var(--ink);}
.legal-page ul{margin:0 0 14px 22px; font-size:15px;}
.legal-page table{width:100%; border-collapse:collapse; margin-bottom:16px; font-size:14px;}
.legal-page td, .legal-page th{border:1px solid var(--border); padding:8px 10px; text-align:left;}

/* CALC PAGE */
.calc-page{padding:56px 24px;}
.calc-page .wrap{max-width:600px; margin:0 auto;}
.calc-page h1{font-size:32px; margin-bottom:12px; letter-spacing:-0.5px;}
.calc-page > .wrap > p{color:var(--ink-soft); margin-bottom:32px;}
.calc-block{margin-bottom:48px;}
.calc-block h2{font-size:18px; margin-bottom:16px;}

/* FOOTER — dark band bookend */
footer{background:var(--teal-deep); color:#DCE9E3; padding:40px 24px; margin-top:20px;}
.footer-grid{display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; font-size:13px; color:#B9CFC6;}
.footer-links{display:flex; gap:20px;}
.footer-links a:hover{color:#fff;}

/* TOGGLE SWITCH — personalización avanzada */
.toggle-row{display:flex; align-items:center; justify-content:space-between; gap:16px; background:#fff; border:1px solid var(--border); border-radius:12px; padding:14px 18px; margin:22px 0;}
.toggle-row .toggle-copy{display:flex; flex-direction:column; gap:2px;}
.toggle-row .toggle-label{font-size:14px; font-weight:600; color:var(--ink);}
.toggle-row .toggle-sub{font-size:12px; color:var(--ink-soft);}
.toggle-switch{position:relative; display:inline-block; width:44px; height:26px; flex-shrink:0;}
.toggle-switch input{opacity:0; width:0; height:0; position:absolute;}
.toggle-slider{position:absolute; cursor:pointer; inset:0; background:var(--border); border-radius:999px; transition:background .2s ease;}
.toggle-slider::before{content:''; position:absolute; height:20px; width:20px; left:3px; top:3px; background:#fff; border-radius:50%; transition:transform .2s ease; box-shadow:0 1px 3px rgba(0,0,0,.2);}
.toggle-switch input:checked + .toggle-slider{background:var(--teal);}
.toggle-switch input:checked + .toggle-slider::before{transform:translateX(18px);}

.advanced-panel{
  display:none; background:var(--sand); border:1px dashed var(--coral);
  border-radius:12px; padding:22px; margin-bottom:24px;
}
.advanced-panel.show{display:grid; grid-template-columns:1fr 1fr; gap:20px;}
.advanced-panel .adv-field{display:flex; flex-direction:column; gap:8px;}
.advanced-panel label{font-size:13px; font-weight:600; color:var(--teal-dark);}
.advanced-panel select{padding:9px 10px; border:1px solid var(--border); border-radius:8px; font-size:14px; font-family:'Inter',sans-serif; background:#fff; color:var(--ink);}
.logo-upload{display:flex; align-items:center; gap:14px;}
.logo-preview{width:56px; height:56px; border-radius:10px; background:#fff; border:1px solid var(--border); display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0;}
.logo-preview img{max-width:100%; max-height:100%; object-fit:contain;}
.logo-preview .ph{font-size:10px; color:var(--ink-soft); text-align:center; padding:4px;}
.logo-upload-btn{font-size:13px; font-weight:600; color:var(--teal); background:#fff; border:1px solid var(--teal); border-radius:8px; padding:9px 14px; cursor:pointer; white-space:nowrap;}
.logo-upload-btn:hover{background:var(--teal-light);}
.color-swatch-row{display:flex; gap:10px; align-items:center;}
input[type="color"]{width:44px; height:34px; border:1px solid var(--border); border-radius:6px; padding:2px; cursor:pointer; background:#fff;}
.adv-hint{grid-column:1 / -1; font-size:12px; color:var(--ink-soft); margin-top:-6px;}
@media (max-width:800px){ .advanced-panel.show{grid-template-columns:1fr;} }


@media (max-width:800px){
  .hero-grid{grid-template-columns:1fr;}
  .article-grid{grid-template-columns:1fr;}
  .hero h1{font-size:34px;}
  nav{gap:16px; flex-wrap:wrap;}
}

/* HAMBURGER / MOBILE NAV */
.hamburger{
  display:none; flex-direction:column; justify-content:center; align-items:center;
  gap:5px; width:40px; height:40px; background:none; border:none; cursor:pointer;
  flex-shrink:0; padding:0;
}
.hamburger span{width:22px; height:2px; background:var(--ink); border-radius:2px; transition:transform .2s ease, opacity .2s ease;}
.hamburger.open span:nth-child(1){transform:translateY(7px) rotate(45deg);}
.hamburger.open span:nth-child(2){opacity:0;}
.hamburger.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg);}

.mobile-nav{
  display:none; flex-direction:column; gap:0;
  padding:6px 24px 20px; background:var(--paper); border-top:1px solid var(--border);
}
.mobile-nav a{
  padding:14px 4px; font-size:15px; font-weight:500; color:var(--ink-soft);
  border-bottom:1px solid var(--border);
}
.mobile-nav a:last-child{border-bottom:none;}
.mobile-nav a.nav-cta{
  display:flex; align-items:center; gap:6px; justify-content:center;
  color:#fff; background:var(--coral); border-radius:10px; margin-top:12px; padding:13px; font-weight:600;
}
.mobile-nav.open{display:flex;}
body.nav-open{overflow:hidden;}

@media (max-width:760px){
  .nav-desktop{display:none;}
  .hamburger{display:flex;}
  .headerbar{padding:14px 20px;}
}

/* ITEMS TABLE (facturas / presupuestos) — scroll horizontal en móvil */
.items-table-wrap{overflow-x:auto; -webkit-overflow-scrolling:touch; margin-bottom:12px;}
.items-table-wrap table.items{min-width:540px; margin-bottom:0;}

/* Ajustes finos de móvil */
@media (max-width:480px){
  .wrap{padding:0 18px;}
  .hero{padding:52px 18px 36px;}
  .hero h1{font-size:29px; letter-spacing:-0.4px;}
  .hero p.lead{font-size:15.5px;}
  .calc-card{padding:22px 18px;}
  .calc-page h1{font-size:26px;}
  .article-page h1{font-size:26px;}
  .article-hero{height:140px;}
  .article-hero svg{width:92px; height:92px;}
  .section-head h2{font-size:22px;}
  .related-grid{grid-template-columns:1fr;}
  .toggle-row{flex-wrap:wrap;}
  .footer-grid{flex-direction:column; align-items:flex-start; text-align:left;}
}
