:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --ink: #2b2340;
  --muted: #5e5670;
  --line: #e8dccd;
  --primary: #5b2e91;
  --primary-ink: #ffffff;
  --primary-soft: #efe5fb;
  --accent: #c2410c;
  --danger: #b91c1c;
  --ok-bg: #e7f6ec;
  --ok-ink: #14532d;
  --err-bg: #fde8e8;
  --err-ink: #8a1c1c;
  --star: #b45309;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(43, 35, 64, 0.08);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: var(--primary); }
h1, h2 { line-height: 1.2; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--primary); color: var(--primary-ink);
  box-shadow: var(--shadow);
}
.brand { color: inherit; text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: .2px; flex: 1; min-height: 44px; display: flex; align-items: center; }
.brand-dot { font-size: 1.4rem; width: 44px; height: 44px; display: grid; place-items: center; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  color: inherit; text-decoration: none; font-size: 1.4rem;
}
.icon-btn:hover { background: rgba(255,255,255,.15); }
.logout { margin: 0; }
.topbar .btn-ghost { color: var(--primary-ink); border-color: rgba(255,255,255,.55); background: transparent; }

.wrap { max-width: 960px; margin: 0 auto; padding: 12px 16px 120px; }
.page-title { font-size: 1.5rem; margin: 8px 0 12px; }

