/*
|--------------------------------------------------------------------------
| MARTINA — CRM Tarefas
|--------------------------------------------------------------------------
|
| Estilos exclusivos do módulo de tarefas.
| Este arquivo não altera o CSS principal da MARTINA.
|
|--------------------------------------------------------------------------
*/

.crm-task-wrap {
    margin-top: 20px;
    width: 100%;
}

/*
|--------------------------------------------------------------------------
| Cabeçalho
|--------------------------------------------------------------------------
*/

.crm-task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.crm-task-header-content {
    min-width: 0;
}

.crm-task-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: #101828;
}

.crm-task-subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: #667085;
}

.crm-task-create-button {
    flex-shrink: 0;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #071a2b;
    border-radius: 10px;
    background: #071a2b;
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.crm-task-create-button:hover {
    background: #102f49;
    border-color: #102f49;
}

.crm-task-create-button:active {
    transform: translateY(1px);
}

.crm-task-create-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/*
|--------------------------------------------------------------------------
| Indicadores
|--------------------------------------------------------------------------
*/

.crm-task-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.crm-task-kpis article {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.crm-task-kpis span {
    display: block;
    margin-bottom: 6px;
    overflow: hidden;
    color: #667085;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-task-kpis strong {
    display: block;
    color: #101828;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.15;
}

.crm-task-kpi-overdue {
    border-color: #fecdca !important;
    background: #fff7f6 !important;
}

.crm-task-kpi-today {
    border-color: #fedf89 !important;
    background: #fffaeb !important;
}

.crm-task-kpi-upcoming {
    border-color: #b2ddff !important;
    background: #eff8ff !important;
}

.crm-task-kpi-done {
    border-color: #abefc6 !important;
    background: #ecfdf3 !important;
}

/*
|--------------------------------------------------------------------------
| Quadro
|--------------------------------------------------------------------------
*/

.crm-task-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 16px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.crm-task-column {
    min-width: 240px;
    padding: 14px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #f8fafc;
}

.crm-task-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.crm-task-column-title {
    margin: 0;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.crm-task-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    min-height: 26px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eaecf0;
    color: #475467;
    font-size: 12px;
    font-weight: 700;
}

.crm-task-list {
    display: grid;
    gap: 10px;
}

/*
|--------------------------------------------------------------------------
| Cartão
|--------------------------------------------------------------------------
*/

.crm-task-card {
    position: relative;
    padding: 14px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.crm-task-card:hover {
    border-color: #cfd4dc;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.07);
    transform: translateY(-1px);
}

.crm-task-card.overdue {
    border-color: #fda29b;
    background: #fff7f6;
}

.crm-task-card.today {
    border-color: #fdb022;
    background: #fffaeb;
}

.crm-task-card.done {
    border-color: #abefc6;
    background: #ecfdf3;
}

.crm-task-card.cancelled {
    opacity: 0.7;
}

.crm-task-card-title {
    margin: 0;
    color: #101828;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.crm-task-card-description {
    margin: 8px 0 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.crm-task-card-meta {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}

.crm-task-meta-row {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    color: #667085;
    font-size: 12px;
    line-height: 1.45;
}

.crm-task-meta-label {
    flex-shrink: 0;
    color: #475467;
    font-weight: 600;
}

.crm-task-meta-value {
    min-width: 0;
    overflow-wrap: anywhere;
}

/*
|--------------------------------------------------------------------------
| Status
|--------------------------------------------------------------------------
*/

.crm-task-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 24px;
    margin-top: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f2f4f7;
    color: #475467;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
}

.crm-task-status.open {
    background: #eff8ff;
    color: #175cd3;
}

.crm-task-status.in-progress {
    background: #f4f3ff;
    color: #5925dc;
}

.crm-task-status.done {
    background: #ecfdf3;
    color: #027a48;
}

.crm-task-status.cancelled {
    background: #f2f4f7;
    color: #475467;
}

/*
|--------------------------------------------------------------------------
| Ações
|--------------------------------------------------------------------------
*/

.crm-task-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.crm-task-actions button {
    flex: 1;
    min-width: 0;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #ffffff;
    color: #344054;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.crm-task-actions button:hover {
    background: #f9fafb;
    border-color: #98a2b3;
}

.crm-task-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.crm-task-actions .primary {
    border-color: #071a2b;
    background: #071a2b;
    color: #ffffff;
}

.crm-task-actions .primary:hover {
    border-color: #102f49;
    background: #102f49;
}

.crm-task-actions .danger {
    border-color: #fecdca;
    color: #b42318;
}

.crm-task-actions .danger:hover {
    border-color: #fda29b;
    background: #fff7f6;
}

/*
|--------------------------------------------------------------------------
| Estado vazio
|--------------------------------------------------------------------------
*/

.crm-task-empty {
    padding: 20px 12px;
    border: 1px dashed #d0d5dd;
    border-radius: 12px;
    color: #667085;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

/*
|--------------------------------------------------------------------------
| Carregamento
|--------------------------------------------------------------------------
*/

.crm-task-loading {
    padding: 24px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #ffffff;
    color: #667085;
    font-size: 14px;
    text-align: center;
}

/*
|--------------------------------------------------------------------------
| Modal
|--------------------------------------------------------------------------
*/

.crm-task-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(16, 24, 40, 0.55);
}

.crm-task-modal-backdrop[hidden] {
    display: none !important;
}

.crm-task-modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(16, 24, 40, 0.2);
}

.crm-task-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid #eaecf0;
}

.crm-task-modal-title {
    margin: 0;
    color: #101828;
    font-size: 18px;
    font-weight: 700;
}

.crm-task-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #ffffff;
    color: #475467;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.crm-task-modal-body {
    padding: 20px;
}

