:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e6eaf1;
    --border-strong: #d7dceb;
    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #94a3b8;

    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #eff4ff;
    --purple: #7c3aed;
    --purple-light: #f3eeff;
    --green: #10b981;
    --green-light: #e7faf3;
    --amber: #f59e0b;
    --amber-light: #fef6e7;
    --red: #ef4444;

    --navy: #0b1230;

    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.07);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

.wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

a {
    color: inherit;
}

/* ---------- header ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 92px;
}

.header-spacer {
    grid-column: 1;
}

.logo {
    grid-column: 2;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 64px;
    width: auto;
    display: block;
}

.header-actions {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.icon-btn.is-active {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}

@media (max-width: 640px) {
    .wrap {
        padding: 0 1.1rem;
    }
    .header-inner {
        height: 68px;
    }
    .logo-img {
        height: 44px;
    }
    .icon-btn {
        width: 34px;
        height: 34px;
    }
}

/* ---------- hero ---------- */

.hero {
    padding: 2.4rem 0 0.8rem;
    text-align: center;
}

.hero-title {
    font-size: 3.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 auto 0.8rem;
    line-height: 1.12;
    max-width: 22ch;
}

.hero-title .grad {
    background: linear-gradient(90deg, var(--blue), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    color: var(--text-soft);
    font-size: 1.15rem;
    max-width: 68ch;
    margin: 0 auto 1.6rem;
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem;
    }
    .hero-sub {
        font-size: 0.95rem;
    }
}

@media (max-width: 420px) {
    .hero-title {
        font-size: 1.65rem;
    }
}

/* ---------- main 3-col grid ---------- */

.layout-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 290px;
    gap: 1.25rem;
    align-items: start;
    padding-bottom: 2.5rem;
}

@media (max-width: 1180px) {
    .layout-grid {
        grid-template-columns: 1fr 1fr;
    }
    .col-side {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 760px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .col-side {
        grid-template-columns: 1fr;
    }
}

/* ---------- stat cards ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.95rem 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

.stat-ico.c-blue { background: var(--blue-light); color: var(--blue); }
.stat-ico.c-purple { background: var(--purple-light); color: var(--purple); }
.stat-ico.c-green { background: var(--green-light); color: var(--green); }
.stat-ico.c-amber { background: var(--amber-light); color: var(--amber); }

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.cta-banner {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--blue-light);
    border: 1px solid #d7e6ff;
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--blue-dark);
}

.cta-banner .star {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 0.85rem;
}

/* ---------- map card ---------- */

.map-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.7rem;
}

.panel-head h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}

.panel-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.map-stage {
    position: relative;
    padding: 0.4rem;
}

.map-svg-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    transform-origin: center center;
    transition: transform 0.18s ease;
    cursor: grab;
}

.map-svg-wrap.is-zoomed {
    cursor: grab;
}

.map-svg-wrap.is-dragging {
    cursor: grabbing;
    transition: none;
}

.map-svg-wrap svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

/* fragmentos do SVG sem id (ilhas/recortes costeiros) — cor neutra de base;
   :not([id]) garante que nunca sobrescreva os polígonos reais dos estados */
.map-svg-wrap svg polygon.state:not([id]) {
    fill: #dde6f7;
}

.state-shape {
    stroke: #ffffff;
    stroke-width: 1px;
    cursor: pointer;
    transition: filter 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease;
}

.state-shape:hover {
    filter: brightness(1.08);
    stroke: var(--blue-dark);
    stroke-width: 1.6px;
}

.state-shape.is-active {
    stroke: var(--navy);
    stroke-width: 2px;
    filter: drop-shadow(0 0 5px rgba(37, 99, 235, 0.55));
}

.state-shape.b0 { fill: #eef1f8; }
.state-shape.b1 { fill: #bfdbfe; }
.state-shape.b2 { fill: #7ab3f8; }
.state-shape.b3 { fill: #3b82f6; }
.state-shape.b4 { fill: #1d4ed8; }

.map-zoom {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.map-zoom button {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 7px;
    color: var(--text-soft);
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 700;
}

.map-zoom button:hover {
    background: var(--surface-2);
    color: var(--blue);
}

.map-legend {
    position: absolute;
    left: 0.4rem;
    bottom: 0.4rem;
    z-index: 3;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 0.72rem;
    box-shadow: var(--shadow-sm);
}

.map-legend .lg-title {
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-soft);
}

.map-legend .lg-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
}

.map-legend .sw {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .map-legend {
        position: static;
        margin-top: 0.7rem;
        width: 100%;
        background: var(--surface-2);
        box-shadow: none;
    }

    .map-legend .lg-row {
        display: inline-flex;
        margin-right: 0.7rem;
    }
}

.map-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 4;
    pointer-events: none;
    background: var(--navy);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 7px;
    opacity: 0;
    transition: opacity 0.12s ease;
    white-space: nowrap;
}

.chip-nacional {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
    padding: 0.7rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip-nacional .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
}

.chip-nacional:hover {
    border-color: var(--border-strong);
    background: #eef2f9;
}

.chip-nacional.is-active {
    background: var(--blue-light);
    border-color: #b9d4ff;
    color: var(--blue-dark);
}

.chip-nacional.is-active .dot {
    background: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* ---------- sidebar cards (filters / ranking / donut) ---------- */

.side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.side-card:last-child {
    margin-bottom: 0;
}

.side-card h3 {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0 0 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clear-filters {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.clear-filters:hover {
    color: var(--blue);
}

.fgroup {
    margin-bottom: 0.85rem;
}

.fgroup:last-child {
    margin-bottom: 0;
}

.fgroup label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 0.35rem;
}

.fselect, .ftext {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    appearance: none;
}

.fselect {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 1.8rem;
}

.fselect:focus, .ftext:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--surface);
}

.fsubmit {
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.6rem;
    background: linear-gradient(90deg, var(--blue), var(--blue-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}

.fsubmit:hover {
    filter: brightness(1.05);
}

/* ranking */

.rank-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
    font-size: 0.82rem;
}

.rank-row .rn {
    width: 18px;
    color: var(--text-muted);
    font-weight: 700;
    flex: 0 0 auto;
}

.rank-row .rname {
    flex: 0 0 88px;
    font-weight: 600;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-bar-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.rank-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--blue), var(--purple));
}

.rank-row .rcount {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--text);
    font-size: 0.78rem;
}

.rank-more {
    display: none;
}

.rank-more.is-open {
    display: block;
}

.rank-toggle {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.55rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-soft);
    cursor: pointer;
}

