@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;700&family=IBM+Plex+Sans+JP:wght@400;500;600;700&display=swap');

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

:root {
    --primary-color: #2c3e50;
    /* 濃いネイビー */
    --accent-color: #007bff;
    /* 鮮やかなブルー（ログインボタンと統一） */
    --success-color: #27ae60;
    /* グリーン */
    --warning-color: #e67e22;
    /* オレンジ */
    --danger-color: #c0392b;
    /* レッド */
    --background-color: #dee2e6;
    /* コントラストを強調したグレー背景 */
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #7f8c8d;
    --border-color: #e0e0e0;
}

body {
    font-family: 'IBM Plex Sans JP', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.02em;
    /* わずかに字間を広げ、文字の潰れを防ぐ (OJI-UX最高峰の設定) */
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

html {
    font-size: 115%;
    /* PC版も110%から115%へ引き上げ、全デバイスで「マッシブな視認性」を統一 */
    overflow-x: hidden;
}

/* ヘッダー */
header {
    background-color: var(--card-bg);
    padding: 10px 0;
    /* 上下にパディングを追加 */
    height: 80px;
    /* 64pxから80pxに拡張 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    /* 1000pxから拡張して、さん付け等の追加テキストに対応 */
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.header-inner.is-guest {
    justify-content: center;
}

.header-branding {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-right: 60px;
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 400;
}

header h1 a {
    color: var(--accent-color);
    text-decoration: none;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    white-space: nowrap;
}

header h1 a i {
    margin-right: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.hide-mid {
    transition: opacity 0.2s;
}

@media screen and (max-width: 1100px) {
    .hide-mid {
        display: none;
    }

    .header-branding {
        margin-right: 30px;
    }
}

@media screen and (max-width: 900px) {
    .header-inner {
        padding: 0 10px;
    }

    .header-branding {
        margin-right: 15px;
    }

    nav a {
        margin-left: 10px;
        font-size: 0.9rem;
    }
}

.user-name-badge {
    font-size: 0.9em;
    background: #f0f0f0;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 15px;
    /* 20pxから少し詰める */
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
    /* ナビ項目も改行を防ぐ */
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

nav a i {
    font-size: 1rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

nav a:hover i {
    color: var(--accent-color);
}

nav a:hover {
    color: var(--accent-color);
}

.logout-btn-header {
    background: none;
    border: none;
    color: #dc3545;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    /* ログアウトが2行にならないように強制 */
}

/* コンテンツエリア */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 24px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* カードスタイル */
.card,
article.case-detail,
.card-form {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 32px;
    margin-bottom: 24px;
}

/* テーブルスタイル */
.table-container {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    /* 保険として残すが、基本は収まるようにする */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 24px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f8f9fa;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 12px 10px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    /* 見出しの意図しない改行を防止 */
}

td {
    padding: 12px 10px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* 申請者列の省スペース化 */
.col-requester {
    font-size: 0.85rem !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

/* 申請件名（左寄せ）のパディング調整 */
.text-left {
    text-align: left;
    padding-left: 24px !important;
}

/* PC版一覧のカラム幅調整 */
@media (min-width: 601px) {
    .col-title {
        width: 30%;
        min-width: 250px;
    }

    .col-payee {
        width: 17%;
        min-width: 140px;
    }

    th.text-center,
    td.text-center {
        width: 10%;
    }

    /* 申請日（2行表示）用の幅をさらに拡大して表示切れと意図しない改行を防止 */
    th[data-label="申請日"],
    td[data-label="申請日"] {
        width: 16%;
        min-width: 160px;
        white-space: nowrap;
        /* 1行の中での折れを防止 */
    }
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fcfcfc;
}

/* リンク */
a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* リンク定義は上記で集約済み */

/* ユーティリティ */
/* .text-left 定義は上記で集約済み */

.text-center {
    text-align: center !important;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.status-draft {
    background: #ecf0f1;
    color: #7f8c8d;
}

.status-submitted {
    background: #e3f2fd;
    color: var(--accent-color);
}

.status-approved {
    background: #e8f8f5;
    color: #27ae60;
}

.status-remanded {
    background: #fdedec;
    color: #c0392b;
}

/* 共通バッジスタイル (全デバイス共通) */
.detail-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    line-height: 1.2;
    margin: 2px 0;
    /* マージンを調整 */
}

.detail-header-block h2 {
    font-weight: bold !important;
    /* 全デバイスで太字に統一 */
}

.badge-nta {
    background-color: #f1f3f5;
    color: #495057;
    border: 1px solid #dee2e6;
}

.badge-qualified {
    background-color: #e6fcf5;
    color: #087f5b;
    border: 1px solid #c3fae8;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.badge-verified {
    background-color: #e8f8f5;
    color: #27ae60;
    border: 1px solid #c3fae8;
}

/* ボタン */
button {
    font-family: inherit;
    cursor: pointer;
    /* 手のひらマークを基本設定へ */
}

/* ボタン・アクションエリア */
.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
}

/* 一覧画面のアクションボタン（CSV、新規申請） */
.list-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px 10px;
    /* 上をわずかに多くして視覚的なバランスをとる */
    background-color: var(--accent-color);
    color: white !important;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.95rem;
    min-width: 100px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    line-height: 1.2;
    box-sizing: border-box;
    white-space: nowrap;
}

.button:hover {
    background-color: #0069d9;
    transform: translateY(-1px);
}

.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 24px;
    background-color: #7f8c8d;
    color: white !important;
    border-radius: 6px;
    font-weight: 500;
    font-size: 1rem;
    min-width: 120px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    line-height: 1;
    box-sizing: border-box;
}

.button-outline-danger {
    background-color: transparent !important;
    border: 1px solid #dc3545 !important;
    color: #dc3545 !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
}

.button-primary-bold {
    font-weight: 500 !important;
}

.button-success {
    background-color: var(--success-color) !important;
}

.button-danger {
    background-color: var(--danger-color) !important;
}

/* AI自動作成・領収書から自動入力ボタン */
.button-ai {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    /* 他のボタンと同じサイズに合わせる */
}

/* フォーム要素 */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea,
input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

@media screen and (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 24px;
    }
}

.large-input {
    font-size: 1.2rem !important;
    font-weight: 400 !important;
    padding: 14px 20px !important;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    /* 太字にして階層を明確化 */
    font-size: 1rem;
    /* サイズを少し調整 */
    color: var(--primary-color);
    /* 色を濃くして視認性向上 */
}

.errorlist {
    color: var(--danger-color);
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    font-weight: bold;
}

/* 詳細画面 */
.meta {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.95rem;
}

.case-body {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 1.05rem;
    line-height: 1.8;
}

/* 履歴タイムライン */
.history ul {
    padding-left: 20px;
}

.history li {
    padding-left: 24px;
    margin-bottom: 24px;
    border-left: 2px solid var(--border-color);
    position: relative;
    list-style: none;
}

.history li::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
}

/* 改善された詳細画面のレイアウト (PC/タブレット) */
.pc-only {
    display: none !important;
}


.pc-tablet-only {
    display: none !important;
}

.mobile-only {
    display: block !important;
}

@media screen and (min-width: 768px) {
    .pc-only {
        display: block !important;
    }

    span.pc-only {
        display: inline !important;
    }

    .pc-tablet-only {
        display: block !important;
    }

    .mobile-only {
        display: none !important;
    }

    .detail-header-block {
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 1px solid var(--border-color);
    }

    .detail-header-block h2 {
        margin-bottom: 15px;
        border-bottom: none;
        padding-bottom: 0;
    }

    .detail-meta-row {
        display: flex;
        gap: 25px;
        align-items: center;
        font-size: 0.95rem;
        color: var(--text-muted);
    }

    .detail-section {
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 30px;
    }

    .detail-section-title {
        background: #f8f9fa;
        padding: 12px 20px;
        border-bottom: 1px solid var(--border-color);
        font-weight: 700;
        font-size: 0.9rem;
        color: var(--primary-color);
    }

    .detail-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
    }

    /* タブレット（1024px以下）では2列にする */
    @media screen and (max-width: 1024px) {
        .detail-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    .detail-item {
        padding: 20px;
        border-right: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
    }

    /* グリッドの端のボーダー調整 */
    .detail-item:nth-child(4n) {
        border-right: none;
    }

    @media screen and (max-width: 1024px) {
        .detail-item:nth-child(2n) {
            border-right: none;
        }

        /* 2列時に最後の2つ以外は下線が必要 */
        .detail-item:nth-last-child(n+3) {
            border-bottom: 1px solid #f0f0f0;
        }
    }

    /* スマホ（767px以下）では1列にする */
    @media screen and (max-width: 767px) {
        .detail-grid {
            grid-template-columns: 1fr;
        }

        .detail-item {
            border-right: none !important;
            padding: 15px 20px;
            /* スマホでは上下の余白を少し詰め、横にゆとりを持たせる */
        }
    }

    .detail-item-label {
        font-size: 0.8rem;
        color: var(--text-muted);
        margin-bottom: 8px;
        display: block;
    }

    .detail-item-value {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-color);
        word-break: break-all;
    }

    .detail-item-value.large {
        font-size: 1.5rem;
        color: var(--primary-color);
    }

    .detail-content-area {
        padding: 20px;
        line-height: 1.8;
    }

    .detail-tax-summary {
        margin: 20px;
        padding: 15px 20px;
        background: #f0f7ff;
        border-radius: 6px;
        border-left: 4px solid var(--accent-color);
        display: flex;
        gap: 20px;
        font-size: 0.95rem;
    }

    /* 共通バッジスタイルはグローバルへ移動済み */

    /* 添付ファイルエリアの調整 (PC/タブレットのみ) */
    .attachment-preview-container {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        margin-top: 10px;
    }

    .attachment-card {
        flex: 0 0 auto;
        width: 300px;
        max-width: 100%;
        border: 1px solid #eee;
        padding: 10px;
        border-radius: 8px;
        background: #fff;
        transition: transform 0.2s;
    }

    .attachment-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .attachment-img-wrapper {
        width: 100%;
        height: 200px;
        overflow: hidden;
        border-radius: 4px;
        margin-bottom: 8px;
        background: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .attachment-img-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

    .attachment-filename {
        font-size: 0.85rem;
        font-weight: bold;
        color: var(--accent-color);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }
}


/* アップロード */
.upload-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
}

.hidden-file-input {
    display: none !important;
}

/* --- レスポンシブ対応 (モバイル向け) --- */
/* --- レスポンシブ対応 (モバイル向け: 767px以下 = スマホのみ対象) --- */
@media screen and (max-width: 767px) {
    html {
        font-size: 112%;
        /* 標準モバイルサイズ: PCよりは少し大きく */
        transition: font-size 0.3s ease-in-out;
    }

    html.oji-ux-active {
        font-size: 125%;
        /* 究極の「OJI-UX」: 老眼鏡不要レベル */
    }

    header {
        height: 80px;
        /* PC/タブレットで共通の余裕(80px)に統一 */
        padding: 10px 0;
    }

    .header-inner {
        flex-direction: row !important;
        justify-content: space-between !important;
        flex-wrap: nowrap;
        gap: 5px;
        text-align: left;
        padding: 0 15px;
        height: 100%;
        /* 親要素に合わせる */
    }

    .user-name-badge {
        max-width: 65px;
        /* さらに少し削る */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.75rem;
        /* 微調整 */
        padding: 2px 6px;
    }

    .header-branding {
        gap: 0;
    }

    header h1 {
        font-size: 1.2rem;
        display: flex;
        align-items: center;
    }

    .user-info {
        flex-direction: row;
        gap: 5px;
        /* 隙間を詰める */
        width: auto;
        margin-top: 0;
        align-items: center;
    }

    .user-name-badge {
        font-size: 0.85rem;
        padding: 4px 10px;
        margin: 0;
    }

    nav {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 15px;
        flex-wrap: nowrap;
    }

    nav>form {
        display: contents;
        /* フォームの箱を消して、ボタンを直接 nav の子として扱う */
    }

    nav a {
        margin: 0;
        padding: 5px 0;
        /* タップ領域の確保 */
        font-size: 1.1rem;
        /* 0.95remから引き上げ */
        font-weight: 500;
        text-decoration: none;
        background: none;
        border: none;
        cursor: pointer;
        display: inline-block;
        line-height: 1.5;
    }

    .logout-btn-header {
        margin: 0;
        padding: 4px 8px;
        /* パディングを詰める */
        background: #f1f3f5;
        border: 1px solid #dee2e6;
        border-radius: 20px;
        color: #dc3545;
        font-size: 0.8rem;
        /* 少し小さく */
        font-weight: 700;
        cursor: pointer;
        font-family: inherit;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 2px;
    }

    .container {
        margin: 20px auto;
        padding: 0 12px;
        /* 8pxから12pxに増やして左右の余白を安定させる */
    }

    .card,
    article.case-detail,
    .card-form,
    .search-card {
        padding: 16px;
        /* モバイルではさらに詰める */
    }

    /* テーブル表示の最適化 */
    .table-container {
        background: transparent;
        box-shadow: none;
    }

    @media screen and (max-width: 600px) {

        table,
        thead,
        tbody,
        th,
        td,
        tr {
            display: block;
            width: 100%;
        }

        thead {
            display: none;
            /* ヘッダーを隠す */
        }

        tr {
            background: var(--card-bg);
            margin-bottom: 16px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            padding: 12px;
            /* 左右均等な余白に変更。padding-right: 70px を削除 */
            border: 1px solid var(--border-color);
            width: 100%;
            position: relative;
        }

        td {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            padding: 10px 0;
            border-bottom: 1px solid #f2f2f2;
            font-size: 0.95rem !important;
            gap: 8px;
            width: 100%;
            transition: font-size 0.3s ease-in-out;
        }

        /* 承認状況：1行表示にし、バッジ内容のみを中央に寄せる */
        td[data-label="承認状況"] {
            flex-direction: row;
            align-items: center;
        }

        td[data-label="承認状況"]>span,
        td[data-label="承認状況"]>strong,
        td[data-label="承認状況"]>.status-badge {
            flex: 1;
            text-align: center;
            /* 右側スペースの中で中央に表示 */
            margin: 0;
            width: auto;
        }

        td:before {
            content: attr(data-label);
            font-weight: 600;
            color: var(--text-muted);
            font-size: 0.75rem;
            text-align: center;
            flex-shrink: 0;
            width: 75px;
            padding-top: 3px;
        }

        html.oji-ux-active td {
            font-size: 1.15rem !important;
        }

        td:last-child {
            border-bottom: none;
        }

        /* tdの中身（右側）の基本スタイル：横並びに戻す */
        td>a,
        td>strong,
        td>span,
        td>small {
            flex: 1;
            min-width: 0;
            text-align: right;
            overflow-wrap: break-word;
            word-break: break-all;
            display: block;
        }

        .text-left {
            padding-left: 0 !important;
        }

        /* 金額を強調 */
        td[data-label="金額"] strong {
            font-size: 1.25rem;
            color: var(--primary-color);
            transition: font-size 0.3s ease-in-out;
        }

        html.oji-ux-active td[data-label="金額"] strong {
            font-size: 1.6rem;
        }

        /* 経費件名・支払先は左寄せ（折り返し時に読みやすくするため） */
        td[data-label="経費件名"] a,
        td[data-label="経費件名"] strong,
        td[data-label="支払先"] span {
            text-align: left;
        }
    }

    /* 600px以上のタブレット等では横スクロールを維持 */
    /* 600px以上のタブレット等では横スクロールを維持 */
    @media screen and (min-width: 601px) and (max-width: 767px) {
        .table-container {
            overflow-x: auto;
            background: var(--card-bg);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        table {
            min-width: 700px;
            /* 600から700に増やして余裕を持たせる */
        }

        th,
        td {
            white-space: nowrap;
        }
    }

    /* 詳細画面メタ情報 */
    .meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: 0.9rem;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
    }

    /* 金額・カテゴリー等の情報グリッド */
    .expense-info {
        display: flex !important;
        flex-direction: column !important;
        /* スマホでは1列（縦並び）を強制 */
        gap: 20px !important;
        /* 少し余裕を持たせる */
        padding: 20px !important;
        background-color: #fdfdfd;
        border: 1px solid #eee;
        border-radius: 8px;
        margin-bottom: 25px;
    }

    .expense-info>div {
        flex: 1 1 100% !important;
        /* 1カラム化 */
        min-width: 0;
        /* 文字溢れ防止 */
    }

    .expense-info>div:first-child {
        flex: 1 1 100%;
        /* 金額は一番上に大きく表示 */
        border-bottom: 2px solid #eee;
        padding-bottom: 10px;
        margin-bottom: 5px;
    }

    /* ボタン */
    .button,
    .button-secondary,
    .card-form button[type="submit"],
    .actions form {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin-left: 0 !important;
        margin-bottom: 12px;
        box-sizing: border-box;
        height: 56px !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        border-radius: 12px !important;
        transition: all 0.3s ease-in-out;
    }

    html.oji-ux-active .button,
    html.oji-ux-active .button-secondary,
    html.oji-ux-active .card-form button[type="submit"],
    html.oji-ux-active .actions form {
        height: 80px !important;
        font-size: 1.3rem !important;
        font-weight: 900 !important;
        border-radius: 20px !important;
    }

    .actions,
    .attachment-list,
    form>div[style*="display: flex"] {
        flex-direction: column !important;
        width: 100%;
        gap: 12px;
        /* 要素間の隙間を確保 */
    }

    .attachment-item {
        width: 100% !important;
    }

    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        font-size: 18px !important;
        padding: 14px 16px;
        transition: all 0.3s ease-in-out;
    }

    html.oji-ux-active input[type="text"],
    html.oji-ux-active input[type="number"],
    html.oji-ux-active input[type="date"],
    html.oji-ux-active input[type="email"],
    html.oji-ux-active input[type="password"],
    html.oji-ux-active select,
    html.oji-ux-active textarea {
        font-size: 19px !important;
        padding: 18px 24px;
    }

    /* ラベルを大きく太くして視認性アップ */
    .form-group label {
        display: block;
        font-size: 1.0rem !important;
        font-weight: 700 !important;
        margin-bottom: 8px;
        color: #333;
        transition: all 0.3s ease-in-out;
    }

    html.oji-ux-active .form-group label {
        font-size: 1.15rem !important;
        font-weight: 950 !important;
        margin-bottom: 12px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    /* AI解析ボタンを「おじさま」向けに巨大化 */
    .button-ai {
        height: auto !important;
        min-height: 60px !important;
        font-size: 1.1rem !important;
        font-weight: 800 !important;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 15px;
        margin-bottom: 12px;
        border-radius: 14px !important;
        box-shadow: 0 4px 15px rgba(111, 66, 193, 0.25) !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease-in-out;
        white-space: normal !important;
        line-height: 1.2;
    }

    html.oji-ux-active .button-ai {
        height: auto !important;
        min-height: 84px !important;
        font-size: 1.3rem !important;
        font-weight: 950 !important;
        white-space: normal !important;
        border-radius: 22px !important;
        box-shadow: 0 10px 30px rgba(111, 66, 193, 0.5) !important;
        padding: 15px 20px;
    }
}

/* AI自動作成中のアニメーション（点滅） */
@keyframes pulse-animation {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.is-processing {
    animation: pulse-animation 1.5s infinite ease-in-out !important;
    pointer-events: none !important;
    opacity: 0.7;
}

.processing-text::after {
    content: " 生成中...";
    font-size: 1.0em;
}

/* OCR結果入力時のハイライト効果 */
@keyframes highlight-fade {
    0% {
        background-color: rgba(46, 204, 113, 0.2);
        border-color: #2ecc71;
        box-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
    }

    100% {
        background-color: #fff;
        border-color: var(--border-color);
        box-shadow: none;
    }
}

.ocr-fill-highlight {
    animation: highlight-fade 2s ease-out;
}

/* スマホ/PC表示の切り替え */
/* スマホ/PC表示の切り替え */
@media screen and (max-width: 767px) {
    .pc-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-camera-area {
        display: block !important;
    }

    .upload-drop-zone {
        padding: 20px 10px !important;
        border-style: solid !important;
        /* モバイルでは点線より実線の方がタップ領域として認識しやすい */
        background-color: #fcfcfc;
    }
}

/* 検索フォーム */
.search-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 24px;
    margin-bottom: 24px;
}

.search-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 columns for tablet/smaller screens */
    gap: 20px;
    align-items: flex-end;
}