/* ---------- botões ---------- */
.btn, .btn-ghost, .btn-danger, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .08s ease, background .15s;
}
.btn:active, .chip:active, .star:active, .reaction:active { transform: scale(.96); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #4a2478; }
.btn-ghost { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-ghost.small { min-height: 44px; padding: 6px 14px; font-size: .9rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 44px; min-width: 44px; font: inherit; }

/* ---------- formulários ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-weight: 700; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input:not([type]), textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font: inherit;
}
input:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.has-error input, [aria-invalid=true] { border-color: var(--danger); }
.err { color: var(--danger); font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--primary); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.row2 > * { min-width: 0; }
input[type=date] { min-width: 0; width: 100%; max-width: 100%; display: block; -webkit-appearance: none; appearance: none; }
@media (max-width: 419px) { .row2.dates { grid-template-columns: minmax(0, 1fr); } }
.alert { background: var(--err-bg); color: var(--err-ink); padding: 10px 14px; border-radius: 12px; font-weight: 600; }
.notice { background: #fff4d6; color: #5c3d00; padding: 12px 14px; border-radius: 12px; border: 1px solid #f4d58d; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); padding: 10px 0 4px; }
.form-actions .btn-primary { flex: 1; max-width: 260px; }
details.more { border-top: 1px dashed var(--line); padding-top: 6px; }
details.more > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--primary); cursor: pointer; }
details.more[open] { display: grid; gap: 14px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: .95rem; margin-bottom: 6px; padding: 0; }

/* ---------- capa no formulário ---------- */
.cover-picker { display: flex; gap: 14px; align-items: center; }
.cp-preview { width: 84px; flex: 0 0 84px; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; background: var(--primary-soft); display: grid; place-items: center; }
.cp-preview img { width: 100%; height: 100%; object-fit: cover; }
.cp-empty { font-size: 2rem; }
.cp-actions { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.cp-actions label { cursor: pointer; }

/* ---------- login ---------- */
.page-login .wrap { max-width: 420px; padding-top: 40px; }
.login { text-align: center; }
.login .form { text-align: left; margin-top: 16px; }
.login h1 { font-size: 2.2rem; margin: 4px 0; color: var(--primary); }
.login-hero { font-size: 3rem; }
.wide { width: 100%; }

/* ---------- busca e filtros ---------- */
.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input { flex: 1; min-width: 0; }
.search .btn { padding: 10px 14px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .filters { flex-wrap: wrap; overflow: visible; margin: 0; padding: 4px 0 10px; } }
.page-shelf .grid { padding-bottom: 96px; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink); border: 2px solid var(--line);
  font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip .n { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 0 8px; font-size: .8rem; }
.chip.on, .chip[aria-pressed=true] { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.on .n { background: rgba(255,255,255,.25); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.badge[aria-pressed=true] { background: #fde68a; color: #4a3000; border-color: #d97706; }
.chip.badge[aria-pressed=true]::before { content: "🏷️"; }
.chip-radio { position: relative; }
.chip-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-radio span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: .95rem; }
.chip-radio input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-radio input:focus-visible + span { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* ---------- grade ---------- */
.count { margin: 2px 0 8px; font-size: .9rem; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; } }
.book-card { display: grid; gap: 2px; text-decoration: none; color: var(--ink); }
.cover-wrap { position: relative; }
.cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; box-shadow: 0 4px 12px rgba(43,35,64,.18); display: block; background: #ddd; }
.book-card:hover .cover { transform: translateY(-2px); transition: transform .15s; }
.cover-fake {
  background: linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 60%, #000));
  color: #fff; padding: 12px 10px; display: flex; flex-direction: column; justify-content: center; gap: 6px; overflow: hidden;
  border-left: 6px solid rgba(0,0,0,.2);
}
.cf0 { --c: #5b2e91; } .cf1 { --c: #0f766e; } .cf2 { --c: #b45309; } .cf3 { --c: #be185d; }
.cf4 { --c: #1d4ed8; } .cf5 { --c: #4d7c0f; } .cf6 { --c: #9f1239; } .cf7 { --c: #6d28d9; }
.cf-title { font-weight: 800; font-size: 1rem; line-height: 1.15; overflow-wrap: normal; word-break: normal; hyphens: auto; -webkit-hyphens: auto; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cf-author { font-size: .8rem; opacity: .95; }
.st-pill { position: absolute; left: 6px; bottom: 6px; background: rgba(255,255,255,.95); color: var(--ink); font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.react-pill { position: absolute; right: 6px; top: 6px; background: rgba(255,255,255,.95); border-radius: 999px; font-size: 1.1rem; width: 32px; height: 32px; display: grid; place-items: center; }
.bc-title { font-weight: 800; margin-top: 6px; line-height: 1.2; overflow-wrap: anywhere; }
.bc-author { color: var(--muted); font-size: .875rem; }
.bc-stars { color: var(--star); letter-spacing: 1px; font-size: .95rem; }

/* ---------- vazio ---------- */
.empty { text-align: center; padding: 40px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-art { font-size: 3rem; }
.empty h1, .empty h2 { margin: 8px 0; }

/* ---------- botão flutuante ---------- */
.fab {
  position: fixed; right: 16px; bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20; min-height: 56px; padding: 0 22px; border-radius: 999px;
  display: inline-flex; align-items: center; font-weight: 800; font-size: 1.05rem;
  background: var(--accent); color: #fff; text-decoration: none; box-shadow: 0 6px 18px rgba(194,65,12,.4);
}
.fab:hover { background: #a3360a; }

/* ---------- adicionar ---------- */
.choice { display: grid; gap: 12px; }
@media (min-width: 720px) { .choice { grid-template-columns: repeat(3, 1fr); } }
.choice-card {
  display: grid; gap: 2px; justify-items: start; padding: 18px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  cursor: pointer; border: 2px solid transparent; min-height: 44px; position: relative;
}
.choice-card:hover, .choice-card:focus-within { border-color: var(--primary); }
.choice-card.primary { background: var(--primary); color: #fff; }
.choice-card.primary .choice-sub { color: #f1e8ff; }
.choice-emoji { font-size: 2rem; }
.choice-title { font-weight: 800; font-size: 1.15rem; }
.choice-sub { color: var(--muted); font-size: .9rem; }
.reading { text-align: center; padding: 24px; }
.reading img { max-height: 280px; border-radius: 12px; box-shadow: var(--shadow); }
.reading-text { font-weight: 800; font-size: 1.2rem; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } * { transition: none !important; } }

/* ---------- detalhe ---------- */
.detail-head { display: flex; gap: 16px; align-items: flex-start; }
.detail-cover { flex: 0 0 120px; }
.cover.big { width: 120px; }
@media (min-width: 720px) { .detail-cover { flex-basis: 200px; } .cover.big { width: 200px; } }
.detail-info { min-width: 0; }
.detail-info h1 { margin: 0 0 4px; font-size: 1.4rem; overflow-wrap: anywhere; }
.author { margin: 0 0 6px; font-weight: 700; color: var(--muted); }
.synopsis { background: var(--surface); padding: 12px 14px; border-radius: 12px; white-space: pre-line; }
.detail .block { display: block; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-top: 14px; }
.detail .block h2 { font-size: 1.05rem; margin: 0 0 10px; }
.stars { display: flex; gap: 2px; }
.star { width: 48px; height: 48px; font-size: 2rem; line-height: 1; border: 0; background: none; color: #7d7873; cursor: pointer; border-radius: 10px; padding: 0; }
.star.lit { color: var(--star); }
.reactions { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction { width: 48px; height: 48px; font-size: 1.6rem; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; padding: 0; }
.reaction[aria-pressed=true] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary); }
.inline-add { display: flex; gap: 8px; margin-top: 10px; }
.inline-add input { flex: 1; min-width: 0; }
.imp-form { display: grid; gap: 8px; }
.imp-form .btn { justify-self: end; }
.diary { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.diary li { border-left: 4px solid var(--primary); padding: 6px 10px; background: #fbf7ff; border-radius: 0 10px 10px 0; }
.diary time { font-size: .8rem; color: var(--muted); font-weight: 700; }
.diary p { margin: 4px 0; white-space: pre-line; overflow-wrap: anywhere; }
.diary form { margin: 0; text-align: right; }
.detail .block.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
details.danger > summary { list-style: none; }
details.danger > summary::-webkit-details-marker { display: none; }
.confirm { margin-top: 10px; background: var(--err-bg); padding: 12px; border-radius: 12px; }
.confirm p { margin-top: 0; }

/* ---------- aviso ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700;
  max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast[data-kind=erro] { background: var(--danger); }
.toast[hidden] { display: none; }

/* ---------- campos sugeridos pela IA ---------- */
.sug { font-style: normal; font-size: .75rem; font-weight: 800; background: #fff4d6; color: #5c3d00; border: 1px solid #e0b64f; border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; }
[data-suggested="1"] { border-color: #e0b64f; background: #fffbef; }
.notice.ai { background: var(--primary-soft); color: #3b1d63; border-color: #d6c2f2; }

/* ---------- navegação principal ---------- */
.mainnav { display: flex; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 56px; z-index: 9; }
.mainnav a { flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: .78rem; font-weight: 700; color: var(--muted); text-decoration: none; padding: 4px 2px; border-bottom: 3px solid transparent; }
.mainnav a span { font-size: 1.1rem; line-height: 1.2; }
.mainnav a.on { color: var(--primary); border-bottom-color: var(--primary); }
@media (min-width: 720px) { .mainnav { justify-content: center; } .mainnav a { flex: 0 0 140px; flex-direction: row; gap: 6px; font-size: .95rem; } }

/* ---------- empréstimos ---------- */
.section-title { font-size: 1.15rem; margin: 22px 0 10px; }
.lent-pill { background: #fff4d6; color: #5c3d00; }
.loan-list { display: grid; gap: 12px; }
@media (min-width: 720px) { .loan-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.loan-card { display: flex; gap: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; border-left: 6px solid #15803d; min-width: 0; }
.detail .loan-card { box-shadow: none; padding: 0 0 0 12px; }
.loan-card.tone-warn { border-left-color: #b45309; }
.loan-card.tone-late { border-left-color: var(--danger); background: #fff5f5; }
.loan-card.tone-done { border-left-color: var(--line); }
.lc-cover { flex: 0 0 72px; text-decoration: none; }
.cover-fake, .cover-fake * { text-decoration: none; }
.cover.small { width: 72px; }
.cover.small.cover-fake { padding: 6px; }
.cover.small .cf-title { font-size: .7rem; }
.cover.small .cf-author { display: none; }
.lc-body { min-width: 0; flex: 1; display: grid; gap: 4px; align-content: start; }
.lc-title { font-weight: 800; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; min-height: 44px; display: flex; align-items: center; }
.lc-friend { margin: 0; }
.lc-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; font-size: .85rem; }
.lc-dates dt { color: var(--muted); font-weight: 700; }
.lc-dates dd { margin: 0; }
.days { justify-self: start; font-weight: 800; font-size: .85rem; border-radius: 999px; padding: 3px 10px; }
.days-ok { background: #dcfce7; color: #14532d; }
.days-warn { background: #fef3c7; color: #713f12; }
.days-late { background: #fee2e2; color: #7f1d1d; }
.days-done { background: #eee; color: #3f3f46; }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.lc-actions form { margin: 0; }
.btn.small, .btn-primary.small { min-height: 44px; padding: 6px 14px; font-size: .9rem; }
.lc-more > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--primary); cursor: pointer; }
.lc-more { display: grid; gap: 6px; }
.lc-more form { margin: 0; }
.lc-opinion { margin: 4px 0 0; }
.lc-opinion q { display: block; font-style: italic; overflow-wrap: anywhere; }
.tabs3 .tab-atrasados.on { background: var(--danger); border-color: var(--danger); }
.history > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--primary); cursor: pointer; }
.hist { margin: 0; padding-left: 18px; }
.opinions { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.opinions li { display: flex; gap: 10px; }
.opinions p { margin: 2px 0 0; overflow-wrap: anywhere; }
.avatar { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--primary-soft); border-radius: 50%; flex: 0 0 44px; }
/* escolher amigo e reações em formulários */
.friend-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pick { position: relative; }
.pick input, .reaction-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick > span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; }
.pick input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pick input:checked + span .muted { color: #f1e8ff; }
.pick .plus { color: inherit; background: none; border: 0; padding: 0; min-height: 0; }
.pick input:focus-visible + span, .reaction-radio input:focus-visible + span { outline: 3px solid #f59e0b; outline-offset: 2px; }
.new-friend { display: grid; gap: 10px; }
.friend-pick:has(input[value]:not([data-new-friend]):checked) ~ .new-friend { display: none; }
.reaction-radio { position: relative; }
.reaction-radio span { width: 48px; height: 48px; font-size: 1.6rem; display: grid; place-items: center; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
.reaction-radio input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary); }
.stars-radio { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.stars-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-radio label { width: 48px; height: 48px; font-size: 2rem; display: grid; place-items: center; color: #7d7873; cursor: pointer; }
.stars-radio input:checked ~ label, .stars-radio label:hover, .stars-radio label:hover ~ label { color: var(--star); }
.stars-radio input:focus-visible + label { outline: 3px solid #f59e0b; outline-offset: 2px; border-radius: 10px; }
/* amigos */
.friend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.friend-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; min-height: 64px; }
.fr-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }

a.btn-link { display: inline-flex; align-items: center; min-height: 44px; }
.filters.tabs3 { flex-wrap: nowrap; overflow: visible; margin: 0; padding: 4px 0 10px; gap: 6px; }
.tabs3 .chip { flex: 1 1 0; justify-content: center; padding: 8px 6px; font-size: .9rem; min-width: 0; }
.tabs3 .chip .n { padding: 0 6px; }
/* até 420px: rótulo em cima e contador embaixo, as 3 abas cabem sem encostar na borda */
@media (max-width: 420px) {
  .tabs3 .chip { flex-direction: column; gap: 2px; padding: 6px 4px; border-radius: 16px; font-size: .85rem; line-height: 1.1; }
  .tabs3 .chip .n { font-size: .75rem; }
}
.pick .plus { font-weight: 800; font-size: 1.1rem; margin-right: 4px; }

/* ---------- Pessoas ---------- */
.people-link { margin: 12px 0; }
.person-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
@media (min-width: 720px) { .person-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.person-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; min-height: 64px; }
.person-row.inactive { opacity: .85; background: #f4f1ec; }
.pr-main { min-width: 0; flex: 1; line-height: 1.6; }
.pr-email { overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 1px 9px; margin-right: 4px; }
.tag.role-admin { background: #ede4fb; color: #3b1d63; }
.tag.role-owner { background: #fff4d6; color: #5c3d00; }
.tag.on { background: #dcfce7; color: #14532d; }
.tag.off { background: #e4e4e7; color: #3f3f46; }
.tag.pending { background: #fee2e2; color: #7f1d1d; }
.temp-box { display: grid; gap: 12px; margin-bottom: 14px; }
.temp-box p { margin: 0; }
.temp-pass { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.temp-pass code { font: 700 1.25rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--primary-soft); color: #2b1450; padding: 10px 14px; border-radius: 12px; letter-spacing: .5px; overflow-wrap: anywhere; user-select: all; flex: 1 1 200px; }
.dialog { border: 0; border-radius: var(--radius); padding: 18px; max-width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.3); color: var(--ink); }
.dialog::backdrop { background: rgba(43, 35, 64, .55); }
.dialog h2 { margin: 0 0 8px; font-size: 1.2rem; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.dialog-actions form { margin: 0; }
.book-tools { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.book-tools form { margin: 0; }
.book-tools .btn { white-space: normal; }
.invite-list, .simple-books, .shelf-directory { list-style: none; padding: 0; display: grid; gap: 14px; }
.member-card { margin-top: 14px; }
.member-contact, .simple-book-top { overflow-wrap: anywhere; min-width: 0; }
.simple-book-top { display: flex; align-items: flex-start; gap: 12px; }
.simple-book-top h2 { font-size: 1.15rem; margin: 0; overflow-wrap: anywhere; }
.simple-book-top > div { min-width: 0; }
.simple-book-top p { margin: 4px 0; }
.simple-book-icon { font-size: 1.8rem; }
.simple-book-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.shelf-directory .choice-card { min-height: 96px; }
.member-card button { white-space: normal; }
@media (min-width: 720px) { .shelf-directory { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.label-page { background: #fff; color: #111; }
.label-page main { max-width: 760px; margin: 0 auto; padding: 16px; }
.label-controls { margin-bottom: 24px; }
.book-label { box-sizing: border-box; width: 90mm; max-width: 100%; min-height: 50mm; padding: 3.5mm; border: 2px solid #654795; border-radius: 5mm; display: grid; grid-template-columns: minmax(0, 1fr) 28mm; gap: 2.5mm; background: #fffdf6; color: #34274a; font-family: 'Trebuchet MS', Arial, sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.book-label p { margin: 0 0 1.5mm; font-size: 8pt; line-height: 1.35; overflow-wrap: anywhere; }
.book-label h2 { font-family: ui-rounded, 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif; font-size: 13pt; font-weight: 800; line-height: 1.2; margin: 1mm 0 2mm; overflow-wrap: anywhere; }
.label-banner { grid-column: 1 / -1; display: flex; align-items: center; gap: 2mm; padding: 2mm; border-radius: 3mm; background: #eee5ff; border: 1px solid #d0bee9; }
.label-book { width: 12mm; height: 10mm; flex: none; }
.label-banner > div { flex: 1; min-width: 0; }
.book-label .label-brand { margin: 0; color: #4a326e; font-size: 10pt; font-weight: 800; line-height: 1.2; }
.book-label .label-motto { margin: 1mm 0 0; font-size: 7pt; }
.label-sparkles { align-self: flex-start; font-size: 20pt; line-height: 1; color: #896000; }
.label-sparkles small { display: block; font-size: 10pt; color: #b13a67; text-align: right; }
.label-code { align-self: center; background: #fff; border: 1px solid #d0bee9; border-radius: 3mm; padding: 0 0 1.5mm; }
.book-label .label-code p { margin: 0; text-align: center; font-size: 6.5pt; padding: 0 1mm; color: #4a326e; }
.label-qr { display: block; width: 28mm; height: 28mm; align-self: center; }
.book-label .label-reference { margin: 2mm 0; padding: 1mm 1.5mm; background: #fff0bd; border: 1px solid #c5a34e; border-radius: 2mm; font-size: 7.5pt; }
.label-footer { grid-column: 1 / -1; display: flex; gap: 1.5mm; align-items: center; border-top: 1px dashed #bca5d7; padding-top: 2mm; }
.label-footer > span { color: #b13a67; font-size: 15pt; line-height: 1; }
.label-link { min-width: 0; font-size: 6.5pt; line-height: 1.4; color: #4a326e; text-decoration: none; overflow-wrap: anywhere; }
@media print {
  @page { margin: 10mm; }
  .label-page main { margin: 0; padding: 0; max-width: none; }
  .label-controls { display: none !important; }
  .book-label { max-width: none; break-inside: avoid; }
}
