/* ==========================================================================
   ざいのーと [財産管理] PC専用スタイル
   ========================================================================== */

/* 共通のスタイル */
:root {
    --primary-bg: #add8e6;        /* ライトブルー（在庫側テーマカラー） */
    --header-bg: #4169e1;         /* 青色 */
    --hover-bg: #afeeee;          /* ペールターコイズ */
    --duplicate-red: #ffcccc;     /* 薄めの赤色 */
    --duplicate-yellow: #fffacd;  /* 薄めの黄色 */
    --highlight-red: #ff7777;     /* 強調赤 */
    --highlight-yellow: #ffff33;  /* 強調黄 */
    --border-color: #ccc;
    --button-bg: #0078D4;
    --text-white: white;
}

body {
    background-color: var(--primary-bg);
}

:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

table {
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    width: auto; /* コンテンツに合わせた幅にする */
    background-color: white; /* 背景色を白に設定 */
    margin-top: 20px;
}

#inventory {
    margin-top: 6px;
}

#saveAllButton.has-unsaved-changes {
    background-color: orange;
}

#inventory td.changed-row-number {
    background-color: #ffb347;
    color: #6b3a00;
    font-weight: bold;
}

#inventory td.changed-cell {
    background-color: #ffb347;
}

#inventory td.update-pending {
    background-color: orange;
}

#inventory td.update-time-cell {
    font-size: 13px;
}

#inventory td.row-action-cell {
    position: relative;
    min-width: 40px;
    text-align: center;
}

#inventory td .row-action-trigger {
    min-width: 32px;
    margin: 0;
    padding: 0;
}

#inventory td .row-action-menu {
    position: absolute;
    top: calc(100% - 1px);
    right: 2px;
    z-index: 30;
    display: none;
    min-width: 72px;
    padding: 3px;
    border: 1px solid #8aaec4;
    border-radius: 3px;
    background: #e6f5ff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

#inventory td .row-action-menu.open {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#inventory td .row-action-menu button,
#inventory td .row-action-menu a.history-button {
    width: 100%;
    margin: 0;
}

.app-notice {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10000;
    max-width: min(420px, calc(100vw - 32px));
    padding: 10px 14px;
    border: 1px solid #4a6b80;
    border-radius: 4px;
    background: #f5fbff;
    color: #173042;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.app-notice.visible {
    opacity: 1;
    transform: translateY(0);
}

.app-notice.error {
    border-color: #a33a3a;
    background: #fff5f5;
    color: #7d1f1f;
}

.app-notice.success {
    border-color: #3b8152;
    background: #f3fff5;
    color: #205b30;
}

@media (max-width: 600px) {
    table, th, td {
        font-size: 12px;
    }
}

th, td {
    min-width: 30px; /* 幅調整 */
    border: 1px solid var(--border-color); /* 境界線を薄いグレーに統一 */
}

#inventory th:first-child {
    padding-left: 7px;
    padding-right: 7px;
}

td {
    padding: 2px 8px; /* データ行のパディングを極限まで詰め気味に調整 */
    line-height: 1.2;    /* 行間を最小にして要素の高さに合わせる */
}

#addForm > label {
    font-size: 0.9em;
}

#addForm > select,
#addForm > input,
#addForm > button,
#addForm > .usage-input-wrapper {
    margin-right: 6px;
}

#money-transactions thead th,
.money-income-table thead th,
th {
    background-color: var(--header-bg);
    color: var(--text-white);
    cursor: pointer;
    font-size: 13px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap !important;
    padding: 2px 4px !important;
    height: 22px !important;
    max-height: 22px !important;
    line-height: 1.25 !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

th.sticky-right, td.sticky-right {
    right: 0;
    white-space: nowrap;
}

.separator-row td {
    padding: 0;
    height: 1px; /* 高さを調整 */
    border: none; /* ボーダー削除 */
    background-color: black;
}

.separator-row.separator-row--thick td {
    height: 2px;
}

/* チェック済みアイテムのスタイル */
.checked-item {
    color: gray;
    text-decoration: line-through;
    background-color: #a9a9a9; /* グレー背景 */
}

/* 枠線非表示設定 */
.no-border {
    border: none;
}

/* tbody センターリング */
#inventory tbody td {
    text-align: center;
}

/* styles.css */

.filter-active {
    color: red;
    font-weight: bold;
}

.orange-button {
    background-color: orange;
    color: black; /* 黒文字 */
}

input[type="file"] {
    display: none;
}

/* ボタンの改行防止（全ボタンnowrap統一） */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.custom-button,
.tab-button {
    white-space: nowrap !important;
}

/* 統一ボタンスタイル（リンク・ボタン・ファイル選択ラベル共通） */
.custom-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    height: 22px; /* 入力欄と同じ22pxに統一 */
    font-size: 13px;
    background-color: var(--button-bg);
    color: var(--text-white) !important;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap !important;
    box-sizing: border-box;
    line-height: normal;
    margin: 0;
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.label-box {
    display: flex;
    align-items: center;
    width: 8.5em;
    min-width: 8.5em;
    max-width: 8.5em;
    white-space: nowrap;
    height: 24px;
    font-size: 15px;
    font-weight: bold;
    box-sizing: border-box;
}
.small-input0 {
    width: 40px;
    text-align: right;
}

/* 標準小サイズ入力フィールド */
.small-input {
    width: 50px;
}

/* 中サイズ入力フィールド */
.small-input2 {
    width: 80px;
}

/* 大サイズ入力フィールド */
.small-input3 {
    width: 100px;
}

/* customizeLists.html 固有のスタイル */
/* 管理画面用共通スタイル (Barcode Master, Customize Lists 等) */
.container { 
    padding: 20px; 
    max-width: 1200px; /* 画面を広げても1200pxで止まるように制限 */
}

/* ==========================================
   項目リストカスタマイズ画面 (customizeLists.html) 用スタイル
   ========================================== */
.right-align {
    text-align: right;
}

/* --- customizeLists.html / money-lists.html (マスタ管理画面) 用スタイル --- */
.list-page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.back-link {
    display: inline-block;
    margin-bottom: 14px;
    font-size: 14px;
    color: #b84f50;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.form-section {
    background: #fff;
    border: 1px solid #d8bfc2;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-section h2, .list-section h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
    color: #5c3b3e;
    border-left: 4px solid #b84f50;
    padding-left: 8px;
}

.add-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}

.add-form-row label {
    width: 140px;
    min-width: 140px;
    flex: 0 0 140px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 6px;
    box-sizing: border-box;
    font-weight: 700;
    color: #5c3b3e;
    font-size: 13px;
    white-space: nowrap;
    text-align: left;
}

.add-form-row input[type="text"] {
    width: 220px;
    height: 28px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
}

