﻿/* ==========================================================================
   ざいのーと [食材レシピ管理] スマホ縦画面（Portrait）専用スタイル
   ========================================================================== */


/* ==========================================================================
   スマホ表示最適化 (@media (max-width: 768px))
   ========================================================================== */
@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) {
    /* 1. PC固定幅の完全解除 & 全体の横スクロール防止 */
    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    body,
    .main-container,
    .app-header,
    .tab-navigation,
    .tab-content-panel {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
        font-size: 14px !important;
    }

    .main-container {
        padding: 6px 8px 30px !important;
        overflow-x: hidden !important;
    }

    /* 2. ヘッダー */
    .app-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 10px 12px !important;
        gap: 8px !important;
        white-space: normal !important;
    }

    .app-title-group {
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        grid-template-rows: auto auto !important;
        align-items: center !important;
        width: 100% !important;
        row-gap: 2px !important;
        column-gap: 8px !important;
        position: relative !important;
    }

    /* 左列 (Column 1): ざいのーと アイコン (上) ＆ [アプリ名] (下) */
    .app-title {
        grid-column: 1 / 2 !important;
        grid-row: 1 / 3 !important;
        justify-self: start !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 2px !important;
        margin: 0 !important;
        line-height: 1.15 !important;
    }

    .app-title a {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        color: inherit !important;
        text-decoration: none !important;
    }

    .app-title-main,
    .app-title-tag {
        font-size: 17px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        color: #ffffff !important;
        display: block !important;
    }

    /* スマホモード（縦・横）: tipは完全非表示 */
    .mobile-title-tip,
    .mobile-title-tip.active {
        display: none !important;
    }
    .tab-button.management-help-anchor.help-visible::after {
        display: none !important;
    }
    [data-tooltip]::before,
    [data-tooltip]::after {
        display: none !important;
    }

    /* 中央列 (Column 2): 補足文 (上下2行エリア) */
    .app-subtitle {
        grid-column: 2 / 3 !important;
        grid-row: 1 / 3 !important;
        justify-self: start !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 2px !important;
        margin: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        line-height: 1.25 !important;
    }

    .subtitle-line1,
    .subtitle-line2 {
        font-size: 11px !important;
        opacity: 0.85 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-width: 0 !important;
        display: block !important;
    }

    /* 右列 (Column 3): 1行目: 契約アイコン（プランバッジ） */
    #zainotePlanBadge,
    .zainote-plan-badge {
        grid-column: 3 / 4 !important;
        grid-row: 1 !important;
        justify-self: end !important;
        margin: 0 !important;
        font-size: 11.5px !important;
        padding: 3px 8px !important;
        white-space: nowrap !important;
    }

    /* 右列 (Column 3): 2行目: 画面モード切替ボタン */
    #zainoteModeToggleBtn,
    .zainote-mode-toggle-btn {
        grid-column: 3 / 4 !important;
        grid-row: 2 !important;
        justify-self: end !important;
        margin: 0 !important;
        font-size: 11px !important;
        padding: 3px 6px !important;
        white-space: nowrap !important;
    }

    /* スマホモード（縦・横）: tipは完全非表示 */
    .mobile-title-tip,
    .mobile-title-tip.active {
        display: none !important;
    }
    .tab-button.management-help-anchor.help-visible::after {
        display: none !important;
    }
    [data-tooltip]::before,
    [data-tooltip]::after {
        display: none !important;
    }

    .header-links {
        display: flex !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        gap: 5px !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .header-links .nav-icon {
        display: none !important;
    }

    .header-links a,
    .header-links .current-app {
        flex: 1 1 auto !important;
        font-size: 12px !important;
        padding: 2px 7px !important;
        height: 26px !important;
        white-space: nowrap !important;
        text-align: center !important;
        justify-content: center !important;
    }

    /* 3. タブナビゲーション（360px画面幅に全タブが収まるよう余白・間隔を最適化） */
    .tab-navigation {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow: visible !important;
        overflow-x: visible !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        min-width: 0 !important;
        width: 100% !important;
        gap: 2px !important;
        border-bottom: 2px solid #0d5f3a !important;
        padding-left: 1px !important;
        padding-right: 1px !important;
        box-sizing: border-box !important;
        align-items: flex-end !important;
    }

    .tab-navigation::-webkit-scrollbar {
        display: none !important;
    }

    .tab-button,
    .tab-manual-btn {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
        font-weight: 600 !important;
        -webkit-appearance: none !important;
    }

    .tab-button {
        flex: 0 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        padding: 5px 3.5px !important;
        font-size: 11px !important;
        text-align: center !important;
        white-space: nowrap !important;
        gap: 2px !important;
        letter-spacing: -0.3px !important;
        height: 27px !important;
        box-sizing: border-box !important;
    }
    .tab-button.active {
        height: 28px !important;
        box-sizing: border-box !important;
    }

    .tab-manual-btn {
        flex: 0 0 auto !important;
        margin-left: auto !important;
        margin-top: 0 !important;
        padding: 5px 4px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        gap: 2px !important;
        letter-spacing: -0.3px !important;
    }

    /* 4. タブパネル共通 */
    .tab-content-panel {
        padding: 8px 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .tab-content-panel table,
    .tab-content-panel tbody,
    .tab-content-panel tr,
    .tab-content-panel td {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    /* タブ1: 検索・絞り込み（横1行・4コントロール配置） */
    #tab-panel-search td {
        display: grid !important;
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 2.8fr) minmax(0, 1.2fr) minmax(0, 1.8fr) !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        align-items: center !important;
    }

    #tab-panel-search label {
        display: none !important;
    }

    #itemGenre2 {
        grid-column: 1 / 2 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
        padding: 0 4px !important;
    }

    #searchInputNew {
        grid-column: 2 / 3 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        box-sizing: border-box !important;
        padding: 0 6px !important;
    }

    #searchButtonNew {
        grid-column: 3 / 4 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12.5px !important;
        font-weight: 700 !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        background: #f1f5f9 !important;
        color: #1e293b !important;
        box-sizing: border-box !important;
        cursor: pointer !important;
        padding: 0 4px !important;
        white-space: nowrap !important;
    }

    #clearFilterButton {
        grid-column: 4 / 5 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        background: #f8fafc !important;
        color: #64748b !important;
        box-sizing: border-box !important;
        cursor: pointer !important;
        padding: 0 4px !important;
        white-space: nowrap !important;
    }

    #filterStatus {
        grid-column: 1 / -1 !important;
        text-align: center !important;
        font-size: 12px !important;
        color: #64748b !important;
        margin: 4px 0 0 !important;
        display: block !important;
    }

    /* タブ2: 新レシピの追加フォーム（スマホ完全最適化・横3ボタン＆整然配置） */
    #tab-panel-add table,
    #tab-panel-add tbody,
    #tab-panel-add tr,
    #tab-panel-add td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    #tab-panel-add #addForm {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
    }

    #tab-panel-add label {
        font-size: 12px !important;
        font-weight: 700 !important;
        color: #0d5f3a !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: left !important;
        display: block !important;
        white-space: nowrap !important;
        width: auto !important;
        min-width: 0 !important;
        flex: none !important;
    }

    #tab-panel-add input,
    #tab-panel-add select {
        width: 100% !important;
        min-width: 0 !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        padding: 0 6px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
    }

    #tab-panel-add .add-form-row {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
    }

    /* 素材選択ブロック（4列均等配置: 分類・素材名・数量・単位） */
    #tab-panel-add .add-form-row:first-of-type {
        display: grid !important;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 0.8fr) !important;
        gap: 2px 6px !important;
        width: 100% !important;
        align-items: end !important;
    }

    #tab-panel-add .add-form-row:first-of-type label[for="itemCategory"] {
        grid-column: 1 / 2 !important;
        grid-row: 1 !important;
    }
    #tab-panel-add .add-form-row:first-of-type select#itemCategory {
        grid-column: 1 / 2 !important;
        grid-row: 2 !important;
    }

    #tab-panel-add .add-form-row:first-of-type .material-input-group {
        display: contents !important;
    }

    #tab-panel-add .add-form-row:first-of-type label[for="itemName"] {
        grid-column: 2 / 3 !important;
        grid-row: 1 !important;
    }
    #tab-panel-add .add-form-row:first-of-type select#itemName {
        grid-column: 2 / 3 !important;
        grid-row: 2 !important;
    }

    #tab-panel-add .add-form-row:first-of-type label[for="itemQuantity"] {
        grid-column: 3 / 4 !important;
        grid-row: 1 !important;
    }
    #tab-panel-add .add-form-row:first-of-type select#itemQuantity {
        grid-column: 3 / 4 !important;
        grid-row: 2 !important;
    }

    #tab-panel-add .add-form-row:first-of-type label[for="itemUnit"] {
        grid-column: 4 / 5 !important;
        grid-row: 1 !important;
    }
    #tab-panel-add .add-form-row:first-of-type select#itemUnit {
        grid-column: 4 / 5 !important;
        grid-row: 2 !important;
    }

    /* 素材検索 ＆ 横3ボタンブロック（1行・4列パッキング） */
    #tab-panel-add .add-form-row:nth-of-type(2) {
        display: grid !important;
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 1.25fr) !important;
        gap: 4px 6px !important;
        width: 100% !important;
        align-items: center !important;
        margin: 0 !important;
        margin-bottom: 0 !important;
    }

    #tab-panel-add .add-form-row:nth-of-type(2) label[for="searchInput"] {
        display: none !important;
    }

    #tab-panel-add .add-form-row:nth-of-type(2) input#searchInput {
        grid-column: 1 / 2 !important;
        grid-row: 1 !important;
        width: 100% !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        padding: 0 6px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
    }

    /* アクションボタン（横3ボタン同一行配置） */
    #addButton {
        grid-column: 2 / 3 !important;
        grid-row: 1 !important;
        background: #0d5f3a !important;
        color: #ffffff !important;
        border: 1px solid #0a4b2e !important;
    }

    #compressButton {
        grid-column: 3 / 4 !important;
        grid-row: 1 !important;
        background: #fff1f2 !important;
        color: #be123c !important;
        border: 1px solid #fecdd3 !important;
    }

    #addButton2 {
        grid-column: 4 / 5 !important;
        grid-row: 1 !important;
        background: #ea580c !important;
        color: #ffffff !important;
        border: 1px solid #c2410c !important;
    }

    #addButton,
    #compressButton,
    #addButton2 {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 5px !important;
        box-sizing: border-box !important;
        width: 100% !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 2px 2px !important;
        letter-spacing: -0.3px !important;
        text-align: center !important;
        cursor: pointer !important;
        margin: 0 !important;
    }

    /* 追加済み素材リスト（新レシピタブ内限定: 横2列配置） */
    #tab-panel-add #materialFields {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 3px 6px !important;
        margin-top: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #tab-panel-add .material-field-group {
        display: grid !important;
        grid-template-columns: 50px minmax(0, 1fr) 48px 42px !important;
        gap: 3px !important;
        align-items: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #tab-panel-add .material-field-group[style*="display: none"] {
        display: none !important;
    }

    #tab-panel-add .material-field-group label {
        font-size: 11px !important;
        font-weight: 700 !important;
        text-align: right !important;
        padding-right: 2px !important;
        white-space: nowrap !important;
        color: #334155 !important;
        overflow: hidden !important;
    }

    #tab-panel-add .material-field-group input {
        height: 32px !important;
        font-size: 12px !important;
        padding: 2px 3px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    /* メインの表（#inventory）の素材セル構造 */
    #inventory .material-field-group {
        display: contents;
    }
    #inventory .material-field-group[style*="display: none"] {

        display: none !important;
    }

    /* レシピ基本情報（スマホ縦: 2ペア・2行グリッド配置: 1行目[レシピ名/人前], 2行目[ジャンル/Web]） */
    #materialListContainer {
        width: 100% !important;
        margin-top: 3px !important;
        padding-top: 3px !important;
        border-top: 1px solid #e2e8f0 !important;
    }

    .recipe-input-group {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        grid-template-areas:
            "loc  loc  serv"
            "gen  memo memo" !important;
        gap: 4px 6px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        align-items: center !important;
    }

    .recipe-input-group .form-item {
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        white-space: nowrap !important;
        min-width: 0 !important;
    }

    .recipe-input-group label {
        font-size: 11.5px !important;
        font-weight: 700 !important;
        color: #0d5f3a !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: left !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* 1行目: レシピ名（左〜中央いっぱい） */
    .recipe-input-group .form-item-location {
        grid-area: loc !important;
        width: 100% !important;
    }
    #itemLocation {
        width: 100% !important;
        min-width: 60px !important;
    }

    /* 1行目: 人前（右端） */
    .recipe-input-group .form-item-servings {
        grid-area: serv !important;
        justify-self: end !important;
    }
    #itemServings {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        text-align: center !important;
        padding: 0 4px !important;
        appearance: textfield !important;
        -moz-appearance: textfield !important;
    }

    /* 2行目: ジャンル（左端） */
    .recipe-input-group .form-item-genre {
        grid-area: gen !important;
    }
    #itemGenre {
        width: 84px !important;
        min-width: 84px !important;
        max-width: 90px !important;
    }

    /* 2行目: Web（中央〜右端いっぱい） */
    .recipe-input-group .form-item-memo {
        grid-area: memo !important;
        width: 100% !important;
    }
    #itemMemo {
        width: 100% !important;
        min-width: 60px !important;
    }

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

    #itemLocation,
    #itemServings,
    #itemGenre,
    #itemMemo {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        padding: 0 4px !important;
        border-radius: 5px !important;
        box-sizing: border-box !important;
    }

    /* タブ3: ファイル・データ管理（全PJ共通3列グリッド） */
    .management-tab-content {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .management-group {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 4px !important;
        margin-bottom: 6px !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    .management-group-title {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 20px !important;
        justify-content: flex-start !important;
        text-align: left !important;
        padding: 1px 6px !important;
        margin: 0 0 2px 0 !important;
        border-right: none !important;
        border-bottom: 2px solid #decfae !important;
        border-radius: 4px 4px 0 0 !important;
        white-space: nowrap !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #334155 !important;
        line-height: 1.2 !important;
    }

    .management-tab-content .custom-button,
    .management-group .custom-button,
    .management-group a,
    .management-group label,
    .file-actions .custom-button,
    .file-actions a,
    .file-actions label {
        width: 100% !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 0 4px !important;
        box-sizing: border-box !important;
        border-radius: 5px !important;
        white-space: nowrap !important;
        margin: 0 !important;
    }

    .file-actions {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
    }

    /* 5. グローバルアクションバー（横1行・4コントロール配置） */
    .global-action-bar,
    /* 7. 常時表示アクションバー（スマホ縦モード: ソート・文字色上ラベル、一括保存・ソートボタン排除） */
    #sortControlsTable,
    .inventory-content > .global-action-bar,
    .global-action-bar {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto !important;
        align-items: flex-end !important;
        row-gap: 5px !important;
        column-gap: 8px !important;
        padding: 5px 8px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        position: static !important;
        top: auto !important;
        margin-top: 6px !important;
        margin-bottom: 6px !important;
        overflow: visible !important;
        scrollbar-width: none !important;
    }

    /* 一括保存ボタン・ソートボタン・保存ラベルを完全非表示 */
    #saveAllButton,
    #sortExecuteButton,
    .save-group-label {
        display: none !important;
    }

    /* 1行目・左: ソート（上ラベル＋下セレクトボックス: zaiko同様） */
    .action-group.sort-action-group {
        grid-column: 1 / 2 !important;
        grid-row: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        min-width: 0 !important;
        width: 100% !important;
        gap: 0 !important;
    }

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

    .action-group .sort-select {
        width: 100% !important;
        min-width: 0 !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        font-size: 12.5px !important;
        padding: 0 6px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 5px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
    }

    /* 1行目・右: 文字色（上ラベル＋下ボタン: zaiko同様） */
    .color-priority-control {
        grid-column: 2 / 3 !important;
        grid-row: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        min-width: 0 !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
    }

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

    .color-priority-buttons button,
    .color-priority-control button {
        width: auto !important;
        min-width: 68px !important;
        height: 30px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        padding: 0 10px !important;
        border-radius: 4px !important;
        border: 1px solid #cbd5e1 !important;
        background: #f8fafc !important;
        color: #475569 !important;
        box-sizing: border-box !important;
        cursor: pointer !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;
    }

    /* 2行目: 最新保存時刻 ＋ 購入計算（点線区切りで左右均等配置: zaiko同様） */
    .meta-info-control {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        gap: 4px 8px !important;
        margin-top: 4px !important;
        padding-top: 6px !important;
        border-top: 1px dashed #cbd5e1 !important;
        box-sizing: border-box !important;
    }

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

    #finalCheckLink {
        font-size: 11.5px !important;
        font-weight: 600 !important;
        height: 24px !important;
        line-height: 24px !important;
        padding: 0 8px !important;
        border-radius: 4px !important;
        background: #0d5f3a !important;
        color: #ffffff !important;
        text-decoration: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* 6. 在庫・レシピテーブルの横スクロール対応 & ソートバー巻き込み防止 */
    .inventory-content {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: visible !important;
    }

    .inventory-table-scroll {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        border-radius: 6px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    }

    .inventory-table-scroll::-webkit-scrollbar {
        height: 6px !important;
    }

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

    #inventory,
    body.force-mobile-mode:not(.force-pc-mode) #inventory {
        width: 100% !important;
        min-width: 100% !important;
        margin-top: 0 !important;
        box-sizing: border-box !important;
        table-layout: auto !important;
    }

    #inventory thead th {
        position: static !important;
        top: auto !important;
    }

    #inventory td {
        padding: 4px 4px !important;
        font-size: 12px !important;
        box-sizing: border-box !important;
    }
    #inventory thead th,
    #inventory th {
        padding: 4px 2px !important;
        font-size: 10px !important;
        height: 24px !important;
        max-height: 24px !important;
        line-height: 1.2 !important;
        text-align: center !important;
        vertical-align: middle !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
    }

    /* ==========================================================================
       スマホモード限定: テーブル内コントロールのスリム化＆非入力化（番号タップ編集限定）
       ========================================================================== */
    /* 枠線・背景・矢印を削ってテキスト化 ＆ スクロール誤タップ防止 */
    #inventory tbody td input,
    #inventory tbody td select,
    #inventory tbody td textarea {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        outline: none !important;
        padding: 0 !important;
        margin: 0 !important;
        pointer-events: none !important;
        user-select: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        color: inherit !important;
        font-size: 12px !important;
        font-family: inherit !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }

    #inventory tbody td textarea {
        resize: none !important;
        overflow: hidden !important;
        white-space: pre-wrap !important;
        word-break: break-all !important;
    }

    /* ＋ー（ステッパー）ボタンを削る */
    #inventory .recipe-number-stepper button,
    #inventory .recipe-step-adjust-button,
    body.force-mobile-mode:not(.force-pc-mode) #inventory .recipe-number-stepper button,
    body.force-mobile-mode:not(.force-pc-mode) #inventory .recipe-step-adjust-button {
        display: none !important;
    }

    /* 日付スピン・数値スピンボタンを非表示 */
    #inventory tbody td input::-webkit-inner-spin-button,
    #inventory tbody td input::-webkit-outer-spin-button,
    #inventory tbody td input::-webkit-calendar-picker-indicator {
        display: none !important;
        -webkit-appearance: none !important;
    }

    /* スマホモード: 操作列（9列目）は詳細シート側にあるため表内では非表示にして横幅を大幅圧縮 */
    #inventory th:nth-child(10),
    #inventory td:nth-child(10),
    #inventory th:last-child,
    #inventory td:last-child,
    #inventory .row-action-cell,
    #inventory .row-action-trigger,
    #inventory .row-action-menu,
    .row-action-menu {
        display: none !important;
    }

    /* 1列目: No (幅26px固定・タップ案内下線) */
    #inventory th:first-child,
    #inventory td:first-child,
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:first-child,
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:first-child {
        min-width: 26px !important;
        max-width: 26px !important;
        width: 26px !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
        text-align: center !important;
        border-bottom: 1px solid #ccc !important;
    }

    /* スマホモード限定: Noセルタップで詳細・編集シート起動の案内スタイル */
    #inventory tbody tr:not(.separator-row) td:first-child,
    body.force-mobile-mode:not(.force-pc-mode) #inventory tbody tr:not(.separator-row) td:first-child,
    body:not(.force-pc-mode) #inventory tbody tr:not(.separator-row) td:first-child {
        cursor: pointer !important;
        font-weight: 700 !important;
        color: #0d5f3a !important;
        text-decoration: underline !important;
        text-underline-offset: 2px !important;
        border-bottom: 1px solid #ccc !important;
        transition: background-color 0.15s, color 0.15s;
        user-select: none !important;
        position: relative !important;
        pointer-events: auto !important;
        background: rgba(13, 95, 58, 0.05);
    }

    #inventory tbody tr:not(.separator-row) td:first-child:hover {
        background-color: #d1fae5 !important;
        color: #0d5f3a !important;
        text-decoration: underline !important;
    }

    #inventory tbody tr:not(.separator-row) td:first-child:active {
        background-color: #a7f3d0 !important;
    }

    /* 2列目: レシピ名 (可変幅: 余白を自然に吸収して広がり、上下センタリング) */
    #inventory th:nth-child(2),
    #inventory td:nth-child(2),
    #inventory th.recipe-name,
    #inventory td.recipe-name,
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(2),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(2),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th.recipe-name,
    body.force-mobile-mode:not(.force-pc-mode) #inventory td.recipe-name {
        min-width: 110px !important;
        width: auto !important;
        vertical-align: middle !important;
    }

    #inventory textarea.recipe2,
    body.force-mobile-mode:not(.force-pc-mode) #inventory textarea.recipe2 {
        width: 100% !important;
        min-width: 100px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        padding: 2px 2px !important;
        box-sizing: border-box !important;
        vertical-align: middle !important;
        display: block !important;
        margin: auto 0 !important;
        line-height: 1.35 !important;
        height: auto !important;
        min-height: 34px !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        white-space: pre-wrap !important;
    }

    /* 3列目: 人前 (コンパクト表示) */
    #inventory th:nth-child(3),
    #inventory td:nth-child(3),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(3),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(3),
    #inventory td.servings-cell {
        min-width: 44px !important;
        max-width: 58px !important;
        width: 48px !important;
        text-align: center !important;
        white-space: nowrap !important;
        padding-left: 1px !important;
        padding-right: 1px !important;
    }

    /* 4列目: ジャンル (1文字分削ってコンパクトに調整) */
    #inventory th:nth-child(4),
    #inventory td:nth-child(4),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(4),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(4) {
        min-width: 80px !important;
        max-width: 95px !important;
        width: 88px !important;
        white-space: nowrap !important;
    }

    #inventory td:nth-child(4) select,
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(4) select {
        width: 100% !important;
        min-width: 80px !important;
        max-width: 95px !important;
        font-size: 11.5px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* 5列目: 素材名,数量,単位 (最小180px・可変幅: 広げたときは素材名が伸びて追従) */
    #inventory th:nth-child(5),
    #inventory td:nth-child(5),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(5),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(5) {
        min-width: 156px !important;
        width: auto !important;
        white-space: nowrap !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    #inventory .recipe-materials-grid,
    body.force-mobile-mode:not(.force-pc-mode) #inventory .recipe-materials-grid {
        display: grid !important;
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: minmax(72px, 1fr) calc(4em - 10px) 2.5em !important;
        grid-template-rows: auto !important;
        gap: 1px 2px !important;
        box-sizing: border-box !important;
    }

    #inventory .recipe-materials-grid input {
        font-size: 11.5px !important;
        height: 18px !important;
        line-height: 18px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    #inventory .recipe-materials-grid .material-field {
        text-align: left !important;
    }

    #inventory .recipe-materials-grid .quantity-field {
        text-align: right !important;
    }

    #inventory .recipe-materials-grid .unit-field {
        text-align: left !important;
    }

    /* 6列目: 更新日時 (2行ジャストサイズ 75px) */
    #inventory th:nth-child(6),
    #inventory td:nth-child(6),
    #inventory td.update-time-cell {
        min-width: 75px !important;
        width: 75px !important;
        padding-left: 1px !important;
        padding-right: 1px !important;
        font-size: 11px !important;
        word-break: keep-all !important;
        text-align: center !important;
    }

    /* 7列目: 参考アドレス (余白を自然に吸収して広がる) */
    #inventory th:nth-child(7),
    #inventory td:nth-child(7),
    #inventory th.memo,
    #inventory td.memo,
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(7),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(7),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th.memo,
    body.force-mobile-mode:not(.force-pc-mode) #inventory td.memo {
        min-width: 90px !important;
        width: auto !important;
    }

    #inventory textarea.memo2,
    body.force-mobile-mode:not(.force-pc-mode) #inventory textarea.memo2 {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 11px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* 🌐 参考アドレスのリンクボタンはタップ可能 */
    #inventory .url-open-btn,
    body.force-mobile-mode:not(.force-pc-mode) #inventory .url-open-btn {
        pointer-events: auto !important;
        cursor: pointer !important;
    }

    /* 7列目・8列目: 倍率・採用数 (各32px) */
    #inventory th.exp,
    #inventory td.exp {
        min-width: 32px !important;
        width: 32px !important;
        padding-left: 1px !important;
        padding-right: 1px !important;
        text-align: center !important;
    }

    #inventory td.exp input {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 11.5px !important;
        text-align: center !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
}

