/* Lista estilo Monday (tabela.js), Kanban e editores por tipo. Só tokens do base.css.
   Cores de opção e de etapa (Opcao.cor): --op-* do app.css. */
:root {
  --linha-hover: linear-gradient(rgba(164,189,248,.12), rgba(164,189,248,.12)), var(--surface);
}
.op { background: var(--c, var(--op-neutro)); }
.chips { display: flex; gap: 4px; overflow: hidden; }

/* ------------------------------------------------------------ barra de filtros */
.grade-barra { margin: 0 0 12px; }
.grade-barra .busca { margin-left: 0; }
.grade-barra .busca input { width: 240px; }
.grade-barra .combo-botao { min-width: 0; }
.grade-barra .fantasma .n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r); display: inline-grid; place-items: center; background: var(--blue-soft); font-size: 10.5px; font-weight: 600; }
.chip.ativo svg.i { fill: var(--blue); stroke: var(--blue); }

/* ------------------------------------------------------------ grade */
.grade { position: relative; overflow: auto; max-height: calc(100vh - 250px); min-height: 220px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-card); }
.grade table { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.grade th, .grade td { padding: 0; text-align: left; border-bottom: 1px solid var(--line); }
.grade td:last-child, .grade th:last-child { text-align: left; }
.grade th { position: sticky; top: 0; z-index: 3; height: 38px; background: var(--surface); border-right: 1px solid var(--line); }
.grade td { position: relative; height: 40px; border-right: 1px solid var(--line); font-size: 12.5px; color: var(--ink); background: var(--surface); }
.grade tbody tr { cursor: default; border: 0; }
.grade tbody tr:hover { background: none; }
.grade tbody tr:hover > td { background: var(--linha-hover); }
.grade tr.marcada > td { background: linear-gradient(rgba(164,189,248,.24), rgba(164,189,248,.24)), var(--surface); }
.grade .fixa { position: sticky; left: 0; z-index: 2; box-shadow: inset 3px 0 0 var(--cor, transparent); }
.grade th.fixa { z-index: 4; box-shadow: none; }
.cab-fixa, .nome-cel { display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 10px 0 14px; }
@media (max-width: 640px) { .cab-fixa, .nome-cel { gap: 6px; padding: 0 6px 0 10px; } .coments { display: none; } }
.cab-fixa { font: 600 10.5px/1.5 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); }