.add-form-row .custom-button {
    height: 28px;
    padding: 0 14px;
    box-sizing: border-box;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: #b84f50;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-form-row .custom-button:hover {
    background-color: #9d3843;
}

.list-section {
    margin-bottom: 24px;
}

.list-table-wrapper {
    background: #fff;
    border: 1px solid #d8bfc2;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.list-table {
    width: 100% !important;
    max-width: none !important;
    border-collapse: collapse !important;
    border: none !important;
    font-size: 13px;
    margin: 0 !important;
    background: #fff;
}

.list-table th, .list-table td {
    padding: 6px 8px !important;
    border: none !important;
    border-bottom: 1px solid #f2e4e6 !important;
    vertical-align: middle;
    box-sizing: border-box;
}

.list-table th {
    background: #aa525b !important;
    color: #ffffff !important;
    border-bottom: 1px solid #71313a !important;
    font-weight: 700;
    font-size: 13px !important;
    cursor: default;
    text-align: center;
}

.list-table tr:hover td {
    background: #fbe9e7 !important;
}

.list-table th:nth-child(1),
.list-table td:nth-child(1) {
    text-align: center;
    width: 45px;
}

.list-table th:nth-child(2),
.list-table td:nth-child(2) {
    text-align: left;
    white-space: nowrap !important;
}

.list-table th:nth-child(3) {
    text-align: right;
    width: 55px;
    white-space: nowrap !important;
}

.list-table td:nth-child(3) {
    text-align: right;
    width: 55px;
    white-space: nowrap !important;
}

.list-table th:nth-child(4),
.list-table td:nth-child(4) {
    text-align: center;
    width: 60px;
    white-space: nowrap !important;
}

.list-table th:nth-child(5),
.list-table td:nth-child(5) {
    text-align: center;
    width: 180px;
    white-space: nowrap !important;
}

.list-table th:nth-child(6),
.list-table td:nth-child(6) {
    text-align: center;
    width: 155px;
    white-space: nowrap !important;
}

.sort-section {
    display: grid;
    grid-template-columns: 100px 1fr;
    border: 1px solid #d8bfc2;
    width: 100%;
    margin-top: 20px;
    background-color: #fdf8f8;
    border-radius: 6px 6px 0 0;
    align-items: center;
    box-sizing: border-box;
}

.sort-section div:first-child {
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    background-color: #f5eeee;
    color: #5c3b3e;
    height: 100%;
    border-right: 1px solid #d8bfc2;
    padding: 6px 8px;
    font-size: 13px;
    box-sizing: border-box;
}

.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    padding: 5px 10px;
    gap: 8px;
    align-items: center;
}

.sort-label {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    user-select: none;
}

.sort-buttons button {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #d8bfc2;
    background: #fff;
    color: #5c3b3e;
    white-space: pre;
    line-height: 1.25;
    text-align: center;
    font-family: inherit;
}

.sort-buttons button:hover {
    background: #fbe9e7;
    border-color: #b84f50;
}

.order-btn-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
}

.order-btn {
    background: #f0f4f8;
    color: #173042;
    border: 1px solid #c0d0dc;
    padding: 0;
    width: 32px;
    height: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    border-radius: 3px;
    box-sizing: border-box;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.order-btn:hover:not(:disabled) {
    background: #e2ecf4;
    border-color: #8da4b8;
}

.order-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.del-btn {
    background: #fce8e6;
    color: #a31515;
    border: 1px solid #f5c2c7;
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 12px;
}

.del-btn:hover {
    background: #f8d7da;
}

.list-color-cell {
    text-align: center;
    white-space: nowrap;
}

.list-color-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 5px;
}

.classic-color-palette {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 3px;
}

.list-color-enable {
    display: inline-flex;
    align-items: center;
    margin: 0;
    white-space: nowrap;
    vertical-align: middle;
    font-size: 12px;
    color: #5c3b3e;
}

.list-color-enable input {
    margin: 0 2px 0 0;
    vertical-align: middle;
}

.classic-color-swatch {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0;
    padding: 0;
    border: 1px solid #777;
    border-radius: 2px;
    cursor: pointer;
}

.classic-color-swatch[aria-pressed="true"] {
    outline: 2px solid #111;
    outline-offset: 1px;
}

.controls { margin-bottom: 0; }

/* 管理画面（バーコードマスタ等）のボタングループの余白調整 */
.container > .controls,
.container > .file-actions {
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 10px;
}

.container > .controls {
    margin-bottom: 12px;
}

.container > .file-actions {
    margin-bottom: 16px;
}

.required-field {
    border: 2px solid orange;
    background-color: #ffe6b3;
}

.normal-field {
    border: 1px solid #ccc;
    background-color: white;
}

/* 管理画面（Barcode Master等）の操作列をセンタリング */
.master-table td:last-child, .master-table th:last-child {
    text-align: center;
    width: 60px; /* 操作列の幅を狭める */
    white-space: nowrap;
}

/* JANコード登録表の分類列（4列目）を改行禁止にする */
.master-table th:nth-child(4),
.master-table td:nth-child(4) {
    white-space: nowrap !important;
}

/* 履歴ポップオーバー */
.history-popover {
    position: absolute;
    z-index: 2000;
    min-width: 220px;
    max-width: 420px;
    max-height: 320px;
    overflow: auto;
    background: white;
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    color: #222;
}
.history-popover .hp-loading, .history-popover .hp-empty { color: #666; }
.history-popover .hp-item { padding: 6px 8px; border-bottom: 1px solid #eee; }
.history-popover .hp-item:last-child { border-bottom: none; }
.history-popover .hp-time { font-size: 12px; color: #666; margin-bottom: 4px; }
.history-popover .hp-body { font-weight: 500; }

/* 小さなチップ表示（ボタンを覆わない左上寄せ） */
.history-tip {
    min-width: 120px;
    max-width: 220px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-size: 12px;
    color: #222;
    border-radius: 6px;
}
.history-tip .hp-tip { color: #333; }

/* ==========================================================================
   タブUI & 上部コントロールパネル
   ========================================================================== */
.top-section-container {
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
}

.system-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 8px;
}

.system-header-row h2 {
    margin: 0;
    font-size: 1.5em;
    color: #1a365d;
    white-space: nowrap;
}

/* 常時表示のコントロールバー（保存・並び替え: zaiko踏襲・上ラベル化・不要ボタン非表示） */
.global-action-bar {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    min-width: 810px;
    box-sizing: border-box;
    gap: 16px !important;
    background: #ffffff;
    padding: 6px 12px !important;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    margin-top: 6px;
    margin-bottom: 6px;
    width: 100%;
}

.inventory-content > .global-action-bar {
    position: static;
    margin-bottom: 0;
}

/* 保存ブロック */
.save-action-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
}

#saveAllButton {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    line-height: 28px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 0 12px !important;
    border-radius: 5px !important;
    border: 1px solid #aebdca !important;
    background: #f5f8fa !important;
    color: #263746 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    margin: 0 !important;
    transition: background-color 0.15s, border-color 0.15s;
}

#saveAllButton:hover {
    background: #e4f1f8 !important;
    border-color: #6f9db8 !important;
}

