﻿body {
    margin: 0;
    padding: 0;
    background-color: #eef8f2; /* 上品で清潔感のある淡いミントセージ */
    font-size: 14px !important;
    min-width: 1000px;
}

body.force-mobile-mode {
    min-width: 0 !important;
}

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

body.force-mobile-mode .main-container {
    min-width: 0 !important;
}

/* ヘッダー・タイトルバー（濃緑テーマ） */
.app-header {
    background-color: #0d5f3a;
    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: #d1fae5;
}

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

.tab-navigation {
    display: flex !important;
    width: 100% !important;
    min-width: 1000px !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 4px;
    border-bottom: 2px solid #0d5f3a;
    padding-left: 6px;
    padding-right: 6px;
    position: relative;
    z-index: 1;
    align-items: flex-end;
}

.tab-navigation,
.tab-content-panel {
    min-width: 1000px;
    box-sizing: border-box;
}

.tab-button,
.tab-manual-btn {
    background: #d7f1e3;
    border: 1px solid #95d5b2;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    padding: 5px 12px;
    font-size: 13.6px;
    font-weight: 600;
    color: #084c2e;
    cursor: pointer;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tab-button:hover,
.tab-manual-btn:hover {
    background: #c2ebd4;
    color: #053b23;
}

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

.tab-button.active {
    background: #ffffff;
    border: 2px solid #0d5f3a;
    border-bottom: 2px solid #ffffff;
    color: #0d5f3a;
    padding-bottom: 6px;
    margin-bottom: -2px;
    position: relative;
    z-index: 2;
    cursor: default;
}

.tab-content-panel {
    display: none;
    background: #fff;
    border-width: 2px;
    border-style: solid;
    border-color: #0d5f3a;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
}

.tab-content-panel table,
.tab-content-panel th,
.tab-content-panel td {
    border: none;
}

.tab-content-panel table {
    margin-bottom: 0;
}

#tab-panel-search td {
    white-space: nowrap;
}

#tab-panel-search button {
    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;
    vertical-align: middle;
    white-space: nowrap !important;
}

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

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

.tab-content-panel input:not([type="file"]),
.tab-content-panel select,
.tab-content-panel textarea {
    border-radius: 4px;
}

body > table {
    border-radius: 0;
}

body > table:not(#inventory) {
    margin-bottom: 6px;
}

body > table#inventory {
    margin-top: 0;
}

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

table {
    border-collapse: collapse;
    border: 1px solid #ccc;
    width: 100%; /* テーブル全体の幅を100%に設定 */
    background-color: white; /* テーブルの背景色を白に設定 */
    margin-bottom: 30px; /* 下部に余白を追加して容量表示と離す */
}

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

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

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

th, td {
    min-width: 30px; /* 必要に応じて幅を調整 */
    line-height: 1.2; /* 行間を1.2に設定 */
    padding: 2px; /* パディングを減らしてスペースを詰める */
    border: 1px solid #ccc;
    font-size: 14px !important;
}

th {
    background-color: #2e8555; /* 柔らかいフォレストグリーン */
    color: white; /* テキストを白に設定 */
    cursor: pointer;
    font-size: 14px !important;
    text-align: center;
}

/* 在庫表示テーブルのホバー効果を追加 */
#inventory tr:hover {
    background-color: #d8f3e5; /* 優しいミントグリーンホバー */
}

/* 重複行のホバー効果を強調 */
.pair-highlight.duplicate-both,
#inventory tr:hover.duplicate-both {
    background-color: #ff9999 !important; /* 赤色を強調 */
}

.pair-highlight.duplicate-name,
#inventory tr:hover.duplicate-name {
    background-color: #ffff99 !important; /* 薄めの黄色を濃く */
}

/* 凡例のスタイルを追加 */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

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

.inventory-content {
    min-width: 810px;
}

.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;
    min-width: 810px;
    box-sizing: border-box;
    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;
    width: 100%;
    overflow: visible !important;
    scrollbar-width: none !important;
}

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

