/* Exposure reports use the site's dark surfaces and accent, with the measured rate emphasized. */
.cafe-exposure-panel {
    min-width: 0;
    max-width: 1200px;
    padding: clamp(14px, 2.4vw, 30px);
    color: var(--text-primary);
}
.exposure-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 16px;
}
.exposure-heading h3 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: -.035em;
}
.cafe-exposure-panel p {
    line-height: 1.65;
    overflow-wrap: anywhere;
}
.cafe-exposure-panel > p,
.cafe-exposure-panel details p {
    color: var(--text-secondary);
    font-size: .9rem;
}
.cafe-exposure-panel > h4,
.cafe-exposure-panel > section > h4,
.cafe-exposure-panel caption {
    margin: 22px 0 8px;
    color: var(--text-primary);
    font-size: 1.03rem;
    font-weight: 700;
    text-align: left;
}
.cafe-exposure-panel .cafe-exposure-controls:has(.exposure-brand) {
    align-items: end;
    padding: 12px;
    margin: 14px 0;
    gap: 8px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}
.exposure-brand {
    font-size: .8rem;
    font-weight: 600;
}
.exposure-periods {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
}
.exposure-periods .btn {
    min-height: 40px;
    padding: 5px 10px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    box-shadow: none;
}
.exposure-periods .btn:hover,
.exposure-periods .btn.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--glass-border-hover);
}
.exposure-periods .btn.active {
    color: #dce2ff;
    border-color: var(--accent-light);
}
.cafe-exposure-panel .cafe-exposure-kpis { margin: 12px 0 6px; }
.cafe-exposure-panel .cafe-exposure-kpis > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: var(--bg-secondary);
    min-width: 0;
}
.cafe-exposure-panel .cafe-exposure-kpis > div:last-child {
    background: var(--bg-tertiary);
    border-color: var(--accent-light);
}
.cafe-exposure-panel .cafe-exposure-kpis strong {
    margin-top: auto;
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.035em;
    line-height: 1.25;
}
.cafe-exposure-panel .cafe-exposure-kpis > div:last-child strong { color: #c7d2fe; }
.cafe-exposure-panel :is(summary, button, a, select, input, [tabindex]):focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}
.cafe-exposure-panel > details {
    margin: 6px 0;
    padding: 0 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}
.cafe-exposure-panel summary {
    color: var(--text-accent);
    cursor: pointer;
}
.cafe-exposure-panel > details > summary {
    min-height: 40px;
    padding: 10px 0;
    font-size: .86rem;
    font-weight: 600;
}
.cafe-exposure-panel details[open] > :last-child { margin-bottom: 12px; }
.cafe-exposure-panel > :is(.exposure-primary, .exposure-rank-detail, [data-exposure-disclosure="affiliate-days"], [data-exposure-disclosure="external-days"]) {
    margin-inline: 0;
    padding-inline: 0;
    border: 0;
}
.cafe-exposure-panel > :is(.exposure-primary, .exposure-rank-detail, [data-exposure-disclosure="affiliate-days"], [data-exposure-disclosure="external-days"]) > summary {
    display: block;
    list-style: none;
    padding-inline: 0;
    text-align: start;
}
.cafe-exposure-panel > :is(.exposure-primary, .exposure-rank-detail, [data-exposure-disclosure="affiliate-days"], [data-exposure-disclosure="external-days"]) > summary::-webkit-details-marker { display: none; }
.cafe-exposure-panel > :is(.exposure-primary, .exposure-rank-detail, [data-exposure-disclosure="affiliate-days"], [data-exposure-disclosure="external-days"]) > summary::after {
    content: "";
    display: inline-block;
    margin-inline-start: .35em;
    width: .32em;
    height: .32em;
    border: solid currentColor;
    border-width: 0 1px 1px 0;
    vertical-align: .2em;
    transform: rotate(45deg);
}
.cafe-exposure-panel > :is(.exposure-primary, .exposure-rank-detail, [data-exposure-disclosure="affiliate-days"], [data-exposure-disclosure="external-days"])[open] > summary::after { transform: rotate(225deg); }

