/* =====================================================================
   Quadro de tarefas
   ===================================================================== */

.conteudo-quadro { max-width: none; }
.conteudo-quadro .barra-filtros .select { width: auto; min-width: 190px; }

/* ---------- Colunas ---------- */
.quadro {
    display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px;
    align-items: start; overflow-x: auto; padding-bottom: 8px;
    scroll-snap-type: x proximity;
}
.coluna {
    display: flex; flex-direction: column; min-height: 200px; max-height: calc(100dvh - 260px);
    background: var(--n-100); border: 1px solid transparent; border-radius: var(--r-lg);
    scroll-snap-align: start; transition: background var(--dur), border-color var(--dur), opacity var(--dur);
}
.coluna.alvo { background: var(--brand-50); border-color: var(--brand-300); border-style: dashed; }
.coluna.bloqueada { opacity: .45; }
.coluna-topo {
    display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px 6px 14px;
    color: var(--n-600);
}
.coluna-topo h3 { font-size: 14px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.coluna-qtd {
    min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
    background: var(--surface); font-size: 12px; font-weight: 700; color: var(--n-500);
    display: inline-grid; place-items: center;
}
.coluna-topo .btn-icone { margin-left: auto; }
.coluna-revisao .coluna-topo > .icon { color: var(--warning-600); }
.coluna-entregue .coluna-topo > .icon { color: var(--success-600); }
.coluna-lista { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 10px; overflow-y: auto; flex: 1; min-height: 60px; }
.coluna-vazia { padding: 18px 8px; text-align: center; font-size: 13px; color: var(--text-subtle); }
.marcador-soltar { height: 4px; border-radius: 4px; background: var(--brand-500); margin: -2px 2px; flex-shrink: 0; }

/* ---------- Cartão ---------- */
.tarefa {
    position: relative; display: flex; flex-direction: column; gap: 8px;
    padding: 12px 12px 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
    cursor: pointer; transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
}
.tarefa[draggable="true"] { cursor: grab; }
.tarefa:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); }
.tarefa:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.tarefa.arrastando { opacity: .35; transform: rotate(1deg); }
/* Faixa à esquerda indica prioridade alta/urgente */
.tarefa.prioridade-alta { box-shadow: inset 3px 0 0 var(--warning-500), var(--shadow-sm); }
.tarefa.prioridade-urgente { box-shadow: inset 3px 0 0 var(--danger-500), var(--shadow-sm); }
.coluna-entregue .tarefa { background: var(--n-25); }
.coluna-entregue .tarefa-titulo { color: var(--n-500); }

.tarefa-topo { display: flex; align-items: center; gap: 6px; }
.tarefa-topo .tag { height: 22px; font-size: 11.5px; }
.prioridade { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--warning-600); }
.prioridade-urgente .prioridade { color: var(--danger-600); }
.tarefa-titulo { font-size: 14px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; color: var(--n-800); overflow-wrap: anywhere; }

.prazo {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 7px; border-radius: var(--r-xs);
    background: var(--n-50); color: var(--n-600); font-size: 12px; font-weight: 600;
}
.prazo.hoje { background: var(--warning-50); color: var(--warning-600); }
.prazo.atrasada { background: var(--danger-50); color: var(--danger-600); }

.tarefa-rodape { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.avatares { display: flex; }
.avatares .avatar { width: 26px; height: 26px; border: 2px solid var(--surface); }
.avatares .avatar + .avatar { margin-left: -8px; }
.avatar-mais { display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--n-600); background: var(--n-100); }
.sem-responsavel { font-size: 12px; color: var(--text-subtle); }
.tarefa-contadores { display: flex; gap: 10px; font-size: 12px; font-weight: 600; color: var(--n-400); }
.tarefa-contadores span { display: inline-flex; align-items: center; gap: 3px; }
.tarefa-contadores .completo { color: var(--success-600); }

/* ---------- Detalhes ---------- */
#modal-detalhe { width: min(900px, calc(100vw - 32px)); }
#modal-detalhe .modal-topo .btn-icone { margin-left: 0; }
.det-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.det-tags .prazo { align-self: center; height: 24px; }
.tag-prioridade-baixa { background: var(--n-100); color: var(--n-600); }
.tag-prioridade-media { background: var(--brand-50); color: var(--brand-500); }
.tag-prioridade-alta { background: var(--warning-50); color: var(--warning-600); }
.tag-prioridade-urgente { background: var(--danger-50); color: var(--danger-600); }

