:root {
  --forest: #16352b;
  --forest-2: #1f4a3c;
  --ink: #1d2a25;
  --muted: #5f6b64;
  --paper: #faf6ee;
  --cream: #f2eadb;
  --card: #fffdf8;
  --line: #e5dcca;
  --gold: #e8b85c;
  --accent: #b4452d;
  --accent-dark: #973822;
  --green: #1c7c54;
  --wa: #128c5e;
  --red: #a93226;
  --radius: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(29, 42, 37, .06), 0 8px 24px rgba(29, 42, 37, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.012em; }
p { margin: 0; }
a { color: var(--accent-dark); }
code { font-size: .875em; word-break: break-all; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.section { padding-top: 48px; padding-bottom: 72px; scroll-margin-top: 72px; }
.muted { color: var(--muted); font-size: .92rem; }
.fine { color: var(--muted); font-size: .82rem; text-align: center; margin-top: 14px; }
.is-hidden { display: none; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(250, 246, 238, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest); flex: none; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--forest); color: var(--gold); font: 700 15px/1 var(--serif); letter-spacing: .02em; }
.brand-mark-lg { width: 54px; height: 54px; font-size: 21px; border-radius: 14px; }
.brand-name { font: 600 21px/1 var(--serif); }
.search { position: relative; width: min(340px, 100%); }
.search input { width: 100%; height: 42px; padding: 0 44px 0 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font: inherit; font-size: .92rem; color: var(--ink); }
.search-btn { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--forest); cursor: pointer; }
.search-btn:hover { background: var(--cream); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border: 1px solid transparent; border-radius: 10px; font: 600 .95rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .65; cursor: wait; transform: none; }
.btn-lg { min-height: 52px; padding: 13px 30px; font-size: 1.02rem; }
.btn-sm { min-height: 34px; padding: 5px 13px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(180, 69, 45, .25); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-gold { background: var(--gold); color: var(--forest); }
.btn-gold:hover { background: #f0c672; }
.btn-whatsapp { background: var(--wa); color: #fff; box-shadow: 0 6px 16px rgba(18, 140, 94, .25); }
.btn-whatsapp:hover { background: #0e7850; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--cream); }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--accent-dark); text-decoration: underline; cursor: pointer; }
.linklike-danger { color: var(--red); }

/* Hero */
.hero { position: relative; overflow: hidden; color: #f8f3e7; background: radial-gradient(700px 420px at 82% 28%, rgba(232, 184, 92, .2), transparent 70%), linear-gradient(135deg, var(--forest) 0%, #102a21 100%); }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px; min-height: 470px; padding-top: 56px; padding-bottom: 56px; }
.eyebrow { display: block; margin-bottom: 14px; color: var(--gold); font-size: .78rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow-link { color: var(--accent-dark); text-decoration: none; margin-bottom: 10px; }
.eyebrow-link:hover { text-decoration: underline; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: 1.03; margin-bottom: 20px; }
.lead { max-width: 30em; margin-bottom: 30px; font-size: 1.12rem; color: rgba(248, 243, 231, .82); }
.hero-fan { position: relative; height: 340px; }
.fan-book { position: absolute; left: 50%; top: 50%; width: 190px; transform-origin: 50% 100%; }
.fan-book:nth-child(1) { transform: translate(-50%, -50%) translateY(-6px); z-index: 3; }
.fan-book:nth-child(2) { transform: translate(-112%, -50%) rotate(-11deg) translateY(10px); z-index: 2; }
.fan-book:nth-child(3) { transform: translate(12%, -50%) rotate(11deg) translateY(10px); z-index: 1; }
.fan-book .cover { box-shadow: 0 24px 50px rgba(0, 0, 0, .42); }

/* Covers */
.cover { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 3px 9px 9px 3px; background: var(--cream); box-shadow: 0 10px 22px rgba(29, 42, 37, .2); }
.cover::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .2) 0, rgba(255, 255, 255, .13) 3%, rgba(0, 0, 0, .05) 5%, transparent 9%); }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-art { display: flex; flex-direction: column; text-align: left; padding: 13% 11% 10% 15%; color: #fbf5e7; container-type: inline-size; }
.cover-rule { width: 30%; height: 2px; margin-bottom: 10%; background: currentColor; opacity: .75; }
.cover-title { font: 600 12cqw/1.12 var(--serif); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }
.cover-author { margin-top: auto; font: 500 6.2cqw/1.3 var(--sans); letter-spacing: .03em; opacity: .85; }
.tone-0 { background: linear-gradient(160deg, #24594a, #14372c); }
.tone-1 { background: linear-gradient(160deg, #b4452d, #7b2c1b); }
.tone-2 { background: linear-gradient(160deg, #27476e, #162a45); }
.tone-3 { background: linear-gradient(160deg, #e0ae51, #bd8325); color: #2a200c; }
.tone-4 { background: linear-gradient(160deg, #6a3a5e, #3f2138); }
.tone-5 { background: linear-gradient(160deg, #3b3f46, #1f2226); }

/* Catalog */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
.count { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }
.pill { padding: 7px 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink); font-size: .88rem; font-weight: 500; text-decoration: none; transition: background .15s; }
.pill:hover { background: var(--cream); }
.pill.is-active { background: var(--forest); border-color: var(--forest); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 38px 28px; }
.book-card { display: block; color: inherit; text-decoration: none; }
.book-card .cover { transition: transform .25s ease, box-shadow .25s ease; }
.book-card:hover .cover { transform: translateY(-6px); box-shadow: 0 20px 34px rgba(29, 42, 37, .26); }
.book-card-body { padding-top: 15px; }
.book-card h3 { font-size: 1.08rem; line-height: 1.25; }
.book-card-author { margin-top: 4px; color: var(--muted); font-size: .88rem; }
.book-card-price { margin-top: 7px; font-weight: 700; font-size: .96rem; color: var(--forest); }
.empty { max-width: 520px; margin: 24px auto; padding: 56px 28px; border: 1px dashed #d6cbb4; border-radius: var(--radius); text-align: center; }
.empty h1, .empty h3 { font-size: 1.6rem; margin-bottom: 10px; }
.empty p { color: var(--muted); margin-bottom: 20px; }
.empty p:last-child { margin-bottom: 0; }
.empty-flat { border: 0; margin: 0 auto; padding: 36px 16px; }

/* Steps */
.steps-band { background: var(--cream); border-top: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; padding-top: 56px; padding-bottom: 56px; }
.step-n { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-bottom: 14px; border-radius: 50%; background: var(--forest); color: var(--gold); font: 600 1rem/1 var(--serif); }
.step h3 { font-size: 1.2rem; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: .94rem; }

/* Book page */
.back { display: inline-block; margin-bottom: 26px; color: var(--muted); font-size: .9rem; text-decoration: none; }
.back:hover { color: var(--ink); }
.book-detail { display: grid; grid-template-columns: minmax(240px, 370px) 1fr; gap: clamp(32px, 6vw, 72px); align-items: start; }
.book-detail-cover .cover { box-shadow: 0 30px 56px rgba(29, 42, 37, .28); }
.book-detail h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); }
.byline { margin-top: 8px; color: var(--muted); font-size: 1.05rem; }
.buy-box { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 28px; padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.price-big { font: 700 1.7rem/1.2 var(--serif); color: var(--forest); }
.format { color: var(--muted); font-size: .85rem; }
.assure { margin-top: 12px; color: var(--muted); font-size: .86rem; }
.prose { margin-top: 28px; max-width: 62ch; font-size: 1.03rem; line-height: 1.75; }
.related { margin-top: 72px; padding-top: 44px; border-top: 1px solid var(--line); }

/* Cards and forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.card + .card, form.card + section.card { margin-top: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.card h2 { font-size: 1.32rem; }
.card-head + .muted { margin-bottom: 18px; }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 6px; font-size: .88rem; font-weight: 600; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: .8rem; }
.field small.error, small.error { color: var(--red); font-weight: 500; }
input:not([type=checkbox]):not([type=file]):not([type=search]), select, textarea { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid #d3c9b5; border-radius: 9px; background: #fff; font: inherit; color: var(--ink); }
input[aria-invalid=true] { border-color: var(--red); }
input[type=file] { width: 100%; padding: 8px 0; font-size: .88rem; }
textarea { resize: vertical; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.form-grid > h2 { margin-bottom: 16px; }
.form-grid > .alert { margin-bottom: 18px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; align-self: center; margin-bottom: 18px; font-size: .92rem; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--forest); }
.check small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 260px; margin-bottom: 0; }
.alert { padding: 13px 16px; margin-bottom: 18px; border: 1px solid; border-radius: 10px; font-size: .92rem; }
.alert-success { background: #e8f5ee; border-color: #b8dfca; color: #155c3f; }
.alert-info { background: #eaf1f7; border-color: #c4d7e6; color: #24496a; }
.alert-warning { background: #fdf4dd; border-color: #eed89d; color: #6d4f0c; }
.alert-error { background: #fbeae7; border-color: #efc4bc; color: #80261b; }

/* Checkout */
.narrow { max-width: 960px; }
.checkout { display: grid; grid-template-columns: 300px 1fr; gap: 40px; align-items: start; }
.checkout-cover { width: 150px; margin-bottom: 20px; }
.checkout-summary h2 { font-size: 1.35rem; }
.checkout-summary .byline { font-size: .94rem; }
.summary-lines { margin: 20px 0 0; }
.summary-lines div, .receipt div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.summary-lines dt, .receipt dt { color: var(--muted); }
.summary-lines dd, .receipt dd { margin: 0; font-weight: 600; text-align: right; }
.summary-total dd { font: 700 1.2rem/1.2 var(--serif); color: var(--forest); }
.checkout-form h1 { font-size: 1.7rem; margin-bottom: 6px; }
.checkout-form > .muted { margin-bottom: 22px; }

/* Order page */
.order-page { display: flex; justify-content: center; }
.order-card { width: 100%; max-width: 520px; padding: 42px 34px; text-align: center; }
.order-card h1 { font-size: 2rem; margin-bottom: 10px; }
.lead-sm { font-size: 1.04rem; margin-bottom: 12px; }
.tick, .cross { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 50%; color: #fff; font-size: 30px; font-weight: 700; line-height: 1; }
.tick { background: var(--green); }
.cross { background: var(--red); }
.order-book { width: 148px; margin: 24px auto; }
.notice { margin-top: 16px; color: var(--muted); font-size: .86rem; }
.receipt { margin: 30px 0 0; text-align: left; }
.pulse { position: relative; width: 70px; height: 70px; margin: 6px auto 22px; }
.pulse::before, .pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--gold); animation: pulse 2s ease-out infinite; }
.pulse::after { animation-delay: 1s; }
.pulse span { position: absolute; inset: 20px; z-index: 1; border-radius: 50%; background: var(--forest); }
@keyframes pulse { from { transform: scale(.45); opacity: .85; } to { transform: scale(1.2); opacity: 0; } }

/* Footer */
.footer { background: var(--forest); color: rgba(248, 243, 231, .75); font-size: .9rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; padding-top: 34px; padding-bottom: 34px; }
.footer-brand { font: 600 1.2rem/1.3 var(--serif); color: #fff; }
.footer-link { color: var(--gold); }
.footer-copy { font-size: .82rem; }

/* Admin */
.admin { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.admin-side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 22px 16px; background: var(--forest); color: #fff; }
.brand-light { color: #fff; padding: 0 8px; margin-bottom: 26px; }
.brand-light .brand-mark { background: var(--gold); color: var(--forest); }
.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav a { padding: 10px 12px; border-radius: 9px; color: rgba(255, 255, 255, .78); font-size: .94rem; font-weight: 500; text-decoration: none; }
.admin-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-nav a[aria-current] { background: rgba(232, 184, 92, .18); color: var(--gold); }
.admin-side-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: auto; padding: 0 12px; font-size: .88rem; }
.admin-side-foot a, .admin-side-foot .linklike { color: rgba(255, 255, 255, .72); }
.admin-main { padding: 34px clamp(18px, 4vw, 44px) 60px; min-width: 0; max-width: 1120px; }
.admin-title { font-size: 2rem; margin-bottom: 24px; }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.mode { padding: 13px 16px; margin-bottom: 20px; border-radius: 10px; font-size: .92rem; border: 1px solid; }
.mode-online { background: #e8f5ee; border-color: #b8dfca; color: #155c3f; }
.mode-whatsapp { background: #e6f4ee; border-color: #bcdfcf; color: #17533c; }
.stats { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-3 { grid-template-columns: 1.5fr 1fr 1fr; margin-bottom: 12px; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.stat span { color: var(--muted); font-size: .84rem; font-weight: 500; }
.stat strong { font: 700 1.4rem/1.2 var(--serif); }
.stat-feature { background: var(--forest); border-color: var(--forest); color: #fff; }
.stat-feature span { color: rgba(255, 255, 255, .72); }
.stat-feature strong { font-size: 1.75rem; color: var(--gold); }
.stat-feature a { color: #fff; font-size: .88rem; }
.balance-note { margin-bottom: 24px; font-size: .84rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #efe8da; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.thumb { width: 54px; }
.thumb .cover { width: 42px; box-shadow: 0 3px 8px rgba(29, 42, 37, .22); }
.actions { min-width: 110px; }
.actions > * { display: block; margin-bottom: 4px; font-size: .88rem; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-paid { background: #dff2e7; color: #155c3f; }
.badge-pending { background: #fbeec9; color: #6d4f0c; }
.badge-failed { background: #f8dfda; color: #80261b; }
.badge-muted { background: #ece6d8; color: #5a5a4d; }
.webhook-box { margin-top: 22px; padding: 15px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.webhook-box > span { display: block; margin-bottom: 8px; font-size: .86rem; font-weight: 600; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(600px 400px at 50% 20%, rgba(232, 184, 92, .16), transparent 70%), var(--forest); }
.login-card { width: 100%; max-width: 390px; padding: 36px 30px; text-align: center; }
.login-card h1 { margin: 16px 0 22px; font-size: 1.6rem; }
.login-card .field { text-align: left; }
.login-card .alert { text-align: left; }

@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; min-height: 0; text-align: center; padding-top: 44px; padding-bottom: 36px; }
  .lead { margin-left: auto; margin-right: auto; }
  .hero-fan { height: 280px; }
  .fan-book { width: 150px; }
  .book-detail { grid-template-columns: 1fr; }
  .book-detail-cover { width: min(240px, 66%); margin: 0 auto; }
  .checkout { grid-template-columns: 1fr; gap: 24px; }
  .checkout-summary { display: grid; grid-template-columns: 84px 1fr; column-gap: 16px; }
  .checkout-cover { grid-row: 1 / 3; width: 84px; margin: 0; }
  .summary-lines { grid-column: 1 / -1; }
  .admin { display: block; }
  .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
  .brand-light { margin: 0; padding: 0; }
  .admin-nav { order: 3; flex-direction: row; width: 100%; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; padding: 8px 11px; font-size: .88rem; }
  .admin-side-foot { flex-direction: row; align-items: center; gap: 14px; margin: 0 0 0 auto; padding: 0; font-size: .82rem; }
  .stats, .stats-3 { grid-template-columns: 1fr 1fr; }
  .stat-feature { grid-column: 1 / -1; }
  .stats:not(.stats-3) .stat:nth-child(2) { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .hero-fan { height: 236px; }
  .fan-book { width: 122px; }
  .brand-name { display: none; }
  .search { width: auto; flex: 1; }
  .section { padding-top: 32px; padding-bottom: 52px; }
  .steps { grid-template-columns: 1fr; gap: 26px; padding-top: 42px; padding-bottom: 42px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .buy-box .btn { width: 100%; }
  .card { padding: 20px; }
  .order-card { padding: 32px 20px; }
}

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