/* Cabeçalho de coluna: arrastar para reordenar, borda para redimensionar, menu */
.cab { display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 4px 0 10px; cursor: grab; font: 600 10.5px/1.5 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); }
.cab .rot { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cab .ordem { width: 13px; height: 13px; color: var(--ink); }
.cab .icone { width: 24px; height: 24px; opacity: 0; transition: opacity .15s var(--ease); }
.cab .icone svg.i { width: 14px; height: 14px; }
th:hover .cab .icone, .cab .icone:focus-visible, .cab .icone[aria-expanded="true"] { opacity: 1; }
.grade th.solta { box-shadow: inset 2px 0 0 var(--blue-ink); }
.borda { position: absolute; top: 0; right: -4px; z-index: 1; width: 8px; height: 100%; cursor: col-resize; }
.borda:hover, .borda.ativa { background: linear-gradient(90deg, transparent 3px, var(--blue-ink) 3px, var(--blue-ink) 5px, transparent 5px); }
th.mais-col .icone { margin: 0 auto; }

/* Primeira coluna: seleção, alça, nome, destaque, comentários */
.nome-cel .alca { display: grid; place-items: center; width: 14px; margin: 0 -4px; color: var(--ink-mute); cursor: grab; opacity: 0; }
tr:hover .nome-cel .alca { opacity: 1; }
.nome-cel .alca svg.i { width: 14px; height: 14px; }
.nome-cel .nome { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: 500 13px var(--font-body); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.nome-cel .nome:hover { color: var(--blue-ink); }
.destaque-botao { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--ink-mute); cursor: pointer; }
.destaque-botao:hover { background: var(--hover); color: var(--ink); }
.destaque-botao svg.i { width: 15px; height: 15px; }
.destaque-botao.ligada svg.i, .estrelas .cheia svg.i, .kc-topo .estrela-on { fill: var(--blue); stroke: var(--blue-ink); }
.coments { display: inline-flex; align-items: center; gap: 3px; min-width: 30px; font-size: 11.5px; color: var(--ink-mute); }
.coments svg.i { width: 13px; height: 13px; }
.coments.zero { opacity: .45; }

/* Células */
.cel .v { display: flex; align-items: center; gap: 4px; height: 39px; padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.cel.leitura .v { cursor: default; color: var(--ink-soft); }
.cel .v > span:not(.pilula):not(.chips):not(.estrelas) { overflow: hidden; text-overflow: ellipsis; }
.cel:not(.leitura):hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.cel a, .valor-caixa a { color: var(--blue-ink); overflow: hidden; text-overflow: ellipsis; }
.cel a:hover, .valor-caixa a:hover { text-decoration: underline; }
/* Todos os tipos alinham à esquerda (célula, cabeçalho e editores). */
.t-numero .v, .t-pretensao .v { font-variant-numeric: tabular-nums; }
.estrelas { display: inline-flex; gap: 0; }
.estrelas button { display: grid; place-items: center; width: 20px; height: 24px; padding: 0; border: 0; background: none; color: var(--ink-mute); cursor: pointer; }
.estrelas button svg.i { width: 15px; height: 15px; }
.estrelas .cheia { color: var(--blue-ink); }
.cel .v > a, .valor-caixa > a { min-width: 0; white-space: nowrap; }
.lapis { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-left: auto; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--ink-mute); cursor: pointer; opacity: 0; transition: opacity .15s var(--ease); }
.lapis svg.i { width: 13px; height: 13px; }
.lapis:hover { background: var(--hover); color: var(--ink); }
.cel:hover .lapis, .valor-caixa:hover .lapis, .lapis:focus-visible { opacity: 1; }
a.arquivos-cel { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border-radius: var(--r); color: var(--blue-ink); }
a.arquivos-cel:hover { background: var(--hover); text-decoration: none; }
.arquivos-cel svg.i { width: 16px; height: 16px; }
.arquivos-cel small { font-size: 10.5px; font-weight: 600; }
.enviando { position: absolute; left: 6px; right: 6px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; pointer-events: none; }
.enviando i { display: block; width: 0; height: 100%; background: var(--blue-ink); transition: width .15s var(--ease); }
.grade tr.solta > td { background: linear-gradient(rgba(164,189,248,.32), rgba(164,189,248,.32)), var(--surface); box-shadow: inset 0 1px 0 var(--blue-ink), inset 0 -1px 0 var(--blue-ink); }
.editor-texto { position: absolute; inset: 2px; z-index: 5; width: calc(100% - 4px); height: calc(100% - 4px); padding: 0 8px; border: 1px solid var(--blue-ink); border-radius: var(--r); box-shadow: var(--shadow-focus); background: var(--surface); font: 12.5px var(--font-body); color: var(--ink); outline: none; }

/* Grupos (etapas) */
.grupo-cabeca td { height: 46px; border-bottom: 1px solid var(--line); background: var(--surface); }
.grupo-cabeca:hover > td { background: var(--surface) !important; }
.grupo-nome { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; }
.grupo-nome .alternador { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--ink-soft); cursor: pointer; }
.grupo-nome .alternador:hover { background: var(--hover); }
.grupo-nome .alternador svg.i { width: 15px; height: 15px; transition: transform .15s var(--ease); }
.recolhido .grupo-nome .alternador svg.i { transform: rotate(-90deg); }
.grupo-nome .pilula { font-size: 12.5px; font-weight: 600; padding: 4px 12px; }
.grupo-nome .n { font-size: 12px; color: var(--ink-mute); }
.grupo-nome .icone { width: 26px; height: 26px; }
.grupo-nome .icone svg.i { width: 15px; height: 15px; }
tbody.solta .grupo-cabeca td { box-shadow: inset 0 -2px 0 var(--blue-ink); }
.grupo-rodape td { height: 36px; }
.grupo-rodape:hover > td { background: var(--surface) !important; }
.adicionar-linha { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 40px; border: 0; background: none; font: 500 12.5px var(--font-body); color: var(--ink-mute); cursor: pointer; }
.adicionar-linha:hover { color: var(--blue-ink); }
.adicionar-linha svg.i { width: 14px; height: 14px; }
.grupo-espaco td { height: 18px; border-bottom: 0; background: var(--canvas); }
.grupo-espaco:hover > td { background: var(--canvas) !important; }
.grade-vazia { padding: 40px 20px; text-align: center; font-size: 13px; color: var(--ink-mute); }

/* Barra flutuante de ações em massa */
.massa { position: fixed; z-index: 45; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-pop); overflow-x: auto; scrollbar-width: none; }
.massa[hidden] { display: none; }
.massa strong { font-size: 13px; font-weight: 600; white-space: nowrap; margin-right: 6px; }