/* ==========================================================================
   スマホ縦モード専用スタイル (@media (max-width: 768px) and (orientation: portrait))
   ========================================================================== */
@media screen and (orientation: portrait), (max-width: 768px) and (orientation: portrait) {
    /* 3列目: 人前 (縦画面コンパクト表示) */
    #inventory th:nth-child(3),
    #inventory td:nth-child(3),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(3),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(3),
    #inventory td.servings-cell {
        min-width: 44px !important;
        max-width: 58px !important;
        width: 48px !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    /* 4列目: ジャンル (縦画面でも1文字分削ってコンパクトに調整) */
    #inventory th:nth-child(4),
    #inventory td:nth-child(4),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(4),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(4) {
        min-width: 94px !important;
        max-width: 102px !important;
        width: 98px !important;
        white-space: nowrap !important;
    }

    /* メイン表素材欄: 縦1列 (素材名はmin108px、セル全体はmin188px・画面に合わせて可変追従) */
    #inventory th:nth-child(5),
    #inventory td:nth-child(5),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(5),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(5) {
        min-width: 164px !important;
        width: auto !important;
    }

    #inventory .recipe-materials-grid,
    body.force-mobile-mode:not(.force-pc-mode) #inventory .recipe-materials-grid {
        display: grid !important;
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: minmax(84px, 1fr) calc(4em - 10px) 3em !important;
    }

    /* 縦画面時の参考アドレス列 (7列目): 可変幅で余白を吸収 */
    #inventory th:nth-child(7),
    #inventory td:nth-child(7),
    #inventory th.memo,
    #inventory td.memo,
    body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(7),
    body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(7),
    body.force-mobile-mode:not(.force-pc-mode) #inventory th.memo,
    body.force-mobile-mode:not(.force-pc-mode) #inventory td.memo {
        min-width: 100px !important;
        width: auto !important;
    }
    #inventory .material-field-group.portrait-hide-group {
        display: none !important;
    }

    /* 新レシピ追加タブの素材リスト 01〜08 を縦1列配置 */
    #tab-panel-add #materialFields {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #tab-panel-add .material-field-group {
        grid-template-columns: 50px minmax(0, 1fr) 48px 42px !important;
        gap: 4px !important;
    }
}

