:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #f59e0b;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #cbd5e1;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

header {
    background-color: var(--card-bg);
    border-bottom: 3px solid var(--primary);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.logo-container img {
    height: 50px;
    object-fit: contain;
}

.nav-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    background: #f1f5f9;
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ÁREA DE TRABALHO BEM AMPLA */
main {
    max-width: 1500px;
    margin: 30px auto;
    padding: 0 20px;
}

.view-section {
    display: none;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border-top: 5px solid var(--primary);
}

.view-section.active {
    display: block;
}

.form-header-flex {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 20px;
}

.form-header-flex img {
    height: 60px;
    object-fit: contain;
}

.form-header-flex h2 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--text-main);
}

.form-header-flex p {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #334155;
}

input[type="text"], input[type="email"], select, input[type="file"], input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #f8fafc;
    transition: all 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    margin-top: 10px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* --- BARRA DE FILTROS --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-search-name {
    flex: 1;
    min-width: 240px;
    max-width: 320px;
}

.filter-age-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f8fafc;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-age-group input[type="number"] {
    width: 65px !important;
    padding: 6px 8px !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    font-size: 0.88rem !important;
    text-align: center;
    background-color: #fff !important;
}

/* TABELA COM ESPAÇAMENTO ADEQUADO E RESPIRO NA DIREITA */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th, td {
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: var(--text-muted);
}

/* Coluna de Telefone */
th.col-telefone, td.col-telefone {
    white-space: nowrap;
    min-width: 160px;
}

/* Coluna de Ações com margem de segurança extra à direita para nunca cortar a lixeira */
th.col-acoes, td.col-acoes {
    white-space: nowrap;
    min-width: 150px;
    text-align: center;
    padding-right: 30px;
}

.badge {
    background-color: #dbeafe;
    color: var(--primary);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    line-height: 1.3;
    max-width: 250px;
    white-space: normal;
}

.badge small {
    font-size: 0.78rem;
    color: #1e40af !important;
    font-weight: 500;
}

.download-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.download-link:hover {
    text-decoration: underline;
}

.success-msg {
    display: none;
    background-color: #d1fae5;
    color: #065f46;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-top: 20px;
    border: 1px solid #a7f3d0;
}

.action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    min-width: 130px;
}

.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-action:hover {
    transform: scale(1.2);
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 8% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    border-top: 5px solid var(--primary);
}

.modal-content h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 15px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #ef4444;
}

#notasCandidato {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 15px;
    box-sizing: border-box;
}

#notasCandidato:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #f8fafc;
    transition: all 0.2s;
    font-family: inherit;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.whatsapp-link {
    color: #16a34a;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.whatsapp-link:hover {
    color: #15803d;
    text-decoration: underline;
}

.form-row-dupla {
    display: flex;
    gap: 15px;
}

.form-row-dupla .form-group {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row-dupla {
        flex-direction: column;
        gap: 0;
    }
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-search-name {
        max-width: 100%;
    }
    .filter-age-group {
        justify-content: space-between;
    }
}