.filing-header {
    background: var(--surface);
    padding: 32px 22px;
    border-bottom: 1px solid var(--border-color);
}

.filing-header-content {
    max-width: 900px;
    margin: 0 auto;
}

.filing-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.filing-summary {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 65ch;
}

.filing-record {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 65ch;
    margin: 0 0 16px;
    padding-left: 12px;
    border-left: 3px solid var(--border-color);
}

.filing-number {
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: var(--green-110);
    color: var(--green-900);
}

.status-badge.inactive {
    background: var(--red-120);
    color: var(--red-910);
}

.filing-body {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 22px;
}

.section {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.key-fact {
    position: relative;
    min-width: 0;
    overflow-wrap: anywhere;
}

.key-fact .filing-number {
    align-self: flex-start;
}

.key-fact a,
a.party-search-link {
    color: var(--primary-color);
    text-decoration: none;
}

.key-fact a {
    font-weight: 500;
}

.key-fact a:hover,
.key-fact a:focus-visible,
a.party-search-link:hover,
a.party-search-link:focus-visible {
    text-decoration: underline;
}

.key-fact-secondary {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
}

.key-facts-note {
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.location-addresses {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.detail-map {
    margin-top: 16px;
}

.detail-map-canvas {
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-sunken);
    isolation: isolate;
    z-index: 0;
}

.detail-map-caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-map-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.detail-map-link:hover,
.detail-map-link:focus-visible {
    text-decoration: underline;
}

@media (min-width: 641px) {
    .detail-map-canvas {
        height: 260px;
    }

    .key-facts {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

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

.agent-address {
    margin-top: 16px;
}

.agent-address .address-block {
    margin-top: 4px;
}

.redaction-notice {
    color: var(--gray-550);
    font-style: italic;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 15px;
    color: var(--text-primary);
}

.info-value.empty {
    color: var(--text-secondary);
    font-style: italic;
}

.address-block {
    line-height: 1.6;
}

.officers-table {
    width: 100%;
    border-collapse: collapse;
}

.officers-table th,
.officers-table td {
    text-align: left;
    padding: 12px 8px;
    font-size: 14px;
}

.officers-table th {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.officers-table td {
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}

.officers-table tr:last-child td {
    border-bottom: none;
}

.officer-name {
    font-weight: 500;
    color: var(--text-primary);
}

.officer-entity {
    color: var(--text-secondary);
    font-size: 13px;
}

.officer-address {
    color: var(--text-secondary);
    font-size: 13px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--gray-100);
    color: var(--text-primary);
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.back-link[hidden] {
    display: none;
}

.back-link:hover {
    background: var(--gray-200);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

.actions-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.key-fact-label-tail {
    white-space: nowrap;
}

.code-explanation {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.code-explanation-toggle {
    text-transform: none;
    letter-spacing: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-sunken);
    border-radius: 50%;
    cursor: pointer;
    list-style: none;
}

.code-explanation-toggle::-webkit-details-marker {
    display: none;
}

.code-explanation[open] .code-explanation-toggle,
.code-explanation-toggle:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.code-explanation-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.code-explanation-body {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 100;
    width: min(320px, calc(200% + 16px));
    padding: 12px 14px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    white-space: normal;
    overflow-wrap: normal;
    background: var(--surface-raised);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    line-height: 1.5;
}

.key-fact:nth-child(even) .code-explanation-body {
    left: auto;
    right: 0;
}

.code-explanation-note {
    margin-top: 8px;
    color: var(--text-secondary);
}

.code-explanation-link {
    margin-top: 8px;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.history-entry {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}

.history-entry:last-child {
    border-bottom: none;
}

.history-date {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.history-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history-title {
    font-weight: 500;
    color: var(--text-primary);
}

.history-line {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.history-meta {
    color: var(--text-secondary);
    font-size: 12px;
}

.history-entry[hidden],
.history-pager[hidden],
.history-pager-button[hidden] {
    display: none;
}

.history-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.history-pager-size select {
    margin-left: 4px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
}

.history-pager-status {
    font-variant-numeric: tabular-nums;
}

.history-pager-nav {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}

.history-pager-button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

.history-pager-button:disabled {
    color: var(--text-secondary);
    cursor: default;
    opacity: 0.6;
}

.history-note {
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.takedown-note {
    margin: 8px 0 24px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.related {
    margin-top: 8px;
    font-size: 14px;
}

.related-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
    list-style: none;
}

.related-summary::-webkit-details-marker {
    display: none;
}

.related-summary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.related[open] > .related-summary::before {
    transform: rotate(45deg);
}

.related-summary:hover {
    text-decoration: underline;
}

.related-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0 0 0 12px;
    border-left: 2px solid var(--gray-100);
}

.related-entry {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.related-entry:last-child {
    border-bottom: none;
}

.related-name {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.related-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.related-kind {
    font-weight: 500;
}

.related-crowded,
.related-more {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.related-more {
    padding-left: 14px;
}

.officers-table tr.has-related td {
    border-bottom: none;
}

@media (min-width: 641px) {
    .officers-table tr.has-related td {
        padding-bottom: 0;
    }
}

.officers-table .officer-related-row td {
    padding-top: 0;
}

@media (max-width: 640px) {
    .filing-title {
        font-size: 22px;
    }

    .history-entry {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .officers-table {
        display: block;
    }

    .officers-table thead {
        display: none;
    }

    .officers-table tbody,
    .officers-table tr,
    .officers-table td {
        display: block;
    }

    .officers-table tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--gray-100);
    }

    .officers-table tr:last-child,
    .officers-table tr.has-related {
        border-bottom: none;
    }

    .officers-table .officer-related-row {
        padding-top: 0;
    }

    .officers-table .officer-related-row td:before {
        content: none;
    }

    .officers-table td {
        padding: 4px 0;
        border-bottom: none;
    }

    .officers-table td:before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 500;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: block;
        margin-bottom: 2px;
    }
}

.next-step-lists {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

@media (min-width: 641px) {
    .next-step-lists {
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        grid-template-columns: none;
    }
}

.next-step-list-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.next-step-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.next-step-list li {
    padding: 6px 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.next-step-list li + li {
    border-top: 1px solid var(--border-color);
}

.next-step a,
.next-step-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.next-step a:hover,
.next-step a:focus-visible,
.next-step-links a:hover,
.next-step-links a:focus-visible {
    text-decoration: underline;
}

.next-step-meta {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.next-step-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 16px;
    font-size: 14px;
}

.county-context-stats {
    list-style: none;
    margin: 0;
    padding: 0;
}

.county-context-stats li {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    column-gap: 16px;
    align-items: baseline;
    padding: 10px 0;
    line-height: 1.4;
}

.county-context-stats li + li {
    border-top: 1px solid var(--border-color);
}

@media (max-width: 480px) {
    .county-context-stats li {
        grid-template-columns: minmax(0, 1fr);
    }
}

.county-context-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}

.county-context a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.county-context a:hover,
.county-context a:focus-visible {
    text-decoration: underline;
}

.county-context-note {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.filing-breadcrumbs {
    max-width: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    row-gap: 2px;
    font-size: 13px;
    line-height: 1.4;
}

.filing-breadcrumbs a {
    white-space: nowrap;
}

.filing-breadcrumbs a:hover,
.filing-breadcrumbs a:focus-visible {
    color: var(--primary-color);
    text-decoration: underline;
}

.filing-breadcrumbs .sep {
    margin: 0 8px;
    color: var(--gray-550);
}

.filing-breadcrumbs .current {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 641px) {
    .filing-breadcrumbs {
        flex-wrap: nowrap;
    }

    .filing-breadcrumbs .current {
        flex: 1 1 auto;
    }
}


.alert-prompt-text {
    margin: 0 0 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.alert-prompt-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.alert-prompt .btn-primary {
    display: inline-block;
    padding: 10px 20px;
    border: 0;
    border-radius: 10px;
    background: var(--primary-color);
    color: var(--text-on-accent);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.alert-prompt .btn-primary:hover,
.alert-prompt .btn-primary:focus-visible {
    background: var(--primary-hover);
}

.alert-prompt-signin {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
}

.alert-prompt-signin:hover,
.alert-prompt-signin:focus-visible {
    text-decoration: underline;
}