#saveAllButton.has-unsaved-changes {
    background-color: #d9381e !important;
    border-color: #b32400 !important;
    color: #ffffff !important;
    animation: pulseSave 1.5s infinite;
}

.sort-control-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

/* PCモード: ソート実行ボタンをドロップダウンの右隣りに配置 */
.sort-control-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

@media screen and (min-width: 1025px) {
    body:not(.force-mobile-mode) #sortExecuteButton,
    body:not(.force-mobile-mode) .sort-execute-button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        padding: 0 10px !important;
        border-radius: 5px !important;
        border: 1px solid #aebdca !important;
        background: #f5f8fa !important;
        color: #263746 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        margin: 0 !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
        transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    }

    body:not(.force-mobile-mode) #sortExecuteButton:hover,
    body:not(.force-mobile-mode) .sort-execute-button:hover {
        background: #e4f1f8 !important;
        border-color: #6f9db8 !important;
    }

    body:not(.force-mobile-mode) #sortExecuteButton:active,
    body:not(.force-mobile-mode) .sort-execute-button:active {
        background: #d0e4f0 !important;
        transform: scale(0.98);
    }
}

body.force-pc-mode #sortExecuteButton,
body.force-pc-mode .sort-execute-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    line-height: 28px !important;
    padding: 0 10px !important;
    border-radius: 5px !important;
    border: 1px solid #aebdca !important;
    background: #f5f8fa !important;
    color: #263746 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    margin: 0 !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

body.force-pc-mode #sortExecuteButton:hover,
body.force-pc-mode .sort-execute-button:hover {
    background: #e4f1f8 !important;
    border-color: #6f9db8 !important;
}

body.force-pc-mode #sortExecuteButton:active,
body.force-pc-mode .sort-execute-button:active {
    background: #d0e4f0 !important;
    transform: scale(0.98);
}

/* 共通ラベル（上ラベル化: zaiko準拠） */
.action-bar-item-label,
.sort-group-label,
.color-priority-label {
    display: block !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    line-height: 16px !important;
    font-size: 11.5px !important;
    color: #475569 !important;
    font-weight: 500 !important;
    margin: 0 0 2px 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

/* 1. ソートブロック */
.sort-action-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
}

.sort-action-group .sort-select {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    line-height: 28px !important;
    font-size: 13px !important;
    padding: 0 8px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 5px !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 180px !important;
    max-width: 220px !important;
    margin: 0 !important;
    color: var(--text-color);
    cursor: pointer;
}

.sort-select:focus {
    border-color: #4085ad;
}

/* 2. 文字色ブロック */
.color-priority-control {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    flex: 0 0 auto !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
}

.color-priority-buttons {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    height: 30px !important;
    box-sizing: border-box !important;
}

.color-priority-buttons button,
.color-priority-control button {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    line-height: 28px !important;
    font-size: 12.5px !important;
    padding: 0 10px !important;
    border: 1px solid #aebdca !important;
    border-radius: 4px !important;
    background: #f5f8fa !important;
    color: #263746 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
}

.color-priority-buttons button:hover,
.color-priority-control button:hover {
    background: #e4f1f8 !important;
    border-color: #6f9db8 !important;
}

.color-priority-buttons button.active,
.color-priority-control button.active {
    background-color: #285f88 !important;
    color: #ffffff !important;
    border-color: #1e4767 !important;
}

/* 3. メタ情報ブロック: 最新保存時刻 ＋ 集計サマリー */
.meta-info-control {
    display: flex !important;
    align-items: center !important;
    height: 30px !important;
    gap: 16px !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    white-space: nowrap !important;
}

#saveTimeDisplay {
    font-size: 12px !important;
    color: #555555 !important;
    white-space: nowrap !important;
    line-height: 30px !important;
}

.money-summary-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 5px !important;
    padding: 0 8px !important;
    height: 30px !important;
    box-sizing: border-box !important;
}

.money-summary-wrap .summary-divider {
    color: #94a3b8;
    margin: 0 1px;
}

.money-summary-wrap .summary-label {
    font-size: 11.5px;
    color: #475569;
}

.sort-execute-button:hover,
#saveAllButton:hover {
    background: #e4f1f8;
    border-color: #6f9db8;
}

/* タブヘッダー */
.tab-navigation {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #0078d4;
    padding-left: 6px;
}

.tab-button {
    background: #e3edf7;
    border: 1px solid #b8d0e8;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    white-space: nowrap;
    padding: 5px 12px;
    font-size: 0.85em;
    font-weight: 600;
    color: #334e68;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tab-button:hover {
    background: #d0e2f5;
    color: #102a43;
}

.tab-button.active {
    background: #ffffff;
    border-color: #0078d4;
    border-top: 2px solid #0078d4;
    color: #0078d4;
    padding-bottom: 6px;
    margin-bottom: -2px;
}

/* タブコンテンツパネル */
.tab-content-panel {
    background: #ffffff;
    border: 1px solid #b8d0e8;
    border-top: none;
    border-left: 2px solid #0078d4;
    border-right: 2px solid #0078d4;
    border-bottom: 2px solid #0078d4;
    border-radius: 0 0 6px 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    display: none;
    width: max-content;
    min-width: 100%;
    min-height: 83px;
    max-width: none;
    box-sizing: border-box;
}

.tab-content-panel.active {
    display: block;
}

/* 検索タブ内の整列 */
.search-tab-content {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    width: max-content;
    position: relative;
    top: 3px;
    gap: 6px 10px;
}

.search-tab-content select,
.search-tab-content input[type="text"] {
    padding: 3px 6px;
    font-size: 0.88em;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.search-tab-content button {
    box-sizing: border-box;
    height: 26px;
    padding: 2px 10px;
    border: 1px solid #aebdca;
    border-radius: 3px;
    background: #f5f8fa;
    color: #263746;
    font-size: 0.85em;
    line-height: 1.2;
    cursor: pointer;
}

.search-tab-content button:hover:not(:disabled) {
    background: #e4f1f8;
    border-color: #6f9db8;
}

.search-tab-content button:disabled {
    color: #8c98a3;
    cursor: not-allowed;
    opacity: 0.65;
}

.residual-warning-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    position: relative;
    margin-top: 6px;
    top: 4px;
    font-size: 0.85em;
    white-space: nowrap;
}