/* 保存ブロック */
.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 #cbd5e1 !important;
        background: #ffffff !important;
        color: #334155 !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: #f1f5f9 !important;
        border-color: #94a3b8 !important;
    }

    body:not(.force-mobile-mode) #sortExecuteButton:active,
    body:not(.force-mobile-mode) .sort-execute-button:active {
        background: #e2e8f0 !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 #cbd5e1 !important;
    background: #ffffff !important;
    color: #334155 !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: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

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

/* 共通ラベル（上ラベル化） */
.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: #263746 !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 12px !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: #0d5f3a !important;
    color: #ffffff !important;
    border-color: #0d5f3a !important;
}

/* 3. メタ情報ブロック（最新保存時刻 ＋ 購入計算リンク） */
.meta-info-control {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    gap: 12px !important;
    height: 30px !important;
    box-sizing: border-box !important;
    margin: 0 0 0 auto !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;
}

#finalCheckLink {
    height: 28px !important;
    line-height: 28px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    padding: 0 12px !important;
    border-radius: 5px !important;
    background: #0d5f3a !important;
    color: #ffffff !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s;
}

#finalCheckLink:hover {
    background: #09472b !important;
}

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

.legend-table {
    border: none;
    width: auto; /* コンテンツに合わせる */
}
.legend-table td {
    border: 1px solid #ddd;
    text-align: left; /* 左寄せ */
    padding: 2px 5px; /* 余白を少し狭く */
}
.legend-item {
    background-color: #ffffcc;
    padding: 2px 5px;
    display: inline-block;
}
.legend-item.second {
    background-color: #ffcccc;
}

#filterMessage {
    display: none;
    color: red; /* メッセージを目立たせるために色を設定 */
}

/* 新規追加と賞味期限の列のスタイルを追加 */
td.memo, th.memo {
    min-width: 198px !important; /* 備考欄の最小幅を設定 (+30% / 前回復帰比+10%) */
    width: auto !important; /* 画面・テーブル拡大時に余白を吸収してオート調整 */
}

td.recipe-name, th.recipe-name {
    min-width: 150px; /* レシピ名の最小幅を設定 */
}

/* 固定のスタイルを追加 */
th.sticky, td.sticky {
    position: sticky;
    z-index: 101 !important;
    max-width: 200px;
}

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

th.sticky-right, td.sticky-right {
    right: 0;
    min-width: 36px; /* 右固定列（操作メニュー） */
}

/* 操作列 ＆ ポップオーバー操作メニュー（wallet / zaiko / price 完全準拠） */
#inventory td.row-action-cell {
    position: relative;
    min-width: 36px;
    text-align: center;
    padding: 2px 2px;
}

#inventory td .row-action-trigger {
    min-width: 30px;
    height: 20px;
    padding: 0 4px;
    font-size: 11px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    background-color: #f0f0f0;
    border: 1px solid #767676;
    border-radius: 2px;
    box-sizing: border-box;
    cursor: pointer;
    color: black;
    margin: 0;
}

#inventory td .row-action-trigger:hover {
    background-color: #e5e5e5;
    border-color: #4f4f4f;
}

#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,
.row-action-menu button,
.row-action-menu a {
    width: 100%;
    height: 20px;
    padding: 0 6px;
    margin: 0;
    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;
    color: black !important;
}

#inventory td .row-action-menu button:hover,
#inventory td .row-action-menu a:hover,
.row-action-menu button:hover,
.row-action-menu a:hover {
    background-color: #e5e5e5;
    border-color: #4f4f4f;
    color: black !important;
}

#inventory td .row-action-menu button.delete-button,
.row-action-menu button.delete-button {
    color: red !important;
}

/* 一覧ヘッダー（No行）を単独固定追随 */
#inventory thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background-color: #2e8555 !important;
    opacity: 1;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 2px 4px !important;
    height: 22px !important;
    max-height: 22px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

.small-font {
    font-size: 14px !important;
}

