.license-history-page {
    display: grid;
    gap: clamp(1.2rem, 3vw, 2.2rem);
    margin: 0 auto;
    max-width: 1120px;
    width: 100%;
}

.license-history-page .license-back-link {
    color: var(--cyan);
    font-size: 0.78rem;
    font-weight: 800;
    justify-self: start;
    text-decoration: none;
}

.license-history-page .license-back-link::before {
    content: "\2190";
    margin-right: 0.45rem;
}

.history-hero {
    align-items: end;
    display: grid;
    gap: 2rem;
    grid-template-columns: minmax(0, 1fr) minmax(230px, 0.3fr);
}

.history-hero h1 {
    font-family: Consolas, "Courier New", monospace;
    font-size: clamp(2.35rem, 6vw, 5rem);
    margin: 0.75rem 0 1rem;
    overflow-wrap: anywhere;
}

.history-hero p {
    margin-bottom: 0;
    max-width: 720px;
}

.history-identity {
    background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: grid;
    gap: 0.4rem;
    padding: 1.15rem 1.25rem;
}

.history-identity span,
.history-identity small {
    color: var(--muted);
    font-size: 0.7rem;
}

.history-identity code {
    color: var(--cyan);
    overflow-wrap: anywhere;
}

.history-nav {
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
}

.history-nav a {
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
    padding: 0.9rem 1rem;
    text-decoration: none;
    white-space: nowrap;
}

.history-nav a.active {
    border-bottom-color: var(--cyan);
    color: var(--text);
}

.history-state,
.history-empty,
.history-panel,
.history-safe-note,
.history-pagination {
    background: linear-gradient(148deg, var(--surface), color-mix(in srgb, var(--surface-solid) 88%, var(--primary) 5%));
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.history-state,
.history-empty {
    padding: clamp(1.5rem, 5vw, 3.8rem);
}

.history-state h1,
.history-empty h2 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin: 0.7rem 0 0.9rem;
}

.history-state p,
.history-empty p {
    max-width: 720px;
}

.history-panel {
    padding: clamp(1.2rem, 4vw, 2.2rem);
}

.history-section-heading {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.history-section-heading h2 {
    font-size: clamp(1.7rem, 4vw, 2.55rem);
    margin: 0.48rem 0 0.65rem;
}

.history-section-heading p {
    max-width: 680px;
}

.history-count {
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--cyan) 34%, var(--line));
    border-radius: 999px;
    color: var(--cyan);
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.45rem 0.7rem;
}

.history-timeline {
    display: grid;
    gap: 0;
    list-style: none;
    margin: 1.4rem 0 0;
    padding: 0;
}

.history-event {
    display: grid;
    gap: 1rem;
    grid-template-columns: 18px minmax(0, 1fr);
    padding-bottom: 1rem;
    position: relative;
}

.history-event:not(:last-child)::before {
    background: var(--line);
    content: "";
    left: 8px;
    position: absolute;
    top: 18px;
    bottom: -2px;
    width: 1px;
}

.history-marker {
    background: var(--muted);
    border: 4px solid var(--surface-solid);
    border-radius: 50%;
    height: 17px;
    margin-top: 1.1rem;
    position: relative;
    width: 17px;
    z-index: 1;
}

.history-event.is-current .history-marker {
    background: var(--success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 12%, transparent);
}

.history-event.is-scheduled .history-marker {
    background: var(--cyan);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cyan) 12%, transparent);
}

.history-event article {
    background: color-mix(in srgb, var(--surface-raised) 76%, transparent);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: clamp(1rem, 3vw, 1.45rem);
}

.history-event.is-current article { border-color: color-mix(in srgb, var(--success) 36%, var(--line)); }
.history-event.is-scheduled article { border-color: color-mix(in srgb, var(--cyan) 38%, var(--line)); }

.history-event article > header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.history-date {
    color: var(--muted);
    font-size: 0.7rem;
}

.history-event h3 {
    font-size: 1.25rem;
    margin: 0.3rem 0 0;
}

.history-state-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.4rem 0.65rem;
}

.history-event dl {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 1rem 0 0;
}

.history-event dl > div {
    border-top: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
    min-width: 0;
    padding-top: 0.65rem;
}

.history-event dt {
    color: var(--muted);
    font-size: 0.66rem;
}

.history-event dd {
    font-size: 0.82rem;
    font-weight: 720;
    margin: 0.24rem 0 0;
    overflow-wrap: anywhere;
}

.history-event code {
    color: var(--cyan);
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.history-pagination,
.history-safe-note {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.15rem;
}

.history-pagination span,
.history-safe-note span {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.history-safe-note {
    background: color-mix(in srgb, var(--cyan) 7%, var(--surface));
}

.license-history-page .button.secondary {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-raised));
    border-color: var(--line);
    color: var(--text);
}

@media (max-width: 760px) {
    .history-hero {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 560px) {
    .history-section-heading,
    .history-event article > header,
    .history-pagination,
    .history-safe-note {
        align-items: stretch;
        flex-direction: column;
    }

    .history-event dl {
        grid-template-columns: 1fr;
    }

    .history-pagination .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .license-history-page .button {
        transition: none;
    }
}