/* ==========================================================================
   レコード詳細・直接編集ボトムシート (スマホ専用)
   ========================================================================== */

/* PCモード（769px以上 かつ 横持ちスマホ以外）ではボトムシートを完全非表示 */
@media (min-width: 769px) and (min-height: 501px) {
    body:not(.force-mobile-mode) .mobile-detail-overlay {
        display: none !important;
    }
}
body.force-pc-mode .mobile-detail-overlay {
    display: none !important;
}

/* スマホモード時：No列の数字をクリッカブルとしてアンダーライン表示 */
body.force-mobile-mode #inventory tbody td:first-child,
body.force-mobile-mode #inventory tbody tr:not(.separator-row) td:first-child {
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    border-bottom: 1px solid #ccc !important;
}

@media screen and (max-width: 768px),
       screen and (max-height: 500px) and (orientation: landscape) {
    body:not(.force-pc-mode) #inventory tbody td:first-child,
    body:not(.force-pc-mode) #inventory tbody tr:not(.separator-row) td:first-child {
        text-decoration: underline !important;
        text-underline-offset: 2px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        border-bottom: 1px solid #ccc !important;
    }
}

/* ボトムシート オーバーレイ背景 */
.mobile-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.mobile-detail-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ボトムシート本体 */
.mobile-detail-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 620px;
    max-height: 88vh;
    background: #ffffff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10001;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-detail-sheet.open {
    transform: translateX(-50%) translateY(0);
}