/* 仕切り線のスタイル */
.separator-row td.separator-cell {
    padding: 0;
    height: 1px;
    font-size: 0 !important;
    line-height: 0;
    border: none;
    background-color: black;
}

.separator-row {
    line-height: 0;
}

.separator-row td {
    padding: 0;
    border: none;
}

/* `separator-row` を含む行全体の背景色を補助するため */
/* チェックされたアイテムのスタイル */
.checked-item {
    color: gray;
    text-decoration: line-through;
    background-color: #a9a9a9; /* ダークグレー */
}

/* 新在庫の追加の二行目の枠線の非表示にするスタイル */
.no-border {
    border: none;
}

/* 在庫表示 tbody のみセンターリング */
#inventory tbody td {
    text-align: center;
}

.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: 28px;
    font-size: 14px !important;
    background-color: #1b6b3e;
    color: white !important;
    border: none;
    border-radius: 4px;
    text-decoration: none !important;
    cursor: pointer;
    white-space: nowrap !important;
    box-sizing: border-box;
    line-height: normal;
    margin: 0;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.custom-button:hover {
    background-color: #14532d;
    color: white !important;
}

/* ファイル・データ管理タブ（全PJ共通レイアウト） */
.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,
.management-group .custom-button {
    width: 160px;
    height: 26px;
    font-size: 13px;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
}

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

.file-actions > .custom-button {
    width: 160px;
}

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

.label-box {
    display: flex;
    align-items: center;
    width: 8.5em;
    min-width: 8.5em;
    max-width: 8.5em;
    white-space: nowrap;
    height: 28px;
    font-size: 14px !important;
    font-weight: bold;
    box-sizing: border-box;
}

/* ローカルストレージ容量表示（zaikoに合わせてセンタリング） */
.storage-info {
    margin-top: 20px;
    padding: 10px;
    border-top: 1px solid #ccc;
    font-size: 14px !important;
    color: #666;
    text-align: center;
}

#storageInfo {
    text-decoration: none;
    color: inherit;
}

/* 入力欄のスタイル */
.small-input0 {
    width: 30px; /* 必要に応じて調整してください */
}

/* 入力欄のスタイル */
.small-input {
    width: 50px; /* 必要に応じて調整してください */
}

/* 入力欄のスタイル */
.small-input2 {
    width: 80px; /* 必要に応じて調整してください */
}

/* 入力欄のスタイル */
.small-input3 {
    width: 100px; /* 必要に応じて調整してください */
}
.quantity-field {
    width: 6em; /* 1.5倍（100などの数値も欠けずに表示） */
    text-align: right;
}

.recipe-number-stepper {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    white-space: nowrap;
}

.recipe-stepper-input {
    width: 26px;
    height: 22px;
    padding: 0 1px;
    text-align: right;
    box-sizing: border-box;
    appearance: textfield;
}

.recipe-stepper-input::-webkit-inner-spin-button,
.recipe-stepper-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.recipe-step-adjust-button,
.quantity-adjust-button {
    width: 18px;
    min-width: 18px;
    height: 22px;
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: #333;
    background: #f2f4f7;
    appearance: none;
    border: 1px solid #767676;
    border-radius: 2px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: none;
}

.recipe-step-adjust-button:hover:not(:disabled),
.quantity-adjust-button:hover:not(:disabled) {
    background-color: #e5e5e5;
    border-color: #4f4f4f;
}

.recipe-step-adjust-button:disabled,
.quantity-adjust-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.unit-field {
    width: 4em; /* 6バイト分 */
    text-align: left;
}

select {
    border: 1px solid #ccc;
}

input, textarea {
    border: 1px solid #ccc;
}

#inventory .unit-field {
    width: 3em;
}

#inventory input[type="number"],
#inventory .quantity-field {
    text-align: right;
}

.material-field {
    width: auto;
}

#itemName {
    width: 12em;
    flex: 0 0 12em;
}

.material-field,
.quantity-field,
.unit-field {
    box-sizing: border-box;
}