/* ------------------------------------------------------------ popovers e editores */
/* Só o campo de digitar ganha o anel: o .editor:focus-within de processo-abas.css não vale para o popover. */
.popover.editor, .popover.editor:focus-within { border-color: var(--line); box-shadow: var(--shadow-pop); overflow-y: auto; }
.popover.editor { position: fixed; z-index: 80; width: auto; min-width: 220px; max-width: min(360px, calc(100vw - 24px)); max-height: min(420px, 70vh); padding: 6px; }
.popover.editor.largo { width: min(460px, calc(100vw - 24px)); max-width: none; }
.popover.editor .calendario { width: 100%; min-width: 284px; box-shadow: none; border: 0; padding: 6px; }
.editor-corpo .linha .combo-botao { min-width: 0; }
.menu { display: flex; flex-direction: column; gap: 1px; }
.menu > button, .menu > a, .opcao-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; font: 500 13px var(--font-body); color: var(--ink-soft); text-align: left; cursor: pointer; }
.menu > button:hover, .menu > a:hover, .opcao-item:hover { background: var(--hover); color: var(--ink); }
.menu > button svg.i, .menu > a svg.i { width: 15px; height: 15px; }
.menu > .perigo { color: var(--negative); }
.menu > .separa { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.menu-rotulo { padding: 8px 10px 4px; font: 600 10.5px/1.5 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); }
.opcao-item { font-weight: 400; }
.opcao-item.escolhido { background: var(--blue-wash); }
.editor-corpo { display: flex; flex-direction: column; gap: 10px; padding: 8px; }
.editor-corpo .campo { margin-top: 0; }
.editor-corpo .linha { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.editor-corpo .acoes { display: flex; justify-content: flex-end; gap: 8px; }
.editor-arquivos { display: flex; flex-direction: column; gap: 2px; }
.editor-arquivos .arq { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r); font-size: 12.5px; }
.editor-arquivos .arq:hover { background: var(--hover); }
.editor-arquivos .arq a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue-ink); }
.editor-arquivos .arq small { color: var(--ink-mute); }
.zona input[type=file] { display: none; }
.zona.solta { background: rgba(185,206,255,.36); }
.zona .barra-prog { margin-top: 10px; }
.vazio-editor { padding: 10px; font-size: 12px; color: var(--ink-mute); }
.cores { display: flex; gap: 6px; flex-wrap: wrap; }
.cores button { width: 22px; height: 22px; padding: 0; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--c); cursor: pointer; }
.cores button.escolhido { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
.texto-pequeno { font-size: 11.5px; color: var(--ink-mute); }
.filtro-linha { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r); background: var(--canvas); font-size: 12.5px; }
.filtro-linha span { flex: 1; }
.filtro-linha .icone { width: 26px; height: 26px; }
.filtro-linha .icone svg.i { width: 14px; height: 14px; }
.editor-corpo .campo-data input { height: 34px; }
.editor-corpo input.simples, .janela input.simples { height: 34px; width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); padding: 0 10px; font: 12.5px var(--font-body); color: var(--ink); }
.editor-corpo input.simples:focus, .janela input.simples:focus { outline: none; border-color: var(--blue-ink); box-shadow: var(--shadow-focus); }