.det-titulo { font-size: 22px; color: var(--ink); overflow-wrap: anywhere; }
.det-meta { margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.det-meta a { color: var(--ink); font-weight: 600; }

.det-colunas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 18px; padding: 4px; background: var(--n-100); border-radius: var(--r-md); }
.det-coluna {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: var(--n-600);
    transition: background var(--dur), color var(--dur);
}
.det-coluna:not(:disabled):hover { background: var(--surface); color: var(--ink); }
.det-coluna.atual { background: var(--primary); color: #fff; }
.det-coluna:disabled:not(.atual) { opacity: .4; cursor: not-allowed; }

.det-grade { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; margin-top: 22px; }
.det-descricao { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.65; color: var(--n-700); }
.det-secao { margin-top: 24px; }
.det-secao h4, .det-lado h4 {
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
    font-size: 13px; font-weight: 800; letter-spacing: 0; color: var(--ink);
}
.det-secao h4 .dica { font-weight: 600; }

.progresso { height: 6px; border-radius: 6px; background: var(--n-100); overflow: hidden; margin-bottom: 10px; }
.progresso span { display: block; height: 100%; width: 0; background: var(--success-500); border-radius: 6px; transition: width .3s var(--ease); }
.checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--r-sm); }
.checklist li:hover { background: var(--n-50); }
.checklist .check { flex: 1; align-items: flex-start; }
.checklist .check span { overflow-wrap: anywhere; }
.checklist li.feito .check span { text-decoration: line-through; color: var(--text-subtle); }
.checklist .btn-icone { opacity: 0; }
.checklist li:hover .btn-icone, .checklist .btn-icone:focus-visible { opacity: 1; }
/* Telas de toque (inclusive tablets largos) não têm "passar o mouse": o botão fica sempre visível */
@media (hover: none) { .checklist .btn-icone { opacity: 1; } }
.modal .linha-add { display: flex; flex-direction: row; gap: 8px; margin-top: 8px; }
.linha-add .input { height: 36px; }
.linha-add .btn { flex-shrink: 0; height: 36px; }

.det-anexos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.anexo, .anexo-opcao {
    position: relative; display: block; aspect-ratio: 1; overflow: hidden;
    border-radius: var(--r-md); background: var(--n-100); border: 1px solid var(--border);
}
.anexo img, .anexo-opcao img { width: 100%; height: 100%; object-fit: cover; }
.anexo:hover { border-color: var(--brand-400); }
.anexo-nome {
    position: absolute; inset: auto 0 0 0; padding: 14px 7px 5px;
    background: linear-gradient(transparent, rgba(0, 17, 61, .75));
    color: #fff; font-size: 11.5px; font-weight: 600; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.anexo-play {
    position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; background: rgba(0, 17, 61, .7); color: #fff;
}

.comentarios { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; max-height: 360px; overflow-y: auto; }
.comentarios li { display: flex; gap: 10px; }
.comentarios .avatar { width: 30px; height: 30px; }
.comentarios strong { font-size: 13.5px; color: var(--n-800); }
.comentarios p { margin-top: 2px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--n-700); }
.modal .comentar { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 14px; }
.textarea.textarea-curta { min-height: 92px; }

