.case-library-shell {
    margin-right: 0;
    padding: 24px 28px 40px;
    background: #f6f8fb;
    height: var(--console-shell-height, 100vh);
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.case-library-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    max-width: 1180px;
    margin: 0 auto 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e4e7ec;
}

.case-library-header h1 {
    margin: 3px 0 8px;
    font-size: 30px;
    line-height: 1.2;
    color: #111827;
}

.case-library-header p {
    margin: 0;
    color: #667085;
    line-height: 1.6;
}

.case-eyebrow {
    margin: 0;
    color: #0f766e;
    font-size: 13px;
    font-weight: 700;
}

.case-header-link,
.case-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #344054;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}

.case-library-view {
    max-width: 1180px;
    margin: 0 auto;
}

.case-filter-panel {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    margin-bottom: 16px;
}

.case-filter-panel label {
    display: block;
    margin-bottom: 8px;
    color: #667085;
    font-size: 13px;
    font-weight: 700;
}

.case-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.case-filter-btn {
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #344054;
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
}

.case-filter-btn.active {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

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

.case-card {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 330px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    overflow: hidden;
    color: #1f2937;
    text-decoration: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.case-card:hover {
    text-decoration: none;
    border-color: #98a2b3;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.08);
    transform: translateY(-2px);
}

.case-card:focus-visible {
    outline: 3px solid rgba(22, 155, 99, 0.28);
    outline-offset: 3px;
}

.case-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #eef2f6;
    overflow: hidden;
}

.case-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.case-report-cover {
    height: 100%;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc 0%, #e7f5f2 100%);
}

.case-report-cover strong {
    color: #0f172a;
    font-size: 18px;
    line-height: 1.35;
}

.case-report-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.case-report-metrics span {
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.8);
    color: #475467;
    font-size: 12px;
}

.case-play-mark {
    position: absolute;
    left: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(15, 23, 42, 0.78);
    font-size: 22px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(8px);
}

.case-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 14px 15px 15px;
}

.case-card-tags {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.case-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    background: #eef4ff;
    color: #175cd3;
    font-size: 12px;
}

.case-tag.category {
    background: #ecfdf3;
    color: #067647;
}

.case-card h2 {
    margin: 0 0 8px;
    color: #101828;
    font-size: 17px;
    line-height: 1.35;
}

.case-card p {
    margin: 0;
    color: #667085;
    font-size: 14px;
    line-height: 1.55;
}

.case-card-footer {
    margin-top: auto;
    padding-top: 13px;
    color: #0f766e;
    font-weight: 700;
    font-size: 13px;
}

.case-status,
.case-empty {
    padding: 18px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    color: #667085;
}

.case-modal[hidden] {
    display: none !important;
}

.case-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
}

.case-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(9, 14, 25, 0.72);
    backdrop-filter: blur(10px);
}

.case-modal-panel {
    position: relative;
    z-index: 1;
    width: clamp(780px, 72vw, 1120px);
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-right: 0;
    border-radius: 14px 0 0 14px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(9, 14, 25, 0.36);
    opacity: 0;
    transform: translateX(28px);
    transition: opacity .18s ease, transform .18s ease;
}

.case-modal.open .case-modal-panel {
    opacity: 1;
    transform: translateX(0);
}

.case-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(148, 163, 184, 0.48);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.case-modal-close:hover {
    background: #fff;
    color: #0f766e;
}

.case-modal-intro {
    margin: 0 auto 12px;
    max-width: 1180px;
    padding: 15px 58px 15px 16px;
    border: 1px solid rgba(22, 155, 99, 0.34);
    border-radius: 10px;
    background:
        linear-gradient(135deg, rgba(22, 155, 99, 0.18), rgba(37, 99, 235, 0.1)),
        #f7fef9;
    box-shadow: 0 14px 34px rgba(15, 118, 110, 0.08);
}