.rank-toggle:hover {
    background: #eef2f9;
}

/* donut */

.donut-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.donut {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    flex: 0 0 auto;
    position: relative;
}

.donut::after {
    content: '';
    position: absolute;
    inset: 16px;
    background: var(--surface);
    border-radius: 50%;
}

.donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.donut-legend .dl-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-soft);
}

.donut-legend .sw {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
}

.donut-legend strong {
    margin-left: auto;
    color: var(--text);
}

/* ---------- editais recentes ---------- */

.editais-section {
    padding-bottom: 1rem;
}

.editais-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.editais-head h2 {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.editais-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.editais-count strong {
    color: var(--blue);
}

.cards-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text);
    font-size: 1rem;
    margin: 0 0 0.5rem;
}

.empty-state p {
    margin: 0;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.15rem 1.2rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.card.is-hidden {
    display: none;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
    gap: 0.5rem;
}

.badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
}

.badge.status-open { color: var(--green); background: var(--green-light); }
.badge.status-expected { color: var(--amber); background: var(--amber-light); }
.badge.status-closed { color: var(--red); background: #fde8e8; }

.card-top-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vagas {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-soft);
}

.fav-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.05rem;
    color: var(--border-strong);
    line-height: 1;
    padding: 0;
}

.fav-btn.is-fav {
    color: #f43f5e;
}

.card-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.card-resumo {
    font-size: 0.86rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
    flex-grow: 1;
}

.card-link {
    align-self: flex-start;
    color: var(--blue);
    font-weight: 700;
    font-size: 0.82rem;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font);
    cursor: pointer;
}

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

/* ---------- feature banner ---------- */

.feature-banner {
    background: var(--navy);
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.8rem;
    margin-bottom: 2.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
}

@media (max-width: 860px) {
    .feature-banner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 520px) {
    .feature-banner {
        grid-template-columns: 1fr;
    }
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #fff;
}

.feature-item .fi-ico {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex: 0 0 auto;
}

.feature-item .fi-title {
    font-size: 0.86rem;
    font-weight: 700;
}

.feature-item .fi-sub {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.15rem;
}

/* ---------- modal de detalhes ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-panel {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 720px;
    width: 100%;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.35);
    padding: 2rem 2rem 2.2rem;
}

@media (max-width: 640px) {
    .modal-backdrop {
        padding: 0;
    }
    .modal-backdrop.is-open {
        display: block;
    }
    .modal-panel {
        max-width: none;
        min-height: 100%;
        border-radius: 0;
        padding: 1.5rem 1.15rem 2rem;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: 0.9rem;
    cursor: pointer;
}

.modal-close:hover {
    background: #eef2f9;
    color: var(--text);
}

.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.modal-error {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-soft);
}

.modal-error a {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.detalhe-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: var(--blue-light);
    color: var(--blue-dark);
    margin-bottom: 0.8rem;
}

.detalhe-titulo {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 0.5rem;
}

.detalhe-resumo {
    font-size: 0.92rem;
    color: var(--text-soft);
    margin: 0 0 0.9rem;
}

.detalhe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    font-size: 0.76rem;
    color: var(--text-muted);
    padding-bottom: 1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}

.detalhe-imagem {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin-bottom: 1.1rem;
    display: block;
}

.detalhe-body {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text);
}

.detalhe-body p {
    margin: 0 0 1rem;
}

.detalhe-body h2, .detalhe-body h3 {
    font-size: 1.02rem;
    font-weight: 800;
    margin: 1.4rem 0 0.7rem;
}

.detalhe-body a {
    color: var(--blue);
    text-decoration: underline;
}

.detalhe-body ul, .detalhe-body ol {
    margin: 0 0 1rem;
    padding-left: 1.3rem;
}

.detalhe-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.2rem;
    font-size: 0.85rem;
}

.detalhe-body th, .detalhe-body td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.6rem;
    text-align: left;
}

@media (max-width: 640px) {
    .detalhe-body table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ---------- footer ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
}

@media (max-width: 480px) {
    .search-btn-wrap {
        flex-wrap: wrap;
    }
}