@media screen and (min-width: 1024px) {
    .search-form-grid {
        grid-template-columns: 1.2fr 1.8fr 1fr 1fr;
        /* 4 columns for desktop */
    }
}

.search-input {
    width: 100%;
}

.date-range-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range-container input {
    flex: 1;
    min-width: 0;
    /* Important for flex items to shrink below content size */
}

.search-form-grid label {
    white-space: nowrap;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.search-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

@media screen and (max-width: 767px) {
    .search-form-grid {
        grid-template-columns: 1fr;
    }

    .search-actions {
        flex-direction: column;
    }

    .search-actions .button {
        width: 100%;
    }
}

/* 検索トグル (アコーディオン) */
.search-toggle-btn {
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    /* 文字サイズ拡大 */
    font-weight: 400;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s;
}

.search-toggle-btn:hover {
    background: #f8f9fa;
    border-color: var(--accent-color);
}

.search-form-body {
    display: none;
    /* デフォルト非表示 */
}

.search-form-body.is-open {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-radius: 8px;
    padding: 8px 0;
    border: 1px solid #eee;
    margin-top: 5px;
}

.dropdown-menu a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.dropdown:hover .dropdown-menu,
.dropdown.is-active .dropdown-menu {
    display: block;
}

.dropdown-toggle i {
    font-size: 0.8em;
    margin-left: 5px;
    transition: transform 0.2s;
}

.dropdown:hover .dropdown-toggle i,
.dropdown.is-active .dropdown-toggle i {
    transform: rotate(180deg);
}

/* モバイル対応の追加スタイル */
/* モバイル対応の追加スタイル */
@media screen and (max-width: 767px) {

    /* ヘッダーボタンエリア */
    .dropdown-toggle {
        padding: 10px 16px !important;
        font-size: 0.9rem !important;
    }

    /* 新規申請ボタンを「おじさま」向けに超巨大化 (iPhone SEでも絶対外さないサイズ) */
    .list-header-actions .button-primary-bold {
        width: 100% !important;
        height: 60px !important;
        font-size: 1.2rem !important;
        font-weight: 800 !important;
        border-radius: 14px !important;
        box-shadow: 0 4px 15px rgba(0, 123, 255, 0.25) !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        margin-top: 5px;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease-in-out;
    }

    html.oji-ux-active .list-header-actions .button-primary-bold {
        height: 84px !important;
        font-size: 1.6rem !important;
        font-weight: 950 !important;
        border-radius: 22px !important;
        box-shadow: 0 10px 30px rgba(0, 123, 255, 0.5) !important;
    }

    /* 検索フォームを完全に1カラムに & はみ出し防止 */
    .search-card form>div[style*="grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    .search-card form>div[style*="grid"]>div {
        width: 100% !important;
        grid-column: span 1 !important;
    }

    /* テーブル内の文字も大きく */
    table td,
    table th {
        font-size: 1.05rem !important;
    }

    .search-card input,
    .search-card select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        /* はみ出し防止 */
    }

    /* 検索ボタンエリアのモバイル調整 */
    .search-card form>div[style*="justify-content"] {
        flex-direction: column !important;
    }

    .search-card form>div[style*="justify-content"] .button,
    .search-card form>div[style*="justify-content"] a {
        width: 100% !important;
        min-width: auto !important;
        text-align: center;
    }

    /* 一覧画面のアクションエリア */
    .list-header-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        width: 100% !important;
        margin-top: 15px;
    }

    .list-header-actions>* {
        width: 100% !important;
        margin: 0 !important;
    }

    .list-header-actions .button,
    .list-header-actions .dropdown,
    .list-header-actions .dropdown-toggle {
        width: 100% !important;
        height: 48px !important;
        /* タップしやすい高さに統一 */
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .date-range-container {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    .date-range-container input {
        flex: 1 1 100% !important;
        /* モバイルでは1個ずつ縦に並べる方が安全 */
        width: 100% !important;
    }

    .date-range-container span {
        display: none;
        /* 「〜」を消して、縦並びにする */
    }
}

/* 会社ロゴ */
.company-logo {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary-color);
    /* Fallback */
    background: linear-gradient(135deg, var(--primary-color), #0069d9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    white-space: nowrap;
    margin-right: 15px;
    /* gapの代替 */
}

/* PC画面での列圧縮調整 (1300px以下から適用) */
@media screen and (max-width: 1300px) {

    th,
    td {
        padding: 8px 6px !important;
        font-size: 0.88rem !important;
    }

    .col-requester {
        font-size: 0.82rem !important;
    }

    .brand-jp {
        display: none;
        /* 1300px以下でも早めに隠してヘッダーの余裕を作る */
    }
}

/* PC/タブレット間の中間サイズ調整（1200px以下で要素が重ならないように） */
@media screen and (min-width: 768px) and (max-width: 1200px) {
    .header-inner {
        padding: 0 15px;
    }

    .user-info {
        gap: 8px;
    }

    nav a {
        margin-left: 8px;
        font-size: 0.95rem;
    }

    .logout-btn-header {
        font-size: 0.9rem;
        margin-left: 5px;
    }
}

@media screen and (max-width: 1100px) {
    .brand-jp {
        display: none;
    }
}

@media screen and (max-width: 950px) {
    .user-name-badge {
        font-size: 0.85rem;
        padding: 4px 10px;
    }

    /* 「さん でログイン中」を「さん」のみにする場合はHTML側の変更が必要だが、CSSで「でログイン中」の余白や見栄えを調整 */
}

@media screen and (max-width: 767px) {
    header {
        height: auto !important;
        min-height: 60px;
        /* 80pxから縮小 */
        padding: 6px 0 !important;
        /* パディングを詰める */
        display: flex !important;
        align-items: center !important;
        /* 再度中央寄せに */
    }

    .header-inner {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2px !important;
        /* 隙間を最小限に */
        padding: 0 10px !important;
    }

    .company-logo {
        display: none !important;
    }

    /* タイトルの2行崩れを防止 */
    .brand-jp {
        display: none;
    }

    header h1 {
        white-space: nowrap;
        margin-bottom: 0px !important;
        line-height: 1.1;
    }

    header h1 a {
        font-size: 1.1rem;
        /* スマホではロゴを少し小さくしてスペース確保 */
    }

    .user-info {
        width: 100% !important;
        justify-content: center !important;
        gap: 6px !important;
        flex-wrap: wrap !important;
    }

    .user-name-badge {
        font-size: 0.75rem;
        /* 0.85remから少し縮小 */
        padding: 2px 8px;
        /* パディングを詰める */
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        background: rgba(0, 0, 0, 0.05);
        /* 少し控えめな背景色 */
    }

    /* おじ様モード時はフォントがさらに大きいため、パディングを極限まで詰める */
    html.oji-ux-active header {
        padding: 4px 0 !important;
    }
}

/* ブランド用フォント設定 */
.brand-en {
    font-family: 'IBM Plex Sans JP', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    /* ブランド名も「マッシブな読みやすさ」へ統合 */
}

.brand-jp {
    font-family: 'IBM Plex Sans JP', sans-serif;
    font-weight: 600;
}

/* ログイン画面用 */
.login-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 0 20px;
}