.case-modal-intro.dark {
    margin: 0 0 16px;
    max-width: none;
    border-color: rgba(110, 231, 183, 0.34);
    background:
        linear-gradient(135deg, rgba(22, 155, 99, 0.2), rgba(59, 130, 246, 0.14)),
        rgba(255, 255, 255, 0.055);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.case-intro-label {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.case-modal-intro.dark .case-intro-label {
    background: rgba(209, 250, 229, 0.18);
    color: #d1fae5;
}

.case-modal-intro h2,
.case-modal-video .case-modal-intro h2 {
    margin: 9px 0 6px;
    color: #172033;
    font-size: 22px;
    line-height: 1.25;
}

.case-modal-intro.dark h2,
.case-modal-video .case-modal-intro.dark h2 {
    color: #fff;
}

.case-modal-intro p,
.case-modal-video .case-modal-intro p {
    max-width: 920px;
    margin: 0;
    color: #53657d;
    font-size: 13px;
    line-height: 1.45;
}

.case-modal-intro.dark p,
.case-modal-video .case-modal-intro.dark p {
    color: #cbd5e1;
}

.case-goodcam-report .account-record-badge {
    display: none !important;
}

.case-modal-video {
    height: 100dvh;
    overflow: auto;
    padding: 24px;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 16% 0%, rgba(22, 155, 99, 0.28), transparent 34%),
        linear-gradient(145deg, #090e19 0%, #121a2b 54%, #0b101c 100%);
    color: #fff;
}

.case-modal-video h2 {
    margin: 16px 48px 8px 0;
    color: #fff;
    font-size: 25px;
    line-height: 1.25;
}

.case-modal-video p {
    max-width: 760px;
    margin: 0 0 18px;
    color: #cbd5e1;
    line-height: 1.65;
}

.case-modal-video-frame {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: #000;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
}

.case-modal-video-frame video {
    width: 100%;
    max-height: calc(100dvh - 170px);
    display: block;
    background: #000;
}

.case-modal-report {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f4f8f6;
}

.case-modal-report-body.account-positioning-main {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    margin-right: 0;
    overflow: auto;
    padding: 14px;
    background: #f4f8f6;
    color: #172033;
}

.case-diagnostic-report {
    max-width: 1180px;
    margin: 0 auto;
}

.case-goodcam-report {
    width: 100%;
}

.case-goodcam-report .account-results {
    max-width: none;
    margin: 0;
}

.case-goodcam-report .account-profile-panel,
.case-goodcam-report .analysis-panel,
.case-goodcam-report .metric-card {
    box-shadow: 0 10px 24px rgba(31, 43, 68, 0.045);
}

.case-goodcam-report .lifecycle-chart,
.case-goodcam-report .video-table-wrap {
    max-width: 100%;
}

.case-goodcam-report .lifecycle-chart {
    overflow-x: auto;
}

.case-goodcam-report .lifecycle-svg {
    width: 100%;
    min-width: 760px;
    height: auto;
}

.case-report-loading,
.case-report-error {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid #dce7e1;
    border-radius: 8px;
    background: #fff;
    color: #53657d;
    font-size: 14px;
}

.case-report-error {
    border-color: #fecaca;
    background: #fff7f7;
    color: #991b1b;
}

.case-report-error strong {
    color: #7f1d1d;
}

.case-modal-report-body .ai-report {
    gap: 12px;
}

.case-detail {
    margin-top: 14px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    overflow: hidden;
}

.case-detail-hero {
    padding: 22px 24px;
    border-bottom: 1px solid #edf0f2;
}

.case-detail-hero h1 {
    margin: 9px 0 8px;
    font-size: 28px;
    color: #101828;
    line-height: 1.25;
}

.case-detail-hero p {
    margin: 0;
    color: #667085;
    line-height: 1.65;
}

.case-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.case-video-frame {
    background: #101828;
}

.case-video-frame video {
    display: block;
    width: 100%;
    max-height: 68vh;
    background: #101828;
}

.case-video-empty {
    padding: 46px 24px;
    text-align: center;
    color: #fff;
}

.case-report-head {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 22px 24px;
    border-bottom: 1px solid #edf0f2;
}

.case-report-avatar {
    width: 92px;
    height: 92px;
    border-radius: 12px;
    background: #e7f5f2;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #0f766e;
    font-size: 34px;
    font-weight: 800;
}

.case-report-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.case-report-head h2 {
    margin: 0 0 8px;
    color: #101828;
    font-size: 24px;
}

.case-report-head p {
    margin: 0;
    color: #667085;
    line-height: 1.6;
}

.case-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 18px 24px;
    border-bottom: 1px solid #edf0f2;
    background: #fbfcfd;
}

.case-metric {
    padding: 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e4e7ec;
}

.case-metric strong {
    display: block;
    color: #101828;
    font-size: 22px;
    margin-bottom: 4px;
}

.case-metric span {
    color: #667085;
    font-size: 13px;
}

.case-report-sections {
    padding: 10px 24px 24px;
}

.case-report-section {
    padding: 18px 0;
    border-bottom: 1px solid #edf0f2;
}

.case-report-section:last-child {
    border-bottom: none;
}

.case-report-section h3 {
    margin: 0 0 10px;
    color: #101828;
    font-size: 18px;
}

.case-report-section p,
.case-report-section li {
    color: #475467;
    line-height: 1.75;
}

.case-report-section ul {
    margin: 0;
    padding-left: 20px;
}

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

    .case-modal-panel {
        width: min(980px, calc(100vw - 40px));
    }
}

