/* FactuPulse — estilos
   La pieza central del diseño es la "hoja": la factura en papel. Todo lo
   demás (fondo, navegación, tablas) es tranquilo para que la hoja destaque. */

@font-face { font-family: "Bricolage"; src: url("fonts/bricolage.woff") format("woff"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope.woff") format("woff"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #F3F5F8;
  --paper: #FFFFFF;
  --ink: #14213D;
  --ink-2: #3D4860;
  --muted: #6B7489;
  --line: #DFE3EA;
  --line-2: #EDF0F4;
  --cobalt: #2F5BEA;
  --cobalt-ink: #1E43C2;
  --cobalt-wash: #EAF0FE;
  --paid: #0E7C59;
  --paid-wash: #E5F4EE;
  --late: #B4441C;
  --late-wash: #FBEDE6;
  --warn: #9A6B00;
  --warn-wash: #FBF3DC;
  --r: 10px;
  --r-sheet: 4px;
  --shadow-sheet: 0 1px 2px rgba(20, 33, 61, .06), 0 18px 40px -18px rgba(20, 33, 61, .28);
  --display: "Bricolage", "Manrope", system-ui, sans-serif;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--ui); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
a { color: var(--cobalt-ink); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.fine { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.gate { position: fixed; inset: 0; background: var(--bg); z-index: 100; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 8px; padding: 9px 15px; font-weight: 650; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #C5CCD8; background: #FAFBFC; }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.primary:hover { background: var(--cobalt-ink); border-color: var(--cobalt-ink); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(20, 33, 61, .04); }
.btn.danger { color: var(--late); }
.btn.big { padding: 13px 22px; font-size: 15.5px; border-radius: 10px; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--cobalt-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.iconbtn { background: none; border: 0; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; }
.iconbtn:hover { background: var(--line-2); color: var(--ink); }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 19px/1 var(--display); letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand img { display: block; height: auto; }
.brand.small { font-size: 15px; }

/* =============================================================
   PORTADA
   ============================================================= */
.home { overflow-x: hidden; }
.hnav { max-width: 1160px; margin: 0 auto; padding: 18px 24px; display: flex; align-items: center; gap: 28px; }
.hlinks { display: flex; gap: 22px; margin-left: 12px; }
.hlinks a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.hlinks a:hover { color: var(--ink); }
.hcta { margin-left: auto; display: flex; gap: 8px; }

.hero { max-width: 1160px; margin: 0 auto; padding: 56px 24px 88px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 64px; align-items: center; }
.hero h1 { font-size: clamp(38px, 5.4vw, 64px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; max-width: 13ch; }
.hero .lead { font-size: 18px; line-height: 1.6; color: var(--ink-2); margin: 24px 0 30px; max-width: 54ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .fine { margin-top: 14px; }

/* La hoja (factura) */
.sheet { background: var(--paper); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet); position: relative; }
.demo-sheet { padding: 34px 34px 30px; max-width: 470px; margin-left: auto; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line-2); }
.sheet-from { font: 700 15px/1.3 var(--display); }
.sheet-title { text-align: right; }
.sheet-kind { font: 800 22px/1 var(--display); color: var(--cobalt); letter-spacing: -.01em; margin-bottom: 6px; }
.sheet-muted { color: var(--muted); font-size: 12.5px; }
.sheet-to { padding: 16px 0; font-size: 14px; font-weight: 600; }
.sheet-to .sheet-muted { font-weight: 500; margin-right: 8px; }
.sheet-lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet-lines th { text-align: left; font-size: 12px; font-weight: 700; color: #fff; background: var(--cobalt); padding: 7px 10px; }
.sheet-lines th.r { text-align: right; }
.sheet-lines td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.demo-edit { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.demo-edit input { width: 76px; text-align: right; border: 1px dashed var(--cobalt); border-radius: 5px; padding: 2px 6px; background: var(--cobalt-wash); font-weight: 700; color: var(--cobalt-ink); }
.sheet-totals { margin: 16px 0 0 auto; width: min(100%, 290px); font-size: 14px; }
.sheet-totals div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink-2); }
.sheet-totals dt, .sheet-totals dd { margin: 0; }
.sheet-totals label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.sheet-totals input[type=checkbox] { accent-color: var(--cobalt); }
.sheet-totals .grand { border-top: 2px solid var(--cobalt); margin-top: 8px; padding-top: 10px; color: var(--ink); font: 800 20px/1.2 var(--display); }
.demo-hint { color: var(--muted); font-size: 13px; text-align: right; margin: 14px 0 0; }

/* El sello: el único momento animado de la portada */
.stamp { position: absolute; left: 34px; bottom: 44px; border: 3px solid var(--paid); color: var(--paid); border-radius: 8px; padding: 4px 14px;
  font: 800 22px/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; transform: rotate(-11deg); opacity: 0; pointer-events: none;
  mix-blend-mode: multiply; }
.stamp.on { animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) .9s forwards; }
@keyframes stamp { from { opacity: 0; transform: rotate(-11deg) scale(1.8); } to { opacity: .9; transform: rotate(-11deg) scale(1); } }

.band { background: var(--paper); border-block: 1px solid var(--line); }
.band-inner { max-width: 1160px; margin: 0 auto; padding: 80px 24px; }
.band-inner.narrow { max-width: 760px; }
.band h2, .pricing h2, .faq h2, .final h2 { font-size: clamp(28px, 3.4vw, 40px); margin-bottom: 18px; }
.band-inner.narrow p { font-size: 17px; line-height: 1.65; color: var(--ink-2); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 48px; margin-top: 36px; }
.feat h3 { font-size: 19px; margin-bottom: 10px; padding-top: 14px; border-top: 2px solid var(--ink); }
.feat p { margin: 0; color: var(--ink-2); line-height: 1.6; }

.pricing { max-width: 920px; margin: 0 auto; padding: 88px 24px; text-align: center; }
.section-lead { color: var(--ink-2); font-size: 17px; max-width: 56ch; margin: 0 auto 26px; }
.billing-toggle { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 28px; }
.billing-toggle button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font-weight: 650; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.billing-toggle button[aria-checked=true] { background: var(--ink); color: #fff; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; text-align: left; }
.plan { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 30px; display: flex; flex-direction: column; }
.plan.plus { border: 2px solid var(--cobalt); }
.plan h3 { font-size: 22px; }
.price { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 6px; }
.price .amount { font: 800 44px/1 var(--display); letter-spacing: -.03em; }
.price .per { color: var(--muted); font-weight: 600; }
.plan-desc { color: var(--ink-2); margin: 0 0 18px; }
.ticks { list-style: none; padding: 0; margin: 0 0 26px; flex: 1; }
.ticks li { padding: 7px 0 7px 26px; position: relative; border-top: 1px solid var(--line-2); font-size: 14.5px; }
.ticks li::before { content: ""; position: absolute; left: 3px; top: 13px; width: 10px; height: 6px; border-left: 2px solid var(--paid); border-bottom: 2px solid var(--paid); transform: rotate(-45deg); }

.faq { max-width: 760px; margin: 0 auto; padding: 88px 24px; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 20px; color: var(--muted); line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; color: var(--ink-2); }
.final { text-align: center; padding: 40px 24px 96px; }
.final h2 { margin-bottom: 24px; }
.hfoot { max-width: 1160px; margin: 0 auto; padding: 28px 24px 40px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; }
.hfoot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.hfoot nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.hfoot .fine { margin-left: auto; }

/* =============================================================
   APP
   ============================================================= */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; border-right: 1px solid var(--line); background: var(--bg); }
.side .brand { padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 7px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.nav a:hover { background: rgba(20, 33, 61, .05); color: var(--ink); }
.nav a.on { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.plus-tag { font-size: 11px; font-weight: 700; color: var(--cobalt-ink); background: var(--cobalt-wash); border-radius: 4px; padding: 1px 6px; }
.app.is-plus .plus-tag { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 10px; }
.plan-pill { align-self: flex-start; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-decoration: none; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); }
.plan-pill.plus { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.who { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .linkbtn { align-self: flex-start; font-size: 13px; color: var(--muted); }
.main { min-width: 0; padding: 28px 36px 80px; }
.view { max-width: 1100px; margin: 0 auto; outline: none; }
.tabbar { display: none; }
.banner { max-width: 1100px; margin: 0 auto 18px; background: var(--warn-wash); border: 1px solid #EBD9A3; border-radius: 8px; padding: 10px 14px; font-size: 14px; display: flex; gap: 14px; justify-content: space-between; align-items: center; flex-wrap: wrap; }

/* Cabecera de cada pantalla */
.vhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.vhead h1 { font-size: 30px; }
.vhead p { margin: 6px 0 0; color: var(--muted); }
.vhead .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back:hover { color: var(--ink); }

/* Paneles */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 17px; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .panel + .panel { margin-top: 0; }

/* Cifras del panel */
.figures { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; }
.fig { padding: 18px 20px; border-left: 1px solid var(--line); min-width: 0; }
.fig:first-child { border-left: 0; }
.fig .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.fig .v { font: 700 25px/1.2 var(--display); letter-spacing: -.02em; margin-top: 4px; }
.fig .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.fig.late .v { color: var(--late); }
.taxline { display: flex; flex-wrap: wrap; gap: 8px 26px; align-items: baseline; background: var(--ink); color: #fff; border-radius: var(--r); padding: 16px 20px; margin-bottom: 18px; }
.taxline .t { font-weight: 700; }
.taxline .i { color: #C9D2E6; font-size: 14px; }
.taxline .i b { color: #fff; font: 700 18px var(--display); margin-left: 6px; }
.taxline .fine { color: #A9B4CC; margin-left: auto; }

/* Gráfico mensual */
.chart { width: 100%; height: auto; display: block; }
.chart .bi { fill: var(--cobalt); }
.chart .be { fill: #C4CBD8; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--ui); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Tablas */
.tablewrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 650; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #F8F9FC; }
.tbl .strong { font-weight: 700; }
.tbl .sub { display: block; color: var(--muted); font-size: 12.5px; }
.tbl tfoot td { font-weight: 700; background: #FAFBFC; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 48px 20px; }
.empty h3 { font-size: 19px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin: 0 auto 18px; max-width: 46ch; }

/* Estados */
.chip { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.chip.issued, .chip.sent { background: var(--cobalt-wash); color: var(--cobalt-ink); }
.chip.paid, .chip.accepted { background: var(--paid-wash); color: var(--paid); }
.chip.partial { background: var(--warn-wash); color: var(--warn); }
.chip.overdue, .chip.rejected { background: var(--late-wash); color: var(--late); }
.chip.credit, .chip.invoiced { background: #EFEAFB; color: #5B3DB5; }

/* Filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-weight: 650; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: #fff; }
.search { flex: 1; min-width: 180px; max-width: 320px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; border: 1px solid #CDD3DE; background: var(--paper); border-radius: 7px; padding: 9px 11px; font-size: 14.5px; min-width: 0; }
.field textarea { resize: vertical; min-height: 70px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-wash); }
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c1 { grid-column: span 1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--cobalt); width: 16px; height: 16px; flex: none; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.err { color: var(--late); font-size: 13.5px; font-weight: 600; min-height: 0; margin-top: 8px; }
.hint { background: var(--cobalt-wash); color: var(--cobalt-ink); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.hint.warn { background: var(--warn-wash); color: #6F4D00; }

/* =============================================================
   EDITOR Y VISTA DE FACTURA (la hoja)
   ============================================================= */
.doc-layout { display: grid; grid-template-columns: 1fr 290px; gap: 22px; align-items: start; }
.doc-sheet { padding: 40px 44px 44px; }
.doc-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.doc-logo img { max-height: 56px; max-width: 200px; display: block; }
.doc-logo .name { font: 800 22px/1.15 var(--display); color: var(--accent, var(--cobalt)); }
.doc-kind { font: 800 26px/1 var(--display); color: var(--accent, var(--cobalt)); text-align: right; margin-bottom: 10px; letter-spacing: -.01em; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 3px 14px; font-size: 13.5px; justify-content: end; }
.doc-meta dt { color: var(--muted); text-align: right; }
.doc-meta dd { margin: 0; font-weight: 700; text-align: right; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 26px; }
.doc-parties h4 { margin: 0 0 6px; font-size: 12px; color: var(--accent, var(--cobalt)); font-weight: 800; }
.doc-parties .nm { font-weight: 700; font-size: 15px; }
.doc-parties p { margin: 0; font-size: 13.5px; color: var(--ink-2); white-space: pre-line; }
.doc-lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-lines th { background: var(--accent, var(--cobalt)); color: #fff; font-size: 12px; font-weight: 700; padding: 8px 10px; text-align: right; }
.doc-lines th:first-child { text-align: left; }
.doc-lines td { padding: 10px; border-bottom: 1px solid var(--line-2); text-align: right; vertical-align: top; }
.doc-lines td:first-child { text-align: left; white-space: pre-line; }
.doc-lines td:not(:first-child) { white-space: nowrap; }
.doc-bottom { display: grid; grid-template-columns: 1fr 300px; gap: 28px; margin-top: 20px; }
.doc-pay { font-size: 13.5px; color: var(--ink-2); }
.doc-pay b { color: var(--ink); }
.doc-totals { font-size: 14px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink-2); gap: 12px; }
.doc-totals .grand { border-top: 2px solid var(--accent, var(--cobalt)); margin-top: 8px; padding-top: 10px; color: var(--ink); font: 800 21px var(--display); }
.doc-notes { margin-top: 24px; font-size: 13px; color: var(--ink-2); white-space: pre-line; }
.doc-notes b { display: block; color: var(--ink); margin-bottom: 2px; }
.doc-rect { background: #F6F7FA; border-radius: 6px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 18px; }
.doc-sheet .stamp { position: static; display: inline-block; opacity: .85; margin: 22px 0 0 8px; }
.doc-sheet .stamp.late { border-color: var(--late); color: var(--late); }
.doc-sheet .stamp.draft { border-color: var(--muted); color: var(--muted); }
.doc-sheet .stamp.credit { border-color: #5B3DB5; color: #5B3DB5; }

.side-actions { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.side-actions .panel { padding: 16px; }
.side-actions .btn { width: 100%; }
.side-actions .stack { display: flex; flex-direction: column; gap: 8px; }
.kv { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; gap: 10px; }
.kv span:first-child { color: var(--muted); }
.paylist { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13.5px; }
.paylist li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px solid var(--line-2); gap: 8px; }
.paylist li > span:last-child { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.paylist .iconbtn { width: 26px; height: 26px; font-size: 16px; }

/* Editor */
.ed-sheet { padding: 32px 36px 36px; }
.ed-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; margin-bottom: 16px; }
.ed-client { grid-column: span 6; } .ed-date { grid-column: span 3; }
.client-box { border: 1px dashed #C5CCD8; border-radius: 8px; padding: 12px 14px; font-size: 14px; background: #FBFCFD; }
.client-box .nm { font-weight: 700; }
.client-box p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; white-space: pre-line; }
.lines-ed { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.lines-ed th { font-size: 12px; color: var(--muted); font-weight: 650; text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.lines-ed td { padding: 6px 4px; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.lines-ed input, .lines-ed select, .lines-ed textarea { width: 100%; border: 1px solid transparent; background: #F7F8FA; border-radius: 6px; padding: 7px 8px; font-size: 14px; }
.lines-ed input:hover, .lines-ed select:hover, .lines-ed textarea:hover { border-color: #D6DBE4; }
.lines-ed input:focus, .lines-ed select:focus, .lines-ed textarea:focus { outline: none; border-color: var(--cobalt); background: #fff; }
.lines-ed textarea { resize: none; min-height: 36px; overflow: hidden; line-height: 1.4; }
.lines-ed .n input { text-align: right; }
.lines-ed .amt { text-align: right; font-weight: 700; padding-top: 14px; white-space: nowrap; }
.w-qty { width: 72px; } .w-price { width: 104px; } .w-disc { width: 70px; } .w-vat { width: 84px; } .w-amt { width: 104px; } .w-x { width: 34px; }
.add-line { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.add-line select { max-width: 280px; }
.ed-bottom { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.ed-extras { display: flex; flex-direction: column; gap: 14px; }

/* Medidores de uso */
.meter { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--cobalt); border-radius: 99px; }
.meter.full i { background: var(--late); }

/* Onboarding */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.checklist li:first-child { border-top: 0; }
.checklist .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #C5CCD8; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.checklist li.done .dot { background: var(--paid); border-color: var(--paid); color: #fff; }
.checklist li.done .t { color: var(--muted); text-decoration: line-through; }
.checklist .t { flex: 1; font-weight: 600; }

/* Impuestos */
.taxgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.taxgrid .panel + .panel { margin-top: 0; }
.taxrow { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 14px; gap: 12px; }
.taxrow:first-of-type { border-top: 0; }
.taxrow.res { font-weight: 800; font-size: 16px; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; }
.taxrow.res .neg { color: var(--paid); }
.model-code { color: var(--muted); font-weight: 600; font-size: 13px; margin-left: 6px; }
.locked { position: relative; }
.locked > .blur { filter: blur(5px); pointer-events: none; user-select: none; opacity: .55; }
.locked > .over { position: absolute; inset: 0; display: grid; place-items: center; }
.upsell { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 26px; max-width: 460px; text-align: center; box-shadow: var(--shadow-sheet); }
.upsell h3 { font-size: 21px; margin-bottom: 8px; }
.upsell p { color: var(--ink-2); margin: 0 0 18px; }

/* Ajustes */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.logo-prev { width: 180px; height: 80px; border: 1px dashed #C5CCD8; border-radius: 8px; display: grid; place-items: center; background: #FBFCFD; overflow: hidden; color: var(--muted); font-size: 13px; }
.logo-prev img { max-width: 100%; max-height: 100%; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }

/* Plan */
.plancards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plancards .panel + .panel { margin-top: 0; }
.plancards .current { border: 2px solid var(--cobalt); }

/* Diálogos */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px -20px rgba(20, 33, 61, .45); color: var(--ink); }
.dlg::backdrop { background: rgba(20, 33, 61, .45); }
.dlg .dlg-in { padding: 26px 28px 24px; }
.dlg h2 { font-size: 22px; margin-bottom: 6px; }
.dlg .sub { color: var(--muted); margin: 0 0 18px; }
.dlg.auth { width: min(430px, calc(100vw - 24px)); }
.dlg.wide { width: min(860px, calc(100vw - 24px)); }
.dlg-x { position: absolute; right: 10px; top: 8px; margin: 0; }
.dlg-x button { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.auth .stack { display: flex; flex-direction: column; gap: 14px; }
.auth .switch { text-align: center; font-size: 14px; color: var(--muted); margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 200; box-shadow: 0 12px 30px -10px rgba(20, 33, 61, .5); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--late); }
.cookie { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; gap: 14px; align-items: center; font-size: 13.5px; box-shadow: var(--shadow-sheet); z-index: 150; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 48px; padding-top: 32px; }
  .demo-sheet { margin: 0 auto; }
  .demo-hint { text-align: center; }
  .features { grid-template-columns: 1fr 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
  .side-actions { position: static; }
  .figures { grid-template-columns: 1fr 1fr; }
  .fig:nth-child(3) { border-left: 0; }
  .fig:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .hlinks { display: none; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 30% 0 0; z-index: 60; background: var(--paper); box-shadow: 0 0 0 100vmax rgba(20, 33, 61, .4); overflow-y: auto; }
  .main { padding: 18px 16px 96px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--paper); border-top: 1px solid var(--line); z-index: 50; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { background: none; border: 0; text-align: center; padding: 8px 2px; color: var(--ink-2); text-decoration: none; font-weight: 650; font-size: 12.5px; cursor: pointer; }
  .tabbar a.on { color: var(--cobalt-ink); }
  .tabbar .tab-new { font-size: 24px; line-height: 1; color: #fff; background: var(--cobalt); border-radius: 12px; margin: 0 10px; padding: 6px 0; }
  .grid2, .taxgrid, .plancards, .plans, .doc-parties, .doc-bottom, .ed-bottom { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .c1, .c2, .c3, .c4, .c6 { grid-column: span 2; }
  .form-grid .half { grid-column: span 1; }
  .ed-client, .ed-date { grid-column: span 12; }
  .doc-sheet, .ed-sheet { padding: 22px 18px; }
  .doc-top { flex-direction: column; }
  .doc-kind, .doc-meta { text-align: left; justify-content: start; }
  .doc-meta dt, .doc-meta dd { text-align: left; }
  .tbl .hide-m { display: none; }
  .vhead h1 { font-size: 25px; }
  .taxline .fine { margin-left: 0; }
  /* Líneas del editor en formato tarjeta en móvil */
  .lines-ed thead { display: none; }
  .lines-ed, .lines-ed tbody, .lines-ed tr, .lines-ed td { display: block; width: 100%; }
  .lines-ed tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .lines-ed td { border: 0; padding: 0; }
  .lines-ed td.desc { grid-column: 1 / -1; }
  .lines-ed td.amt { grid-column: 1 / 3; text-align: left; padding-top: 6px; }
  .lines-ed td.x { text-align: right; }
  .lines-ed td[data-l]::before { content: attr(data-l); display: block; font-size: 11.5px; color: var(--muted); font-weight: 650; }
  .doc-lines .hide-m { display: none; }
}
@media (max-width: 560px) {
  .hnav { padding: 14px 16px; gap: 10px; }
  .hcta .ghost { display: none; }
  .hero { padding: 24px 16px 64px; }
  .hero .lead { font-size: 16.5px; }
  .demo-sheet { padding: 22px 18px; }
  .demo-sheet .stamp { bottom: 30px; left: 18px; font-size: 17px; }
  .features { grid-template-columns: 1fr; }
  .band-inner, .pricing, .faq { padding: 60px 16px; }
  .figures { grid-template-columns: 1fr 1fr; }
  .fig { padding: 14px; }
  .fig .v { font-size: 20px; }
  .hfoot .fine { margin-left: 0; }
  .dlg .dlg-in { padding: 22px 18px 18px; }
}

@media print {
  .side, .tabbar, .side-actions, .vhead .actions, .banner, .back, .cookie { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .doc-layout { display: block; }
  .sheet { box-shadow: none; }
  body { background: #fff; }
}
@media (max-width: 820px) { .app:not([hidden]) ~ .cookie { bottom: 84px; } }
/* Sello de la portada: junto a la línea "Para", donde no tapa ninguna cifra */
.demo-sheet .stamp { left: auto; right: 30px; bottom: auto; top: 112px; }
@media (max-width: 560px) { .demo-sheet { padding-bottom: 76px; } .demo-sheet .stamp { left: auto; right: 18px; top: auto; bottom: 20px; font-size: 16px; } }

/* ---------- Equipo, solo lectura y empresas ---------- */
.app.readonly [data-write] { display: none !important; }
.cosel { padding: 0 6px; }
.cosel select { width: 100%; font-size: 13px; padding: 7px 8px; background: var(--paper); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.banner.ro { background: var(--cobalt-wash); border-color: #C9D6FB; }

/* ---------- Avisos ---------- */
.notice { border-radius: 8px; padding: 12px 14px; font-size: 14px; margin: 10px 0; background: var(--warn-wash); border: 1px solid #EBD9A3; }
.notice.ok { background: var(--paid-wash); border-color: #BFE2D3; }
.notice.warn { background: var(--warn-wash); }
.errlist { margin: 8px 0 0; padding-left: 18px; max-height: 180px; overflow: auto; font-size: 13px; color: var(--late); }
ol.steps { padding-left: 20px; margin: 10px 0 16px; display: flex; flex-direction: column; gap: 6px; }
ol.steps code, .notice code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---------- Importar ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 26px 16px; border: 1.5px dashed #B9C2D3; border-radius: var(--r); background: var(--paper); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--cobalt); background: var(--cobalt-wash); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.dropzone small { color: var(--muted); font-size: 13px; }

/* ---------- Casillas de modelos ---------- */
details.casillas { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
details.casillas summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--cobalt-ink); }
details.casillas .tbl { margin-top: 8px; font-size: 13.5px; }
details.casillas td.cas { width: 52px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Tesorería ---------- */
.tbl.cash .neg, .kv .neg { color: var(--late); }
.tbl.cash tr.cash-items td { background: var(--line-2); padding: 8px 14px; }
.tbl.cash tr.cash-items .kv { font-size: 13.5px; padding: 3px 0; }
.tbl.cash td.num { white-space: nowrap; }

/* ---------- Administración ---------- */
.banner.test { background: #EAF6FF; border-color: #BFE0FA; }
.chip.ok, .chip.plan-plus { background: var(--paid-wash); color: var(--paid); }
.chip.bad { background: var(--late-wash); color: var(--late); }
.chip.plan-trial { background: var(--cobalt-wash); color: var(--cobalt-ink); }
.chip.plan-manual { background: #EFEAFB; color: #5B3DB5; }
.adm-grid { gap: 22px; margin-bottom: 8px; }
#modalBody h3, .panel h3 { font-size: 15px; margin: 18px 0 8px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.check-row:last-child { border-bottom: 0; }
.check-row .sub { display: block; color: var(--muted); font-size: 13px; }
.check-row .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.check-row.ok .dot { background: var(--paid-wash); color: var(--paid); }
.check-row.ko .dot { background: var(--late-wash); color: var(--late); }
.ext { display: flex; flex-wrap: wrap; gap: 6px; }
pre.log { background: #0F1A30; color: #DCE3F0; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 14px; border-radius: 8px; max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ---------- Menú «Más acciones» ---------- */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary::after { content: "▾"; margin-left: 6px; font-size: 11px; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px -12px rgba(20, 33, 61, .3); padding: 6px; display: flex; flex-direction: column; }
.dd-menu a, .dd-menu button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 7px; font-size: 14px; color: var(--ink); text-decoration: none; cursor: pointer; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--line-2); }
.seen { color: var(--paid); display: inline-flex; vertical-align: -2px; }

/* ---------- Factura rápida ---------- */
.quick { max-width: 560px; margin: 0 auto; }
.quick h1 { margin-bottom: 4px; }
.quick .sub { margin: 0 0 16px; color: var(--muted); }
.big-amount { font-size: 22px !important; font-weight: 700; }
.quick-total { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--cobalt-wash); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
.quick-total b { font: 700 22px/1 var(--display); white-space: nowrap; }
.btn.block { width: 100%; justify-content: center; }
.quick-done { text-align: center; }
.quick-done .ok-dot { width: 54px; height: 54px; margin: 6px auto 12px; border-radius: 50%; background: var(--paid-wash); color: var(--paid); display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.quick-done .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ---------- Facturación masiva ---------- */
.bk-list { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
.bk-list .check small { display: block; }

/* ---------- Importar desde foto ---------- */
.ph-tbl input { width: 100%; min-width: 80px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 13px; background: var(--paper); }
.ph-tbl input[type=checkbox] { width: auto; min-width: 0; }

/* ---------- Calendario fiscal ---------- */
.cal-panel { margin: -6px 0 18px; padding: 12px 18px; }
.cal-panel summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.cal-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.cal-list li { display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
@media (max-width: 640px) { .cal-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Diseños de PDF ---------- */
.tpl-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .tpl-cards { grid-template-columns: repeat(2, 1fr); } }
.tpl-card { text-align: left; border: 1.5px solid var(--line); background: var(--paper); border-radius: 10px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; color: var(--ink); }
.tpl-card.on { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-wash); }
.tpl-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.tpl-mini { display: block; height: 84px; border: 1px solid var(--line); border-radius: 4px; padding: 8px; margin-bottom: 6px; position: relative; overflow: hidden; background: #fff; }
.tpl-mini i { display: block; height: 5px; border-radius: 3px; background: #E3E8F0; margin-bottom: 6px; }
.tpl-mini i:nth-child(1) { width: 45%; height: 7px; background: var(--accent); margin-bottom: 14px; }
.tpl-mini i:nth-child(2) { height: 8px; background: var(--accent); }
.tpl-mini i:nth-child(4) { width: 40%; margin-left: auto; margin-top: 14px; background: var(--ink); }
.tpl-moderna .tpl-mini::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 26%; background: var(--accent); }
.tpl-moderna .tpl-mini i:nth-child(1) { position: relative; background: #fff; }
.tpl-moderna .tpl-mini i:nth-child(4) { background: var(--accent); height: 9px; }
.tpl-minimal .tpl-mini i:nth-child(1), .tpl-minimal .tpl-mini i:nth-child(2) { background: var(--ink); }
.tpl-minimal .tpl-mini i:nth-child(2) { height: 2px; }
.tpl-elegante .tpl-mini i:nth-child(2) { background: color-mix(in srgb, var(--accent) 18%, #fff); }
