:root {
    --ink: #18201d;
    --muted: #5e6a64;
    --line: #dfe6e1;
    --paper: #fbfcfa;
    --band: #eef5f1;
    --accent: #1f7a68;
    --accent-2: #bb4b45;
    --signal: #2d5f9a;
    --source: #8a6f22;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.site-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 18px clamp(20px, 5vw, 72px);
}

.brand,
.nav {
    align-items: center;
    display: flex;
    gap: 14px;
}

.brand {
    font-weight: 750;
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    aspect-ratio: 1;
    background: var(--ink);
    border-radius: 6px;
    color: white;
    display: inline-flex;
    font-size: 0.82rem;
    justify-content: center;
    width: 42px;
}

.brand-logo {
    border-radius: 6px;
    display: block;
    height: 120px;
    margin-left: -35px;
    object-fit: cover;
    width: 120px;
}

.admin-label {
    font-weight: 750;
}

.nav a {
    color: var(--muted);
    font-size: 0.95rem;
    text-decoration: none;
}

.hero,
.page-head,
.band {
    padding: clamp(44px, 8vw, 92px) clamp(20px, 5vw, 72px);
}

.hero {
    align-items: end;
    display: grid;
    min-height: 64vh;
}

.hero-copy,
.page-head,
.band > * {
    max-width: 1120px;
}

.hero-copy {
    max-width: 900px;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 10px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 5.7rem);
    letter-spacing: 0;
    line-height: 0.95;
    margin-bottom: 22px;
    max-width: 1050px;
}

h2 {
    font-size: clamp(1.7rem, 3vw, 2.6rem);
    line-height: 1.05;
}

h3 {
    font-size: 1.18rem;
}

.lede,
.page-head p {
    color: var(--muted);
    font-size: 1.15rem;
    max-width: 760px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 7px;
    color: white;
    display: inline-flex;
    font-weight: 700;
    min-height: 44px;
    padding: 10px 16px;
    text-decoration: none;
}

.button-secondary {
    background: transparent;
    color: var(--ink);
}

.band-muted {
    background: var(--band);
}

.section-heading {
    margin-bottom: 26px;
}

.card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card,
.list-item {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}

.card-meta,
.list-item span {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.88rem;
    gap: 10px;
}

.card h2,
.card h3 {
    margin: 14px 0 10px;
}

.card a {
    text-decoration: none;
}

.traction {
    background: #e6ece8;
    border-radius: 999px;
    height: 8px;
    margin-top: 18px;
    overflow: hidden;
}

.traction span {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    display: block;
    height: 100%;
}

.list {
    display: grid;
    gap: 12px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.tag-row span,
.tag-row a {
    background: #edf2ef;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    padding: 5px 9px;
    text-decoration: none;
}

.table-wrap {
    overflow-x: auto;
}

table {
    background: white;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    text-align: left;
}

.map-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    padding: 0 clamp(20px, 5vw, 72px) clamp(44px, 8vw, 92px);
}

.map-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
}

.map-toolbar button {
    background: white;
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    padding: 9px 14px;
}

.map-toolbar .active {
    background: var(--ink);
    color: white;
}

.map-legend {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    grid-column: 1 / -1;
    margin-top: -6px;
}

.map-status {
    color: var(--muted);
    font-size: 0.92rem;
    grid-column: 1 / -1;
    margin-top: -8px;
}

.map-legend span {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.legend-dot {
    border-radius: 999px;
    display: inline-block;
    height: 12px;
    width: 12px;
}

.legend-tag {
    background: var(--accent);
}

.legend-source {
    background: var(--source);
}

.legend-overlap {
    background: var(--accent-2);
}

.legend-organization {
    background: var(--signal);
}

#ecosystem-map,
.map-panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
}

#ecosystem-map {
    height: min(68vh, 680px);
    width: 100%;
}

.map-panel {
    align-self: start;
    padding: 20px;
}

.connection-list {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
}

.connection-list h3 {
    font-size: 1rem;
    margin: 0 0 4px;
}

.connection-list button {
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    text-align: left;
}

.connection-list button:hover {
    border-color: var(--accent);
}

.connection-list small {
    color: var(--muted);
}

.admin-header {
    background: #f4f8f5;
}

.compact-head {
    padding-bottom: 28px;
}

.metric-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}

.metric strong {
    display: block;
    font-size: 2.5rem;
    line-height: 1;
}

.metric span {
    color: var(--muted);
}

.taxonomy-insights {
    padding-top: clamp(34px, 6vw, 64px);
}

.taxonomy-metrics {
    margin-bottom: 18px;
}

.insight-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.rank-list {
    display: grid;
    gap: 10px;
}

.rank-item {
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    text-decoration: none;
}

.rank-item:hover {
    border-color: var(--accent);
}

.rank-list span {
    font-weight: 750;
}

.rank-list small {
    color: var(--muted);
}

.notice {
    background: #e7f4ef;
    border: 1px solid #b8d8cd;
    border-radius: 8px;
    color: var(--ink);
    margin-bottom: 18px;
    padding: 12px 14px;
}

.notice-error {
    background: #fbe9e7;
    border-color: #e7bab6;
}

.actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.actions form {
    margin: 0;
}

.actions button {
    background: var(--ink);
    border: 0;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    padding: 7px 10px;
}

.admin-form,
.form-stack {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

.admin-form label,
.form-stack label {
    color: var(--muted);
    display: grid;
    font-weight: 700;
    gap: 6px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    font: inherit;
    padding: 11px 12px;
    width: 100%;
}

textarea {
    min-height: 96px;
}

.checkbox-label {
    align-items: center;
    display: flex !important;
    gap: 8px;
}

.checkbox-label input {
    width: auto;
}

.auth-page {
    align-items: center;
    display: grid;
    min-height: 100vh;
    padding: 24px;
}

.auth-box {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0 auto;
    max-width: 460px;
    padding: 32px;
    width: 100%;
}

@media (max-width: 780px) {
    .site-header,
    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-shell {
        grid-template-columns: 1fr;
    }
}