.residual-warning-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

#unopenedQuantityWarningThreshold,
#residualRateWarningThreshold {
    width: 48px;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 0.88em;
    box-sizing: border-box;
    text-align: right;
}

/* 新在庫追加フォームのグリッド整列 */
.add-form-container {
    display: flex;
    flex-direction: column;
    width: max-content;
    gap: 6px;
    position: relative;
    top: 3px;
}

.form-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px 10px;
}

.form-row + .form-row {
    position: relative;
    top: 3px;
}

.form-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.88em;
}

.form-item label {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.form-item select,
.form-item input {
    padding: 3px 5px;
    font-size: 0.88em;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#itemExpiryDate {
    width: 93px;
    height: 22px;
    box-sizing: border-box;
    font-size: 1em;
}

#itemLocation {
    width: 198px;
    box-sizing: border-box;
}

#itemCategory {
    width: 120px;
    box-sizing: border-box;
}

#itemName {
    width: 150px;
    box-sizing: border-box;
}

#itemQuantity {
    width: 67px;
    box-sizing: border-box;
}

/* ファイル・データ管理タブ内の整列 */
.management-tab-content {
    display: flex;
    flex-direction: column;
    width: max-content;
    gap: 8px;
    position: relative;
    top: 2px;
}

.management-group {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
    flex-shrink: 0;
    gap: 6px 8px;
}

.management-group-title {
    font-size: 0.88em;
    font-weight: 500;
    color: #333;
    width: 130px;
    min-width: 130px;
    padding-right: 8px;
    border-right: 2px solid #d9e2ec;
    box-sizing: border-box;
}

/* ファイル・データ管理タブ内のボタン幅を最大文字数に合わせて統一 */
.management-tab-content .custom-button {
    width: 165px;
    height: 26px;
    font-size: 13px;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
}

/* 上部管理tipは下部のテーマカラー定義に統合 */

.management-tab-content .maintenance-button {
    background-color: #58736F;
}

.danger-button,
.management-tab-content .danger-button,
.management-group .danger-button {
    background-color: #ffffff !important;
    color: #dc2626 !important;
    border: 1px solid #dc2626 !important;
    font-weight: 700 !important;
}
.danger-button:hover,
.management-tab-content .danger-button:hover,
.management-group .danger-button:hover {
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #b91c1c !important;
}
.danger-button:active,
.management-tab-content .danger-button:active,
.management-group .danger-button:active {
    background-color: #fee2e2 !important;
}

/* --- money-lists.html スマホ縦モード（削除で改行・2段カード型レイアウト） --- */
@media (max-width: 600px) {
    .list-page-container {
        padding: 10px 8px 30px !important;
        overflow-x: hidden !important;
    }

    /* 新しい項目の追加フォーム */
    .form-section {
        padding: 10px 10px 12px !important;
        margin-bottom: 14px !important;
    }

    .form-section h2, .list-section h2 {
        font-size: 15px !important;
        margin-bottom: 10px !important;
    }

    .form-section .add-form-row {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        align-items: center !important;
        margin-bottom: 10px !important;
    }

    .form-section .add-form-row label {
        width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 100% !important;
        display: flex !important;
        justify-content: flex-start !important;
        gap: 2px !important;
        padding-right: 0 !important;
        font-size: 13px !important;
        margin-bottom: 2px !important;
    }

    .form-section .add-form-row input[type="text"] {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        height: 32px !important;
        font-size: 13px !important;
    }

    .form-section .add-form-row .custom-button {
        flex: 0 0 auto !important;
        height: 32px !important;
        padding: 0 14px !important;
        font-size: 13px !important;
    }

    /* ソートセクション */
    .sort-section {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        margin-top: 14px !important;
        border-radius: 6px 6px 0 0 !important;
    }

    .sort-section div:first-child {
        width: 100% !important;
        height: auto !important;
        padding: 5px 8px !important;
        border-right: none !important;
        border-bottom: 1px solid #b8d0e8 !important;
        font-size: 12px !important;
        justify-content: flex-start !important;
    }

    .sort-buttons {
        padding: 4px 6px !important;
        gap: 4px !important;
    }

    .sort-buttons button {
        padding: 3px 6px !important;
        font-size: 10.5px !important;
    }

    /* リスト一覧テーブル */
    .list-table-wrapper {
        overflow: visible !important;
        border-radius: 0 0 6px 6px !important;
        margin-bottom: 18px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .list-table {
        display: block !important;
        width: 100% !important;
    }

    .list-table thead {
        display: none !important;
    }

    .list-table tbody {
        display: block !important;
        width: 100% !important;
    }

    .list-table tr {
        display: grid !important;
        grid-template-columns: 24px 1fr auto auto !important;
        grid-template-rows: auto auto !important;
        align-items: center !important;
        padding: 7px 6px !important;
        border-bottom: 1px solid #e3edf7 !important;
        box-sizing: border-box !important;
        width: 100% !important;
        row-gap: 5px !important;
        column-gap: 4px !important;
    }

    /* 1段目: No, 項目名, 件数, 削除 */
    .list-table th:nth-child(1),
    .list-table td:nth-child(1) {
        grid-column: 1 / 2 !important;
        grid-row: 1 !important;
        width: auto !important;
        text-align: center !important;
        font-size: 11px !important;
        color: #718096 !important;
        padding: 0 !important;
        line-height: 1.2 !important;
    }

    .list-table th:nth-child(2),
    .list-table td:nth-child(2) {
        grid-column: 2 / 3 !important;
        grid-row: 1 !important;
        min-width: 0 !important;
        width: auto !important;
        text-align: left !important;
        font-size: 13.5px !important;
        font-weight: 700 !important;
        padding: 0 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .list-table th:nth-child(3),
    .list-table td:nth-child(3) {
        grid-column: 3 / 4 !important;
        grid-row: 1 !important;
        width: auto !important;
        text-align: right !important;
        font-size: 11px !important;
        color: #4a5568 !important;
        padding: 0 4px !important;
        white-space: nowrap !important;
    }

    .list-table td:nth-child(3)::after {
        content: "件";
        font-size: 10px;
        margin-left: 1px;
        color: #718096;
    }

    .list-table th:nth-child(4),
    .list-table td:nth-child(4) {
        grid-column: 4 / 5 !important;
        grid-row: 1 !important;
        width: auto !important;
        text-align: right !important;
        padding: 0 !important;
        justify-self: end !important;
    }

    .del-btn, .transfer-btn {
        height: 24px !important;
        padding: 2px 8px !important;
        font-size: 11px !important;
        border-radius: 4px !important;
    }

    /* 2段目: 文字色(左) ＋ 順序ボタン(常に右寄せ) */
    .list-table th:nth-child(5),
    .list-table td:nth-child(5) {
        grid-column: 1 / 3 !important;
        grid-row: 2 !important;
        width: auto !important;
        text-align: left !important;
        padding: 0 0 0 24px !important;
        display: flex !important;
        align-items: center !important;
    }

    .list-table th:nth-child(6),
    .list-table td:nth-child(6) {
        grid-column: 3 / 5 !important;
        grid-row: 2 !important;
        width: auto !important;
        text-align: right !important;
        padding: 0 !important;
        justify-self: end !important; /* カラー有無に関わらず常に右寄せ！ */
    }

    .list-color-settings {
        gap: 3px !important;
    }

    .classic-color-swatch {
        width: 17px !important;
        height: 17px !important;
        min-width: 17px !important;
    }

    .list-color-enable {
        font-size: 10.5px !important;
        margin-left: 2px !important;
    }

    .order-btn-group {
        display: inline-flex !important;
        gap: 2px !important;
    }

    .order-btn {
        width: 29px !important;
        height: 23px !important;
        font-size: 9.5px !important;
        padding: 0 !important;
    }
}



/* --- money-ledger.css PC基本レイアウト --- */
:root {
    --primary-bg: #f3f5f6;
    --header-bg: #aa525b;        /* 表ヘッダー用（少し薄く柔らかいローズボルドー） */
    --dark-header-bg: #5a232b;    /* 濃色最上段ヘッダー */
    --hover-bg: #fbe9e7;
    --button-bg: #b84f50;
}

/* ボタンの改行防止（全ボタンnowrap統一） */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.custom-button,
.tab-button {
    white-space: nowrap !important;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--primary-bg);
    min-width: 1000px;
}

.main-container {
    padding: 8px 12px 30px;
    box-sizing: border-box;
    min-width: 1000px;
}

/* ヘッダー・タイトルバー（濃赤・ワインテーマ） */
.app-header {
    background-color: var(--dark-header-bg);
    color: #ffffff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 10px;
    min-width: 1000px;
    box-sizing: border-box;
}

.app-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap !important;
    flex-shrink: 0;
}