.cafe-exposure-panel > .exposure-status-note,
.cafe-exposure-panel > [role="alert"] {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 3px solid var(--warning);
    background: var(--warning-bg);
    color: #fde3aa;
}
.cafe-exposure-panel .cafe-stats-table-wrap {
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    scrollbar-width: thin;
}
.cafe-exposure-panel .cafe-stats-table { font-variant-numeric: tabular-nums; }
.cafe-exposure-panel .cafe-stats-table :is(th, td) { border-right: 0; }
.cafe-exposure-panel .cafe-stats-table thead th {
    color: #d8e3f7;
    background: var(--bg-tertiary);
    box-shadow: inset 0 -1px var(--glass-border-hover);
}
.cafe-exposure-panel :is(.cafe-exposure-brands, .exposure-external-table) tr > :nth-child(n+2):nth-child(-n+4),
.cafe-exposure-panel .exposure-affiliate-table tr > :nth-child(n+3):nth-child(-n+5) { text-align: right; }
.cafe-exposure-panel .cafe-exposure-results td:nth-child(5),
.cafe-exposure-panel :is(.cafe-exposure-brands, .exposure-external-table) td:nth-child(4),
.cafe-exposure-panel .exposure-affiliate-table td:nth-child(5) { color: #c7d2fe; font-weight: 700; }

/* Daily records may span an entire month. The summary remains reachable before the rows. */
.cafe-exposure-panel > .exposure-primary {
    margin: 16px 0 8px;
    padding: 0;
    border: 0;
}
.cafe-exposure-panel > .exposure-primary > summary {
    color: var(--text-primary);
    font-size: 1.03rem;
    font-weight: 700;
}
@media (max-width: 768px) {
    .cafe-exposure-panel .cafe-exposure-controls:has(.exposure-brand) {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
        padding: 8px;
        margin: 8px 0;
    }
    .cafe-exposure-panel .cafe-exposure-controls > .exposure-brand {
        grid-area: 1 / 1;
        display: flex;
        gap: 6px;
        align-items: center;
        white-space: nowrap;
    }
    .cafe-exposure-panel .exposure-brand select { flex: 1; }
    .cafe-exposure-panel .cafe-exposure-controls > .btn-primary { grid-area: 1 / 2; }
    .exposure-periods {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px;
    }
    .exposure-periods .btn { padding: 2px; }
    .cafe-exposure-panel .exposure-date-nav { width: 100%; }
    .cafe-exposure-panel .cafe-exposure-kpis { margin-top: 8px; }
    .cafe-exposure-panel > h4 { margin-top: 16px; }
}

@media (max-width: 1050px) {
    .cafe-exposure-panel .cafe-exposure-results,
    .cafe-exposure-panel .cafe-exposure-brands { min-width: 0; }
    /* Keep every sort control available. Each result repeats its metric labels on small screens. */
    .cafe-exposure-results thead tr {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
    }
    .cafe-exposure-panel .cafe-exposure-results thead th {
        position: static;
        padding: 0;
        border: 0;
        border-radius: 5px;
        box-shadow: none;
    }
    .cafe-exposure-panel .cafe-exposure-results th .cafe-entry-sort {
        gap: 3px;
        min-height: 40px;
        padding: 4px 7px;
    }
    :is(.cafe-exposure-brands, .exposure-affiliate-table, .exposure-rank-table) thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    .cafe-exposure-panel :is(.cafe-exposure-results, .cafe-exposure-brands, .exposure-affiliate-table, .exposure-rank-table),
    .cafe-exposure-panel :is(.cafe-exposure-results, .cafe-exposure-brands, .exposure-affiliate-table, .exposure-rank-table) tbody,
    .cafe-exposure-panel .cafe-exposure-results thead { display: block; }
    .cafe-exposure-panel :is(.cafe-exposure-results, .cafe-exposure-brands, .exposure-affiliate-table, .exposure-rank-table) tbody tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 10px;
        margin: 7px 0;
        padding: 10px;
        background: var(--bg-secondary);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm);
    }
    .cafe-exposure-panel :is(.cafe-exposure-results, .cafe-exposure-brands, .exposure-affiliate-table, .exposure-rank-table) tbody :is(td, th) {
        min-width: 0;
        padding: 0;
        border: none;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .cafe-exposure-results tbody td:nth-child(1) { grid-column: 3; grid-row: 1; text-align: right; font-size: .75rem; color: var(--text-secondary); }
    .cafe-exposure-results tbody td:nth-child(2) { grid-column: 1 / 3; grid-row: 1; font-weight: 700; }
    .cafe-exposure-brands tbody td:first-child { grid-column: 1 / -1; font-weight: 700; }
    .cafe-exposure-results td:nth-child(3)::before, .cafe-exposure-brands td:nth-child(2)::before { content: '발행'; }
    .cafe-exposure-results td:nth-child(4)::before, .cafe-exposure-brands td:nth-child(3)::before { content: '노출'; }
    .cafe-exposure-results td:nth-child(5)::before, .cafe-exposure-brands td:nth-child(4)::before { content: '노출률'; }
    .cafe-exposure-panel :is(.cafe-exposure-results, .cafe-exposure-brands, .exposure-affiliate-table, .exposure-rank-table) td::before { display: block; color: var(--text-secondary); font-size: .73rem; font-weight: 400; }
    .cafe-exposure-panel .cafe-exposure-results td:nth-child(n+6),
    .cafe-exposure-panel .cafe-exposure-brands td:nth-child(5) { grid-column: 1 / -1; font-size: .82rem; }
    .cafe-exposure-panel :is(.cafe-exposure-results, .cafe-exposure-brands) td[colspan] { grid-column: 1 / -1; text-align: left; }
    .cafe-exposure-panel .cafe-stats-table-wrap:has(.cafe-exposure-results, .cafe-exposure-brands) { max-height: none; }

    .exposure-affiliate-table tbody th { grid-column: 1 / 3; grid-row: 1; }
    .exposure-affiliate-table td:nth-child(1) { grid-column: 3; grid-row: 1; }
    .exposure-affiliate-table td:nth-child(6) { grid-column: 1 / -1; font-size: .82rem; }
    .exposure-affiliate-table td:nth-child(3)::before { content: '발행'; }
    .exposure-affiliate-table td:nth-child(4)::before { content: '노출'; }
    .exposure-affiliate-table td:nth-child(5)::before { content: '노출률'; }
    .exposure-affiliate-table td:nth-child(6)::before { content: '수집 상태·원천'; }
    .cafe-exposure-panel .exposure-rank-table tbody tr {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .exposure-rank-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 1; font-weight: 700; }
    .exposure-rank-table td:nth-child(1)::before { content: '시트 기준일'; }
    .exposure-rank-table td:nth-child(2)::before { content: '브랜드'; }
    .exposure-rank-table td:nth-child(3)::before { content: '카페'; }
    .exposure-rank-table td:nth-child(4)::before { content: '검색 키워드'; }
    .exposure-rank-table td:nth-child(6)::before { content: '노출 여부'; }
    .exposure-rank-table td:nth-child(7)::before { content: '영역별 순위'; }
    .exposure-rank-table td:nth-child(8)::before { content: '측정 출처·시각 (한국)'; }
    .exposure-rank-table td:nth-child(9)::before { content: '시트 노출 기록'; }
    .exposure-rank-table td:nth-child(n+8) { grid-column: 1 / -1; font-size: .82rem; }
    .cafe-exposure-panel .exposure-rank-detail .cafe-exposure-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    .exposure-rank-detail .cafe-exposure-controls button { width: auto; }
}

