
        body{ font-family:Arial; background:#f0f0f0; padding:30px; }
        .box{ background:#fff; padding:30px; border-radius:15px; max-width:700px; margin:auto; }
        input[type="text"], textarea { 
            width:100%; padding:15px; margin-top:10px; margin-bottom:20px; 
            box-sizing: border-box; text-transform: uppercase; 
        }
        input[type="file"] {
            display: block;
            width: 100%;
            margin-top: 10px;
            margin-bottom: 25px;
        }
        label { font-weight: bold; display: block; margin-top: 10px; }
        button{ width:100%; padding:18px; border:none; background:#000; color:#fff; font-size:18px; cursor:pointer; margin-top: 10px; }
        img{ width:200px; margin-top:10px; border-radius:10px; display: none; margin-bottom: 20px; }
        
        .menu-container { position: fixed; top: 20px; right: 20px; z-index: 1000; }
        .menu-icon { background: transparent !important; color: var(--livros-bege, #cbbda4) !important; width: 45px; height: 45px; border-radius: 0 !important; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 24px; }
        .menu-content { display: none; position: absolute; top: 55px; right: 0; background: #fff; min-width: 220px; box-shadow: 0 8px 16px rgba(0,0,0,0.2); border-radius: 10px; overflow: hidden; }
        .menu-content a { color: #333; padding: 15px 20px; text-decoration: none; display: block; font-size: 14px; font-weight: bold; border-bottom: 1px solid #eee; }
        .menu-content a:hover { background: #f4f4f4; }
        .show { display: block !important; }
        .edit-panel { margin: 0 0 25px; padding: 18px; border: 1px solid #ddd; border-radius: 10px; background: #fafafa; }
        .edit-panel select { width: 100%; padding: 12px; margin-top: 10px; box-sizing: border-box; }
        .secondary { background: #555; }
        .danger { background: #b42318; }
        .help { color: #555; font-size: 13px; line-height: 1.4; }
    

        body { margin: 0; background: #efefef; font-family: Arial; }
        header { background: #000; color: #fff; padding: 15px 5%; display: flex; justify-content: space-between; align-items: center; }
        .logo { font-size: 24px; font-weight: bold; text-decoration: none; color: #fff; }
        .toolbar { width: 90%; max-width: 1100px; margin: 20px auto; display: flex; align-items: center; gap: 14px; }
        .search-container { flex: 1 1 auto; min-width: 220px; }
        #searchInput { width: 100%; padding: 15px; border-radius: 25px; border: 1px solid #ccc; font-size: 16px; outline: none; box-sizing: border-box; text-transform: uppercase; }
        
        .container { width: 90%; margin: 20px auto; }
        
        /* ALTERAÇÃO: Miniaturas menores (de 250px para 180px) */
        .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
        
        .card { background: #fff; border-radius: 12px; overflow: hidden; cursor: pointer; transition: 0.3s; text-transform: uppercase; display: flex; flex-direction: column; }
        
        /* ALTERAÇÃO: Altura da imagem menor (de 350px para 250px) */
        .card img { width: 100%; height: 250px; object-fit: cover; }
        
        .content { padding: 12px; flex-grow: 1; }
        .title { font-size: 14px; font-weight: bold; line-height: 1.2; margin-bottom: 5px; }
        .author-text { color: #666; font-size: 12px; margin-bottom: 5px; }
        small { color: #888; font-size: 11px; }

        /* Estilo das etiquetas de formato no card */
        .format-badge { 
            display: inline-block; 
            margin-top: 8px; 
            font-size: 10px; 
            font-weight: bold; 
            padding: 2px 6px; 
            border-radius: 4px; 
            background: #eee; 
            color: #333;
        }

        .organization { flex: 0 0 auto; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
        .organization label { font-weight: bold; }
        .organization select { padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 14px; background: #fff; }
        .sections-list { display: block; }
        .sections-list .book-section { display: block; width: 100%; margin: 0 0 30px; }
        .book-section { margin: 0 0 30px; }
        .section-title { font-size: 20px; border-bottom: 2px solid #222; padding-bottom: 8px; margin: 0 0 15px; }
        .modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: none; justify-content: center; align-items: center; z-index: 1000; padding: 16px; box-sizing: border-box; overflow-y: auto; }
        .modal-box { background: #fff; width: 95%; max-width: 800px; max-height: calc(100vh - 32px); border-radius: 20px; overflow-y: auto; display: flex; flex-wrap: wrap; position: relative; margin: auto; }
        .close-modal { position: sticky; top: 0; margin-left: auto; margin-bottom: -42px; z-index: 2; height: 32px; font-size: 30px; cursor: pointer; font-weight: bold; line-height: 32px; padding: 4px 16px; }
        .left, .right { flex: 1; min-width: 280px; }
        .left img { width: 100%; max-height: 70vh; object-fit: contain; display: block; }
        .right { padding: 30px; box-sizing: border-box; overflow-wrap: anywhere; }
        @media (max-width: 700px) {
            .toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
            .search-container { min-width: 0; }
            .organization { width: 100%; }
            .organization select { flex: 1; min-width: 0; }
        }
        @media (max-width: 600px) {
            .modal { align-items: flex-start; padding: 10px; }
            .modal-box { width: 100%; max-height: calc(100vh - 20px); border-radius: 12px; }
            .left, .right { min-width: 100%; flex-basis: 100%; }
            .left img { max-height: 35vh; }
            .right { padding: 18px; }
            .close-modal { position: sticky; }
        }
        #modalTitle, #modalAuthor { text-transform: uppercase; }
        .btn { display: inline-block; padding: 12px 20px; color: #fff; text-decoration: none; border-radius: 10px; margin-top: 10px; margin-right: 10px; font-weight: bold; }
        .pdf { background: #e74c3c; }
        .epub { background: #3498db; }
    
.status-message { font-weight: bold; margin-top: 15px; }
.modal-author { color: #555; font-weight: bold; }
.account-container { position: relative; display: inline-block; z-index: 1100; }
.account-button { width: auto; padding: 10px 14px; margin: 0; border: 1px solid #555; border-radius: 8px; background: #fff; color: #111; font-size: 13px; font-weight: bold; cursor: pointer; }
.account-menu { display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; background: #fff; box-shadow: 0 8px 16px rgba(0,0,0,.2); border-radius: 8px; overflow: hidden; }
.account-menu.show { display: block !important; }
.account-menu button { display: block; width: 100%; margin: 0; padding: 12px; background: #fff; color: #222; font-size: 13px; text-align: left; }
.account-menu button:hover { background: #eee; }
header .account-button { background: #fff; color: #111; }
.login-page { min-height: 100vh; margin: 0; padding: 25px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; background: #efefef; font-family: Arial, sans-serif; }
.login-card { width: 100%; max-width: 430px; padding: 30px; box-sizing: border-box; border-radius: 15px; background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.1); }
.login-card h1 { margin-top: 0; text-align: center; }
.login-card label { display: block; margin: 14px 0 6px; font-weight: bold; }
.login-card input { width: 100%; padding: 13px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 6px; text-transform: none; }
.login-card input.username-input { text-transform: uppercase; }
.login-card button { width: 100%; padding: 14px; margin-top: 16px; border: 0; border-radius: 6px; background: #000; color: #fff; font-weight: bold; cursor: pointer; }
.login-card .secondary-login { background: #555; }
.login-message { min-height: 20px; margin-top: 14px; font-size: 14px; line-height: 1.4; }
.login-links { margin-top: 15px; text-align: center; }
.login-links a { color: #222; cursor: pointer; }
@media (max-width: 600px) { body { padding: 15px; } .account-container { margin-right: 4px; } }


/* PALETA ESCURA: CINZA-ESCURO, CINZA, BRANCO E BEGE — TODAS AS PÁGINAS */
:root {
  --livros-fundo: #242424;
  --livros-painel: #303030;
  --livros-cartao: #383838;
  --livros-campo: #454545;
  --livros-cinza: #777777;
  --livros-branco: #f5f5f3;
  --livros-bege: #cbbda4;
  --livros-bege-claro: #e0d6c4;
  --livros-borda: #55524c;
  --livros-texto: #f2f0eb;
  --livros-texto-secundario: #c7c4bd;
}
html, body { background: var(--livros-fundo) !important; color: var(--livros-texto) !important; }
body { font-family: Arial, sans-serif; }
header { background: #1c1c1c !important; color: var(--livros-branco) !important; border-bottom: 1px solid #414141; }
.logo { color: var(--livros-branco) !important; }
.box, .login-card, .card, .modal-box, .edit-panel, .info, .menu-content,
.account-menu, .toolbar, .container, .organization, .sections-list,
#upload-container, #reader-container, .area, .label, .book-section {
  color: var(--livros-texto) !important;
}
.box, .login-card, .modal-box, .edit-panel, .menu-content, .account-menu, .info,
.card, .book-section { background-color: var(--livros-painel) !important; border-color: var(--livros-borda) !important; }
input:not([type="file"]), textarea, select, .organization select, .login-card input, #searchInput {
  background-color: var(--livros-campo) !important; border-color: #68645c !important; color: var(--livros-branco) !important;
}
input::placeholder, textarea::placeholder, #searchInput::placeholder { color: #d0ccc3 !important; opacity: .8; }
button, .btn, .upload-btn, #saveButton, .login-card button, .menu-icon, .secondary, .danger, .nav-btn {
  background-color: var(--livros-bege) !important; border-color: #b9a98c !important; color: #25231f !important;
}
button:hover, .btn:hover, .upload-btn:hover, .menu-content a:hover, .account-menu button:hover, .nav-btn:hover { background-color: var(--livros-bege-claro) !important; }
.menu-content, .account-menu { background: var(--livros-painel) !important; }
.menu-content a, .account-menu button, .login-links a { color: var(--livros-texto) !important; background: var(--livros-painel) !important; }
.menu-content a { border-bottom-color: var(--livros-borda) !important; }
.format-badge { background: #4a463f !important; color: var(--livros-bege-claro) !important; }
.section-title { border-bottom-color: var(--livros-bege) !important; color: var(--livros-branco) !important; }
.modal { background: rgba(0,0,0,.82) !important; }
#viewer { background: #2c2c2c !important; color: var(--livros-texto) !important; }
.controls { background: #1c1c1c !important; color: var(--livros-branco) !important; }
.controls .nav-btn { background: var(--livros-bege) !important; color: #25231f !important; }
.login-page { background: var(--livros-fundo) !important; }
.login-card h1 { color: var(--livros-bege-claro) !important; }
.status-message, .help, .author-text, small, .modal-author { color: var(--livros-texto-secundario) !important; }
.card .content { background: var(--livros-cartao) !important; }
.card .title { color: var(--livros-branco) !important; }
.card img { display: block !important; width: 100%; height: 250px; object-fit: contain !important; background: #292929; margin: 0; border-radius: 0; }
.left img { display: block !important; background: #292929; }
.close-modal { color: var(--livros-branco) !important; }





.login-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#forgotPassword[hidden] {
    display: none !important;
}




/* No index, usuário à direita, imediatamente antes do menu hambúrguer */
body:has(.menu-container) > .account-container {
  position: fixed !important; top: 20px !important; right: 76px !important; z-index: 1001 !important; margin: 0 !important;
}
body:has(.menu-container) > .account-container .account-button {
  max-width: min(42vw, 220px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--livros-bege) !important; color: #25231f !important; border-color: #b9a98c !important;
}
body:has(.menu-container) .menu-icon { background: transparent !important; color: var(--livros-bege) !important; border-radius: 0 !important; }
@media (max-width: 600px) {
  body:has(.menu-container) > .account-container { top: 20px !important; right: 70px !important; }
  body:has(.menu-container) > .account-container .account-button { padding: 9px 10px !important; font-size: 11px !important; }
}

/* DESIGN MODERNO DO FORMULÁRIO DE CADASTRO — somente estilos */
.box {
  max-width: 900px !important;
  margin: 72px auto 30px !important;
  padding: clamp(18px, 3vw, 34px) !important;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0 12px;
  border: 1px solid #49463f;
  border-radius: 22px !important;
  box-shadow: 0 14px 38px rgba(0,0,0,.24);
}
.box > h1 { grid-column: 1 / -1; grid-row: 1; margin: 0 0 22px; color: var(--livros-bege-claro); letter-spacing: .4px; }
.box > .edit-panel { grid-column: 1 / -1; grid-row: 2; margin-bottom: 22px; padding: 18px; border-radius: 16px !important; background: #333 !important; }
.box > label, .box > input, .box > textarea, .box > #preview, .box > #saveButton, .box > .status-message { min-width: 0; }
.box > label { align-self: end; margin: 12px 0 7px; color: var(--livros-bege-claro); font-size: 12px; letter-spacing: .55px; }
.box > input:not([type="file"]), .box > textarea {
  width: 100%; min-width: 0; padding: 13px 14px; margin: 0 0 10px;
  border: 1px solid #5e5a52; border-radius: 12px; box-sizing: border-box;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.box > input:not([type="file"]):focus, .box > textarea:focus, .box > select:focus {
  outline: none; border-color: var(--livros-bege) !important; box-shadow: 0 0 0 3px rgba(203,189,164,.15);
}
/* Quatro campos principais organizados em duas colunas, com cada título sobre seu campo. */
.box > label:nth-of-type(1) { grid-column: 1 / span 3; grid-row: 3; }
#title { grid-column: 1 / span 3; grid-row: 4; }
.box > label:nth-of-type(2) { grid-column: 4 / span 3; grid-row: 3; }
#author { grid-column: 4 / span 3; grid-row: 4; }
.box > label:nth-of-type(3) { grid-column: 1 / span 3; grid-row: 5; }
#category { grid-column: 1 / span 3; grid-row: 6; width: 100%; box-sizing: border-box; }
#categoryOptions { display: none; }
.box > label:nth-of-type(4) { grid-column: 4 / span 3; grid-row: 5; }
#visibilidade { grid-column: 4 / span 3; grid-row: 6; width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 13px 14px; }
.box > label:nth-of-type(5) { grid-column: 1 / -1; grid-row: 7; }
#description { grid-column: 1 / -1; grid-row: 8; min-height: 110px; resize: vertical; }
/* Capa, PDF e EPUB alinhados na mesma linha, cada um em um terço. */
.box > label:nth-of-type(6) { grid-column: 1 / span 2; grid-row: 9; }
#cover { grid-column: 1 / span 2; grid-row: 10; }
#preview { grid-column: 1 / span 2; grid-row: 11; width: min(100%, 150px) !important; max-height: 170px; object-fit: contain; justify-self: start; }
.box > label:nth-of-type(7) { grid-column: 3 / span 2; grid-row: 9; }
#pdf { grid-column: 3 / span 2; grid-row: 10; }
.box > label:nth-of-type(8) { grid-column: 5 / span 2; grid-row: 9; }
#epub { grid-column: 5 / span 2; grid-row: 10; }
.box > input[type="file"] { width: 100%; min-width: 0; padding: 10px 8px; margin: 0 0 14px; border: 1px dashed #68645c; border-radius: 12px; box-sizing: border-box; color: var(--livros-texto-secundario); font-size: 12px; }
#saveButton { grid-column: 1 / -1; grid-row: 12; width: 100%; margin-top: 14px; padding: 15px 18px; border-radius: 13px; font-size: 15px; font-weight: 800; letter-spacing: .4px; }
.box > .status-message { grid-column: 1 / -1; grid-row: 13; margin-bottom: 0; }

/* Botões de edição menores e alinhados à direita. */
.edit-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.edit-panel > label, .edit-panel > select, .edit-panel > .help { flex: 0 0 100%; }
.edit-panel > button { width: auto; margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 11px; line-height: 1.2; }
.edit-panel > button.secondary { margin-left: auto; }
.edit-panel > button#deleteButton { width: 34px; min-width: 34px; height: 34px; padding: 0; flex: 0 0 34px; font-size: 0 !important; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.edit-panel > button#deleteButton::before { content: ""; display: block; width: 17px; height: 17px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2m-11 0 1 14h12l1-14M10 11v5m4-5v5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2m-11 0 1 14h12l1-14M10 11v5m4-5v5'/%3E%3C/svg%3E") center / contain no-repeat; }
.edit-panel > button#deleteButton:disabled { opacity: .42; cursor: not-allowed; }
button, .btn, input, textarea, select, .menu-content, .account-menu, .login-card, .card, .modal-box, .edit-panel { border-radius: 12px; }
button { transition: transform .15s ease, filter .15s ease, background-color .15s ease; }
button:not(:disabled):hover { filter: brightness(1.07); }
button:not(:disabled):active { transform: translateY(1px); }

@media (max-width: 620px) {
  .box { margin: 72px 12px 20px !important; padding: 18px !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
  .box > h1, .box > .edit-panel, .box > label:nth-of-type(5), #description, #saveButton, .box > .status-message { grid-column: 1 / -1; }
  .box > label:nth-of-type(1), #title, .box > label:nth-of-type(3), #category { grid-column: 1; }
  .box > label:nth-of-type(2), #author, .box > label:nth-of-type(4), #visibilidade { grid-column: 2; }
  .box > label:nth-of-type(6), #cover, .box > label:nth-of-type(7), #pdfFileRow, .box > label:nth-of-type(8), #epubFileRow { grid-column: 1 / -1; }
  .box > label:nth-of-type(6), .box > label:nth-of-type(7), .box > label:nth-of-type(8), #cover, #preview, #pdf, #epub, #pdfFileRow, #epubFileRow { grid-row: auto; }
  #preview { grid-column: 1 / -1; }
  #saveButton { grid-row: auto; }
  .edit-panel { padding: 13px !important; }
  .edit-panel > button.secondary { margin-left: auto; max-width: calc(100% - 45px); }
}

/* Modal de recuperação de senha */
.recovery-overlay { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 18px; box-sizing: border-box; background: rgba(0,0,0,.72); }
.recovery-overlay[hidden], #recoveryStepRequest[hidden], #recoveryStepReset[hidden] { display: none !important; }
.recovery-card { position: relative; width: 100%; max-width: 430px; max-height: calc(100vh - 36px); overflow-y: auto; box-sizing: border-box; padding: 28px; border-radius: 14px; background: #303030; color: #fff; box-shadow: 0 10px 36px rgba(0,0,0,.28);}
.recovery-card h2 { margin: 0 30px 18px 0; font-size: 21px; }
.recovery-card label { display: block; margin: 14px 0 6px; font-weight: bold; }
.recovery-card input { display: block; width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid #d6c6a5; border-radius: 7px; background: #f5ecd9; color: #222; text-transform: none;}
.recovery-card button:not(.recovery-close) { width: 100%; padding: 13px; margin-top: 16px; border: 0; border-radius: 7px; background: #111; color: #fff; font-weight: bold; cursor: pointer; }
.recovery-card button:disabled { opacity: .6; cursor: wait; }

.recovery-card .recovery-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 24px !important;
  min-width: 24px;
  max-width: 24px;
  height: 24px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #222;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  flex: 0 0 24px;
}
.recovery-card .help { color: #555; font-size: 13px; line-height: 1.4; }

/* Painel de edição reposicionado no final da página do gerenciador */
.edit-panel-final { max-width: 900px; margin: 28px auto 30px !important; padding: 18px !important; box-sizing: border-box; }


/* Cabeçalho unificado das páginas principais */
body { padding: 0 !important; }
.site-header { width: 100%; min-height: 74px; box-sizing: border-box; padding: 12px 24px 12px 5%; margin: 0 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #1c1c1c; color: var(--livros-texto, #f2f0eb); border-bottom: 1px solid #414141; }
.page-title { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 23px; line-height: 1.2; font-weight: 700; letter-spacing: .3px; }
.page-title svg { width: 25px; height: 25px; flex: 0 0 25px; fill: none; stroke: var(--livros-bege, #cbbda4); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 18px; flex: 0 0 auto; }
.site-header .account-container, .site-header .menu-container { position: relative !important; inset: auto !important; z-index: 1100; display: block; margin: 0 !important; }
.site-header .account-button { max-width: min(35vw, 220px); padding: 10px 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--livros-bege, #cbbda4) !important; color: #25231f !important; border-color: #b9a98c !important; }
.site-header .menu-icon { width: 28px; height: 30px; padding: 3px 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 0 !important; background: transparent !important; color: var(--livros-bege, #cbbda4) !important; cursor: pointer; }
.site-header .menu-icon span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 0; }
.site-header .menu-content { top: calc(100% + 12px); right: 0; z-index: 1200; }
.site-header .account-menu { top: calc(100% + 6px); right: 0; z-index: 1201; }
@media (max-width: 600px) { .site-header { min-height: 64px; padding: 10px 14px; gap: 10px; } .page-title { font-size: 17px; gap: 7px; } .page-title svg { width: 21px; height: 21px; flex-basis: 21px; } .header-actions { gap: 12px; } .site-header .account-button { padding: 8px 9px !important; font-size: 11px !important; } }
