/* Posts page */
.posts-dashboard-content {
    padding-top: 0;
    padding-bottom: 2rem;
    /* 投稿画像列の幅（.post-thumb-cell / .post-thumb と整合。変更時は下記 calc も確認） */
    --posts-thumb-column-width: 100px;
}

/* ツールバー用ヘッダー（メイン列最上部・カードより上） */
.app-page-toolbar-header {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding-block: 0.75rem;
    margin-bottom: 0.875rem;
}

.posts-toolbar.posts-toolbar--page-header {
    margin-bottom: 0;
    padding: 0;
    background-color: transparent;
    border: none;
}

/* 投稿一覧: テーブル向けにメインカラムを広げる（サムネ列拡張分を含む） */
.posts-dashboard-content > .page-intro .container,
.posts-dashboard-content > .app-page-toolbar-header .container,
.posts-dashboard-content > .container {
    max-width: min(
        100%,
        calc(1200px + var(--posts-thumb-column-width) - 72px + 4.75rem)
    );
    padding-inline: 0.75rem;
}

.posts-page-card {
    overflow: visible;
}

/* フォロワー推移チャート直下の投稿サムネ帯（グラフに近づけるコンパクト配置） */
.follower-chart-canvas-wrap {
    position: relative;
    height: 500px;
    width: 100%;
    margin-bottom: 0;
}

.follower-post-strip-block {
    margin-top: 0.15rem;
    padding: 0;
}

.follower-post-strip-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-color);
}

.follower-post-strip-error {
    margin: 0 0 0.25rem;
}

.follower-post-strip-notice {
    margin: 0 0 0.25rem;
}

.follower-post-strip-mount {
    min-height: 2rem;
    margin-top: 0;
    padding-top: 0;
}

.follower-post-strip-intro {
    margin: 0.35rem 0 0;
    line-height: 1.5;
    font-size: 0.8125rem;
}

.follower-demographics-row {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: stretch;
}

.follower-demographics-row > .follower-gender-card,
.follower-demographics-row > .follower-gender-age-card {
    flex: 1 1 min(100%, 320px);
    min-width: min(100%, 280px);
}