/* 上部ドラッグバー風ハンドル */
.sheet-drag-handle {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 3px;
    margin: 8px auto 4px;
    flex-shrink: 0;
}

/* シートヘッダー */
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px 10px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.sheet-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-no-badge {
    background: #0d5f3a;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.sheet-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.sheet-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
}

.sheet-close-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* シートボディ（スクロール領域） */
.sheet-body {
    padding: 14px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.sheet-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sheet-label {
    font-size: 12px;
    font-weight: 700;
    color: #0d5f3a;
}

.sheet-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sheet-input,
.sheet-select {
    width: 100%;
    height: 40px;
    padding: 6px 10px;
    font-size: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    background: #ffffff;
    color: #1e293b;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.sheet-input:focus,
.sheet-select:focus {
    border-color: #0d5f3a;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 95, 58, 0.2);
}

.sheet-name-input {
    font-size: 15px;
    font-weight: 700;
}
textarea.sheet-name-input {
    height: auto !important;
    min-height: 48px !important;
    line-height: 1.35 !important;
    padding: 6px 8px !important;
    resize: none !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* ステッパーコントロール */
.sheet-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sheet-step-btn {
    width: 38px;
    height: 40px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    transition: background-color 0.15s, transform 0.05s;
}

.sheet-step-btn:hover {
    background: #e2e8f0;
}

.sheet-step-btn:active {
    background: #cbd5e1;
    transform: scale(0.95);
}

.sheet-num-input {
    flex: 1;
    text-align: center;
    font-weight: 700;
}

/* 素材リスト (シート内) */
.sheet-material-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
}

.sheet-mat-row {
    display: grid;
    grid-template-columns: 24px 1fr 60px 50px;
    gap: 4px;
    align-items: center;
}

.sheet-mat-num {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-align: right;
    padding-right: 2px;
}

.sheet-mat-name,
.sheet-mat-qty,
.sheet-mat-unit {
    height: 34px !important;
    font-size: 13px !important;
    padding: 2px 6px !important;
}

.sheet-toggle-mat-btn {
    background: none;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    color: #0d5f3a;
    font-size: 12px;
    font-weight: 700;
    padding: 6px;
    cursor: pointer;
    margin-top: 4px;
    text-align: center;
}

.sheet-toggle-mat-btn:hover {
    background: #f1f5f9;
}

/* メタ情報行 */
.sheet-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    gap: 6px;
}

.sheet-update-time {
    font-size: 12px;
    color: #64748b;
}

.sheet-btn-lbl-short {
    display: none;
}

/* フッターアクションバー */
.sheet-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px 14px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
    position: sticky;
    bottom: -14px;
    margin-top: auto;
    margin-left: -16px;
    margin-right: -16px;
    margin-bottom: -14px;
    z-index: 10;
}

