:root {
    --blue-dark: #003876;
    --blue-mid: #005baa;
    --blue-light: #e8f0fe;
    --green: #2e7d32;
    --green-light: #e8f5e9;
    --orange: #e65100;
    --orange-light: #fff3e0;
    --purple: #6a1b9a;
    --purple-light: #f3e5f5;
    --teal: #00695c;
    --teal-light: #e0f2f1;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-600: #757575;
    --gray-800: #424242;
    --gray-900: #212121;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-900);
    line-height: 1.6;
    background: var(--gray-50);
}

/* ── Logos bar ── */
.logos-bar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 1.5rem;
}
.logos-bar .container {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}
.logos-bar img, .logos-bar svg {
    height: 36px;
    width: auto;
    object-fit: contain;
}
.logos-bar .sep {
    width: 1px;
    height: 28px;
    background: var(--gray-300);
}

/* ── Header ── */
header {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
    color: white;
    padding: 2rem 1.5rem 1.75rem;
}
header .container {
    max-width: 1160px;
    margin: 0 auto;
}
header .badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
header .badge {
    background: rgba(255,255,255,0.18);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}
header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.5rem;
}
header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 760px;
    line-height: 1.5;
}
header .meta {
    margin-top: 1rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    opacity: 0.8;
}
header .breadcrumb {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 0.75rem;
}
header .breadcrumb a {
    color: white;
    text-decoration: none;
}
header .breadcrumb a:hover {
    text-decoration: underline;
}

/* ── Layout: sidebar + content ── */
.page-layout {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    gap: 0;
    min-height: calc(100vh - 200px);
}

/* ── Sidebar / TOC ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    font-size: 0.82rem;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

.sidebar .toc-label {
    padding: 0 1rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-600);
}
.sidebar a {
    display: block;
    padding: 0.4rem 1rem 0.4rem 1.25rem;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    line-height: 1.35;
}
.sidebar a:hover {
    color: var(--blue-mid);
    background: var(--blue-light);
}
.sidebar a.active {
    color: var(--blue-mid);
    border-left-color: var(--blue-mid);
    background: var(--blue-light);
    font-weight: 600;
}
.sidebar .toc-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.75rem 1rem;
}
.sidebar .toc-page {
    font-size: 0.78rem;
    padding-left: 1.25rem;
}
.sidebar .toc-page.current {
    color: var(--blue-dark);
    font-weight: 700;
}

/* ── Main content ── */
.content {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.5rem 4rem;
}

/* ── Sections ── */
section { margin-top: 2.5rem; }
section:first-child { margin-top: 0; }
section h2 {
    font-size: 1.35rem;
    color: var(--blue-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--blue-light);
}
section h3 {
    font-size: 1.05rem;
    color: var(--gray-800);
    margin: 1.25rem 0 0.5rem;
}
section p {
    margin-bottom: 0.75rem;
    color: var(--gray-800);
}

/* ── Cards ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}
.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--blue-mid);
}
.card h4 { font-size: 0.92rem; color: var(--blue-dark); margin-bottom: 0.4rem; }
.card p, .card li { font-size: 0.88rem; color: var(--gray-800); }
.card ul { margin: 0.4rem 0 0 1.25rem; }
.card li { margin-bottom: 0.2rem; }

/* ── Objective cards ── */
.obj-card { border-left-color: var(--green); }
.obj-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    background: var(--green-light);
    color: var(--green);
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

/* ── Timeline ── */
.timeline { position: relative; margin: 1.25rem 0; }
.timeline::before {
    content: '';
    position: absolute;
    left: 18px; top: 0; bottom: 0;
    width: 3px;
    background: var(--blue-light);
}
.phase { position: relative; padding-left: 50px; margin-bottom: 1.75rem; }
.phase-dot {
    position: absolute; left: 8px; top: 4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--blue-mid);
    color: white;
    font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.phase h3 { margin-top: 0; font-size: 1rem; color: var(--blue-dark); }
.phase .timeline-meta { font-size: 0.8rem; color: var(--gray-600); margin-bottom: 0.4rem; }
.phase ul { margin: 0.4rem 0 0 1.25rem; }
.phase li { font-size: 0.88rem; margin-bottom: 0.25rem; color: var(--gray-800); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; margin-top: 0.75rem; }
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 0.88rem;
}
thead { background: var(--blue-dark); color: white; }
th { padding: 0.75rem 0.85rem; text-align: left; font-weight: 600; font-size: 0.82rem; }
td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--gray-100); }
td.pct { font-weight: 600; color: var(--blue-mid); text-align: center; white-space: nowrap; }
td.date { white-space: nowrap; }

