/* Manual: índice à esquerda, uma folha por capítulo à direita. */

.docs {
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr);
  gap: 32px;
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 28px) 24px 24px;
  align-items: start;
}

/* ---------- Índice ---------- */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding: 16px 12px;
  background: var(--sheet);
  border: 1.5px solid var(--rule-strong);
  border-radius: 4px 4px 18px 4px;
  box-shadow: 6px 6px 0 -1px var(--rule);
  scrollbar-width: thin;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 10px;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  margin-bottom: 8px;
}
.search:focus-within { border-color: var(--brand); }
.search .mdi { font-size: 20px; color: var(--ink-3); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; }
.search-key { background: var(--rule); color: var(--ink-2); }

.toc-group {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 16px 8px 6px;
}

.toc-ch {
  --mc: var(--brand);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.toc-ch:hover { background: var(--paper); color: var(--ink); }
.toc-ch.on { background: color-mix(in srgb, var(--mc) 12%, transparent); color: var(--ink); font-weight: 600; }
.toc-ch > span:nth-child(2) { flex: 1; }
.toc-ch small { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.toc-ch small::after { content: " MZN"; font-weight: 400; }

.toc-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--mc);
  background: color-mix(in srgb, var(--mc) 12%, transparent);
  flex-shrink: 0;
}

.toc-secs {
  display: flex;
  flex-direction: column;
  margin: 4px 0 8px 23px;
  padding-left: 16px;
  border-left: 1.5px solid var(--rule);
}
.toc-secs a {
  padding: 4px 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 6px;
}
.toc-secs a:hover { color: var(--brand-ink); background: var(--paper); }
.toc-secs a.on { color: var(--brand-ink); font-weight: 600; }

.toc-btn { display: none; }

/* ---------- Capítulo ---------- */
.doc { min-width: 0; outline: none; }
.chapter { --mc: var(--brand); max-width: none; padding: 44px 52px; }

.ch-head { display: flex; gap: 20px; align-items: flex-start; padding-bottom: 22px; border-bottom: 1px dashed var(--rule); }
.ch-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 32px;
  color: var(--mc);
  background: color-mix(in srgb, var(--mc) 13%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--mc) 35%, transparent);
  flex-shrink: 0;
}
.chapter h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin: 6px 0 8px; }
.chapter .lead { font-size: 16.5px; }

.ch-mod {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--mc) 9%, transparent);
  border-left: 4px solid var(--mc);
  font-size: 14.5px;
  color: var(--ink-2);
}
.ch-mod > span { display: block; }
.ch-mod > span > .mdi { margin-right: 6px; vertical-align: -3px; }
.ch-mod .mdi { color: var(--mc); font-size: 18px; }
.ch-mod a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; }
.ch-mod a .mdi { color: inherit; }
.ch-mod a:hover { text-decoration: underline; }

.ch-toc { margin: 24px 0 8px; padding: 16px 20px; border: 1.5px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.ch-toc ol { margin: 8px 0 0 20px; columns: 2; column-gap: 32px; font-size: 14.5px; }
.ch-toc li { break-inside: avoid; padding: 2px 0; }
.ch-toc a { color: var(--ink); text-decoration: none; }
.ch-toc a:hover { color: var(--brand-ink); text-decoration: underline; }

.ch-sec { padding-top: 34px; scroll-margin-top: calc(var(--header-h) + 20px); }
.ch-sec.flash h2 { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--mc) 16%, transparent); } }

.ch-sec h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 -10px 12px;
  padding: 4px 10px;
  border-radius: 10px;
}
.sec-n {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid var(--mc);
  color: var(--mc);
  flex-shrink: 0;
}
.sec-link { margin-left: auto; color: var(--ink-3); opacity: 0; font-size: 18px; text-decoration: none; transition: opacity 0.15s; }
.ch-sec h2:hover .sec-link,
.sec-link:focus-visible { opacity: 1; }