.cafe-exposure-panel .exposure-pc-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr));
}
/* The measured columns share a ruler across the owned, external and affiliate reports. */
.cafe-exposure-panel {
    container: exposure-report / inline-size;
    --exposure-rule: #35445c;
    --exposure-row-rule: #29364c;
}
.cafe-exposure-panel .cafe-stats-table-wrap:has(.exposure-pc-table) {
    border: 1px solid var(--exposure-rule);
    margin-block: 12px 20px;
}
.cafe-exposure-panel .exposure-pc-table {
    --exposure-identity-width: 21%;
    --exposure-count-width: 10%;
    --exposure-long-count-width: 12%;
    --exposure-rate-width: 11%;
    table-layout: fixed;
    border-spacing: 0;
    border-collapse: separate;
}
.exposure-pc-table:has(.exposure-col-brand):has(.exposure-col-cafe) {
    --exposure-identity-width: 14%;
    --exposure-count-width: 8%;
    --exposure-long-count-width: 10%;
    --exposure-rate-width: 10%;
}
.cafe-exposure-panel .exposure-pc-table:has(.exposure-col-date) {
    --exposure-identity-width: 9.5%;
    --exposure-count-width: 7%;
    --exposure-long-count-width: 9%;
    --exposure-rate-width: 9%;
}
.exposure-col-brand, .exposure-col-cafe { width: var(--exposure-identity-width); }
.exposure-col-date { width: 10%; }
.exposure-pc-table:has(.exposure-col-date) .exposure-col-cafe { width: 16%; }
.exposure-col-published, .exposure-col-exposed { width: var(--exposure-count-width); }
.exposure-col-checked, .exposure-col-unknown { width: var(--exposure-long-count-width); }
.exposure-col-rate { width: var(--exposure-rate-width); }
.exposure-col-checked { width: calc(var(--exposure-long-count-width) + 2.5%); }
.cafe-exposure-panel .exposure-pc-table .exposure-field-checked .cafe-table-sort > span:first-child { white-space: nowrap; }

