/* ==========================================================================
   CONFIGURAÇÕES GERAIS E CORES DE STATUS
   ========================================================================== */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Cores de Status para os Prazos */
    --vencido: #ef4444;    /* Vermelho */
    --hoje: #f97316;       /* Laranja */
    --semana: #f59e0b;     /* Amarelo/Âmbar */
    --em-dia: #10b981;     /* Verde */
    --sem-prazo: #6b7280;  
    
    --bg-light: #f3f4f6;   /* Fundo cinza claro para contraste */
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: #1f2937;
    line-height: 1.5;
    min-height: 100vh;
}

/* Área principal com respiro vertical */
main {
    padding: 2rem 0; 
}

/* Container centralizado com margens laterais de segurança */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; 
}

/* ==========================================================================
   TOP BAR E HEADER
   ========================================================================== */
.top-bar {
    background: var(--gradient);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-menu {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.3s;
}

.btn-menu:hover { background: rgba(255,255,255,0.3); }

/* ==========================================================================
   CARDS DE ESTATÍSTICAS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    border-bottom: 4px solid var(--primary);
}

.stat-card h3 { font-size: 0.875rem; color: #6b7280; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: #111827; }

.card-vencido { border-color: var(--vencido); }
.card-hoje { border-color: var(--hoje); }
.card-semana { border-color: var(--semana); }
.card-sem-prazo { border-color: var(--sem-prazo); }

/* ==========================================================================
   BUSCA E FORMULÁRIO
   ========================================================================== */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

input, select {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    width: 100%;
}

/* ==========================================================================
   TABELA E AÇÕES (SCROLL E ALINHAMENTO)
   ========================================================================== */
.table-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    overflow-x: auto; 
}

table { width: 100%; border-collapse: collapse; }

th {
    background: #f9fafb;
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

td:nth-child(4), td:nth-child(6) {
    white-space: nowrap !important;
}

.col-larga { min-width: 250px; }

.col-acoes {
    display: flex;
    gap: 8px;
    justify-content: center;
    min-width: 100px;
    white-space: nowrap !important;
}

.btn-acao {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    color: white;
    transition: 0.2s;
}

.btn-acao:hover { transform: translateY(-2px); opacity: 0.9; }

/* BADGES COLORIDOS */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.badge.status-vencido { background-color: var(--vencido); }
.badge.status-hoje   { background-color: var(--hoje); }
.badge.status-emdia   { background-color: var(--em-dia); }
.badge.status-sem-prazo { background-color: var(--sem-prazo); }

/* ==========================================================================
   MODAL DE EDIÇÃO
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(4px);
}

.modal.show { display: flex; }

.modal-content {
    background: white;
    width: 95%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.modal-header { margin-bottom: 1.5rem; border-bottom: 1px solid #eee; padding-bottom: 1rem; }

.btn-full { 
    width: 100%; 
    padding: 0.8rem; 
    margin-top: 1rem; 
    font-weight: bold; 
    border-radius: 8px; 
    cursor: pointer;
    background: var(--primary);
    color: white;
    border: none;
}

/* ==========================================================================
   AJUSTES RESPONSIVOS (STRICT MODE - SEM ALTERAR LÓGICA)
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* Ajuste da grade de estatísticas no iPhone/iPad */
    .stats-grid {
        grid-template-columns: 1fr 1fr; /* 2 colunas no celular */
        gap: 1rem;
    }

    .stat-card .value { font-size: 1.5rem; }

    /* Transformação da Tabela em Cards */
    .table-card { border: none; background: transparent; box-shadow: none; overflow: visible; }
    
    table, thead, tbody, th, td, tr { display: block; }
    
    table thead { display: none; } /* Esconde o cabeçalho original */

    table tr {
        background: white;
        margin-bottom: 1.2rem;
        border-radius: 12px;
        box-shadow: var(--shadow);
        border: 1px solid #e5e7eb;
        overflow: hidden;
    }

    table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.8rem 1rem;
        border-bottom: 1px solid #f3f4f6;
        position: relative;
    }

    /* O Segredo: Insere o título da coluna antes do dado */
    table td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.7rem;
        color: var(--primary);
        text-align: left;
        margin-right: 10px;
    }

    table td:last-child {
        border-bottom: none;
        background: #f9fafb;
        justify-content: center;
        padding: 1rem;
    }

    .col-acoes { width: 100%; justify-content: space-around; }

    /* Ajuste de formulários e botões */
    .form-row { grid-template-columns: 1fr; }
    .btn-full { font-size: 1rem; padding: 1rem; }
}

/* ==========================================================================
   RODAPÉ OU MARGEM FINAL
   ========================================================================== */
.footer-spacer {
    height: 4rem; 
}