/* Bookshelf — estilos. Tokens iguais às maquetas: verde-floresta, fundo claro, Newsreader + Manrope. */
:root {
  --verde: #1E5B47; --verde-esc: #143F31; --verde-claro: #DDEFE6; --verde-txt: #1E5B47;
  --fundo: #F1F2EE; --cartao: #FFFFFF; --tinta: #1A1C1A; --suave: #5D625C; --linha: #E1E3DD; --linha-forte: #C9CCC4;
  --ambar-fundo: #FBEFD9; --ambar: #7A4A06; --perigo: #A1342A; --perigo-linha: #E8C4BC;
  --chip: #E6E8E2; --serif: 'Newsreader', Georgia, serif; --sans: 'Manrope', system-ui, sans-serif;
  --raio: 16px; --sombra: 0 6px 16px rgba(30, 91, 71, .30);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--tinta); font-family: var(--sans); }
body { -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--verde); }
h1, h2, h3 { margin: 0; }
.serif { font-family: var(--serif); font-weight: 600; }
.suave { color: var(--suave); }
.oculto { display: none !important; }
:focus-visible { outline: 3px solid #3FBF86; outline-offset: 2px; }

/* ---------- estrutura */
.app { min-height: 100dvh; display: flex; }
.lateral { display: none; }
.principal { flex: 1; min-width: 0; padding: max(20px, env(safe-area-inset-top)) 20px calc(110px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.principal.largo { max-width: none; }
.navbaixo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--cartao); border-top: 1px solid var(--linha);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); }
.navbaixo a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--suave); text-decoration: none; min-height: 44px; justify-content: center; }
.navbaixo a.ativo { color: var(--verde); font-weight: 700; }
.navbaixo .camara { width: 58px; height: 58px; border-radius: 50%; background: var(--verde); color: #fff; margin: -26px auto 0; box-shadow: var(--sombra); }
.navbaixo .camara.ativo { color: #fff; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.p { width: 18px; height: 18px; }

@media (min-width: 900px) {
  .navbaixo { display: none; }
  .lateral { display: flex; flex-direction: column; gap: 4px; width: 240px; flex: none; background: var(--cartao); border-right: 1px solid var(--linha);
    padding: 22px 14px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
  .lateral .marca { font-family: var(--serif); font-weight: 600; font-size: 24px; padding: 0 10px 14px; }
  .lateral a.nav { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 10px; border-radius: 10px; color: var(--tinta); text-decoration: none; font-weight: 600; font-size: 14px; }
  .lateral a.nav.ativo { background: var(--verde-claro); color: var(--verde); font-weight: 700; }
  .lateral .sep { height: 1px; background: var(--linha); margin: 12px 4px; }
  .lateral .titulo-sec { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--suave); padding: 4px 10px; }
  .principal { padding: 28px 32px 48px; }
}

/* ---------- componentes */
.topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.topo h1 { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.05; letter-spacing: -.01em; }
.sobre { font-size: 13px; font-weight: 600; color: var(--suave); }
.sync { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--suave); }
.ponto { width: 7px; height: 7px; border-radius: 50%; background: #2E8B57; display: inline-block; }
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: 20px; padding: 18px; }
.grelha3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini { background: var(--fundo); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mini b { font-size: 18px; } .mini span { font-size: 11px; color: var(--suave); }
.mini.ambar { background: var(--ambar-fundo); color: var(--ambar); } .mini.ambar span { color: var(--ambar); }
.botao { height: 52px; border-radius: 14px; border: 1px solid var(--linha-forte); background: var(--cartao); font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; text-decoration: none; color: var(--tinta); }
.botao.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.botao.primario:hover { background: var(--verde-esc); }
.botao.grande { height: 60px; border-radius: 18px; font-size: 16px; width: 100%; }
.botao.escuro { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.botao.perigo { color: var(--perigo); border-color: var(--perigo-linha); }
.botao.peq { height: 38px; border-radius: 10px; font-size: 13px; padding: 0 12px; }
.botao:disabled { opacity: .5; cursor: default; }
.redondo { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--linha); background: var(--cartao); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--tinta); text-decoration: none; }
.aviso { background: var(--ambar-fundo); color: var(--ambar); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.aviso b { font-size: 14px; } .aviso small { font-size: 12px; display: block; }
.ok { background: var(--verde-claro); color: var(--verde); border-radius: 16px; padding: 12px 14px; font-size: 13px; }
.erro { background: #F8E1DC; color: #7A2117; border-radius: 16px; padding: 12px 14px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: var(--cartao); border: 1px solid var(--linha); display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--tinta); text-decoration: none; white-space: nowrap; }
.chip.ativo { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.chip span { color: var(--suave); font-weight: 500; } .chip.ativo span { color: #ccc; }
.etiqueta { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--cartao); border: 1px solid var(--linha); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; }
.etiqueta.tema { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 700; }
.sec-titulo { display: flex; justify-content: space-between; align-items: baseline; }
.sec-titulo h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.sec-titulo a { font-size: 13px; font-weight: 600; text-decoration: none; }
.rotulo { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--suave); }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.campo input, .campo select, .campo textarea { height: 46px; border-radius: 12px; border: 1px solid var(--linha-forte); padding: 0 12px; font-size: 16px; font-weight: 500; background: var(--cartao); min-width: 0; }
.campo textarea { height: 110px; padding: 10px 12px; resize: vertical; }
.procura { height: 48px; border-radius: 14px; background: var(--cartao); border: 1px solid var(--linha); display: flex; align-items: center; gap: 10px; padding: 0 14px; color: var(--suave); }
.procura input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--tinta); }
.linha-flex { display: flex; gap: 10px; align-items: center; }
.estado { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.estado::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.estado.conf { color: var(--verde); } .estado.nao { color: #9A5B07; } .estado.ja { color: var(--suave); }

/* ---------- capas */
.capa { border-radius: 4px 8px 8px 4px; box-sizing: border-box; padding: 9px 8px; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: inset 4px 0 0 rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.08); overflow: hidden; background-size: cover; background-position: center; }
.capa .t { font-family: var(--serif); font-weight: 600; line-height: 1.1; }
.capa .a { font-size: 8px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .85; }
.capa.img .t, .capa.img .a { display: none; }
.grelha-capas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
@media (min-width: 640px) { .grelha-capas { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
.grelha-capas a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--tinta); }
.grelha-capas .capa { aspect-ratio: 2/3; } .grelha-capas .capa .t { font-size: 13px; }
.grelha-capas .nome { font-size: 12px; font-weight: 700; line-height: 1.25; }
.recentes { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.recentes a { width: 78px; flex: none; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--suave); font-size: 11px; }
.recentes .capa { width: 78px; height: 112px; } .recentes .capa .t { font-size: 12px; }

/* ---------- listas de livros */
.lista { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--cartao); border: 1px solid var(--linha); border-radius: 16px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; }
.item .capa { width: 44px; height: 64px; flex: none; padding: 5px; } .item .capa .t { font-size: 8px; } .item .capa .a { display: none; }
.item .texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .texto b { font-size: 14px; line-height: 1.25; } .item .texto small { font-size: 12px; color: var(--suave); }
.item.apagado { opacity: .55; }
.item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--verde); }
.item .marcar { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.item textarea, .item input[type=text] { width: 100%; border: 1px solid var(--linha); border-radius: 8px; padding: 4px 8px; font-size: 14px; }

/* ---------- barras fixas no fundo */
.barra-fundo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--fundo) 70%, rgba(241,242,238,0)); display: flex; gap: 10px; justify-content: center; }
.barra-fundo > * { max-width: 680px; }
@media (min-width: 900px) { .barra-fundo { left: 240px; } }

