.history-heading,
.history-detail-heading,
.history-search-card,
.history-stats,
.history-results,
.history-contact-card,
.history-event-section,
.history-pagination {
    width: min(1160px, calc(100% - 40px));
    margin-inline: auto;
}

.history-heading,
.history-detail-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 34px 0 22px;
}

.history-heading h1,
.history-detail-heading h1,
.history-section-heading h2,
.history-card-heading h2 {
    margin: 4px 0 6px;
}

.history-heading p,
.history-detail-heading p,
.history-section-heading p,
.history-card-heading p {
    margin: 0;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.history-stats article {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 15px 17px;
    border: 1px solid color-mix(in srgb, var(--app-accent, #b9944a) 30%, transparent);
    border-radius: 15px;
    background: color-mix(in srgb, var(--app-card, #fffdf6) 92%, transparent);
    box-shadow: 0 10px 25px rgba(27, 43, 64, .09), inset 0 1px rgba(255, 255, 255, .8);
}

.history-stats span {
    color: #4b5869;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.history-stats strong {
    color: var(--app-navy, #243247);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.65rem;
}

.history-search-card,
.history-contact-card,
.history-event-card,
.history-empty {
    border: 1px solid rgba(185, 148, 74, .32);
    background: linear-gradient(145deg, rgba(255, 253, 246, .98), rgba(242, 246, 248, .94));
    box-shadow: 0 18px 44px rgba(27, 43, 64, .11), inset 0 1px rgba(255, 255, 255, .92);
}

.history-search-card {
    padding: 18px;
    border-radius: 19px;
    margin-bottom: 18px;
}

.history-search-form {
    display: grid;
    grid-template-columns: minmax(260px, 1.8fr) minmax(150px, .65fr) minmax(125px, .5fr) auto;
    align-items: end;
    gap: 12px;
}

.history-search-form label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: #2f3d51;
    font-size: .82rem;
    font-weight: 800;
}

.history-search-form input,
.history-search-form select {
    width: 100%;
    min-height: 46px;
}

.history-search-form .button {
    min-height: 46px;
    white-space: nowrap;
}

.history-search-summary {
    margin: 13px 2px 0;
    color: #445164;
}

.history-results {
    display: grid;
    gap: 13px;
    padding-bottom: 20px;
}

.history-client-card {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.15fr) auto;
    align-items: center;
    gap: 24px;
    padding: 18px 20px;
    border: 1px solid rgba(185, 148, 74, .26);
    border-radius: 18px;
    color: #243247;
    text-decoration: none;
    background: linear-gradient(140deg, rgba(255, 254, 249, .98), rgba(240, 245, 248, .96));
    box-shadow: 0 10px 26px rgba(27, 43, 64, .1), inset 0 1px rgba(255, 255, 255, .88);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.history-client-card:nth-child(even) {
    background: linear-gradient(140deg, rgba(248, 245, 233, .98), rgba(234, 241, 245, .96));
}

@media (hover: hover) and (pointer: fine) {
    .history-client-card:hover {
        transform: translateY(-3px);
        border-color: rgba(185, 148, 74, .55);
        box-shadow: 0 16px 34px rgba(27, 43, 64, .16), inset 0 1px rgba(255, 255, 255, .95);
    }
}

.history-client-identity,
.history-client-event,
.history-card-action {
    min-width: 0;
}

.history-client-identity h2 {
    margin: 2px 0 3px;
    overflow-wrap: anywhere;
    font-size: 1.15rem;
}

.history-client-identity p,
.history-client-event p,
.history-client-event span {
    margin: 0;
}

.history-client-event {
    display: grid;
    gap: 3px;
    padding-left: 22px;
    border-left: 1px solid rgba(185, 148, 74, .34);
}

.history-client-event span,
.history-contact-line {
    color: #465367;
    overflow-wrap: anywhere;
}

.history-source-id,
.history-event-id {
    color: #8a6b2e;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.history-event-date {
    color: #8a6b2e;
    font-size: .78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.history-card-action {
    display: grid;
    justify-items: end;
    gap: 6px;
    white-space: nowrap;
}

.history-card-action span {
    color: #5a6676;
    font-size: .78rem;
}

.history-card-action strong {
    color: #8a6b2e;
}

.history-empty {
    padding: 34px 24px;
    border-radius: 18px;
    text-align: center;
}

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

.history-empty p {
    margin-top: 6px;
    color: #526071;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 8px 0 32px;
}

.history-record-count,
.history-status {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid rgba(185, 148, 74, .38);
    border-radius: 999px;
    color: #6f5420;
    background: rgba(255, 248, 224, .88);
    font-size: .78rem;
    font-weight: 850;
}

.history-contact-card {
    padding: 23px;
    border-radius: 20px;
    margin-bottom: 22px;
}

.history-contact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 18px 0 0;
    overflow: hidden;
    border: 1px solid rgba(37, 55, 77, .12);
    border-radius: 14px;
    background: rgba(37, 55, 77, .12);
}

.history-contact-grid div {
    min-width: 0;
    padding: 13px 14px;
    background: rgba(255, 255, 255, .83);
}

.history-contact-grid .history-contact-wide {
    grid-column: span 2;
}

.history-contact-grid dt,
.history-fact-list dt {
    color: #78612f;
    font-size: .69rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.history-contact-grid dd,
.history-fact-list dd {
    margin: 4px 0 0;
    color: #25364d;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.history-preserved-note {
    margin-top: 16px;
    padding: 14px 16px;
    border-left: 4px solid var(--app-accent, #b9944a);
    border-radius: 10px;
    background: rgba(255, 255, 255, .67);
}

.history-preserved-note p {
    margin: 6px 0 0;
}

.history-event-section {
    padding-bottom: 34px;
}

.history-section-heading {
    margin-bottom: 13px;
}

.history-event-card {
    margin-bottom: 17px;
    overflow: hidden;
    border-radius: 21px;
}

.history-event-card:nth-of-type(odd) {
    background: linear-gradient(145deg, rgba(248, 245, 233, .98), rgba(235, 242, 246, .95));
}

.history-event-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 19px 22px;
    border-bottom: 1px solid rgba(185, 148, 74, .28);
    background: rgba(255, 255, 255, .52);
}

.history-event-header h3,
.history-event-header p {
    margin: 0;
}

.history-event-header h3 {
    margin-top: 3px;
}

.history-event-columns {
    display: grid;
    grid-template-columns: 1.12fr .88fr;
}

.history-package-panel,
.history-venue-panel {
    min-width: 0;
    padding: 21px 22px;
}

.history-package-panel {
    border-right: 1px solid rgba(185, 148, 74, .26);
}

.history-package-panel h4,
.history-venue-panel h4,
.history-package-panel p,
.history-venue-panel p {
    margin: 0;
}

.history-package-panel h4,
.history-venue-panel h4 {
    margin: 3px 0 7px;
    color: #243247;
    font-size: 1.08rem;
}

.history-fact-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 15px 0 0;
}

.history-fact-list div {
    min-width: 0;
    padding: 10px 11px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .66);
}

.history-event-copy {
    margin-top: 14px;
    color: #34445a;
}

.history-event-copy p,
.history-event-copy ul {
    margin: 5px 0 0;
}

.history-event-copy ul {
    padding-left: 20px;
}

.history-staff-line {
    padding: 13px 22px;
    border-top: 1px solid rgba(185, 148, 74, .22);
    color: #35455a;
    background: rgba(255, 255, 255, .38);
}

.history-notes {
    border-top: 1px solid rgba(185, 148, 74, .24);
}

.history-notes summary {
    padding: 14px 22px;
    color: #6f5420;
    font-weight: 850;
    cursor: pointer;
}

.history-notes div {
    padding: 0 22px 16px;
}

.history-notes p {
    margin: 5px 0 0;
    color: #3b4b60;
}

@media (max-width: 820px) {
    .history-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-search-form {
        grid-template-columns: 1fr 1fr;
    }

    .history-search-query {
        grid-column: 1 / -1;
    }

    .history-client-card {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .history-card-action {
        grid-column: 1 / -1;
        display: flex;
        justify-content: space-between;
        padding-top: 11px;
        border-top: 1px solid rgba(185, 148, 74, .24);
    }

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

@media (max-width: 560px) {
    .history-heading,
    .history-detail-heading,
    .history-search-card,
    .history-stats,
    .history-results,
    .history-contact-card,
    .history-event-section,
    .history-pagination {
        width: min(100% - 24px, 1160px);
    }

    .history-heading,
    .history-detail-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 24px 0 16px;
    }

    .history-stats {
        gap: 8px;
    }

    .history-stats article {
        padding: 12px 13px;
    }

    .history-stats strong {
        font-size: 1.42rem;
    }

    .history-search-card {
        padding: 14px;
    }

    .history-search-form {
        grid-template-columns: 1fr;
    }

    .history-search-query {
        grid-column: auto;
    }

    .history-search-form .button {
        width: 100%;
    }

    .history-client-card {
        grid-template-columns: 1fr;
        gap: 13px;
        padding: 16px;
    }

    .history-client-event {
        padding: 13px 0 0;
        border-top: 1px solid rgba(185, 148, 74, .27);
        border-left: 0;
    }

    .history-card-action {
        grid-column: auto;
    }

    .history-contact-card {
        padding: 17px;
    }

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

    .history-contact-grid .history-contact-wide {
        grid-column: auto;
    }

    .history-event-header {
        padding: 16px;
    }

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

    .history-package-panel,
    .history-venue-panel {
        padding: 17px;
    }

    .history-package-panel {
        border-right: 0;
        border-bottom: 1px solid rgba(185, 148, 74, .26);
    }

    .history-fact-list {
        grid-template-columns: 1fr;
    }

    .history-staff-line,
    .history-notes summary,
    .history-notes div {
        padding-inline: 17px;
    }

    .history-pagination {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .history-client-card {
        transition: none;
    }
}
