/* ==========================================================================
   Tema "apresenta" - Central de Ajuda Apresenta.me
   Usa as variáveis de cor do BookStack (--color-primary etc.), então segue
   as cores definidas em Configurações > Personalização e o modo escuro.
   ========================================================================== */

:root {
  --ap-radius: 12px;
  --ap-border: rgba(0, 0, 0, 0.08);
  --ap-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --ap-shadow-hover: 0 6px 16px rgba(16, 24, 40, 0.12);
  --ap-text: #1f2937;
  --ap-muted: #6b7280;
  --ap-surface: #fff;
  --ap-bg: #f4f6f9;
}
html.dark-mode {
  --ap-border: rgba(255, 255, 255, 0.1);
  --ap-text: #e5e7eb;
  --ap-muted: #9ca3af;
  --ap-surface: #222222; /* mesmo tom do cartão do BookStack no modo escuro */
  --ap-bg: #1a1a1a;
  --ap-link-on-dark: #9cc1e6; /* tom claro da cor da marca: contraste AA sobre fundo escuro */
}
html.dark-mode .tri-layout-mobile-tab,
html.dark-mode .ap-card-meta,
html.dark-mode .book-tree a.selected .entity-list-item-name,
html.dark-mode .ap-page-nav .sidebar-page-nav .current-heading > a { color: var(--ap-link-on-dark) !important; }

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */
body.ap-home-page { background: var(--ap-bg); }
body.ap-home-page #content { padding: 0; }

.ap-hero {
  background: var(--color-primary);
  background-image: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark, #195785) 100%);
  color: #fff;
  padding: 56px 24px 64px;
  text-align: center;
}
.ap-hero-inner { max-width: 760px; margin: 0 auto; }
.ap-hero-title {
  color: #fff;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.2;
}
.ap-hero-sub { color: rgba(255, 255, 255, 0.88); margin: 0 0 28px; font-size: 1.05rem; }

