/* base.css */

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    background-image: 
        linear-gradient(135deg, #D9F2FF 0%, #D0E8F5 33%, #786988 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial,
        "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

/* ==========================================
   共通コンポーネント：ボタンアセット
   ========================================== */
/* 全ボタン共通のベースクラス */
.btn-global {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.15s ease;
    font-size: 15px;
    text-decoration: none;
}
.btn-global > i {
    width: 1em;
    text-align: center;
}
.btn-global:hover,
.btn-global:focus,
.btn-global:active {
    text-decoration: none;
}

/* 確定・実行（プライマリメイン） */
.btn-sys-primary {
    background-color: #322152;
    color: #ffffff;
    padding: 12px 36px;
    font-weight: bold;
}
@media (hover: hover) and (pointer: fine) {
    .btn-sys-primary:hover {
        background-color: #6d28d9;
    }
}

/* キャンセル・破棄（セカンダリサブ） */
.btn-sys-secondary {
    background-color: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 12px 28px;
    font-weight: 500;
    min-width: 110px;
}
@media (hover: hover) and (pointer: fine) {
    .btn-sys-secondary:hover {
        background-color: #f8fafc;
    }
}

/* 危険操作（削除など不可逆な確認用） */
.btn-sys-danger {
    background-color: #ef4444;
    color: #ffffff;
    padding: 12px 36px;
    font-weight: bold;
}
@media (hover: hover) and (pointer: fine) {
    .btn-sys-danger:hover {
        background-color: #dc2626;
    }
}
.btn-sys-danger:disabled {
    background-color: #f1f5f9 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

/* ==========================================
   共通コンポーネント：グローバルモーダル基盤
   ========================================== */
.modal-root-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-root-overlay.active {
    display: flex;
}
.modal-root-overlay.layer-z-top {
    z-index: 2000;
}

.modal-viewport {
    background-color: #ffffff;
    border-radius: 24px;
    padding: 35px 40px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
    width: 92%;
    box-sizing: border-box;
    max-height: 88vh;
    max-height: 88dvh;
}

/* 本文が長くなりうるモーダル(詳細情報等)は、ヘッダー/フッターを固定し中身だけスクロールさせる。
   size-lgは常時この構造。他サイズも .modal-scrollable を付ければ同じ挙動を再利用できる */
.modal-viewport.size-lg,
.modal-viewport.modal-scrollable {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-viewport.size-lg .detail-list,
.modal-viewport.size-lg .modal-scroll-body,
.modal-viewport.modal-scrollable .detail-list,
.modal-viewport.modal-scrollable .modal-scroll-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.modal-viewport.size-lg .modal-footer-action-align,
.modal-viewport.modal-scrollable .modal-footer-action-align {
    flex-shrink: 0;
}
.modal-viewport.size-lg .modal-main-header,
.modal-viewport.size-lg .modal-sub-header,
.modal-viewport.size-lg .detail-header-row,
.modal-viewport.modal-scrollable .modal-main-header,
.modal-viewport.modal-scrollable .modal-sub-header,
.modal-viewport.modal-scrollable .detail-header-row {
    flex-shrink: 0;
}
.modal-viewport.modal-scrollable {
    max-height: 88vh;
}
.modal-viewport.modal-scrollable form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}
.modal-viewport.size-sm { max-width: 540px; }
.modal-viewport.size-lg { max-width: 820px; }
.modal-viewport.size-preview-frame, 
.modal-viewport.size-cropper-frame {
    max-width: 900px;
    padding: 20px;
}

.preview-modal-top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.preview-target-filename {
    font-weight: 600;
    color: #2d3748;
}

.modal-main-header {
    text-align: center;
    color: #322152;
    font-size: 28px;
    margin: 0 0 8px 0;
    font-weight: 600;
    word-break: break-word;
    overflow-wrap: break-word;
}

.modal-sub-header {
    text-align: center;
    color: #718096;
    font-size: 14px;
    margin-bottom: 25px;
}

.btn-circle-close-x {
    background-color: #322152;
    color: #ffffff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   モーダルフッター・レイアウト制御基盤
   ========================================== */
.modal-footer-action-align {
    display: flex;
    justify-content: center;
    margin-top: 25px;
    width: 100%;
}

/* 【追加】ボタンが1つだけの場合は自動的に幅いっぱいに拡張する */
.modal-footer-action-align > button:only-child {
    max-width: 100% !important;
    width: 100% !important;
    flex: none; /* flexによる伸縮を解除して100%を適用 */
}

/* 2分割レイアウト用の構造 */
.modal-footer-action-align.split-button-layout {
    justify-content: center;
    gap: 12px;
}

.modal-footer-action-align.split-button-layout .btn-sys-secondary,
.modal-footer-action-align.split-button-layout .btn-sys-primary {
    flex: 1;
    /* max-width: 160px; による横幅の制限を解除 */
    max-width: none; 
    min-width: 0;
    text-align: center;
}

.toast-hidden {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #007d32;
    font-weight: bold;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 9999;
    pointer-events: none;
}
.toast-show { 
    opacity: 1; 
}
.error-message {
    color: #e53935;
    font-size: 11px;
    margin-top: 6px;
    padding: 4px 8px;
    background-color: #fff5f5;
    border-left: 3px solid #e53935;
    border-radius: 2px;
}

/* base.css */

/* 通常時は「保存」と「キャンセル」を非表示にする */
.profile-item-row .btn-trigger-save,
.profile-item-row .btn-trigger-cancel {
    display: none !important;
}

/* 編集時は「編集」ボタンを隠し、「保存」「キャンセル」を表示 */
.profile-item-row.is-editing .btn-trigger-edit {
    display: none !important;
}

.profile-item-row.is-editing .btn-trigger-save,
.profile-item-row.is-editing .btn-trigger-cancel {
    display: inline-block !important;
}

/* キャンセルボタンのスタイル定義 */
.btn-profile-action-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    margin-right: 8px !important;
}

/* モーダル内フォーム要素・メッセージの共通クラス（重複インラインstyleの受け皿） */
.form-error-text {
    color: #ff0000;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.upload-summary-text {
    color: #64748b;
    font-size: 13px;
    margin-top: 8px;
}

.static-desc-box {
    padding: 12px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
}

.static-desc-box.tall {
    min-height: 120px;
    white-space: pre-wrap;
    word-break: break-all;
    color: #b91c1c;
    background-color: #fff7f7;
    border-color: #fca5a5;
}

.btn-full-width {
    width: 100%;
}

.fullscreen-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* ==========================================
   フルサイズプレビュー：ライトボックス風全画面表示
   ========================================== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    cursor: zoom-out;
}
.lightbox-overlay.active {
    display: flex;
}
.lightbox-image {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}
.lightbox-close-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    z-index: 2501;
}
.lightbox-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.22);
}
.lightbox-filename {
    position: fixed;
    top: 22px;
    left: 90px;
    right: 24px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    white-space: normal;
    word-break: break-all;
    z-index: 2501;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

@media (max-width: 800px) {
    .lightbox-filename {
        top: 26px;
        left: 64px;
        font-size: 13px;
    }
}

/* プレビュー表示中は背後のページスクロールを止める */
body.lightbox-open {
    overflow: hidden;
}

@media (max-width: 800px) {
    .lightbox-close-btn {
        top: 16px;
        left: 16px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .lightbox-image {
        max-width: 94vw;
        max-height: 60vh;
    }
}
/* 管理者バッジ */
.app-name-admin-pill {
    font-size: 10px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    color: #64748b;
    font-weight: bold;
    vertical-align: middle;
}

@media (max-width: 800px) {
    .modal-viewport {
        padding: 25px 20px;
        border-radius: 16px;
        max-height: 85vh;
        max-height: 85dvh;
        overflow-y: auto;
    }
    
    .modal-viewport.size-preview-frame, 
    .modal-viewport.size-cropper-frame {
        padding: 12px;
    }
    .modal-footer-action-align.split-button-layout {
        flex-direction: row !important;
        gap: 12px !important;
        width: 100% !important;
    }
    .modal-footer-action-align.split-button-layout button {
        flex: 1 !important;
        max-width: none !important;
        width: 100% !important;
        white-space: nowrap;
        font-size: 14px;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    /* .card-thumbnail-box のモバイルサイズは analysis.css 側の定義（64px）が実際に適用されており、
       このルールは常に上書きされ効果を持たない死んだ定義だったため削除。
       サイズ変更は analysis.css の --thumb-size-mobile 参照箇所で行う。 */

    /* カードの中身が溢れないようにする */
    .card-info-content {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0; /* これでテキストの溢れを防ぐ */
        flex: 1;
    }
}

/* ==========================================
   コンポーネント：インラインアラート（Bootstrap風）
   ========================================== */
.alert-inline {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    width: 100%;
}

/* 成功・通知（success）用の配色 */
.alert-inline.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* アイコンとコンテンツのレイアウト */
.alert-inline .alert-icon {
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-inline .alert-content {
    font-weight: 500;
    flex: 1;
}

/* 汎用エラー（error/danger）用の配色も備えておく場合 */
.alert-inline.alert-error,
.alert-inline.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
/* 長い名前がセル・カードから溢れて横スクロールの原因になっていたため、
   PC/モバイル問わずここで一律に省略表示を強制する。
   親がflexの場合、子がmin-width:0でないと省略が効かないため、
   使用箇所側（.admin-user-cell等）にもmin-width:0の対応が必要 */
.admin-user-name,
.user-name-label {
    color: var(--c-primary, #322152);
    display: inline-block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* 変更後 */
.btn-gradient-accent {
    background: linear-gradient(135deg, #F4A261 0%, #e8935a 100%);
    color: #322152;
    box-shadow: 0 4px 14px rgba(244, 162, 97, 0.35);
    border: none;
    cursor: pointer;
    transition: color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .btn-gradient-accent:hover {
        background: #322152;
        color: #ffffff;
        box-shadow: 0 6px 18px rgba(50, 33, 82, 0.4);
        transform: translateY(-1px);
    }
}

/* 変更後 */
.btn-primary-purple.accent {
    background: linear-gradient(135deg, #F4A261 0%, #e8935a 100%);
    color: #322152;
    box-shadow: 0 4px 14px rgba(244, 162, 97, 0.35);
    transition: color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    border: none;
}

.btn-primary-purple.accent:hover {
    background: #322152;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(50, 33, 82, 0.4);
    transform: translateY(-1px);
    border: none;
}

.btn-primary-purple.accent:active {
    transform: translateY(0);
}

/* btn-global 系のボタンにもアンバーの見た目を適用したい場合の共通クラス。
   .btn-sys-primary の紫を上書きせず、.btn-accent-amber を追加で付けたボタンだけ
   アンバーになるようにする（他の紫ボタンへの影響を避けるため）。 */
.btn-global.btn-accent-amber {
    background: linear-gradient(135deg, #F4A261 0%, #e8935a 100%) !important;
    color: #322152 !important;
    box-shadow: 0 4px 14px rgba(244, 162, 97, 0.35);
    transition: color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}
.btn-global.btn-accent-amber:hover {
    background: #322152 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(50, 33, 82, 0.4);
    transform: translateY(-1px);
}
.btn-global.btn-accent-amber:active {
    transform: translateY(0);
}


/* ==========================================================================
   共通コンポーネント：リアルタイム文字数バリデーション（フォーム全般で共用）
   ========================================================================== */
.realtime-length-error {
    color: #e53935;
    font-size: 12px;
    margin: 6px 0 0 0;
}
.login-button:disabled,
.btn-form-primary-action:disabled,
.btn-trigger-save:disabled,
button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 危険操作用モーダル（削除確認など） */
.modal-viewport.modal-danger {
    border-top-color: #ef4444;
}
.modal-viewport.modal-danger .modal-main-header {
    color: #b91c1c;
}
.modal-viewport.modal-danger .modal-main-header::before {
    content: "\f071";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 10px;
    color: #ef4444;
}

/* ==========================================
   共通コンポーネント：フォントサイズスケール
   ========================================== */
:root {
    --font-xs: 11px;   /* 極小ラベル・補足（日時のサブテキスト等） */
    --font-sm: 12px;   /* 補足・メタ情報（ファイルサイズ、metaラベル等） */
    --font-base: 13px; /* テーブル本文・pill・ボタンの標準 */
    --font-md: 14px;   /* 強調本文（ファイル名等） */
    --font-lg: 16px;   /* セクション見出し級 */

    --icon-sm: 14px;   /* トグル矢印など補助的な小アイコン */
    --icon-md: 18px;   /* ナビゲーション・ボタン内アイコンの標準 */
    --icon-lg: 24px;   /* 見出し横・強調アクションのアイコン */

    /* カラートークン（紫の役割分担を固定） */
    --c-primary:       #322152;  /* 塗り・主ボタン・通常文字 */
    --c-primary-hover: #6d28d9;
    --c-accent:        #6d28d9;  /* アクセントライン・フォーカス */
    --c-accent-strong: #6d28d9;  /* リンク/identityのhover */
    --c-accent-tint:   #faf8ff;  /* 淡い紫の背景（サイドバー・ホバー等の面塗り用） */
    --c-accent-border: #e4d9f7;  /* 淡い紫の枠線（--c-accent-tintと対になるボーダー） */
    --c-danger:        #e53935;  /* エラー文字色（全画面共通） */

    /* サムネイルボックスのサイズトークン（PC/モバイル/子カードで散在していたサイズを一元管理） */
    --thumb-size-pc: 64px;
    --thumb-size-mobile: 64px;
    --thumb-size-mobile-child: 52px;
}
/* ==========================================
   共通：プレビュー起動要素のホバー演出（虫眼鏡）
   .preview-trigger を持つサムネ/アバターで全画面共通
   ========================================== */
.preview-trigger {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
    .preview-trigger:not(.multiple-stack):hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(50, 33, 82, 0.15);
    }
    .preview-trigger:not(.multiple-stack):hover::after {
        opacity: 1;
    }
}
.preview-trigger:not(.multiple-stack)::after {
    content: "\f00e";
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif;
    font-weight: 900;
    font-size: 16px;
    color: #ffffff;
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* ==========================================
   共通コンポーネント：アイコンボタン（削除・中断系）
   ========================================== */
.btn-danger-icon {
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
    padding: 0;
    font-size: 20px;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
    .btn-danger-icon:hover {
        background-color: #dc2626;
        transform: scale(1.06);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    }
}
.btn-danger-icon:active {
    transform: scale(0.94);
}

/* 一覧テーブル内の「一覧アクション系」小型プライマリボタン（詳細へ/再解析 等） */
.btn-sys-primary.compact {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

/* 「詳細へ」ボタン共通スタイル（PC/モバイル問わず同一デザイン・同一ラベルに統一） */
.btn-detail-link {
    padding: 8px 20px;
    font-size: 13px;
    border-radius: 6px;
    text-decoration: none;
}
/* ==========================================
   共通：遷移するユーザーIDリンク（ヘッダ・管理一覧で共有）
   リンク内どこをホバーしても name+avatar 両方強調／クリックで遷移
   ========================================== */
/* 長いテキストを1行で省略表示する共通ユーティリティ。max-widthは利用箇所ごとに上書きする */
.text-ellipsis-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: bottom;
}

.identity-link { text-decoration: none; color: inherit; }
.identity-name { color: var(--c-primary, #322152); }
.identity-avatar { transition: box-shadow 0.15s ease; }
.identity-link:hover .identity-name {
    color: var(--c-accent-strong, #6d28d9);
    text-decoration: underline;
}
.identity-link:hover .identity-avatar {
    box-shadow: 0 0 0 2px var(--c-accent-strong, #6d28d9);
}

/* ==========================================
   共通コンポーネント：アバター（サイズバリエーション）
   ========================================== */
.avatar-common {
    border-radius: 50%;
    overflow: hidden;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.avatar-common img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-size-sm { width: 36px; height: 36px; }
.avatar-size-md { width: 48px; height: 48px; }
.avatar-size-lg { width: 60px; height: 60px; }
.avatar-size-xl { width: 96px; height: 96px; }
.avatar-ring {
    box-shadow: 0 0 0 3px #ffffff, 0 0 10px rgba(50, 33, 82, 0.35);
}

/* ==========================================
   共通：属性ラベルバッジ（クリック不可の状態/属性表示）
   ※解析ステータスは .status-pill-solid を使う。役割で系統を分ける
   ========================================== */
.badge-neutral,
.badge-admin,
.badge-danger {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: var(--font-sm, 12px);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid transparent;
    line-height: 1.4;
}
.badge-neutral { background-color: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.badge-admin   { background-color: #e6f9ed; color: #1f9254; border-color: #1f9254; }
.badge-danger  { background-color: #ffebee; color: #e53935; border-color: #e53935; }

/* ==========================================
   共通：モバイルカードのサムネイル画像フィット
   （analysis.html / admin_analysis_status_list.html 双方の
    .card-thumbnail-box 内 img に共通適用）
   ========================================== */
.card-thumbnail-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* モバイルカード共通：右上の「…」メニューとファイル名が重ならないよう余白を確保 */
.mobile-card-view .card-filename-text {
    padding-right: 44px;
    box-sizing: border-box;
}

/* バッチ（セッション）ヘッダーのみ、点々メニューと横並びではなく別行にレイアウトされているため
   右側の余白は不要 */
.mobile-batch-header .card-filename-text {
    padding-right: 0;
}

/* ==========================================
   共通コンポーネント：Empty State（データ空枠表示）
   ========================================== */
.empty-state-container {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.empty-state-icon {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
    display: block;
}

.empty-state-text {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

/* Empty State を全幅表示するための共通ラッパー（インラインstyle/個別クラスの重複を統一） */
.empty-state-full-span {
    grid-column: 1 / -1;
    width: 100%;
}

/* ==========================================
   共通コンポーネント：ページヘッダーカード（page_header_card.html用）
   元は同テンプレート内に<style>としてインライン記述されていたものを移設。
   ========================================== */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: var(--font-sm, 12px);
    color: #94a3b8;
    margin-bottom: 10px;
    padding: 0 4px;
}

.breadcrumb-nav a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-nav a:hover {
    color: #6d28d9;
    text-decoration: underline;
}

.breadcrumb-nav .breadcrumb-current {
    color: #322152;
    font-weight: 600;
}

.breadcrumb-nav .breadcrumb-sep {
    color: #cbd5e1;
}

.shared-page-header-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    border-top: 3px solid #6d28d9;
    margin-bottom: 12px;
}

.header-title-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
}

.header-title-inner i {
    font-size: 28px;
    color: #322152;
}

.header-title-inner .page-heading {
    font-size: 28px;
    font-weight: 700;
    color: #322152;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    text-align: left;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

.header-action-side {
    display: flex;
    align-items: center;
}

@media (max-width: 800px) {
    .breadcrumb-nav {
        font-size: 11px;
        justify-content: center;
    }

    .shared-page-header-card {
        flex-direction: column !important;
        align-items: center !important;
        gap: 16px !important;
        padding: 20px !important;
    }

    .header-title-inner {
        width: auto !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }

    .header-title-inner .page-heading {
        text-align: center !important;
    }

    .header-action-side {
        width: 100% !important;
    }

    .header-action-side button,
    .header-action-side .btn-primary-purple,
    .header-action-side .btn-global {
        width: 100% !important;
    }
}

@media (max-width: 360px) {
    .header-title-inner {
        max-width: 100%;
        min-width: 0;
    }
    .header-title-inner .page-heading {
        font-size: 20px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .header-action-side {
        width: 100% !important;
        justify-content: center !important;
    }

    .header-action-side button,
    .header-action-side .btn-primary-purple {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }
}

/* ==========================================
   共通コンポーネント：ページネーション（analysis.cssから統一）
   ========================================== */
.pagination-container {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    margin-top: 30px !important;
    margin-bottom: 30px !important;
}

/* ==============================================================
   ローディングスピナー（analysis.cssから移設）
   ============================================================== */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #322152;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.loading-modal-text {
    margin-top: 20px;
    font-weight: 600;
    color: #322152;
    font-size: 16px;
}
.loading-modal-subtext {
    margin-top: 4px;
    color: #718096;
    font-size: 13px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==============================================================
   トースト通知（analysis.cssから移設）
   ============================================================== */
body:has(.modal-root-overlay.active) .ajax-toast-container {
    z-index: 900 !important;
}
.ajax-toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1950;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 450px;
    pointer-events: none;
}

/* モバイルではヘッダー(app-header)の下に重ならないよう位置調整（全画面共通） */
@media (max-width: 800px) {
    .ajax-toast-container {
        top: 65px !important;
        bottom: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: calc(100% - 24px) !important;
        max-width: 370px !important;
    }
}
.custom-toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px 18px 18px;
    border-radius: 4px;
    color: #ffffff;
    font-family: sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    transition: opacity 0.3s, transform 0.3s;
}
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.custom-toast.processing { background-color: #1e88e5; }
.custom-toast.toast-summary-variant {
    background-color: #f1f5f9;
    border-left: 4px solid #64748b;
    color: #334155;
}
.toast-summary-variant .toast-icon-zone,
.toast-summary-variant .toast-close-btn { color: #64748b; }
.toast-summary-variant .toast-spinner-neutral { border-top-color: #64748b; }
.custom-toast.success { background-color: #007d32; }
.custom-toast.failed { background-color: #c53030; }
.custom-toast.failed .toast-progress-bar-fill {
    background-color: rgba(255, 255, 255, 0.7);
    animation: successBarShrink 4s linear forwards;
    transform-origin: left;
}
.toast-icon-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
.toast-white-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: toastSpin 0.8s linear infinite;
}
@keyframes toastSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.toast-msg-content { flex: 1; line-height: 1.4; word-break: break-all; }
.toast-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
    line-height: 1;
}
.toast-close-btn:hover { color: #ffffff; }
.toast-progress-bar-track {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
}
.toast-progress-bar-fill {
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    width: 100%;
}
.custom-toast.processing .toast-progress-bar-fill {
    width: 100%;
    animation: processingBarMove 1.5s linear infinite;
    transform-origin: left center;
}
@keyframes processingBarMove {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.custom-toast.success .toast-progress-bar-fill {
    animation: successBarShrink 4s linear forwards;
    transform-origin: left;
}
@keyframes successBarShrink {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}