.record-page {
    max-width: 1180px;
    margin: 0 auto;
}

.record-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.record-page-actions,
.record-filter-actions,
.record-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.record-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}

.record-overview-card {
    min-height: 84px;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: var(--app-surface);
    padding: .95rem 1rem;
    box-shadow: var(--app-shadow);
}

.record-overview-label {
    color: var(--app-text-soft);
    font-size: .78rem;
    margin-bottom: .3rem;
}

.record-overview-value {
    color: var(--app-text);
    font-size: 1.36rem;
    font-weight: 800;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.record-overview-value.warning {
    color: #b45309;
}

.record-overview-value.success {
    color: #166534;
}

.record-filter-shell,
.record-panel,
.record-form-shell {
    padding: 1rem;
    border-radius: .75rem;
}

.record-filter-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, max-content) auto;
    align-items: end;
    gap: .75rem;
}

.record-toggle-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.record-tab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    color: var(--app-text-soft);
    background: #f8fafc;
    padding: .35rem .8rem;
    text-decoration: none;
    font-size: .84rem;
    font-weight: 650;
}

.record-tab:hover,
.record-tab:focus,
.record-tab.active {
    border-color: var(--app-primary);
    color: var(--app-primary-strong);
    background: var(--app-primary-faint);
}

.record-card-grid,
.document-card-grid,
.document-file-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.document-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-card,
.document-owner-card,
.document-file-card,
.document-missing-card {
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: var(--app-surface);
    overflow: hidden;
    box-shadow: var(--app-shadow);
}

.record-card {
    display: flex;
    min-height: 196px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.record-card:hover,
.document-owner-card:hover,
.document-file-card:hover,
.document-missing-card:hover {
    transform: translateY(-2px);
    border-color: var(--app-primary);
    box-shadow: 0 18px 38px rgba(15, 23, 42, .11);
}

.document-owner-card,
.document-file-card,
.document-missing-card {
    padding: 1rem;
}

.record-card-rail,
.record-date-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    flex-direction: column;
    color: #fff;
    background: linear-gradient(180deg, var(--app-primary), var(--app-secondary));
    font-weight: 800;
    text-align: center;
}

.record-card-rail {
    width: 78px;
}

.record-date-mark {
    width: 72px;
    height: 72px;
    border-radius: 8px;
}

.record-card-rail span,
.record-date-mark span {
    font-size: 1.32rem;
    line-height: 1;
}

.record-card-rail small,
.record-date-mark small {
    margin-top: .25rem;
    color: rgba(255, 255, 255, .88);
    font-size: .74rem;
    text-transform: uppercase;
}

.record-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 1rem;
}

.record-card-head,
.document-owner-head,
.document-file-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.record-card-subline {
    color: var(--app-text-soft);
    font-size: .85rem;
}

.record-card-meta,
.record-hero-meta,
.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.record-card-meta,
.document-meta {
    margin-top: .9rem;
}

.record-pill,
.record-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    color: var(--app-text-soft);
    background: #f8fafc;
    padding: .15rem .55rem;
    font-size: .74rem;
    font-weight: 750;
    white-space: nowrap;
}

.record-status {
    color: #475569;
    border-color: #e2e8f0;
    background: #f1f5f9;
    font-weight: 700;
}

.record-status.warning {
    color: #92400e;
    border-color: #fde68a;
    background: #fef3c7;
}

.record-status.info {
    color: #0369a1;
    border-color: #bae6fd;
    background: #e0f2fe;
}

.record-status.success,
.record-pill-success {
    color: #166534;
    border-color: #bbf7d0;
    background: #dcfce7;
}

.record-status.danger {
    color: #be123c;
    border-color: #fecdd3;
    background: #ffe4e6;
}

.record-pill-muted {
    color: #475569;
    border-color: #e2e8f0;
    background: #f1f5f9;
}

.record-stat-stack {
    display: grid;
    gap: .5rem;
    margin-top: auto;
    padding-top: 1rem;
}

.record-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    color: var(--app-text-soft);
    font-size: .86rem;
    border-radius: .65rem;
    background: #f8fafc;
    padding: .55rem .65rem;
}

.record-stat-row strong {
    color: var(--app-text);
    font-size: .96rem;
    font-weight: 650;
    text-align: right;
    overflow-wrap: anywhere;
}

.record-card-actions,
.document-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    margin-top: 1rem;
}

.record-card-actions.single,
.document-card-actions.single {
    grid-template-columns: 1fr;
}

.record-empty-state {
    grid-column: 1 / -1;
    padding: 2.2rem 1rem;
    text-align: center;
}

.record-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.record-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--app-border);
    border-radius: .8rem;
    background: linear-gradient(135deg, var(--app-surface), var(--app-primary-faint));
    padding: 1.25rem;
    box-shadow: var(--app-shadow);
}

.record-hero-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 1rem;
}

.record-hero-meta {
    color: var(--app-text-soft);
    font-size: .9rem;
    margin-top: .55rem;
}

.record-detail-layout,
.document-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 1rem;
    align-items: start;
}

.record-info-grid,
.document-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.record-info-label,
.document-info-label {
    color: var(--app-text-soft);
    font-size: .78rem;
    margin-bottom: .25rem;
}

.record-info-value,
.document-info-value {
    color: var(--app-text);
    font-size: .92rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.record-note-box {
    border-top: 1px solid var(--app-border);
    color: var(--app-text-soft);
    margin-top: 1rem;
    padding-top: 1rem;
    white-space: pre-wrap;
}

.document-summary-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: var(--app-surface);
    padding: 1rem;
    box-shadow: var(--app-shadow);
}

.document-missing-grid {
    display: grid;
    gap: .5rem;
}

.document-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

@media (max-width: 991.98px) {
    .record-overview-grid,
    .record-card-grid,
    .document-card-grid,
    .document-file-grid,
    .record-detail-layout,
    .document-detail-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .record-page-header,
    .record-hero,
    .document-summary-band {
        align-items: stretch;
        flex-direction: column;
    }

    .record-page-actions,
    .record-page-actions .btn,
    .record-filter-actions,
    .record-filter-actions .btn,
    .record-hero-actions,
    .record-hero-actions .btn {
        width: 100%;
    }

    .record-hero-main {
        align-items: flex-start;
    }

    .record-overview-grid,
    .record-card-grid,
    .document-card-grid,
    .document-file-grid,
    .record-detail-layout,
    .document-detail-layout,
    .record-info-grid,
    .document-info-grid,
    .record-filter-form,
    .document-upload-grid {
        grid-template-columns: 1fr;
    }

    .record-card-actions,
    .document-card-actions {
        grid-template-columns: 1fr;
    }

    .record-pagination {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .record-card {
        flex-direction: column;
        min-height: 0;
    }

    .record-card-rail {
        width: 100%;
        min-height: 56px;
        flex-direction: row;
        gap: .35rem;
    }

    .record-date-mark {
        width: 56px;
        height: 56px;
    }
}

