:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #17202a;
    --muted: #687385;
    --line: #d8dee8;
    --accent: #0f766e;
    --accent-strong: #0b5d56;
    --warn: #9a4d00;
    --danger: #b42318;
    --soft: #e8f3f1;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--accent-strong); text-decoration: none; }
button, .button, .button-light {
    border: 0;
    border-radius: 7px;
    background: var(--accent);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    font-weight: 700;
    cursor: pointer;
}
.button-light {
    background: #edf1f5;
    color: var(--ink);
}
button:disabled,
.button-light:disabled {
    cursor: default;
    opacity: 0.72;
}
.button-danger {
    background: var(--danger);
    color: white;
}
.small-button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}
.shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    background: #101820;
    color: white;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.brand {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}
.brand span:last-child {
    line-height: 1.2;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 7px;
    background: var(--accent);
}
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: contain;
    background: white;
    border: 1px solid rgba(255, 255, 255, .16);
}
.group-leadership {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    color: #d9e1e8;
}
.group-leadership div {
    display: grid;
    gap: 3px;
}
.group-leadership span {
    color: #9fb0bf;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
}
.group-leadership strong {
    color: white;
    line-height: 1.25;
}
.sidebar nav {
    display: grid;
    gap: 6px;
}
.sidebar nav a {
    color: #d9e1e8;
    padding: 10px 12px;
    border-radius: 7px;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: white; }
.profile {
    margin-top: auto;
    display: grid;
    gap: 4px;
    color: #d9e1e8;
    font-size: 14px;
}
.profile strong { color: white; }
.content {
    padding: 28px;
    min-width: 0;
}
.top-banner {
    min-height: 220px;
    border-radius: 8px;
    margin-bottom: 22px;
    padding: 34px;
    display: flex;
    align-items: end;
    color: white;
    background:
        linear-gradient(90deg, rgba(8, 13, 18, .96) 0%, rgba(8, 13, 18, .72) 44%, rgba(8, 13, 18, .18) 100%),
        url("?route=assets/img/research-banner.webp") center/cover no-repeat;
    overflow: hidden;
}
.top-banner p {
    margin: 0 0 8px;
    color: #5eead4;
    font-weight: 900;
    letter-spacing: 0;
}
.top-banner h1 {
    margin: 0;
    max-width: 680px;
    font-size: 34px;
    line-height: 1.12;
    letter-spacing: 0;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head h1, .auth-panel h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: 0;
}
.eyebrow {
    color: var(--accent-strong);
    margin: 0 0 4px;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 800;
}
.panel, .auth-panel, .empty {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 8px 28px rgba(23, 32, 42, .06);
}
.auth-panel {
    max-width: 430px;
    margin: 8vh auto;
}
.auth-panel.wide { max-width: 760px; }
.auth-links {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}
.stack, .grid-form { display: grid; gap: 14px; }
.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.full { grid-column: 1 / -1; }
.cnpq-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
label {
    display: grid;
    gap: 7px;
    color: #344051;
    font-weight: 700;
    font-size: 14px;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    font: inherit;
    color: var(--ink);
    background: white;
}
.access-field {
    border: 1px solid #b9d8ff;
    background: #eef7ff;
    border-radius: 8px;
    padding: 10px;
}
.access-field input {
    border-color: #9bc5f5;
    background: #f8fbff;
}
textarea { resize: vertical; }
.small-input { max-width: 90px; }
.muted, .muted-link { color: var(--muted); }
.context-line {
    margin: 0 0 14px;
    color: #344051;
}
.field-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}
.flash {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: #eef7f6;
    color: #17443f;
}
.flash.erro { background: #fff1ee; color: #782a1f; }
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stats article {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.stats strong {
    display: block;
    font-size: 28px;
}
.stats span { color: var(--muted); }
.section-title, .filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.section-title h2, .panel h2 {
    margin: 0;
    font-size: 18px;
}
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
th, td {
    text-align: left;
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    vertical-align: middle;
}
th {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
}
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
}
.cards-inline, .project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.spaced { margin-top: 18px; }
.mini-card, .project-card, .request {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: white;
}
.project-card {
    min-height: 178px;
    display: grid;
    align-content: start;
    gap: 10px;
}
.highlighted-card {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.project-card h2 {
    margin: 0;
    color: var(--ink);
    font-size: 19px;
}
.project-card p, .project-card small { margin: 0; color: var(--muted); }
.filters {
    justify-content: start;
}
.filters input { max-width: 300px; }
.filters select { max-width: 240px; }
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}
.side-stack {
    display: grid;
    gap: 18px;
}
.person, .timeline article {
    display: grid;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}
.participant-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.danger-zone {
    border-color: #f1b8b2;
    background: #fff8f7;
}
.danger-zone h2 {
    margin: 0 0 6px;
}
.profile-photo {
    display: flex;
    align-items: center;
    gap: 14px;
}
.profile-photo img, .person-card-head img, .photo-placeholder {
    width: 82px;
    height: 82px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
    background: #edf1f5;
}
.group-mini, .group-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.group-mini img, .group-card-head img {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--line);
    background: #fff;
}
.group-mini div, .group-card {
    display: grid;
    gap: 8px;
}
.group-card h2 {
    margin: 0;
    font-size: 20px;
}
.group-card-single {
    display: grid;
    gap: 18px;
}
.group-copy h3 {
    margin: 16px 0 6px;
    font-size: 15px;
}
.group-copy p {
    margin: 0;
    color: #344051;
}
.group-profile {
    display: grid;
    gap: 16px;
}
.group-profile-head {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}
.group-profile-head img,
.group-profile-head .photo-placeholder {
    width: 112px;
    height: 112px;
    object-fit: contain;
    background: white;
}
.group-profile-head h2 {
    margin: 2px 0 8px;
    font-size: 28px;
}
.link-list {
    display: grid;
    gap: 8px;
}
.people-list {
    display: grid;
    gap: 10px;
}
.person-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}
.person-row img,
.person-row .photo-placeholder {
    width: 58px;
    height: 58px;
}
.person-row h3 {
    margin: 0 0 4px;
    font-size: 16px;
}
.person-row p {
    margin: 0;
}
.field-readonly {
    display: grid;
    gap: 7px;
    align-content: center;
    min-height: 64px;
}
.field-readonly span {
    color: #344051;
    font-weight: 700;
    font-size: 14px;
}
.photo-placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.person-card {
    display: grid;
    gap: 14px;
}
.person-card-head {
    display: flex;
    gap: 12px;
    align-items: center;
}
.person-card h2 {
    margin: 0 0 4px;
    font-size: 18px;
}
.person-card p { margin: 0; }
.member-projects {
    display: grid;
    gap: 6px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}