/* ---------- ler prateleira */
.foto-prev { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 20px; background: #111412; display: block; }
.passos { display: flex; flex-direction: column; gap: 14px; }
.passo { display: flex; align-items: center; gap: 12px; }
.passo .n { width: 30px; height: 30px; border-radius: 50%; background: var(--fundo); color: var(--suave); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.passo.feito .n { background: var(--verde-claro); color: var(--verde); }
.passo.agora .n { background: var(--verde); color: #fff; animation: pulso 1.2s infinite; }
.passo b { font-size: 14px; display: block; } .passo small { font-size: 12px; color: var(--suave); }
@keyframes pulso { 50% { box-shadow: 0 0 0 6px rgba(30,91,71,.15); } }
.local { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 8px; }
@media (max-width: 420px) { .local { grid-template-columns: 1fr 1fr; } .local .campo:last-child { grid-column: span 2; } }
.tirar { position: relative; overflow: hidden; }
.tirar input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- ficha */
.ficha-capa { background: #E9DFC6; border-radius: 22px; padding: 22px; display: flex; justify-content: center; position: relative; }
.ficha-capa .capa { width: 160px; height: 240px; padding: 18px 14px; box-shadow: inset 6px 0 0 rgba(0,0,0,.1), 0 18px 36px rgba(60,45,20,.28); }
.ficha-capa .capa .t { font-size: 19px; } .ficha-capa .capa .a { font-size: 9px; }
.dados { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--linha); border-radius: 14px; background: var(--cartao); }
.dados > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--linha); min-width: 0; }
.dados > div:last-child { border-right: 0; }
.dados small { font-size: 11px; color: var(--suave); } .dados b { font-size: 13px; overflow-wrap: anywhere; }
.sinopse { font-size: 15px; line-height: 1.55; margin: 0; }

/* ---------- organizar (computador) */
.org { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.org .prateleiras { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.org .editor { flex: 1 1 280px; max-width: 360px; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 12px; }
.prateleira { background: var(--cartao); border: 1px solid var(--linha); border-radius: 18px; padding: 14px 16px 0; }
.prateleira .cab { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.lombadas { display: flex; align-items: flex-end; gap: 4px; min-height: 200px; overflow-x: auto; border-bottom: 10px solid #D9D3C3; padding-top: 8px; }
.lombadas.alvo { background: var(--verde-claro); }
.lombada { flex: none; border-radius: 3px 3px 0 0; padding: 8px 0; display: flex; justify-content: center; cursor: grab; border: 0; position: relative; }
.lombada span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--serif); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-height: 100%; }
.lombada.sel { outline: 3px solid var(--verde); outline-offset: 2px; }
.lombada.emprestado::after { content: ''; position: absolute; top: -6px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #E2A33B; }
.vazio { color: var(--suave); font-size: 13px; padding: 20px 0; align-self: center; }
.arvore a { display: flex; justify-content: space-between; align-items: center; height: 36px; padding: 0 10px; border-radius: 10px; text-decoration: none; color: var(--tinta); font-size: 14px; font-weight: 600; }
.arvore a.bib { font-family: var(--serif); font-size: 17px; }
.arvore a.est { padding-left: 24px; }
.arvore a.ativo { background: var(--verde-claro); color: var(--verde); font-weight: 700; }
.arvore a.alvo { outline: 2px dashed var(--verde); }
.arvore span { font-family: var(--sans); font-size: 12px; color: var(--suave); font-weight: 600; }
.barra-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--tinta); color: #fff; border-radius: 14px; padding: 10px 14px; }
.barra-acoes select, .barra-acoes button { height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-weight: 700; font-size: 13px; padding: 0 10px; }
.barra-acoes select option { color: var(--tinta); }
.barra-acoes .perigo { margin-left: auto; border: 0; color: #F2B8A8; }

/* ---------- aviso flutuante (desfazer) */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 50; background: var(--tinta); color: #fff;
  border-radius: 14px; padding: 12px 16px; display: flex; gap: 14px; align-items: center; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }
.toast button { background: none; border: 0; color: #9EE0BF; font-weight: 700; }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ---------- entrar */
.entrar { min-height: 100dvh; background: var(--verde); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 64px 24px 40px; max-width: 520px; margin: 0 auto; }
.entrar h1 { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1.02; }
.entrar p { color: #DCEBE4; line-height: 1.5; }
.entrar .botao { background: #fff; color: var(--tinta); border: 0; width: 100%; height: 56px; }
.prat-deco { display: flex; align-items: flex-end; gap: 6px; height: 190px; border-bottom: 10px solid var(--verde-esc); margin: 24px 0; }
.prat-deco i { display: block; border-radius: 3px; }

.item.estante-linha { flex-wrap: wrap; }
.item.estante-linha .texto { flex: 1 1 140px; }

/* lombada recortada da foto da prateleira (livros não identificados) */
img.recorte { display: block; max-width: 100%; max-height: 64px; width: auto; border-radius: 6px; margin-top: 4px;
  box-shadow: 0 0 0 1px var(--linha); cursor: pointer; transition: transform .2s; }
img.recorte.virar { transform: rotate(180deg); }
.lombada-grande img.recorte { max-height: 96px; }
.girar { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--linha); border-top-color: var(--verde);
  animation: girar 0.9s linear infinite; flex: none; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Google Drive */
.barra-drive { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--ambar-fundo); color: var(--ambar);
  border-radius: 14px; padding: 10px 12px 10px 14px; font-size: 13px; font-weight: 600; }
.sync.ambar { color: var(--ambar); } .sync.ambar .ponto { background: var(--ambar); }

/* administração › utilização */
.abas { display: flex; gap: 4px; background: var(--chip); border-radius: 12px; padding: 4px; margin: 4px 0 14px; }
.abas button { flex: 1; border: 0; background: none; font: 600 14px var(--sans); color: var(--suave); padding: 9px 6px; border-radius: 9px; min-height: 40px; cursor: pointer; }
.abas button.sel { background: var(--cartao); color: var(--tinta); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.abas.peq button { font-size: 12px; padding: 6px; min-height: 34px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--cartao); border: 1px solid var(--linha); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi b { font: 600 24px var(--serif); color: var(--verde-txt); }
.kpi small { font-size: 12px; font-weight: 600; }
.kpi span { font-size: 11px; color: var(--suave); }
h3.titulo-sec { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--suave); margin: 20px 0 8px; }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 10px 10px 4px; overflow-x: auto; }
.barras > div { flex: 1 0 10px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.barras i { display: block; width: 100%; background: var(--verde); border-radius: 3px 3px 0 0; }
.barras i.com-erros { background: linear-gradient(var(--perigo) 0 4px, var(--verde) 4px); }
.barras small { font-size: 9px; color: var(--suave); }
.tabela-rol { overflow-x: auto; background: var(--cartao); border: 1px solid var(--linha); border-radius: 14px; }
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { text-align: left; font-size: 11px; color: var(--suave); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--linha); white-space: nowrap; }
.tabela td { padding: 8px 10px; border-bottom: 1px solid var(--linha); white-space: nowrap; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela td.mau, .erro-txt { color: var(--perigo); }
.erro-txt { white-space: normal; word-break: break-word; }