.sheet-btn {
    flex: 1 1 auto;
    height: 42px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background-color 0.15s, opacity 0.15s, transform 0.05s;
    white-space: nowrap;
}

.sheet-btn:active {
    transform: scale(0.97);
}

.sheet-btn-update {
    background: #0d5f3a;
    color: #ffffff;
    flex: 2 1 140px;
    font-size: 15px;
}

.sheet-btn-update:hover {
    background: #0a4b2e;
}

.sheet-btn-url {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
}

.sheet-btn-url:hover {
    background: #e2e8f0;
}

.sheet-btn-delete {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}

.sheet-btn-delete:hover {
    background: #ffe4e6;
}


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


/* ==========================================================================
   全スマホモード（縦・横・強制スマホ）共通:
   - タブ余白削減 (padding: 4px 8px 3px)
   - ドロップダウン・テキストボックス: 上下サイズ30pxに圧縮
   - ソートエリア: 30px統一
   - データ管理タブボタン: 30px統一
   ========================================================================== */
@media (max-width: 768px), (max-height: 600px) and (orientation: landscape), (orientation: portrait) and (max-width: 768px) {
    #tab-panel-search,
    #tab-panel-add,
    #tab-panel-files,
    .tab-content-panel {
        padding: 4px 8px 3px !important;
        margin-bottom: 4px !important;
        min-height: 0 !important;
    }

    .file-actions .custom-button,
    .file-actions a,
    .file-actions label {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        font-size: 12px !important;
        padding: 2px 2px !important;
        box-sizing: border-box !important;
        border-radius: 5px !important;
        line-height: 1.2 !important;
    }

    /* ソートエリア: 高さ30pxに統一 */
    .action-group .sort-select,
    .action-group .sort-execute-button,
    #finalCheckLink,
    #saveAllButton,
    .sort-select,
    .sort-execute-button {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        box-sizing: border-box !important;
    }

    /* タブ内: ドロップダウン・テキストボックスの上下サイズを30pxに圧縮（上下余白・パディングを削減） */
    .tab-content-panel input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    .tab-content-panel select,
    #tab-panel-search input,
    #tab-panel-search select,
    #tab-panel-add input,
    #tab-panel-add select,
    #tab-panel-add select#itemCategory,
    #tab-panel-add select#itemName,
    #tab-panel-add select#itemQuantity,
    #tab-panel-add select#itemUnit,
    #itemLocation,
    #itemGenre,
    #itemMemo,
    #itemOutput {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        padding: 0 6px !important;
        box-sizing: border-box !important;
        font-size: 12px !important;
    }

    /* タブ内のアクションボタンも30pxで高さを揃える */
    #tab-panel-add #addButton,
    #tab-panel-add #compressButton,
    #tab-panel-add #addButton2,
    #tab-panel-search button,
    #addButton,
    #compressButton,
    #addButton2 {
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        box-sizing: border-box !important;
    }

    /* ラベルの高さ統一 */
    #tab-panel-add label,
    #addForm label,
    .add-form-row label {
        height: 16px !important;
        min-height: 16px !important;
        max-height: 16px !important;
        line-height: 16px !important;
        font-size: 11.5px !important;
        margin: 0 0 2px 0 !important;
        padding: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        box-sizing: border-box !important;
    }
}