.det-lado { padding: 14px; border-radius: var(--r-md); background: var(--n-25); border: 1px solid var(--border); align-self: start; }
.det-lado h4:not(:first-child) { margin-top: 16px; }
.det-lado p { font-size: 14px; color: var(--n-700); }
.det-pessoas { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.det-pessoas li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.det-pessoas .avatar { width: 30px; height: 30px; }
.det-pessoas span { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.det-pessoas a { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-pessoas em { font-style: normal; font-size: 12px; color: var(--text-subtle); }

/* ---------- Formulário ---------- */
.linha.linha-3 { grid-template-columns: repeat(3, 1fr); }
.escolher-pessoas {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 220px; overflow-y: auto;
    padding: 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--n-25);
}
.pessoa-opcao {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm);
    cursor: pointer; border: 1px solid transparent; min-width: 0;
}
.pessoa-opcao:hover { background: var(--surface); }
.pessoa-opcao:has(input:checked) { background: var(--surface); border-color: var(--brand-300); }
.pessoa-opcao input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.pessoa-opcao .avatar { width: 28px; height: 28px; }
.pessoa-opcao span { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pessoa-opcao strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pessoa-opcao em { font-style: normal; font-size: 11.5px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.anexos-escolhidos { display: flex; flex-wrap: wrap; gap: 6px; }
.anexos-escolhidos:not(:empty) { margin-bottom: 8px; }
.anexo-chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 240px;
    padding: 3px 3px 3px 3px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
}
.anexo-chip img { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; background: var(--n-100); }
.anexo-chip > span { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.anexo-chip .btn-icone { width: 26px; height: 26px; flex-shrink: 0; }

/* Seletor de anexos */
.busca-bloco { display: block; margin-bottom: 14px; }
.anexos-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.anexo-opcao { cursor: pointer; }
.anexo-opcao input { position: absolute; top: 7px; left: 7px; z-index: 1; width: 18px; height: 18px; accent-color: var(--primary); }
.anexo-opcao.marcado { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
#modal-anexos .modal-rodape .dica { margin-right: auto; }

/* ---------- Telas menores ---------- */
@media (max-width: 1024px) {
    .quadro { grid-template-columns: repeat(4, minmax(270px, 82vw)); margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; }
    .coluna { max-height: none; }
}
@media (max-width: 760px) {
    .det-grade { grid-template-columns: 1fr; }
    .det-lado { order: -1; }
    .det-colunas { grid-template-columns: 1fr 1fr; }
    .linha.linha-3, .escolher-pessoas { grid-template-columns: 1fr; }
    .checklist .btn-icone { opacity: 1; }
}
#btn-escolher-anexos { align-self: flex-start; }

/* Apagar comentário: aparece ao passar o mouse (no celular, sempre visível) */
.comentario-corpo { flex: 1; min-width: 0; }
.comentarios .btn-icone { opacity: 0; flex-shrink: 0; }
.comentarios li:hover .btn-icone, .comentarios .btn-icone:focus-visible { opacity: 1; }
@media (hover: none) { .comentarios .btn-icone { opacity: 1; } }

/* Entregas enviadas pela tarefa */
.entregas { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.entregas li {
    display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.entrega-miniatura { position: relative; width: 52px; height: 52px; flex-shrink: 0; overflow: hidden; border-radius: var(--r-sm); background: var(--n-100); }
.entrega-miniatura img { width: 100%; height: 100%; object-fit: cover; }
.entrega-miniatura .anexo-play { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); }
.entrega-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.entrega-info strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entrega-info em { font-style: normal; font-size: 12px; color: var(--text-subtle); }
#btn-enviar-entrega + .dica { margin-top: 6px; }

/* ---------- Aprovação de peças ---------- */
.selo-aprovacao {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 7px; border-radius: var(--r-xs); font-size: 12px; font-weight: 700;
}
.selo-aprovacao.pendente { background: var(--warning-50); color: var(--warning-600); }
.selo-aprovacao.ajuste { background: var(--danger-50); color: var(--danger-600); }
.selo-aprovacao.aprovada { background: var(--success-50); color: var(--success-600); }

.barra-aprovacao {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
    margin-top: 14px; padding: 12px 12px 12px 14px; border-radius: var(--r-md);
    background: var(--warning-50); border: 1px solid #f6dfae; color: var(--n-800); font-size: 14px;
}
.barra-aprovacao > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.barra-aprovacao > span .icon { color: var(--warning-600); }
.barra-aprovacao-acoes { display: flex; gap: 8px; }
.barra-aprovacao.neutra { background: var(--n-50); border-color: var(--border); color: var(--n-600); }
.barra-aprovacao.neutra > span .icon { color: var(--n-400); }
.barra-aprovacao.ajuste { background: var(--danger-50); border-color: #f5c9d2; flex-direction: column; align-items: flex-start; }
.barra-aprovacao.ajuste > span .icon { color: var(--danger-600); }
.barra-aprovacao.ajuste p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--n-700); padding-left: 22px; }

.versao-titulo { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; font-size: 12.5px; font-weight: 700; color: var(--n-600); }
.versao-titulo:first-of-type { margin-top: 0; }
.versao-titulo .selo-aprovacao { align-self: center; }

.decisoes { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.decisoes li { display: flex; gap: 10px; font-size: 14px; color: var(--n-700); }
.decisoes strong { color: var(--n-800); }
.decisoes p { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 10px; border-radius: var(--r-sm); background: var(--n-50); }
.decisao-icone { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; }
.decisoes .aprovada .decisao-icone { background: var(--success-50); color: var(--success-600); }
.decisoes .ajuste .decisao-icone { background: var(--danger-50); color: var(--danger-600); }
.form-ajuste .modal-corpo { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 600px) {
    .barra-aprovacao-acoes { width: 100%; }
    .barra-aprovacao-acoes .btn { flex: 1; }
}

/* ---------- Entregue: check desenhado, título riscado ---------- */
.coluna-entregue .prioridade { display: none; }
.tarefa-feito { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; color: var(--success-500); }
.tarefa-feito svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tarefa-feito circle { stroke-width: 1.8; stroke-dasharray: 1; }
.tarefa-feito path { stroke-dasharray: 1; }
.coluna-entregue .tarefa-titulo { padding-right: 26px; }
.tarefa-titulo span { background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 1.5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.coluna-entregue .tarefa-titulo span { background-size: 100% 1.5px; }

.tarefa.acabou-de-entregar { --ja: 0ms; animation: entregue-chega .55s cubic-bezier(.2, 1.25, .4, 1) calc(0ms - var(--ja)) both, entregue-brilho .9s ease-out calc(1000ms - var(--ja)) both; }
.acabou-de-entregar .tarefa-feito { animation: feito-pula .4s cubic-bezier(.3, 1.8, .5, 1) calc(250ms - var(--ja)) both; }
.acabou-de-entregar .tarefa-feito circle { animation: traco .45s var(--ease) calc(250ms - var(--ja)) both; }
.acabou-de-entregar .tarefa-feito path { animation: traco .3s var(--ease) calc(600ms - var(--ja)) both; }
.acabou-de-entregar .tarefa-titulo span { animation: risca .45s var(--ease) calc(800ms - var(--ja)) both; }
@keyframes entregue-chega { from { opacity: 0; transform: translateX(-36px) scale(.96); } }
@keyframes entregue-brilho { 0% { box-shadow: 0 0 0 0 rgba(18, 148, 90, .45), var(--shadow-sm); } 100% { box-shadow: 0 0 0 10px rgba(18, 148, 90, 0), var(--shadow-sm); } }
@keyframes feito-pula { from { transform: scale(.3); opacity: 0; } }
@keyframes traco { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes risca { from { background-size: 0 1.5px; } to { background-size: 100% 1.5px; } }
@media (prefers-reduced-motion: reduce) { .tarefa.acabou-de-entregar, .acabou-de-entregar * { animation: none !important; } }


/* ---------- Celular: segurar e arrastar ---------- */
/* Rolar com o dedo continua valendo sobre o cartão; só o zoom de pinça/duplo toque fica de fora.
   Segurar não seleciona texto nem abre o menu do sistema. */
.tarefas-celular .tarefa { touch-action: pan-x pan-y; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Durante o arrastar, o quadro não "encaixa" nas colunas (atrapalharia a rolagem automática). */
.quadro.arrastando-toque, .quadro.arrastando-toque .coluna-lista { scroll-snap-type: none; scroll-behavior: auto; }
.tarefa-fantasma {
    position: fixed; z-index: 1000; margin: 0; pointer-events: none;
    box-shadow: 0 18px 40px rgba(0, 17, 61, .28); border-color: var(--brand-300);
    transition: none; will-change: transform;
}
.dica-quadro { display: none; }
@media (max-width: 760px) {
    .tarefas-celular .dica-quadro {
        display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: 13px; color: var(--text-muted);
    }
    .tarefas-celular .quadro { grid-template-columns: repeat(4, 84vw); gap: 10px; scroll-snap-type: x proximity; }
    .tarefas-celular .quadro.arrastando-toque { scroll-snap-type: none; }
    .tarefas-celular .coluna { min-height: 50dvh; }
    .tarefas-celular .tarefa { padding: 14px 14px 12px; }
    .tarefas-celular .tarefa-titulo { font-size: 15px; }
    .tarefas-celular .tarefa.arrastando { opacity: .3; transform: none; }
    .tarefas-celular .coluna.alvo { background: var(--brand-50); }
}

/* ---------- Cartão com arte, checklist e prazo por extenso ---------- */
.tarefa-capa { margin: -12px -12px 2px; height: 120px; overflow: hidden; border-radius: var(--r-md) var(--r-md) 0 0; background: var(--n-100); }
.tarefa-capa img { display: block; width: 100%; height: 100%; object-fit: cover; }
.coluna-entregue .tarefa-capa { opacity: .75; }
.tarefa-progresso { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--n-500); }
.tarefa-progresso progress { flex: 1; height: 6px; border: 0; border-radius: 999px; overflow: hidden; background: var(--n-100); appearance: none; -webkit-appearance: none; }
.tarefa-progresso progress::-webkit-progress-bar { background: var(--n-100); border-radius: 999px; }
.tarefa-progresso progress::-webkit-progress-value { background: var(--brand-500); border-radius: 999px; transition: width .3s var(--ease); }
.tarefa-progresso progress::-moz-progress-bar { background: var(--brand-500); border-radius: 999px; }
.tarefa-progresso progress[value]:not([value="0"]) + span { color: var(--brand-600); }
@media (max-width: 760px) {
    /* Detalhes em tela cheia no celular */
    .tarefas-celular #modal-detalhe { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
    .tarefas-celular #modal-detalhe .modal-topo { position: sticky; top: 0; z-index: 2; background: var(--surface); }
    .tarefas-celular .tarefa-capa { height: 150px; }
}

/* Selo de prazo: a cor vai do verde (longo prazo) ao vermelho (curto prazo/atrasada) aos poucos */
.selo-prazo {
    --prazo-matiz: 130;
    margin-left: auto; flex: none;
    padding: 2px 9px; border-radius: var(--r-full);
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
    background: hsl(var(--prazo-matiz) 78% 90%);
    color: hsl(var(--prazo-matiz) 80% 24%);
    box-shadow: inset 0 0 0 1px hsl(var(--prazo-matiz) 60% 72%);
    transition: background-color .6s ease, color .6s ease, box-shadow .6s ease;
}
.prioridade + .selo-prazo { margin-left: 6px; }
.tarefa.esta-atrasada .selo-prazo { background: hsl(0 80% 52%); color: #fff; box-shadow: none; }

/* ---------- Tema escuro ---------- */
[data-tema="escuro"] .barra-aprovacao { border-color: #5a4518; }
[data-tema="escuro"] .barra-aprovacao.neutra { border-color: var(--border); }
[data-tema="escuro"] .barra-aprovacao.ajuste { border-color: #5c2433; }
[data-tema="escuro"] .selo-prazo {
    background: hsl(var(--prazo-matiz) 45% 17%);
    color: hsl(var(--prazo-matiz) 75% 76%);
    box-shadow: inset 0 0 0 1px hsl(var(--prazo-matiz) 40% 30%);
}
[data-tema="escuro"] .tarefa.esta-atrasada .selo-prazo { background: hsl(350 70% 46%); color: #fff; box-shadow: none; }

/* =====================================================================
   Celular (estilo app)
   Cabeçalho enxuto, "Nova tarefa" flutuando no canto, busca + botão de filtros numa linha
   (responsável e tipo numa folha que sobe de baixo), filtros rápidos em fichas que rolam de lado,
   abas fixas com as colunas do quadro e detalhes numa folha com o campo de comentar preso no pé.
   No computador nada disso aparece.
   ===================================================================== */
.btn-filtros, .abas-colunas, .det-resumo, .det-rodape { display: none; }
.filtros-extras { display: contents; }
.filtros-qtd {
    position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-full); border: 2px solid var(--bg); background: var(--primary); color: #fff;
    font-size: 10.5px; font-weight: 800; line-height: 1; display: grid; place-items: center;
}

/* ---------- Quadro: abas das colunas + uma coluna por vez ---------- */
@media (max-width: 760px) {
    .abas-colunas {
        position: sticky; top: var(--topbar-h); z-index: calc(var(--z-topbar) - 1);
        display: flex; margin: 0 -16px 12px; padding: 0 16px;
        background: var(--bg); border-bottom: 1px solid var(--border);
        overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    }
    .abas-colunas::-webkit-scrollbar { display: none; }
    .abas-colunas button {
        flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
        height: 44px; padding: 0 5px; margin-bottom: -1px; border-bottom: 2px solid transparent;
        font-size: 13px; font-weight: 700; color: var(--text-muted); white-space: nowrap;
        transition: color var(--dur), border-color var(--dur);
    }
    .abas-colunas button[aria-current="true"] { color: var(--ink); border-bottom-color: var(--ink); }
    .abas-colunas button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -4px; border-radius: var(--r-sm); }
    .aba-qtd {
        min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full);
        display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 800;
        background: var(--n-100); color: var(--n-500);
    }
    .abas-colunas button[aria-current="true"] .aba-qtd { background: var(--primary); color: #fff; }

    /* A coluna tem a altura do que tem dentro (a página rola, não a coluna). */
    .tarefas-celular .coluna { min-height: 140px; }
    /* Arrastando um cartão: as colunas crescem para ficar fácil soltar em qualquer uma. */
    .tarefas-celular .quadro.arrastando-toque .coluna { min-height: 60dvh; }

    .tarefas-celular .dica-quadro {
        margin: 0 0 10px; padding: 4px 4px 4px 10px; border-radius: var(--r-md);
        background: var(--n-100); font-size: 12.5px; line-height: 1.4;
    }
    .dica-quadro > .icon { flex: none; }
    .dica-quadro > span { flex: 1; min-width: 0; }
    .dica-quadro .btn-icone { flex: none; }
}

@media (max-width: 600px) {
    /* ---------- Cabeçalho ---------- */
    .conteudo-quadro { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } /* nada fica atrás do botão flutuante */
    .conteudo-quadro .cabecalho { margin-bottom: 14px; }
    .conteudo-quadro .cabecalho h2 { font-size: 21px; }
    .conteudo-quadro .cabecalho p { display: none; }

    /* ---------- Busca + filtros ---------- */
    .conteudo-quadro .barra-filtros { gap: 10px 8px; margin-bottom: 12px; }
    .conteudo-quadro .barra-filtros .busca { flex: 1 1 0; min-width: 0; }
    .btn-filtros { display: inline-grid; flex: none; width: 42px; height: 42px; }
    .barra-filtros #filtros {
        display: flex; flex: 0 0 calc(100% + 32px); max-width: none; margin: 0 -16px; padding: 0 16px; gap: 6px;
        background: none; border-radius: 0; scroll-padding: 0 16px;
    }
    .barra-filtros #filtros button {
        height: 34px; padding: 0 14px; border-radius: var(--r-full);
        border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    }
    .barra-filtros #filtros button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: none; }
    .barra-filtros #filtros button[aria-pressed="true"] .qtd { color: rgba(255, 255, 255, .78); }

    /* Folha de filtros e folha de detalhes: sobem de baixo, cantos de cima arredondados */
    #modal-filtros, .tarefas-celular #modal-detalhe {
        width: 100vw; max-width: none; height: fit-content; max-height: 94dvh; margin: auto 0 0; top: auto; bottom: 0;
        border-radius: 20px 20px 0 0; animation: folhaSobe .26s var(--ease);
    }
    #modal-filtros .modal-topo { padding: 14px 16px; }
    #modal-filtros .modal-corpo { padding: 16px; }
    #modal-filtros .filtros-extras { display: flex; flex-direction: column; gap: 6px; }
    #modal-filtros .filtros-extras .sr-only {
        position: static; width: auto; height: auto; margin: 10px 0 0; overflow: visible; clip: auto; white-space: normal;
        font-size: 13px; font-weight: 700; color: var(--ink);
    }
    #modal-filtros .filtros-extras .sr-only:first-child { margin-top: 0; }
    #modal-filtros .select { width: 100%; min-width: 0; height: 46px; }
    #modal-filtros .modal-rodape { flex-direction: row; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
    #modal-filtros .modal-rodape .btn { flex: 1; width: auto; height: 46px; justify-content: center; }

    /* ---------- Detalhes ---------- */
    .tarefas-celular #modal-detalhe .modal-topo { padding: 12px 10px 12px 16px; gap: 4px; }
    #modal-detalhe .modal-corpo { padding: 16px; }
    .det-titulo { font-size: 20px; line-height: 1.25; }
    .det-colunas { margin-top: 14px; gap: 3px; padding: 3px; }
    .det-coluna { height: 34px; font-size: 12.5px; }
    .det-grade { gap: 18px; margin-top: 16px; }
    .det-secao { margin-top: 20px; }

    /* Responsáveis numa linha (tocar abre a lista) e prazo logo abaixo, no mesmo cartão */
    .det-lado { display: flex; flex-direction: column; padding: 0 12px; }
    .det-lado > h4, .det-lado > p, .det-lado > .det-pessoas { display: none; }
    .det-resumo { display: contents; }
    .det-resumo-linha {
        order: 3; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 0;
        text-align: left; font: inherit; color: inherit;
    }
    .det-resumo-linha:first-child { order: 1; }
    /* Responsáveis: rótulo em cima, fotos + nomes embaixo (nomes longos têm a largura toda); "+ Adicionar" ao lado */
    .det-lado > .det-lado-topo { display: none; }
    .det-resumo-resp { padding: 0; gap: 8px; }
    .det-resumo-abrir {
        flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
        min-height: 48px; padding: 10px 0; text-align: left; font: inherit; color: inherit;
    }
    .det-resumo-abrir > .icon { grid-row: 1 / span 2; grid-column: 2; color: var(--text-subtle); transition: transform .2s var(--ease); }
    .det-lado.pessoas-abertas .det-resumo-abrir > .icon { transform: rotate(180deg); }
    .det-resumo-abrir:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: var(--r-sm); }
    .det-resumo .btn-add-resp { height: 36px; padding: 0 12px 0 8px; }
    .det-pessoas .det-tirar-resp { width: 36px; height: 36px; }
    .det-resumo-linha + .det-resumo-linha { border-top: 1px solid var(--border); }
    .det-lado.pessoas-abertas > .det-pessoas { display: flex; order: 2; padding: 2px 0 12px; }
    .det-resumo-rotulo { flex: none; width: 92px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
    .det-resumo-valor { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--n-800); }
    .det-resumo-valor.dica { font-weight: 500; color: var(--text-subtle); }
    .det-resumo-valor .avatares { flex: none; }
    .det-resumo-valor .avatares .avatar { width: 24px; height: 24px; border-color: var(--n-25); }
    .det-resumo-valor .avatar-mais { display: none; } /* o "+N" já vai junto dos nomes */
    .det-resumo-nomes { min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }

    /* Comentários: a lista corre junto com a folha; o campo fica preso no pé, como num chat */
    .comentarios { max-height: none; overflow: visible; }
    .det-rodape {
        display: block; flex: none; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 12px;
        border-top: 1px solid var(--border); background: var(--surface);
    }
    .det-rodape:empty { display: none; }
    #det-rodape .comentar { flex-direction: row; align-items: flex-end; gap: 8px; margin: 0; }
    #det-rodape .textarea {
        flex: 1; min-width: 0; min-height: 0; height: 42px; max-height: 110px; /* até 4 linhas */
        padding: 9px 14px; border-radius: 21px; line-height: 1.4; resize: none;
    }
    #det-rodape .btn { flex: none; width: 42px; height: 42px; padding: 0; border-radius: 50%; justify-content: center; }
    #det-rodape .btn > span { display: none; }
    #det-rodape .btn .icon { width: 18px; height: 18px; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
    #modal-filtros, .tarefas-celular #modal-detalhe { animation: none; }
}

/* ---------- Nova tarefa / Editar / Anexar no celular: mesma folha que sobe de baixo ----------
   Topo e botões presos (o meio rola); Tipo e Prioridade lado a lado, Prazo embaixo; responsáveis
   viram fotos para tocar (4 por linha, com o check em cima de quem foi escolhido). */
@media (max-width: 600px) {
    #modal-tarefa, #modal-anexos, #modal-responsaveis {
        width: 100vw; max-width: none; max-height: 94dvh; margin: auto 0 0; top: auto; bottom: 0;
        border-radius: 20px 20px 0 0; animation: folhaSobe .26s var(--ease);
    }
    #modal-tarefa::backdrop, #modal-anexos::backdrop, #modal-responsaveis::backdrop { background: rgba(0, 8, 30, .6); }
    #modal-tarefa .modal-topo, #modal-anexos .modal-topo, #modal-responsaveis .modal-topo { padding: 14px 16px; }
    #modal-responsaveis .modal-corpo { padding: 12px 16px 16px; }
    #modal-responsaveis .modal-rodape { flex-direction: row; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
    #modal-responsaveis .modal-rodape .btn { width: auto; flex: 1; height: 48px; justify-content: center; }
    #modal-responsaveis .modal-rodape .btn-primario { flex: 2; }
    #modal-responsaveis .escolher-pessoas { max-height: none; border: 0; background: none; padding: 0; }
    #modal-responsaveis .pessoa-opcao { min-height: 52px; padding: 8px 10px; }
    #modal-responsaveis .pessoa-opcao .avatar { width: 36px; height: 36px; }
    #modal-responsaveis .pessoa-opcao input { width: 20px; height: 20px; order: 3; margin-left: auto; }
    #modal-responsaveis .pessoa-opcao strong { font-size: 14.5px; }
    #modal-responsaveis .pessoa-opcao em { font-size: 12.5px; }
    #modal-tarefa .modal-corpo { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
    #modal-tarefa .modal-corpo .campo { margin: 0; }
    #modal-tarefa #f-descricao { min-height: 84px; }
    #modal-tarefa .linha.linha-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
    #modal-tarefa .linha.linha-3 .campo:last-child { grid-column: 1 / -1; }
    #modal-tarefa .modal-rodape, #modal-anexos .modal-rodape {
        flex-direction: row; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    #modal-tarefa .modal-rodape .btn, #modal-anexos .modal-rodape .btn { width: auto; flex: 1; height: 48px; justify-content: center; }
    #modal-tarefa .modal-rodape .btn-primario, #modal-anexos .modal-rodape .btn-primario { flex: 2; }

    #modal-tarefa .escolher-pessoas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: none; padding: 8px; }
    #modal-tarefa .pessoa-opcao {
        position: relative; flex-direction: column; justify-content: flex-start; gap: 5px;
        padding: 8px 2px; border: 0; background: none; text-align: center;
    }
    #modal-tarefa .pessoa-opcao:has(input:checked) { background: none; }
    #modal-tarefa .pessoa-opcao input { position: absolute; opacity: 0; pointer-events: none; }
    #modal-tarefa .pessoa-opcao .avatar { width: 52px; height: 52px; box-shadow: 0 0 0 2px transparent; transition: box-shadow var(--dur), opacity var(--dur); }
    #modal-tarefa .pessoa-opcao:has(input:checked) .avatar { box-shadow: 0 0 0 3px var(--primary); }
    #modal-tarefa .pessoa-opcao::after {
        content: ''; position: absolute; top: 6px; left: calc(50% + 12px); width: 20px; height: 20px; border-radius: 50%;
        background: var(--primary) center / 12px no-repeat 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.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
        border: 2px solid var(--surface); transform: scale(0); transition: transform .18s var(--ease);
    }
    #modal-tarefa .pessoa-opcao:has(input:checked)::after { transform: scale(1); }
    #modal-tarefa .pessoa-opcao:has(input:focus-visible) .avatar { outline: 2px solid var(--brand-400); outline-offset: 3px; }
    #modal-tarefa .pessoa-opcao span { align-items: center; width: 100%; }
    #modal-tarefa .pessoa-opcao strong { font-size: 12px; max-width: 100%; }
    #modal-tarefa .pessoa-opcao em { display: none; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) { #modal-tarefa, #modal-anexos, #modal-responsaveis { animation: none; } }

/* =====================================================================
   Responsáveis nos detalhes: "+ Adicionar" e tirar (só para quem edita a tarefa)
   ===================================================================== */
.det-lado-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.det-lado-topo h4 { margin-bottom: 0; }
.btn-add-resp {
    flex: none; display: inline-flex; align-items: center; gap: 3px; height: 28px; padding: 0 10px 0 6px;
    border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface);
    font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap;
    transition: background var(--dur), border-color var(--dur);
}
.btn-add-resp:hover { background: var(--brand-50); border-color: var(--brand-300); }
.btn-add-resp:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.det-pessoas li > span { flex: 1; }
.det-tirar-resp { flex: none; opacity: 0; color: var(--text-subtle); }
.det-pessoas li:hover .det-tirar-resp, .det-tirar-resp:focus-visible { opacity: 1; }
@media (hover: none) { .det-tirar-resp { opacity: 1; } }

