:root {
  --tinta: #17181C;
  --tinta-2: #3A3A3F;
  --suave: #5E5C57;
  --apagado: #8A877F;
  --papel: #F5F3EE;
  --branco: #FFFFFF;
  --linha: #E4E0D8;
  --linha-2: #EFEBE4;
  --dobra: #C9C2B4;
  --perigo: #8E1B24;
  --ok: #1D5E4A;
  --serifa: 'Newsreader', Georgia, serif;
  --sans: 'Geist', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--papel); color: var(--tinta); font-family: var(--sans); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--tinta); }
:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tela { max-width: 720px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 104px); display: flex; flex-direction: column; gap: 18px; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.titulo { margin: 0; font-family: var(--serifa); font-weight: 600; font-size: 40px; line-height: 1.02; letter-spacing: -0.02em; }
.titulo-m { margin: 0; font-family: var(--serifa); font-weight: 600; font-size: 28px; line-height: 1.1; }
.secao { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--suave); }
.texto-suave { margin: 0; font-size: 14px; line-height: 1.5; color: var(--suave); }
.bloco { display: flex; flex-direction: column; gap: 10px; }
.bloco.largo { gap: 18px; }


.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 13px; font-weight: 500; color: var(--suave); }
/* Grupo de opções (motivo da denúncia, D77): sem a moldura do fieldset; a legenda como o rótulo de um campo, as opções como itens. */
fieldset.campo { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.campo legend { font-size: 13px; font-weight: 500; color: var(--suave); padding: 0; margin-bottom: 6px; }
fieldset.campo label.item { font-size: inherit; font-weight: inherit; color: inherit; }
.entrada { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--linha); border-radius: 12px; background: var(--branco); font-size: 16px; }
.entrada:focus { border-color: var(--tinta); outline: none; }
select.entrada { padding-right: 8px; }
.busca { position: relative; }
.busca svg { position: absolute; left: 14px; top: 14px; pointer-events: none; }
.busca .entrada { padding-left: 42px; }