.login-branding {
    text-align: center;
    margin-bottom: 30px;
}

.login-branding .brand-logo-text {
    font-size: 2.8rem;
    font-weight: 800;
    color: #007bff;
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 8px;
    font-family: 'IBM Plex Sans JP', sans-serif;
}

.login-branding .brand-subtext {
    font-size: 1.1rem;
    color: #6b7280;
    font-weight: 500;
}

/* 小型端末 (iPhone SE等) 用の調整 */
@media screen and (max-width: 380px) {
    .login-branding .brand-logo-text {
        font-size: 2.2rem;
        /* 改行させない */
        white-space: nowrap;
    }

    .login-branding .brand-subtext {
        font-size: 0.95rem;
    }
}

.button-vivid-blue {
    background-color: #007bff !important;
    border: none !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    height: 52px !important;
    transition: all 0.2s ease !important;
}


.button-vivid-blue:hover {
    background-color: #0069d9 !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* =========================================
   Mobile Bottom Navigation & FAB (Oji-UX)
   ========================================= */

/* デフォルトでは非表示 (PC/Tablet) */
.mobile-bottom-nav {
    display: none;
}

.fab-container {
    display: none;
}

@media screen and (max-width: 767px) {

    /* コンテンツが下に隠れないように余白を追加 */
    body {
        padding-bottom: 80px;
    }

    /* ボトムナビゲーション */
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: #ffffff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        border-top: 1px solid #e0e0e0;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.7rem;
        flex: 1;
        height: 100%;
    }

    .nav-item i {
        font-size: 1.4rem;
        margin-bottom: 2px;
    }

    .nav-item.active {
        color: var(--accent-color);
        font-weight: 600;
    }

    /* Floating Action Button (FAB) */
    .fab-container {
        display: flex;
        /* モバイルでのみ表示 */
        position: fixed;
        bottom: 75px;
        /* ボトムナビの上に配置 */
        right: 20px;
        z-index: 1001;
    }

    .fab {
        width: 56px;
        height: 56px;
        background-color: var(--accent-color);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        text-decoration: none;
        transition: transform 0.2s;
    }

    .fab:active {
        transform: scale(0.95);
    }

    .fab i {
        font-size: 1.5rem;
    }

    /* PC用のヘッダーナビを隠す（ボトムナビへの移行） */
    header nav {
        display: none !important;
    }
}

/* 一覧行のクリック対応 */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background-color: #f1f3f5 !important;
}