.material-input-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#itemCategory {
    width: 12em !important;
    height: 24px !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
    vertical-align: middle !important;
}

#itemUnit {
    width: 114px !important;
}

.material-field-group {
    display: grid;
    grid-template-columns: 6.5em 12em 4em 3em;
    align-items: center;
    column-gap: 8px;
    white-space: nowrap;
}

.material-field-group:nth-child(odd) {
    display: grid;
    grid-template-columns: 6.5em 156px 78px 42px;
    align-items: center;
    column-gap: 8px;
    white-space: nowrap;
}

.material-field-group:nth-child(even) {
    display: grid;
    grid-template-columns: 62px 156px 78px 42px;
    align-items: center;
    column-gap: 8px;
    white-space: nowrap;
}

.material-field-group:nth-child(even) label {
    text-align: right;
    padding-right: 4px;
    box-sizing: border-box;
    width: 62px;
}

.material-field-group.is-selected input {
    border-color: #008000 !important;
    background-color: #fff9c4;
}

.material-field-group label {
    text-align: right;
    padding-right: 4px;
    box-sizing: border-box;
}

.material-field-group input {
    width: 100% !important;
    height: 24px !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    padding: 2px 6px;
    font-size: 13px;
}

.material-field-group .unit-field {
    width: 100% !important;
}

#materialFields {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 2px 8px;
    margin-top: 2px;
}

#materialFields .material-field {
    width: 100%;
}



#addForm {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.add-form-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    width: max-content;
    gap: 6px 8px;
}

.add-form-row > label {
    flex: 0 0 6.5em;
    width: 6.5em;
    min-width: 6.5em;
    text-align: right;
    white-space: nowrap;
    padding-right: 4px;
    box-sizing: border-box;
}

#searchInput {
    width: 12em !important;
    height: 24px !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    padding: 2px 6px;
    font-size: 13px;
    margin: 0;
}

#materialFields br {
    display: block;
    content: "";
    height: 2px;
}

/* すべての入力・選択要素に対するフォーカス時の基本スタイル（レシピ名やメモ等も含む。※モーダル内は除外） */
input:not(.zainote-key-input):focus, 
select:not(.zainote-select-input):focus, 
textarea:focus {
    background-color: #fff9c4 !important;
    border: 1px solid #0078D4 !important;
    outline: none;
}

/* 素材名・数量・単位の3点セットを連動してハイライトさせる設定 */
/* 1. 新レシピ追加フォーム（固定部分）の連動 */
.material-input-group:focus-within .material-field,
.material-input-group:focus-within .quantity-field,
.material-input-group:focus-within .unit-field {
    background-color: #fff9c4 !important;
}

/* 2. 追加済み素材リスト（表側・動的生成部分）の連動 */
/* 生成される各行のコンテナ(div等)内のどれかにフォーカスがあれば、そのセットの背景をすべて変える */
#materialFields > div:focus-within input,
#materialFields > div:focus-within select {
    background-color: #fff9c4 !important;
}

/* 入力フォーム内のラベルとセレクトボックスを密着させる */
#addForm label, 
#addForm select {
    margin-right: 0 !important;
    margin-left: 0px !important;
}

.recipe-input-group {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 14px;
    margin-top: 6px;
    width: max-content;
}


.recipe-input-group .form-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.recipe-input-group .form-item label {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    width: auto !important;
    min-width: 0 !important;
    flex: none !important;
    text-align: left !important;
    padding-right: 0 !important;
    margin: 0 !important;
}

#addForm select,
.recipe-input-group .form-item select,
.recipe-input-group .form-item input {
    height: 24px !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    font-size: 13px !important;
    padding: 2px 6px;
}


#itemServings {
    width: 86px !important;
    text-align: center !important;
    padding: 0 4px !important;
    appearance: textfield !important;
    -moz-appearance: textfield !important;
}

#itemServings::-webkit-inner-spin-button,
#itemServings::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.recipe-input-group .form-item.form-item-location {
    gap: 8px !important;
}

