:root {
    --kb-primary: #0f3d57;
    --kb-primary-dark: #0a2c3f;
    --kb-primary-light: #185478;
    --kb-accent: #d99a2b;
    --kb-accent-dark: #b87f1c;
    --kb-bg: #f6f8fa;
    --kb-bg-alt: #eef3f6;
    --kb-text: #1c2733;
    --kb-text-muted: #6b7580;
    --kb-border: #e0e5e9;
    --kb-radius: 10px;
    --kb-shadow: 0 2px 10px rgba(15, 61, 87, .08);
    --kb-shadow-hover: 0 8px 24px rgba(15, 61, 87, .14);
    --kb-font-heading: 'Poppins', 'Segoe UI', Arial, sans-serif;
    --kb-font-body: 'Inter', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
    margin: 0;
    font-family: var(--kb-font-body);
    background: var(--kb-bg);
    color: var(--kb-text);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .kb-brand {
    font-family: var(--kb-font-heading);
    font-weight: 600;
    line-height: 1.25;
    color: var(--kb-primary-dark);
}

.kb-main > h1:first-child, .kb-main > h1:first-child + p {
    text-align: left;
}
.kb-main > h1:first-child { font-size: 2rem; margin-bottom: .4rem; }
.kb-main > p:first-of-type { color: var(--kb-text-muted); font-size: 1.02rem; }

a { color: var(--kb-primary); }

/* ---------------------------------------------------------------- header */

.kb-header {
    background: var(--kb-primary);
    color: #fff;
    padding: .9rem 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
}

.kb-header a { color: #fff; text-decoration: none; }
.kb-header .kb-brand { font-size: 1.3rem; font-weight: 700; letter-spacing: .3px; }

.kb-header nav { display: flex; flex-wrap: wrap; gap: .6rem 1.35rem; align-items: center; }
.kb-header nav a { opacity: .88; font-size: .92rem; font-weight: 500; transition: opacity .15s ease; }
.kb-header nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

.kb-brand-logo { max-height: 42px; max-width: 180px; object-fit: contain; display: block; vertical-align: middle; }

/* ---------------------------------------------------------------- layout */

.kb-main { max-width: 1080px; margin: 0 auto; padding: 2.75rem 1.5rem; }
.kb-main-full { max-width: none; padding: 0; margin: 0; }
.kb-main-full > .kb-band:first-child { padding-top: 3rem; }

.kb-band { padding: 3.5rem 1.5rem; }
.kb-band-alt { background: var(--kb-bg-alt); }
.kb-band-primary { background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%); color: #fff; }
.kb-band-inner { max-width: 1080px; margin: 0 auto; }
.kb-band h2 { margin-top: 0; }
.kb-band-primary h2, .kb-band-primary p { color: #fff; }

.kb-eyebrow {
    display: inline-block;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--kb-accent-dark);
    margin-bottom: .5rem;
}
.kb-band-primary .kb-eyebrow { color: #f0c988; }

.kb-section-heading { font-size: 1.7rem; margin: 0 0 .5rem; }
.kb-section-lead { color: var(--kb-text-muted); max-width: 640px; margin: 0 0 2rem; font-size: 1rem; }
.kb-band-primary .kb-section-lead { color: rgba(255,255,255,.85); }

.kb-icon-circle {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 50%;
    background: var(--kb-bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: .9rem;
}

/* ----------------------------------------------------------------- cards */

.kb-card {
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
    padding: 1.85rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--kb-shadow);
}

.kb-status { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: #1f7a3d; }
.kb-status::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: #1f7a3d; display: inline-block; }

/* --------------------------------------------------------------- buttons */

.kb-btn {
    display: inline-block;
    background: var(--kb-accent);
    color: #23180a;
    padding: .7rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: .92rem;
    letter-spacing: .01em;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(217, 154, 43, .3);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.kb-btn:hover { background: var(--kb-accent-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(217, 154, 43, .4); }

.kb-btn-full { width: 100%; text-align: center; border: none; }
.kb-btn-secondary {
    background: transparent;
    color: var(--kb-primary);
    border: 1.5px solid var(--kb-primary);
    box-shadow: none;
}
.kb-btn-secondary:hover { background: var(--kb-primary); color: #fff; box-shadow: 0 4px 12px rgba(15, 61, 87, .25); }
.kb-band-primary .kb-btn-secondary { color: #fff; border-color: #fff; }
.kb-band-primary .kb-btn-secondary:hover { background: #fff; color: var(--kb-primary); }
.kb-btn + .kb-btn { margin-left: .5rem; }
.kb-btn-sm { padding: .45rem 1rem; font-size: .84rem; }

/* ------------------------------------------------------------------ nav pills / badges */

.kb-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    background: #e7edf5;
    color: #294a72;
    margin-bottom: .35rem;
}

.kb-filter-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.kb-filter-pills a {
    display: inline-block;
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--kb-border);
    background: #fff;
    color: var(--kb-text);
    text-decoration: none;
    font-size: .85rem;
    transition: all .15s ease;
}
.kb-filter-pills a.is-active { background: var(--kb-primary); border-color: var(--kb-primary); color: #fff; }
.kb-filter-pills a:hover:not(.is-active) { border-color: var(--kb-primary); color: var(--kb-primary); }

/* ------------------------------------------------------------------ grid / content cards */

.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    /* Explicito (e nao so o omisso do grid): garante que, numa mesma linha,
       um cartao com pouco texto (ex: um membro da equipa sem bio longa) fica
       sempre com a mesma altura dos vizinhos, em vez de encolher ao seu
       proprio conteudo - e o cabecalho (foto/nome/cargo) de todos fica
       alinhado ao topo, mesmo quando a quantidade de texto varia. */
    align-items: stretch;
}

/* O cartao tanto pode ser <div> como <a> (listagens que abrem a pagina de
   detalhe). Sem isto o sublinhado do link atravessa todo o texto do cartao:
   nao chega por text-decoration nos filhos, porque a linha e desenhada pelo
   <a> antepassado. */
.kb-formacao-card {
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--kb-shadow);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.kb-formacao-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--kb-shadow-hover);
    border-color: var(--kb-primary);
}

.kb-formacao-card img {
    width: 100%; height: 160px; object-fit: contain; background: var(--kb-bg-alt);
    transition: transform .4s ease;
}
.kb-formacao-card:hover img { transform: scale(1.07); }
.kb-formacao-card .kb-formacao-img-placeholder {
    width: 100%; height: 160px; background: var(--kb-bg-alt);
}

.kb-formacao-card-body { padding: 1.2rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.kb-formacao-card-body h3 { margin: 0; font-size: 1.05rem; transition: color .22s ease; }
.kb-formacao-card:hover .kb-formacao-card-body h3 { color: var(--kb-primary); }
/* :not(.kb-formacao-meta) e essencial aqui: o cargo/categoria (".kb-formacao-meta",
   quando e um <p>) e sempre uma legenda curta de uma linha e nao pode ganhar
   "flex: 1" - se ganhasse, disputava o espaco extra do cartao em pe de igualdade
   com o paragrafo principal (bio/resumo/descricao) e ficava com uma caixa
   gigante e quase vazia (uma legenda de uma linha esticada a >2000px de
   altura), empurrando o texto principal para muito mais abaixo do que devia. */
.kb-formacao-card-body p:not(.kb-formacao-meta) { margin: 0; font-size: .9rem; color: var(--kb-text-muted); flex: 1; }
.kb-formacao-meta { font-size: .8rem; color: var(--kb-text-muted); margin: 0; flex: 0 0 auto; }

/* O corpo do cartao e uma coluna flex, por isso um <span> de etiqueta esticava
   ate a largura toda apesar do "inline-block". Encostado ao inicio, volta a
   ter o tamanho do proprio texto. */
.kb-formacao-card-body .kb-badge { align-self: flex-start; }

/* ---- Vagas de emprego ---- */

.kb-badge-vaga-tipo { background: #e2f0e8; color: #1e6b41; }
.kb-badge-vaga-fim { background: #f0e3e1; color: #8c352c; }

/* Vaga fora do prazo: continua visivel (serve de referencia) mas deixa de
   competir visualmente com as que ainda aceitam candidaturas. */
.kb-formacao-card.is-expirada { opacity: .72; }
.kb-formacao-card.is-expirada:hover { opacity: 1; }
.kb-formacao-card.is-expirada img { filter: grayscale(1); }
.kb-formacao-card.is-expirada:hover img { filter: none; }

.kb-aviso-prazo {
    background: #f0e3e1;
    color: #8c352c;
    border-radius: 8px;
    padding: .6rem .9rem;
    font-size: .88rem;
    font-weight: 600;
    margin: .75rem 0 0;
}

.kb-formacao-header { display: flex; gap: 1.75rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1.5rem; }
.kb-formacao-header img {
    width: 280px; max-width: 100%; height: 210px; border-radius: var(--kb-radius);
    object-fit: contain; background: var(--kb-bg-alt); border: 1px solid var(--kb-border);
    cursor: zoom-in;
}
.kb-formacao-header-info { flex: 1; min-width: 240px; }

.kb-formacao-meta-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; font-size: .9rem; }
.kb-formacao-meta-list li strong { display: inline-block; min-width: 110px; color: var(--kb-primary); }

.kb-empty-state { color: var(--kb-text-muted); padding: 2rem 0; text-align: center; }

/* ------------------------------------------------------------- "Quem Somos" */

.kb-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .kb-grid-2 { grid-template-columns: 1fr; } }

.kb-section-title { margin: 2.25rem 0 1.25rem; }

.kb-lista-check { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.kb-lista-check li {
    position: relative;
    padding-left: 1.75rem;
    color: var(--kb-text-muted);
}
/* ---- Botao flutuante de WhatsApp ---- */

.kb-whatsapp-flutuante {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .8rem 1.1rem;
    border-radius: 999px;
    background: #25d366;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(37, 211, 102, .45);
    transition: transform .2s ease, box-shadow .2s ease;
}
.kb-whatsapp-flutuante svg { width: 1.4rem; height: 1.4rem; flex: 0 0 auto; }
.kb-whatsapp-flutuante:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(37, 211, 102, .55);
    color: #fff;
}

/* Em ecras pequenos fica so o icone redondo, para nao tapar o conteudo. */
@media (max-width: 560px) {
    .kb-whatsapp-flutuante { padding: .85rem; }
    .kb-whatsapp-flutuante span { display: none; }
}

/* ---- Equipa: cartao com resumo + janela com o perfil completo ---- */

.kb-membro.is-clicavel { cursor: pointer; }
.kb-membro.is-clicavel:focus-visible { outline: 3px solid var(--kb-primary); outline-offset: 3px; }

.kb-membro-link {
    font-size: .82rem;
    font-weight: 600;
    color: var(--kb-primary);
    margin-top: .25rem;
    transition: gap .2s ease;
}
.kb-membro.is-clicavel:hover .kb-membro-link { text-decoration: underline; }
a.kb-formacao-card:hover .kb-membro-link { text-decoration: underline; }
/* Encosta sempre o "Ver detalhes" ao fundo do cartao, mesmo quando nao ha
   resumo nenhum acima dele (ai nao existe o <p> com "flex: 1" a empurrar). */
.kb-formacao-card-body .kb-membro-link { margin-top: auto; padding-top: .25rem; }

.kb-membro-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10, 25, 40, .72);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: kb-fade-in .18s ease;
}

@keyframes kb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes kb-slide-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.kb-membro-modal {
    position: relative;
    background: #fff;
    border-radius: 14px;
    max-width: 640px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(10, 25, 40, .35);
    animation: kb-slide-up .22s ease;
}

.kb-membro-modal-foto {
    width: 100%;
    height: 260px;
    object-fit: contain;
    background: var(--kb-bg-alt);
    border-radius: 14px 14px 0 0;
    display: block;
}

.kb-membro-modal-texto { padding: 1.75rem; }
.kb-membro-modal-texto h3 { margin: 0 0 .3rem; font-size: 1.25rem; }
.kb-membro-modal-cargo {
    margin: 0 0 1rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--kb-primary);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.kb-membro-modal-texto p { margin: 0; color: var(--kb-text-muted); line-height: 1.7; }

.kb-membro-fechar {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .92);
    color: var(--kb-primary-dark);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(10, 25, 40, .25);
    transition: background .18s ease, transform .18s ease;
}
.kb-membro-fechar:hover { background: #fff; transform: scale(1.08); }

@media (max-width: 560px) {
    .kb-membro-modal-foto { height: 200px; }
    .kb-membro-modal-texto { padding: 1.25rem; }
}

.kb-lista-check li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .3rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: var(--kb-primary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center/70% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E") center/70% no-repeat;
}

/* ------------------------------------------ fundo de pagina (legibilidade)

   Com uma imagem de fundo, o texto solto (titulos, paragrafos) podia ficar
   ilegivel consoante a imagem. Uma folha translucida clara por tras do
   conteudo garante contraste com qualquer imagem - clara ou escura - sem
   esconder o fundo, que continua visivel a toda a volta.                     */

.kb-page-bg .kb-main {
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(3px);
    border-radius: 14px;
    margin-top: 1.75rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 10px 40px rgba(10, 25, 40, .18);
}
.kb-page-bg .kb-main-full {
    background: transparent;
    backdrop-filter: none;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
}
/* Na página inicial (full-width) sao as proprias secoes que ganham a folha. */
.kb-page-bg .kb-main-full .kb-band { background: rgba(255, 255, 255, .9); backdrop-filter: blur(3px); }
.kb-page-bg .kb-main-full .kb-band-alt { background: rgba(238, 243, 246, .92); }
.kb-page-bg .kb-main-full .kb-band-primary { background: linear-gradient(135deg, rgba(15, 61, 87, .94), rgba(10, 44, 63, .94)); }

/* -------------------------------------------------------- partilhar */

.kb-share { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: 1.25rem; }
.kb-share-label { font-size: .82rem; font-weight: 600; color: var(--kb-text-muted); margin-right: .15rem; }
.kb-share-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--kb-bg-alt);
    color: var(--kb-primary);
    border: 1px solid var(--kb-border);
    cursor: pointer;
    padding: 0;
    transition: transform .12s ease, background .12s ease, color .12s ease;
}
.kb-share-btn svg { width: 1.05rem; height: 1.05rem; }
.kb-share-btn:hover { transform: translateY(-2px); color: #fff; }
.kb-share-wa:hover { background: #25d366; border-color: #25d366; }
.kb-share-fb:hover { background: #1877f2; border-color: #1877f2; }
.kb-share-li:hover { background: #0a66c2; border-color: #0a66c2; }
.kb-share-mail:hover, .kb-share-copy:hover { background: var(--kb-primary); border-color: var(--kb-primary); }
.kb-share-btn.is-copied { background: #1e7a46; border-color: #1e7a46; color: #fff; }

/* ----------------------------------------------- area do formando */

.kb-formando-hero { margin-bottom: 1.75rem; }

.kb-formando-turma-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--kb-border);
}

.kb-formando-cols {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 2rem;
}
@media (max-width: 720px) { .kb-formando-cols { grid-template-columns: 1fr; gap: 1.5rem; } }

.kb-mini-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--kb-text-muted);
    margin: 0 0 .75rem;
}

.kb-doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.kb-doc-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .9rem;
    background: var(--kb-bg-alt);
    border-radius: 8px;
}
.kb-doc-icon { font-size: 1.15rem; }
.kb-doc-info { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.kb-doc-info strong { font-size: .92rem; }
.kb-doc-info small { color: var(--kb-text-muted); font-size: .78rem; }

.kb-note {
    background: #fdf3e0;
    border: 1px solid #f0dcb4;
    color: #8a6415;
    padding: .85rem 1rem;
    border-radius: 8px;
    font-size: .89rem;
}

.kb-alert-ok {
    background: #e9f7ef;
    border: 1px solid #bfe6cd;
    color: #1e6b3c;
    padding: .9rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* ------------------------------------------------------------------ forms */

.kb-form-narrow { max-width: 440px; margin: 0 auto; }

.kb-field { margin-bottom: 1.1rem; }
.kb-field label { display: block; font-size: .85rem; margin-bottom: .35rem; font-weight: 600; }
.kb-field input, .kb-field textarea, .kb-field select {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .15s ease;
}
.kb-field input:focus, .kb-field textarea:focus, .kb-field select:focus {
    outline: none;
    border-color: var(--kb-primary);
}
.kb-field small { display: block; color: var(--kb-text-muted); font-size: .78rem; margin-top: .3rem; }
.kb-field .kb-field-error { color: #b3261e; font-size: .8rem; margin-top: .3rem; }

/* ------------------------------------------------------------- inscricao status */

.kb-inscricao-status {
    display: inline-block;
    padding: .3rem .8rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
}
.kb-inscricao-status.pendente { background: #fdf3e0; color: #91630a; }
.kb-inscricao-status.confirmada { background: #e9f7ef; color: #1e6b3c; }
.kb-inscricao-status.cancelada { background: #fdecea; color: #7a2118; }
.kb-inscricao-status.concluida { background: #e7edf5; color: #294a72; }

/* ------------------------------------------------------------------ table */

.kb-table { width: 100%; border-collapse: collapse; background: #fff; }
.kb-table th, .kb-table td {
    text-align: left;
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--kb-border);
    font-size: .9rem;
    vertical-align: middle;
}
.kb-table th { font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--kb-text-muted); }
.kb-table-wrap { background: #fff; border: 1px solid var(--kb-border); border-radius: var(--kb-radius); overflow-x: auto; box-shadow: var(--kb-shadow); }
.kb-table-wrap .kb-table { border: none; }

/* --------------------------------------------------------------- carousel */

.kb-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 1;
    max-height: 190px;
    overflow: hidden;
    background: var(--kb-bg-alt);
}
.kb-carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform .6s ease;
}
.kb-carousel-slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}
.kb-carousel-slide img { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--kb-bg-alt); }
.kb-carousel-slide a { display: block; width: 100%; height: 100%; }
.kb-carousel-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: .6rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
}
.kb-carousel-dots {
    position: absolute;
    bottom: 1rem; right: 1.5rem;
    display: flex; gap: .5rem;
    z-index: 1;
}
.kb-carousel-dots button {
    width: .6rem; height: .6rem;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.5);
    cursor: pointer;
    padding: 0;
}
.kb-carousel-dots button.is-active { background: #fff; }

@media (max-width: 640px) {
    .kb-carousel { aspect-ratio: 2 / 1; max-height: 160px; }
}

/* -------------------------------------------------------------- lightbox */

.kb-lightbox-img { cursor: zoom-in; }
.kb-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 20, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}
.kb-lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}
.kb-lightbox-close {
    position: absolute;
    top: 1.25rem; right: 1.5rem;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 999px;
    padding: .5rem 1.2rem;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}
.kb-lightbox-close:hover { background: rgba(255, 255, 255, .22); }
.kb-lightbox-hint {
    position: absolute;
    bottom: .75rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .55);
    font-size: .78rem;
}

/* ---------------------------------------------------------------- footer */

.kb-footer {
    background: var(--kb-primary-dark);
    color: rgba(255, 255, 255, .82);
    padding: 3rem 1.5rem 1.5rem;
    margin-top: 2rem;
}
.kb-footer-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 2rem;
}
.kb-footer h4 {
    color: #fff;
    font-size: .95rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 1rem;
}
.kb-footer p { margin: 0 0 .6rem; font-size: .9rem; }
.kb-footer ul { list-style: none; margin: 0; padding: 0; }
.kb-footer ul li { margin-bottom: .55rem; }
.kb-footer a { color: rgba(255, 255, 255, .82); text-decoration: none; font-size: .9rem; }
.kb-footer a:hover { color: #fff; text-decoration: underline; }

.kb-footer-social { display: flex; gap: .6rem; margin-top: .5rem; }
.kb-footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    font-size: .8rem;
    font-weight: 700;
}
.kb-footer-social a:hover { background: var(--kb-accent); color: #23180a; text-decoration: none; }

.kb-footer-bottom {
    max-width: 1080px;
    margin: 2.25rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .82rem;
    color: rgba(255, 255, 255, .55);
    text-align: center;
}

@media (max-width: 720px) {
    .kb-footer-inner { grid-template-columns: 1fr; }
}

/* =====================================================================
   Menus em categorias (submenus) + menu de telemovel
   ===================================================================== */

.kb-header nav { gap: .25rem .4rem; }

.kb-nav-item {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .45rem .7rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    color: #fff;
    opacity: .9;
    white-space: nowrap;
    transition: background .15s ease, opacity .15s ease;
}
.kb-header nav a.kb-nav-item:hover,
.kb-nav-botao:hover { background: rgba(255, 255, 255, .13); opacity: 1; text-decoration: none; }

/* A aba onde o visitante esta fica marcada - sem isto perde-se a nocao
   de onde se esta, agora que os menus agrupam varias paginas. */
.kb-nav-item.is-active { opacity: 1; background: rgba(255, 255, 255, .16); box-shadow: inset 0 -2px 0 var(--kb-accent); }

.kb-nav-botao { border: none; background: none; font: inherit; cursor: pointer; }
.kb-nav-botao svg { width: .85rem; height: .85rem; transition: transform .2s ease; }
.kb-nav-grupo.is-aberto .kb-nav-botao svg { transform: rotate(180deg); }

.kb-nav-destaque {
    background: var(--kb-accent);
    color: #23180a !important;
    font-weight: 600;
    opacity: 1;
}
.kb-nav-destaque:hover { background: var(--kb-accent-dark); color: #fff !important; }

.kb-nav-grupo { position: relative; }

.kb-submenu {
    position: absolute;
    top: calc(100% + .45rem);
    left: 0;
    min-width: 218px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(8, 30, 44, .22);
    padding: .4rem;
    display: grid;
    gap: .1rem;
    z-index: 60;
    /* Fechado por omissao. "visibility" (e nao display:none) mantem a
       transicao suave e o submenu continua fora da ordem de tabulacao. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    /* "visibility" nao deve animar junto com a opacidade: se animasse, o
       submenu so passava a visivel no FIM dos 160ms e nao se via o aparecer.
       A abrir muda de imediato; a fechar espera que a opacidade acabe. */
    transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.kb-nav-grupo.is-aberto .kb-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .16s ease, transform .16s ease, visibility 0s;
}

/* Abrir ao passar o rato so onde ha mesmo um rato. Num telemovel o toque
   deixa um ":hover" agarrado ao elemento tocado, e era isso que escondia os
   submenus: o dedo abria o grupo (.is-aberto) e, no mesmo gesto, o ":hover"
   pegajoso mandava o submenu para invisivel. Com "hover: hover" o telemovel
   nunca entra nestas regras e o menu passa a depender so do toque. */
@media (hover: hover) and (pointer: fine) {
    .kb-nav-grupo:hover .kb-submenu,
    .kb-nav-grupo:focus-within .kb-submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition: opacity .16s ease, transform .16s ease, visibility 0s;
    }
}

.kb-submenu a {
    display: block;
    padding: .55rem .75rem;
    border-radius: 8px;
    color: var(--kb-primary-dark) !important;
    font-size: .88rem;
    font-weight: 500;
}
.kb-submenu a:hover { background: var(--kb-bg-alt); text-decoration: none; }
.kb-submenu a.is-active { background: var(--kb-primary); color: #fff !important; }

/* Botao de menu: so aparece em ecras pequenos. */
.kb-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 38px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 9px;
    background: none;
    cursor: pointer;
}
.kb-nav-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }

@media (max-width: 900px) {
    .kb-header { padding: .75rem 1rem; }
    .kb-nav-toggle { display: flex; }

    .kb-header nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: .15rem;
        margin-top: .6rem;
        padding-top: .6rem;
        border-top: 1px solid rgba(255, 255, 255, .18);
    }
    .kb-header nav.is-aberto { display: flex; }

    /* Com oito grupos abertos o menu passava do fundo do ecra e as ultimas
       entradas ficavam fora de alcance, porque o cabecalho e "sticky". */
    .kb-header nav {
        max-height: calc(100vh - 5.5rem);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .kb-nav-item { width: 100%; justify-content: space-between; padding: .7rem .8rem; }
    .kb-nav-grupo { position: static; }

    /* No telemovel o submenu abre no fluxo, nao a flutuar por cima. */
    .kb-submenu {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, .07);
        transform: none;
        margin: .15rem 0 .35rem .6rem;
        display: none;
    }
    /* O ".is-aberto" vive no grupo, nao no submenu: e o unico interruptor
       do menu de telemovel. */
    .kb-nav-grupo.is-aberto .kb-submenu {
        display: grid;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .kb-submenu a { color: #fff !important; padding: .6rem .8rem; }
    .kb-submenu a:hover { background: rgba(255, 255, 255, .12); }
    .kb-nav-destaque { justify-content: center; margin-top: .4rem; }
}

/* =====================================================================
   Biblioteca
   ===================================================================== */

.kb-livros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1.6rem;
    align-items: stretch;
}