/* ------------------------------------------------------------ Kanban */
.kanban { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kanban-coluna { flex: none; width: 272px; display: flex; flex-direction: column; max-height: calc(100vh - 250px); border: 1px solid var(--line); border-radius: var(--r); background: rgba(24,24,24,.025); box-shadow: inset 0 3px 0 var(--cor); }
.kanban-coluna.solta { box-shadow: inset 0 3px 0 var(--cor), 0 0 0 1.5px var(--blue-ink); }
.kanban-cabeca { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.kanban-cabeca strong { font: 450 15px/1.2 var(--font-display); letter-spacing: -.02em; }
.kanban-cabeca .n { margin-left: auto; font-size: 12px; color: var(--ink-mute); }
.kanban-cabeca .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--cor); box-shadow: inset 0 0 0 1px rgba(24,24,24,.12); }
.kanban-cartoes { display: flex; flex-direction: column; gap: 8px; min-height: 60px; padding: 0 10px 12px; overflow-y: auto; scrollbar-width: none; }
.kanban-cartao { padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-card); cursor: grab; transition: box-shadow .15s var(--ease); }
.kanban-cartao:hover { box-shadow: 0 0 0 1.5px var(--blue), var(--shadow-card); }
.kanban-cartao.arrastando { opacity: .5; }
.kc-topo { display: flex; align-items: center; gap: 6px; }
.kc-topo strong { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-topo svg.i { width: 15px; height: 15px; color: var(--blue-ink); }
.kc-campo { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.kc-campo > span:first-child { color: var(--ink-mute); flex: none; }
.kc-campo > :last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-vazio { padding: 10px 4px; font-size: 12px; color: var(--ink-mute); text-align: center; }

/* ------------------------------------------------------------ janelas (janelas.js) */
[hidden] { display: none !important; }
.botao:disabled { opacity: .45; cursor: not-allowed; }
.janela.larga { width: min(680px, calc(100vw - 24px)); }
.janela.nova-coluna { width: min(720px, calc(100vw - 24px)); }
.janela form > .campo:first-of-type { margin-top: 18px; }
.janela .combo-botao { width: 100%; }
.janela p.erro { margin-top: 12px; color: var(--negative); }
.janela .opcao { margin-top: 16px; }
.janela .nota { margin-top: 12px; }
.janela .acoes { flex-wrap: wrap; }
.menu > button.escolhido { background: var(--blue-wash); color: var(--ink); }
.opcao-edicao { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.opcao-edicao input { flex: 1; min-width: 0; }
.opcao-edicao { padding: 2px; border-radius: var(--r); }
.opcao-edicao.solta { box-shadow: inset 0 2px 0 var(--blue-ink); }
.alca-op { flex: none; display: grid; place-items: center; width: 22px; height: 30px; border-radius: var(--r); color: var(--ink-mute); cursor: grab; }
.alca-op:hover, .alca-op:focus-visible { background: var(--hover); color: var(--ink); outline: none; box-shadow: var(--shadow-focus); }
.alca-op svg.i { width: 14px; height: 14px; }
.tipos-coluna { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.tipo-cartao { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.tipo-cartao:hover { background: var(--hover); }
.tipo-cartao input { position: absolute; opacity: 0; pointer-events: none; }
.tipo-cartao svg.i { width: 16px; height: 16px; color: var(--ink-soft); }
.tipo-cartao strong { font-size: 12.5px; font-weight: 600; }
.tipo-cartao span { grid-column: 2; font-size: 11.5px; line-height: 1.4; color: var(--ink-mute); }
.tipo-cartao:has(input:checked) { border-color: var(--blue-ink); background: var(--blue-wash); }
.tipo-cartao:has(input:checked) svg.i { color: var(--blue-ink); }
.tipo-cartao:has(input:focus-visible) { box-shadow: var(--shadow-focus); }
.nova-coluna .grupo-tipos { padding-left: 0; margin-top: 16px; }
.grupo-tipos + .tipos-coluna { margin-top: 6px; }
button.tipo-cartao { width: 100%; background: none; font: inherit; color: inherit; text-align: left; }
button.tipo-cartao:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
button.tipo-cartao:disabled { opacity: .6; cursor: progress; }
.janela [data-opcoes] .menu-rotulo { margin-top: 14px; }
.mapa, .previa table { width: 100%; }
.mapa td { padding: 6px 12px 6px 0; vertical-align: middle; font-size: 12.5px; color: var(--ink); }
.mapa td:last-child { width: 50%; padding-right: 0; text-align: left; }
.mapa tbody tr, .previa tbody tr { cursor: default; }
.mapa tbody tr:hover, .previa tbody tr:hover { background: none; }
.mapa .texto-pequeno { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.previa { margin-top: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.previa th, .previa td { padding: 8px 12px; white-space: nowrap; font-size: 12px; text-align: left; }
.previa td:last-child, .previa th:last-child { text-align: left; padding-right: 12px; }
.resultado { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.resultado span { font-size: 11.5px; color: var(--ink-mute); }
.resultado .num { display: block; font-size: 24px; color: var(--ink); }
.erros-importar { margin: 12px 0 0; padding: 0; list-style: none; max-height: 180px; overflow-y: auto; font-size: 12px; color: var(--ink-82); }
.erros-importar li { padding: 4px 0; border-bottom: 1px solid var(--line); }

/* ------------------------------------------------------------ tela do processo e do banco */
.topo .meta { flex-wrap: wrap; }
.topo .meta svg.i { width: 14px; height: 14px; }
.topo .meta a, .topo .meta button.link { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; font: inherit; color: var(--blue-ink); cursor: pointer; }
.topo .meta a:hover, .topo .meta button.link:hover { text-decoration: underline; }
.topo .mais-acoes { position: relative; }
.abas-processo { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.kanban-barra { display: flex; justify-content: flex-end; margin: -4px 0 10px; }

@media (max-width: 640px) {
  .grade-barra .busca input { width: 100%; }
  .grade { max-height: calc(100vh - 200px); }
  .massa { left: 12px; right: 12px; transform: none; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .cab .icone, .grupo-nome .alternador svg.i, .kanban-cartao, .lapis, .enviando i, .tipo-cartao { transition: none; }
}