.ap-hero-search {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.ap-hero-search-icon { display: flex; color: #9ca3af; font-size: 1.3rem; }
.ap-hero-search-icon svg { fill: currentColor; }
.ap-hero-search input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 1.05rem;
  padding: 12px 10px;
  color: #111;
}
.ap-hero-search button {
  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  padding: 12px 22px;
  cursor: pointer;
  white-space: nowrap;
}
.ap-hero-search button:hover { filter: brightness(1.08); }

.ap-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.ap-chip {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  text-decoration: none !important;
}
.ap-chip:hover { background: rgba(255, 255, 255, 0.26); }

.ap-home-body { max-width: 1180px; margin: 0 auto; padding: 8px 24px 48px; }

.ap-section { margin-top: 40px; }
.ap-section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ap-section-head h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
  color: var(--ap-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ap-section-head h2 svg { fill: var(--color-primary); }
.ap-section-icon {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--ap-surface);
  box-shadow: var(--ap-shadow);
  flex-shrink: 0;
}
.ap-section-desc { margin: 2px 0 0; color: var(--ap-muted); font-size: 0.92rem; }

.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ap-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 18px 18px 14px;
  box-shadow: var(--ap-shadow);
  color: var(--ap-text) !important;
  text-decoration: none !important;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  min-height: 112px;
}
.ap-card:hover, .ap-card:focus-visible {
  box-shadow: var(--ap-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--color-primary);
}
.ap-card-title { font-weight: 600; font-size: 1.05rem; line-height: 1.3; }
.ap-card-desc {
  color: var(--ap-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ap-card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 500;
}
.ap-card-arrow svg { fill: currentColor; }

.ap-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.ap-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ap-text) !important;
  text-decoration: none !important;
}
.ap-link:hover { border-color: var(--color-primary); }
.ap-link-icon { color: var(--color-page, #206ea7); display: flex; padding-top: 2px; }
.ap-link-icon svg { fill: currentColor; }
.ap-link-text { display: flex; flex-direction: column; min-width: 0; }
.ap-link-title { font-weight: 500; line-height: 1.35; }
.ap-link-meta { color: var(--ap-muted); font-size: 0.82rem; margin-top: 2px; }

.ap-pagination { margin-top: 32px; }
.ap-editor-links { margin-top: 40px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.9rem; }
.ap-editor-links a { display: inline-flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------------------
   Tutoriais interativos (SupaDemo)
   -------------------------------------------------------------------------- */
.ap-tours-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.ap-tours-btn svg { fill: currentColor; }
.ap-tours-btn:hover { filter: brightness(0.96); }
.ap-tours-btn:active, .ap-tours-fab:active, .ap-search-toggle:active { transform: scale(0.97); }
.ap-tours-fab {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.ap-tours-fab svg { fill: currentColor; }
[data-ap-tours][aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* Link do header em destaque: pílula branca (desktop) */
@media screen and (min-width: 1001px) {
  #header .header-links a[data-ap-tours] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: var(--color-primary) !important;
    font-weight: 700;
    border-radius: 999px;
    padding: 8px 18px !important;
    margin-inline-end: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  #header .header-links a[data-ap-tours]:hover,
  #header .header-links a[data-ap-tours]:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    text-decoration: none;
  }
  #header .header-links a[data-ap-tours] svg { fill: currentColor; margin-inline-end: 0; }
}
/* No menu do celular: item em destaque */
@media screen and (max-width: 1000px) {
  #header .header-links a[data-ap-tours] { font-weight: 700; color: var(--color-primary) !important; }
}

/* Demo Hub do SupaDemo: remove o rodapé "Powered by Supademo" */
.supademo-widget-root .supademo-drawer-footer,
.supademo-widget-root .supademo-footer-branding { display: none !important; }

/* --------------------------------------------------------------------------
   Busca no celular: ícone no header + painel sobreposto
   -------------------------------------------------------------------------- */
.ap-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-inline-start: auto;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
}
.ap-search-toggle svg { fill: currentColor; }
.ap-search-toggle:hover { background: rgba(255, 255, 255, 0.14); }
.ap-search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--color-primary);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
}
.ap-search-panel[hidden], .ap-search-backdrop[hidden] { display: none !important; }
.ap-search-panel-form {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 0 14px;
  height: 44px;
}
.ap-search-panel-icon { display: flex; color: #6b7280; }
.ap-search-panel-icon svg { fill: currentColor; }
.ap-search-panel-form input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: 0;
  font-size: 16px; /* >= 16px evita zoom automático no iOS */
  padding: 0 8px;
  color: #111827;
}
.ap-search-panel-form input::placeholder { color: #6b7280; }
.ap-search-panel-form input,
.ap-search-panel-form input:focus,
.ap-hero-search input,
.ap-hero-search input:focus {
  -webkit-appearance: none;
  appearance: none;
  border: 0 !important;
  border-radius: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}
.ap-search-panel-form input::-webkit-search-decoration,
.ap-hero-search input::-webkit-search-decoration { -webkit-appearance: none; }
.ap-search-panel-form:focus-within, .ap-hero-search:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45); }
.ap-search-panel-cancel {
  border: 0;
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 6px;
  cursor: pointer;
}
.ap-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, 0.45);
}

/* --------------------------------------------------------------------------
   Leitura de páginas
   -------------------------------------------------------------------------- */
.page-content img { height: auto !important; max-width: 100%; }
.page-content img:not(a img) { cursor: zoom-in; }
.page-content { overflow-wrap: anywhere; }
.page-content table { max-width: 100%; }