.kb-livro-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
    overflow: hidden;
    height: 100%;
    box-shadow: var(--kb-shadow);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.kb-livro-card:hover { transform: translateY(-6px); box-shadow: var(--kb-shadow-hover); border-color: var(--kb-primary); }

.kb-livro-capa { position: relative; background: var(--kb-bg-alt); }
/* 2:3 e a proporcao normal de uma capa de livro; fixa-la impede que capas
   de tamanhos diferentes desalinhem a grelha toda. */
.kb-livro-capa img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.kb-livro-card:hover .kb-livro-capa img { transform: scale(1.05); }

.kb-livro-capa-vazia {
    width: 100%;
    aspect-ratio: 2 / 3;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
}
.kb-livro-capa-vazia span { font-family: 'Poppins', sans-serif; font-size: 3rem; color: rgba(255, 255, 255, .55); }
.kb-livro-capa-grande { border-radius: var(--kb-radius); }

.kb-livro-etiqueta {
    position: absolute;
    top: .6rem;
    right: .6rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
}
.kb-livro-etiqueta.is-gratuito { background: rgba(30, 122, 70, .92); color: #fff; }
.kb-livro-etiqueta.is-venda { background: rgba(217, 154, 43, .95); color: #23180a; }

.kb-livro-corpo { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.kb-livro-corpo h3 { margin: 0; font-size: .98rem; line-height: 1.35; transition: color .22s ease; }
.kb-livro-card:hover .kb-livro-corpo h3 { color: var(--kb-primary); }
.kb-livro-autor { margin: 0; font-size: .82rem; color: var(--kb-accent-dark); font-weight: 600; }
.kb-livro-sinopse { margin: 0; font-size: .84rem; color: var(--kb-text-muted); flex: 1; }
.kb-livro-corpo .kb-membro-link { margin-top: auto; padding-top: .3rem; }

/* ---- pagina do livro ---- */

.kb-livro-detalhe { display: grid; grid-template-columns: 260px 1fr; gap: 2.25rem; margin-bottom: 2rem; align-items: start; }
.kb-livro-detalhe-capa img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: var(--kb-radius);
    box-shadow: 0 14px 38px rgba(8, 30, 44, .24);
    cursor: zoom-in;
}
.kb-livro-detalhe-info h1 { margin: .35rem 0 .25rem; }
.kb-livro-autor-grande { margin: 0 0 .75rem; color: var(--kb-accent-dark); font-weight: 600; }
.kb-livro-sinopse-grande { margin: 1rem 0 0; font-size: 1rem; color: var(--kb-text-muted); }

.kb-livro-preco { margin: .5rem 0 0; font-family: 'Poppins', sans-serif; font-size: 1.5rem; font-weight: 700; }
.kb-livro-preco.is-venda { color: var(--kb-accent-dark); }
.kb-livro-preco.is-gratuito { color: #1e7a46; font-size: 1.05rem; }

.kb-livro-acoes { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.35rem; }

.kb-livro-ficha { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem 1.5rem; margin: 1.75rem 0 0; }
.kb-livro-ficha dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; color: var(--kb-text-muted); margin-bottom: .15rem; }
.kb-livro-ficha dd { margin: 0; font-size: .92rem; font-weight: 500; }

.kb-estrelas { color: var(--kb-accent); letter-spacing: 1px; }
.kb-avaliacao { margin: 0 0 .5rem; font-size: .9rem; color: var(--kb-text-muted); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ---- comentarios ---- */

.kb-comentarios { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.kb-comentarios li { padding: 1rem 1.15rem; background: var(--kb-bg-alt); border-radius: var(--kb-radius); border-left: 3px solid var(--kb-primary); }
.kb-comentarios li p { margin: .45rem 0 0; font-size: .93rem; }
.kb-comentario-topo { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: .88rem; }
.kb-comentario-topo time { color: var(--kb-text-muted); font-size: .8rem; margin-left: auto; }

/* O campo-armadilha tem de ficar invisivel para pessoas mas preenchivel por
   robos: "display:none" seria ignorado por muitos deles. */
.kb-campo-armadilha { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* =====================================================================
   Modernizacao geral
   ===================================================================== */

.kb-pagina-cabecalho {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--kb-border);
}
.kb-pagina-cabecalho h1 { margin: .2rem 0 .35rem; }
.kb-pagina-cabecalho p { margin: 0; color: var(--kb-text-muted); max-width: 60ch; }

.kb-alerta-sucesso {
    background: #e9f7ef;
    color: #1e6b3c;
    border: 1px solid #bfe5cd;
    border-radius: var(--kb-radius);
    padding: .9rem 1.15rem;
    margin-bottom: 1.5rem;
    font-size: .93rem;
    font-weight: 500;
}

.kb-chamada {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 2.75rem;
    padding: 1.75rem 2rem;
    border-radius: var(--kb-radius);
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: #fff;
}
.kb-chamada h2 { margin: 0 0 .35rem; font-size: 1.25rem; color: #fff; }
.kb-chamada p { margin: 0; opacity: .88; font-size: .93rem; max-width: 62ch; }

.kb-passos { margin: 0; padding-left: 1.2rem; display: grid; gap: .55rem; }
.kb-passos li { font-size: .93rem; }

.kb-pedido-referencia { font-size: 1.15rem; margin: .75rem 0 .25rem; }
.kb-pedido-referencia strong {
    font-family: 'Poppins', sans-serif;
    letter-spacing: 2px;
    background: var(--kb-bg-alt);
    padding: .3rem .7rem;
    border-radius: 8px;
    color: var(--kb-primary-dark);
}

.kb-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.kb-form-grid .kb-field-full { grid-column: 1 / -1; }
.kb-form .kb-field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .3rem; }
.kb-form .kb-field input[type="text"],
.kb-form .kb-field input[type="email"],
.kb-form .kb-field select,
.kb-form .kb-field textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--kb-border);
    border-radius: 9px;
    font: inherit;
    font-size: .93rem;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.kb-form .kb-field input:focus,
.kb-form .kb-field select:focus,
.kb-form .kb-field textarea:focus {
    outline: none;
    border-color: var(--kb-primary);
    box-shadow: 0 0 0 3px rgba(15, 61, 87, .12);
}
.kb-form .kb-field small { display: block; margin-top: .3rem; font-size: .79rem; color: var(--kb-text-muted); }
.kb-form .kb-field-error { margin-top: .3rem; font-size: .82rem; color: #9e2f26; font-weight: 500; }
.kb-form .kb-form-actions { margin-top: 1.5rem; display: flex; gap: .7rem; flex-wrap: wrap; }

@media (max-width: 760px) {
    .kb-livro-detalhe { grid-template-columns: 1fr; gap: 1.5rem; }
    .kb-livro-detalhe-capa { max-width: 220px; }
    .kb-livros-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.1rem; }
    .kb-chamada { padding: 1.35rem 1.25rem; }
}