.member-projects strong {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
}
.member-projects a {
    line-height: 1.35;
}
.item-builder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}
.item-list {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
}
.item-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    padding: 7px 10px;
    font-size: 14px;
}
.item-pill button {
    width: 22px;
    min-height: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    background: #dfe6ee;
    color: #344051;
}
.complementary-fields {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
}
.complementary-fields summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 7px;
    background: #edf1f5;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
}
.complementary-fields[open] summary {
    margin-bottom: 14px;
}
.complementary-fields .grid-form {
    padding: 0;
}
.person span, .timeline span {
    color: var(--muted);
    font-size: 13px;
}
.timeline p { margin: 0; color: #344051; }
.compact-form {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}
.checkbox-line {
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 10px;
}
.checkbox-line input {
    width: 18px;
    height: 18px;
}
.request {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}
.request h2 { margin: 0 0 6px; }
.request p { color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: start; }
.tip-list {
    display: grid;
    gap: 14px;
}
.tip-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: white;
}
.tip-card h2 {
    margin: 0 0 4px;
    font-size: 20px;
}
.tip-card span {
    color: var(--muted);
    font-size: 13px;
}
.tip-card p {
    margin: 0;
    color: #344051;
}
.empty {
    max-width: 620px;
    margin: 10vh auto;
    text-align: center;
}
code {
    background: #edf1f5;
    border-radius: 5px;
    padding: 2px 5px;
}

@media (max-width: 980px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .split, .stats, .project-grid, .cards-inline, .grid-form { grid-template-columns: 1fr; }
    .cnpq-picker, .item-builder { grid-template-columns: 1fr; }
    .page-head, .request, .filters { align-items: stretch; flex-direction: column; }
    .content { padding: 18px; }
    .top-banner { min-height: 190px; padding: 22px; }
    .top-banner h1 { font-size: 25px; }
    .group-profile-head, .person-row { grid-template-columns: 1fr; }
    .person-row .badge { justify-self: start; }
    table { min-width: 620px; }
}
