.history-page {
    background: #f4f7f8;
}

.history-page-heading {
    padding: 38px 0 30px;
    background: var(--navy);
    color: var(--white);
}

.history-page-heading .detail-back-link {
    color: #c9edf5;
}

.history-page-heading .section-kicker {
    margin-top: 28px;
    color: #8fd8e8;
}

.history-page-heading h1 {
    max-width: none;
    margin: 4px 0 10px;
    color: var(--white);
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 1;
}

.history-page-course {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    color: #d9e7eb;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
}

.history-page-course strong {
    color: var(--white);
}

.history-year-identity {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.history-year-identity h3,
.history-year-identity p {
    margin: 0;
}

.history-year-identity p {
    color: var(--muted);
}

.history-occupancy {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #eef5f6;
}

.history-occupancy div {
    display: flex;
    gap: 7px;
}

.history-occupancy dt {
    color: var(--muted);
}

.history-occupancy dd {
    margin: 0;
    font-weight: 800;
}

.history-chart-section {
    margin-top: 30px;
}

.history-chart-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}

.history-chart-heading h2 {
    margin: 2px 0 0;
    font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.history-chart-heading > p {
    max-width: 580px;
    margin: 0 0 4px;
    color: var(--muted);
    line-height: 1.5;
    text-align: right;
}

.history-chart-card {
    position: relative;
    min-height: min(68vh, 760px);
    padding: 18px 20px 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.history-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 22px;
    min-height: 26px;
    padding: 2px 18px 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.history-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.history-chart-legend-point {
    width: 13px;
    height: 13px;
    border: 3px solid #0f5873;
    border-radius: 50%;
    background: var(--white);
}

.history-chart-legend-point--incomplete {
    border-color: #98451f;
    background: #f1a24d;
}

.history-chart-legend-forecast {
    width: 22px;
    height: 0;
    border-top: 3px dashed #76549f;
}

.history-chart-legend-forecast::after {
    display: block;
    width: 8px;
    height: 8px;
    margin: -6px auto 0;
    border: 2px solid #76549f;
    background: #fbfcfc;
    content: "";
    transform: rotate(45deg);
}

.history-chart {
    display: block;
    width: 100%;
    min-height: min(62vh, 700px);
}

.history-chart text {
    font-family: inherit;
}

.history-chart .chart-grid-line {
    stroke: #dbe5e8;
    stroke-dasharray: 4 6;
    stroke-width: 1;
}

.history-chart .chart-axis-label {
    fill: #607781;
    font-size: 13px;
    font-weight: 650;
}

.history-chart .chart-line {
    fill: none;
    stroke: #176e8e;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.history-chart .chart-area {
    fill: url(#history-chart-gradient);
}

.history-chart .chart-forecast-line {
    fill: none;
    stroke: #76549f;
    stroke-dasharray: 9 7;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.history-chart .chart-forecast-point {
    fill: #fbfcfc;
    stroke: #76549f;
    stroke-width: 3;
    cursor: pointer;
}

.history-chart .chart-forecast-point:hover,
.history-chart .chart-forecast-point:focus {
    fill: #ddcdef;
    outline: none;
    stroke-width: 4;
}

.history-chart .chart-point {
    fill: var(--white);
    stroke: #0f5873;
    stroke-width: 4;
    cursor: pointer;
    transition: r 120ms ease;
}

.history-chart .chart-point:hover,
.history-chart .chart-point:focus {
    r: 8;
    outline: none;
}

.history-chart .chart-point--complete:hover,
.history-chart .chart-point--complete:focus {
    fill: #9ddde8;
}

.history-chart .chart-point--incompleto {
    r: 7;
    fill: #f1a24d;
    stroke: #98451f;
}

.history-chart .chart-point--desconhecido {
    fill: #dce4e7;
    stroke: #61767e;
    stroke-dasharray: 3 2;
}

.history-chart .chart-tooltip-box {
    fill: #0c3547;
    filter: drop-shadow(0 6px 10px rgba(8, 34, 47, 0.18));
}

.history-chart .chart-tooltip-box--forecast {
    fill: #4b3468;
}

.history-chart .chart-tooltip {
    pointer-events: none;
}

.history-chart .chart-tooltip-title,
.history-chart .chart-tooltip-value,
.history-chart .chart-tooltip-detail {
    fill: var(--white);
    pointer-events: none;
}

.history-chart .chart-tooltip-status {
    fill: #aee6d0;
    font-size: 11px;
    font-weight: 800;
}

.history-chart .chart-tooltip-status--incompleto {
    fill: #ffc178;
}

.history-chart .chart-tooltip-status--desconhecido {
    fill: #d0dce0;
}

.history-chart .chart-tooltip-title {
    font-size: 13px;
    font-weight: 700;
}

.history-chart .chart-tooltip-value {
    font-size: 18px;
    font-weight: 900;
}

.history-chart .chart-tooltip-detail {
    fill: #cbe0e8;
    font-size: 11px;
}

.history-chart-instruction {
    margin: 2px 0 6px;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.history-chart-empty {
    display: grid;
    min-height: 42vh;
    place-content: center;
    padding: 40px;
    border: 1px solid #ccdade;
    border-radius: 20px;
    background: var(--white);
    text-align: center;
}

.history-chart-empty h2,
.history-chart-empty p {
    margin: 0;
}

.history-lineage-section {
    margin-top: 30px;
}

.history-lineage-panel {
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid #ccdade;
    border-radius: 18px;
    background: var(--white);
    box-shadow: 0 14px 36px rgba(10, 40, 54, 0.07);
}

.history-lineage-panel > .section-kicker {
    margin: 0 0 5px;
}

.history-lineage-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.history-lineage-heading h2,
.history-lineage-heading p {
    margin: 0;
}

.history-lineage-heading h2 {
    font-size: clamp(1.5rem, 2.5vw, 2.15rem);
}

.history-lineage-heading p {
    max-width: 520px;
    color: var(--muted);
    line-height: 1.5;
    text-align: right;
}

.history-lineage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 14px;
    margin-top: 22px;
}

.history-lineage-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #d6e2e5;
    border-radius: 13px;
    background: #f5f8f8;
}

.history-lineage-card h3,
.history-lineage-card p {
    margin: 0;
}

.history-lineage-card h3 {
    margin-top: 5px;
    font-size: 1.08rem;
}

.history-lineage-card > p:not(.history-lineage-years) {
    min-height: 1.5em;
    margin-top: 5px;
    color: var(--muted);
}

.history-lineage-years {
    color: #a04b2c;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.history-lineage-card a {
    display: inline-block;
    margin-top: 16px;
    font-weight: 800;
}

.history-chart-empty p {
    max-width: 620px;
    margin-top: 10px;
    color: var(--muted);
}

.history-data-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

.history-data-section .history-panel {
    max-width: none;
}

.history-method-section {
    margin-top: 30px;
    margin-bottom: 60px;
}

.history-method-panel {
    padding: clamp(24px, 4vw, 48px);
}

.history-method-panel h2 {
    margin: 6px 0 0;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.history-method-intro {
    max-width: 900px;
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.history-method-list {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.history-method-year {
    border: 1px solid #cedcdf;
    border-radius: 12px;
    background: #f8faf9;
}

.history-method-year summary {
    display: grid;
    grid-template-columns: minmax(58px, auto) 1fr;
    gap: 16px;
    align-items: center;
    padding: 17px 20px;
    cursor: pointer;
}

.history-method-year summary strong {
    color: #9b482a;
    font-size: 1.06rem;
}

.history-method-year summary span {
    color: var(--muted);
}

.history-method-year-body {
    padding: 4px 20px 22px;
    border-top: 1px solid #dce5e7;
}

.history-method-facts {
    margin: 0;
}

.history-method-facts > div {
    display: grid;
    grid-template-columns: minmax(170px, 0.28fr) 1fr;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e9ea;
}

.history-method-facts dt {
    font-weight: 800;
}

.history-method-facts dd {
    min-width: 0;
    margin: 0;
    color: var(--muted);
}

@media (max-width: 760px) {
    .history-page-heading {
        padding: 26px 0 24px;
    }

    .history-page-heading .section-kicker {
        margin-top: 20px;
    }

    .history-chart-section {
        margin-top: 18px;
    }

    .history-chart-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .history-chart-heading > p {
        text-align: left;
    }

    .history-lineage-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .history-lineage-heading p {
        text-align: left;
    }

    .history-chart-card {
        min-height: 480px;
        padding: 8px 8px 4px;
        border-radius: 15px;
    }

    .history-chart-legend {
        justify-content: flex-start;
        padding: 8px 10px 0;
    }

    .history-chart {
        min-height: 440px;
    }

    .history-method-year summary,
    .history-method-facts > div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

}
