/* 共通のスタイル */
:root {
    --primary-bg: #add8e6;        /* ライトブルー（在庫側テーマカラー） */
    --header-bg: #4169e1;         /* 青色 */
    --dark-header-bg: #0d4a78;    /* 濃色ヘッダー */
    --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 {
    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: #e0f2fe;
}

.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;
}

: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,
.row-action-menu {
    position: fixed;
    z-index: 100000;
    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);
    box-sizing: border-box;
}

#inventory td .row-action-menu.open,
.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,
.row-action-menu button,
.row-action-menu a.history-button {
    width: 100%;
    margin: 0;
}

/* 操作メニュー内の区切り線 */
.row-action-menu .menu-divider {
    height: 1px;
    background-color: #b0cddf;
    margin: 2px 0;
}

/* 履歴記録トグル（操作ではなく設定項目としての外観・ピルスイッチ風） */
.row-action-menu .history-record-toggle,
#inventory td .history-record-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    height: 20px !important;
    padding: 0 4px !important;
    border-radius: 10px !important; /* ピル型で通常の角丸長方形操作ボタンと区別 */
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s !important;
}

.row-action-menu .history-record-toggle.enabled,
#inventory td .history-record-toggle.enabled {
    background-color: #e8f5e9 !important;
    color: #1b5e20 !important;
    border: 1.5px solid #4caf50 !important;
}

.row-action-menu .history-record-toggle.enabled:hover,
#inventory td .history-record-toggle.enabled:hover {
    background-color: #c8e6c9 !important;
    border-color: #388e3c !important;
}

.row-action-menu .history-record-toggle.disabled,
#inventory td .history-record-toggle.disabled {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    border: 1.5px solid #cbd5e1 !important;
}

.row-action-menu .history-record-toggle.disabled:hover,
#inventory td .history-record-toggle.disabled:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
}

.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,
#inventory td {
    padding: 2px 8px 2px 8px; /* データ行のパディング */
    line-height: 1.2;    /* 行間を最小にして要素の高さに合わせる */
    vertical-align: middle;
}

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

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

#inventory 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;
}

/* ホバー時の行背景色 */
#inventory tr:not(.separator-row):hover {
    background-color: var(--hover-bg);
}

.duplicate-popover {
    position: absolute;
    z-index: 9999;
    display: none;
    pointer-events: auto;
    width: max-content;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    padding: 8px 10px;
    background-color: #e6f5ff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    line-height: 1.4;
    color: #222;
    white-space: nowrap;
    transform: translateY(-100%);
    margin-top: -32px;
}

.duplicate-popover strong {
    display: block;
    margin-bottom: 4px;
}

.duplicate-popover-line {
    display: block;
    width: max-content;
    min-width: 100%;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.duplicate-popover-line:hover {
    background-color: #eaf4ff;
}

@keyframes duplicate-target-focus {
    0% {
        outline: 2px solid transparent;
        outline-offset: -2px;
    }
    35% {
        outline: 2px solid rgba(190, 30, 30, 0.95);
        outline-offset: -2px;
    }
    100% {
        outline: 2px solid transparent;
        outline-offset: -2px;
    }
}

@keyframes duplicate-target-cell-focus {
    0%, 100% {
        background-color: transparent;
    }
    35% {
        background-color: rgba(255, 150, 150, 0.9);
    }
}

#inventory tr.duplicate-target-focus {
    animation: duplicate-target-focus 1.6s ease-in-out;
}

#inventory tr.duplicate-target-focus td {
    border-color: transparent;
    background-color: rgba(255, 150, 150, 0.9) !important;
    transition: background-color 600ms ease-in-out;
}

#inventory tr.duplicate-target-fade td,
#inventory tr.duplicate-target-fade td {
    background-color: transparent !important;
}

/* 重複行のスタイル */
.duplicate-both {
    background-color: var(--duplicate-red);
}

.duplicate-name {
    background-color: var(--duplicate-yellow);
}

/* ペアハイライトのホバー効果 */
.pair-highlight.duplicate-both,
#inventory tr:hover.duplicate-both {
    background-color: var(--highlight-red) !important;
}

.pair-highlight.duplicate-name,
#inventory tr:hover.duplicate-name {
    background-color: var(--highlight-yellow) !important;
}

/* コントロール（並び替え等）のスタイル */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.update-rate-control {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    font-size: 0.9em;
    white-space: nowrap;
}

