/* Visor de factura electrónica — estilo sobrio: blanco, negro y mucho aire. */

:root {
  --ink: #0b0b0c;
  --ink-2: #45464d;
  --ink-3: #85868f;
  --line: #e8e8ea;
  --line-2: #d4d4d8;
  --bg: #ffffff;
  --soft: #f4f4f1;
  --soft-2: #ebebe6;
  --ok: #12805c;
  --ok-bg: #e6f4ed;
  --warn: #9a5a00;
  --warn-bg: #fdf2df;
  --warn-dot: #d58a00;
  --bad: #c0362c;
  --bad-bg: #fcebea;
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 28px;
  --shadow: 0 1px 2px rgba(11, 11, 12, 0.04), 0 10px 32px rgba(11, 11, 12, 0.06);
  --font: "Inter Tight", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1200px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 1360px; margin: 0 auto; padding: 0 24px; }

.skip { position: absolute; left: -9999px; top: 12px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius); }
.skip:focus { left: 16px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px;
  border-radius: var(--radius); border: 1.5px solid var(--ink);
  font-size: 17px; font-weight: 500; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #2b2b30; border-color: #2b2b30; }
.btn-line { background: #fff; color: var(--ink); }
.btn-line:hover { background: var(--soft); }
.btn-sm { height: 40px; padding: 0 14px; font-size: 15px; }
.btn-xs { height: 32px; padding: 0 12px; font-size: 13.5px; border-width: 1px; }
.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--radius); border: 1px solid var(--line-2); background: #fff;
  cursor: pointer;
}
.icon-btn:hover { background: var(--soft); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-in { display: flex; align-items: center; gap: 36px; height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 21px; letter-spacing: -0.02em; flex: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.nav { display: flex; gap: 26px; flex: 1; min-width: 0; }
.nav a { text-decoration: none; font-size: 16px; white-space: nowrap; }
.nav a:hover { text-decoration: underline; text-underline-offset: 6px; }
.nav a[aria-current="page"] { font-weight: 600; }
.header-cta { margin-left: auto; }

/* ---------- Portada ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 64px; align-items: center;
  padding-top: 40px; padding-bottom: 72px;
}
.eyebrow { margin: 0 0 18px; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.hero h1 {
  margin: 0 0 36px;
  font-size: clamp(42px, 5.4vw, 72px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700;
  text-wrap: balance;
}
.checks { list-style: none; margin: 0 0 36px; padding: 0; display: grid; gap: 12px; font-size: 18px; }
.checks li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; }
.checks li::before {
  content: ""; width: 18px; height: 18px; margin-top: 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0b0c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") no-repeat center / contain;
}
.checks strong { font-weight: 650; }
.cta { display: flex; gap: 14px; flex-wrap: wrap; }
.fine { margin: 16px 0 0; font-size: 14px; color: var(--ink-3); }

.dropcard {
  position: relative; overflow: hidden;
  aspect-ratio: 1 / 1.02;
  display: grid; place-items: center;
  border-radius: var(--radius-xl);
  background: radial-gradient(120% 90% at 70% 10%, #fbfbf9 0%, var(--soft) 55%, var(--soft-2) 100%);
  cursor: pointer;
  transition: background-color 0.2s;
}
.dropcard::after {
  content: ""; position: absolute; inset: 14px; pointer-events: none;
  border: 2px dashed transparent; border-radius: 20px;
  transition: border-color 0.2s;
}
.dropcard:hover::after { border-color: var(--line-2); }
body.dragging .dropcard::after { border-color: var(--ink); }
.dropcard:focus-visible { outline-offset: 4px; }

.mock {
  width: 70%; max-width: 420px;
  padding: 24px 24px 20px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 30px 70px rgba(0, 0, 0, 0.12);
  font-size: 12px; color: var(--ink);
  transform: rotate(-2.5deg) translateY(-22px);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.dropcard:hover .mock { transform: rotate(-1.5deg) translateY(-28px); }
.mock-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.mock-kind { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.mock-chip { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.mock-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 14px; }
.mock-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.mock-parties div { background: var(--soft); border-radius: 8px; padding: 9px 10px; min-width: 0; }
.mock-parties b { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-parties span { display: block; color: var(--ink-3); font-size: 10px; }
.mock-lines { border-top: 1px solid var(--ink); }
.mock-lines div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mock-lines span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-lines b { font-weight: 600; white-space: nowrap; }
.mock-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
.mock-total span { color: var(--ink-2); }
.mock-total strong { font-size: 20px; letter-spacing: -0.02em; }
.mock-actions { display: flex; gap: 8px; margin-top: 14px; }
.mock-actions span { flex: 1; text-align: center; padding: 8px 0; border: 1px solid var(--ink); border-radius: 6px; font-size: 11px; font-weight: 600; }
.mock-actions .dark { background: var(--ink); color: #fff; }
.drop-hint {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: 999px;
  background: #fff; box-shadow: var(--shadow);
  font-size: 15px; white-space: nowrap;
}

.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

/* ---------- Visor ---------- */
.workspace {
  display: grid; grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px; align-items: start;
  padding-top: 24px; padding-bottom: 72px;
}
.side {
  position: sticky; top: 96px;
  max-height: calc(100vh - 116px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; overflow: hidden;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 18px; }
.side-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.count { color: var(--ink-3); font-weight: 500; }
.side input[type="search"] {
  margin: 0 12px 8px; height: 40px; padding: 0 12px 0 36px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385868f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center / 16px;
  font-size: 14.5px;
}
.side input[type="search"]:focus { outline: none; border-color: var(--ink); }
.list { list-style: none; margin: 0; padding: 2px 8px 8px; overflow: auto; flex: 1; min-height: 0; }
.item {
  width: 100%; display: grid; gap: 3px;
  padding: 11px 12px; border: 0; border-radius: 10px;
  background: none; text-align: left; cursor: pointer;
}
.item:hover { background: var(--soft); }
.item.active { background: var(--ink); color: #fff; }
.item-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.item-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-total { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.item-sub > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.active .item-sub { color: rgba(255, 255, 255, 0.7); }
.tag { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.item.active .tag { background: rgba(255, 255, 255, 0.16); color: #fff; }
.empty-list { padding: 18px 12px; font-size: 14px; color: var(--ink-3); text-align: center; }
.side-foot { display: grid; gap: 8px; padding: 12px 18px 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.side-foot b { color: var(--ink); font-weight: 600; }
.side-foot .muted { color: var(--ink-3); }
.side-actions { display: flex; gap: 18px; flex-wrap: wrap; }

.stage { min-width: 0; scroll-margin-top: 92px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 16px; }
.crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-right: auto; min-width: 0; font-size: 14px; color: var(--ink-2); }
.crumb b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Factura ---------- */
.paper {
  padding: 44px 48px 32px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-size: 14.5px;
}
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.inv-kind { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.inv-kind .chip { letter-spacing: 0; text-transform: none; }
.inv-number { margin: 8px 0 18px; font-size: 34px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; overflow-wrap: anywhere; }
.inv-meta { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.inv-meta dt { font-size: 12.5px; color: var(--ink-3); }
.inv-meta dd { margin: 2px 0 0; font-weight: 600; }
.inv-total { flex: none; text-align: right; }
.inv-total .label { font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.inv-total .amount { margin-top: 6px; font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-total .sub { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.inv-total .sub b { color: var(--ink); }

.parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 28px 0; }
.party { padding: 18px 20px; border-radius: 12px; background: var(--soft); min-width: 0; }
.label-sm { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.party-name { margin-bottom: 4px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.party-addr { margin-bottom: 4px; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 10px 0 0; font-size: 13.5px; }
.kv > div { display: contents; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.mark { margin-left: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.mark.ok { color: var(--ok); }
.mark.bad { color: var(--bad); }

.block { padding: 24px 0; border-top: 1px solid var(--line); }
.parties + .block { border-top: 0; padding-top: 0; }
.block h3 { margin: 0 0 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.notes p { margin: 0 0 8px; white-space: pre-line; }
.notes .kv { margin-top: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  padding: 0 10px 10px; border-bottom: 1px solid var(--ink);
  text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.num { text-align: right; white-space: nowrap; }
.c-n { width: 1%; color: var(--ink-3); }
.desc { font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; min-width: 180px; }
.line-meta { margin-top: 3px; font-size: 13px; color: var(--ink-3); }
.line-meta span + span::before { content: " · "; }
.taxes td:first-child { min-width: 140px; }

.summary { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.totals { margin: 0; }
.totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; }
.totals dt { color: var(--ink-2); }
.totals dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals .strong { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--ink); }
.totals .strong + .strong { margin-top: 0; border-top-color: var(--line); }
.totals .strong dt { color: var(--ink); font-weight: 650; }
.totals .strong dd { font-size: 18px; font-weight: 700; }
.totals.info { margin-top: 10px; font-size: 13px; }
.totals.info dt, .totals.info dd { color: var(--ink-3); }

.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; }
.pay { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.pay-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.pay-head b { font-size: 15.5px; font-weight: 650; }
.pay-amount { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.iban { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.copy { margin-left: 8px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 12.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.atts { display: grid; gap: 8px; }
.att { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.att-ico { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--soft); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; }
.att-info { flex: 1; min-width: 0; }
.att-name { font-weight: 600; overflow-wrap: anywhere; }
.att-sub { font-size: 13px; color: var(--ink-3); }
.att-actions { display: flex; gap: 6px; flex: none; }

.inv-foot { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 4px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.print-only { display: none; }

/* ---------- Comprobaciones ---------- */
.checks-card { margin-top: 16px; padding: 22px 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.checks-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.checks-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.check-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; font-size: 14.5px; }
.ck { width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.ck svg { width: 12px; height: 12px; }
.ck.ok { background: var(--ok); }
.ck.aviso { background: var(--warn-dot); }
.ck.error { background: var(--bad); }
.check-list + .checks-ok { margin-top: 14px; }
.checks-ok summary { cursor: pointer; font-size: 14.5px; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.checks-ok summary::-webkit-details-marker { display: none; }
.checks-ok summary::before { content: ""; width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
.checks-ok[open] summary::before { transform: rotate(45deg); }
.checks-ok summary:hover { color: var(--ink); }
.checks-ok .check-list { margin-top: 12px; }
.checks-note { margin: 14px 0 0; font-size: 13px; color: var(--ink-3); }
.feedback { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--ink-2); }
.feedback a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }

/* ---------- Confianza ---------- */
.trust { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-top: 8px; padding-bottom: 88px; }
.trust-item { padding: 26px 28px; border-radius: var(--radius-lg); background: var(--soft); }
.trust-item svg { width: 26px; height: 26px; margin-bottom: 16px; }
.trust-item h2 { margin: 0 0 6px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.trust-item p { margin: 0; font-size: 15px; color: var(--ink-2); }

/* ---------- Texto ---------- */
.content { padding-bottom: 88px; }
.prose { max-width: 760px; }
.prose h2 { margin: 72px 0 18px; font-size: clamp(28px, 3vw, 40px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; text-wrap: balance; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 17.5px; line-height: 1.6; color: var(--ink-2); }
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ink); font-weight: 500; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.steps { counter-reset: paso; list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.steps li { counter-increment: paso; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; align-items: start; }
.steps li::before { content: counter(paso); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; }
.formats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.format { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.format h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; }
.format p { margin: 0; font-size: 15px; line-height: 1.5; }
.format.soon { border-color: transparent; background: var(--soft); }
.faq details { padding: 20px 0; border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 16px; list-style: none; cursor: pointer; font-size: 18px; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 24px; font-weight: 400; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 12px 0 0; }

.related { padding-bottom: 96px; }
.related h2 { margin: 0 0 24px; font-size: clamp(28px, 3vw, 40px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.tool-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tool-card { display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; transition: border-color 0.15s; }
.tool-card:hover { border-color: var(--ink); }
.tool-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; }
.tool-card p { margin: 0 0 18px; font-size: 14.5px; color: var(--ink-2); }
.tool-card .arrow { margin-top: auto; font-size: 14.5px; font-weight: 600; }

/* ---------- Pie ---------- */
.site-footer { padding: 52px 0 40px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-claim { max-width: 300px; margin: 14px 0 0; }
.site-footer h2 { margin: 0 0 12px; font-size: 14px; color: var(--ink); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer ul a { text-decoration: none; }
.site-footer ul a:hover { text-decoration: underline; }
.foot-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }

/* ---------- Arrastrar, avisos y diálogos ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; place-items: center; pointer-events: none;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.drop-overlay > div { padding: 48px 64px; border: 2px dashed var(--ink); border-radius: var(--radius-xl); background: #fff; font-size: 22px; font-weight: 650; }
body.dragging .drop-overlay { display: grid; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 8px; max-width: min(440px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14.5px; box-shadow: var(--shadow); animation: toast-in 0.2s ease-out; transition: opacity 0.3s; }
.toast.error { background: var(--bad); }
.toast b { font-weight: 600; }
.toast a { color: #fff; font-weight: 600; }
.toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

dialog {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); color: var(--ink);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(11, 11, 12, 0.5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.dlg-body { overflow: auto; }
pre.xml { margin: 0; padding: 18px 20px; font: 12.5px/1.6 var(--mono); white-space: pre; tab-size: 2; }
.x-t { color: #1d4ed8; }
.x-a { color: #9a3412; }
.x-v { color: #047857; }
.x-c { color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Pantallas medianas y móviles ---------- */
@media (max-width: 1100px) {
  .nav { display: none; }
  .tool-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 24px; padding-bottom: 56px; }
  .dropcard { aspect-ratio: auto; padding: 44px 0 104px; }
  .mock, .dropcard:hover .mock { transform: rotate(-1.5deg); }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; }
  .side { position: static; max-height: none; }
  .list { max-height: 264px; }
  .trust { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wrap, .wrap-wide { padding: 0 16px; }
  .header-in { height: 64px; gap: 12px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 28px; height: 28px; }
  .hero h1 { font-size: 40px; margin-bottom: 28px; }
  .checks { font-size: 16.5px; }
  .btn { height: 50px; font-size: 16px; }
  .btn-sm { height: 40px; font-size: 14.5px; }
  .cta .btn { flex: 1 1 auto; }
  .dropcard { padding: 32px 0 88px; border-radius: 22px; }
  .mock { width: 84%; padding: 18px 18px 16px; }
  .drop-hint { bottom: 20px; font-size: 14px; padding: 11px 16px; }
  .paper { padding: 24px 18px 20px; border-radius: 14px; }
  .inv-head { flex-direction: column; gap: 18px; }
  .inv-total { text-align: left; }
  .inv-number, .inv-total .amount { font-size: 28px; }
  .parties { grid-template-columns: minmax(0, 1fr); padding: 22px 0; }
  .checks-card { padding: 18px; }
  .att { flex-wrap: wrap; }
  /* Líneas en tarjetas: descripción e importe arriba, cantidad, precio e impuesto debajo. */
  .lines thead { display: none; }
  .lines, .lines tbody { display: block; }
  .lines tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .lines td { padding: 0; border: 0; }
  .lines .c-desc { order: 1; flex: 1 1 0; min-width: 0; }
  .lines .c-total { order: 2; font-weight: 600; }
  .lines .c-n { order: 3; flex-basis: 100%; height: 0; overflow: hidden; }
  .lines .c-sm { order: 4; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
  .lines .c-sm:empty { display: none; }
  .lines .c-sm::before { content: attr(data-label) " "; color: var(--ink-3); }
  .desc { min-width: 0; }
  .formats, .tool-cards, .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .prose p, .prose li { font-size: 16.5px; }
  .drop-overlay > div { padding: 32px 28px; font-size: 18px; }
}

/* ---------- Impresión y PDF: solo la factura ---------- */
@media print {
  @page { margin: 14mm; }
  body.con-facturas { background: #fff; font-size: 10.5pt; }
  .con-facturas .site-header, .con-facturas .side, .con-facturas .toolbar, .con-facturas .checks-card, .con-facturas .feedback,
  .con-facturas .trust, .con-facturas .content, .con-facturas .related, .con-facturas .site-footer,
  .toasts, .drop-overlay, .skip { display: none !important; }
  .con-facturas .workspace { display: block; max-width: none; padding: 0; }
  .paper { padding: 0; border: 0; border-radius: 0; box-shadow: none; font-size: 10pt; }
  .party { background: #f4f4f1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .copy, .att-actions, .mark { display: none !important; }
  .print-only { display: block; }
  .parties { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px 0; }
  .summary { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; }
  .block { padding: 16px 0; }
  .inv-head { padding-bottom: 20px; }
  .table-wrap { overflow: visible; }
  tr, .pay, .party, .att, .totals { break-inside: avoid; }
  .inv-number, .inv-total .amount { font-size: 22pt; }
}