.app-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.app-subtitle {
    font-size: 13px;
    opacity: 0.9;
    color: #ffd8dc;
}

.app-title a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}
.app-title-main,
.app-title-tag {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    display: inline;
}
.subtitle-line1,
.subtitle-line2 {
    display: inline;
}
.subtitle-line1::after {
    content: " ";
}

.header-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

.header-links a,
.header-links .current-app {
    color: #ffffff !important;
    font-size: 13px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
    line-height: 1 !important;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 9px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    height: 30px !important;
    transition: background 0.2s, border-color 0.2s;
}

.header-links a:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    text-decoration: none !important;
    color: #ffffff !important;
}

.header-links a.home-btn {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
}

.header-links .current-app {
    background: rgba(0, 0, 0, 0.28) !important;
    color: rgba(255, 255, 255, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    cursor: default !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

/* 5アプリのイメージカラー枠線＋総合TOPボタン（PC・スマホ共通） */
.header-links a.nav-zaiko {
    border: 1.5px solid #38bdf8 !important;
    background: rgba(56, 189, 248, 0.14) !important;
}
.header-links a.nav-recipe {
    border: 1.5px solid #34d399 !important;
    background: rgba(52, 211, 153, 0.14) !important;
}
.header-links a.nav-price {
    border: 1.5px solid #fbbf24 !important;
    background: rgba(251, 191, 36, 0.14) !important;
}
.header-links a.nav-money {
    border: 1.5px solid #fb7185 !important;
    background: rgba(251, 113, 133, 0.14) !important;
}
.header-links a.nav-wallet {
    border: 1.5px solid #c084fc !important;
    background: rgba(192, 132, 252, 0.16) !important;
}
.header-links a.home-btn {
    border: 1.5px solid rgba(255, 255, 255, 0.7) !important;
    background: rgba(255, 255, 255, 0.22) !important;
}

.header-links a.nav-zaiko:hover { background: rgba(56, 189, 248, 0.28) !important; border-color: #7dd3fc !important; }
.header-links a.nav-recipe:hover { background: rgba(52, 211, 153, 0.28) !important; border-color: #6ee7b7 !important; }
.header-links a.nav-price:hover { background: rgba(251, 191, 36, 0.28) !important; border-color: #fde68a !important; }
.header-links a.nav-money:hover { background: rgba(251, 113, 133, 0.28) !important; border-color: #fda4af !important; }
.header-links a.nav-wallet:hover { background: rgba(192, 132, 252, 0.3) !important; border-color: #d8b4fe !important; }
.header-links a.home-btn:hover { background: rgba(255, 255, 255, 0.34) !important; border-color: #ffffff !important; }

.header-links .current-app.nav-zaiko {
    border: 1.5px solid rgba(56, 189, 248, 0.45) !important;
}
.header-links .current-app.nav-recipe {
    border: 1.5px solid rgba(52, 211, 153, 0.45) !important;
}
.header-links .current-app.nav-price {
    border: 1.5px solid rgba(251, 191, 36, 0.45) !important;
}
.header-links .current-app.nav-money {
    border: 1.5px solid rgba(251, 113, 133, 0.45) !important;
}
.header-links .current-app.nav-wallet {
    border: 1.5px solid rgba(192, 132, 252, 0.45) !important;
}

.system-header-row h2 {
    color: #71313a;
}

.top-section-container {
    margin: 0;
}

.tab-navigation {
    border-bottom: 2px solid #b84f50 !important;
    display: flex !important;
    width: 100% !important;
    min-width: 1000px !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 4px;
    padding-left: 6px;
    padding-right: 6px;
    box-sizing: border-box;
    align-items: flex-end;
}

.tab-button,
.tab-manual-btn {
    background: #f5eeee !important;
    border: 1px solid #d8bfc2 !important;
    border-bottom: none !important;
    border-radius: 5px 5px 0 0 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 6px 14px 5px !important;
    font-size: 0.85em !important;
    font-weight: 600 !important;
    color: #5c3b3e !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    line-height: normal !important;
    box-sizing: content-box !important;
    text-decoration: none !important;
}

.tab-button:hover,
.tab-manual-btn:hover {
    background: #f3dddd !important;
    color: #4a2930 !important;
}

.tab-manual-btn {
    margin-left: auto !important;
}

.tab-button.active {
    background: #ffffff !important;
    border-color: #b84f50 !important;
    border-top: 2px solid #b84f50 !important;
    border-bottom: none !important;
    color: #9d3843 !important;
    padding: 6px 14px 7px !important;
    margin-bottom: -2px !important;
    position: relative !important;
    z-index: 2 !important;
}
.tab-button.management-help-anchor {
    position: relative;
}
.tab-button.management-help-anchor.help-visible::after {
    display: block !important;
    position: absolute;
    top: 50%;
    left: calc(100% + 8px);
    z-index: 1000;
    width: max-content;
    max-width: min(600px, calc(100vw - 420px));
    padding: 5px 9px;
    border: 1px solid #d8bfc2;
    border-radius: 6px;
    background: #ffffff;
    color: #263238;
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: normal;
    line-height: 1.35;
    opacity: 1;
    pointer-events: none;
    white-space: normal;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%);
    box-sizing: border-box;
    text-align: left !important;
}

.tab-content-panel {
    border-color: #d8bfc2;
    border-left-color: #b84f50;
    border-right-color: #b84f50;
    border-bottom-color: #b84f50;
}

.search-tab-content button:hover:not(:disabled) {
    border-color: #bd7278;
    background: #fbe9e7;
}

#money-transactions th {
    background-color: var(--header-bg);
    padding: 3px 1px;
}

#money-transactions .money-amount,
#month-total,
#record-count {
    color: #71313a;
}

#pending-total {
    color: #9a5a00;
}

:focus-visible {
    outline-color: #b84f50;
}

#money-transactions {
    width: 100%;
    min-width: 1320px;
    table-layout: fixed;
    margin-top: 6px;
}

#money-transactions th:nth-child(1) { width: 34px; }
#money-transactions th:nth-child(2) { width: 105px; }
#money-transactions th:nth-child(3) { width: 11%; }
#money-transactions th:nth-child(4) { width: 7%; }
#money-transactions th:nth-child(5) { width: 62px; }
#money-transactions th:nth-child(6) { width: 34px; }
#money-transactions th:nth-child(7) { width: 72px; }
#money-transactions th:nth-child(8) { width: 9%; }
#money-transactions th:nth-child(9) { width: 9%; }
#money-transactions th:nth-child(10) { width: 7%; }
#money-transactions th:nth-child(11) { width: 7%; }
#money-transactions th:nth-child(12) { width: 105px; }
#money-transactions th:nth-child(13) { width: 34px; }
#money-transactions th:nth-child(14) { width: 34px; }
#money-transactions th:nth-child(15) { width: 15%; }
#money-transactions th:nth-child(16) { width: 44px; }

.pool-income-section {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fffafa;
    border: 1px solid #e8d0d2;
    border-radius: 6px;
    max-width: 980px;
}

.pool-income-section h3 {
    margin: 0 0 8px 0;
    font-size: 13.5px;
    font-weight: 700;
    color: #5c282c;
}

#pool-income-form {
    margin-bottom: 10px;
}

#pool-income-form .form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#pool-income-form .form-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

#pool-income-form input,
#pool-income-form select {
    height: 24px;
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    box-sizing: border-box;
}

#pool-income-date {
    width: 125px;
}