/* 強制スマホモード（PCでの検証用） */
body.force-mobile-mode #tab-panel-search,
body.force-mobile-mode #tab-panel-add,
body.force-mobile-mode #tab-panel-files,
body.force-mobile-mode .tab-content-panel {
    padding: 4px 8px 3px !important;
    margin-bottom: 4px !important;
    min-height: 0 !important;
}

body.force-mobile-mode .file-actions .custom-button,
body.force-mobile-mode .file-actions a,
body.force-mobile-mode .file-actions label,
body.force-mobile-mode .action-group .sort-select,
body.force-mobile-mode .action-group .sort-execute-button,
body.force-mobile-mode #finalCheckLink,
body.force-mobile-mode #saveAllButton,
body.force-mobile-mode .tab-content-panel input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.force-mobile-mode .tab-content-panel select,
body.force-mobile-mode #addButton,
body.force-mobile-mode #compressButton,
body.force-mobile-mode #addButton2 {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    box-sizing: border-box !important;
}


/* ==========================================================================
   スマホモード専用: 参考アドレス（td.memo）設定
   PCではマウスオンのチップを使用し、スマホ時のみ右下角に🌐地球アイコンボタンを表示
   ========================================================================== */
#inventory td.memo,
.recipe-table td.memo,
body.force-mobile-mode:not(.force-pc-mode) #inventory td.memo,
body.force-mobile-mode:not(.force-pc-mode) .recipe-table td.memo {
    position: relative !important;
}

