/* ============================================================
   dl.css - フォトリミ配布 ユーザー向けダウンロード画面
   ============================================================ */

:root {
    --primary:   #1a6fcf;
    --text:      #2d3748;
    --text-sub:  #718096;
    --border:    #e2e8f0;
    --error:     #c53030;
    --error-bg:  #fff5f5;
    --radius:    10px;
    --bg:        #f0f4f8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ラッパー */
.dl-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 40px 16px 60px;
}

/* ヘッダー */
.dl-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    background: #1a365d;
    color: #fff;              /* 屋号設定の文字色をテンプレート側でstyle指定して上書きする */
    padding: 10px 24px;
    border-radius: 8px;
}
.dl-logo {
    height: 28px;
    width: auto;
}
.dl-sitename {
    font-size: 1rem;
    font-weight: 700;
    color: inherit;           /* 屋号設定の文字色。白背景に白文字にならないよう決め打ちしない */
    letter-spacing: .02em;
}

/* メインカード */
.dl-main {
    width: 100%;
    max-width: 420px;
}

.dl-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 36px 32px 32px;
    text-align: center;
}

/* アイコン */
.dl-card-icon {
    width: 56px;
    height: 56px;
    background: #ebf4ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.dl-card-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
}

/* タイトル */
.dl-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

/* プロジェクト情報 */
.dl-info {
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    text-align: left;
}
.dl-studio-name {
    font-size: .8rem;
    color: var(--text-sub);
    margin-bottom: 2px;
}
.dl-project-name {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
}
.dl-filename {
    font-size: .85rem;
    color: var(--text-sub);
    margin-top: 4px;
}

/* 説明文 */
.dl-lead {
    font-size: .92rem;
    color: var(--text-sub);
    margin-bottom: 20px;
}
.dl-lead strong {
    color: var(--text);
}

/* エラー */
.dl-error {
    background: var(--error-bg);
    border: 1px solid #feb2b2;
    border-radius: 6px;
    color: var(--error);
    font-size: .88rem;
    padding: 10px 14px;
    margin-bottom: 14px;
    text-align: left;
}
.dl-error-remaining {
    margin-top: 6px;
    font-size: .8rem;
    font-weight: 700;
    color: #c05621;
}

/* キー入力 */
.dl-key-group {
    margin-bottom: 16px;
}
.dl-key-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color .15s;
}
.dl-key-input:focus {
    border-color: var(--primary);
}
.dl-key-input.iserr {
    border-color: var(--error);
    background: var(--error-bg);
}

/* 送信ボタン */
.dl-btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}
.dl-btn-submit:hover {
    background: #155aab;
}

/* 注釈 */
.dl-note {
    margin-top: 20px;
    font-size: .8rem;
    color: var(--text-sub);
    text-align: center;
    line-height: 1.7;
}

/* スマホ対応 */
@media (max-width: 480px) {
    .dl-card {
        padding: 28px 20px 24px;
    }
}

/* ============================================================
   証明写真ダウンロード画面
   ============================================================ */

