* { box-sizing: border-box; }

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-soft: #f8f9fc;
    --text: #17202a;
    --muted: #667085;
    --line: #e6e8ee;
    --primary: #155eef;
    --primary-dark: #0d47c7;
    --primary-soft: #edf4ff;
    --success: #157347;
    --danger: #a40000;
    --shadow: 0 12px 34px rgba(16, 24, 40, .07);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top right, #eef4ff 0, transparent 32%), var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1120px, calc(100% - 36px)); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 850; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 900; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-link { color: #475467; font-weight: 650; font-size: .94rem; }
.nav-link:hover { color: var(--text); text-decoration: none; }
.admin-link { color: var(--danger); }
.main-content { min-height: calc(100vh - 150px); }
.hero { padding: 92px 0 82px; max-width: 850px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); gap: 40px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 6px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { margin: 0 0 18px; font-size: clamp(2.35rem, 5vw, 4.55rem); line-height: 1.01; letter-spacing: -.055em; max-width: 800px; }
.hero p { max-width: 690px; color: var(--muted); font-size: 1.1rem; line-height: 1.75; }
.hero-panel { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.8); box-shadow: var(--shadow); }
.hero-panel .mini-title { font-weight: 800; margin-bottom: 16px; }
.mini-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: #475467; font-size: .93rem; }
.mini-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 900; flex: 0 0 auto; }
.actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; padding: 12px 18px; font: inherit; font-weight: 750; cursor: pointer; box-shadow: 0 5px 14px rgba(21,94,239,.16); }
.button:hover { text-decoration: none; background: var(--primary-dark); }
.button.secondary { background: #edf0f5; color: var(--text); box-shadow: none; }
.button.secondary:hover { background: #e2e6ed; }
.button.button-small { padding: 9px 14px; font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.narrow { width: min(540px, 100%); margin: 58px auto; }
form { display: grid; gap: 10px; }
label { margin-top: 8px; font-weight: 700; color: #344054; }
input, textarea, select { width: 100%; padding: 12px 13px; border: 1px solid #cfd4dc; border-radius: 10px; background: #fff; font: inherit; color: var(--text); }
textarea { min-height: 150px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(21,94,239,.14); border-color: var(--primary); }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-weight: 500; line-height: 1.5; }
.check-row input { width: auto; margin-top: 4px; }
.alert { border-radius: 10px; padding: 13px 15px; margin: 16px 0; border: 1px solid transparent; }
.alert.error { background: #fff1f1; color: var(--danger); border-color: #ffd5d5; }
.alert.success { background: #ecfdf3; color: var(--success); border-color: #b7ebcd; }
.form-footer { margin-bottom: 0; text-align: center; color: var(--muted); }
.page-head { padding: 48px 0 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.035em; }
.page-head p { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card h2 { margin: 0 0 10px; letter-spacing: -.02em; }
.card p { line-height: 1.65; }
.meta { color: var(--muted); font-size: .9rem; }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #fff7e6; color: #9a6700; font-size: .76rem; font-weight: 800; }
.checklist { padding-left: 20px; line-height: 2; color: #475467; }
.empty-state { text-align: center; padding: 44px 24px; background: var(--surface-soft); border: 1px dashed #cfd4dc; border-radius: 16px; }
.inline-form { display: inline; }
.link-button { border: 0; background: none; padding: 0; color: #475467; font: inherit; font-weight: 650; cursor: pointer; }
.link-button:hover { color: var(--text); }
.site-footer { margin-top: 80px; padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }
.footer-inner div { display: flex; gap: 12px; flex-wrap: wrap; }
.feature-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; padding-bottom: 70px; }
.feature { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.65); }
.feature-icon { font-size: 1.35rem; margin-bottom: 12px; }
.feature h3 { margin: 0 0 8px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.6; }
.actions-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.small { font-size: .86rem; }
.muted { color: var(--muted); }

@media (max-width: 800px) {
    .hero-grid, .grid.three, .feature-list { grid-template-columns: 1fr; }
    .hero { padding: 64px 0 58px; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .nav { min-height: auto; padding: 14px 0; align-items: flex-start; }
    .nav-links { flex-wrap: wrap; justify-content: flex-end; gap: 10px 14px; }
}
@media (max-width: 560px) {
    .container { width: min(100% - 24px, 1120px); }
    .hero h1 { font-size: 2.45rem; }
    .footer-inner { flex-direction: column; }
}

.eyebrow{display:inline-block;font-size:.78rem;text-transform:uppercase;letter-spacing:.08em;font-weight:800;color:#155eef;margin-bottom:8px}.hero{padding:42px;margin-bottom:28px}.hero h1{font-size:clamp(2rem,4vw,3.2rem);line-height:1.05;max-width:760px;margin:0 0 14px}.section-head,.page-head{display:flex;justify-content:space-between;align-items:end;gap:20px;margin:26px 0 18px}.badge{display:inline-block;border-radius:999px;padding:5px 10px;background:#eef4ff;color:#155eef;font-size:.78rem;font-weight:700}.empty-state{text-align:center;padding:48px 24px}.admin-card{border-color:#d9b6b6}

.reader-shell { margin: 28px 0 60px; }
.reader-toolbar { display:flex; justify-content:space-between; align-items:flex-end; gap:20px; margin-bottom:18px; flex-wrap:wrap; }
.reader-toolbar h1 { margin:6px 0 0; }
.reader-actions { display:flex; gap:10px; flex-wrap:wrap; }
.reader-status { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:12px 15px; color:#667085; margin-bottom:14px; }
.reader-page-wrap { display:flex; justify-content:center; align-items:flex-start; background:#e5e7eb; border:1px solid #d0d5dd; border-radius:14px; padding:18px; overflow:auto; }
.reader-canvas-stage { position:relative; display:inline-block; width:min(850px,100%); max-width:100%; background:#fff; box-shadow:0 2px 10px rgba(16,24,40,.12); user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; overflow:hidden; }
.reader-page { display:block; width:100%; height:auto; background:#fff; user-select:none; -webkit-user-select:none; pointer-events:none; }
.reader-watermark { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; transform:rotate(-28deg); font-size:18px; font-weight:700; letter-spacing:.04em; color:rgba(30,64,175,.14); text-align:center; pointer-events:none; user-select:none; -webkit-user-select:none; white-space:nowrap; }
@media print { .reader-shell { display:none !important; } body::after { content:"Este manuscrito é protegido e não está disponível para impressão."; display:block; margin:25vh auto; max-width:70%; text-align:center; font:700 18px/1.5 sans-serif; } }
.reader-agreement { margin-top:55px; }
@media (max-width:700px){ .reader-toolbar { align-items:flex-start; } .reader-actions { width:100%; } .reader-actions .button { flex:1; text-align:center; } .reader-page-wrap { padding:8px; } }

/* Administração */
.button.danger { background: #a40000; color: #fff; box-shadow: none; }
.button.danger:hover { background: #820000; }
.admin-stats .card h2 { font-size: 2.1rem; margin: 8px 0 14px; }
.admin-menu { margin-top: 20px; }
.actions-card { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; flex-wrap:wrap; }
.admin-inline-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.status-active { background:#ecfdf3; color:#157347; }
.status-inactive { background:#fff1f1; color:#a40000; }
.temporary-password { margin-bottom: 20px; border-color:#b7ebcd; background:#f6fff9; }
.temporary-password code { display:block; margin:12px 0; padding:14px; border-radius:10px; background:#101828; color:#fff; font:700 1.1rem ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.06em; }
.admin-create-book { margin-bottom: 20px; }

/* V7 — cartões de obras, categorias e sinopse */
.form-hint { margin: -4px 0 8px; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.books-grid { align-items: start; }
.book-card { min-width: 0; overflow: hidden; }
.book-card-top { display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; }
.book-card-title { margin: 16px 0 12px !important; line-height: 1.15; overflow-wrap:anywhere; word-break:break-word; }
.book-categories { display:flex; flex-wrap:wrap; gap:7px; min-width:0; margin: 0 0 18px; }
.category-chip { display:inline-flex; align-items:center; max-width:100%; padding:5px 10px; border-radius:999px; background:#eef4ff; color:#155eef; font-size:.78rem; font-weight:750; line-height:1.25; overflow-wrap:anywhere; }
.category-empty { color:var(--muted); font-size:.86rem; }
.book-synopsis { min-width:0; margin-bottom:18px; }
.book-synopsis-label { display:block; margin-bottom:6px; color:#344054; font-size:.78rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.book-synopsis p { margin:0; color:var(--muted); line-height:1.65; overflow-wrap:anywhere; word-break:break-word; }
.read-more { margin-top:7px; color:var(--primary); }
.modal[hidden] { display:none; }
.modal { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:20px; }
.modal-backdrop { position:absolute; inset:0; background:rgba(16,24,40,.55); backdrop-filter:blur(3px); }
.modal-dialog { position:relative; z-index:1; width:min(720px,100%); max-height:min(80vh,760px); overflow:auto; padding:30px; border:1px solid var(--line); border-radius:20px; background:#fff; box-shadow:0 24px 70px rgba(16,24,40,.22); }
.modal-dialog h2 { margin:0 0 18px; overflow-wrap:anywhere; word-break:break-word; }
.modal-body { color:#344054; line-height:1.8; white-space:normal; overflow-wrap:anywhere; word-break:break-word; }
.modal-close { position:absolute; top:12px; right:14px; width:38px; height:38px; border:0; border-radius:10px; background:#f2f4f7; color:#344054; font-size:1.6rem; line-height:1; cursor:pointer; }
.modal-close:hover { background:#e4e7ec; }
body.modal-open { overflow:hidden; }
@media (max-width:700px) {
    .book-card { padding:22px; }
    .modal-dialog { padding:24px 20px; max-height:88vh; }
}

/* V8 — cartões de obras: texto contido e modal de sinopse redesenhado */
.my-books-actions { display:flex; justify-content:flex-end; margin:0 0 20px; }
.books-grid { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
.book-card { min-width:0; width:100%; overflow:hidden; }
.book-card-top { min-width:0; display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.book-card-top .status, .book-card-top .meta { max-width:100%; }
.book-card-title { margin:16px 0 14px !important; max-width:100%; line-height:1.12; overflow-wrap:anywhere; word-break:break-word; hyphens:auto; }
.book-categories { display:flex; flex-wrap:wrap; align-items:flex-start; gap:8px; width:100%; max-width:100%; margin:0 0 20px; min-width:0; }
.category-chip { display:inline-flex; align-items:center; justify-content:flex-start; max-width:min(100%,280px); min-width:0; padding:6px 11px; border-radius:999px; background:#eef4ff; color:#155eef; font-size:.78rem; font-weight:750; line-height:1.3; overflow-wrap:anywhere; word-break:break-word; white-space:normal; }
.category-empty { color:var(--muted); font-size:.86rem; }
.book-synopsis { width:100%; max-width:100%; min-width:0; margin:0 0 20px; }
.book-synopsis-label { display:block; margin:0 0 7px; color:#344054; font-size:.78rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.book-synopsis-preview { width:100%; max-width:100%; margin:0 !important; color:var(--muted); line-height:1.65; overflow-wrap:anywhere; word-break:break-word; white-space:normal; }
.read-more-button { display:inline-flex; margin-top:9px; padding:0; border:0; background:none; color:var(--primary); font:inherit; font-weight:750; cursor:pointer; }
.read-more-button:hover { text-decoration:underline; }

.synopsis-modal[hidden] { display:none !important; }
.synopsis-modal { position:fixed !important; inset:0 !important; z-index:99999 !important; width:100vw !important; height:100vh !important; margin:0 !important; padding:24px !important; display:flex !important; align-items:center !important; justify-content:center !important; overflow:auto !important; }
.synopsis-modal-backdrop { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; background:rgba(15,23,42,.62) !important; backdrop-filter:blur(5px); }
.synopsis-modal-panel { position:relative !important; z-index:1 !important; width:min(760px,calc(100vw - 48px)) !important; max-height:min(78vh,720px) !important; overflow:auto !important; margin:0 !important; padding:34px 38px 38px !important; border:1px solid rgba(255,255,255,.65) !important; border-radius:24px !important; background:#fff !important; box-shadow:0 30px 90px rgba(15,23,42,.30) !important; }
.synopsis-modal-eyebrow { margin-bottom:12px !important; }
.synopsis-modal-panel h2 { margin:0 44px 20px 0 !important; font-size:clamp(1.65rem,3vw,2.2rem) !important; line-height:1.15 !important; overflow-wrap:anywhere; word-break:break-word; }
.synopsis-modal-content { color:#344054; font-size:1rem; line-height:1.85; overflow-wrap:anywhere; word-break:break-word; white-space:normal; }
.synopsis-modal-close { position:absolute !important; top:18px !important; right:18px !important; width:40px !important; height:40px !important; display:grid !important; place-items:center !important; border:1px solid #e4e7ec !important; border-radius:12px !important; background:#f8fafc !important; color:#344054 !important; font:500 1.45rem/1 system-ui,sans-serif !important; cursor:pointer !important; }
.synopsis-modal-close:hover { background:#eef2f6 !important; }
.synopsis-modal-close:focus-visible { outline:3px solid rgba(21,94,239,.2); border-color:var(--primary); }
body.synopsis-modal-open { overflow:hidden !important; }

@media (max-width:800px) {
    .books-grid { grid-template-columns:1fr; }
}
@media (max-width:560px) {
    .my-books-actions { justify-content:stretch; }
    .my-books-actions .button { width:100%; }
    .synopsis-modal { padding:12px !important; }
    .synopsis-modal-panel { width:100% !important; max-height:90vh !important; padding:28px 22px 26px !important; border-radius:20px !important; }
    .synopsis-modal-close { top:12px !important; right:12px !important; }
}

/* V10 — denúncias e gerenciamento de administradores do site */
body.modal-open { overflow: hidden; }
.report-trigger { border: 1px solid rgba(220, 38, 38, .18); }
.report-modal[hidden] { display: none !important; }
.report-modal { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 24px; }
.report-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .58); backdrop-filter: blur(5px); }
.report-dialog { position: relative; z-index: 1; width: min(560px, 100%); max-height: min(760px, calc(100vh - 48px)); overflow: auto; padding: 32px; border-radius: 22px; background: #fff; box-shadow: 0 24px 80px rgba(15, 23, 42, .25); }
.report-close { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f1f5f9; color: #334155; font-size: 25px; line-height: 1; cursor: pointer; }
.report-close:hover { background: #e2e8f0; }
.report-dialog h2 { margin: 10px 42px 8px 0; }
.report-form { display: grid; gap: 16px; margin-top: 22px; }
.report-form label, .admin-role-form label { display: grid; gap: 7px; font-weight: 700; }
.report-form select, .report-form textarea, .admin-role-form select { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 12px; padding: 12px 14px; font: inherit; background: #fff; }
.report-form textarea { resize: vertical; min-height: 130px; }
.admin-role-form { display: grid; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
@media (max-width: 700px) { .report-dialog { padding: 24px 20px; } }
