/* Editora Marinho — app */
:root {
  --red: #9E1B1F;
  --red-2: #7C1318;
  --red-soft: #F6E3DF;
  --cream: #FBF5EE;
  --paper: #FFFFFF;
  --sand: #F1E4D6;
  --line: #EADBCB;
  --ink: #2E1A17;
  --muted: #86685E;
  --gold: #C79A57;
  --green: #2F7D4F;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(78, 30, 20, .28);
  --side: 248px;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--cream); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.ico { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; display: inline-block; vertical-align: middle; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 450; user-select: none; }
.ico.fill { font-variation-settings: 'FILL' 1, 'wght' 450; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Estrutura ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side) 1fr; }
.side { position: sticky; top: 0; height: 100vh; background: var(--red); color: #fff; display: flex; flex-direction: column; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 26px 22px 22px; border-bottom: 1px solid rgba(255,255,255,.14); }
.side-brand img { width: 40px; height: 40px; border-radius: 12px; background: #fff; padding: 4px; }
.side-brand b { font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.1; }
.side-brand small { display: block; font-size: 11px; opacity: .75; letter-spacing: .14em; text-transform: uppercase; font-family: var(--sans); }
.side nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; font-weight: 700; font-size: 14.5px; opacity: .9; transition: background .15s; }
.side nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.side nav a.on { background: rgba(255,255,255,.16); opacity: 1; }
.side nav .sep { height: 1px; background: rgba(255,255,255,.14); margin: 10px 8px; }
.side nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; opacity: .6; padding: 6px 12px 4px; }
.side-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.14); display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--red); display: grid; place-items: center; font-weight: 800; font-family: var(--serif); flex: none; }
.side-foot .who { min-width: 0; flex: 1; font-size: 13px; }
.side-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.side-foot button { background: none; border: 0; color: #fff; opacity: .8; cursor: pointer; padding: 6px; border-radius: 8px; }
.side-foot button:hover { opacity: 1; background: rgba(255,255,255,.12); }
.main { min-width: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 36px 60px; }
.topbar, .bottomnav { display: none; }

/* ---------- Topo / banner ---------- */
.hero { position: relative; background: #E9D2B0 center / cover no-repeat; aspect-ratio: 1920 / 620; max-height: 470px; width: 100%; overflow: hidden; }
.hero.default { background-image: url('/static/brand/banner.webp'); }
.greet { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.greet h1 { font-size: 30px; }
.greet p { margin: 4px 0 0; color: var(--muted); }

.offer { display: flex; align-items: center; gap: 18px; background: linear-gradient(110deg, #2B1412 0%, #5A1518 55%, var(--red) 100%); color: #fff; border-radius: var(--radius); padding: 20px 24px; margin-bottom: 30px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.offer::before { content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(rgba(199,154,87,.45), transparent 70%); }
.offer .tag { background: var(--gold); color: #2B1412; font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; flex: none; }
.offer h3 { font-size: 20px; }
.offer p { margin: 3px 0 0; opacity: .85; font-size: 14px; }
.offer .btn { margin-left: auto; flex: none; position: relative; }

/* ---------- Seções e cards ---------- */
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 22px; }
.section-head a { color: var(--red); font-weight: 700; font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 20px; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card { position: relative; display: block; border-radius: 14px; overflow: hidden; background: var(--sand); box-shadow: 0 6px 18px -10px rgba(78,30,20,.45); transition: transform .2s ease, box-shadow .2s ease; isolation: isolate; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card .cover { aspect-ratio: 2 / 3; width: 100%; object-fit: cover; background: var(--sand); }
.card.audio .cover { aspect-ratio: 16 / 9; }
.card .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.55); }
.card .bar i { display: block; height: 100%; background: var(--red); }
.card .badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
.card .done { position: absolute; top: 10px; right: 10px; background: var(--green); color: #fff; border-radius: 999px; width: 28px; height: 28px; display: grid; place-items: center; }
.card .done .ico { font-size: 18px; }
.card.locked .cover { filter: saturate(.55) brightness(.78); }
.card .lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; text-align: center; padding: 14px; background: linear-gradient(180deg, rgba(30,10,8,.05), rgba(30,10,8,.55)); }
.card .lock .pad { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; border: 1px solid rgba(255,255,255,.4); }
.card .lock .pad .ico { font-size: 28px; }
.card .lock span { font-weight: 800; font-size: 13px; background: var(--red); padding: 7px 14px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.card-title { margin-top: 9px; font-weight: 700; font-size: 14px; line-height: 1.3; }
.card-meta { font-size: 12.5px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; background: var(--paper); color: var(--red); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.pill.gold { background: var(--gold); color: #2B1412; }
.pill.dark { background: #2B1412; color: #fff; }
.pill.green { background: #E3F1E8; color: var(--green); box-shadow: none; }
.pill.gray { background: var(--sand); color: var(--muted); box-shadow: none; }

/* Continuar lendo */
.continue { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.cont { display: flex; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; transition: box-shadow .2s, transform .2s; }
.cont:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.cont img { width: 62px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; flex: none; }
.cont.audio img { width: 92px; aspect-ratio: 16/9; }
.cont .info { min-width: 0; flex: 1; }
.cont b { display: block; font-size: 14.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont .track { height: 6px; background: var(--sand); border-radius: 99px; margin: 8px 0 5px; overflow: hidden; }
.cont .track i { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.cont .play { width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; flex: none; }

.empty { text-align: center; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); padding: 34px 20px; color: var(--muted); }
.empty .ico { font-size: 40px; color: var(--gold); }
.empty h3 { color: var(--ink); margin: 8px 0 4px; font-size: 19px; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; border-radius: 999px; padding: 12px 22px; font-weight: 800; font-size: 14.5px; background: var(--red); color: #fff; transition: background .15s, transform .1s, box-shadow .15s; text-align: center; line-height: 1.2; }
.btn:hover { background: var(--red-2); }
.btn:active { transform: scale(.98); }
.btn .ico { font-size: 20px; }
.btn.light { background: #fff; color: var(--red); }
.btn.light:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--sand); }
.btn.gold { background: var(--gold); color: #2B1412; }
.btn.gold:hover { background: #B98B48; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger { background: #fff; color: #B3261E; box-shadow: inset 0 0 0 1.5px #F0C9C5; }
.btn.danger:hover { background: #FDECEA; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: inherit; }
.iconbtn:hover { background: rgba(0,0,0,.06); }

/* ---------- Página do livro ---------- */
.book { display: grid; grid-template-columns: 300px 1fr; gap: 44px; align-items: start; }
.book > * { min-width: 0; }
.book-cover { position: sticky; top: 24px; }
.book-cover img { width: 100%; border-radius: 14px; box-shadow: 0 24px 50px -20px rgba(78,30,20,.55); }
.book-cover.audio img { aspect-ratio: 16/9; object-fit: cover; }
.book h1 { font-size: 36px; margin: 10px 0 6px; }
.book .sub { font-size: 17px; color: var(--muted); margin: 0 0 16px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.facts span { display: inline-flex; align-items: center; gap: 6px; }
.facts .ico { font-size: 19px; color: var(--gold); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 26px; }
.desc { font-size: 16px; line-height: 1.7; color: #4A322D; white-space: pre-line; max-width: 680px; }
.progress-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 22px; max-width: 560px; }
.progress-box .track { height: 8px; background: var(--sand); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-box .track i { display: block; height: 100%; background: var(--red); }
.marks { margin: 26px 0 0; max-width: 560px; }
.marks h3 { font-size: 18px; margin-bottom: 10px; }
.marks a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); margin-bottom: 6px; }
.marks a .ico { color: var(--red); }
.tracklist { margin: 8px 0 0; max-width: 640px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tracklist div { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.tracklist div:first-child { border-top: 0; }
.tracklist .n { width: 26px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.tracklist .t { flex: 1; font-weight: 600; }
.sibling { display: flex; align-items: center; gap: 14px; background: var(--red-soft); border-radius: var(--radius); padding: 14px; max-width: 560px; margin: 0 0 22px; }
.sibling img { width: 96px; border-radius: 10px; aspect-ratio: 16/9; object-fit: cover; }
.sibling.ebook img { width: 56px; aspect-ratio: 2/3; }
.lockbox { background: linear-gradient(135deg, #FFF8F1, var(--red-soft)); border: 1px solid #EFCFC8; border-radius: var(--radius); padding: 20px; max-width: 560px; margin: 0 0 24px; }
.lockbox h3 { font-size: 20px; display: flex; align-items: center; gap: 8px; color: var(--red); }
.lockbox p { margin: 6px 0 14px; color: #5B3B35; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; margin-bottom: 18px; }
.back:hover { color: var(--red); }

/* ---------- Avisos ---------- */
.flash { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; background: #E3F1E8; color: #1F5A37; font-weight: 600; }
.flash.err { background: #FDECEA; color: #8C1D18; }
.notice { display: flex; gap: 12px; align-items: center; background: #FFF6E2; border: 1px solid #F1DDAE; border-radius: 14px; padding: 12px 16px; margin-bottom: 22px; }
.notice .ico { color: #A87412; }
.notice p { margin: 0; flex: 1; }

/* ---------- Formulários ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.panel h2 { font-size: 20px; margin-bottom: 14px; }
.panel h3 { font-size: 17px; margin: 18px 0 10px; }
.field { margin-bottom: 14px; }
.field label, .lbl { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(158,27,31,.1); }
textarea.input { min-height: 120px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; margin: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--cream); }
.auth-art { position: relative; background: #E6CBA4 18% center / cover; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, var(--cream)); }
.auth-covers { position: absolute; left: 6%; bottom: 7%; display: flex; z-index: 1; }
.auth-covers img { width: 92px; border-radius: 8px; box-shadow: 0 14px 28px -10px rgba(0,0,0,.6); margin-right: -26px; transform: rotate(-4deg); border: 2px solid #fff; }
.auth-covers img:nth-child(2n) { transform: rotate(3deg) translateY(-10px); }
.auth-box { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 6vw, 90px); }
.auth-box .logo { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.auth-box h1 { font-size: 34px; color: var(--red); }
.auth-box > p { color: var(--muted); margin: 6px 0 26px; }
.auth-box form { max-width: 400px; }
.auth-box .links { margin-top: 18px; font-size: 14px; color: var(--muted); max-width: 400px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-box .links a { color: var(--red); font-weight: 700; }
.pass { position: relative; }
.pass button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* ---------- Admin ---------- */
.admin .side { background: #2B1412; }
.admin .side nav a.on { background: var(--red); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-family: var(--serif); font-size: 30px; color: var(--red); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #FCF8F3; }
tr:last-child td { border-bottom: 0; }
td .thumb { width: 44px; border-radius: 6px; aspect-ratio: 2/3; object-fit: cover; }
td .thumb.audio { width: 70px; aspect-ratio: 16/9; }
.copy { display: flex; gap: 8px; }
.copy .input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.log-warn td { background: #FFF6F4; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager a, .pager span { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); font-weight: 700; padding: 0 10px; }
.pager .on { background: var(--red); color: #fff; border-color: var(--red); }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
code { background: var(--sand); padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- Celular ---------- */
@media (max-width: 960px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--red); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
  .topbar img { width: 34px; height: 34px; border-radius: 10px; background: #fff; padding: 3px; }
  .topbar b { font-family: var(--serif); font-size: 19px; flex: 1; }
  .topbar a { color: #fff; }
  .admin .topbar { background: #2B1412; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
  .bottomnav a.on { color: var(--red); }
  .bottomnav a.on .ico { font-variation-settings: 'FILL' 1, 'wght' 500; }
  .main { padding-bottom: 76px; }
  .wrap { padding: 20px 16px 30px; }
  .hero { aspect-ratio: 16 / 9; }
  .hero.default { background-image: url('/static/brand/banner-celular.webp'); }
  .greet h1 { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .grid.wide { grid-template-columns: 1fr; }
  .rail { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail > * { scroll-snap-align: start; }
  .rail.wide { grid-auto-columns: 80%; }
  .offer { flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px; }
  .offer .btn { margin-left: 0; width: 100%; }
  .book { grid-template-columns: 1fr; gap: 22px; }
  .book-cover { position: static; max-width: 230px; margin: 0 auto; }
  .book-cover.audio { max-width: 100%; }
  .book h1 { font-size: 27px; }
  .actions .btn { flex: 1 1 100%; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { height: 34vh; min-height: 210px; }
  .auth-art::after { background: linear-gradient(180deg, transparent 55%, var(--cream)); }
  .auth-covers { display: none; }
  .auth-box { padding: 6px 22px 40px; }
  .auth-box h1 { font-size: 28px; }
  .continue { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 23px; }
  th, td { padding: 10px; }
}
