/* As Notas do app Projetos (notas.js): o campo de anotar, o mosaico no jeito do Keep e a nota aberta. Materiais do sistema (cosmos.css). */

/* ---------------------------------------------------------------- as dez cores
   --nt-tinta é o fundo da nota. No escuro, um véu de cor por cima do vidro; no claro, tons pastel chapados. Nada de neon. */
.nt-cor-nenhuma { --nt-tinta: rgba(var(--f), .085); }
.nt-cor-coral { --nt-tinta: rgba(232, 116, 98, .25); }
.nt-cor-pessego { --nt-tinta: rgba(232, 158, 102, .23); }
.nt-cor-areia { --nt-tinta: rgba(214, 190, 118, .21); }
.nt-cor-menta { --nt-tinta: rgba(96, 196, 154, .2); }
.nt-cor-salvia { --nt-tinta: rgba(146, 174, 126, .22); }
.nt-cor-nevoa { --nt-tinta: rgba(116, 164, 220, .22); }
.nt-cor-lavanda { --nt-tinta: rgba(156, 138, 228, .24); }
.nt-cor-rosa { --nt-tinta: rgba(222, 126, 172, .22); }
.nt-cor-grafite { --nt-tinta: rgba(6, 8, 12, .4); }
:root[data-tema="claro"] .nt-cor-nenhuma { --nt-tinta: rgba(255, 255, 255, .82); }
:root[data-tema="claro"] .nt-cor-coral { --nt-tinta: #f6d5cd; }
:root[data-tema="claro"] .nt-cor-pessego { --nt-tinta: #f9dfca; }
:root[data-tema="claro"] .nt-cor-areia { --nt-tinta: #f3e8c4; }
:root[data-tema="claro"] .nt-cor-menta { --nt-tinta: #d2ecdf; }
:root[data-tema="claro"] .nt-cor-salvia { --nt-tinta: #dfe8d4; }
:root[data-tema="claro"] .nt-cor-nevoa { --nt-tinta: #d6e3f0; }
:root[data-tema="claro"] .nt-cor-lavanda { --nt-tinta: #e3dcf3; }
:root[data-tema="claro"] .nt-cor-rosa { --nt-tinta: #f3d9e5; }
:root[data-tema="claro"] .nt-cor-grafite { --nt-tinta: #dcdee3; }
/* na paleta, a bolinha do escuro mostra o tom com mais corpo, para dar para reconhecer a cor (no claro, é o próprio pastel) */
.c-tinta.nt-cor-coral { --nt-amostra: rgba(232, 116, 98, .55); }
.c-tinta.nt-cor-pessego { --nt-amostra: rgba(232, 158, 102, .55); }
.c-tinta.nt-cor-areia { --nt-amostra: rgba(214, 190, 118, .5); }
.c-tinta.nt-cor-menta { --nt-amostra: rgba(96, 196, 154, .5); }
.c-tinta.nt-cor-salvia { --nt-amostra: rgba(146, 174, 126, .55); }
.c-tinta.nt-cor-nevoa { --nt-amostra: rgba(116, 164, 220, .55); }
.c-tinta.nt-cor-lavanda { --nt-amostra: rgba(156, 138, 228, .55); }
.c-tinta.nt-cor-rosa { --nt-amostra: rgba(222, 126, 172, .55); }
.c-tinta.nt-cor-grafite { --nt-amostra: rgba(6, 8, 12, .7); }
:root[data-tema="claro"] .c-tinta { --nt-amostra: var(--nt-tinta); }

/* na lateral do Projetos, as Notas ficam logo abaixo das listas de tarefas, um pouco afastadas delas */
.pj-item.pj-notas { margin-top: 4px; }

/* ---------------------------------------------------------------- a vista: campo de anotar, filtros e mosaico */
.nt { flex: 1; min-height: 0; scrollbar-gutter: stable; overflow-y: auto; overscroll-behavior: contain; padding: 2px 12px 18px; }
.nt-chips { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.nt-filtros { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.nt-filtros::-webkit-scrollbar { display: none; }
.nt-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 28px; padding: 0 11px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--tinta-2); background: rgba(var(--f), .07); cursor: pointer; transition: background-color .14s ease, color .14s ease; }
.nt-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-chip .ico { color: var(--tinta-3); }
.nt-chip.on { color: var(--tinta); background: rgba(var(--f), .17); }
.nt-chip.on .ico { color: var(--tinta-2); }
.nt-chip:active { transform: scale(.97); }

/* o campo de anotar: fechado é uma linha; com o cursor, abre título, texto (ou lista) e as ações */
.nt-compor { position: relative; display: flex; align-items: center; gap: 4px; width: min(600px, 100%); margin: 6px auto 16px; padding: 3px 5px 3px 16px; border-radius: 8px; color: var(--tinta); background-color: var(--nt-tinta); box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(var(--f), .07); outline: none; cursor: text; transition: box-shadow .18s ease, background-color .18s ease; }
.nt-compor.aberta { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 8px 6px 16px; box-shadow: 0 14px 34px -16px rgba(0, 0, 0, .7), 0 0 0 1px rgba(var(--f), .12); cursor: default; }
.nt-compor .nt-corpo { flex: 1; min-width: 0; }
.nt-compor:not(.aberta) .nt-texto { padding: 9px 0; }
.nt-compor.aberta .nt-texto { min-height: 46px; }
.nt-compor.aberta .nt-compor-lista { display: none; }
.nt-compor .nt-pe { display: flex; align-items: center; gap: 2px; margin: 6px -2px 0 -8px; }
.nt-compor .nt-pe[hidden] { display: none; }
.nt-compor-tags { display: flex; gap: 4px; min-width: 0; margin-left: 6px; overflow: hidden; }
:root[data-tema="claro"] .nt-compor { box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .06); }

/* os campos de escrever não têm contorno: a nota inteira é o campo */
.nt-titulo, .nt-texto, .nt-item-t, .nt-item-novo input { display: block; width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; outline: 0; resize: none; overflow: hidden; font: inherit; color: var(--tinta); background: none; box-shadow: none; }
.nt-titulo { font-size: 16px; font-weight: 600; line-height: 1.35; padding: 4px 0; }
.nt-texto { font-size: 14.5px; line-height: 1.5; padding: 4px 0; }
.nt-titulo::placeholder, .nt-texto::placeholder, .nt-item-novo input::placeholder { color: var(--tinta-3); opacity: 1; }
.nt-titulo:focus-visible, .nt-texto:focus-visible, .nt-item-t:focus-visible, .nt-item-novo input:focus-visible { box-shadow: none; }

/* a lista de marcar */
.nt-itens { display: flex; flex-direction: column; padding: 2px 0; }
.nt-item { display: flex; align-items: flex-start; gap: 8px; min-height: 30px; }
.nt-item-t { flex: 1; font-size: 14.5px; line-height: 1.45; padding: 4px 0; }
.nt-item.ok .nt-item-t { color: var(--tinta-3); text-decoration: line-through; }
.nt-caixa { flex: none; position: relative; display: grid; place-items: center; width: 26px; height: 28px; margin: 0 -4px 0 -6px; border-radius: 6px; cursor: pointer; }
.nt-caixa::before { content: ""; width: 16px; height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px rgba(var(--f), .5); transition: background-color .14s ease, box-shadow .14s ease; }
.nt-item.ok .nt-caixa::before { box-shadow: none; background: rgba(var(--f), .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.400' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.500 12.500 3.500 3.500 7.500-8'/%3E%3C/svg%3E") center / 12px no-repeat; }
:root[data-tema="claro"] .nt-item.ok .nt-caixa::before { background-color: rgba(0, 0, 0, .45); }
.nt-item-x { flex: none; display: grid; place-items: center; width: 26px; height: 28px; border-radius: 6px; color: var(--tinta-3); opacity: 0; transition: opacity .14s ease, background-color .14s ease; }
.nt-item:hover .nt-item-x, .nt-item:focus-within .nt-item-x { opacity: 1; }
.nt-item-novo { align-items: center; color: var(--tinta-3); cursor: text; }
.nt-item-novo > .ico { flex: none; width: 26px; margin: 0 -4px 0 -6px; padding: 0 4px 0 5px; }
.nt-item-novo input { flex: 1; height: 30px; font-size: 14.5px; }
.nt-feitos { display: flex; flex-direction: column; margin-top: 6px; padding-top: 4px; border-top: 1px solid rgba(var(--f), .12); }
.nt-marcados { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 2px; margin-left: -4px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--tinta-3); cursor: pointer; }
.nt-marcados .ico { transition: transform .18s var(--ease-out); }
.nt-marcados[aria-expanded="true"] .ico { transform: rotate(90deg); }

/* o mosaico: as colunas são montadas pelo notas.js, cada nota entra na coluna mais baixa */
.nt-secao + .nt-secao { margin-top: 20px; }
.nt-secao > h3 { margin: 0 0 8px 4px; }
.nt-mosaico { position: relative; display: flex; align-items: flex-start; gap: 10px; }
.nt-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.nt-medidor { position: absolute; left: 0; top: 0; flex: none; visibility: hidden; pointer-events: none; }
.nt-fantasmas { gap: 10px; }
.nt-fantasmas .pj-fantasma { flex: 1; height: 120px; }
.nt-vazio { padding: 40px 0; }
.nt-estado { padding: 40px 0; }

/* o cartão da nota */
.nt-nota { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px 14px 12px; border-radius: 8px; color: var(--tinta); background-color: var(--nt-tinta); box-shadow: 0 1px 2px rgba(0, 0, 0, .24); cursor: pointer; outline: none; overflow: hidden; transition: box-shadow .16s ease, background-color .16s ease, opacity .16s ease; }
.nt-nota:has(> .nt-barra) { padding-bottom: 4px; }
.nt-nota > * { flex-shrink: 0; } /* o que corta o texto longo é o limite de linhas, nunca o encolhimento */
:root[data-tema="claro"] .nt-nota { box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 1px rgba(0, 0, 0, .05); }
.nt-nota:focus-visible { box-shadow: 0 0 0 1.5px rgba(var(--f), .55); }
.nt-nota.arrastando { opacity: .35; }
.nt-nota.arrastando > * { visibility: hidden; }
.nt-ao-lado { padding-right: 24px; }
.nt-nota-titulo { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.nt-nota-texto { display: -webkit-box; -webkit-line-clamp: 12; -webkit-box-orient: vertical; overflow: hidden; margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.nt-nota-itens { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.nt-nota-itens li { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 1.4; }
.nt-nota-itens li > span { min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.nt-nota .nt-caixa { width: 22px; height: 22px; margin: -1px -3px 0 -4px; }
.nt-nota .nt-caixa::before { width: 14px; height: 14px; }
.nt-mais { margin: -2px 0 0; padding-left: 21px; font-size: 12.5px; font-weight: 600; color: var(--tinta-3); }
.nt-nota-vazia { margin: 0; font-size: 14px; color: var(--tinta-3); }
.nt-nota-marcas { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.nt-tag, .nt-de, .nt-selo { min-width: 0; max-width: 100%; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 5px; font-style: normal; font-size: 12px; font-weight: 500; line-height: 22px; color: var(--tinta); background: rgba(var(--f), .12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-de, .nt-selo { color: var(--tinta-2); }
.nt-de > span, .nt-selo > span, .nt-tag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nt-selo { font-weight: 600; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
button.nt-selo, button.nt-tag { cursor: pointer; transition: background-color .14s ease, color .14s ease; }
:root[data-tema="claro"] :is(.nt-tag, .nt-de, .nt-selo) { background: rgba(0, 0, 0, .07); }

/* as ações: o alfinete no canto e a barra de baixo, que aparecem com o mouse em cima */
.nt-acao { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; color: var(--tinta-2); cursor: pointer; transition: background-color .14s ease, color .14s ease, opacity .14s ease; }
.nt-acao:active { transform: scale(.94); }
.nt-acao[aria-expanded="true"] { color: var(--tinta); background: rgba(var(--f), .14); }
.nt-nota > .nt-fixa { position: absolute; top: 5px; right: 5px; width: 30px; height: 30px; opacity: 0; }
.nt-fixa.on { color: var(--tinta); }
.nt-nota > .nt-fixa.on, .nt-nota:hover > .nt-fixa, .nt-nota:focus-within > .nt-fixa { opacity: 1; }
/* o alfinete mora no canto de cima: a primeira peça da nota (o título, ou o texto quando não há título) termina antes dele */
.nt-nota > .nt-fixa + * { padding-right: 22px; }
.nt-barra { display: flex; align-items: center; gap: 1px; margin: -3px -10px -1px; opacity: 0; transition: opacity .14s ease; }
.nt-nota:hover .nt-barra, .nt-nota:focus-within .nt-barra, .nt-barra:has([aria-expanded="true"]) { opacity: 1; }
.nt-barra .nt-acao { width: 30px; height: 28px; }
.nt-compor-lista { width: 36px; height: 36px; }

/* arrastar: o cartão voa com o cursor e a nota mostra onde vai cair */
.pj.nt-arrastando, .pj.nt-arrastando * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.nt-voando { position: absolute; z-index: 7; margin: 0; pointer-events: none; box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7); will-change: transform; }
.nt-voando .nt-barra, .nt-voando .nt-fixa:not(.on) { opacity: 0; }

/* o bloco da ficha do cliente: as primeiras notas, lado a lado */
.nt-ficha-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; align-items: start; }
.nt-ficha .nt-nota-texto { -webkit-line-clamp: 6; }
.nt-ficha .nt-nota-titulo { -webkit-line-clamp: 2; }
.nt-ficha-pe { display: flex; align-items: center; gap: 4px; margin: 8px 0 -4px -8px; }
.nt-ficha-pe .pj-novo { width: auto; }
.nt-ver small { margin-left: 2px; font-size: 12px; color: var(--tinta-3); }

/* ---------------------------------------------------------------- a nota aberta: uma folha na cor da nota, por cima do app */
/* sem vidro (backdrop-filter) aqui dentro: a janela já é vidro, e vidro dentro de vidro faz a placa de vídeo recompor o fundo a cada troca (a "tarja"). A folha por cima já é quase opaca. */
.nt-veu { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px; background: var(--veu); animation: pj-veu .16s ease; }
.nt-veu[hidden] { display: none; }
.nt-folha { position: relative; isolation: isolate; display: flex; flex-direction: column; width: min(640px, 100%); max-height: min(720px, 100%); border-radius: 10px; color: var(--tinta); background: var(--sup-folha); box-shadow: var(--brilho), 0 30px 70px -24px rgba(0, 0, 0, .8); overflow: hidden; outline: none; animation: pj-folha .2s var(--ease-out); }
.nt-folha::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--nt-tinta); pointer-events: none; }
.nt-folha.nt-cor-nenhuma::before { display: none; }
.nt-folha.sem-entrada { animation: none; }
.nt-folha-cab { flex: none; display: flex; align-items: flex-start; gap: 6px; padding: 14px 10px 0 20px; }
.nt-folha-cab .nt-titulo { flex: 1; font-size: 19px; letter-spacing: -.01em; padding: 3px 0; }
.nt-folha-cab .nt-fixa { margin-top: -1px; }
.nt-folha-rolo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 14px; }
.nt-folha .nt-texto { min-height: 120px; font-size: 15px; }
.nt-folha-marcas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.nt-folha-marcas:empty { display: none; }
.nt-folha-marcas :is(.nt-tag, .nt-selo, .nt-ligar) { height: 28px; padding: 0 10px; font-size: 12.5px; line-height: 28px; border-radius: 6px; }
.nt-ligar { min-width: 0; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--tinta-2); background: rgba(var(--f), .12); white-space: nowrap; cursor: pointer; transition: background-color .14s ease, color .14s ease; }
.nt-ligar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nt-ligar.vazia { color: var(--tinta-3); background: rgba(var(--f), .07); }
.nt-ligar[aria-expanded="true"], .nt-tag-botao[aria-expanded="true"] { color: var(--tinta); background: rgba(var(--f), .2); }
.nt-folha-pe { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 12px 10px 12px; }
.nt-folha-acoes { display: flex; align-items: center; gap: 2px; min-width: 0; }
.nt-editada { flex: none; margin: 0 8px; font-size: 12px; color: var(--tinta-3); white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .nt-chip:not(.on):hover { color: var(--tinta); background: rgba(var(--f), .12); }
  .nt-nota:hover { box-shadow: 0 8px 22px -10px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--f), .12); }
  :root[data-tema="claro"] .nt-nota:hover { box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .08); }
  .nt-acao:hover, .nt-item-x:hover, .nt-marcados:hover { color: var(--tinta); background: rgba(var(--f), .12); }
  .nt-caixa:hover::before { box-shadow: inset 0 0 0 1.5px var(--tinta); }
  button.nt-selo:hover, button.nt-tag:hover, .nt-ligar:hover { color: var(--tinta); background: rgba(var(--f), .2); }
  .nt-ligar.vazia:hover { background: rgba(var(--f), .14); }
}
.nt :is(.nt-chip, .nt-acao, .nt-caixa, .nt-selo, .nt-item-x, .nt-marcados):focus-visible,
.nt-veu :is(.nt-acao, .nt-caixa, .nt-selo, .nt-tag-botao, .nt-ligar, .nt-item-x, .nt-marcados):focus-visible,
.nt-ficha .nt-nota:focus-visible { outline: none; box-shadow: 0 0 0 1.5px rgba(var(--f), .55); }
.nt-folha:focus-visible { outline: none; }

/* no toque, nada aparece só com o mouse: o cartão abre a nota, e lá as ações ficam à vista */
@media (hover: none) { .nt-barra, .nt-nota > .nt-fixa:not(.on) { display: none; } .nt-nota > .nt-fixa:not(.on) + * { padding-right: 0; } }

@media (max-width: 860px) {
  .nt { padding: 2px 8px 18px; }
  .nt-chips { margin-bottom: 10px; }
  .nt-chip { height: 36px; padding: 0 12px; font-size: 14px; }
  .nt-compor { margin: 4px 0 12px; width: 100%; padding-left: 14px; }
  .nt-compor:not(.aberta) .nt-texto { padding: 10px 0; }
  .nt-titulo { font-size: 17px; }
  .nt-texto, .nt-item-t, .nt-item-novo input { font-size: 16px; }
  .nt-acao, .nt-compor-lista { width: 38px; height: 38px; }
  .nt-mosaico, .nt-col { gap: 8px; }
  .nt-nota { padding: 11px 12px; gap: 6px; }
  .nt-nota-titulo { font-size: 15px; }
  .nt-nota-texto, .nt-nota-itens li { font-size: 14px; }
  .nt-nota-texto { -webkit-line-clamp: 10; }
  .nt-ficha-grade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nt-ficha-pe { margin: 8px 0 -4px -8px; }
  .nt-itens, .nt-feitos { gap: 4px; }
  .nt-item { min-height: 40px; }
  .nt-caixa { width: 38px; height: 40px; margin: 0 -8px 0 -10px; }
  .nt-caixa::before { width: 19px; height: 19px; }
  .nt-nota .nt-caixa { width: 20px; height: 20px; margin: 0 -2px 0 -3px; }
  .nt-nota .nt-caixa::before { width: 14px; height: 14px; }
  .nt-item-t { padding: 8px 0; }
  .nt-item-x { width: 38px; height: 40px; opacity: 1; }
  .nt-item-novo > .ico { width: 38px; margin: 0 -8px 0 -10px; padding: 0 10px 0 11px; }
  .nt-item-novo input { height: 40px; }
  .nt-marcados { height: 40px; font-size: 14px; }
  .nt-veu { padding: 0; }
  /* na tela inteira, a folha é chapada: o mosaico de trás não aparece por baixo do que se lê */
  .nt-folha { width: 100%; height: 100%; max-height: none; border-radius: 0; background: rgb(31, 37, 47); animation-name: nt-sobe; }
  :root[data-tema="claro"] .nt-folha { background: rgb(250, 250, 252); }
  .nt-folha-cab { padding: 6px 8px 0 6px; align-items: center; }
  .nt-folha-cab .redondo.so-celular { flex: none; justify-content: center; width: 40px; height: 40px; background: none; }
  .nt-folha-cab .nt-titulo { font-size: 19px; padding: 8px 0; }
  .nt-folha-rolo { padding: 4px 16px 16px; }
  .nt-folha-marcas :is(.nt-tag, .nt-selo, .nt-ligar) { height: 36px; line-height: 36px; padding: 0 12px; font-size: 14px; }
  .nt-folha-pe { padding: 4px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -1px 0 rgba(var(--f), .08); }
  .nt-folha-acoes { gap: 0; }
  .nt-editada { margin: 0 6px; }
}
@keyframes nt-sobe { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { .nt-veu, .nt-folha { animation: none; } .nt-marcados .ico { transition: none; } }
