body {
    margin: 0;
    font-family: 'Varela', sans-serif;
    background: #ececec;
    color: #2f3337;
}

.grant-page {
    max-width: 1200px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

.grant-top-row {
    margin-bottom: 20px;
}

#back-to-funding {
    color: #0d4a47;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 14px;
}

#back-to-funding:hover {
    text-decoration: underline;
}

.main-item {
    background: #fff;
    border: 1px solid #d9dde2;
    border-radius: 4px;
    padding: 20px;
}

.profile-header {
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 8px;
    font-size: 34px;
    font-weight: 600;
}

h2 {
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 600;
}

.grant-subtitle {
    margin-bottom: 0;
    font-size: 18px;
    color: #444b52;
}

#tagged-projects {
    font-size: 14px;
    color: #555;
    margin-top: 6px;
}

#tagged-projects .tagged-label {
    font-weight: 600;
    color: #0d4a47;
}

#tagged-projects a {
    color: #0d4a47;
    text-decoration: underline;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dash-item-container {
    display: flex;
    flex-flow: row wrap;
    align-items: stretch;
    background: #0f4f4e;
    color: #fff;
    border-radius: 4px;
    margin-bottom: 14px;
}

.dash-item-container .dash-item {
    flex: 1 1 220px;
    min-width: max-content;
    padding: 18px;
    border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.dash-item-container .dash-item:last-child {
    border-right: 0;
}

.detail-item {
    background: #ffffff;
    border: 1px solid #d9dde2;
    border-radius: 4px;
    padding: 12px 14px;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.meta-label,
.detail-label {
    font-size: 13px;
    color: #606a73;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.meta-value,
.detail-value {
    font-size: 18px;
    font-weight: 600;
    color: #2f3337;
    line-height: 1.3;
}

.detail-value {
    font-size: 17px;
    font-weight: 500;
}

#grant-description {
    white-space: pre-wrap;
    line-height: 1.5;
}

.dash-item .meta-label,
.dash-item .meta-value {
    color: #fff;
}

.grant-section {
    margin-top: 24px;
    background: #ffffff;
    border: 1px solid #d9dde2;
    border-radius: 4px;
    padding: 18px;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 24px;
    margin-top: 24px;
}

.section-grid .grant-section {
    margin-top: 0;
}

.grant-section p {
    margin: 0;
    font-size: 17px;
    line-height: 1.5;
}

.grant-section h2 {
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e4e7eb;
}

#grant-guidelines-link,
#grant-officer-email {
    color: #0d4a47;
}

.grant-error {
    background: #ffffff;
    border: 1px solid #d9dde2;
    border-radius: 4px;
    padding: 14px;
}

.grant-map {
    width: 100%;
    height: 420px;
    border-radius: 4px;
    overflow: hidden;
}

@media (max-width: 900px) {
    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 20px;
    }

    .grant-subtitle {
        font-size: 16px;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-grid {
        grid-template-columns: 1fr;
    }

    .dash-item-container .dash-item {
        min-width: 180px;
    }

    .meta-value,
    .detail-value {
        font-size: 16px;
    }
}

@media (max-width: 560px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .dash-item-container .dash-item {
        flex: 1 1 100%;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    }

    .dash-item-container .dash-item:last-child {
        border-bottom: 0;
    }

    .detail-item-full {
        grid-column: auto;
    }

    .grant-map {
        height: 320px;
    }
}

/* ── Profile Save / Favorite button ───────────────────────── */

.btn-save-profile {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid #0d4a47;
    color: #0d4a47;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.btn-save-profile:hover {
    background: #0d4a47;
    color: #fff;
}

.btn-save-profile.saved {
    background: #0d4a47;
    color: #fff;
}

.btn-save-profile .save-star {
    font-size: 18px;
    line-height: 1;
}

/* ── Save / Bookmark star ─────────────────────────────────── */

.save-grant-btn {
    cursor: pointer;
    font-size: 20px;
    color: #ccc;
    transition: color 0.15s;
    user-select: none;
}

.save-grant-btn:hover {
    color: #e8a500;
}

.save-grant-btn.saved {
    color: #e8a500;
}

/* ── Match Score badges ───────────────────────────────────── */

.match-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.match-high {
    background: #d4edda;
    color: #155724;
}

.match-mid {
    background: #fff3cd;
    color: #856404;
}

.match-low {
    background: #f0f0f0;
    color: #666;
}

/* ── Matching Projects cards ──────────────────────────────── */

.matching-projects-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
}

.mp-card {
    flex: 1 1 0;
    min-width: 200px;
    max-width: 280px;
    background: #f8f9fa;
    border: 1px solid #d9dde2;
    border-radius: 6px;
    padding: 14px;
    text-decoration: none;
    color: #2f3337;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.mp-card:hover {
    border-color: #0d4a47;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.mp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mp-card-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mp-card-meta {
    font-size: 13px;
    color: #606a73;
    line-height: 1.4;
}

.mp-status {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 3px;
}

.status-submitted {
    background: #d4edda;
    color: #155724;
}

.status-draft {
    background: #fff3cd;
    color: #856404;
}

/* ── Matching badge in save/tag multiselect ───────────────── */

.matching-badge {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}

/* ── Featured badge ───────────────────────────────────────── */

.featured-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
}

.featured-card-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 8px;
}

/* Funding Navigation loads grants.css, whose generic dashboard styles are
   green. Keep recommendation metrics aligned with the white FCD cards. */
#recommendation-metrics .dash-item-container {
    color: #2f3337;
    background: #fff;
    border-radius: 0;
}

#recommendation-metrics .dash-item {
    color: #2f3337;
    background: #fff;
    border-right-color: #ccc;
}

#recommendation-metrics .dash-item span,
#recommendation-metrics .dash-item div {
    color: #2f3337;
}
