/* Meu Acervo — estilos */
:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-2: #eaf0f5;
  --ink: #1f2d3a;
  --ink-2: #475867;
  --muted: #74838f;
  --border: #dce5ed;
  --accent: #2b7bbf;
  --accent-ink: #ffffff;
  --accent-soft: #e3eff9;
  --brand: #2b7bbf;
  --gold: #dea248;
  --gold-soft: #fbf1e1;
  --good: #2e8a5a;
  --warn: #b7791f;
  --bad: #c4453d;
  --star: #dea248;
  --shadow: 0 1px 2px rgba(30, 60, 90, .05), 0 4px 14px rgba(30, 60, 90, .06);
  --radius: 14px;
  --serif: "Poppins", "Inter", system-ui, sans-serif; /* títulos: mesma família visual da logo */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10181f; --surface: #17222c; --surface-2: #1f2d39; --ink: #e4ecf2; --ink-2: #bfccd7;
    --muted: #8d9caa; --border: #2a3a48; --accent: #6bb0e6; --accent-ink: #0f1820; --accent-soft: #18324a;
    --good: #6cc38f; --warn: #e3a93b; --bad: #f08b83; --star: #e8b25e; --brand: #9cc3e0; --gold: #e8b25e; --gold-soft: #3a2f1c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10181f; --surface: #17222c; --surface-2: #1f2d39; --ink: #e4ecf2; --ink-2: #bfccd7;
    --muted: #8d9caa; --border: #2a3a48; --accent: #6bb0e6; --accent-ink: #0f1820; --accent-soft: #18324a;
    --good: #6cc38f; --warn: #e3a93b; --bad: #f08b83; --star: #e8b25e; --brand: #9cc3e0; --gold: #e8b25e; --gold-soft: #3a2f1c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.brand img, .side-brand img { display: block; height: 34px; width: auto; }
