:root {
    --surface: #fff;
    --surface-muted: #f8fafc;
    --border-subtle: #e2e8f0;
    --text-primary: #172033;
    --text-muted: #64748b;
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
}

body {
    background: #f3f6fb;
    color: var(--text-primary);
    min-height: 100vh;
}

.navbar {
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
    padding-block: .7rem;
}

.board-toolbar {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.board-toolbar .card-body {
    padding: 1.25rem;
}

.kanban-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(330px, .95fr);
    align-items: start;
    gap: 1rem;
}

.board {
    min-width: 0;
    min-height: 70vh;
    overflow-x: auto;
    align-items: flex-start;
    padding-bottom: 1rem;
}

.proximas-vencer-card {
    position: sticky;
    top: 1rem;
    min-height: 70vh;
    max-height: calc(100vh - 2rem);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.proximas-vencer-card .card-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 1.1rem;
}

.proximas-vencer-cabecalho h5 {
    font-size: 1rem;
    font-weight: 700;
}

.proximas-vencer-icone {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    place-items: center;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
}

.proximas-vencer-busca {
    width: 100%;
}

.proximas-vencer-busca .input-group-text {
    border-color: var(--border-subtle);
    color: var(--text-muted);
}

.proximas-vencer-lista {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    gap: .55rem;
    padding: .15rem .25rem .25rem 0;
}

.proximas-vencer-item {
    border: 1px solid var(--border-subtle) !important;
    border-radius: 10px !important;
    padding: .8rem;
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.proximas-vencer-item:hover {
    border-color: #93c5fd !important;
    box-shadow: 0 5px 14px rgba(37, 99, 235, .09);
    transform: translateY(-1px);
}

.proximas-vencer-item:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .3);
    outline-offset: 2px;
}

.coluna {
    background: #eef2f7;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    min-width: 300px;
    max-width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 82vh;
    box-shadow: var(--shadow-card);
}

.coluna-header {
    padding: 12px 14px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #fff;
    gap: 0.5rem;
}

.coluna-header .badge-contagem {
    background: rgba(255,255,255,.25);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .8rem;
}

.coluna-header .btn-excluir-coluna {
    border: 0;
    padding: 0.2rem 0.4rem;
    opacity: 0.9;
}

.coluna-header .btn-excluir-coluna:hover {
    opacity: 1;
    transform: scale(1.03);
}

.coluna-body {
    padding: 10px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 60px;
}

.coluna-body.drag-over {
    background: rgba(13,110,253,.08);
    border-radius: 0 0 16px 16px;
}

.card-tarefa {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    cursor: grab;
    border-left: 4px solid #6c757d;
    transition: box-shadow .15s ease, transform .15s ease;
}

.card-tarefa:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
    transform: translateY(-2px);
}

.card-tarefa.dragging {
    opacity: .4;
}

.card-tarefa.prioridade-alta { border-left-color: #dc3545; }
.card-tarefa.prioridade-media { border-left-color: #ffc107; }
.card-tarefa.prioridade-baixa { border-left-color: #198754; }

.card-tarefa .titulo {
    font-weight: 700;
    margin-bottom: 4px;
    word-break: break-word;
}

.card-tarefa .descricao {
    font-size: .82rem;
    color: #6c757d;
    margin-bottom: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.card-tarefa .rodape {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .75rem;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.card-tarefa .vencimento.vencido {
    color: #dc3545;
    font-weight: 600;
}

.btn-add-coluna {
    min-width: 250px;
}

.card-tarefa .badge.rounded-pill {
    font-size: .68rem;
    font-weight: 500;
}

.checklist-mini .progress {
    background-color: #e9ecef;
}

.checklist-mini small {
    font-size: .72rem;
}

#tarefa-etiquetas-lista .etiqueta-toggle {
    font-size: .78rem;
    padding: .4em .7em;
}

#tarefa-etiquetas-lista .form-editar-etiqueta [name="nome"] {
    width: 10rem;
}

#tarefa-etiquetas-lista .btn-editar-etiqueta,
#tarefa-etiquetas-lista .btn-excluir-etiqueta {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border-radius: 50%;
    opacity: .72;
}

#tarefa-etiquetas-lista .etiqueta-item:hover .btn-editar-etiqueta,
#tarefa-etiquetas-lista .etiqueta-item:hover .btn-excluir-etiqueta,
#tarefa-etiquetas-lista .btn-editar-etiqueta:focus-visible,
#tarefa-etiquetas-lista .btn-excluir-etiqueta:focus-visible {
    opacity: 1;
}

.historico-toggle {
    border: 1px solid var(--border-subtle);
    background: var(--surface-muted);
    color: var(--text-primary);
}

.historico-chevron {
    transition: transform .18s ease;
}

.historico-toggle:not(.collapsed) .historico-chevron {
    transform: rotate(180deg);
}

#tarefa-historico {
    max-height: 12rem;
    overflow-y: auto;
}

#tarefa-dias-semana .btn {
    min-width: 3.2rem;
}

#checklist-itens .list-group-item {
    border-left: none;
    border-right: none;
}

#checklist-itens .list-group-item:first-child {
    border-top: none;
}

.card-tarefa .btn-editar-tarefa {
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.card-tarefa:hover .btn-editar-tarefa {
    opacity: 1;
}

.form-control, .form-select {
    border-radius: 10px;
}

.btn {
    border-radius: 10px;
}

.modal-content {
    border-radius: 16px;
    border: 0;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.modal-header,
.modal-footer {
    border-color: var(--border-subtle);
    padding: 1rem 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

#modalTarefa #form-tarefa {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

#modalTarefa #form-tarefa .modal-body {
    flex: 1 1 auto;
    min-height: 0;
}

.empty-board-state {
    width: 100%;
    min-height: 280px;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.empty-column-state {
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    color: #64748b;
    background: rgba(255,255,255,0.4);
    font-size: 0.9rem;
}

@media (max-width: 991.98px) {
    .kanban-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .proximas-vencer-card {
        position: static;
        min-height: 0;
        max-height: 28rem;
        order: 2;
    }

    .board {
        min-height: 50vh;
    }
}

@media (max-width: 575.98px) {
    .container-fluid.px-4 {
        padding-inline: .75rem !important;
    }

    .board-toolbar .card-body {
        padding: 1rem;
    }

    .board-toolbar .row > [class*="col-"] {
        width: 100%;
    }

    .proximas-vencer-card .card-body {
        padding: .9rem;
    }

    .navbar .container-fluid {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: .65rem;
    }

    .navbar .container-fluid > .d-flex {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
