/* Caderno (notes.souza.wiki.br) */
html, body { overscroll-behavior: none; }
body { touch-action: manipulation; }
.pequeno { font-size: 13px; }
.grupo { display: flex; align-items: center; gap: 2px; }
.marca { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.marca svg { color: var(--primaria); }
.entrar .marca { margin-bottom: 18px; }

/* ------------------------------------------------ lista de cadernos */
.casa { min-height: 100dvh; }
.casa-topo {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--fundo) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borda);
}
.casa-topo .grupo { gap: 8px; }
.casa-corpo { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.casa-corpo h1 { font-size: 26px; margin-bottom: 18px; }
.grade-cadernos { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 22px 18px; }
.cartao { display: grid; gap: 8px; min-width: 0; }
.cartao-abrir { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 14px; }
.capa {
  position: relative; aspect-ratio: 1000 / 1414; border-radius: 6px 14px 14px 6px; padding: 9px 9px 9px 16px;
  box-shadow: var(--sombra);
}
.capa::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: rgba(0, 0, 0, .18); }
.capa .miniatura { height: 100%; width: 100%; object-fit: cover; border-radius: 3px 8px 8px 3px; }
.cartao-abrir:hover .capa { transform: translateY(-2px); transition: transform .15s; }
.cartao-info { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.cartao-info > div { display: grid; min-width: 0; }
.cartao-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cartao-novo {
  aspect-ratio: 1000 / 1414; display: grid; place-content: center; justify-items: center; gap: 8px;
  border: 2px dashed var(--borda); border-radius: 14px; background: transparent; cursor: pointer;
  color: var(--suave); font-weight: 600;
}
.cartao-novo:hover { border-color: var(--primaria); color: var(--primaria); }

.modelos { display: flex; gap: 10px; flex-wrap: wrap; }
.modelo-op {
  display: grid; justify-items: center; gap: 6px; padding: 8px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--borda); background: var(--superficie-2); font-size: 13px; font-weight: 600;
}
.modelo-op[aria-pressed=true] { border-color: var(--primaria); }
.mini-modelo { width: 58px; height: 82px; border-radius: 4px; box-shadow: 0 0 0 1px var(--borda); background: #fff; }
.lista-acoes { display: grid; gap: 8px; margin-bottom: 10px; }
.lista-acoes .btn { justify-content: flex-start; }
.subtitulo { font-size: 14px; margin: 16px 0 8px; color: var(--suave); }
.ir-paginas { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; }
.ir-paginas .btn { min-width: 44px; padding: 0 10px; min-height: 36px; }

/* ------------------------------------------------ editor */
.editor { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; background: var(--mesa); }
.barra {
  color: var(--texto);
  display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0;
  padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: var(--superficie); border-bottom: 1px solid var(--borda); z-index: 4;
}
.barra-meio { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.barra-meio::-webkit-scrollbar { display: none; }
.sep { width: 1px; height: 24px; background: var(--borda); margin: 0 6px; flex: none; }
.titulo-caderno {
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none;
  font-weight: 650; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.titulo-caderno:hover { background: var(--superficie-2); }
.ferr[aria-pressed=true], .esp[aria-pressed=true] { background: color-mix(in srgb, var(--primaria) 16%, transparent); color: var(--primaria); }
.cor-barra { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--superficie); box-shadow: 0 0 0 1px var(--suave); margin: 0 2px; cursor: pointer; padding: 0; }
.cor-barra[aria-pressed=true] { box-shadow: 0 0 0 2.5px var(--primaria); }
.cor-barra.auto { background: linear-gradient(135deg, #1d1d1f 50%, #f4f4f5 50%) !important; }
.cor-livre { width: 30px; height: 30px; flex: none; padding: 0; border: 0; background: none; cursor: pointer; margin-left: 2px; }
.esp .ponto { display: block; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--superficie), 0 0 0 2.5px var(--suave); }
.estado-sync { display: inline-grid; place-items: center; width: 34px; height: 40px; color: var(--ok); }
.estado-sync.enviando { color: var(--suave); }
.estado-sync.offline, .estado-sync.erro { color: #d08a1e; }

.area { position: relative; display: flex; min-height: 0; }
.mesa { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.mesa canvas { position: absolute; left: 0; top: 0; display: block; }
.mesa .tinta { touch-action: none; }
.indicador {
  position: absolute; right: 12px; bottom: 12px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--superficie) 90%, transparent); color: var(--suave); pointer-events: none; box-shadow: var(--sombra);
}
.menu-selecao {
  position: absolute; z-index: 3; display: flex; gap: 6px; padding: 6px; border-radius: 12px;
  background: var(--superficie); box-shadow: var(--sombra);
}
.menu-selecao[hidden] { display: none; }
.menu-selecao .btn { min-height: 36px; padding: 0 12px; }
.bolinha-cor { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

@media (max-width: 760px) { .titulo-caderno { max-width: 90px; } }
@media (max-width: 1060px) {
  .barra { flex-wrap: wrap; row-gap: 2px; }
  .barra-meio { order: 3; flex-basis: 100%; justify-content: center; border-top: 1px solid var(--borda); padding-top: 4px; }
}

.progresso { height: 8px; border-radius: 999px; background: var(--superficie-2); overflow: hidden; margin-top: 8px; }
.progresso > span { display: block; height: 100%; width: 0; background: var(--primaria); transition: width .2s; }

.abas { display: flex; gap: 4px; margin-left: 14px; }
.abas a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; color: var(--suave); text-decoration: none; font-weight: 600; }
.abas a.ativa { background: var(--superficie); color: var(--texto); box-shadow: 0 0 0 1px var(--borda); }
.cartao-abrir.livro { position: relative; display: block; text-decoration: none; color: inherit; }
.capa-livro { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px 10px 10px 4px; box-shadow: var(--sombra); background: var(--superficie-2); }
.capa-livro.vazia { display: grid; place-items: center; padding: 14px; text-align: center; font-weight: 700; background: linear-gradient(160deg, #3b6fd6, #23324f); color: #fff; }
.barra-lida { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .55); overflow: hidden; }
.barra-lida > span { display: block; height: 100%; background: var(--primaria); }
@media (max-width: 640px) { .abas a { padding: 7px 9px; } .marca span { display: none; } }