.cafe-exposure-panel .exposure-pc-table caption {
    margin: 0;
    padding: 12px 14px;
    background: var(--bg-secondary);
}
.cafe-exposure-panel .exposure-pc-table .exposure-column-groups th {
    position: static;
    padding: 6px 10px;
    background: #152137;
    color: #b3c4dc;
    font-size: .74rem;
    font-weight: 600;
    text-align: left;
    border-block: 1px solid var(--exposure-rule);
    box-shadow: none;
}
.cafe-exposure-panel .exposure-column-groups th:nth-child(2) { text-align: center; }
.cafe-exposure-panel .exposure-pc-table tbody td {
    padding: 10px;
    vertical-align: middle;
    text-align: left;
    border-bottom: 1px solid var(--exposure-row-rule);
    line-height: 1.5;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.cafe-exposure-panel .exposure-pc-table .exposure-field-headings th {
    padding: 3px 8px;
    vertical-align: middle;
    text-align: left;
}
.cafe-exposure-panel .exposure-pc-table .cafe-table-sort {
    justify-content: flex-start;
    align-items: center;
    gap: 3px;
    font-size: .8rem;
    line-height: 1.35;
}
.cafe-exposure-panel .exposure-pc-table .cafe-table-sort > span:first-child { flex: 0 1 auto; }
.cafe-exposure-panel .exposure-pc-table .cafe-table-sort > span[aria-hidden] { flex: none; }
.cafe-exposure-panel .exposure-pc-table :is(.exposure-field-date, .exposure-field-published, .exposure-field-checked, .exposure-field-exposed, .exposure-field-unknown, .exposure-field-rate) .cafe-table-sort {
    justify-content: center;
    text-align: center;
}
.cafe-exposure-panel .exposure-pc-table td:is([data-label="날짜"], [data-field]) {
    text-align: center;
    white-space: nowrap;
}
.cafe-exposure-panel .exposure-pc-table td[data-label="브랜드"] { white-space: nowrap; }
.cafe-exposure-panel .exposure-pc-table td[data-field="rate"] {
    font-weight: 700;
    color: #c7d2fe;
}
.cafe-exposure-panel .exposure-pc-table td[data-label="확인 내역"] { font-size: .85rem; color: #c5d0df; }
.cafe-exposure-panel .exposure-pc-table :is(.exposure-column-groups th + th, .exposure-field-published, .exposure-field-status, td[data-field="published"], td[data-label="확인 내역"]) {
    border-inline-start: 1px solid var(--exposure-rule);
}
.cafe-exposure-panel .exposure-rank-table td,
.cafe-exposure-panel .exposure-affiliate-table td {
    word-break: keep-all;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
@media (min-width: 1051px) {
    .cafe-exposure-panel .exposure-rank-table td:first-child,
    .cafe-exposure-panel .cafe-exposure-results td:first-child { white-space: nowrap; }
    .cafe-exposure-panel .exposure-affiliate-table tr > :is(:nth-child(3), :nth-child(6)),
    .cafe-exposure-panel .exposure-rank-table tr > :is(:nth-child(4), :nth-child(7)),
    .cafe-exposure-panel .exposure-rank-table tr > :nth-child(6),
    .cafe-exposure-panel .cafe-exposure-results tr > :is(:nth-child(3), :nth-child(6)) { border-inline-start: 1px solid var(--exposure-rule); }
}

@container exposure-report (max-width: 56rem) {
    .cafe-exposure-panel .cafe-stats-table-wrap:has(.exposure-pc-table) {
        border: 0;
        max-height: none;
    }
    .exposure-pc-table,
    .exposure-pc-table caption,
    .exposure-pc-table thead,
    .exposure-pc-table tbody { display: block; }
    .exposure-pc-table colgroup,
    .exposure-pc-table .exposure-column-groups { display: none; }
    .cafe-exposure-panel .exposure-pc-table caption { padding: 8px 0; background: transparent; }
    .exposure-pc-table .exposure-field-headings {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding-bottom: 4px;
    }
    .cafe-exposure-panel .exposure-pc-table .exposure-field-headings th {
        position: static;
        padding: 0;
        border: 1px solid var(--exposure-rule);
        border-radius: 6px;
        box-shadow: none;
    }
    .cafe-exposure-panel .exposure-pc-table .cafe-table-sort { padding-inline: 7px; min-height: 40px; }
    .cafe-exposure-panel .exposure-pc-table tbody tr {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0;
        margin: 8px 0;
        border: 1px solid var(--exposure-rule);
        border-radius: var(--radius-sm);
        background: var(--bg-secondary);
    }
    .cafe-exposure-panel .exposure-pc-table tbody tr > td {
        grid-column: auto;
        padding: 8px;
        min-width: 0;
        border: 0;
        text-align: left;
    }
    .exposure-pc-table td::before {
        display: block;
        content: attr(data-label);
        margin-bottom: 2px;
        color: var(--text-secondary);
        font-size: .73rem;
        font-weight: 500;
    }
    .cafe-exposure-panel .exposure-pc-table td:is([data-label="브랜드"], [data-label="날짜"], [data-label="카페"]) {
        grid-row: 1;
        text-align: left;
    }
    .exposure-pc-table tr:has([data-label="브랜드"]) { --exposure-cafe-start: 2; }
    .exposure-pc-table tr:has([data-label="날짜"]) { --exposure-cafe-start: 3; }
    .cafe-exposure-panel .exposure-pc-table td[data-label="카페"] { grid-column: var(--exposure-cafe-start, 1) / -1; }
    .cafe-exposure-panel .exposure-pc-table td[data-field] {
        grid-row: 2;
        padding: 7px 4px;
        border-block-start: 1px solid var(--exposure-rule);
        background: rgba(148,163,184,.05);
        text-align: center;
    }
    .cafe-exposure-panel .exposure-pc-table td[data-label="확인 내역"] {
        grid-column: 1 / -1;
        border-block-start: 1px solid var(--exposure-rule);
    }
}
@container exposure-report (max-width: 32rem) {
    .cafe-exposure-panel .exposure-pc-table tbody tr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .cafe-exposure-panel .exposure-pc-table td[data-label="브랜드"],
    .cafe-exposure-panel .exposure-pc-table td[data-label="날짜"] { grid-column: span 3; }
    .cafe-exposure-panel .exposure-pc-table td[data-label="카페"] { grid-column: 1 / -1; grid-row: auto; }
    .cafe-exposure-panel .exposure-pc-table td[data-field] {
        grid-column: span 2;
        grid-row: auto;
    }
    .cafe-exposure-panel .exposure-pc-table td:is([data-field="unknown"], [data-field="rate"]) {
        grid-column: span 3;
    }
}

.exposure-matrix-wrap {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}
.exposure-matrix { width: 100%; border-spacing: 0; font-variant-numeric: tabular-nums; }
.cafe-exposure-panel .exposure-matrix caption { margin: 0; padding: 10px 14px; font-size: .83rem; color: var(--text-secondary); }
.exposure-matrix th, .exposure-matrix td { padding: 6px 10px; text-align: center; border-top: 1px solid var(--glass-border); }
.exposure-matrix thead th { background: var(--bg-secondary); }
.exposure-matrix th:first-child {
    position: sticky; left: 0; z-index: 1; text-align: left; min-width: 6rem; max-width: 12rem;
    background: var(--bg-secondary); border-right: 1px solid var(--glass-border); overflow-wrap: anywhere;
}
.exposure-matrix td { min-width: 6.8rem; }
.exposure-matrix button {
    width: 100%; min-height: 42px; padding: 4px; background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-sm); color: var(--text-primary); cursor: pointer; font: inherit;
}
.exposure-matrix button:is(:hover, [aria-expanded="true"]) { background: var(--bg-tertiary); border-color: var(--glass-border-hover); }
.exposure-matrix button:focus-visible, .exposure-matrix-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.exposure-matrix button strong { display: block; white-space: nowrap; }
.exposure-matrix button span, .exposure-matrix th small { display: block; font-size: .77rem; font-weight: 500; color: var(--text-secondary); }
.exposure-matrix-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-block: 10px; }
.exposure-matrix button small { display: block; margin-top: 2px; font-size: .72rem; color: var(--text-secondary); }