.botao { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--tinta); color: var(--branco); font-weight: 600; cursor: pointer; text-decoration: none; }
.botao.secundario { background: var(--branco); color: var(--tinta); border: 1px solid var(--linha); }
.botao.perigo { background: var(--branco); color: var(--perigo); border: 1px solid #E4C8C8; }
.botao.pequeno { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.botao.cheio { width: 100%; }
.botao:disabled { opacity: 0.5; cursor: default; }
.link-botao { border: 0; background: none; padding: 8px 4px; min-height: 44px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.icone-btn { width: 44px; height: 44px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; cursor: pointer; }
.icone-btn:hover { background: var(--linha-2); }

.cartao { background: var(--branco); border: 1px solid var(--linha); border-radius: 14px; }
.lista { display: flex; flex-direction: column; background: var(--branco); border: 1px solid var(--linha); border-radius: 14px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; text-decoration: none; color: var(--tinta); border-bottom: 1px solid var(--linha-2); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; cursor: pointer; }
.item:last-child { border-bottom: 0; }
/* Linha de IA: nome e detalhes por inteiro em cima, botões embaixo (nomes como ChatGPT_1 e ChatGPT_2 precisam ser legíveis). */
.item.ia { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; cursor: default; }
.item.ia:hover { background: none; }
.item.ia .item-texto { flex: 1 1 0; }
.item.ia .item-titulo, .item.ia .item-sub { white-space: normal; overflow-wrap: anywhere; }
.item.ia .linha-botoes { flex-basis: 100%; justify-content: flex-end; }
.item:hover { background: #FAF9F6; }
.item-texto { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.item-titulo { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: 12px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contagem { font-size: 14px; color: var(--suave); }
.vazio { padding: 18px 14px; font-size: 14px; color: var(--suave); }

/* Fixadas (D24): linha simples com a altura da busca (46 px); dupla = 2 linhas + espaçamento. */
.grade-fixadas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 46px; gap: 10px; }
.grade-fixadas.n1 .fixada { grid-column: 1; grid-row: 1 / span 2; }
.grade-fixadas.n2 .fixada { grid-row: span 2; }
.grade-fixadas.n3 .fixada:nth-child(1) { grid-column: 1; grid-row: 1; }
.grade-fixadas.n3 .fixada:nth-child(2) { grid-column: 1; grid-row: 2; }
.grade-fixadas.n3 .fixada:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
.fixada { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 0; overflow: hidden; border-radius: 14px; background: var(--linha-2); border: 1px solid var(--dobra); text-decoration: none; color: var(--tinta); }
.fixada svg { flex-shrink: 0; }
.fixada strong { font-size: 14px; font-weight: 600; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Box duplo: mesmo arranjo (alfinete ao lado), mas o nome pode ocupar até três linhas. */
.grade-fixadas.n1 .fixada strong, .grade-fixadas.n2 .fixada strong, .grade-fixadas.n3 .fixada:nth-child(3) strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: 15px; }

.avatar { width: 24px; height: 24px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 600; flex-shrink: 0; border: 2px solid var(--branco); }
.avatar.g { width: 32px; height: 32px; border-radius: 16px; font-size: 13px; }
.avatar.ia { width: auto; height: auto; min-width: 14px; background: none !important; border: 0; font-size: 11px; font-weight: 700; }
.avatar.ia.g { width: auto; height: auto; min-width: 18px; font-size: 14px; }
.avatar.ia svg { width: 14px; height: 14px; }
.avatar.ia.g svg { width: 18px; height: 18px; }
.pilha { display: inline-flex; }
.pilha .avatar + .avatar { margin-left: -7px; }
.pilha .avatar.ia + .avatar.ia { margin-left: 6px; }
.pilha .mais-ias { margin-left: 8px; align-self: center; }

.fab { position: fixed; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 20px); width: 58px; height: 58px; border-radius: 29px; border: 0; background: var(--tinta); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 18px rgba(23, 24, 28, 0.25); z-index: 5; }
.perfil-btn { position: relative; border: 0; background: none; padding: 4px; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.selo-num { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--perigo); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--papel); }
.marca.pequena { font-size: 24px; gap: 8px; text-decoration: none; min-height: 44px; }
.item.sem-marca { padding-left: 16px; }
.item.com-ia { padding-left: 12px; gap: 8px; }
.item.perigo { color: var(--perigo); }
.item.perigo svg { stroke: var(--perigo); }
.cartao.convite { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cartao.convite p { margin: 0; font-size: 15px; line-height: 1.5; }
.codigo { margin: 0; font-family: var(--serifa); font-size: 34px; font-weight: 600; letter-spacing: 0.08em; }
.linha-botoes.centro { justify-content: center; }
button.item { width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; background: var(--branco); cursor: pointer; }
label.item { cursor: pointer; }
.item.quebra .item-titulo, .item.quebra .item-sub { white-space: normal; }
.item .entrada { width: auto; min-height: 40px; flex-shrink: 0; }
.item input[type='checkbox'] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--tinta); }

.nota-titulo { width: 100%; border: 0; background: none; padding: 0; margin: 0; resize: none; overflow: hidden; font-family: var(--serifa); font-weight: 600; font-size: 32px; line-height: 1.15; letter-spacing: -0.015em; display: block; }
.nota-titulo:focus { outline: none; }
.editor { outline: none; min-height: 30dvh; font-size: 17px; line-height: 1.55; padding-bottom: 8dvh; }
.editor > :first-child { margin-top: 0; }
.editor > * + * { margin-top: 0.6em; }
.editor p { margin: 0; }
.editor h1, .editor h2, .editor h3 { font-family: var(--serifa); font-weight: 600; line-height: 1.15; margin: 1em 0 0.3em; }
.editor h1 { font-size: 28px; } .editor h2 { font-size: 23px; } .editor h3 { font-size: 19px; }
.editor ul, .editor ol { padding-left: 1.4em; margin: 0; }
.editor li > p { margin: 0; }
.editor ul[data-type='taskList'] { list-style: none; padding-left: 0; }
.editor ul[data-type='taskList'] li { display: flex; gap: 10px; align-items: flex-start; }
.editor ul[data-type='taskList'] li > label { flex-shrink: 0; margin-top: 3px; }
.editor ul[data-type='taskList'] li > label input { width: 20px; height: 20px; accent-color: var(--tinta); }
.editor ul[data-type='taskList'] li > div { flex-grow: 1; min-width: 0; }
.editor ul[data-type='taskList'] li[data-checked='true'] > div { color: var(--suave); text-decoration: line-through; }
.editor blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--dobra); color: var(--tinta-2); }
.editor code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.92em; background: var(--linha-2); padding: 1px 5px; border-radius: 5px; }
.editor pre { background: var(--linha-2); padding: 12px 14px; border-radius: 10px; overflow-x: auto; }
.editor pre code { background: none; padding: 0; }
.editor hr { border: 0; border-top: 1px solid var(--dobra); margin: 1em 0; }
.editor a { color: var(--tinta); text-decoration: underline; text-underline-offset: 3px; }
/* Links internos (D75): abrem a nota; sem acesso (D55), o texto escrito some e fica "sem acesso". */
.editor .link-nota { cursor: pointer; }
.editor .link-nota-oculto { display: none; }
.editor .link-nota.atual { color: var(--tinta); text-decoration: underline; text-underline-offset: 3px; }
.editor .link-nota.sem-acesso { color: var(--suave); font-style: italic; text-decoration: none; cursor: default; }
.editor p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--apagado); pointer-events: none; float: left; height: 0; }
/* Cursores das outras pessoas, com a cor de cada uma (D17/D25). */
.collaboration-carets__caret { position: relative; border-left: 1px solid; border-right: 1px solid; margin-left: -1px; margin-right: -1px; pointer-events: none; word-break: normal; }
.collaboration-carets__label { position: absolute; top: -1.5em; left: -1px; padding: 1px 6px; border-radius: 4px 4px 4px 0; font-size: 11px; font-weight: 600; line-height: 1.4; color: #fff; white-space: nowrap; user-select: none; }
.collaboration-carets__selection { background: rgba(23, 24, 28, 0.14); }
.ferramentas { display: flex; gap: 2px; overflow-x: auto; margin: 0 -16px; padding: 0 12px; border-top: 1px solid var(--linha-2); border-bottom: 1px solid var(--linha-2); scrollbar-width: none; }
.ferramentas::-webkit-scrollbar { display: none; }
.ferramenta { flex-shrink: 0; min-width: 44px; height: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: 10px; background: none; font-weight: 600; font-size: 15px; cursor: pointer; }
.ferramenta.italico { font-style: italic; } .ferramenta.tachado { text-decoration: line-through; } .ferramenta.titulo { font-family: var(--serifa); font-size: 18px; }
.ferramenta.ativo { background: var(--linha-2); border-color: var(--dobra); }
.markdown-cru { width: 100%; min-height: 50dvh; padding: 12px; border: 1px solid var(--linha); border-radius: 12px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 14px; line-height: 1.5; resize: vertical; }
.aviso-offline { color: var(--perigo); }
.pagina-nota .tela { gap: 0; min-height: 100dvh; padding-top: 0; padding-bottom: 0; }
.nota-cabecalho { position: sticky; top: 0; z-index: 4; display: flex; flex-direction: column; gap: 10px; padding: calc(env(safe-area-inset-top) + 12px) 0 12px; border-bottom: 1px solid var(--linha-2); background: var(--branco); }
.nota-editor { flex-grow: 1; padding: 12px 0; }
/* Autoria por bloco (D49): ponto na margem esquerda do bloco; IA: só o contorno. A cor entra pelo CSSOM (a CSP não aceita style em linha). */
.nota-editor .ProseMirror > * { position: relative; }
.autoria-ponto { position: absolute; left: -13px; top: .62em; width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; pointer-events: none; user-select: none; }
.autoria-ponto.ia { border: 2px dashed var(--apagado); background: transparent; width: 10px; height: 10px; left: -14px; top: .55em; }
.autoria-ponto.fixo { position: static; display: inline-block; flex-shrink: 0; }
.autoria-legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 8px 0 0; font-size: 13px; color: var(--suave); }
.autoria-legenda[hidden] { display: none; }
.autoria-legenda-item { display: inline-flex; align-items: center; gap: 6px; }
.nota-rodape { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; min-height: 40px; padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px); border-top: 1px solid var(--linha-2); background: var(--branco); }
.nota-meta .meta-pasta { display: inline-flex; align-items: center; gap: 4px; }
.bolinha { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; background: var(--apagado); }
.bolinha.conectado { background: var(--ok); }
.bolinha.conectando { background: #8A5A00; }
.bolinha.offline { background: var(--perigo); }
.bolinha.sem-acesso { background: var(--apagado); }
.nota-meta { font-size: 13px; color: var(--suave); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagina-nota { background: var(--branco); min-height: 100dvh; }
.selo { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--linha-2); color: var(--tinta-2); }

.folha-fundo { position: fixed; inset: 0; background: rgba(23, 24, 28, 0.45); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.folha { width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; background: var(--branco); border-radius: 20px 20px 0 0; padding: 12px 16px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 16px; }
.folha::before { content: ''; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: #D6D2CA; flex-shrink: 0; }
@media (min-width: 700px) { .folha-fundo { align-items: center; } .folha { border-radius: 20px; } .folha::before { display: none; } }
.sugestoes { display: flex; flex-direction: column; border: 1px solid var(--linha); border-radius: 12px; overflow: hidden; }
.linha-acesso { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.linha-acesso .item-texto { flex-grow: 1; }
.info { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--papel); font-size: 14px; line-height: 1.5; color: var(--tinta-2); }

.entrar { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.entrar-caixa { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.marca { display: flex; align-items: center; gap: 12px; font-family: var(--serifa); font-weight: 600; font-size: 40px; letter-spacing: -0.02em; }
.erro { margin: 0; padding: 12px 14px; border-radius: 10px; background: #F8E9E9; color: var(--perigo); font-size: 14px; }
.sucesso { margin: 0; padding: 12px 14px; border-radius: 10px; background: #E6F1EC; color: var(--ok); font-size: 14px; }

#aviso { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: var(--tinta); color: var(--branco); font-size: 14px; z-index: 20; }
.linha-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
.carregando { padding: 40px 0; text-align: center; color: var(--suave); }
.linha-quem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.linha-quem select { width: auto; }
[hidden] { display: none !important; }
.linha-acesso select { width: auto; flex-shrink: 0; min-height: 40px; }
.linha-acesso .item-titulo, .linha-acesso .item-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* CSS base do ProseMirror (o TipTap injetaria em linha, o que a CSP não permite). */
.ProseMirror { position: relative; word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; }
.ProseMirror pre { white-space: pre-wrap; }
.ProseMirror li { position: relative; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection { caret-color: transparent; }
.ProseMirror [draggable][contenteditable=false] { user-select: text; }
.ProseMirror-selectednode { outline: 2px solid var(--dobra); }
li.ProseMirror-selectednode { outline: none; }
img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; }
.ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--tinta); animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; }
@keyframes ProseMirror-cursor-blink { to { visibility: hidden; } }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }

/* D72: IA suspensa, vista só pela dona. */
.avatar.ia.apagada { opacity: .35; }

/* D80: aviso de IA de outra pessoa na pasta e o que a IA recebe, na tela de autorização. */
.aviso-ia { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.aviso-ia p { margin: 0; }
.consentimento-ia { display: flex; flex-direction: column; gap: 6px; }
.consentimento-ia p { margin: 0; }