/* Lightbox de imagens (apresenta.js) */
.ap-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 14, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: zoom-out;
  overflow: auto;
  touch-action: pinch-zoom;
}
.ap-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.ap-lightbox-close {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 26px;
  line-height: 44px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Páginas internas (livro, capítulo, página) - vale para todas as larguras;
   ajustes específicos do celular ficam no bloco < 1000px abaixo.
   -------------------------------------------------------------------------- */
.tri-layout-middle-contents > .content-wrap.card,
main.content-wrap.card {
  border-radius: 16px;
  border: 1px solid var(--ap-border);
  box-shadow: var(--ap-shadow);
}
@media screen and (min-width: 1001px) {
  main.content-wrap.card { padding: 48px 56px; }
}

/* Leitura */
.page-content { font-size: 1.0625rem; line-height: 1.75; color: var(--ap-text); }
.page-content > h1:first-child, .page-content h1#bkmrk-page-title {
  font-size: clamp(1.75rem, 2.4vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 0.5em;
}
.ap-updated { color: var(--ap-muted); font-size: 0.88rem; margin: -0.3em 0 1.6em; }
.page-content h2 { font-size: 1.45rem; font-weight: 650; margin-top: 2.1em; letter-spacing: -0.01em; }
.page-content h3 { font-size: 1.2rem; font-weight: 600; margin-top: 1.8em; }
.page-content h4 { font-size: 1.05rem; font-weight: 600; }
.page-content hr { border: 0; border-top: 1px solid var(--ap-border); margin: 2.2em 0; }
.page-content img {
  border-radius: 10px;
  border: 1px solid var(--ap-border);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
}
.page-content table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  overflow: hidden;
}
.page-content table th, .page-content table td { padding: 10px 14px; border: 0; border-bottom: 1px solid var(--ap-border); }
.page-content table tr:last-child td { border-bottom: 0; }
.page-content table th, .page-content table thead td { background: rgba(59, 113, 165, 0.08); font-weight: 600; }
.page-content .callout { border-radius: 10px; }

/* Breadcrumb: sem o nível genérico "Estantes"/"Livros" */
.breadcrumbs > a.icon-list-item:first-child,
.breadcrumbs > a.icon-list-item:first-child + .separator,
.breadcrumbs > a.icon-list-item:first-child + .dropdown-search { display: none; }
@media screen and (min-width: 1001px) {
  .breadcrumbs { font-size: 0.9rem; }
}

/* Anterior / Próximo como cartões */
#sibling-navigation a {
  border: 1px solid var(--ap-border);
  background: var(--ap-surface);
  border-radius: 12px;
  padding: 10px 6px;
}
#sibling-navigation a:hover { border-color: var(--color-primary); }

/* Colunas laterais: títulos discretos */
.tri-layout-left-contents h5, .tri-layout-right-contents h5 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ap-muted);
  margin-bottom: 10px;
}

/* Navegação do livro (sidebar) e índice do livro: capítulos sempre abertos, artigo atual destacado */
.book-tree .chapter-contents-toggle,
.book-contents .chapter-contents-toggle { display: none !important; }
.book-tree .chapter-contents-list,
.book-contents .chapter-contents-list { display: block !important; height: auto !important; overflow: visible !important; }
.book-tree .sidebar-page-list > li { border-inline-start: 0 !important; margin-bottom: 4px; }
.book-tree .entity-list-item { padding: 6px 10px; border-radius: 8px; }
.book-tree .entity-list-item .icon { display: none; }
.book-tree .entity-list-item-name { font-size: 0.92rem; line-height: 1.35; }
.book-tree .list-item-book > a .entity-list-item-name { font-weight: 700; font-size: 1rem; }
.book-tree .list-item-chapter > a .entity-list-item-name { font-weight: 600; color: var(--ap-text); }
.book-tree .entity-list-item.no-hover { padding: 0; }
/* Sidebar: só o capítulo atual fica aberto (livros grandes ficariam longos demais) */
.book-tree .list-item-chapter:not(:has(a.selected)) .chapter-contents-list { display: none !important; }
.book-tree .chapter-contents-list {
  margin: 2px 0 8px 18px !important;
  padding-inline-start: 6px !important;
  border-inline-start: 2px solid var(--ap-border);
}
.book-tree .chapter-contents-list .entity-list-item-name { font-weight: 400; font-size: 0.88rem; color: var(--ap-muted); }
.book-tree a.selected {
  background: rgba(59, 113, 165, 0.1) !important;
  box-shadow: inset 3px 0 0 var(--color-primary);
}
.book-tree a.selected .entity-list-item-name { color: var(--color-primary) !important; font-weight: 600 !important; }

/* "Nesta página" (coluna direita em telas largas) */
.ap-page-nav .sidebar-page-nav a { font-size: 0.88rem; color: var(--ap-muted); }
.ap-page-nav .sidebar-page-nav .current-heading > a { color: var(--color-primary); font-weight: 600; }

