/* modelofactura.es — Sunlit Open Ledger */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #0c2764;
  --navy-hover: #081c4a;
  --inkwell: #0f172b;
  --slate-ink: #1d293d;
  --pencil: #314158;
  --muted: #45556c;
  --mist: #62748e;
  --border: #e2e8f0;
  --silver: #c3c6cb;
  --paper: #ffffff;
  --cloud: #f1f5f9;
  --success-text: #166534;
  --success-bg: #f0fdf4;
  --warning-text: #92400e;
  --warning-bg: #fffbeb;
  --error-text: #991b1b;
  --error-bg: #fef2f2;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --micro: 12px;
  --caption: 14px;
  --body-sm: 16px;
  --body: 18px;
  --subheading: 20px;
  --heading-sm: 28px;
  --tool-h1: 32px;
  --heading: 40px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-card: 0 10px 15px -3px rgba(15, 23, 43, .06), 0 4px 6px -4px rgba(15, 23, 43, .04);
  --focus-ring: 0 0 0 3px rgba(12, 39, 100, .16);
  --max: 1240px;
  --section-gap: clamp(40px, 5vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--inkwell);
  font-family: var(--font);
  font-size: var(--body-sm);
  line-height: 1.5;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--inkwell); letter-spacing: -.025em; line-height: 1.2; font-weight: 700; }
h1 { font-weight: 800; font-size: var(--tool-h1); color: var(--navy); }
h2 { font-size: var(--heading-sm); font-weight: 700; color: var(--slate-ink); margin-top: 1.8em; }
h3 { font-size: var(--subheading); font-weight: 600; margin-top: 1.5em; }
p { margin: 0 0 1em; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy-hover); }
img, svg { max-width: 100%; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .35em; }
strong { font-weight: 600; color: var(--slate-ink); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  clip-path: inset(50%);
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--max); margin: 0 auto; padding: 0 20px;
  min-height: 64px; display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); text-decoration: none; flex: 0 0 auto; }
.brand__icon { color: var(--navy); flex: 0 0 auto; }
.brand__name { font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--navy); }
.brand__name span { color: var(--inkwell); font-weight: 600; }
.nav { display: flex; gap: 22px; margin-left: 16px; flex: 1 1 auto; }
.nav a { color: var(--inkwell); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--navy); }
.nav a[aria-current] { font-weight: 600; }
.topbar__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }
.langs { display: inline-flex; align-items: center; gap: 2px; }
.langs__a {
  font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--mist);
  text-decoration: none; padding: 4px 6px; border-radius: 6px;
}
.langs__a:hover { background: var(--cloud); color: var(--navy); }
.langs__a.is-active { color: var(--navy); background: var(--cloud); font-weight: 700; }

@media (max-width: 980px) {
  .nav { order: 3; flex: 1 0 100%; margin: 0 0 6px; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 9px 2px; }
  .topbar__inner { flex-wrap: wrap; padding-top: 8px; padding-bottom: 2px; }
}
@media (max-width: 560px) {
  .topbar__actions .btn--primary { display: none; }
  .brand__name { font-size: 16px; }
  .langs__a { padding: 9px 9px; font-size: 13px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s;
  line-height: 1.2;
}
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-hover); color: #fff; }
.btn--outline { background: #fff; border-color: var(--border); color: var(--inkwell); font-weight: 500; }
.btn--outline:hover { background: var(--cloud); color: var(--inkwell); }
.btn--ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn--ghost:hover { background: var(--cloud); color: var(--slate-ink); }
.btn--sm { font-size: 14px; padding: 8px 14px; }
.btn--xs { font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero { padding: 32px 0 20px; }
.hero__kicker {
  font-size: var(--micro); font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  color: var(--mist); margin: 0 0 8px;
}
.hero h1 { margin: 0 0 10px; max-width: 22ch; }
.hero__lead { font-size: var(--body-sm); color: var(--muted); max-width: 68ch; margin: 0 0 12px; }
.hero--tool h1, .hero--blank h1 { max-width: 26ch; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--mist); margin-bottom: 10px; }
.crumbs a { color: var(--mist); text-decoration: none; }
.crumbs a:hover { color: var(--navy); text-decoration: underline; }
.crumbs span[aria-current="page"] {
  min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--pencil);
}
@media (max-width: 560px) { .crumbs { font-size: 12px; } }

.chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--pencil);
  background: var(--cloud); border-radius: 999px; padding: 5px 12px;
}
.chips svg { color: var(--navy); flex: 0 0 auto; }

/* ---------- Workspace grid ---------- */
.wrap--workspace {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px;
  margin-bottom: var(--section-gap);
}
@media (min-width: 1120px) {
  .wrap--workspace { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
}
.workspace__main { min-width: 0; }
.rail { display: grid; gap: 16px; }
@media (min-width: 1120px) {
  .rail { position: sticky; top: 88px; }
}
.rail__card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; background: #fff; }
.rail__card--muted { background: var(--cloud); }
.rail__title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--mist); margin: 0 0 10px; }
.rail__text { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; }
.rail__list { list-style: none; padding: 0; margin: 0; }
.rail__list li { margin: 0; border-bottom: 1px solid var(--border); }
.rail__list li:last-child { border-bottom: 0; }
.rail__list a { display: block; padding: 9px 0; font-size: 14px; color: var(--inkwell); text-decoration: none; }
.rail__list a:hover { color: var(--navy); text-decoration: underline; }
@media (max-width: 1119px) { .rail { grid-auto-flow: column; grid-auto-columns: 1fr; } }
@media (max-width: 700px) { .rail { grid-auto-flow: row; } .rail__card--muted { display: none; } }

/* ---------- Ads ---------- */
.ad { margin: 24px 0; text-align: center; }
.ad__tag {
  display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--silver); margin-bottom: 4px;
}
.ad--top { min-height: 0; }
.ad--sidebar { min-height: 0; }
.ad ins { background: transparent; }

/* ---------- Sheet (generador) ---------- */
.sheet {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 24px; scroll-margin-top: 88px;
}
@media (max-width: 640px) { .sheet { padding: 16px; } }

.sheet__doc {
  display: grid; gap: 12px;
  grid-template-columns: 1.2fr 1fr 1fr 1fr .7fr;
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
@media (max-width: 860px) { .sheet__doc { grid-template-columns: 1fr 1fr; } .field--type { grid-column: 1 / -1; } }
@media (max-width: 420px) { .sheet__doc { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 500; color: var(--pencil); }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 15px; color: var(--inkwell);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 9px 12px; width: 100%; min-width: 0; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5l5-5' stroke='%2362748e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy); box-shadow: var(--focus-ring); outline: none;
}
.field--full { grid-column: 1 / -1; }
.field--currency select { padding-right: 26px; background-position: right 8px center; }

.parties { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--border); }
@media (min-width: 860px) { .parties { grid-template-columns: 1fr 1fr; } }
.party { border: 0; padding: 0; margin: 0; min-width: 0; }
.party legend {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--pencil); padding: 0; margin-bottom: 8px;
}
.party__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .party__fields { grid-template-columns: 1fr; } }

