html { scroll-behavior: smooth; }

.reference-nav { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 105px); overflow-y: auto; }
.reference-nav strong { margin-bottom: 7px; color: #263746; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.reference-nav a { padding: 5px 7px; border-radius: 7px; color: #68747e; font-size: .75rem; line-height: 1.25; text-decoration: none; }
.reference-nav a:hover, .reference-nav a:focus { color: #315f4b; background: #e5f0eb; }

.reference-page { --reference-green: #4f8d72; --reference-green-dark: #315f4b; --reference-text: #263746; --reference-muted: #68747e; color: var(--reference-text); }
.reference-page section { display: block; height: auto; min-height: 0; overflow: visible; }

.reference-introduction { display: flex; gap: 14px; margin-bottom: 30px; padding: 17px 19px; border: 1px solid #dce6e1; border-radius: 13px; background: #f1f7f4; }
.reference-introduction > i { color: var(--reference-green); font-size: 1.45rem; }
.reference-introduction strong { display: block; margin-bottom: 4px; }
.reference-introduction p { margin: 0 0 5px; }
.reference-introduction small { color: var(--reference-muted); }

.reference-section { padding: 7px 4px 29px; scroll-margin-top: 85px; }
.reference-section + .reference-section { border-top: 1px solid #e8ecef; padding-top: 30px; }
.reference-section h2 { position: relative; margin: 0 0 23px; padding-bottom: 10px; color: var(--reference-green); font-size: 2rem; font-weight: 300; letter-spacing: -.035em; }
.reference-section h2::after { content: ''; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; border-radius: 2px; background: var(--reference-green); }
.reference-section h3 { margin: 19px 0 7px; color: #202a32; font-size: 1rem; font-weight: 700; }
.reference-section p, .reference-section li { color: #303a42; font-size: .93rem; line-height: 1.65; }
.reference-section p { margin: 0 0 11px; }
.reference-section ul { margin-bottom: 12px; }

.reference-formula { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 10px 0; padding: 12px 15px; border-left: 4px solid var(--reference-green); border-radius: 0 9px 9px 0; background: #f3f5f7; }
.reference-formula strong { font-size: .88rem; }
.reference-formula span { color: var(--reference-green-dark); font-size: .9rem; font-weight: 600; text-align: right; }

.reference-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.reference-links a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #cfe0d8; border-radius: 8px; color: var(--reference-green-dark); font-size: .8rem; font-weight: 600; text-decoration: none; background: #f5faf7; }
.reference-links a:hover { background: #e5f0eb; }

.reference-apsmat-help {
    margin-top: 22px;
    padding: 17px 19px;
    border: 1px solid #bcd8ca;
    border-radius: 12px;
    background: #edf7f2;
}

.reference-apsmat-help-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--reference-green-dark);
}

.reference-apsmat-help-title i { color: var(--reference-green); font-size: 1.2rem; }
.reference-apsmat-help-title strong { font-size: 1rem; }
.reference-apsmat-help p,
.reference-apsmat-help li { font-size: .88rem; line-height: 1.55; }
.reference-apsmat-help ul { margin: 8px 0 11px; padding-left: 1.2rem; }
.reference-apsmat-help p:last-child { margin-bottom: 0; }

.reference-family-events { margin: 14px 0 12px; font-size: .88rem; }
.reference-family-events thead th { color: var(--reference-green-dark); background: #e5f0eb; }
.reference-family-events th,
.reference-family-events td { padding: 9px 12px; vertical-align: middle; }
.reference-family-events th:last-child,
.reference-family-events td:last-child { width: 165px; white-space: nowrap; }
.reference-family-events .reference-family-events-category th { color: #303a42; background: #f1f3f4; }

.reference-footer-note { display: flex; flex-direction: column; gap: 4px; padding: 17px 19px; border-radius: 12px; color: #49545d; font-size: .86rem; background: #eef1f3; }
.reference-footer-note strong { color: var(--reference-text); }

@media (max-width: 767px) {
    .reference-nav { position: static; max-height: none; }
    .reference-section h2 { font-size: 1.65rem; }
    .reference-formula { align-items: flex-start; flex-direction: column; gap: 5px; }
    .reference-formula span { text-align: left; }
}
