:root {
    --bg: #f3f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #133041;
    --muted: #648093;
    --primary: #0f9d95;
    --secondary: #ff7a45;
    --line: #d8e4ee;
    --danger: #d04047;
    --success: #1f9d55;
    --radius: 16px;
    --shadow: 0 12px 30px rgba(7, 38, 58, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 80% -20%, #d7f4f0 0%, transparent 50%),
                radial-gradient(circle at 10% 120%, #ffe5d9 0%, transparent 45%),
                var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.app-sidebar {
    background: linear-gradient(180deg, #0d2f3d, #12475a);
    color: #f6fbff;
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.profile {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 18px;
}

.profile small {
    display: block;
    text-transform: uppercase;
    color: #b9e7f2;
    margin-top: 4px;
    letter-spacing: 0.04em;
}

.menu {
    display: grid;
    gap: 8px;
}

.menu a {
    border-radius: 12px;
    padding: 10px 12px;
    color: #c8e8f3;
    font-size: 0.95rem;
}

.menu a.active,
.menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.app-main {
    padding: 24px;
    overflow-x: hidden;
}

.app-main.full {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 18px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.55rem;
}

.page-header p {
    color: var(--muted);
    margin: 8px 0 0;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-top: 16px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.stats-grid {
    margin-top: 16px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
    background: linear-gradient(160deg, #f7fcff, #fff);
    border: 1px solid #d2e5f4;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.45rem;
    color: #0b2a3a;
}

.grid-2 {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr 1fr;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

.researcher-mobile-list {
    display: none;
}

.researcher-mobile-card {
    border: 1px solid #dbe8f2;
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 8px;
}

.researcher-mobile-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.researcher-mobile-card p {
    margin: 0;
    color: #4d6c80;
    font-size: 0.88rem;
}

.researcher-mobile-metrics {
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr;
    font-size: 0.86rem;
    color: #45687d;
}

.researcher-mobile-metrics strong {
    color: #133244;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e3edf4;
    font-size: 0.92rem;
    vertical-align: top;
}

th {
    background: #f4f8fc;
    color: #33566c;
    font-weight: 600;
}

.form-grid,
.filter-grid {
    display: grid;
    gap: 8px;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cddce8;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    color: #113043;
}

textarea {
    resize: vertical;
}

.btn {
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    padding: 10px 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sm {
    padding: 7px 10px;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0c8d86);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #ff9656);
    color: #fff;
}

.btn-light {
    background: #eff6fb;
    color: #19445a;
    border: 1px solid #d5e5f1;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.inline-checkbox input {
    width: auto;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-ativa {
    background: #ddf7ec;
    color: #1f8654;
}

.badge-rascunho {
    background: #fff2d6;
    color: #9b6600;
}

.badge-encerrada {
    background: #f7dde0;
    color: #9c2b39;
}

.alert {
    margin-bottom: 12px;
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #e5f9ef;
    color: #197d48;
    border-color: #c4efd9;
}

.alert-error {
    background: #fde8ea;
    color: #ab2a35;
    border-color: #f6c7cd;
}

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.phone-frame {
    width: min(430px, 100%);
    border-radius: 32px;
    background: linear-gradient(180deg, #0f3647, #20556b 38%, #e8f4fb 38%, #eef8ff 100%);
    padding: 16px;
    box-shadow: 0 25px 50px rgba(5, 35, 52, 0.3);
}

.login-hero {
    color: #fff;
    padding: 12px 12px 26px;
}

.login-hero h1 {
    margin: 0;
    font-size: 1.45rem;
}

.login-hero p {
    margin: 10px 0 0;
    color: #ccecf8;
    font-size: 0.92rem;
    line-height: 1.35;
}

.login-card {
    margin: 0;
    background: #fff;
    border: 1px solid #d9e8f3;
}

.dual-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 8px;
}

.hint {
    display: block;
    margin-top: 10px;
    color: #5f7d90;
}

.map-canvas {
    width: 100%;
    height: min(72vh, 650px);
    border-radius: 14px;
    overflow: hidden;
}

.question-wizard {
    gap: 14px;
}

.wizard-progress {
    background: #f2f8fd;
    border: 1px solid #d9e8f4;
    border-radius: 12px;
    padding: 8px 10px;
    color: #376078;
    font-weight: 600;
}

.wizard-step {
    display: none;
    gap: 8px;
}

.wizard-step.is-active {
    display: grid;
}

.wizard-step h3 {
    margin: 4px 0;
    font-size: 1.02rem;
}

.wizard-actions {
    margin-top: 12px;
}

.candidate-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.candidate-grid.selectable {
    margin-bottom: 6px;
}

.candidate-option-card,
.candidate-admin-card {
    border: 1px solid #d2e3ef;
    border-radius: 14px;
    background: #fff;
    padding: 10px;
}

.candidate-option-card {
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.candidate-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.candidate-option-card.is-selected {
    border-color: #0f9d95;
    box-shadow: 0 0 0 3px rgba(15, 157, 149, 0.16);
}

.candidate-option-card img,
.candidate-admin-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid #dde9f2;
}

.candidate-option-card strong,
.candidate-admin-info strong {
    display: block;
}

.candidate-admin-card {
    display: grid;
    gap: 8px;
    align-content: start;
}

.candidate-admin-card.is-inactive {
    opacity: 0.55;
}

.candidate-admin-info {
    display: grid;
    gap: 2px;
}

.candidate-admin-info small {
    color: var(--muted);
}

.candidate-placeholder {
    width: 100%;
    height: 120px;
    border-radius: 10px;
    border: 1px dashed #cadbe8;
    background: #f6fbff;
    color: #6d8ca1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.pagination {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.pagination span {
    color: #46677b;
    font-size: 0.9rem;
}

.public-form-wrap {
    max-width: 960px;
}

.cookie-card {
    text-align: left;
}

.success-card {
    text-align: center;
}

.success-check {
    width: 86px;
    height: 86px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #60cf9b, #1f9d55);
    color: #fff;
    font-size: 2.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popSuccess 0.65s ease both;
    box-shadow: 0 14px 24px rgba(31, 157, 85, 0.25);
}

@keyframes popSuccess {
    0% { transform: scale(0.55); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        height: auto;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .candidate-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-main {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .brand {
        margin-bottom: 12px;
    }

    .menu {
        grid-template-columns: 1fr 1fr;
    }

    .menu a {
        font-size: 0.85rem;
        padding: 9px;
        text-align: center;
    }

    .candidate-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .candidate-option-card img,
    .candidate-admin-card img,
    .candidate-placeholder {
        height: 92px;
    }

    .wizard-actions .btn {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .researcher-desktop-table {
        display: none;
    }

    .researcher-mobile-list {
        display: grid;
        gap: 10px;
        margin-top: 6px;
    }

    .researcher-mobile-card .btn {
        width: 100%;
    }
}