#updateRateDays {
    width: 36px;
    height: 26px;
    box-sizing: border-box;
    font-size: 13px;
    text-align: right;
}

#saveTimeDisplay {
    font-size: 0.9em;
}

#saveTimeValue {
    color: #0066cc;
    font-weight: bold;
}

#updateRateDisplay {
    color: #0066cc;
    font-weight: bold;
}

#updateRatePercent {
    display: inline-block;
    min-width: 48px;
    text-align: right;
}

#updateRateCount {
    display: inline-block;
    min-width: 86px;
    white-space: nowrap;
}

#updateRateNumerator,
#updateRateDenominator {
    display: inline-block;
    width: 32px;
    text-align: right;
}

.update-rate-slash {
    display: inline-block;
    width: 10px;
    text-align: center;
}

.legend {
    display: flex;
    gap: 10px;
}

.legend-table {
    border: none;
    width: auto; /* 自動幅 */
    white-space: nowrap;
}
.legend-table td {
    border: 1px solid #ddd;
    background-color: #fff;
    text-align: left; /* 左揃え */
    padding: 1px 5px; /* 余白調整 */
}
.legend-item {
    background-color: #ffffcc;
    padding: 2px 5px;
    display: inline-block;
}
.legend-item.second {
    background-color: #ffcccc;
}

.list-container {
    display: block;
    max-width: 800px; /* 画面が広くても横に伸びすぎないように制限 */
}

.list-table, .master-table {
    width: 85% !important;
    border: 1px solid #ccc !important;
    border-collapse: collapse !important;
    margin-top: 10px;
    margin-bottom: 30px;
}

.barcode-master-table {
    margin-top: 6px;
}

.list-table th, .list-table td,
.master-table th, .master-table td {
    border: 1px solid #ccc !important;
}
.list-table th, .master-table th {
    padding: 6px 12px; /* ヘッダは少し広めに */
}
.list-table td, .master-table td {
    padding: 3px 12px; /* データ行は詰め気味に */
}

/* customizeLists.html のテーブル行にマウスを当てた時の色 */
.list-table tr:hover td,
.master-table tr:hover td {
    background-color: #bce2ff !important;
}

/* customizeLists.html で項目（行）を選択した時のハイライト */
.list-table tr.selected,
.list-table tr.selected td {
    background-color: #90c2d4 !important; /* 背景色より少し濃い同系色のブルー */
}

#filterMessage {
    display: none;
    color: red; /* メッセージを赤色に */
}

/* 在庫テーブル内の入力・選択要素の高さと見た目を統一 */
#inventory td input,
#inventory td select {
    height: 20px;
    margin: 0;
    margin-bottom: 2px; /* セルの区切り線とドロップ・入力の下線の間に2pxの隙間をあける */
    padding: 0 4px;
    box-sizing: border-box; /* 枠線を含めた高さ計算にする */
    border: 1px solid var(--border-color);
    border-radius: 2px;
    vertical-align: middle;
}

#inventory td select.qty-input,
#inventory td select.small-input {
    text-align: right;
}

#inventory td select.qty-input.stock-empty {
    outline: 2px solid #c96f6f;
    outline-offset: -1px;
}

#inventory td input.usage-input.stock-empty {
    outline: 2px solid #c96f6f;
    outline-offset: -1px;
}

#inventory td input.mid-input.stock-empty {
    outline: 2px solid #c96f6f;
    outline-offset: -1px;
}

#inventory td input.purchase-input.stock-empty {
    outline: 2px solid #c96f6f;
    outline-offset: -1px;
}

#inventory td input.export-checkbox,
#inventory td input.history-checkbox {
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    margin: 0;
    vertical-align: middle;
    cursor: pointer;
}

#inventory td input.export-checkbox.stock-empty {
    accent-color: #d32f2f;
    outline: 2px solid #c96f6f;
    outline-offset: 1px;
    border-radius: 2px;
}

#inventory th.hist-record,
#inventory td.history-record-cell {
    text-align: center;
    white-space: nowrap !important;
}

.quantity-unit-inner,
.quantity-adjuster {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.quantity-unit-inner {
    gap: 3px;
    justify-content: center;
}

.quantity-unit-cell {
    min-width: 176px;
    white-space: nowrap;
}

.quantity-adjuster select.qty-input {
    width: 50px;
}

.quantity-unit-inner select.unit-input {
    width: 56px;
}

.quantity-adjuster {
    gap: 2px;
}

.numeric-adjuster {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

#inventory td button.quantity-adjust-button {
    width: 18px;
    min-width: 18px;
    height: 22px;
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: #333;
    background: #f2f4f7;
}

#inventory td button.quantity-adjust-button:disabled {
    opacity: 0.4;
    cursor: default;
}