.recipe-input-group .form-item.form-item-location label {
    width: 6.5em !important;
    min-width: 6.5em !important;
    max-width: 6.5em !important;
    flex: 0 0 6.5em !important;
    text-align: right !important;
    padding-right: 4px !important;
    box-sizing: border-box !important;
}

#itemLocation {
    width: 156px !important;
    height: 24px !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
}

#itemGenre {
    width: 113px !important;
}

#itemMemo {
    width: 195px;
}

#addForm button {
    box-sizing: border-box;
    height: 24px !important;
    padding: 0 10px;
    border: 1px solid #aebdca;
    border-radius: 3px;
    background: #f5f8fa;
    color: #263746;
    font-size: 13px;
    line-height: 22px;
    cursor: pointer;
    vertical-align: middle !important;
    white-space: nowrap !important;
    margin: 0;
}

#addForm button:hover:not(:disabled) {
    background: #e4f1f8;
    border-color: #6f9db8;
}

#addForm button:disabled {
    color: #8c98a3;
    cursor: not-allowed;
    opacity: 0.65;
}

textarea.recipe2,
textarea.memo2 {
    height: 44px !important;
    max-height: 44px !important;
    padding: 2px 3px !important;
    line-height: 1.35;
    overflow-y: auto;
}
textarea.recipe2, textarea.memo2 {
    width: 100%; /* セル幅の幅にフィット */
    height: auto; /* 行数に基づいて自動調整 */
    box-sizing: border-box; /* パディングとボーダーを含めて調整 */
    font-size: 14px !important;
    line-height: 1.35;
    overflow-wrap: break-word; /* 折り返しを許可 */
    word-break: break-word;
    word-wrap: break-word; /* 折り返しを許可（レガシー対応） */
    white-space: pre-wrap; /* 改行を保持しつつ折り返す */
}

#inventory td.memo textarea.memo2 {
    width: 100% !important;
}

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

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

.material-name {
    font-weight: bold;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.recipe-list {
    font-size: 14px !important;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
    display: none; /* 初期非表示 */
}
.material-name-cell {
    cursor: pointer;
    user-select: none;
}

/* テーブル全体のレイアウトを自動調整（コンテンツに合わせて伸縮） */
#inventory {
    table-layout: auto;
    width: 100%;
}

/* 3列目（人前）: 数値ステッパー（[-] 2 [+]）をコンパクトにセンタリング */
#inventory th:nth-child(3),
#inventory td:nth-child(3),
body.force-pc-mode #inventory th:nth-child(3),
body.force-pc-mode #inventory td:nth-child(3),
#inventory td.servings-cell {
    white-space: nowrap !important;
    text-align: center;
    min-width: 66px !important;
    width: 72px !important;
    max-width: 80px !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
}

#inventory td:nth-child(3) .recipe-number-stepper,
#inventory td.servings-cell .recipe-number-stepper {
    justify-content: center;
}

/* 4列目（ジャンル）: 1文字分削ってコンパクトに調整 */
#inventory th:nth-child(4),
#inventory td:nth-child(4),
body.force-pc-mode #inventory th:nth-child(4),
body.force-pc-mode #inventory td:nth-child(4) {
    white-space: nowrap !important;
    text-align: center;
    min-width: 96px !important;
    width: 101px !important;
    max-width: 106px !important;
}

#inventory td:nth-child(4) select,
body.force-pc-mode #inventory td:nth-child(4) select {
    width: 100% !important;
    min-width: 91px !important;
    max-width: 101px !important;
    font-size: 13px !important;
    padding: 2px 4px !important;
    box-sizing: border-box !important;
}

/* 各セルの折り返しを設定 */
#inventory th,
#inventory td {
    word-break: break-word;
    white-space: normal;
}

/* 5列目（素材名,数量,単位）: nowrapを維持する最小幅を確保し、他の列と同様にオートで幅調整 */
#inventory th:nth-child(5),
#inventory td:nth-child(5) {
    white-space: nowrap !important;
    text-align: center;
    width: auto !important;
}

