/* Tachado · estilos. Sobrio, legible, sin efectos decorativos. */
:root {
  --ink: #0f1b2d;          /* azul marino profundo: texto principal y superficies oscuras */
  --ink-2: #33415c;
  --muted: #5d6b82;
  --line: #d9dee7;
  --line-2: #e9edf3;
  --paper: #ffffff;
  --bg: #f5f6f8;
  --accent: #1d5a8c;       /* único acento, contenido */
  --accent-ink: #ffffff;
  --accent-soft: #e8f0f7;
  --ok: #1f6f4a; --ok-soft: #e7f3ec;
  --warn: #8a5a00; --warn-soft: #fbf3e2;
  --bad: #9b1c1c; --bad-soft: #fbeaea;
  --redact: #000000;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15,27,45,.06), 0 4px 16px rgba(15,27,45,.06);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 4.2vw, 3.1rem); }
h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--paper); padding: 8px 12px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Cabecera y pie ---- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; }
.nav { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.nav .btn { color: var(--accent-ink); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; min-height: 44px; font: inherit; color: var(--ink); cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--paper); flex-direction: column; align-items: stretch; padding: 12px 20px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
  .nav.open { display: flex; }
}
.credit-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .875rem; color: var(--ink-2); background: var(--bg); white-space: nowrap; }
.credit-badge strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.credit-badge.low { border-color: #e2c27a; background: var(--warn-soft); color: var(--warn); }
.credit-badge.empty { border-color: #e3a3a3; background: var(--bad-soft); color: var(--bad); }

.site-footer { background: var(--ink); color: #c9d2e0; padding: 40px 0 28px; margin-top: 64px; font-size: .9rem; }
.site-footer a { color: #e7ecf4; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer .legal-line { border-top: 1px solid #2b3a52; margin-top: 24px; padding-top: 16px; color: #93a0b5; font-size: .8rem; }

/* ---- Botones y formularios ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 600 .95rem/1 var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { background: #164a74; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--ink-2); background: var(--paper); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn.block { width: 100%; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select { font: inherit; padding: 10px 12px; border: 1px solid #c3cad6; border-radius: 6px; background: var(--paper); min-height: 44px; }
.field input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.field .hint { font-size: .825rem; color: var(--muted); }
.field .field-error { font-size: .825rem; color: var(--bad); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; margin-bottom: 16px; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.form-error { background: var(--bad-soft); color: var(--bad); border: 1px solid #efc4c4; padding: 10px 12px; border-radius: 6px; font-size: .9rem; margin-bottom: 16px; }
.form-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe0cd; padding: 10px 12px; border-radius: 6px; font-size: .9rem; margin-bottom: 16px; }

/* ---- Tarjetas, avisos ---- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.notice { border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: var(--accent-soft); border-color: #c9dbea; color: #123a5b; }
.notice.warn { background: var(--warn-soft); border-color: #ecd6a6; color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: #efc4c4; color: var(--bad); }
.demo-banner { background: var(--warn-soft); border: 1px solid #d9b45a; border-left: 4px solid #b7860b; color: #5b4300; padding: 12px 14px; border-radius: var(--radius); font-weight: 600; font-size: .92rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.tag.alta { background: var(--ok-soft); color: var(--ok); }
.tag.media { background: var(--accent-soft); color: var(--accent); }
.tag.baja { background: var(--warn-soft); color: var(--warn); }
.tag.manual { background: #ececec; color: #333; }

/* ---- Auth ---- */
.auth-page { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.7rem; }

/* ---- Inicio ---- */
.hero { background: var(--paper); border-bottom: 1px solid var(--line); padding: 64px 0 56px; }
.hero .grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero .grid { grid-template-columns: 1fr; } }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 36em; }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 16px; }
.trust { display: flex; gap: 18px; flex-wrap: wrap; font-size: .875rem; color: var(--muted); padding: 0; margin: 0; list-style: none; }
.trust li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
section.block { padding: 64px 0; }
section.block.alt { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 32px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }
.steps li { list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; }
.steps li::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem; margin-bottom: 10px; }
.steps { padding: 0; margin: 0; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 800px) { .cols-3, .cols-2 { grid-template-columns: 1fr; } }
.feature h3 { margin-bottom: 6px; }