.follower-gender-note,
.follower-gender-age-note {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.follower-gender-age-chart-block {
    margin-top: 0.5rem;
}

.follower-gender-age-chart-wrap {
    position: relative;
    height: 360px;
    width: 100%;
    max-width: 100%;
}

.follower-gender-chart-block {
    margin-top: 0.5rem;
}

.follower-gender-chart-wrap {
    position: relative;
    height: 280px;
    max-width: 320px;
    margin-inline: auto;
}

.follower-gender-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    line-height: 1.35;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.follower-gender-donut-center .follower-gender-pct-f {
    color: #c62828;
}

.follower-gender-donut-center .follower-gender-pct-m {
    color: #4778df;
}

.follower-country-card {
    margin-top: 1.25rem;
}

.follower-jp-pref-card {
    margin-top: 1.25rem;
}

.follower-country-note {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.follower-jp-pref-note {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* タグ付け投稿ページ */
.tagged-posts-note {
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    color: var(--text-light);
    font-size: 0.875rem;
}

.tagged-posts-chart-wrap {
    position: relative;
    height: 360px;
    width: 100%;
    margin-top: 0.5rem;
}

.tagged-posts-summary-row {
    margin-top: 1.25rem;
}

.tagged-posts-summary-row > .tagged-posts-summary-card {
    flex: 1 1 min(100%, 320px);
    min-width: 0;
    max-width: 100%;
}

/* タグ付けページは投稿一覧用の広い container を使わず PC に収まる幅にする */
.tagged-posts-dashboard.posts-dashboard-content > .app-page-toolbar-header .container,
.tagged-posts-dashboard.posts-dashboard-content > .container {
    max-width: min(100%, 1200px);
    padding-inline: 1.25rem;
}

.tagged-posts-mini-table-wrap {
    max-height: 280px;
    overflow-x: auto;
    overflow-y: auto;
}

/*
 * .posts-table の min-width: 1300px+ が継承されるとカード内で列が押し出され、
 * overflow-x: hidden だと「件数」列が見えなくなる。ミニテーブルは常にカード幅に収める。
 */
.posts-table.tagged-posts-mini-table {
    /* 件数列の固定幅（左列は残り） */
    --tagged-mini-count-col: 5.75rem;
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

/* 2列構成: 左は可変（省略）、右は件数を固定幅で常に表示 */
.tagged-posts-mini-table th:nth-child(1),
.tagged-posts-mini-table td:nth-child(1) {
    width: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tagged-posts-mini-table th:nth-child(2),
.tagged-posts-mini-table td:nth-child(2) {
    width: var(--tagged-mini-count-col);
    min-width: var(--tagged-mini-count-col);
    max-width: var(--tagged-mini-count-col);
    box-sizing: border-box;
    padding-left: 0.5rem;
    padding-right: 0.35rem;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* 一覧: 投稿テーブル用の巨大 min-width を打ち消し、固定レイアウトで PC に収める */
.posts-table.tagged-posts-main-table {
    /* 列幅トークン（タグ付け一覧のみ。調整はここを優先） */
    --tagged-product-type-w: 4.25rem;
    --tagged-product-type-min: 3.75rem;
    --tagged-product-type-max: 5rem;
    --tagged-account-w: 7.5rem;
    --tagged-account-min: 7rem;
    --tagged-account-max: 8.5rem;
    --tagged-datetime-w: 7.5rem;
    --tagged-datetime-min: 7rem;
    --tagged-datetime-max: 8.5rem;
    --tagged-metric-w: 4.5rem;
    --tagged-metric-min: 4.25rem;
    --tagged-metric-max: 5rem;
    --tagged-pr-w: 4.5rem;
    --tagged-pr-min: 4.25rem;
    --tagged-pr-max: 5rem;
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.tagged-posts-main-table th:nth-child(1),
.tagged-posts-main-table td:nth-child(1) {
    width: var(--posts-thumb-column-width);
}

/* 種別（画像の右。FEED/REELS 程度の幅） */
.tagged-posts-main-table th:nth-child(2),
.tagged-posts-main-table td:nth-child(2) {
    width: var(--tagged-product-type-w);
    min-width: var(--tagged-product-type-min);
    max-width: var(--tagged-product-type-max);
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tagged-posts-main-table th:nth-child(3),
.tagged-posts-main-table td:nth-child(3) {
    width: var(--tagged-account-w);
    min-width: var(--tagged-account-min);
    max-width: var(--tagged-account-max);
    box-sizing: border-box;
}

/* 投稿日時は下の .tagged-posts-main-table .posts-col-post-time で幅を確保 */

.tagged-posts-main-table th:nth-child(5),
.tagged-posts-main-table td:nth-child(5) {
    width: auto;
    min-width: 0;
}

.tagged-posts-main-table th:nth-child(6),
.tagged-posts-main-table td:nth-child(6),
.tagged-posts-main-table th:nth-child(7),
.tagged-posts-main-table td:nth-child(7),
.tagged-posts-main-table th:nth-child(8),
.tagged-posts-main-table td:nth-child(8),
.tagged-posts-main-table th:nth-child(9),
.tagged-posts-main-table td:nth-child(9),
.tagged-posts-main-table th:nth-child(10),
.tagged-posts-main-table td:nth-child(10) {
    width: var(--tagged-metric-w);
    min-width: var(--tagged-metric-min);
    max-width: var(--tagged-metric-max);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.tagged-posts-main-table th:nth-child(11),
.tagged-posts-main-table td:nth-child(11) {
    width: var(--tagged-pr-w);
    min-width: var(--tagged-pr-min);
    max-width: var(--tagged-pr-max);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.tagged-posts-main-table th:nth-child(3) .sort-button {
    white-space: normal;
    line-height: 1.25;
    font-size: 0.82rem;
    text-align: center;
    width: 100%;
    padding-inline: 0.2rem;
}

.tagged-posts-main-table th:nth-child(6) .sort-button,
.tagged-posts-main-table th:nth-child(7) .sort-button,
.tagged-posts-main-table th:nth-child(8) .sort-button,
.tagged-posts-main-table th:nth-child(9) .sort-button,
.tagged-posts-main-table th:nth-child(10) .sort-button {
    white-space: normal;
    line-height: 1.25;
    font-size: 0.78rem;
    text-align: center;
    width: 100%;
}

/* いいねと総いいねが異なる行（広告利用などの参考） */
.posts-table.tagged-posts-main-table tr.tagged-posts-row--like-total-mismatch > td {
    background-color: rgba(71, 120, 223, 0.12);
}

.tagged-posts-main-table .post-text-cell {
    overflow: hidden;
    vertical-align: top;
}

.tagged-posts-main-table .post-text-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-break: break-word;
}

.tagged-posts-account-cell {
    max-width: var(--tagged-account-max);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

/* 一覧: 極狭ビューのみ横スクロール（table-layout:fixed で通常は収まる想定） */
#tagged-posts-list-region .posts-table-wrapper {
    overflow-x: auto;
}

.tagged-posts-pr-yes {
    font-weight: 600;
    color: var(--text-color);
}

.follower-country-map-block,
.follower-jp-pref-map-block {
    margin-top: 0.5rem;
}

.follower-country-map-split,
.follower-jp-pref-map-split {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.follower-country-map-split .follower-country-map-wrap,
.follower-jp-pref-map-split .follower-jp-pref-map-wrap {
    flex: 1 1 280px;
    min-width: 0;
    width: 100%;
    min-height: 420px;
    max-height: 420px;
    box-sizing: border-box;
}

.follower-country-table-panel,
.follower-jp-pref-table-panel {
    flex: 0 1 300px;
    width: 100%;
    max-width: 320px;
    max-height: 420px;
    overflow: auto;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #ffffff;
}

.follower-jp-region-table-panel {
    flex: 0 1 220px;
    max-width: 260px;
}

.follower-country-table,
.follower-jp-pref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.follower-country-table thead th,
.follower-jp-pref-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.5rem 0.65rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.follower-country-table-th-num,
.follower-country-table td.follower-country-table-num,
.follower-jp-pref-table-th-num,
.follower-jp-pref-table td.follower-jp-pref-table-num {
    text-align: right;
    white-space: nowrap;
}

.follower-country-table tbody td,
.follower-jp-pref-table tbody td {
    padding: 0.4rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: top;
}

.follower-country-table tbody tr:last-child td,
.follower-jp-pref-table tbody tr:last-child td {
    border-bottom: none;
}

.posts-interactive-region {
    position: relative;
}

.posts-content-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.posts-content-tabs__tab {
    padding: 0.65rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.posts-content-tabs__tab:hover {
    color: var(--text-color);
}

.posts-content-tabs__tab--active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.stories-insights-disclaimer {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-light);
}

.stories-insights-disclaimer strong {
    color: var(--text-color);
    font-weight: 600;
}

.posts-table.stories-table {
    min-width: 880px;
}

.post-thumb-open-btn {
    display: block;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}

.post-thumb-open-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.post-thumb-open-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.post-thumb-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.28);
    color: var(--bg-color);
    pointer-events: none;
}

.post-thumb-play-icon {
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.stories-text-unavailable {
    color: var(--text-light);
}

.caption-modal-main--media-only .caption-modal-media {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
}

.caption-modal-main--media-only .caption-modal-body {
    display: none;
}

/* 投稿一覧: 絶対値 / リーチ比率 表示切替 */
.posts-display-mode {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.65rem;
    margin-bottom: 1rem;
}

.posts-display-mode__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.posts-display-mode__btn {
    height: var(--posts-toolbar-control-height, 2.5rem);
    min-height: var(--posts-toolbar-control-height, 2.5rem);
    padding: 0 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.posts-display-mode__btn:hover {
    background-color: var(--bg-light);
}

.posts-display-mode__btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.posts-display-mode__btn--active {
    border-color: var(--primary-color);
    background-color: #f0f5ff;
    color: var(--primary-color);
}

.posts-display-mode--reach-ratio
    .posts-display-mode__btn.posts-display-mode__btn--active[data-posts-display-mode='reach_ratio'] {
    border-color: var(--posts-reach-ratio-accent);
    background-color: #fff3e0;
    color: var(--posts-reach-ratio-accent);
}

.posts-display-mode--reach-ratio
    .posts-display-mode__btn.posts-display-mode__btn--active[data-posts-display-mode='reach_ratio']:focus-visible {
    outline-color: var(--posts-reach-ratio-accent);
}

/* 投稿一覧: 絞り込み後全件の指標サマリー（フィード・リール） */
.posts-metrics-summary {
    margin: 0 0 1rem;
}

.posts-metrics-summary__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.5rem;
}

.posts-metrics-summary__card {
    margin: 0;
    min-height: 4.75rem;
    padding: 0.65rem 0.75rem;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-light);
}

.posts-metrics-summary__label {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-light);
}

.posts-metrics-summary__value {
    margin: 0.2rem 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.posts-metrics-summary__avg {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
}

.posts-metrics-summary__avg-label {
    margin-right: 0.25rem;
}

.posts-metrics-summary__note {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-light);
}

.posts-metric--reach-ratio {
    color: var(--posts-reach-ratio-accent);
    font-weight: 600;
}

/* 投稿一覧: クライアントのみの種別・本文検索・コラボ除外（API は呼ばない） */
.posts-client-filters {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    box-sizing: border-box;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.posts-client-filters__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
}

.posts-client-filters__group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.posts-client-filters__group--grow {
    flex: 1 1 220px;
}

.posts-client-filters__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.posts-client-filters__select,
.posts-client-filters__search {
    height: var(--posts-toolbar-control-height, 2.5rem);
    min-height: var(--posts-toolbar-control-height, 2.5rem);
    max-height: var(--posts-toolbar-control-height, 2.5rem);
    padding: 0 0.65rem;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
}

.posts-client-filters__select {
    min-width: 10rem;
    max-width: 100%;
}

.posts-client-filters__search {
    flex: 1 1 auto;
    min-width: 0;
}

.posts-client-filters__search:focus,
.posts-client-filters__select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.posts-client-filters__search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.posts-client-filters__clear-btn {
    height: var(--posts-toolbar-control-height, 2.5rem);
    min-height: var(--posts-toolbar-control-height, 2.5rem);
    max-height: var(--posts-toolbar-control-height, 2.5rem);
    flex-shrink: 0;
}

.posts-client-filters__group--checkbox {
    align-self: flex-end;
}

.posts-client-filters__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: var(--posts-toolbar-control-height, 2.5rem);
    min-height: var(--posts-toolbar-control-height, 2.5rem);
    margin: 0;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.posts-client-filters__checkbox input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--primary-color);
}

.posts-client-filters__checkbox input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.posts-client-filters__checkbox:has(input:disabled) {
    color: var(--text-light);
    cursor: not-allowed;
}