/* ── Progress bar ── */
.progress-track {
    display: flex; gap: 2px; margin-top: 0.75rem;
    height: 32px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.progress-seg {
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 0.72rem; font-weight: 600;
}
.progress-seg.s1 { background: #1565c0; flex: 20; }
.progress-seg.s2 { background: #2e7d32; flex: 35; }
.progress-seg.s3 { background: #e65100; flex: 20; }
.progress-seg.s4 { background: #6a1b9a; flex: 25; }
.progress-labels {
    display: flex; gap: 2px; margin-top: 0.3rem;
    font-size: 0.72rem; color: var(--gray-600);
}
.progress-labels span { text-align: center; }
.progress-labels .s1 { flex: 20; }
.progress-labels .s2 { flex: 35; }
.progress-labels .s3 { flex: 20; }
.progress-labels .s4 { flex: 25; }

/* ── Country flags ── */
.countries { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.75rem; }
.country {
    display: flex; align-items: center; gap: 0.5rem;
    background: white; padding: 0.5rem 0.85rem;
    border-radius: var(--radius); box-shadow: var(--shadow);
    font-weight: 500; font-size: 0.92rem;
}
.country .flag { font-size: 1.4rem; }
.country.primary { border: 2px solid var(--blue-mid); }

/* ── Team grid ── */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem; margin-top: 0.75rem;
}
.team-card { background: white; border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.team-card h4 { color: var(--blue-dark); font-size: 0.95rem; margin-bottom: 0.4rem; }
.team-card ul { margin: 0.4rem 0 0 1.25rem; font-size: 0.83rem; }
.team-card li { margin-bottom: 0.2rem; color: var(--gray-800); }

/* ── Highlight box ── */
.highlight {
    background: var(--orange-light);
    border-left: 4px solid var(--orange);
    padding: 0.85rem 1.1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 0.75rem 0;
}
.highlight p { font-size: 0.88rem; margin: 0; }

/* ── Library: featured ── */
.featured {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, var(--blue-light) 0%, #f0f7ff 100%);
    border: 1px solid #c5d9f0;
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex; gap: 1.25rem; align-items: flex-start;
}
.featured-badge {
    background: var(--blue-mid); color: white;
    font-size: 0.68rem; font-weight: 700;
    padding: 0.2rem 0.55rem; border-radius: 4px;
    text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
.featured-icon {
    flex-shrink: 0; width: 56px; height: 72px;
    background: #c62828; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.72rem;
}
.featured-content h3 { font-size: 1.05rem; color: var(--blue-dark); margin: 0.4rem 0 0.3rem; }
.featured-content p { font-size: 0.88rem; color: var(--gray-800); margin-bottom: 0.4rem; }
.featured-content .meta { font-size: 0.78rem; color: var(--gray-600); }
.featured-content a {
    display: inline-block; margin-top: 0.4rem;
    color: var(--blue-mid); font-weight: 500; font-size: 0.88rem; text-decoration: none;
}
.featured-content a:hover { text-decoration: underline; }

/* ── Library: sections ── */
.lib-section { margin-top: 2rem; }
.lib-section h2 {
    font-size: 1.15rem; color: var(--blue-dark);
    margin-bottom: 0.2rem;
    display: flex; align-items: center; gap: 0.5rem;
    border-bottom: none; padding-bottom: 0;
}
.lib-section .section-count {
    background: var(--gray-200); color: var(--gray-600);
    font-size: 0.72rem; font-weight: 600;
    padding: 0.12rem 0.45rem; border-radius: 10px;
}
.lib-section .section-desc { font-size: 0.82rem; color: var(--gray-600); margin-bottom: 0.75rem; }

/* ── Library: resources ── */
.resource-list { display: flex; flex-direction: column; gap: 0.6rem; }
.resource {
    background: white; border-radius: var(--radius);
    padding: 0.9rem 1.1rem; box-shadow: var(--shadow);
    display: flex; gap: 0.85rem; align-items: flex-start;
    transition: box-shadow 0.2s;
}
.resource:hover { box-shadow: var(--shadow-lg); }
.resource-num {
    flex-shrink: 0; width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; color: white;
}
.cat-carbon-markets .resource-num { background: var(--blue-mid); }
.cat-rwanda .resource-num { background: var(--green); }
.cat-kenya .resource-num { background: var(--orange); }
.cat-mrv .resource-num { background: var(--purple); }
.cat-watershed .resource-num { background: var(--teal); }
.resource-body { flex: 1; min-width: 0; }
.resource-body h4 { font-size: 0.9rem; line-height: 1.3; margin-bottom: 0.25rem; }
.resource-body h4 a { color: var(--gray-900); text-decoration: none; }
.resource-body h4 a:hover { color: var(--blue-mid); text-decoration: underline; }
.resource-body .desc { font-size: 0.82rem; color: var(--gray-800); margin-bottom: 0.3rem; }
.resource-body .source { font-size: 0.75rem; color: var(--gray-600); }
.resource-body .tags { margin-top: 0.3rem; display: flex; gap: 0.3rem; flex-wrap: wrap; }
.tag {
    display: inline-block; padding: 0.12rem 0.45rem;
    border-radius: 4px; font-size: 0.68rem; font-weight: 500;
}
.tag-carbon { background: var(--blue-light); color: var(--blue-mid); }
.tag-water { background: var(--teal-light); color: var(--teal); }
.tag-health { background: var(--green-light); color: var(--green); }
.tag-tech { background: var(--purple-light); color: var(--purple); }
.tag-policy { background: var(--orange-light); color: var(--orange); }

/* ── Library: filter bar ── */
.filter-bar {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    margin-bottom: 1.25rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}
.filter-bar label { font-size: 0.78rem; font-weight: 600; color: var(--gray-600); margin-right: 0.15rem; }
.filter-btn {
    display: inline-block; padding: 0.3rem 0.75rem;
    border-radius: 20px; font-size: 0.78rem; font-weight: 500;
    border: 1px solid var(--gray-300); background: white;
    color: var(--gray-800); cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--blue-mid); color: var(--blue-mid); }
.filter-btn.active { background: var(--blue-mid); color: white; border-color: var(--blue-mid); }
.search-box {
    margin-left: auto; padding: 0.35rem 0.7rem;
    border: 1px solid var(--gray-300); border-radius: 20px;
    font-size: 0.82rem; outline: none; width: 200px;
    transition: border-color 0.2s;
}
.search-box:focus { border-color: var(--blue-mid); }
.no-results { text-align: center; padding: 3rem; color: var(--gray-600); display: none; }

/* ── Reports: deliverables ── */
.deliverable {
    margin-top: 2rem; background: white;
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.deliverable:first-child { margin-top: 0; }
.deliverable-header {
    padding: 1.1rem 1.25rem;
    display: flex; align-items: center; gap: 0.85rem;
    cursor: pointer; user-select: none;
}
.deliverable-header:hover { background: var(--gray-50); }
.d-num {
    flex-shrink: 0; width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.95rem;
}
.d1 .d-num { background: #1565c0; }
.d2 .d-num { background: #2e7d32; }
.d3 .d-num { background: #e65100; }
.d4 .d-num { background: #6a1b9a; }
.d-info { flex: 1; }
.d-info h2 { font-size: 1.05rem; color: var(--gray-900); margin-bottom: 0.1rem; border-bottom: none; padding-bottom: 0; }
.d-info .d-meta { font-size: 0.78rem; color: var(--gray-600); }
.d-status { padding: 0.2rem 0.65rem; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.status-draft { background: var(--orange-light); color: var(--orange); }
.d-toggle { font-size: 1.1rem; color: var(--gray-600); transition: transform 0.3s; }
.deliverable.open .d-toggle { transform: rotate(180deg); }
.deliverable-body { display: none; border-top: 1px solid var(--gray-200); padding: 1.25rem; }
.deliverable.open .deliverable-body { display: block; }

/* ── Reports: outline ── */
.outline h3 {
    font-size: 1rem; color: var(--blue-dark);
    margin: 1.1rem 0 0.4rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--gray-200);
}
.outline h3:first-child { margin-top: 0; }
.outline h4 { font-size: 0.9rem; color: var(--gray-800); margin: 0.85rem 0 0.3rem; }
.outline p { font-size: 0.88rem; color: var(--gray-800); margin-bottom: 0.4rem; }
.outline ul, .outline ol { margin: 0.3rem 0 0.65rem 1.4rem; font-size: 0.88rem; }
.outline li { margin-bottom: 0.25rem; color: var(--gray-800); }
.outline li ul { margin-top: 0.2rem; }

.ref-box {
    background: var(--blue-light); border-left: 3px solid var(--blue-mid);
    padding: 0.65rem 0.85rem; border-radius: 0 var(--radius) var(--radius) 0;
    margin: 0.65rem 0; font-size: 0.82rem;
}
.ref-box strong { color: var(--blue-dark); }
.ref-box a { color: var(--blue-mid); text-decoration: none; }
.ref-box a:hover { text-decoration: underline; }

.guidance-box {
    background: var(--green-light); border-left: 3px solid var(--green);
    padding: 0.65rem 0.85rem; border-radius: 0 var(--radius) var(--radius) 0;
    margin: 0.65rem 0; font-size: 0.82rem;
}
.guidance-box strong { color: var(--green); }

/* ── Footer ── */
footer {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem 1.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--gray-600);
}
footer a { color: var(--blue-mid); text-decoration: none; }

/* ── Mobile ── */
@media (max-width: 768px) {
    .page-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        padding: 0.75rem 0;
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        overflow-x: auto;
    }
    .sidebar .toc-label { display: none; }
    .sidebar .toc-divider { display: none; }
    .sidebar a {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 0.5rem 0.85rem;
        white-space: nowrap;
    }
    .sidebar a.active { border-left: none; border-bottom-color: var(--blue-mid); }
    .content { padding: 1.5rem 1rem 3rem; }
    header h1 { font-size: 1.3rem; }
    header { padding: 1.5rem 1rem; }
    .card-grid, .team-grid { grid-template-columns: 1fr; }
    .featured { flex-direction: column; }
    .search-box { width: 100%; margin-left: 0; margin-top: 0.5rem; }
    .filter-bar { flex-direction: column; align-items: flex-start; }
}
