/* =====================================================================
   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(--navy); 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(--navy); overflow-wrap: anywhere; }
.det-meta { margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.det-meta a { color: var(--navy); 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(--navy); }
.det-coluna.atual { background: var(--navy); 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(--navy);
}
.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; }
.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(--navy); 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(--navy); 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(--navy); }
.anexo-opcao.marcado { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy); }
#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; }
}