@media (min-width: 601px) {
    #modal-responsaveis { width: min(520px, calc(100vw - 32px)); }
    #modal-responsaveis .escolher-pessoas { max-height: min(52dvh, 380px); }
}
#modal-responsaveis .busca-bloco { margin-bottom: 10px; }
.resp-vazio { grid-column: 1 / -1; padding: 16px 6px; text-align: center; }

/* Quem vê a tarefa mas não cuida dela: aviso de "só leitura" e arquivos sem abrir */
.det-so-leitura {
    display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--n-50);
    font-size: 13.5px; line-height: 1.45; color: var(--n-600);
}
.det-so-leitura .icon { flex: none; margin-top: 2px; color: var(--n-400); }
.det-bloqueio { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.det-bloqueio .icon { flex: none; }
.anexo-trancado { cursor: default; }
.anexo-trancado:hover { border-color: var(--border); }
.anexo-trancado img { opacity: .75; }
span.entrega-miniatura img { opacity: .75; }

/* =====================================================================
   Lixeira do quadro: aparece enquanto um cartão é arrastado por quem pode excluir a tarefa.
   Mouse: faixa no pé do quadro. Toque: botão redondo no meio do pé da tela.
   A lata é a mesma do "descartar áudio" das Conversas (tampa abre, o item cai, tampa fecha, balança).
   ===================================================================== */
.lixeira-tarefas {
    /* Só a lixeira: um círculo no meio do pé da tela, que sobe quando o cartão começa a ser arrastado. */
    position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); z-index: 999;
    display: grid; place-items: center; width: 62px; height: 62px; margin-left: -31px;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--surface); color: var(--danger-500); box-shadow: var(--shadow-lg);
    transform: translateY(160%) scale(.6); opacity: 0; visibility: hidden; pointer-events: none;
    transition: transform .28s cubic-bezier(.2, 1.3, .4, 1), opacity .16s ease, visibility 0s .28s,
        background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.lixeira-tarefas.visivel { transform: translateY(0) scale(1); opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.lixeira-tarefas.perto, .lixeira-tarefas.engolindo { background: var(--danger-500); border-color: var(--danger-500); color: #fff; }
.lixeira-tarefas.visivel.perto { transform: translateY(0) scale(1.3); }
.lixeira-circulo { display: grid; place-items: center; width: 44px; height: 44px; pointer-events: none; }
.lixeira-texto { display: none; }
.lixeira-lata { width: 28px; height: 28px; overflow: visible; }
.lixeira-tampa { transform-box: fill-box; transform-origin: 0% 100%; transition: transform .18s var(--ease); }
.lixeira-tarefas.perto .lixeira-tampa { transform: translateY(-1px) rotate(-42deg); }

.lixeira-tarefas.engolindo { visibility: visible; pointer-events: none; animation: lixeiraSai 1.25s cubic-bezier(.4, 0, .2, 1) forwards; }
.lixeira-tarefas.engolindo .lixeira-lata { animation: lixeiraLata 1.25s cubic-bezier(.4, 0, .2, 1) forwards; }
.lixeira-tarefas.engolindo .lixeira-tampa { transition: none; animation: lixeiraTampa 1.25s ease-in-out forwards; }
@keyframes lixeiraTampa {
    0%, 40% { transform: translateY(-1px) rotate(-42deg); }
    52%, 100% { transform: rotate(0); }
}
@keyframes lixeiraLata {
    0%, 56% { transform: rotate(0); }
    62% { transform: rotate(-8deg); }
    69% { transform: rotate(6deg); }
    76%, 100% { transform: rotate(0); }
}
@keyframes lixeiraSai {
    0%, 82% { transform: translateY(0) scale(1.3); opacity: 1; }
    100% { transform: translateY(160%) scale(.6); opacity: 0; }
}
.tarefa-fantasma.sobre-lixeira { opacity: .72; border-color: var(--danger-500); } /* a lixeira vermelha aparece por baixo */
@media (prefers-reduced-motion: reduce) {
    .lixeira-tarefas, .lixeira-tampa { transition: none; }
    .lixeira-tarefas.engolindo, .lixeira-tarefas.engolindo .lixeira-lata, .lixeira-tarefas.engolindo .lixeira-tampa { animation: none; }
}