/* Visitante: sem metadados internos (revisões, autores, atividades) */
.ap-guest #recent-activity,
.ap-guest .tri-layout-sides .mb-xl:has(.entity-meta),
.ap-guest .entity-details,
.ap-guest .actions { display: none !important; }

/* --------------------------------------------------------------------------
   Celular e tablet (< 1000px, mesmo breakpoint "l" do BookStack)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 1000px) {
  /* Header: uma linha de 56px (logo, busca, menu), sem borda */
  #header {
    position: relative;
    z-index: 30; /* menu aberto fica acima da barra fixa do índice */
    padding: 0 8px 0 16px !important;
    min-height: 56px;
    border-bottom: 0 !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  #header > .flex-container-row { min-height: 56px; gap: 4px; }
  #header .logo { padding: 0; margin: 0 !important; }
  #header .logo-image { max-height: 26px; width: auto; }
  #header .hide-over-l.py-s { padding: 0 !important; }
  #header .mobile-menu-toggle {
    width: 44px;
    height: 44px;
    border: 0 !important;
    border-radius: 12px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
  }
  #header .mobile-menu-toggle:hover, #header .mobile-menu-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, 0.14); }
  /* Menu aberto: cartão abaixo do header, itens com alvo de toque de 48px */
  #header .header-links.show {
    top: 52px !important;
    right: 8px !important;
    min-width: 230px;
    padding: 6px !important;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
  }
  #header .header-links .links { text-align: left; }
  #header .header-links .links a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px !important; border-radius: 10px; }
  #header .header-links .links a:hover { background: rgba(59, 113, 165, 0.08); }
  #header .header-links .links a[href$="/search"] { display: none !important; } /* já existe o ícone de busca no header */
  #header .mobile-menu-toggle:focus:not(:focus-visible), .ap-search-toggle:focus:not(:focus-visible) { outline: none; }

  /* Barra fina do índice: mostra só o botão da aba inativa ("Índice do livro" / "Voltar ao artigo") */
  .tri-layout-mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--ap-surface);
    border-bottom: 1px solid var(--ap-border);
  }
  .tri-layout-mobile-tabs .grid { display: block; }
  .tri-layout-mobile-tab[aria-selected="true"] { display: none; }
  .tri-layout-mobile-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 0 18px !important;
    min-height: 46px;
    border: 0 !important;
    background: transparent !important;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--color-primary) !important;
  }
  /* Ícone de lista feito em CSS (três traços) */
  .tri-layout-mobile-tab[data-tab="info"]::before {
    content: "";
    width: 16px;
    height: 12px;
    background: linear-gradient(currentColor 0 0) top / 100% 2px no-repeat,
                linear-gradient(currentColor 0 0) center / 100% 2px no-repeat,
                linear-gradient(currentColor 0 0) bottom / 100% 2px no-repeat;
  }
  .tri-layout-mobile-tab[data-tab="content"]::before {
    content: "";
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-inline-start: 4px;
  }

  /* Breadcrumb: uma linha, só texto, sem repetir o título da página */
  .tri-layout-middle-contents > .mb-m:first-child,
  .tri-layout-middle-contents > div:first-child:has(.breadcrumbs) { margin: 0 !important; padding: 12px 18px 0; }
  .tri-layout-middle { padding-top: 0 !important; }
  .breadcrumbs { flex-wrap: nowrap; overflow: hidden; gap: 0; font-size: 0.82rem; opacity: 1; }
  .breadcrumbs .icon-list-item > span:first-child { display: none; }
  .breadcrumbs .icon-list-item > span + span {
    display: inline !important;
    max-width: 44vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .breadcrumbs .icon-list-item { padding: 4px 2px !important; color: var(--ap-muted) !important; }
  .breadcrumbs > a.icon-list-item:last-child,
  .breadcrumbs > .dropdown-search:nth-last-child(2),
  .breadcrumbs > .separator:nth-last-child(2) { display: none; }
  .breadcrumbs .separator, .breadcrumbs .dropdown-search { font-size: 1.1em; opacity: 0.6; }

  /* Conteúdo de borda a borda (sem moldura cinza em volta do cartão) */
  body.tri-layout, body.tri-layout #content { background: var(--ap-surface); }
  .tri-layout-middle-contents { padding: 0 0 88px; } /* respiro para o botão flutuante de tutoriais */
  .tri-layout-middle-contents > .content-wrap.card,
  main.content-wrap.card {
    padding: 12px 18px 24px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  #sibling-navigation { padding: 0 18px; }

  /* Páginas fora do layout de 3 colunas (busca, listas): também de borda a borda, título discreto */
  body:not(.tri-layout):not(.ap-home-page), body:not(.tri-layout):not(.ap-home-page) #content { background: var(--ap-surface); }
  body:not(.tri-layout):not(.ap-home-page) #content .content-wrap.card {
    margin: 0 !important;
    padding: 20px 18px 96px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  body:not(.tri-layout):not(.ap-home-page) #content > .container { padding: 0 !important; margin: 0 !important; max-width: none; }
  h1.list-heading { font-size: 1.45rem !important; font-weight: 650; }

  /* Botão flutuante de tutoriais: compacto, respeita a área segura do iPhone */
  .ap-tours-fab {
    left: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  /* Tipografia legível */
  .page-content { font-size: 1rem; line-height: 1.65; }
  .page-content h1, h1.break-text { font-size: 1.65rem !important; line-height: 1.25; }
  .page-content h2 { font-size: 1.35rem; }
  .page-content h3 { font-size: 1.15rem; }
  .page-content h4 { font-size: 1.05rem; }

  /* Tabelas do DocAgent usam larguras fixas (table-layout:fixed; th 160px):
     no celular viram blocos com rolagem horizontal em vez de esmagar o texto. */
  .page-content table {
    display: block;
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    table-layout: auto !important;
    border-collapse: collapse;
  }
  .page-content table th,
  .page-content table td {
    width: auto !important;
    min-width: 110px;
    white-space: normal !important;
    vertical-align: top;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: auto;
  }
  .page-content table td:first-child, .page-content table th:first-child { min-width: 140px; }
  .page-content table td:nth-child(2), .page-content table th:nth-child(2) { min-width: 200px; }

  /* Código e blocos largos */
  .page-content pre { white-space: pre; overflow-x: auto; max-width: 100%; }

  /* Navegação anterior/próximo empilhada */
  .entity-sibling-navigation, .sibling-navigation { grid-template-columns: 1fr !important; gap: 8px; }

  /* Home */
  .ap-hero { padding: 32px 16px 40px; }
  .ap-hero-sub { font-size: 0.98rem; margin-bottom: 20px; }
  .ap-hero-search { padding: 4px 4px 4px 14px; }
  .ap-hero-search input { font-size: 16px; padding: 10px 6px; }
  .ap-hero-search button { padding: 10px 16px; }
  .ap-chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; scrollbar-width: none; }
  .ap-chips::-webkit-scrollbar { display: none; }
  .ap-chip { flex-shrink: 0; }
  .ap-home-body { padding: 0 16px 32px; }
  .ap-section { margin-top: 28px; }
  .ap-section-head h2 { font-size: 1.15rem; }
  .ap-section-icon { width: 40px; height: 40px; }
  .ap-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ap-card { padding: 14px 12px 12px; min-height: 96px; }
  .ap-card-title { font-size: 0.97rem; }
  .ap-links { grid-template-columns: 1fr; }
  .ap-tours-btn { margin-top: 14px; font-size: 0.92rem; padding: 9px 16px; }
  .entity-list-item .entity-list-item-name { font-size: 1.08rem; }
}

@media screen and (max-width: 560px) {
  .ap-hero-search button { display: none; } /* teclado do celular já tem "buscar" */
  .ap-grid { grid-template-columns: 1fr; }
  .ap-card { min-height: 0; }
  .ap-card-desc { -webkit-line-clamp: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-card, .ap-tours-btn, .ap-tours-fab, #header .header-links a[data-ap-tours] { transition: none !important; }
  .ap-card:hover, #header .header-links a[data-ap-tours]:hover { transform: none !important; }
}