#inventory td input.small-input {
    text-align: right;
}

/* 在庫テーブル内および操作メニュー内のボタン（デザインは標準、サイズのみ行に合わせる） */
#inventory td button,
#inventory td a.history-button,
.row-action-menu button,
.row-action-menu a.history-button {
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    text-decoration: none !important; /* 下線を強制的に消す */
    background-color: #f0f0f0;
    border: 1px solid #767676;
    border-radius: 2px;
    box-sizing: border-box;
    cursor: pointer;
    margin: 0;
    color: black !important;
}

#inventory td button {
    margin-right: 4px; /* テーブルセル内でのみ隣のボタンとの間に隙間 */
}

/* 履歴ボタンはリンク色を打ち消して黒にし、ホバー時も下線なし */
#inventory td a.history-button,
.row-action-menu a.history-button {
    color: black !important;
    text-decoration: none !important;
}

#inventory td .history-button:hover,
.row-action-menu .history-button:hover {
    background-color: #e5e5e5;
    border-color: #4f4f4f;
    text-decoration: none !important;
}

/* 削除ボタンは赤文字にする */
#inventory td button.delete-button,
.row-action-menu button.delete-button {
    color: red !important;
}

/* 未開封数量など、セレクトボックスを含むセルの幅設定 */
#inventory td:has(select), 
#inventory th:has(select) {
    min-width: 90px;
    white-space: nowrap;
}

/* 使用率列のスタイル */
td.usage-rate, th.usage-rate {
    white-space: nowrap;
}
td.usage-rate {
    width: 1%;
}
#inventory th.usage-rate {
    min-width: 64px;
}
#inventory td input.usage-input {
    width: 28px;
    padding-left: 1px;
    padding-right: 1px;
    text-align: right;
}
#inventory td input.purchase-input {
    width: 28px;
    padding-left: 1px;
    padding-right: 1px;
}
#inventory td input.usage-input,
#inventory td input.purchase-input {
    appearance: textfield;
}
#inventory td input.usage-input::-webkit-inner-spin-button,
#inventory td input.usage-input::-webkit-outer-spin-button,
#inventory td input.purchase-input::-webkit-inner-spin-button,
#inventory td input.purchase-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.usage-suffix {
    font-size: 0.8em;
}
#inventory tbody tr:not(.separator-row) td {
    padding: 0px 6px;
}

/* 購入数列の改行禁止（左から11番目の列） */
.purchase, .small-input0 {
    white-space: nowrap;
}

/* 備考・賞味期限列のスタイル */
td.memo, th.memo {
    min-width: 150px; /* 賞味期限以外は元の幅指定に戻す */
}
td.expiry-date, th.expiry-date {
    width: auto !important;
    white-space: nowrap !important; /* ヘッダもデータも絶対に改行させない */
}

#inventory td.expiry-date input[type="date"] {
    width: 103px;
    padding-left: 2px;
    padding-right: 2px;
    font-family: inherit;
    font-size: 13px;
}
#inventory td.expiry-date input[type="date"]::-webkit-datetime-edit {
    font-family: inherit;
    font-size: 13px;
}

/* 入力フィールドの幅調整 */
input.expiry-date {
    width: auto !important;
}

input[type="text"].memo {
    width: 150px; /* 賞味期限以外は元の幅指定に戻す */
}

/* 固定列（Sticky）の設定 */
th.sticky, td.sticky {
    position: sticky;
    z-index: 1; /* 前面に表示 */
    max-width: 200px; 
}

th.sticky-left, td.sticky-left {
    left: 0;
}

/* 「在庫量更新日時」(8列目) と 「更新/削除」(最後) を確実に改行禁止にする */
.sticky, #inventory th:nth-child(8), #inventory td:nth-child(8), #inventory th:last-child, #inventory td:last-child, th.expiry-date, td.expiry-date {
    white-space: nowrap !important;
}

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

.separator-row {
    line-height: 0 !important;
    height: 3px !important;
}

.separator-row td,
#inventory tbody tr.separator-row td {
    padding: 0 !important;
    height: 3px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    border: none !important;
    background-color: black !important;
}