.quickbar {
  display: flex; gap: 8px; align-items: center; background: var(--cloud);
  border-radius: var(--radius-sm); padding: 8px; margin-bottom: 14px;
}
.quickbar__select {
  flex: 1 1 auto; min-width: 0; font-family: inherit; font-size: 13px; color: var(--inkwell);
  background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-preview { height: 40px; width: auto; border: 1px solid var(--border); border-radius: 6px; padding: 2px; background: #fff; }

/* ---------- Líneas ---------- */
.lines-block { padding: 20px 0; border-bottom: 1px solid var(--border); }
.lines { width: 100%; border-collapse: collapse; }
.lines thead th {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  color: var(--slate-ink); background: var(--cloud); padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.lines thead th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.lines thead th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.lines th.num, .lines td.num { text-align: right; }
.lines td { padding: 6px 4px; vertical-align: middle; }
.lines input, .lines select {
  font-family: inherit; font-size: 14px; color: var(--inkwell); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; width: 100%;
}
.lines input:focus, .lines select:focus { border-color: var(--navy); box-shadow: var(--focus-ring); outline: none; }
.lines input { font-variant-numeric: tabular-nums; }
.lines .line-desc { text-align: left; }
.lines .num input, .lines .num select, .line-total { text-align: right; font-variant-numeric: tabular-nums; }
.lines .col-qty { width: 72px; }
.lines .col-price { width: 104px; }
.lines .col-disc { width: 76px; }
.lines .col-vat { width: 84px; }
.lines .col-total { width: 108px; }
.lines .col-actions { width: 68px; }
.line-total { display: block; padding: 7px 2px; font-size: 14px; font-weight: 500; }
.col-actions { white-space: nowrap; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--mist); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--cloud); color: var(--slate-ink); }
.icon-btn--del:hover { background: var(--error-bg); color: var(--error-text); }
.lines-actions { margin-top: 12px; }

@media (max-width: 768px) {
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; }
  .lines tr {
    display: grid;
    grid-template-columns: .8fr 1.2fr .8fr .8fr 1.1fr 40px;
    gap: 8px; padding: 12px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fcfdff;
  }
  .lines td { padding: 0; width: auto !important; }
  .lines td::before {
    content: attr(data-label); display: block; font-size: 10px; text-transform: uppercase;
    letter-spacing: .04em; color: var(--mist); margin-bottom: 3px; font-weight: 600;
  }
  .lines .col-desc { grid-column: 1 / -1; }
  .lines .col-actions { grid-column: 1 / -1; text-align: right; display: flex; justify-content: flex-end; gap: 4px; }
  .lines .col-actions::before { content: none; }
  .lines input, .lines select { font-size: 15px; padding: 6px 7px; }
  .line-total { text-align: right; font-size: 15px; font-weight: 600; padding-top: 8px; }
}