body:not(.force-mobile-mode) #inventory th:nth-child(5),
body:not(.force-mobile-mode) #inventory td:nth-child(5) {
    min-width: 440px;
}

/* 5列目内の素材入力グリッドおよび各マス（罫線）のオート幅調整 */
#inventory .recipe-materials-grid {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: minmax(80px, 1fr) 4em 3em minmax(80px, 1fr) 4em 3em !important;
    grid-template-rows: repeat(4, auto) !important;
    box-sizing: border-box !important;
}

#inventory .recipe-materials-grid .material-field {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

#inventory .recipe-materials-grid .quantity-field {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    text-align: right !important;
}

#inventory .recipe-materials-grid .unit-field {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    text-align: left !important;
}

/* 6列目（更新日時）を2行（日付・時刻）で綺麗におさめる（左右パディングを詰めてコンパクト化） */
#inventory th:nth-child(6),
#inventory td:nth-child(6),
#inventory td.update-time-cell {
    white-space: nowrap !important;
    text-align: center;
    min-width: 86px;
    width: 86px;
    padding-left: 1px !important;
    padding-right: 1px !important;
    word-break: keep-all !important;
}

/* 5列目（素材名,数量,単位）のボックス内で、3つ目と4つ目の要素の間に仕切り線を追加（3+3の区切り） */
#inventory td:nth-child(5) > *:nth-child(3) {
    border-right: 3px solid #444 !important;
    padding-right: 0.5em; /* 仕切り線の左側に半文字分の隙間（nbsp代わり） */
    margin-right: 0.5em;  /* 仕切り線の右側に半文字分の隙間（nbsp代わり） */
    display: inline-block;
    vertical-align: middle;
}

/* --- customizeLists.html (マスタ管理画面) 用スタイル --- */
.right-align {
    text-align: right;
}

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

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

.container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
}

.form-container, .list-container {
    width: 100%;
    margin-bottom: 20px;
}

.form-container {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 0 20px;
    justify-content: start;
}

.form-container h2 {
    grid-column: 1 / 3;
    margin-bottom: 10px;
}

.form-container div {
    margin-bottom: 10px;
}

/* --- 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: #0d5f3a;
    text-decoration: none;
}

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

.form-section {
    background: #fff;
    border: 1px solid #c2ded0;
    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: #084c2e;
    border-left: 4px solid #0d5f3a;
    padding-left: 8px;
}

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

.form-section .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: #084c2e;
    font-size: 13px;
    white-space: nowrap;
    text-align: left !important;
}

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

.form-section .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: #1b6b3e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-section .add-form-row .custom-button:hover {
    background-color: #14532d;
}

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

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

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

.list-table tr:hover td {
    background: #eef9f3 !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 #c2ded0;
    width: 100%;
    margin-top: 20px;
    background-color: #f6fbf8;
    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: #d7f1e3;
    color: #084c2e;
    height: 100%;
    border-right: 1px solid #c2ded0;
    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 #95d5b2;
    background: #fff;
    color: #084c2e;
    white-space: pre;
    line-height: 1.25;
    text-align: center;
    font-family: inherit;
}

.sort-buttons button:hover {
    background: #d7f1e3;
    border-color: #0d5f3a;
}

.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: #084c2e;
}

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

/* テーブル内（操作列）の削除ボタンの文字を赤くする */
#inventory .delete-button {
    color: #ff4d4d !important;
    font-weight: bold;
}

/* ツールチップ（ポップオーバー）のスタイル */
.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-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; }

/* ==========================================================================
   強制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, #2e8555) !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モード: 参考アドレス（td.memo）設定
   PCではマウスオン（hover）で吹き出しチップを表示し、テキストエリア内にはボタンを置かない
   （スクロールバーやスクロールボタン▼との干渉を完全に防ぐ）
   ========================================================================== */