#pool-income-payer {
    min-width: 95px;
}

#pool-income-amount {
    width: 85px;
}

#pool-income-form .form-item:has(#pool-income-memo) {
    flex: 1;
    min-width: 140px;
}

#pool-income-memo {
    width: 100%;
    min-width: 120px;
}

.money-income-table {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

.money-income-table th {
    background-color: var(--header-bg) !important;
    color: #ffffff !important;
    padding: 3px 2px !important;
    font-size: 13px !important;
    text-align: center !important;
    white-space: nowrap !important;
    border: 1px solid #994750 !important;
    box-sizing: border-box !important;
}

/* 1. No: 3桁でいい (30px) */
.money-income-table th:nth-child(1),
.money-income-table td:nth-child(1) {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    text-align: center !important;
    padding: 3px 2px !important;
    box-sizing: border-box !important;
}

/* 2. 加算日: パディングひろすぎるを解消 (78px) */
.money-income-table th:nth-child(2),
.money-income-table td:nth-child(2) {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    text-align: center !important;
    padding: 3px 2px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

/* 3. 支払者: (68px) */
.money-income-table th:nth-child(3),
.money-income-table td:nth-child(3) {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    text-align: center !important;
    padding: 3px 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
}

/* 4. 金額: 6桁が入ればいい (64px) */
.money-income-table th:nth-child(4),
.money-income-table td:nth-child(4) {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    text-align: right !important;
    padding: 3px 3px !important;
    white-space: nowrap !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums !important;
    box-sizing: border-box !important;
}

/* 5. メモ: 1/3でいい (140px) */
.money-income-table th:nth-child(5),
.money-income-table td:nth-child(5) {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    text-align: left !important;
    padding: 3px 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
}

/* 6. 残高: 金額と同様6桁 (64px) */
.money-income-table th:nth-child(6),
.money-income-table td:nth-child(6) {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    text-align: right !important;
    padding: 3px 3px !important;
    white-space: nowrap !important;
    font-weight: 700 !important;
    font-variant-numeric: tabular-nums !important;
    color: #71313a !important;
    box-sizing: border-box !important;
}

/* 7. 操作: 削除ボタン (44px) */
.money-income-table th:nth-child(7),
.money-income-table td:nth-child(7) {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    text-align: center !important;
    padding: 3px 1px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.money-income-table tbody td {
    padding: 3px 3px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    border: 1px solid #d8bfc2 !important;
    box-sizing: border-box !important;
}

.money-income-table tbody tr:hover {
    background-color: #fff2f2 !important;
}

.pool-slots-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    vertical-align: middle;
}

.pool-slot-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px;
    background: #fff8f8;
    border: 1px solid #e0c8c8;
    border-radius: 4px;
    font-size: 12px;
}

.pool-slot-select {
    height: 22px;
    padding: 0 4px;
    border: 1px solid #d0b0b0;
    border-radius: 3px;
    background: #ffffff;
    font-size: 11.5px;
    color: #4a282b;
    cursor: pointer;
}

.pool-slot-amount {
    font-weight: 700;
    color: #8f3d46;
    margin-left: 2px;
}

.money-table-scroll {
    width: 100%;
    max-width: none;
    overflow-x: visible;
}

#money-transactions tbody td {
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
}

#money-transactions tbody tr:hover {
    background-color: var(--hover-bg);
}

#money-transactions .money-amount {
    text-align: right;
    font-weight: bold;
    white-space: nowrap;
}

#money-transactions .row-action-cell {
    position: relative;
    width: 44px;
    min-width: 44px;
    padding: 1px 2px;
    white-space: nowrap;
    text-align: center;
}

#money-transactions .row-action-trigger {
    min-width: 32px;
    height: 20px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid #767676;
    border-radius: 2px;
    background: #f0f0f0;
    color: #000;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}

