/* Biblioteca multimarca (22/10/2026). Los colores de cada marca llegan desde /api/marca. */
:root {
  --font-head: "Cormorant Garamond", Georgia, serif;
  --font-brand: "Cinzel", Georgia, serif;
  --font-ui: "DM Sans", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --app-w: 480px;
  --bg: #FBF6EF; --surface: #FFFFFF; --ink: #2B1A1F; --muted: #7A6468; --line: #EADFD3;
  --primary: #810B38; --primary-dark: #5E0828; --gold: #C9A24A; --gold-soft: #F3E6C4;
  --tile: #810B38; --tool-bg: #810B38;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-ui); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
@media (min-width: 560px) { body { background: #E9E4DE; } }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
[hidden], .hidden { display: none !important; }

.app { max-width: var(--app-w); margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 76px; box-shadow: 0 0 40px rgba(0,0,0,.08); }
.cargando { min-height: 60vh; display: grid; place-items: center; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.top { position: sticky; top: 0; z-index: 20; height: 54px; background: var(--primary); color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.wordmark { font-family: var(--font-brand); font-weight: 700; letter-spacing: .12em; color: var(--gold); font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-lang { font-size: 12px; background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px 9px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; border: 0; }

main { padding: 14px 14px 8px; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.1; }
h1 { font-size: 30px; }
h2 { font-size: 22px; margin: 18px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Entrada */
.login { display: flex; flex-direction: column; padding: 34px 22px 40px; text-align: center; min-height: 100vh;
  background: radial-gradient(120% 60% at 50% 0%, var(--gold-soft) 0%, transparent 60%), var(--bg); }
.login .seal { font-family: var(--font-brand); color: var(--primary); letter-spacing: .18em; font-size: 14px; margin-bottom: 10px; }
.login .covers { display: flex; justify-content: center; margin: 4px 0 18px; min-height: 140px; }
.login .covers img { width: 92px; border-radius: 6px; box-shadow: 0 10px 24px rgba(0,0,0,.22); margin: 0 -10px; background: #fff; object-fit: cover; }
.login .covers img:nth-child(1) { transform: rotate(-7deg) translateY(8px); }
.login .covers img:nth-child(3) { transform: rotate(7deg) translateY(8px); }
.login .covers img:nth-child(2) { position: relative; z-index: 2; width: 104px; }
.login h1 { font-size: 34px; color: var(--primary); }
.login p { margin: 8px auto 18px; max-width: 320px; }
.field { width: 100%; max-width: 340px; margin: 0 auto; display: grid; gap: 10px; }
input[type="email"], input[type="search"] { width: 100%; font: inherit; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 700; text-decoration: none; }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-gold { background: linear-gradient(180deg, #D9B860, var(--gold)); color: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.error { color: #B3261E; font-size: 13px; min-height: 18px; }

/* Inicio */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.stats div { padding: 10px 6px; text-align: center; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font-family: var(--font-head); font-size: 26px; color: var(--primary); line-height: 1; }
.stats span { font-size: 12px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.check-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .4s; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.steps button { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; background: transparent; border: 0; padding: 8px 4px; border-radius: 10px; color: var(--ink); }
.steps button:hover { background: var(--bg); }
.tick { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: #fff; }
.done .tick { background: var(--primary); border-color: var(--primary); }
.done .st-title { text-decoration: line-through; color: var(--muted); }
.st-title { font-weight: 700; font-size: 14.5px; display: block; }
.st-sub { font-size: 12.5px; color: var(--muted); }
.continue { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; color: inherit; }
.continue img { width: 64px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.continue .grow { flex: 1; min-width: 0; }
.tool { display: flex; gap: 12px; align-items: center; background: var(--tool-bg); color: #fff; border-radius: var(--radius); padding: 12px; border: 0; width: 100%; text-align: left; }
.tool img { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; border: 2px solid var(--gold); }
.tool .tag { display: inline-block; font-size: 11px; letter-spacing: .08em; background: var(--gold); color: var(--primary-dark); border-radius: 99px; padding: 2px 8px; font-weight: 700; margin-bottom: 4px; }
.tool b { display: block; font-family: var(--font-head); font-size: 19px; line-height: 1.15; }
.tool .icon-big { width: 64px; height: 64px; border-radius: 14px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 30px; border: 2px solid var(--gold); flex: none; }
.tools-list { display: grid; gap: 8px; }

/* Biblioteca */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips button { flex: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; }
.chips button[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.book { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; color: var(--ink); display: flex; flex-direction: column; }
.book .cv { background: var(--tile); padding: 12px 0 10px; display: grid; place-items: center; height: 150px; }
.book .cv img { height: 128px; width: auto; max-width: 86%; object-fit: contain; border-radius: 3px; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.xl { width: 84px; height: 112px; border-radius: 8px; background: #fff; color: #1D6F42; display: grid; place-items: center; font-weight: 700; font-size: 13px; box-shadow: 0 8px 18px rgba(0,0,0,.35); border-top: 14px solid #1D6F42; }
.book .meta { padding: 9px 10px 11px; display: grid; gap: 4px; flex: 1; }
.book .pp { font-size: 11.5px; color: var(--muted); }
.book h3 { font-size: 16.5px; }
.book .sub { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book .prog { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: auto; padding-top: 4px; }
.book .prog .bar { flex: 1; height: 4px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* Complementos */
.addon { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; }
.addon img { width: 92px; border-radius: 5px; box-shadow: 0 6px 14px rgba(0,0,0,.2); }
.addon .opt { font-size: 11px; letter-spacing: .08em; font-weight: 700; color: var(--primary); }
.addon h3 { font-size: 19px; margin: 2px 0 4px; }
.addon ul { margin: 6px 0 8px; padding-left: 18px; font-size: 13px; color: var(--muted); }
.price { font-weight: 700; font-size: 15px; margin: 8px 0; }
.price s { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 13px; }
.mini-covers { display: flex; gap: 4px; margin-top: 6px; }
.mini-covers img { width: 34px; border-radius: 3px; box-shadow: 0 2px 5px rgba(0,0,0,.2); }

/* Cuenta */
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .ok { width: 22px; height: 22px; border-radius: 50%; background: var(--gold-soft); color: var(--primary); display: grid; place-items: center; font-size: 12px; flex: none; }
.row .grow { flex: 1; min-width: 0; font-size: 14px; }

/* Barra de abajo */
nav.bottom { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--app-w); height: calc(64px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
nav.bottom button { background: none; border: 0; color: var(--muted); display: grid; place-items: center; font-size: 11.5px; padding: 8px 0 6px; }
nav.bottom svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.bottom button[aria-current="page"] { color: var(--primary); font-weight: 700; }

/* Hoja de detalle */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,10,12,.5); z-index: 60; display: none; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: var(--app-w); background: var(--surface); border-radius: 20px 20px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); z-index: 61; display: none; max-height: 88vh; overflow: auto; }
.sheet.open, .sheet-bg.open { display: block; }
.grab { width: 40px; height: 4px; background: var(--line); border-radius: 9px; margin: 0 auto 12px; }
.sheet .hero { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; }
.sheet .hero img { width: 110px; border-radius: 5px; box-shadow: 0 10px 22px rgba(0,0,0,.25); }
.sheet h3 { font-size: 24px; }
.sheet .actions { display: grid; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #1E1E1E; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; z-index: 80; max-width: 90vw; display: none; }
.toast.show { display: block; }
