/* =========================================================
   CalcuVentas · estilos
   Tipografías autoalojadas (licencia SIL OFL, ver /fonts):
   Geist (texto), Geist Mono (etiquetas), Doto (cifras)
   ========================================================= */
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Doto"; src: url("fonts/doto-latin-900-normal.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --bg: #eeeeec;
  --surface: #ffffff;
  --surface-soft: rgba(255,255,255,.62);
  --text: #141414;
  --muted: #6b6b6b;
  --line: #e3e3e0;
  --ink: #111111;
  --accent: #d7f25a;          /* punto lima del menú */
  --good: #35d35a;            /* píldora verde */
  --good-ink: #0d3d18;
  --bad: #e5484d;
  --radius-lg: 22px;
  --radius: 14px;
  --sidebar: 248px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --dots: "Doto", "Geist Mono", ui-monospace, monospace;

  /* degradados pastel de las tarjetas */
  --g-olive:    linear-gradient(160deg, #e7dd6a 0%, #cdbb3c 55%, #b9a83a 100%);
  --g-lavender: linear-gradient(160deg, #b9b6ea 0%, #a3a0dc 50%, #c9a6d6 100%);
  --g-coral:    linear-gradient(160deg, #f3a07f 0%, #e8805f 55%, #d9776a 100%);
  --g-orange:   linear-gradient(160deg, #f6c07b 0%, #eea25c 55%, #e9b57a 100%);
  --g-pink:     linear-gradient(160deg, #f6a9c3 0%, #ee86a8 55%, #f2a7b8 100%);
  --g-mint:     linear-gradient(160deg, #b9ead6 0%, #93d9c0 55%, #a9e0d8 100%);
  --tone: var(--g-olive);
}

body[data-tone="lavender"] { --tone: var(--g-lavender); }
body[data-tone="coral"]    { --tone: var(--g-coral); }
body[data-tone="orange"]   { --tone: var(--g-orange); }
body[data-tone="pink"]     { --tone: var(--g-pink); }
body[data-tone="mint"]     { --tone: var(--g-mint); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(900px 520px at 92% -8%, rgba(250, 205, 120, .55), transparent 70%),
    radial-gradient(700px 420px at 70% -12%, rgba(245, 225, 150, .45), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--accent); }

/* ---------- barra lateral / cabecera ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(244,244,242,.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
header .wrap { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; padding-bottom: 12px; }
.logo { display: inline-flex; align-items: center; gap: 0; font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.logo::before {
  content: ""; width: 30px; height: 30px; border-radius: 9px; flex: none; margin-right: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d7f25a' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M7 8h10M7 12h4M13 12h4M7 16h4M13 16h4'/%3E%3C/svg%3E") center/18px no-repeat,
    var(--ink);
}
.logo span { font-weight: 300; color: var(--ink); }

nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
nav::-webkit-scrollbar { display: none; }
nav a {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  font-size: 14px; color: #3d3d3d; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
nav a:hover { background: rgba(0,0,0,.05); }
nav a.active { background: var(--ink); color: #fff; }
nav a::before {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor; opacity: .8;
  -webkit-mask: var(--ico) center/contain no-repeat; mask: var(--ico) center/contain no-repeat;
}
nav a.active::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }
nav a[href="index.html"]            { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11 12 4l8 7v8a1 1 0 0 1-1 1h-5v-6h-4v6H5a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
nav a[href="margen.html"]           { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19 10 13l4 4 6-8'/%3E%3Cpath d='M15 9h5v5'/%3E%3C/svg%3E"); }
nav a[href="precio-venta.html"]     { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12V4h8l10 10-8 8z'/%3E%3Ccircle cx='7.5' cy='8.5' r='1.5'/%3E%3C/svg%3E"); }
nav a[href="iva.html"]              { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M6 18 18 6'/%3E%3Ccircle cx='7' cy='7' r='2.5'/%3E%3Ccircle cx='17' cy='17' r='2.5'/%3E%3C/svg%3E"); }
nav a[href="factura-autonomo.html"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6z'/%3E%3Cpath d='M9 11h7M9 15h7M9 7h3'/%3E%3C/svg%3E"); }
nav a[href="punto-equilibrio.html"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v16M5 20h14'/%3E%3Cpath d='M4 9h16'/%3E%3Cpath d='M4 9l-2 5h4zM20 9l-2 5h4z'/%3E%3C/svg%3E"); }
nav a[href="comisiones.html"]       { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='13' rx='2'/%3E%3Cpath d='M3 10h18M7 15h3'/%3E%3C/svg%3E"); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- títulos ---------- */
.eyebrow {
  display: block; margin: 34px 0 6px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -.035em; font-weight: 300; margin: 34px 0 10px; }
.eyebrow + h1 { margin-top: 0; }
h1 strong { font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 680px; font-size: 16px; }

/* ---------- barra de estado ---------- */
.status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px;
  background: var(--surface-soft); border: 1px solid rgba(255,255,255,.8);
  border-radius: 999px; padding: 12px 22px; margin: 0 0 26px; font-size: 13.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.status .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.status b { font-weight: 600; }
.status small { display: block; color: var(--muted); font-size: 12px; }
.status .dot { display: inline-flex; gap: 8px; align-items: baseline; }
.status .dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; transform: translateY(-1px); }
.status .dot.warn::before { background: #f0a43a; }

/* ---------- pestañas y píldoras ---------- */
.tabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 9px 18px; border-radius: 999px; font: 500 14px var(--font); cursor: pointer; color: #3d3d3d; white-space: nowrap; }
.tab:hover { background: rgba(0,0,0,.04); }
.tab.active { background: var(--ink); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 15px; font: 500 14px var(--font); cursor: pointer; color: var(--text); transition: border-color .15s; }
.chip:hover { border-color: #bdbdb8; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- rejilla y tarjetas ---------- */
.grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 18px; align-items: start; }
.grid > * { min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.04); }
.card h2 { font-size: 17px; letter-spacing: -.01em; margin: 0 0 18px; font-weight: 600; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: #2b2b2b; }
.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
.field small a, .note a, .lead a { color: var(--ink); }
.input { display: flex; align-items: center; background: #f6f6f4; border: 1px solid transparent; border-radius: 12px; overflow: hidden; transition: border-color .15s, box-shadow .15s, background .15s; }
.input:focus-within { background: #fff; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(17,17,17,.07); }
.input input { flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; padding: 12px 14px; font: 500 16px var(--font); color: var(--text); outline: none; font-variant-numeric: tabular-nums; }
.input span { padding: 0 14px; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hidden { display: none !important; }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* ---------- resultado principal (tarjeta pastel) ---------- */
.result-main {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: 20px 20px 22px; margin-bottom: 18px;
  background: var(--tone); color: #1b1b1b;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.result-main::before {
  content: ""; position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M9 7h8v8'/%3E%3C/svg%3E") center/15px no-repeat;
}
.result-main::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(240px 120px at 50% 42%, rgba(255,255,255,.28), transparent 70%);
}
.result-main .label { position: relative; font-size: 15px; font-weight: 500; padding-right: 44px; }
.result-main .value {
  position: relative; font-family: var(--dots); font-weight: 900;
  font-size: clamp(40px, 7.4vw, 60px); line-height: 1.05; letter-spacing: .01em;
  margin: 26px 0 10px; color: #161616; overflow-wrap: anywhere;
}
.result-main .sub {
  position: relative; display: inline-block; font-size: 13px; font-weight: 600;
  background: var(--good); color: var(--good-ink); padding: 4px 10px; border-radius: 999px;
}
.result-main.bad { background: linear-gradient(160deg, #f6b3b0 0%, #ee8f8b 60%, #f0a9a0 100%); }
.result-main.bad .sub { background: #fff; color: #9b1c1f; }

/* ---------- desglose ---------- */
.lines { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.lines li:last-child { border-bottom: 0; }
.lines li span { color: #3d3d3d; }
.lines li b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines li.total { font-weight: 700; border-top: 1.5px solid var(--ink); border-bottom: 0; margin-top: 4px; }
.lines li.total span { color: var(--ink); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.kpi { background: #f6f6f4; border-radius: 16px; padding: 14px 14px 12px; }
.kpi .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); line-height: 1.4; min-height: 2.8em; }
.kpi .v { font-family: var(--dots); font-weight: 900; font-size: 27px; line-height: 1.15; margin-top: 6px; color: var(--ink); overflow-wrap: anywhere; }

.note { font-size: 12.5px; color: var(--muted); margin: 16px 0 0; line-height: 1.5; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; background: var(--ink); color: #fff; border-radius: 999px; padding: 11px 18px; font: 600 14px var(--font); cursor: pointer; margin-top: 16px; width: 100%; text-decoration: none; transition: transform .1s, background .15s; }
.btn:hover { background: #2a2a2a; }
.btn:active { transform: scale(.98); }

.ad-slot { margin: 28px 0; }

/* ---------- contenido ---------- */
article { background: var(--surface); border-radius: var(--radius-lg); padding: 32px; margin: 28px 0 44px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.04); }
article h2 { font-size: 24px; letter-spacing: -.025em; font-weight: 600; margin: 34px 0 10px; }
article h2:first-child { margin-top: 0; }
article h3 { font-size: 16.5px; font-weight: 600; margin: 22px 0 6px; }
article p, article li { color: #2b2b2b; }
article ul, article ol { padding-left: 22px; }
article li { margin: 4px 0; }
article a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
article code { font-family: var(--mono); font-size: 13.5px; background: #f3f3f0; padding: 3px 8px; border-radius: 8px; }
article table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; margin: 14px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
article th { background: #f6f6f4; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
article td, article th { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
article tr:last-child td { border-bottom: 0; }
article td { font-variant-numeric: tabular-nums; }

/* ---------- inicio: tarjetas de herramientas ---------- */
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.section-title h2 { font-size: 22px; letter-spacing: -.02em; margin: 0; font-weight: 300; }
.section-title h2 strong { font-weight: 700; }
.section-title span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 0 0 40px; }
.tool {
  position: relative; display: flex; flex-direction: column; min-height: 230px;
  border-radius: var(--radius-lg); padding: 20px; text-decoration: none; color: #161616; overflow: hidden;
  background: var(--g-olive); transition: transform .2s, box-shadow .2s;
}
.tool:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,.10); }
.tools .tool:nth-child(6n+2) { background: var(--g-lavender); }
.tools .tool:nth-child(6n+3) { background: var(--g-coral); }
.tools .tool:nth-child(6n+4) { background: var(--g-orange); }
.tools .tool:nth-child(6n+5) { background: var(--g-pink); }
.tools .tool:nth-child(6n+6) { background: var(--g-mint); }
.tool::after {
  content: ""; position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M9 7h8v8'/%3E%3C/svg%3E") center/15px no-repeat;
}
.tool h2 { font-size: 17px; font-weight: 600; margin: 0 44px 0 0; letter-spacing: -.01em; line-height: 1.25; }
.tool .art { display: block; width: 120px; height: 56px; margin: 18px auto 10px; color: rgba(255,255,255,.95); }
.tool .big { font-family: var(--dots); font-weight: 900; font-size: 34px; line-height: 1; margin-top: auto; }
.tool p { margin: 8px 0 0; font-size: 13.5px; color: rgba(0,0,0,.72); line-height: 1.4; }
.tool .soon { display: inline-block; margin-top: 10px; font-size: 12px; background: rgba(255,255,255,.6); padding: 2px 8px; border-radius: 999px; }
.tools.guides .tool { background: var(--surface) !important; min-height: 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.tools.guides .tool::after { background-color: #f1f1ee; }
.tools.guides .tool .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* ---------- pie ---------- */
footer { border-top: 1px solid var(--line); padding: 22px 0 28px; font-size: 13px; color: var(--muted); }
footer a { color: var(--muted); margin-right: 16px; white-space: nowrap; display: inline-block; margin-bottom: 6px; text-decoration: none; }
footer a:hover { color: var(--ink); }
footer span { font-family: var(--mono); font-size: 11.5px; }

/* ---------- escritorio: barra lateral como en un panel ---------- */
@media (min-width: 1100px) {
  header {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar);
    border-bottom: 0; border-right: 1px solid var(--line);
    background: rgba(248,248,246,.82);
  }
  header .wrap { height: 100%; padding: 24px 16px; gap: 26px; max-width: none; }
  .logo { padding: 0 8px; }
  nav { flex-direction: column; gap: 2px; overflow: visible; margin: 0; padding: 0; }
  nav a { padding: 10px 14px; font-size: 14.5px; }
  body { padding-left: var(--sidebar); }
  .wrap { padding: 0 40px; }
  footer .wrap { padding: 0 40px; }
  h1, .eyebrow { margin-top: 44px; }
}

/* ---------- móvil ---------- */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  article { padding: 22px 18px; }
  article td, article th { padding: 8px 10px; overflow-wrap: anywhere; }
  .status { border-radius: 20px; padding: 14px 18px; }
  .tool { min-height: 200px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