#money-transactions .row-action-menu,
.row-action-menu {
    position: fixed;
    z-index: 100000;
    box-sizing: border-box;
    display: none;
    min-width: 72px;
    padding: 3px;
    border: 1px solid #8aaec4;
    border-radius: 3px;
    background: #e6f5ff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

#money-transactions .row-action-menu.open,
.row-action-menu.open {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#money-transactions .row-action-menu button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 20px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid #767676;
    border-radius: 2px;
    background: #f0f0f0;
    color: #000;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}

#money-transactions .row-action-menu button:hover {
    background: #e5e5e5;
    border-color: #4f4f4f;
}

#money-transactions .row-action-menu button.money-row-delete {
    color: red;
}

#money-transactions .money-row-action {
    padding: 2px 3px;
    font-size: 11px;
}

#money-transactions .money-inline-input,
#money-transactions .money-inline-select {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 24px;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 2px;
    color: inherit;
    background: #fff;
    font-size: 13px;
}

#money-transactions .money-inline-input:hover,
#money-transactions .money-inline-select:hover {
    border-color: #d3a5a8;
    background: #fffafa;
}

#money-transactions .money-inline-input:focus,
#money-transactions .money-inline-select:focus {
    border-color: #b84f50;
    background: #fff;
}

#money-transactions .money-inline-amount {
    width: 100%;
    max-width: 100%;
    text-align: right;
    appearance: textfield;
    -moz-appearance: textfield;
}

#money-transactions .money-inline-amount::-webkit-inner-spin-button,
#money-transactions .money-inline-amount::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#money-transactions input[data-field="expenseDate"],
#money-transactions input[data-field="recoveryDate"] {
    width: 100%;
    max-width: 100%;
    min-height: 24px;
    padding: 1px 2px;
    font-size: 13px;
    box-sizing: border-box;
}

#amount {
    width: 78px;
    max-width: 78px;
}

#money-transactions .money-inline-memo {
    width: 100%;
    min-width: 0;
    text-align: left;
}

#money-transactions .money-memo-cell {
    min-width: 162px;
    padding: 2px 4px !important;
    text-align: left;
}

#money-transactions th:first-child,
#money-transactions td:first-child {
    box-sizing: border-box;
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    padding-right: 2px;
    padding-left: 2px;
}

#money-transactions td.money-cell-changed {
    background-color: #ffb347;
}

#money-transactions td.money-row-number-changed {
    background-color: #ffb347;
    color: #6b3a00;
    font-weight: bold;
}

#saveAllButton {
    box-sizing: border-box;
    height: 26px;
    padding: 2px 10px;
    border: 1px solid #aebdca;
    border-radius: 3px;
    background: #f5f8fa;
    color: #263746;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap !important;
}

#saveAllButton:hover {
    background: #e4f1f8;
    border-color: #6f9db8;
}

#saveAllButton.has-unsaved-changes {
    background-color: orange;
    color: #111;
}

.money-row-action {
    border: 1px solid #767676;
    border-radius: 2px;
    background: #f0f0f0;
    color: #000;
    cursor: pointer;
}

.money-row-action:hover {
    background: #e5e5e5;
    border-color: #4f4f4f;
    color: #000;
}

.money-row-delete {
    color: red !important;
}

.money-status {
    display: inline-block;
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
}

.money-status-pending {
    border-color: #d8b36d;
    color: #80500b;
    background: #fff1d4;
}

.money-status-done {
    border-color: #89b6aa;
    color: #28675e;
    background: #e5f3ef;
}

.money-status-none {
    background: #f5f8fa;
}

.money-recovery-detail {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    white-space: nowrap;
}

.money-recovery-toggle {
    display: inline-flex;
    min-width: 16px;
    min-height: 16px;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    padding: 0;
    margin: 0;
}

.money-recovery-toggle input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: #28675e;
    cursor: pointer;
}

#money-transactions td:has(.money-recovery-toggle) {
    padding: 2px 0;
}

.money-recovery-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.money-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#month-total,
#pending-total,
#record-count {
    color: #71313a;
}

#pending-total {
    color: #9a5a00;
}

.money-storage-note {
    margin: 6px 0 0;
    font-size: 12px;
    text-align: center;
}

.money-list-table th:nth-child(5) {
    white-space: nowrap;
}

#appNotice {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10000;
}

.money-search-content {
    gap: 6px;
}

.search-tab-content.money-search-content {
    align-items: center;
}
.search-tab-content.money-search-content label {
    font-size: 14.08px !important;
    line-height: 20px;
}
.search-tab-content.money-search-content input,
.search-tab-content.money-search-content select {
    box-sizing: border-box;
    height: 26px;
    min-height: 26px;
    padding: 3px 5px;
    font-size: 12.39px;
    line-height: 1.2;
}
.search-tab-content.money-search-content button {
    box-sizing: border-box;
    height: 26px;
    min-height: 26px;
    padding: 2px 10px;
    border: 1px solid #aebdca;
    border-radius: 3px;
    background: #f5f8fa;
    color: #263746;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap !important;
}
.search-tab-content.money-search-content #search-button {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
    font-weight: 600;
}
.search-tab-content.money-search-content #search-button:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1e40af;
}
.search-tab-content.money-search-content button:hover:not(:disabled) {
    background: #e4f1f8;
    border-color: #6f9db8;
}
.search-tab-content.money-search-content button:disabled {
    color: #8c98a3;
    cursor: not-allowed;
    opacity: 0.65;
}
.search-tab-content.money-search-content #search-filter {
    font-size: 12.39px !important;
}

.money-search-pool-summary {
    margin-top: 9px;
    padding: 3px 0;
    color: var(--text-color);
    font-size: 0.9em;
}
.money-search-pool-summary strong {
    color: #71313a;
}