/* ---------- Totales ---------- */
.sheet__bottom { display: grid; grid-template-columns: 1fr; gap: 24px; padding-top: 20px; }
@media (min-width: 780px) { .sheet__bottom { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.extras { display: grid; gap: 14px; }
.extras__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.extras__row--sup { grid-template-columns: 2fr 1fr; }
.chips .chip, .chip {
  font: inherit; font-size: 12px; font-weight: 500; color: var(--pencil);
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 11px; cursor: pointer;
}
.chip:hover { background: var(--cloud); border-color: var(--silver); }
#note-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

.totals { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; background: #fcfdff; }
.totals__breakdown:empty { display: none; }
.totals__breakdown { border-bottom: 1px solid var(--border); margin-bottom: 8px; padding-bottom: 8px; }
.totals__sub { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 2px 0; }
.totals__row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.totals__row:last-of-type { border-bottom: 0; }
.totals__total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 8px; padding-top: 12px; border-top: 2px solid var(--navy);
  font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums;
}
.totals__total .num { font-size: 26px; letter-spacing: -.02em; }
.totals__total small { font-size: 15px; font-weight: 600; }

/* ---------- Acciones ---------- */
.actions {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.actions__primary, .actions__secondary { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 720px) {
  .actions { flex-direction: column-reverse; align-items: stretch; }
  .actions__primary .btn { flex: 1 1 auto; }
}

/* ---------- Prosa ---------- */
.prose-wrap { margin-bottom: var(--section-gap); }
.prose { max-width: 78ch; }
.prose-wrap--article { max-width: 820px; margin-left: auto; margin-right: auto; }
.prose--narrow { max-width: 70ch; margin: 0 auto; }
.prose h1 { font-size: var(--heading); }
@media (max-width: 640px) { .prose h1 { font-size: 30px; } }
.prose p, .prose li { font-size: var(--body); line-height: 1.65; color: var(--slate-ink); }
.prose li { margin-bottom: .5em; }
.prose h2 { font-size: var(--heading-sm); margin-top: 2em; padding-top: .2em; }
.prose h3 { color: var(--slate-ink); }
.prose a { color: var(--navy); }
.prose ul, .prose ol { padding-left: 1.1em; }
.prose code {
  font-size: .9em; background: var(--cloud); padding: 2px 6px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.updated { font-size: 13px; color: var(--mist); margin: 24px 0 0; }
.cta-line { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0; }
.link-list { list-style: none; padding: 0; }
.link-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.link-list a { font-weight: 500; text-decoration: none; }
.link-list a:hover { text-decoration: underline; }

.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--navy);
  background: var(--cloud); border-radius: var(--radius-sm);
  padding: 16px 18px; margin: 24px 0;
}
.callout__title { font-weight: 600; color: var(--slate-ink); margin: 0 0 6px; }
.callout p { font-size: var(--body-sm); margin-bottom: .5em; }
.callout p:last-child { margin-bottom: 0; }
.callout--warn { background: var(--warning-bg); border-left-color: var(--warning-text); }
.callout--cta { background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--navy); }
.callout--cta .cta-line { margin: 12px 0 0; }

/* ---------- Tablas ---------- */
.table-wrap {
  margin: 24px 0; border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 15px; }
caption {
  text-align: left; font-size: 13px; font-weight: 600; color: var(--mist);
  padding: 12px 16px 0;
}
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th {
  background: var(--cloud); font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; color: var(--slate-ink); position: sticky; top: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fbfcfd; }
td.is-strong { font-weight: 600; color: var(--slate-ink); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-note { font-size: 13px; color: var(--mist); margin: -16px 0 24px; }

/* ---------- FAQ ---------- */
.faq { margin: 40px 0 24px; }
.faq h2 { margin-top: 0; }
.faq__item { border-bottom: 1px solid var(--border); }
.faq__item:first-of-type { border-top: 1px solid var(--border); }
.faq__item summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 16px 36px 16px 0; font-size: 17px; font-weight: 600; color: var(--slate-ink);
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: ''; position: absolute; right: 6px; top: 50%; width: 8px; height: 8px;
  border-right: 1.5px solid var(--mist); border-bottom: 1.5px solid var(--mist);
  transform: translateY(-70%) rotate(45deg); transition: transform .18s;
}
.faq__item[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq__item summary:hover { color: var(--navy); }
.faq__a { padding: 0 24px 18px 0; }
.faq__a p { font-size: var(--body-sm); line-height: 1.65; color: var(--muted); margin-bottom: .6em; }
.faq__a p:last-child { margin-bottom: 0; }

/* ---------- Descargas ---------- */
.downloads { display: grid; gap: 10px; margin: 20px 0 28px; }
@media (min-width: 700px) { .downloads { grid-template-columns: 1fr 1fr; } }
.download {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none;
  color: var(--inkwell); background: #fff;
}
.download:hover { border-color: var(--navy); background: #fcfdff; }
.download__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; background: var(--cloud); color: var(--navy); flex: 0 0 auto;
}
.download__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.download__text strong { font-size: 15px; font-weight: 600; }
.download__text span { font-size: 12px; color: var(--mist); }

/* ---------- Related ---------- */
.related { margin: 40px 0 8px; padding-top: 24px; border-top: 1px solid var(--border); }
.related h2 { font-size: var(--subheading); margin: 0 0 12px; }
.related__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
@media (min-width: 700px) { .related__list { grid-template-columns: 1fr 1fr; } }
.related__list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--inkwell); text-decoration: none;
}
.related__list a:hover { border-color: var(--navy); color: var(--navy); background: #fcfdff; }
.related__list svg { color: var(--mist); flex: 0 0 auto; }

/* ---------- Cards (hubs) ---------- */
.cards {
  list-style: none; padding: 0; margin: 8px 0 var(--section-gap);
  display: grid; gap: 16px; grid-template-columns: 1fr;
}
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }
.card { border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: #cbd5e1; box-shadow: var(--shadow-card); }
.card__link { display: flex; flex-direction: column; gap: 8px; padding: 20px; text-decoration: none; color: inherit; height: 100%; }
.card__kind {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--navy); background: var(--cloud); border-radius: 999px; padding: 3px 9px; align-self: flex-start;
}
.card__title { font-size: 17px; font-weight: 600; color: var(--slate-ink); letter-spacing: -.02em; }
.card__text { font-size: 14px; color: var(--muted); line-height: 1.55; flex: 1 1 auto; }
.card__cta { font-size: 14px; font-weight: 600; color: var(--navy); display: inline-flex; align-items: center; gap: 4px; }