@media (max-width: 760px) {
    .case-library-shell {
        padding: 18px 16px 32px;
    }

    .case-library-header {
        flex-direction: column;
    }

    .case-grid,
    .case-report-head,
    .case-metrics-grid {
        grid-template-columns: 1fr;
    }

    .case-detail-hero,
    .case-report-head,
    .case-metrics-grid,
    .case-report-sections {
        padding-left: 16px;
        padding-right: 16px;
    }

    .case-modal {
        padding: 0;
    }

    .case-modal-panel {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .case-modal-close {
        top: 10px;
        right: 10px;
    }

    .case-modal-video {
        min-height: 100dvh;
        padding: 18px 14px;
    }

    .case-modal-video h2 {
        margin-right: 46px;
        font-size: 22px;
    }

    .case-modal-video-frame video {
        max-height: 68dvh;
    }

    .case-modal-report {
        height: 100dvh;
    }

    .case-modal-intro {
        padding: 10px 54px 10px 12px;
    }

    .case-modal-intro h2 {
        font-size: 19px;
    }

    .case-modal-report-body.account-positioning-main {
        padding: 12px;
    }

    .case-diagnostic-report {
        max-width: none;
    }

    .case-goodcam-report .account-profile-panel,
    .case-goodcam-report .keyword-profile-panel,
    .case-goodcam-report .account-metric-grid,
    .case-goodcam-report .account-data-layout,
    .case-goodcam-report .keyword-data-layout,
    .case-goodcam-report .keyword-author-list,
    .case-goodcam-report .keyword-competition-summary,
    .case-goodcam-report .performance-insight-grid,
    .case-goodcam-report .ai-summary-band,
    .case-goodcam-report .ai-visual-grid,
    .case-goodcam-report .ip-value-panel,
    .case-goodcam-report .thirty-week-grid,
    .case-goodcam-report .thirty-extra-grid {
        grid-template-columns: 1fr;
    }

    .case-goodcam-report .account-kpi-strip,
    .case-goodcam-report .lifecycle-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .case-goodcam-report .lifecycle-controls {
        justify-content: flex-start;
    }

    .case-goodcam-report .lifecycle-svg {
        min-width: 720px;
    }
}