.separator-row.separator-row--thick td,
#inventory tbody tr.separator-row.separator-row--thick td {
    height: 3px !important;
}

/* チェック済みアイテムのスタイル */
.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 (マスタ管理画面) 用スタイル --- */
.list-page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

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

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

.form-section {
    background: #fff;
    border: 1px solid #b8d0e8;
    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: #102a43;
    border-left: 4px solid #0078d4;
    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: #102a43;
    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: #0078d4;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-form-row .custom-button:hover {
    background-color: #005a9e;
}

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

.list-table-wrapper {
    background: #fff;
    border: 1px solid #b8d0e8;
    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 #e3edf7 !important;
    vertical-align: middle;
    box-sizing: border-box;
}

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

.list-table tr:hover td {
    background: #eef6fc !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 #b8d0e8;
    width: 100%;
    margin-top: 20px;
    background-color: #f5f8fa;
    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: #e3edf7;
    color: #102a43;
    height: 100%;
    border-right: 1px solid #b8d0e8;
    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 #aebdca;
    background: #fff;
    color: #263746;
    white-space: pre;
    line-height: 1.25;
    text-align: center;
    font-family: inherit;
}

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

.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: #102a43;
}

.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;
}

/* 常時表示のコントロールバー（ソート・文字色・最新保存時刻・更新率を横1行に完全集約） */
.global-action-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    background: #ffffff;
    padding: 6px 12px;
    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;
    box-sizing: border-box;
    width: 100%;
    overflow: visible !important;
    scrollbar-width: none !important;
}

.global-action-bar::-webkit-scrollbar {
    display: none !important;
}

.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追加タブのform-itemを完全再現） */
.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;
}

/* 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: 12px !important;
    font-weight: 500 !important;
    padding: 0 10px !important;
    border-radius: 5px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #334155 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    margin: 0 !important;
    transition: background-color 0.15s, border-color 0.15s;
}

.color-priority-buttons button[aria-pressed="true"],
.color-priority-control button[aria-pressed="true"],
.color-priority-control button.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

/* 3. メタ情報ブロック（最新保存時刻 ＋ 更新率） */
.meta-info-control {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    flex: 0 0 auto !important;
    gap: 2px !important;
    height: 48px !important;
    box-sizing: border-box !important;
    margin: 0 0 0 4px !important;
    padding: 0 !important;
    border: none !important;
}

#saveTimeDisplay {
    font-size: 11.5px !important;
    color: #64748b !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#saveTimeDisplay #saveTimeValue {
    color: #0284c7 !important;
    font-weight: 600 !important;
    margin-left: 2px !important;
}

.update-rate-control {
    font-size: 11.5px !important;
    color: #64748b !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    gap: 4px !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.update-rate-control input[type="number"] {
    width: 34px !important;
    height: 20px !important;
    text-align: center !important;
    font-size: 11px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

#updateRateDisplay {
    color: #0284c7 !important;
    font-weight: 600 !important;
}

/* タブヘッダー */
.tab-navigation {
    display: flex !important;
    width: 100% !important;
    min-width: 1000px;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 4px;
    border-bottom: 2px solid #0078d4;
    padding-left: 6px;
    padding-right: 6px;
    box-sizing: border-box;
    align-items: flex-end;
}

.tab-button,
.tab-manual-btn {
    background: #e3edf7;
    border: 1px solid #b8d0e8;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    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;
    text-decoration: none !important;
    box-sizing: border-box;
}

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

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

.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-checkbox-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.form-item-checkbox-box .checkbox-box-text {
    display: none;
}

.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;
}

.tab-button.management-help-anchor {
    position: relative;
}

.mobile-title-tip {
    display: none;
}

.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 #8aaec4;
    border-radius: 6px;
    background: #ffffff;
    color: #263746;
    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;
}

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

.danger-button {
    background-color: #d32f2f !important;
    color: #ffffff !important;
}
.danger-button:hover {
    background-color: #b71c1c !important;
}

/* Gemini API設定カード（他PJ統一デザイン） */
.api-key-card {
    background: #ffffff;
    border: 1px solid #b0c4de;
    border-left: 4px solid #0284c7;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 14px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.api-key-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.api-key-card .card-title {
    font-weight: 700;
    font-size: 14px;
    color: #0369a1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-status {
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-block;
    vertical-align: middle;
}

.badge-status.configured {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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


/* ==========================================================================
   強制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(--tab-border, #007bff) !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 {
    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: #222f3e;
    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;
}