#inventory .memo-wrapper,
.recipe-table .memo-wrapper,
body.force-mobile-mode:not(.force-pc-mode) #inventory .memo-wrapper,
body.force-mobile-mode:not(.force-pc-mode) .recipe-table .memo-wrapper {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    box-sizing: border-box !important;
}

#inventory .url-open-btn,
.recipe-table .url-open-btn,
body.force-mobile-mode:not(.force-pc-mode) #inventory .url-open-btn,
body.force-mobile-mode:not(.force-pc-mode) .recipe-table .url-open-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: static !important;
    align-self: flex-end !important;
    width: 20px !important;
    height: 19px !important;
    padding: 0 !important;
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    font-size: 12px !important;
    line-height: 1 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.25) !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    cursor: pointer !important;
    z-index: 5 !important;
    touch-action: manipulation !important;
    box-sizing: border-box !important;
}

#inventory .memo-wrapper.has-scrollbar .url-open-btn,
.recipe-table .memo-wrapper.has-scrollbar .url-open-btn,
body.force-mobile-mode:not(.force-pc-mode) #inventory .memo-wrapper.has-scrollbar .url-open-btn,
body.force-mobile-mode:not(.force-pc-mode) .recipe-table .memo-wrapper.has-scrollbar .url-open-btn {
    position: static !important;
    align-self: flex-end !important;
    right: auto !important;
}

#inventory .url-open-btn:active,
.recipe-table .url-open-btn:active,
body.force-mobile-mode:not(.force-pc-mode) #inventory .url-open-btn:active,
body.force-mobile-mode:not(.force-pc-mode) .recipe-table .url-open-btn:active {
    background: #cbd5e1 !important;
    transform: scale(0.92) !important;
}

@media screen and (min-width: 1025px) {
    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 {
        display: none !important;
    }
}


/* ========================================================
   final_check 画面の表ごと個別横スクロール (スマホ縦)
   ======================================================== */
.finalcheck-table-scroll,
#inventorySectionsContainer,
#recipeSectionsContainer .finalcheck-table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    margin-bottom: 20px !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    scrollbar-width: thin !important;
    display: block !important;
}

#recipeSectionsContainer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

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

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

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

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

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

#inventorySectionsContainer th,
#inventorySectionsContainer td,
#recipeSectionsContainer th,
#recipeSectionsContainer td,
#purchaseListTable th,
#purchaseListTable td {
    white-space: nowrap !important;
}

/* ==========================================================================
   強制スマホモード時（PCデスクトップでのスマホプレビュー等）のテーブル非入力化
   ========================================================================== */
body.force-mobile-mode:not(.force-pc-mode) #inventory {
    width: 100% !important;
    min-width: 100% !important;
    font-size: 12px !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory td {
    padding: 4px 4px !important;
    box-sizing: border-box !important;
}
body.force-mobile-mode:not(.force-pc-mode) #inventory thead th,
body.force-mobile-mode:not(.force-pc-mode) #inventory th {
    padding: 4px 2px !important;
    font-size: 10px !important;
    height: 24px !important;
    max-height: 24px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td input,