.portrait-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 60px;
    width: 100%;
}
.portrait-info {
    margin-bottom: 12px;
}
.portrait-size-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.portrait-size-label {
    font-size: .85rem;
    color: var(--text-sub);
    white-space: nowrap;
}
.portrait-size-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .88rem;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}
/* カスタムサイズ入力パネル */
.portrait-custom-panel {
    background: #f0f6ff;
    border: 1px solid #b6d0f5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    text-align: center;
}
.portrait-custom-panel .custom-panel-title {
    font-size: .8rem;
    color: var(--text-sub);
    margin-bottom: 10px;
}
.portrait-custom-panel .custom-panel-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.portrait-custom-panel .custom-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .85rem;
    color: var(--text);
}
.portrait-custom-panel .custom-input {
    width: 68px;
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: .9rem;
    text-align: right;
}
.portrait-custom-panel .custom-sep {
    font-size: 1.1rem;
    color: var(--text-sub);
}
.portrait-custom-panel .custom-unit-select {
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: .85rem;
}
.portrait-custom-panel .custom-apply-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: .85rem;
    cursor: pointer;
    transition: opacity .15s;
}
.portrait-custom-panel .custom-apply-btn:hover { opacity: .85; }
.portrait-custom-panel .custom-err {
    font-size: .8rem;
    color: var(--error);
    margin-top: 6px;
    min-height: 1.2em;
}
body.theme-hc .portrait-custom-panel { background: #1e2d3d; border-color: #3b5a82; }
body.theme-hc .portrait-custom-panel .custom-input,
body.theme-hc .portrait-custom-panel .custom-unit-select { background: #1f2937; color: #f9fafb; border-color: #4b5563; }

.portrait-api-warn {
    background: #fffbeb;
    border: 1px solid #f6cc52;
    color: #92600a;
    font-size: .85rem;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}
.portrait-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

/* 操作パネル */
.portrait-ctrl {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    min-width: 110px;
}
.ctrl-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.ctrl-label {
    font-size: .75rem;
    color: var(--text-sub);
    text-align: center;
    font-weight: 600;
}
.ctrl-dpad {
    display: grid;
    grid-template-areas: ". up ." "left . right" ". down .";
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
}
.ctrl-dpad [data-action="up"]    { grid-area: up; }
.ctrl-dpad [data-action="left"]  { grid-area: left; }
.ctrl-dpad [data-action="right"] { grid-area: right; }
.ctrl-dpad [data-action="down"]  { grid-area: down; }
.ctrl-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}
.ctrl-btn {
    width: 36px;
    height: 36px;
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .1s;
    user-select: none;
}
.ctrl-btn:hover  { background: #e8f0fe; }
.ctrl-btn:active { background: #c7d8f8; }
.ctrl-reset-btn {
    width: 100%;
    padding: 7px 0;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 6px;
    color: #c53030;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.ctrl-reset-btn:hover { background: #fed7d7; }

/* クロップコンテナ */
.portrait-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.crop-container {
    position: relative;
    width: 300px;
    overflow: hidden;
    border: 2px solid #1a6fcf;
    border-radius: 4px;
    cursor: grab;
    background: #ddd;
    user-select: none;
    touch-action: none;
}
.crop-container:active { cursor: grabbing; }
.crop-img {
    position: absolute;
    display: block;
    max-width: none;
}
.crop-guide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.crop-loading {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(240, 244, 248, 1.0);
    pointer-events: none;

background: linear-gradient(
        90deg, 
        rgba(240, 244, 248, 1.0) 25%, 
        rgba(220, 225, 235, 1.0) 50%, 
        rgba(240, 244, 248, 1.0) 75%
    );
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite linear;

}
.crop-loading.hidden { display: none; }
.crop-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #c8d8ea;
    border-top-color: #1a6fcf;
    border-radius: 50%;
    animation: crop-spin 0.8s linear infinite;
}
@keyframes crop-spin { to { transform: rotate(360deg); } }
.crop-loading-text {
    font-size: .8rem;
    color: #555;
    margin: 0;
}
.crop-hint {
    font-size: .75rem;
    color: var(--text-sub);
    text-align: center;
}
.crop-hint-sp { display: none; }

/* ダウンロードボタン */
.portrait-dl-area {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}
.portrait-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}
.portrait-dl-btn:hover { background: #155aab; }
.portrait-dl-btn svg { width: 20px; height: 20px; }

@media (max-width: 600px) {
    /* 写真を上・コントロールを下に反転 */
    .portrait-layout {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .portrait-preview-wrap { order: 1; }
    .portrait-ctrl {
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: unset;
        width: 100%;
        padding: 10px 12px;
    }
    /* グループラベル非表示 */
    .portrait-ctrl .ctrl-label { display: none; }
    /* 各グループを横並びボタン列に */
    .portrait-ctrl .ctrl-group {
        flex-direction: row;
        gap: 4px;
    }
    /* d-pad のグリッドを解除して横1列に */
    .portrait-ctrl .ctrl-dpad {
        display: flex;
        flex-direction: row;
        gap: 4px;
    }
    .portrait-ctrl .ctrl-dpad [data-action] { grid-area: unset; }
    .ctrl-reset-btn { display: none; }
    .crop-hint-pc { display: none; }
    .crop-hint-sp { display: block; }
    /* 写真はほぼ全幅に・1本指スクロールを妨げない */
    .crop-container {
        width: calc(100vw - 48px);
        touch-action: pan-x pan-y;
    }
}

/* ============================================================
   スナップ・記念写真ダウンロード画面
   ============================================================ */

/* ヘッダー拡張 */
.dl-header-sep {
    flex: 1;
}
.dl-header-studio {
    font-size: .85rem;
    color: inherit;           /* 屋号設定の文字色を継ぐ */
    opacity: .75;
}

/* メインエリア */
.snap-main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    width: 100%;
}

/* 情報バー */
.snap-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.snap-project {
    font-size: .82rem;
    color: var(--text-sub);
    margin-bottom: 2px;
}
.snap-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

/* ZIPボタン */
.btn-zip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    font-size: .92rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}
.btn-zip:hover { background: #155aab; }
.btn-zip svg { width: 18px; height: 18px; }

/* フォトグリッド */
.snap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.snap-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    overflow: hidden;
    transition: box-shadow .15s;
}
.snap-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.13);
}

.snap-thumb-wrap {
    aspect-ratio: 3 / 2;
    background: #f0f4f8;
    overflow: hidden;
    cursor: pointer;
}
.snap-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
}
.snap-card:hover .snap-thumb {
    transform: scale(1.03);
}

.snap-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}
.snap-fname {
    font-size: .78rem;
    color: var(--text-sub);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* 個別DLボタン */
.btn-dl-single {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #ebf4ff;
    color: var(--primary);
    font-size: .8rem;
    font-weight: 600;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .12s;
}
.btn-dl-single:hover { background: #bee3f8; }
.btn-dl-single svg { width: 13px; height: 13px; }

/* 空ステート */
.snap-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-sub);
}

/* サムネイルホバーオーバーレイ */
.snap-thumb-wrap {
    position: relative;
    cursor: pointer;
}
.snap-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .18s;
}
.snap-thumb-overlay svg {
    width: 40px;
    height: 40px;
    stroke: #fff;
}
.snap-thumb-wrap:hover .snap-thumb-overlay {
    opacity: 1;
}