.crm-task-form {
    display: grid;
    gap: 16px;
}

.crm-task-field {
    display: grid;
    gap: 7px;
}

.crm-task-field label {
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.crm-task-field input,
.crm-task-field select,
.crm-task-field textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    outline: none;
    background: #ffffff;
    color: #101828;
    font: inherit;
    font-size: 14px;
}

.crm-task-field textarea {
    min-height: 96px;
    resize: vertical;
}

.crm-task-field input:focus,
.crm-task-field select:focus,
.crm-task-field textarea:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(132, 173, 255, 0.18);
}

.crm-task-form-error {
    display: none;
    padding: 10px 12px;
    border: 1px solid #fecdca;
    border-radius: 9px;
    background: #fff7f6;
    color: #b42318;
    font-size: 13px;
    line-height: 1.45;
}

.crm-task-form-error.visible {
    display: block;
}

.crm-task-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #eaecf0;
}

.crm-task-modal-footer button {
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #ffffff;
    color: #344054;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.crm-task-modal-footer .primary {
    border-color: #071a2b;
    background: #071a2b;
    color: #ffffff;
}

/*
|--------------------------------------------------------------------------
| Responsividade
|--------------------------------------------------------------------------
*/

@media (max-width: 1100px) {
    .crm-task-board {
        grid-template-columns: repeat(4, minmax(260px, 1fr));
    }
}

@media (max-width: 900px) {
    .crm-task-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-task-header {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .crm-task-wrap {
        margin-top: 16px;
    }

    .crm-task-header {
        flex-direction: column;
    }

    .crm-task-create-button {
        width: 100%;
    }

    .crm-task-kpis {
        grid-template-columns: 1fr;
    }

    .crm-task-board {
        display: flex;
        gap: 12px;
    }

    .crm-task-column {
        width: 86vw;
        min-width: 280px;
    }

    .crm-task-actions {
        flex-direction: column;
    }

    .crm-task-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .crm-task-modal {
        width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    .crm-task-modal-footer {
        flex-direction: column-reverse;
    }

    .crm-task-modal-footer button {
        width: 100%;
    }
}