body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td select,
body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    color: inherit !important;
    font-size: 12px !important;
    font-family: inherit !important;
    line-height: 1.3 !important;
    box-sizing: border-box !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td textarea {
    resize: none !important;
    overflow: hidden !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td input::-webkit-inner-spin-button,
body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td input::-webkit-outer-spin-button,
body.force-mobile-mode:not(.force-pc-mode) #inventory tbody td input::-webkit-calendar-picker-indicator {
    display: none !important;
    -webkit-appearance: none !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(10),
body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(10),
body.force-mobile-mode:not(.force-pc-mode) #inventory th:last-child,
body.force-mobile-mode:not(.force-pc-mode) #inventory td:last-child,
body.force-mobile-mode:not(.force-pc-mode) #inventory .row-action-cell,
body.force-mobile-mode:not(.force-pc-mode) #inventory .row-action-trigger,
body.force-mobile-mode:not(.force-pc-mode) #inventory .row-action-menu,
body.force-mobile-mode:not(.force-pc-mode) .row-action-menu {
    display: none !important;
}

/* --------------------------------------------------------------------------
   アクションバー（強制スマホモード縦: 2段レイアウト）:
   1段目: ソート（左）＋ 文字色（右）
   2段目: 最新保存時刻 ＋ 購入計算（左右均等）
   -------------------------------------------------------------------------- */
body.force-mobile-mode:not(.force-pc-mode) .global-action-bar {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto !important;
    align-items: flex-end !important;
    row-gap: 5px !important;
    column-gap: 8px !important;
    padding: 5px 8px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.force-mobile-mode:not(.force-pc-mode) #saveAllButton,
body.force-mobile-mode:not(.force-pc-mode) #sortExecuteButton,
body.force-mobile-mode:not(.force-pc-mode) .save-group-label {
    display: none !important;
}

body.force-mobile-mode:not(.force-pc-mode) .action-group.sort-action-group {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 0 !important;
}

body.force-mobile-mode:not(.force-pc-mode) .color-priority-control {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: auto !important;
    gap: 0 !important;
}

body.force-mobile-mode:not(.force-pc-mode) .meta-info-control {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    gap: 4px 8px !important;
    margin-top: 4px !important;
    padding-top: 6px !important;
    border-top: 1px dashed #cbd5e1 !important;
    box-sizing: border-box !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory .recipe-number-stepper button,
body.force-mobile-mode:not(.force-pc-mode) #inventory .recipe-step-adjust-button {
    display: none !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory th:nth-child(2),
body.force-mobile-mode:not(.force-pc-mode) #inventory td:nth-child(2),
body.force-mobile-mode:not(.force-pc-mode) #inventory th.recipe-name,
body.force-mobile-mode:not(.force-pc-mode) #inventory td.recipe-name {
    vertical-align: middle !important;
}

body.force-mobile-mode:not(.force-pc-mode) #inventory textarea.recipe2 {
    vertical-align: middle !important;
    display: block !important;
    margin: auto 0 !important;
    line-height: 1.35 !important;
}





/* スマホ縦: 保存アクションブロック完全非表示 */
@media (max-width: 768px) {
    body:not(.force-pc-mode) .save-action-group,
    body:not(.force-pc-mode) .save-action-group * {
        display: none !important;
    }
}
body.force-mobile-mode:not(.force-pc-mode) .save-action-group,
body.force-mobile-mode:not(.force-pc-mode) .save-action-group * {
    display: none !important;
}

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

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

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

/* レスポンシブ (max-width: 768px) 用ルール */
@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) {
    body:not(.force-pc-mode) .tab-navigation .tab-button,
    body:not(.force-pc-mode) .tab-navigation .tab-manual-btn,
    body:not(.force-pc-mode) .tab-button,
    body:not(.force-pc-mode) .tab-manual-btn {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        line-height: normal !important;
    }

    body:not(.force-pc-mode) .tab-content-panel button,
    body:not(.force-pc-mode) .tab-content-panel .custom-button,
    body:not(.force-pc-mode) .tab-content-panel a.custom-button,
    body:not(.force-pc-mode) .tab-content-panel input[type="button"],
    body:not(.force-pc-mode) .tab-content-panel input[type="submit"],
    body:not(.force-pc-mode) .management-tab-content .custom-button,
    body:not(.force-pc-mode) .management-group .custom-button,
    body:not(.force-pc-mode) .management-group a,
    body:not(.force-pc-mode) .management-group button,
    body:not(.force-pc-mode) .management-group label,
    body:not(.force-pc-mode) .search-tab-content button,
    body:not(.force-pc-mode) .search-tab-content .custom-button,
    body:not(.force-pc-mode) .search-tab-content #searchButton,
    body:not(.force-pc-mode) .search-tab-content #outOfStockButton,
    body:not(.force-pc-mode) .search-tab-content #clearFilterButton,
    body:not(.force-pc-mode) #tab-panel-search button,
    body:not(.force-pc-mode) #tab-panel-search #searchButton,
    body:not(.force-pc-mode) #tab-panel-search #outOfStockButton,
    body:not(.force-pc-mode) #tab-panel-search #clearFilterButton,
    body:not(.force-pc-mode) #tab-panel-add button,
    body:not(.force-pc-mode) #tab-panel-manage button,
    body:not(.force-pc-mode) #tab-search button,
    body:not(.force-pc-mode) #tab-add button,
    body:not(.force-pc-mode) #tab-manage button,
    body:not(.force-pc-mode) .form-section button,
    body:not(.force-pc-mode) .add-form-row .custom-button,
    body:not(.force-pc-mode) #addButton,
    body:not(.force-pc-mode) #scanButton,
    body:not(.force-pc-mode) #addButton2,
    body:not(.force-pc-mode) #compressButton,
    body:not(.force-pc-mode) #addPriceSubmitBtn,
    body:not(.force-pc-mode) #addWalletSubmitBtn,
    body:not(.force-pc-mode) #submit-record-button,
    body:not(.force-pc-mode) #searchButton,
    body:not(.force-pc-mode) #searchButtonNew,
    body:not(.force-pc-mode) #tabSearchButton,
    body:not(.force-pc-mode) #search-button,
    body:not(.force-pc-mode) #clearFilterButton,
    body:not(.force-pc-mode) #clearFilterButtonNew,
    body:not(.force-pc-mode) #tabClearFilterButton,
    body:not(.force-pc-mode) #clear-filters-button,
    body:not(.force-pc-mode) #outOfStockButton,
    body:not(.force-pc-mode) #tabExpiringButton {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif !important;
        height: 30px !important;
        min-height: 30px !important;
        line-height: 28px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        box-sizing: border-box !important;
    }
}

/* スマホモード（縦画面・横画面・強制スマホモード）: ソート実行ボタンを完全非表示 */
@media screen and (max-width: 1024px) {
    body:not(.force-pc-mode) #sortExecuteButton,
    body:not(.force-pc-mode) .sort-execute-button,
    body:not(.force-pc-mode) .action-group .sort-execute-button,
    body:not(.force-pc-mode) .sort-control-wrap .sort-execute-button {
        display: none !important;
    }
}
@media screen and (orientation: landscape) and (max-height: 600px) {
    body:not(.force-pc-mode) #sortExecuteButton,
    body:not(.force-pc-mode) .sort-execute-button,
    body:not(.force-pc-mode) .action-group .sort-execute-button,
    body:not(.force-pc-mode) .sort-control-wrap .sort-execute-button {
        display: none !important;
    }
}
body.force-mobile-mode:not(.force-pc-mode) #sortExecuteButton,
body.force-mobile-mode:not(.force-pc-mode) .sort-execute-button,
body.force-mobile-mode:not(.force-pc-mode) .action-group .sort-execute-button,
body.force-mobile-mode:not(.force-pc-mode) .sort-control-wrap .sort-execute-button {
    display: none !important;
}