/* Antes / después */
.ba { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); user-select: none; }
.ba .doc { padding: 44px 30px 28px; font-family: var(--serif); font-size: .9rem; color: #1b2433; line-height: 1.7; }
.ba .doc h4 { font-family: var(--font); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 12px; color: #444; }
.ba .after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--split, 50%)); background: #fff; }
.ba .bar { display: inline-block; background: var(--redact); color: transparent; border-radius: 1px; vertical-align: -2px; height: 1.05em; }
.ba .divider { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; background: var(--accent); transform: translateX(-1px); pointer-events: none; }
.ba .divider::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1rem; }
.ba .label { position: absolute; top: 10px; font: 600 .72rem var(--font); letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: rgba(15,27,45,.8); color: #fff; }
.ba .label.l { left: 10px; } .ba .label.r { right: 10px; }
.ba input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.ba-caption { font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* Precios */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--accent); }
.plan .price { font-size: 2.2rem; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.plan .price span { font-size: 1rem; font-weight: 500; color: var(--muted); }
.plan ul { padding: 0; margin: 16px 0 24px; list-style: none; display: grid; gap: 8px; font-size: .95rem; flex: 1; }
.plan li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.plan .note { font-size: .8rem; color: var(--muted); margin-top: 10px; }

/* FAQ */
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq summary::-webkit-details-marker { display: none; }
.faq details > div { padding: 0 0 16px; color: var(--ink-2); }

/* Legales */
.legal { max-width: 780px; margin: 0 auto; padding: 48px 20px; }
.legal h1 { font-size: 2rem; }
.legal h2 { font-size: 1.3rem; margin-top: 2em; font-family: var(--font); }
.legal .pending { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 3px; font-weight: 600; }
.legal table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: 1em 0; table-layout: fixed; }
.legal th, .legal td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
@media (max-width: 480px) { .legal table { font-size: .8rem; } .legal th, .legal td { padding: 6px; } }

/* ---- App (editor) ---- */
.app-main { padding: 24px 0 40px; }
.app-shell .wrap { max-width: 1400px; }
.dropzone { border: 2px dashed #b9c2d0; border-radius: 12px; background: var(--paper); padding: 48px 24px; text-align: center; cursor: pointer; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone h1 { font-size: 1.6rem; }
.dropzone .icon { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--accent); }
.samples { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.progress { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .editor { grid-template-columns: 1fr; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 14px; position: sticky; top: 72px; z-index: 20; }
@media (max-width: 760px) { .toolbar { position: static; } .toolbar .sep, .toolbar .spacer { display: none; } .toolbar .fname { flex-basis: 100%; max-width: none; } }
.toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.toolbar .fname { font-weight: 600; font-size: .9rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar .spacer { flex: 1; }
.btn.toggle[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pages { display: grid; gap: 18px; justify-items: center; }
.page-wrap { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.page-wrap canvas { display: block; }
.page-num { position: absolute; top: -1px; left: -1px; background: var(--ink); color: #fff; font-size: .72rem; padding: 2px 7px; border-radius: 0 0 4px 0; z-index: 3; }
.overlay { position: absolute; inset: 0; z-index: 2; }
.overlay.drawing { cursor: crosshair; }
.rbox { position: absolute; background: var(--redact); cursor: pointer; border-radius: 1px; }
.rbox.off { background: rgba(255, 196, 0, .16); outline: 2px dashed #c58a00; outline-offset: -1px; }
.rbox.focus { box-shadow: 0 0 0 3px #3b82f6; }
.rbox.temp { background: rgba(0,0,0,.55); outline: 1px solid #000; }
.page-scan { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 4; }
.side { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 72px; max-height: calc(100vh - 88px); display: flex; flex-direction: column; }
@media (max-width: 980px) { .side { position: static; max-height: none; } }
.side-head { padding: 16px; border-bottom: 1px solid var(--line); }
.side-head h2 { font-family: var(--font); font-size: 1.05rem; margin: 0 0 4px; }
.side-body { overflow: auto; padding: 8px 8px 16px; flex: 1; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.group { border-bottom: 1px solid var(--line-2); padding: 8px 6px 10px; }
.group-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.group-head h3 { font-size: .9rem; margin: 0; }
.det { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 6px; font-size: .875rem; }
.det:hover { background: var(--bg); }
.det .val { font-family: var(--mono); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det .meta { font-size: .75rem; color: var(--muted); }
.det .info { flex: 1; min-width: 0; cursor: pointer; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #8a96a8; border-radius: 99px; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 150ms cubic-bezier(.2,0,0,1); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; cursor: pointer; color: var(--muted); font-size: .85rem; }
.icon-btn:hover { border-color: var(--line); color: var(--bad); }
.summary-line { display: flex; justify-content: space-between; font-size: .9rem; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,27,45,.55); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--paper); border-radius: 10px; max-width: 560px; width: 100%; max-height: calc(100vh - 40px); overflow: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { font-family: var(--font); font-size: 1.25rem; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal ul { padding-left: 1.2em; }

/* Toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 8px; z-index: 200; font-size: .92rem; box-shadow: var(--shadow); max-width: calc(100vw - 40px); }

/* Cuenta */
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .account-grid { grid-template-columns: 1fr; } }
.meter { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.meter > div { height: 100%; background: var(--ink); }
table.history { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.history th, table.history td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
table.history td.num { text-align: right; font-variant-numeric: tabular-nums; }