/* ライトボックス */
.lb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,30,70,.75);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.lb-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100vh;
    width: 100%;
}
.lb-close {
    position: absolute;
    top: -44px;
    right: 4px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: .7;
    padding: 4px 10px;
    transition: opacity .12s;
}
.lb-close:hover { opacity: 1; }

.lb-body {
    display: flex;
    align-items: center;
    gap: 12px;
    max-height: calc(100vh - 120px);
    width: 100%;
    padding: 0 8px;
}
.lb-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-height: calc(100vh - 120px);
}
.lb-img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.lb-nav {
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    width: 48px;
    height: 64px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s;
}
.lb-nav:hover { background: rgba(255,255,255,.25); }

.lb-foot {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px 0;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}
.lb-fname {
    font-size: .85rem;
    color: rgba(255,255,255,.6);
}
.lb-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--primary);
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    border-radius: 7px;
    text-decoration: none;
    transition: background .12s;
}
.lb-dl-btn:hover { background: #155aab; }
.lb-dl-btn svg { width: 16px; height: 16px; }

/* ============================================================
   ライトボックス内セレクト（拡大表示中も選択できる。picpas_connect dl.css の
   写真セレクト画面ライトボックス構成を参考に移植。.lb-overlay-select が付いた
   ライトボックスのみ写真＋サイドバー構成になり、他画面（.lb-overlay単体）の
   ビューア専用ライトボックスには影響しない）
   ============================================================ */
.lb-img-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.lb-sidebar-head { display: none; }
.lb-fname-side { font-size: .95rem; font-weight: 700; color: #2d3748; word-break: break-all; }
.lb-mobile-nav-footer { display: none; }
.lb-mobile-close {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.lb-foot-nav { display: none; }
/* ライトボックス内 選択ボタン */
.lb-sel-btn {
    padding: 9px 20px;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,.4);
    border-radius: 7px;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.lb-sel-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.7); }
.lb-sel-btn.lb-sel-btn-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.lb-sel-area { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* PC版：写真エリア＋右サイドバー構成 */
@media (min-width: 601px) {
    .lb-overlay-select .lb-dialog {
        background: #f4f5f6;
        border-radius: 10px;
        overflow: hidden;
        width: min(1320px, 94vw);
        height: min(880px, 92vh);
        max-height: 92vh;
        box-shadow: 0 20px 60px rgba(0,0,0,.4);
    }
    .lb-overlay-select .lb-close {
        position: absolute;
        top: 10px;
        right: 14px;
        bottom: auto;
        color: #2d3748;
        opacity: .6;
    }
    .lb-overlay-select .lb-close:hover { opacity: 1; }
    .lb-overlay-select .lb-body {
        flex: 1;
        min-height: 0;
        max-height: none;
        align-items: center;
        gap: 0;
        padding: 0;
    }
    .lb-overlay-select .lb-nav.lb-prev,
    .lb-overlay-select .lb-nav.lb-next {
        align-self: center;
        background: rgba(0,0,0,.08);
        color: #2d3748;
    }
    .lb-overlay-select .lb-nav.lb-prev:hover,
    .lb-overlay-select .lb-nav.lb-next:hover { background: rgba(0,0,0,.16); }
    .lb-overlay-select .lb-img-col {
        align-self: stretch;
        background: #f4f5f6;
        padding: 40px;
        gap: 12px;
    }
    .lb-overlay-select .lb-img-col .lb-fname { display: none; }
    .lb-overlay-select .lb-img-wrap {
        max-height: none;
        min-height: 0;
        width: 100%;
    }
    .lb-overlay-select .lb-img {
        max-width: 100%;
        max-height: 100%;
        box-shadow: none;
    }
    .lb-overlay-select .lb-sidebar {
        align-self: stretch;
        display: flex;
        flex-direction: column;
        width: 320px;
        flex-shrink: 0;
        border-left: 1px solid #e2e8f0;
    }
    .lb-overlay-select .lb-sidebar-head {
        display: block;
        padding: 20px 24px;
        border-bottom: 1px solid #e2e8f0;
    }
    .lb-overlay-select .lb-sel-area {
        flex: 1;
        min-height: 0;
        flex-direction: column;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: stretch;
        gap: 12px;
        padding: 20px 24px;
    }
    .lb-overlay-select .lb-sel-area .lb-sel-btn {
        width: 100%;
        justify-content: center;
        padding: 16px 20px;
        font-size: 1.05rem;
        border-radius: 10px;
        background: #fff;
        color: #4a5568;
        border-width: 2.5px;
        border-color: #cbd5e0;
    }
    .lb-overlay-select .lb-sel-area .lb-sel-btn:hover { background: #f3f4f6; }
    .lb-overlay-select .lb-sel-area .lb-sel-btn.lb-sel-btn-active {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
    }
    .lb-overlay-select .lb-foot { display: none; }
    .lb-overlay-select .lb-foot-nav {
        display: flex;
        gap: 10px;
        padding: 0 24px 24px;
    }
    .lb-overlay-select .lb-foot-nav-btn {
        flex: 1;
        padding: 10px;
        background: #fff;
        border: 1.5px solid #cbd5e0;
        border-radius: 8px;
        font-size: .95rem;
        color: #4a5568;
        cursor: pointer;
    }
    .lb-overlay-select .lb-foot-nav-btn:hover { background: #f3f4f6; }
}

/* スマホ版：写真は上部いっぱい、セレクトボタンは下部固定シートで */
@media (max-width: 600px) {
    .lb-overlay-select .lb-dialog {
        width: 100%;
        height: 100%;
        max-height: 100vh;
    }
    .lb-overlay-select .lb-body {
        flex-direction: column;
        align-items: stretch;
        height: 100%;
        max-height: none;
        gap: 0;
        padding: 0;
    }
    .lb-overlay-select .lb-img-col {
        flex: 1;
        min-height: 0;
        gap: 0;
    }
    .lb-overlay-select .lb-img-col .lb-fname { display: none; }
    .lb-overlay-select .lb-img-wrap {
        width: 100%;
        height: 100%;
        max-height: none;
        align-items: center;
    }
    .lb-overlay-select .lb-img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
    }
    .lb-overlay-select .lb-sidebar {
        flex: 0 0 auto;
        width: 100%;
        max-height: 50vh;
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -6px 24px rgba(0,0,0,.3);
        z-index: 20;
    }
    .lb-overlay-select .lb-sidebar-head {
        display: block;
        padding: 14px 18px;
        border-bottom: 1px solid #e2e8f0;
    }
    .lb-overlay-select .lb-sel-area {
        width: 100%;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 10px;
        padding: 14px 18px;
        overflow-y: auto;
    }
    .lb-overlay-select .lb-sel-area .lb-sel-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 18px;
        font-size: 1rem;
        border-radius: 10px;
        background: #fff;
        color: #4a5568;
        border-width: 2.5px;
        border-color: #cbd5e0;
    }
    .lb-overlay-select .lb-sel-area .lb-sel-btn.lb-sel-btn-active {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
    }
    .lb-overlay-select .lb-nav.lb-prev,
    .lb-overlay-select .lb-nav.lb-next,
    .lb-overlay-select .lb-close { display: none; }
    .lb-overlay-select .lb-mobile-nav-footer {
        display: flex;
        align-items: stretch;
        justify-content: stretch;
        gap: 8px;
        padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #e2e8f0;
    }
    .lb-overlay-select .lb-mobile-nav-footer .lb-nav {
        position: static;
        top: auto; left: auto; right: auto;
        transform: none;
        width: auto;
        height: auto;
        flex: 1.5 1 0;
        min-width: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f4f5f6;
        color: #2d3748;
        font-size: 1.6rem;
        border-radius: 8px;
    }
    .lb-overlay-select .lb-mobile-nav-footer .lb-nav:active { background: #e8eaed; }
    .lb-overlay-select .lb-mobile-close {
        flex: 1 1 0;
        text-align: center;
        color: #2d3748;
        font-size: .92rem;
        font-weight: 700;
        letter-spacing: .05em;
        padding: 14px 16px;
        background: #f4f5f6;
        border-radius: 8px;
    }
    .lb-overlay-select .lb-mobile-close:active { background: #e8eaed; }
}

/* ============================================================
   ガイドSVG  CSS変数（テーマで色を切り替えられるように）
   ============================================================ */

:root {
    --guide-ellipse: rgba(255,80,80,.7);
    --guide-line:    rgba(255,80,80,.45);
}
.crop-guide ellipse { stroke: var(--guide-ellipse); }
.crop-guide line    { stroke: var(--guide-line); }

@keyframes loading-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ============================================================
   テーマ切り替えボタン（ヘッダー内）
   ============================================================ */
/* 終了ボタンと同じ理由で、白の半透明ではなく文字色から作る */
.dl-theme-btn {
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: 5px 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: inherit;
    opacity: .85;
    transition: background .15s, opacity .15s;
    margin-left: 8px;
}
.dl-theme-btn:hover  { background: rgba(127,127,127,.18); opacity: 1; }
.dl-theme-btn svg { display: block; }

/* ログアウト（終了）ボタン（ヘッダー内） */
/* 白い半透明で作ると、ヘッダー背景を白にした屋号で枠も文字も消える。
   文字色（currentColor）から作ることで、濃い背景でも白い背景でも読める */
.dl-logout-btn {
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: .78rem;
    color: inherit;
    opacity: .85;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    margin-left: 8px;
}
.dl-logout-btn:hover { background: rgba(127,127,127,.18); opacity: 1; }
.dl-logout-btn svg   { display: block; flex-shrink: 0; }

/* ============================================================
   テーマ: 高コントラスト (theme-hc)  暗背景・黄色ガイド
   ============================================================ */
body.theme-hc {
    --primary:      #60a5fa;
    --text:         #f9fafb;
    --text-sub:     #9ca3af;
    --border:       #374151;
    --error:        #fca5a5;
    --error-bg:     #3b1515;
    --bg:           #111827;
    --guide-ellipse: rgba(253,224,71,.9);
    --guide-line:    rgba(253,224,71,.55);
}
body.theme-hc .dl-header              { background: #0f172a; }
body.theme-hc .portrait-ctrl         { background: #1f2937; }
body.theme-hc .ctrl-btn              { background: #374151; color: #f9fafb; border-color: #4b5563; }
body.theme-hc .ctrl-btn:hover        { background: #4b5563; }
body.theme-hc .ctrl-btn:active       { background: #6b7280; }
body.theme-hc .ctrl-reset-btn        { background: #3b1515; border-color: #f87171; color: #fca5a5; }
body.theme-hc .ctrl-reset-btn:hover  { background: #4c1c1c; }
body.theme-hc .crop-container        { border-color: #60a5fa; background: #374151; }
body.theme-hc .crop-loading          { background: linear-gradient(90deg,rgba(31,41,55,1) 25%,rgba(55,65,81,1) 50%,rgba(31,41,55,1) 75%); background-size: 200% 100%; }
body.theme-hc .crop-loading-text     { color: #9ca3af; }
body.theme-hc .portrait-size-select  { background: #1f2937; color: #f9fafb; border-color: #4b5563; }
body.theme-hc .portrait-size-label   { color: #9ca3af; }
body.theme-hc .portrait-dl-btn       { background: #2563eb; }
body.theme-hc .portrait-dl-btn:hover { background: #3b82f6; }
body.theme-hc .portrait-api-warn     { background: #422006; border-color: #d97706; color: #fde68a; }
body.theme-hc .snap-card             { background: #1f2937; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
body.theme-hc .snap-thumb-wrap       { background: #374151; }
body.theme-hc .snap-card-foot        { border-color: #374151; }
body.theme-hc .btn-dl-single         { background: #1e3a5f; color: #93c5fd; }
body.theme-hc .btn-dl-single:hover   { background: #1e4a7a; }

/* ============================================================
   テーマ: カラーバリアフリー (theme-cb)  青・アンバー基調 赤緑不使用
   ============================================================ */
body.theme-cb {
    --primary:      #0050c8;
    --text:         #111827;
    --text-sub:     #4b5563;
    --border:       #c0cde8;
    --error:        #c05000;
    --error-bg:     #fff4e6;
    --bg:           #f0f5ff;
    --guide-ellipse: rgba(0,80,200,.75);
    --guide-line:    rgba(0,80,200,.4);
}
body.theme-cb .dl-header              { background: #003090; }
body.theme-cb .ctrl-btn:hover         { background: #dde8ff; }
body.theme-cb .ctrl-btn:active        { background: #b8ccff; }
body.theme-cb .ctrl-reset-btn         { background: #fff4e6; border-color: #f97316; color: #c05000; }
body.theme-cb .ctrl-reset-btn:hover   { background: #ffedd5; }
body.theme-cb .crop-container         { border-color: #0050c8; }
body.theme-cb .portrait-dl-btn        { background: #0050c8; }
body.theme-cb .portrait-dl-btn:hover  { background: #003ba3; }
body.theme-cb .portrait-api-warn      { background: #fff4e6; border-color: #f97316; color: #c05000; }
body.theme-cb .btn-dl-single          { background: #e8efff; color: #0050c8; }
body.theme-cb .btn-dl-single:hover    { background: #c8d8ff; }

/* スマホ対応 */
@media (max-width: 600px) {
    .snap-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .lb-nav { display: none; }
}

/* ============================================================
   写真選択画面
   ============================================================ */

/* 選択枚数指示バー（sticky） */
.sel-instruction-bar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #1a6fcf;
    color: #fff;
    text-align: center;
    padding: 18px 24px;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: .06em;
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
    line-height: 1.2;
}

/* プレビュー通知バー */
.sel-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fffbeb;
    border-bottom: 1px solid #f6cc52;
    color: #92600a;
    font-size: .82rem;
    padding: 8px 20px;
}

/* フラッシュメッセージ */
.sel-flash {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 6px;
    color: #276749;
    font-size: .88rem;
    padding: 10px 14px;
    margin-bottom: 20px;
}

/* 選択枚数情報 */
.sel-count-info {
    text-align: right;
}
.sel-count-label {
    font-size: .85rem;
    color: var(--text-sub);
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    white-space: nowrap;
}

/* カード選択状態 */
.sel-card {
    cursor: pointer;
    transition: box-shadow .15s, transform .12s;
    outline: none;
    border: 2px solid transparent;
    border-radius: 8px;
}
.sel-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.16);
    transform: translateY(-2px);
}
.sel-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
.sel-card.sel-chosen {
    border-color: #38a169;
    box-shadow: 0 0 0 2px rgba(56,161,105,.25);
}

/* チェックオーバーレイ */
.sel-thumb-area {
    position: relative;
    aspect-ratio: unset;
    overflow: visible;
}
.sel-thumb-area .snap-thumb {
    height: auto;
    object-fit: contain;
}
.sel-check-overlay {
    position: absolute;
    inset: 0;
    background: rgba(56,161,105,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}
.sel-check-overlay svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}
.sel-card.sel-chosen .sel-check-overlay {
    opacity: 1;
}

/* 選択中バッジ（カードフッター） */
.sel-chosen-badge {
    font-size: .75rem;
    font-weight: 700;
    color: #2f855a;
    background: #c6f6d5;
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s;
}
.sel-card.sel-chosen .sel-chosen-badge {
    opacity: 1;
}

/* 固定下部の確定バー */
.sel-submit-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    z-index: 500;
}
.sel-submit-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sel-submit-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.sel-submit-hint {
    font-size: .8rem;
    color: var(--text-sub);
    transition: color .15s;
}
.btn-sel-submit {
    padding: 12px 28px;
    background: #38a169;
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, opacity .15s;
    flex-shrink: 0;
}
.btn-sel-submit:hover:not(:disabled) {
    background: #2f855a;
}
.btn-sel-submit:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .sel-submit-bar {
        padding: 10px 16px;
    }
    .btn-sel-submit {
        padding: 10px 18px;
        font-size: .88rem;
    }
}

/* カード内ズームボタン（選択画面） */
.sel-zoom-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,.52);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
    padding: 0;
    flex-shrink: 0;
}
.sel-zoom-btn svg { width: 18px; height: 18px; stroke: #fff; pointer-events: none; }
.sel-card:hover .sel-zoom-btn { opacity: 1; }
/* 個人写真選択：クロップ表示で全体が見えないため常時表示 */
.port-sel-card .sel-zoom-btn { opacity: 1; }

/* ライトボックス ルーペ（虫眼鏡） */
.lb-loupe {
    position: fixed;
    width: 440px;
    height: 440px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.75);
    box-shadow: 0 4px 24px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.15);
    pointer-events: none;
    display: none;
    z-index: 9999;
    background-repeat: no-repeat;
    overflow: hidden;
}
/* ルーペ使用中はカーソル非表示 */
.lb-img.loupe-active { cursor: none; }

/* ライトボックスのフッター（ルーペヒント） */
.lb-loupe-hint {
    font-size: .75rem;
    color: rgba(255,255,255,.4);
    white-space: nowrap;
}
@media (pointer: coarse) {
    .lb-loupe-hint { display: none; }
}

/* ============================================================
   個人写真選択モード：顔検出クロッププレビュー
   ============================================================ */

/* 個人写真選択：縦長比率はクロップフレーム自身が持つ（親は高さ固定しない） */
.port-sel-card .sel-thumb-area {
    overflow: visible;
}

/* スナップ選択：横長比率に固定 */
.snap-sel-card .sel-thumb-area {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.snap-sel-card .sel-thumb-area .snap-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* スナップ選択：ズームボタン常時表示 */
.snap-sel-card .sel-zoom-btn {
    opacity: 1;
}

/* クロップフレーム */
.port-crop-frame {
    width: 100%;
    aspect-ratio: 3 / 4;
    position: relative;
    overflow: hidden;
    cursor: grab;
    background: #d8dde4;
    /* 指を置いただけでは動かさず、縦スクロールはブラウザに任せる。
       長押しで動かせるようになったときだけ none にする（.is-dragmove） */
    touch-action: pan-y;
    -webkit-touch-callout: none;   /* 長押しで画像の保存メニューを出さない */
    -webkit-user-select: none;
    user-select: none;
}
.port-crop-frame:active {
    cursor: grabbing;
}
/* 長押しで「動かせる状態」になったとき */
.port-crop-frame.is-dragmove {
    touch-action: none;
    cursor: grabbing;
    box-shadow: inset 0 0 0 3px #1a6fcf;
}

/* 画像：絶対配置でJS制御 */
.port-crop-img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    pointer-events: none;
    display: block;
    will-change: transform;
}

/* Loading オーバーレイ（顔検出完了まで表示） */
.port-crop-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d0d5db;
    z-index: 3;
}
.port-crop-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: portCropSpin .75s linear infinite;
}
@keyframes portCropSpin { to { transform: rotate(360deg); } }

/* テザー：別の写真を選ぶボタン */
.tether-reselect-btn {
    display: inline-block;
    margin-top: 6px;
    font-size: .82rem;
    color: #4a9d8f;
    text-decoration: none;
}
.tether-reselect-btn:hover {
    text-decoration: underline;
}

/* テザー選択：サムネイルローディング */
/* ローディング中は縦長比率（3:4）でボックス高さを確保してレイアウトジャンプを防ぐ */
.sel-thumb-area.thumb-loading {
    aspect-ratio: 3 / 4;
}
.thumb-loading .snap-thumb {
    opacity: 0;
}
.snap-thumb {
    transition: opacity .3s;
}
.thumb-spinner {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0,0,0,.1);
    border-top-color: #4a9d8f;
    border-radius: 50%;
    animation: thumb-spin .7s linear infinite;
}
.thumb-loading .thumb-spinner {
    display: block;
}
@keyframes thumb-spin {
    to { transform: rotate(360deg); }
}

/* ── データ受領 / 納品ダウンロード 共通 ──────────── */
.rcv-head { margin-bottom: 20px; }
.rcv-title { font-size: 1.2rem; font-weight: 700; color: #1a202c; margin: 0 0 5px; }
.rcv-project { font-size: .95rem; color: #4a5568; margin: 0 0 3px; }
.rcv-cap { font-size: .82rem; color: #718096; margin: 0; }

/* ドロップゾーン */
.rcv-drop-zone {
    border: 2px dashed #b2c4e0;
    border-radius: 12px;
    padding: 28px 24px 24px;
    text-align: center;
    background: #f7fbff;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    margin-bottom: 0;
}
.rcv-drop-zone.over { border-color: #4a9d8f; background: #f0faf9; }
.rcv-drop-icon { margin-bottom: 10px; color: #6b9fb8; }
.rcv-drop-label { font-size: .95rem; color: #4a5568; margin: 0 0 5px; }
.rcv-drop-or { font-size: .8rem; color: #a0aec0; margin: 0 0 10px; }
.rcv-file-btn {
    display: inline-block;
    padding: 7px 18px;
    background: #4a9d8f;
    color: #fff;
    border-radius: 6px;
    font-size: .88rem;
    cursor: pointer;
    transition: opacity .15s;
}
.rcv-file-btn:hover { opacity: .85; }

/* 選択後の警告 */
/* ドロップ時容量超過エラー */
.rcv-drop-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 16px 18px;
    background: #fff5f5;
    border: 2px solid #fc8181;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #c53030;
    line-height: 1.5;
}

.rcv-pending-warn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .83rem;
    color: #744210;
    background: #fefcbf;
    border: 1px solid #f6e05e;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 14px 0 12px;
}

/* 容量インジケーター */
.rcv-cap-bar-wrap {
    margin: 0 0 12px;
}
.rcv-cap-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
    font-size: .8rem;
    color: #718096;
}
.rcv-cap-bar-label { font-weight: 600; }
.rcv-cap-bar-track {
    height: 7px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.rcv-cap-bar-fill {
    height: 100%;
    background: #4a9d8f;
    border-radius: 4px;
    transition: width .25s, background .25s;
}
.rcv-cap-bar-over {
    margin-top: 5px;
    font-size: .8rem;
    color: #c53030;
    font-weight: 600;
}

/* ファイルカードグリッド */
.rcv-pending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 10px;
    margin-bottom: 4px;
}
.rcv-card {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.rcv-card-thumb {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rcv-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.rcv-card-icon-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rcv-card-icon-wrap.rcv-card-loading { background: #f7fafc; }
.rcv-card-ext {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .06em;
}
.rcv-card-spinner {
    width: 24px; height: 24px;
    border: 3px solid rgba(0,0,0,.1);
    border-top-color: #4a9d8f;
    border-radius: 50%;
    animation: thumb-spin .7s linear infinite;
}
.rcv-card-foot {
    padding: 6px 8px 7px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.rcv-card-dir {
    font-size: .7rem;
    color: #a0aec0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcv-card-name {
    font-size: .8rem;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcv-card-size {
    font-size: .72rem;
    color: #a0aec0;
}
.rcv-card-remove {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,.45);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: .85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
}
.rcv-card:hover .rcv-card-remove { opacity: 1; }
.rcv-card-remove:hover { background: rgba(197,48,48,.85); }

/* アップロードボタン */
.rcv-upload-btn {
    padding: 10px 36px;
    background: #2b6cb0;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.rcv-upload-btn:hover:not(:disabled) { opacity: .85; }
.rcv-upload-btn:disabled { background: #a0aec0; cursor: default; }

/* プログレス */
/* アップロード進捗モーダル */
.rcv-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rcv-modal {
    background: #fff;
    border-radius: 14px;
    padding: 28px 28px 24px;
    width: min(460px, calc(100vw - 32px));
    box-shadow: 0 12px 48px rgba(0,0,0,.28);
}
.rcv-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 14px;
}
.rcv-progress-file {
    font-size: .85rem;
    color: #4a5568;
    margin: 0 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcv-progress-wrap {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.rcv-progress-bar {
    height: 100%;
    background: #4a9d8f;
    transition: width .15s;
    width: 0%;
}
.rcv-progress-count {
    font-size: .82rem;
    color: #718096;
    margin: 6px 0 0;
    text-align: right;
}
.rcv-modal-done-icon {
    text-align: center;
    margin-bottom: 12px;
}
.rcv-modal-done-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2d3748;
    text-align: center;
    margin: 0 0 4px;
}
.rcv-modal-done-sub {
    font-size: .85rem;
    color: #718096;
    text-align: center;
    margin: 0 0 8px;
}
.rcv-modal-done-errors {
    font-size: .82rem;
    color: #c53030;
    white-space: pre-wrap;
    margin: 10px 0 0;
    max-height: 120px;
    overflow-y: auto;
    background: #fff5f5;
    border-radius: 6px;
    padding: 8px 10px;
}
.rcv-modal-done-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
}
.rcv-modal-btn {
    display: block;
    text-align: center;
    border-radius: 8px;
    padding: 13px 16px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: opacity .15s;
    line-height: 1;
}
.rcv-modal-btn:hover { opacity: .82; }
.rcv-modal-btn-more {
    background: #edf2f7;
    color: #2d3748;
}
.rcv-modal-btn-exit {
    background: #1a6fcf;
    color: #fff;
}

/* アップロード済みファイルリスト */
.rcv-existing { margin-top: 28px; border-top: 1px solid #e2e8f0; padding-top: 18px; }
.rcv-existing-title { font-size: .92rem; font-weight: 600; color: #4a5568; margin: 0 0 10px; }
.rcv-file-list {
    list-style: none; padding: 0; margin: 0;
    border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.rcv-file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 13px;
    border-top: 1px solid #f0f4f8;
    font-size: .85rem;
}
.rcv-file-item:first-child { border-top: none; }
.rcv-file-icon { width: 15px; height: 15px; flex-shrink: 0; color: #a0aec0; }
.rcv-file-name {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #2d3748;
}
.rcv-file-meta { font-size: .78rem; color: #a0aec0; white-space: nowrap; flex-shrink: 0; }

/* 個別ダウンロードリンク */
.rcv-dl-link {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px; background: #ebf8ff; color: #2b6cb0;
    border-radius: 4px; font-size: .78rem; text-decoration: none;
    flex-shrink: 0; transition: background .15s;
}
.rcv-dl-link:hover { background: #bee3f8; }

/* ZIP一括DLボタン */
.tdl-zip-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 28px; background: #2b6cb0; color: #fff;
    border-radius: 8px; font-size: .95rem; font-weight: 600;
    text-decoration: none; transition: opacity .15s;
}
.tdl-zip-btn:hover { opacity: .85; }

/* ─── PC/スマホ 文言出し分け ─── */
.pc-only { display: inline; }
.sp-only { display: none; }
@media (max-width: 600px) {
    .pc-only { display: none; }
    .sp-only { display: inline; }
}

/* ZIP一括ダウンロード不可の案内 */
.tdl-zip-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #fffaf0;
    border: 1px solid #f6ad55;
    border-radius: 10px;
    text-align: left;
}
.tdl-zip-notice-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #dd6b20;
    margin-top: 1px;
}
.tdl-zip-notice strong {
    display: block;
    font-size: .92rem;
    color: #9c4221;
    margin-bottom: 4px;
}
.tdl-zip-notice p {
    font-size: .85rem;
    color: #7b341e;
    line-height: 1.7;
    margin: 0;
}

/* アップロード先フォルダ選択（データ受領） */
.rcv-folder-box {
    background: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
}
.rcv-folder-label {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
}
.rcv-folder-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: #fff;
    color: #2d3748;
}
.rcv-folder-note {
    font-size: .78rem;
    color: #718096;
    margin: 8px 0 0;
    line-height: 1.6;
}

/* データ受領：アップロード済み一覧のサムネイル＋タイル切替 */
.rcv-existing-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.rcv-existing-head .rcv-existing-title { margin: 0; }
.view-toggle {
    display: flex;
    margin-left: auto;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    overflow: hidden;
}
.view-toggle-btn {
    background: #fff;
    border: none;
    padding: 5px 12px;
    font-size: .78rem;
    color: #4a5568;
    cursor: pointer;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid #cbd5e0; }
.view-toggle-btn.is-active { background: #4a9d8f; color: #fff; }

.rcv-file-thumb {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rcv-file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcv-file-thumb .rcv-file-icon { display: none; width: 18px; height: 18px; color: #a0aec0; }
.rcv-file-thumb:not(:has(img)) .rcv-file-icon,
.rcv-file-thumb.is-noimg .rcv-file-icon { display: block; }
.rcv-file-thumb.is-noimg img { display: none; }

/* タイル表示 */
.rcv-file-list.view-tile {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
}
.rcv-file-list.view-tile .rcv-file-item {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.rcv-file-list.view-tile .rcv-file-thumb {
    width: 100%;
    height: 88px;
    border-radius: 6px;
}
.rcv-file-list.view-tile .rcv-file-name {
    font-size: .72rem;
    word-break: break-all;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
}
.rcv-file-list.view-tile .rcv-file-meta { font-size: .68rem; }

/* ------------------------------------------------------------
   確認モーダル（js/ui_confirm.js が生成する）
   管理画面と同じ部品をお客様画面でも使うため、必要なクラスだけ定義する
   ------------------------------------------------------------ */
.ui-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ui-modal-overlay.is-open { display: flex; }
.ui-modal-box {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    width: 420px;
    max-width: 100%;
}
.ui-modal-title { font-weight: 700; font-size: 1.02rem; margin-bottom: 12px; }
.ui-confirm-msg { font-size: .92rem; line-height: 1.9; margin-bottom: 6px; }
.ui-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.ui-modal-actions .btn {
    padding: 9px 18px;
    font-size: .9rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
}
.ui-modal-actions .btn-secondary { background: #edf2f7; color: #4a5568; border-color: #e2e8f0; }
.ui-modal-actions .btn-primary   { background: #2b6cb0; color: #fff; border-color: #2b6cb0; }
.ui-modal-actions .btn-danger    { background: #c53030; color: #fff; border-color: #c53030; }