.add-form-container .form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.add-form-container .form-item {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.add-form-container .form-item input,
.add-form-container .form-item select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.money-storage-info {
    margin-top: 20px;
    padding: 10px;
    border-top: 1px solid #ccc;
    text-align: center;
}

.pool-income-section {
    margin-top: 14px;
    padding-top: 8px;
    border-top: 2px solid var(--header-bg);
}



.money-search-content input[type="month"] {
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 24px;
    min-height: 24px;
    box-sizing: border-box;
    font-size: 12.39px;
}




/* ==========================================================================
   強制PCモード（ウィンドウを縮めてもPCスタイル・横スクロールを死守する保護レイアウト）
   ========================================================================== */
html.force-pc-mode,
body.force-pc-mode {
    min-width: 1000px !important;
    max-width: none !important;
    width: auto !important;
    overflow-x: visible !important;
}

html.force-pc-mode body,
body.force-pc-mode .main-container,
body.force-pc-mode .app-header {
    min-width: 1000px !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

body.force-pc-mode .app-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    padding: 10px 20px !important;
}

body.force-pc-mode .app-title-group {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: auto !important;
    white-space: nowrap !important;
}

body.force-pc-mode .app-title {
    display: block !important;
    line-height: normal !important;
}

body.force-pc-mode .app-subtitle {
    display: block !important;
    line-height: normal !important;
}

body.force-pc-mode .header-links {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
}

body.force-pc-mode .tab-navigation {
    display: flex !important;
    border-bottom: 2px solid var(--header-bg, #aa525b) !important;
    width: auto !important;
    min-width: 1000px !important;
}

body.force-pc-mode .tab-content-panel {
    min-width: 1000px !important;
    width: auto !important;
}

body.force-pc-mode .action-bar-container,
body.force-pc-mode .global-action-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-width: 1000px !important;
    white-space: nowrap !important;
}

body.force-pc-mode .mobile-detail-overlay,
body.force-pc-mode .mobile-detail-sheet {
    display: none !important;
}

/* ==========================================================================
   【PCモード統一】タブエリア（タブナビゲーション＋タブパネル内）ボタン統一スタイル
   ※タブの外（アクションバー・ヘッダー・テーブル等）には干渉しないようタブ内に完全限定
   ========================================================================== */

/* 1. タブナビゲーションボタン（フォント13.5px・太さ600・システムフォント統一） */
body:not(.force-mobile-mode) .tab-navigation .tab-button,
body:not(.force-mobile-mode) .tab-navigation .tab-manual-btn,
body:not(.force-mobile-mode) .tab-button,
body:not(.force-mobile-mode) .tab-manual-btn {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
}

/* 2. タブパネル内の全ボタン（データ管理・追加・検索パネル内：高さ26px・フォント13px・太さ600統一） */
body:not(.force-mobile-mode) .tab-content-panel button,
body:not(.force-mobile-mode) .tab-content-panel .custom-button,
body:not(.force-mobile-mode) .tab-content-panel a.custom-button,
body:not(.force-mobile-mode) .tab-content-panel input[type="button"],
body:not(.force-mobile-mode) .tab-content-panel input[type="submit"],
body:not(.force-mobile-mode) .management-tab-content .custom-button,
body:not(.force-mobile-mode) .management-group .custom-button,
body:not(.force-mobile-mode) .management-group a,
body:not(.force-mobile-mode) .management-group button,
body:not(.force-mobile-mode) .management-group label,
body:not(.force-mobile-mode) .search-tab-content button,
body:not(.force-mobile-mode) .search-tab-content .custom-button,
body:not(.force-mobile-mode) #tab-panel-search button,
body:not(.force-mobile-mode) #tab-panel-search #searchButton,
body:not(.force-mobile-mode) #tab-panel-search #outOfStockButton,
body:not(.force-mobile-mode) #tab-panel-search #clearFilterButton,
body:not(.force-mobile-mode) #tab-panel-add button,
body:not(.force-mobile-mode) #tab-panel-manage button,
body:not(.force-mobile-mode) #tab-search button,
body:not(.force-mobile-mode) #tab-add button,
body:not(.force-mobile-mode) #tab-manage button,
body:not(.force-mobile-mode) .form-section button,
body:not(.force-mobile-mode) .add-form-row .custom-button,
body:not(.force-mobile-mode) #addButton,
body:not(.force-mobile-mode) #scanButton,
body:not(.force-mobile-mode) #addButton2,
body:not(.force-mobile-mode) #compressButton,
body:not(.force-mobile-mode) #addPriceSubmitBtn,
body:not(.force-mobile-mode) #addWalletSubmitBtn,
body:not(.force-mobile-mode) #submit-record-button,
body:not(.force-mobile-mode) #searchButton,
body:not(.force-mobile-mode) #searchButtonNew,
body:not(.force-mobile-mode) #tabSearchButton,
body:not(.force-mobile-mode) #search-button,
body:not(.force-mobile-mode) #clearFilterButton,
body:not(.force-mobile-mode) #clearFilterButtonNew,
body:not(.force-mobile-mode) #tabClearFilterButton,
body:not(.force-mobile-mode) #clear-filters-button,
body:not(.force-mobile-mode) #outOfStockButton,
body:not(.force-mobile-mode) #tabExpiringButton {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
    height: 26px !important;
    min-height: 26px !important;
    line-height: 24px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    box-sizing: border-box !important;
}

/* 3. データ管理タブのグループタイトル（データ入出力、マスタ設定等：フォント12px・太さ600・高さ26px統一） */
body:not(.force-mobile-mode) .management-group-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    color: #333333 !important;
    width: 130px !important;
    min-width: 130px !important;
    height: 26px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding-right: 8px !important;
    border-right: 2px solid #d9e2ec !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    justify-content: flex-start !important;
    text-align: left !important;
    padding-left: 6px !important;
}

.transfer-btn {
    background: #e8f0fe;
    color: #1a56db;
    border: 1px solid #b9d5ff;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 4px;
}
.transfer-btn:hover:not(:disabled) {
    background: #dbeafe;
}
.transfer-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f1f3f4;
    color: #80868b;
    border-color: #dadce0;
}
.transfer-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}
.transfer-modal {
    background: #fff;
    border-radius: 8px;
    padding: 22px 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    color: #333;
    box-sizing: border-box;
    border: 1px solid #c8d6e5;
}
.transfer-modal h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
}
.transfer-modal p {
    margin: 0 0 14px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #444;
}
.transfer-modal-select {
    width: 100%;
    padding: 7px 10px;
    font-size: 13.5px;
    border: 1px solid #c8d6e5;
    border-radius: 4px;
    margin-bottom: 14px;
    box-sizing: border-box;
    background: #fff;
    color: #333;
}
.transfer-modal-check {
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    cursor: pointer;
    color: #444;
    user-select: none;
}
.transfer-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.transfer-modal-btn {
    padding: 6px 16px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    font-weight: 600;
}
.transfer-modal-cancel {
    background: #f1f2f6;
    color: #2f3542;
    border-color: #ced6e0;
}
.transfer-modal-cancel:hover {
    background: #e4e7eb;
}
.transfer-modal-exec {
    background: #1a56db;
    color: #fff;
    border-color: #1646b8;
}
.transfer-modal-exec:hover {
    background: #1545b3;
}
.app-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Excel風ヘッダー境界列幅リサイザー */
.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize !important;
    user-select: none;
    z-index: 120;
    background: transparent;
    transition: background-color 0.15s ease;
}

.col-resizer:hover,
.col-resizer.is-resizing {
    background-color: rgba(59, 130, 246, 0.7) !important;
}