#inventory .url-open-btn,
.recipe-table .url-open-btn,
.memo-wrapper .url-open-btn,
body:not(.force-mobile-mode) #inventory .url-open-btn,
body:not(.force-mobile-mode) .recipe-table .url-open-btn,
body:not(.force-mobile-mode) .memo-wrapper .url-open-btn,
body.force-pc-mode #inventory .url-open-btn,
body.force-pc-mode .recipe-table .url-open-btn,
body.force-pc-mode .memo-wrapper .url-open-btn {
    display: none !important;
}

#inventory td.memo,
.recipe-table td.memo {
    position: relative !important;
}

#inventory .memo-wrapper,
.recipe-table .memo-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* ==========================================================================
   参考アドレス（td.memo）マウスオン時のその場チップ表示（ポップオーバー）
   ========================================================================== */
.memo-url-tooltip {
    position: fixed !important;
    z-index: 10000 !important;
    background: #0f172a !important;
    color: #f8fafc !important;
    padding: 7px 11px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35) !important;
    font-size: 11.5px !important;
    line-height: 1.35 !important;
    max-width: 340px !important;
    min-width: 160px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: opacity 0.15s ease !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

.memo-url-tooltip:hover {
    background: #1e293b !important;
    border-color: #38bdf8 !important;
}

.memo-tooltip-header {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin-bottom: 3px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding-bottom: 2px !important;
}

.memo-tooltip-icon {
    font-size: 13px !important;
}

.memo-tooltip-title {
    font-weight: 700 !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
}

.memo-tooltip-action {
    margin-left: auto !important;
    color: #38bdf8 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
}

.memo-tooltip-content {
    color: #e2e8f0 !important;
    font-size: 12px !important;
    word-break: break-all !important;
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
    text-decoration-color: rgba(56, 189, 248, 0.5) !important;
}

.memo-url-tooltip.arrow-bottom::after {
    content: "" !important;
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-width: 6px !important;
    border-style: solid !important;
    border-color: #0f172a transparent transparent transparent !important;
}

.memo-url-tooltip.arrow-top::after {
    content: "" !important;
    position: absolute !important;
    bottom: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-width: 6px !important;
    border-style: solid !important;
    border-color: transparent transparent #0f172a transparent !important;
}


/* 文字色設定コントロール (zaiko互換) */
.color-priority-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding-left: 8px;
    border-left: 1px solid #cbd5e1;
    white-space: nowrap;
}

.color-priority-control span {
    font-size: 0.85em;
    color: #475569;
}

.color-priority-control button {
    padding: 3px 9px;
    border: 1px solid #aebdca;
    border-radius: 4px;
    background: #f8fafc;
    color: #1e293b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
    transition: all 0.15s ease;
}

.color-priority-control button:hover {
    background: #f1f5f9;
}

.color-priority-control button.active {
    background-color: #0d5f3a;
    border-color: #0d5f3a;
    color: #fff;
}


/* ========================================================
   final_check 画面の表ごと個別横スクロール
   ======================================================== */
.finalcheck-table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    margin-bottom: 24px !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    scrollbar-width: thin !important;
}

.finalcheck-table-scroll::-webkit-scrollbar {
    height: 7px !important;
}

.finalcheck-table-scroll::-webkit-scrollbar-thumb {
    background: #a7f3d0 !important;
    border-radius: 4px !important;
}

.finalcheck-table-scroll::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
}

.finalcheck-table-scroll .inventory-table,
.finalcheck-table-scroll #purchaseListTable {
    min-width: 780px !important;
    width: max-content !important;
    border-collapse: collapse !important;
}

.finalcheck-table-scroll .recipe-summary-table {
    min-width: 480px !important;
    width: max-content !important;
    border-collapse: collapse !important;
}

/* Tooltip Help Anchor (zaiko / price準拠) */
.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 #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;
}

/* ==========================================================================
   【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;
}

/* 通知メッセージ（他PJ完全共通トースト） */
.app-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1b4d3e;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 100000;
    display: none;
}

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