.ch-sec h4 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.ch-sec p,
.ch-sec li { color: var(--ink-2); max-width: 46em; }
.ch-sec p + p,
.ch-sec p + ul,
.ch-sec ul + p,
.ch-sec ol + p,
.ch-sec p + ol,
.ch-sec p + table,
.ch-sec table + p { margin-top: 12px; }
.ch-sec ul { margin-left: 20px; }
.ch-sec li + li { margin-top: 6px; }
.ch-sec code { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 6px; border-radius: 5px; background: var(--paper); border: 1px solid var(--rule); }

/* Passos numerados */
.how { list-style: none; counter-reset: how; margin: 12px 0 0; max-width: 46em; }
.how li { counter-increment: how; position: relative; padding: 0 0 0 40px; min-height: 28px; }
.how li + li { margin-top: 10px; }
.how li::before {
  content: counter(how);
  position: absolute;
  left: 0;
  top: -1px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--mc);
  color: #fff;
}
.how li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 28px; bottom: -10px; border-left: 1.5px dashed var(--rule); }

:root[data-theme="dark"] .how li::before { color: #04201d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .how li::before { color: #04201d; }
}

/* Notas */
p.tip,
p.warn {
  position: relative;
  margin-top: 14px !important;
  padding: 12px 16px 12px 46px;
  border-radius: 12px;
  font-size: 14.5px;
}
p.tip { background: var(--brand-soft); color: var(--ink) !important; }
p.warn { background: var(--warn-soft); color: var(--ink) !important; }
p.tip::before,
p.warn::before {
  font-family: "Material Design Icons";
  position: absolute;
  left: 14px;
  top: 10px;
  font-size: 21px;
  line-height: 1.2;
}
p.tip::before { content: "\F0335"; color: var(--brand); }   /* mdi-lightbulb-outline */
p.warn::before { content: "\F0026"; color: var(--warn); }   /* mdi-alert */

/* Tabelas */
.table { width: 100%; max-width: 46em; border-collapse: collapse; font-size: 14.5px; margin-top: 12px; border: 1.5px solid var(--rule); border-radius: 12px; overflow: hidden; }
.table th,
.table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table thead th { font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); background: var(--paper); }
.table td { color: var(--ink-2); }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { white-space: nowrap; }

/* Anterior / seguinte */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; padding-top: 24px; border-top: 1px dashed var(--rule); }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1.5px solid var(--rule); border-radius: var(--radius); text-decoration: none; transition: border-color 0.15s; }
.pager a:hover { border-color: var(--brand); }
.pager small { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.pager b { font-size: 16px; color: var(--ink); }
.pager .next { text-align: right; align-items: flex-end; }

/* Resultados da pesquisa */
.hits { list-style: none; margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.hits a { --mc: var(--brand); display: block; padding: 14px 18px; border: 1.5px solid var(--rule); border-left: 4px solid var(--mc); border-radius: 8px var(--radius) var(--radius) 8px; text-decoration: none; background: var(--paper); }
.hits a:hover { border-color: var(--mc); }
.hits small { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.hits small .mdi { color: var(--mc); font-size: 16px; }
.hits b { display: block; font-size: 16px; color: var(--ink); margin: 2px 0 4px; }
.hits span { font-size: 14px; color: var(--ink-2); }
.hits mark { background: var(--accent-soft); color: var(--ink); border-radius: 3px; padding: 0 2px; }

.manual-page .site-footer { max-width: 1240px; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .docs { grid-template-columns: 1fr; padding-top: calc(var(--header-h) + 72px); }
  .toc {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: min(340px, 88vw);
    max-height: none;
    z-index: 40;
    border-radius: 0;
    border-width: 0 1.5px 0 0;
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
  }
  .toc.open { transform: none; box-shadow: var(--shadow); }
  .toc-btn {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    left: 16px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1.5px solid var(--rule-strong);
    background: var(--sheet);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow);
  }
  .toc-btn .mdi { font-size: 20px; }
}

@media (max-width: 720px) {
  .docs { padding: calc(var(--header-h) + 64px) 12px 12px; }
  .chapter { padding: 26px 18px; }
  .ch-head { flex-direction: column; gap: 12px; }
  .ch-toc ol { columns: 1; }
  .pager { grid-template-columns: 1fr; }
  .table td:first-child { white-space: normal; }
}

/* O <main> do manual não usa o espaçamento da página inicial */
main.doc { padding: 0; display: block; }