.logo-dark { display: none !important; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: .8rem; background: var(--surface); }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-pill.ok .dot { background: var(--good); }
.sync-pill.pending .dot { background: var(--warn); }
.sync-pill.error .dot { background: var(--bad); }
.sync-pill.busy .dot { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.view { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }

/* Tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .7rem; padding: 6px 0; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabbar a.active { color: var(--accent); }
.tabbar .tab-add { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); justify-content: center; margin-top: -18px; box-shadow: var(--shadow); }
.tabbar .tab-add svg { stroke-width: 2.4; width: 26px; height: 26px; }
.tabbar .tab-add.active { color: var(--accent-ink); }

/* Reading bar (sessão ativa) */
.reading-bar {
  position: sticky; top: 52px; z-index: 15; display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 8px 16px; background: var(--accent); color: var(--accent-ink); font-size: .9rem;
}
.reading-bar .rb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reading-bar .rb-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.reading-bar button { background: var(--accent-ink); color: var(--accent); border: 0; border-radius: 999px; padding: 5px 12px; font-weight: 600; cursor: pointer; }

/* Generic */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section a { font-size: .85rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty svg { width: 46px; height: 46px; stroke: var(--border); fill: none; stroke-width: 1.5; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 11px; cursor: pointer; font-weight: 500; min-height: 42px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--ink-2); line-height: 0; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.fav-on svg { fill: var(--bad); stroke: var(--bad); }

/* Stats tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; color: var(--ink); display: block; }
.tile .n { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: .8rem; }
.tile.accent { background: var(--accent-soft); border-color: transparent; }

/* Progress */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Book covers */
.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; overflow: hidden; background: var(--surface-2);
  box-shadow: inset 3px 0 0 rgba(0,0,0,.12), var(--shadow); flex-shrink: 0;
}
.cover img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; } /* acima da lombada (.ph), que só aparece sem imagem */
.cover .ph { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 8px 5px; text-align: center; font-family: var(--serif); font-size: .78rem; line-height: 1.15; color: #fff; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; }
.list-item .cover .ph, .result-item .cover .ph { font-size: .5rem; padding: 3px; }
.list-item .cover .ph small, .result-item .cover .ph small { display: none; }
.cover .ph small { display: block; font-family: var(--sans); font-size: .62rem; opacity: .85; margin-top: 4px; }
.cover .badge { position: absolute; left: 4px; top: 4px; font-size: .62rem; padding: 2px 6px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; }
.cover .fav { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; fill: #f06a5e; stroke: #fff; stroke-width: 1.5; }

.shelf-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.book-mini { color: var(--ink); }
.shelf-row .book-mini { width: 108px; flex-shrink: 0; scroll-snap-align: start; }
.book-mini .t { font-size: .82rem; font-weight: 500; margin-top: 6px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-mini .a { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-mini .progress { height: 4px; margin-top: 5px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 12px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
.list-item .cover { width: 48px; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta .a { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.continue-card { display: flex; gap: 12px; align-items: stretch; }
.continue-card .cover { width: 70px; }
.continue-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.continue-card .row { flex-wrap: wrap; gap: 6px; }
.continue-card .btn { white-space: nowrap; }
.continue-card .t { font-weight: 600; font-family: var(--serif); font-size: 1.02rem; line-height: 1.2; }

/* Chips / segmented */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; font-size: .84rem; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .x { margin-left: 4px; opacity: .7; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin: 0 4px 4px 0; }
.status-tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.pill-warn { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill-ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }

.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.segmented button { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 6px; font-size: .84rem; cursor: pointer; color: var(--ink-2); }
.segmented button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Search */
.searchbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.searchbar .input-wrap { flex: 1; position: relative; }
.searchbar input { width: 100%; padding: 11px 12px 11px 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.searchbar .input-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .field .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); min-height: 42px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .searchbar input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
legend { font-family: var(--serif); font-weight: 600; padding: 0 6px; }
.check { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: .9rem; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Stars */
.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 18px; height: 18px; }
.stars.big svg { width: 32px; height: 32px; }
.star-input { display: inline-flex; gap: 4px; touch-action: none; user-select: none; cursor: pointer; }

/* Book detail */
.book-hero { display: flex; gap: 16px; align-items: flex-start; }
.book-hero .cover { width: 116px; }
.book-hero .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.book-hero h1 { font-size: 1.35rem; line-height: 1.2; }
.book-hero .authors { color: var(--ink-2); }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.actions .btn { flex-direction: column; font-size: .76rem; padding: 10px 4px; gap: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.synopsis { white-space: pre-line; color: var(--ink-2); }
.timeline-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .head { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; color: var(--muted); }
.timeline-item .body { margin-top: 4px; white-space: pre-line; }

/* Charts (single-series bars) */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 16px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.bars .bar i { display: block; width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.bars .bar i.zero { background: var(--border); height: 2px !important; border-radius: 1px; }
.bars .bar .v { position: absolute; font-size: .7rem; color: var(--ink-2); font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .12s; pointer-events: none; }
.bars .bar:hover .v, .bars .bar:focus .v, .bars .bar.lbl .v { opacity: 1; }
.bars .bar:hover i:not(.zero) { filter: brightness(1.12); }
.bar-axis { display: flex; gap: 2px; border-top: 1px solid var(--border); padding-top: 4px; }
.bar-axis span { flex: 1; text-align: center; font-size: .66rem; color: var(--muted); }
.hbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: .85rem; margin: 6px 0; }
.hbar .track { height: 12px; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar .n { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Menu list */
.menu { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.menu a, .menu button { display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--ink); border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; width: 100%; }
.menu > :last-child { border-bottom: 0; }
.menu svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.menu .m-text { flex: 1; }
.menu .m-text small { display: block; color: var(--muted); font-size: .8rem; }

/* Modal (bottom sheet) */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 30, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal {
  background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out;
}
@media (min-width: 700px) { .modal-backdrop { align-items: center; } .modal { border-radius: 18px; } }
.modal .modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal .modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; opacity: 0; pointer-events: none; transition: all .2s; z-index: 60; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Scanner */
#scanner { width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; min-height: 240px; }
#scanner video { width: 100% !important; }
.alert { padding: 10px 12px; border-radius: 12px; font-size: .9rem; display: flex; gap: 8px; align-items: flex-start; }
.alert.warn { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.info { background: var(--accent-soft); color: var(--ink); }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; margin-top: 1px; }

.result-item { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; width: 100%; color: var(--ink); }
.result-item + .result-item { margin-top: 8px; }
.result-item .cover { width: 52px; }
.result-item .t { font-weight: 600; }

@media (max-width: 380px) {
  .grid2 { grid-template-columns: 1fr; }
  .actions { grid-template-columns: repeat(2, 1fr); }
}
/* ================= Responsivo: celular (base) · tablet (≥700px) · desktop (≥1100px) ================= */
.tabbar .side-brand, .tabbar .add-label { display: none; }
.continue-grid, .panels, .form-cols { display: flex; flex-direction: column; gap: 10px; }
.continue-grid .card + .card { margin-top: 0; }
.panel .section { margin-top: 22px; }
.form-cols > fieldset { align-self: stretch; }

@media (hover: hover) {
  a.tile:hover, .book-mini:hover .cover, .result-item:hover, .list-item:hover { filter: brightness(1.03); }
  .book-mini:hover .cover { transform: translateY(-2px); transition: transform .15s; }
  .menu a:hover, .menu button:hover { background: var(--surface-2); }
  .chip:hover { border-color: var(--muted); }
}

/* Tablet */
@media (min-width: 700px) {
  .view { max-width: 980px; padding: 20px 24px; }
  h1 { font-size: 1.8rem; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 16px; }
  .shelf-row .book-mini { width: 124px; }
  .continue-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
  .panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; align-items: start; }
  .book-hero .cover { width: 150px; }
  .book-hero h1 { font-size: 1.7rem; }
  .actions { max-width: 560px; }
  .tabbar { padding-left: max(16px, calc((100% - 640px) / 2)); padding-right: max(16px, calc((100% - 640px) / 2)); }
  .modal { padding: 22px 24px; }
}

/* Desktop: navegação lateral + colunas */
@media (min-width: 1100px) {
  :root { --side-w: 232px; }
  body { padding-bottom: 24px; padding-left: var(--side-w); }
  .topbar .brand { visibility: hidden; }
  .reading-bar { top: 53px; }
  .view { max-width: 1180px; padding: 24px 36px 40px; }

  .tabbar {
    top: 0; right: auto; width: var(--side-w); height: 100vh; padding: 18px 14px; flex-direction: column; justify-content: flex-start;
    align-items: stretch; gap: 4px; border-top: 0; border-right: 1px solid var(--border); z-index: 45;
  }
  .tabbar .side-brand { display: flex; flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 1.15rem; padding: 4px 8px 18px; flex: 0 0 auto; }
  .tabbar .side-brand img { height: 46px; }
  .tabbar a { flex: 0 0 auto; flex-direction: row; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; color: var(--ink-2); }
  .tabbar a:hover { background: var(--surface-2); }
  .tabbar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar .tab-add { order: 0; width: auto; height: auto; margin: 0 0 14px; border-radius: 11px; justify-content: center; padding: 11px 12px; color: var(--accent-ink); }
  .tabbar .tab-add:hover { background: var(--accent); filter: brightness(1.08); }
  .tabbar .tab-add .add-label { display: inline; font-weight: 600; }
  .tabbar .tab-add svg { width: 20px; height: 20px; }
  .tabbar .tab-add.active { background: var(--accent); color: var(--accent-ink); }
  .tabbar .side-brand { order: -2; }
  .tabbar .tab-add { order: -1; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .continue-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
  .panels { gap: 0 24px; }

  /* Ficha do livro em duas colunas: capa/ações fixas à esquerda, conteúdo à direita */
  .book-layout { display: grid; grid-template-columns: 360px 1fr; gap: 32px; align-items: start; }
  .book-main .book-hero { flex-direction: column; }
  .book-main .book-hero .cover { width: 180px; }
  .book-main .actions { grid-template-columns: repeat(2, 1fr); }
  .book-main .segmented { grid-template-columns: repeat(2, 1fr); }
  .book-side > .section:first-child { margin-top: 0; }

  /* Formulário em duas colunas */
  .form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .form-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); }

  .toast { bottom: 24px; left: calc(50% + var(--side-w) / 2); }
  .modal-backdrop { padding-left: var(--side-w); }
}

@media (forced-colors: active) { .progress > span, .bars .bar i, .hbar .track i { background: CanvasText; } }

/* Escolha de capa (edições encontradas) */
.cover-picker { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 10px; }
.cover-picker .row { gap: 8px; flex-wrap: wrap; }
.cp-strip { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 4px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.cp-strip > p { margin: 6px 0; }
.cp-item { flex: 0 0 84px; display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink-2); text-align: left; scroll-snap-align: start; }
.cp-item img { width: 84px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; border: 2px solid transparent; background: var(--surface-2); box-shadow: var(--shadow); }
.cp-item.on img { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.cp-item span { font-size: .66rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-item.on span { color: var(--accent); font-weight: 600; }

.result-item.loading { opacity: .55; pointer-events: none; }

/* Logo: versão clara no tema escuro */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

/* Sugestões de livro sob o campo Título */
.suggest-wrap { position: relative; }
.title-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(20, 40, 60, .16); }
.sg-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; color: var(--ink); }
.sg-item:last-child { border-bottom: 0; }
.sg-item:hover, .sg-item:focus { background: var(--accent-soft); }
.sg-item .cover { width: 34px; }
.sg-item .cover .ph { font-size: .4rem; padding: 2px; }
.sg-item .cover .ph small { display: none; }
.sg-item span { display: flex; flex-direction: column; min-width: 0; }
.sg-item b { font-weight: 600; font-size: .9rem; }
.sg-item small { color: var(--muted); font-size: .76rem; }
#autoInfo:empty { display: none; }