/* ---------- PDF ---------- */
.wrap--pdf { margin-bottom: var(--section-gap); }
.pdf-frame {
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
  background: var(--cloud); box-shadow: var(--shadow-card);
}
.pdf-frame object { display: block; width: 100%; border: 0; }
.pdf-fallback { padding: 24px; text-align: center; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: #fcfdff; margin-top: 24px; }
.footer__inner {
  max-width: var(--max); margin: 0 auto; padding: 40px 20px 24px;
  display: grid; gap: 28px; grid-template-columns: 1fr;
}
@media (min-width: 760px) { .footer__inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
@media (min-width: 1080px) { .footer__inner { grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; } }
.footer__brand { font-size: 16px; font-weight: 700; color: var(--navy); margin: 0 0 8px; }
.footer__brand span { color: var(--inkwell); font-weight: 600; }
.footer__note { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 8px; max-width: 40ch; }
.footer__note--fine { color: var(--mist); font-size: 12px; }
.footer__title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mist); margin: 0 0 10px; }
.footer__title a { color: var(--mist); text-decoration: none; }
.footer__title a:hover { color: var(--navy); }
.footer__list { list-style: none; padding: 0; margin: 0; }
.footer__list li { margin: 0 0 7px; }
.footer__list a { font-size: 13px; color: var(--muted); text-decoration: none; }
.footer__list a:hover { color: var(--navy); text-decoration: underline; }
.footer__base {
  max-width: var(--max); margin: 0 auto; padding: 16px 20px 32px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--mist);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--slate-ink); color: #fff; font-size: 14px; font-weight: 500;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(15, 23, 43, .18);
  z-index: 60; max-width: calc(100vw - 32px); text-align: center;
}
.toast[hidden] { display: none; }
.toast--err { background: var(--error-text); }
.toast--ok { background: var(--success-text); }

/* ---------- Modal datos ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 43, .45); }
.modal__box {
  position: relative; background: #fff; border-radius: var(--radius-md); width: min(560px, 100%);
  max-height: 80vh; overflow: auto; padding: 24px; box-shadow: 0 24px 48px rgba(15, 23, 43, .24);
}
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal__head h2 { margin: 0; font-size: var(--subheading); }
.modal__tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.modal__tab { font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--muted); }
.modal__tab.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.modal__list { list-style: none; padding: 0; margin: 0; }
.modal__list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.modal__list li:last-child { border-bottom: 0; }
.modal__empty { font-size: 14px; color: var(--mist); padding: 8px 0; }

/* ---------- Print ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  .topbar, .footer, .rail, .ad, .hero, .prose-wrap, .actions, .toast, .skip-link, .crumbs, .chips { display: none !important; }
  body { background: #fff; }
  .wrap, .wrap--workspace { max-width: none; padding: 0; margin: 0; display: block; }
  .sheet { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .quickbar, .lines-actions, .chips, #note-chips, .icon-btn, .field--type, .logo-field label, .logo-field .btn { display: none !important; }
  .field input, .field select, .field textarea, .lines input, .lines select { border: 0; padding: 2px 0; background: transparent; color: #0f172b; }
  .lines thead th { background: #f1f5f9; }
  a { color: #0f172b; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}