:root {
  /* ライト配色専用。ブラウザ/OSの自動ダーク（強制反転）を無効化して文字が消えないようにする */
  color-scheme: only light;
  --bg: #ffffff;
  --canvas: #f7f8fa;
  --panel: #ffffff;
  --ink: #2b3440;
  --muted: #7a8593;
  --line: #e6e9ee;
  --line-strong: #d7dce3;
  /* ZAICO風オレンジ */
  --brand: #e06c2c;
  --brand-deep: #cf5f22;
  --brand-soft: #fdf1e8;
  --brand-ink: #ffffff;
  --nav-ink: #3a4653;
  --ok: #1a9d4e;
  --warn: #d97706;
  --danger: #dc2626;
  --chip: #eef1f5;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.06);
  --header-h: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
/* body を内容の高さまで伸ばす＝上部ヘッダーの sticky(top:0) がページ全体で効くように（height:100%だと1画面ぶんで固定が外れる） */
body { height: auto; }
body {
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}
button { cursor: pointer; font: inherit; color: inherit; }
/* プルダウン（select）を全ページ共通で今風に（エクセル感のある枠を刷新）。矢印は独自アイコン。 */
select {
  appearance: none; -webkit-appearance: none;
  background-color: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 34px 8px 12px; font: inherit; font-size: 14px; line-height: 1.45; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 11px;
}
select:hover { border-color: var(--brand); }
select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
select:disabled { opacity: .55; cursor: not-allowed; background-color: var(--canvas); }

/* ===================== 上部ヘッダー ===================== */
.app-header {
  height: var(--header-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; position: sticky; top: 0; z-index: 40;
}
.app-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--brand); font-size: 16px; }
.brand-text { font-size: 18px; font-weight: 800; letter-spacing: .02em; color: #2a3542; }
.brand-text b { color: var(--brand); font-weight: 800; }
.plan-badge {
  font-size: 11px; font-weight: 700; color: var(--brand-deep);
  background: var(--brand-soft); border: 1px solid #f2d9c6;
  padding: 2px 8px; border-radius: 4px; margin-left: 4px;
}
.app-header-right { display: flex; align-items: center; gap: 16px; color: var(--nav-ink); font-size: 13px; }
.app-header-right .company { font-weight: 600; }

/* ===================== シェル（3カラム） ===================== */
.shell { display: flex; align-items: stretch; min-height: calc(100vh - var(--header-h)); }

/* --- 左アイコンナビ --- */
.rail {
  width: 72px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; padding: 6px 0;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;   /* 項目が増えて縦に収まらない時はスクロール（下が見切れない） */
  scrollbar-width: thin;
}
.rail::-webkit-scrollbar { width: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.rail-item {
  border: none; background: none; padding: 8px 2px; display: flex;
  flex-direction: column; align-items: center; gap: 3px; color: var(--muted);
  border-left: 3px solid transparent; position: relative; flex-shrink: 0;
}
.rail-item .rail-ico { font-size: 20px; filter: grayscale(.4); opacity: .8; }
.rail-item .rail-lbl { font-size: 10.5px; font-weight: 600; }
.rail-item:hover { background: #fafbfc; color: var(--nav-ink); }
.rail-item.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); }
.rail-item.active .rail-ico { filter: none; opacity: 1; }
/* 買取システムの「NEW」バッジ（割り当て・入庫がまだの買取があると点灯／全部済むと消える） */
.rail-new {
  position: absolute; top: 3px; right: 5px;
  background: #dc2626; color: #fff; font-size: 9px; font-weight: 800;
  border-radius: 6px; padding: 1px 4px; letter-spacing: .02em; line-height: 1.35;
  box-shadow: 0 1px 3px rgba(220,38,38,.45);
}
.rail-bottom { margin-top: auto; }

/* --- 保管場所サイドバー --- */
.side {
  width: 224px; background: var(--panel); border-right: 1px solid var(--line);
  padding: 12px 10px; overflow-y: auto; flex-shrink: 0;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
}
.side-all {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--radius); padding: 9px 12px; font-weight: 700; color: var(--nav-ink);
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.side-all.active { background: var(--brand-soft); border-color: #f0cfba; color: var(--brand-deep); }
.side-head { font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 6px; }
.side-search {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--canvas); margin: 6px 0 8px; font-size: 12px;
}
.side-list { display: flex; flex-direction: column; }
.side-loc {
  text-align: left; border: none; background: none; padding: 7px 10px; border-radius: 6px;
  color: var(--nav-ink); font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px;
}
.side-loc:hover { background: #f4f6f8; }
.side-loc.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.side-loc .cnt { color: var(--muted); font-size: 11px; }
/* --- 絞り込みパネル（左サイドにフィルターを縦並び） --- */
.side-head { margin-top: 4px; }
.side .filter-bar { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; align-items: stretch; }
.side .filter-bar .msel { width: 100%; }
.side .filter-bar .msel-btn { width: 100%; max-width: none; }
.side .filter-bar > select, .side .filter-bar #f-custom select { width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); font-size: 12.5px; color: var(--nav-ink); }
.side .filter-bar #f-custom { display: flex; flex-direction: column; gap: 8px; }
.side .filter-bar #f-custom:empty { display: none; }
.f-qty-row { display: flex; align-items: center; gap: 6px; }
.f-qty-row .f-qty { flex: 1; margin: 0; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.f-qty-row .f-qty input { width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 12.5px; }
.filter-actions { display: flex; gap: 6px; margin-top: 4px; }
.filter-actions .btn { flex: 1; justify-content: center; padding: 8px 10px; }
.side-backdrop { display: none; }

/* ===================== メイン ===================== */
.main { flex: 1; min-width: 0; padding: 12px 22px 24px; }
/* スクロールしても固定する上部（検索・アクション・件数）。列見出しはこの下に貼り付く。
   在庫一覧・割当て待ちのときだけ固定（.topbar-sticky）。他の画面では通常どおり流れる。 */
.list-topbar.topbar-sticky { position: sticky; top: var(--header-h); z-index: 6; background: var(--canvas); }
.list-topbar:empty { display: none; }

.main-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 800; margin: 0; color: #2a3542; }
.search-box {
  display: flex; align-items: center; gap: 6px; background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 8px;
  flex: 1; min-width: 220px; max-width: 460px;
}
.search-box input { flex: 1; border: none; outline: none; padding: 9px 4px; font-size: 14px; background: none; color: var(--ink); }
.search-ico { color: var(--muted); font-size: 13px; }
.search-gear { border: none; background: none; color: var(--muted); padding: 4px; }
.btn-detail {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius);
  padding: 8px 14px; font-weight: 600; color: var(--nav-ink);
}

/* ボタン */
.btn {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius);
  padding: 9px 16px; font-weight: 700; color: var(--nav-ink); display: inline-flex;
  align-items: center; gap: 6px; white-space: nowrap;
}
.btn span { font-size: 13px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(207,95,34,.25); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-outline:hover { background: #fafbfc; }
.btn-out { background: #0f6fb8; border-color: #0f6fb8; color: #fff; box-shadow: 0 1px 2px rgba(15,111,184,.25); }
.btn-out:hover { background: #0c5c99; }
.btn-restock { background: #15803d; border-color: #15803d; color: #fff; box-shadow: 0 1px 2px rgba(21,128,61,.25); }
.btn-restock:hover { background: #116632; }
.btn-in { background: #7c3aed; border-color: #7c3aed; color: #fff; box-shadow: 0 1px 2px rgba(124,58,237,.25); }
.btn-in:hover { background: #6d28d9; }
.btn.sel-on { box-shadow: 0 0 0 3px rgba(0,0,0,.14); }
.btn-danger { color: var(--danger); border-color: #f0c2c2; }
.btn.ghost { background: transparent; }

.action-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.action-bar .btn { padding: 7px 12px; } /* 在庫一覧上部をコンパクトに（アクションボタンを少し小さく） */
.stat-chips { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.stat-chip {
  display: inline-flex; flex-direction: column; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 12px; line-height: 1.25;
}
.stat-chip i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.stat-chip b { font-size: 15px; color: #2a3542; font-variant-numeric: tabular-nums; }

/* フィルタ */
.filter-bar { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.filter-bar select {
  padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel); font-size: 12.5px; color: var(--nav-ink);
}
.mobile-only-loc { display: none; }

/* 複数選択フィルタ（チェックボックス式ドロップダウン） */
.msel { position: relative; }
.msel-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel); font-size: 12.5px; color: var(--nav-ink); cursor: pointer;
}
.msel-btn .msel-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msel-btn .msel-caret { color: var(--muted); font-size: 10px; margin-left: auto; }
.msel.msel-on .msel-btn { border-color: var(--brand-deep); background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.msel-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 200px; max-width: 300px;
  max-height: 300px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px;
}
.msel-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.msel-opt:hover { background: var(--canvas); }
.msel-opt input { flex: 0 0 auto; width: 16px; height: 16px; cursor: pointer; }
.msel-empty { color: var(--muted); font-size: 12.5px; padding: 8px; }

.result-info { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager { display: inline-flex; align-items: center; gap: 6px; }
.pager .pg-btn {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--nav-ink);
  border-radius: 6px; padding: 4px 10px; font-size: 12.5px; cursor: pointer;
}
.pager .pg-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-deep); }
.pager .pg-btn:disabled { opacity: .4; cursor: default; }
.pager .pg-cur { font-weight: 700; color: var(--nav-ink); }

/* ===================== テーブル ===================== */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
/* 在庫一覧の表：横スクロールの囲み(overflow)を外し、ページ自体をスクロールさせる＝列見出しの固定(sticky)を効かせる。
   物品名は折返すので既定の列構成は横にはみ出さない。 */
/* 在庫一覧の表：表の枠の中だけで縦横スクロール（ページ自体は横に流れない＝左メニュー・上部は固定のまま）。
   高さは JS(fitInventoryTableHeight) で画面下まで広げる。 */
.main > .table-wrap { overflow: auto; }
.grid-table { width: 100%; border-collapse: collapse; }
.grid-table thead th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfd; white-space: nowrap;
  position: sticky; top: 0; z-index: 5; /* 表の枠内スクロールで列見出し（1行目）を上端に固定 */
}
.grid-table th.col-money { text-align: right; }
.grid-table .col-check, .grid-table .td-check { width: 34px; text-align: center; padding-left: 10px; padding-right: 0; }
.grid-table .row-check, #check-all { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }
.grid-table tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; }
.grid-table tbody tr:last-child { border-bottom: none; }
.grid-table tbody tr:hover { background: var(--brand-soft); }
.grid-table td { padding: 11px 14px; vertical-align: middle; }
.td-mgmt { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.td-name .cat-tag {
  display: inline-block; background: #8b8578; color: #fff; font-size: 10.5px; font-weight: 600;
  padding: 1px 8px; border-radius: 4px; margin-bottom: 4px;
}
.td-name .nm { font-weight: 700; font-size: 14px; color: #2a3542; }
.td-name .rank-badge {
  font-size: 11px; font-weight: 800; padding: 0 7px; margin-right: 6px; min-width: 0;
}
.td-name .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.td-name .cond-tag {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; margin-right: 6px;
}
.cond-new { color: #2e7d32; background: #e8f5e9; border: 1px solid #c8e6c9; }
.qty-badge { display: inline-block; font-weight: 800; color: var(--brand-deep); font-size: 13px; margin-left: 2px; }
.td-qty { white-space: nowrap; text-align: center; color: #2a3542; }
.td-qty b { font-size: 14px; }
.td-qtyin { white-space: nowrap; }
.td-qtyin input { width: 64px; padding: 5px 6px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; }
.kaitori-hint { margin: 8px 2px 0; padding: 8px 12px; font-size: 12.5px; color: #1b5e20; background: #eafaf0; border: 1px solid #bce6c9; border-radius: 8px; }
/* 編集画面の物品名プルダウンの絞り込み検索（選択肢が数百件あるため） */
.nm-search { width: 100%; margin-bottom: 6px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.nm-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
/* 検索窓に入力したときに出る候補リスト（クリックで選択） */
.nm-pop { margin: -2px 0 6px; max-height: 240px; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--brand); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.10); }
.nm-pop.hidden { display: none; }
.nm-pop-h { position: sticky; top: 0; background: var(--brand-soft); color: var(--brand-deep);
  font-size: 11px; font-weight: 800; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.nm-pop-item { padding: 9px 12px; font-size: 13.5px; color: var(--ink); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); }
.nm-pop-item:last-child { border-bottom: none; }
.nm-pop-item:hover, .nm-pop-item.hi { background: var(--brand-soft); font-weight: 700; }
.nm-pop-empty { padding: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
/* 入力方式の切替（プルダウン／記述式）。.field は縦並びflexなので、指定しないと
   横いっぱいに引き伸ばされて「枠だけ右に長い」状態になる → 中身ぶんの幅に収める。 */
.name-mode { display: inline-flex; align-self: flex-start; width: fit-content; gap: 0; margin-left: 8px; vertical-align: middle;
  border: 1.5px solid var(--brand); border-radius: 7px; overflow: hidden; }
/* 非選択は淡いグレー、選択中はオレンジ塗り＋白文字。どちらが有効か一目で分かるようにする。 */
.name-mode .nm-btn { font-size: 11.5px; font-weight: 700; padding: 5px 16px; cursor: pointer; color: var(--muted); background: var(--canvas); user-select: none; white-space: nowrap; }
.name-mode .nm-btn + .nm-btn { border-left: 1.5px solid var(--brand); }
.name-mode .nm-btn.active { color: #fff; background: var(--brand); }
.name-mode .nm-btn:not(.active):hover { background: var(--brand-soft); color: var(--brand-deep); }
/* 新規登録：カテゴリ未選択の間のロック表示 */
.cat-gate-hint { background: #fff6e5; border: 1px solid #eab890; color: #8a5a20; padding: 10px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 700; margin: 2px 0 14px; }
.cat-locked .name-mode, .cat-locked .field-mode { pointer-events: none; opacity: .4; }

/* 保管場所・ランクの プルダウン＝横並びボタン選択 */
.chip-control { display: block; margin-top: 6px; }
.chip-control > input { width: 100%; }
/* 選択肢が多い項目（保管場所・物品名など）は枠内でスクロール。少ない項目は中身の高さに収まる */
/* 今の選択を枠の上に常に表示（選択肢が多いとチップが枠外に隠れて分からなくなるため） */
.chip-current { margin-bottom: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.chip-filter { width: 100%; padding: 7px 11px; margin-bottom: 6px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13.5px; background: var(--panel); color: var(--ink); }
.chip-cur-val { display: inline-block; padding: 3px 12px; margin-left: 2px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 13.5px; font-weight: 800; }
.chip-cur-none { color: var(--danger); font-weight: 700; }
.chip-row {
  position: relative;   /* 選択中チップの位置(offsetTop)をこの枠基準にする */
  display: flex; flex-wrap: wrap; gap: 9px; align-content: flex-start;
  max-height: 168px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--canvas);
  scrollbar-width: thin;
}
.chip-row::-webkit-scrollbar { width: 8px; }
.chip-row::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.opt-chip {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--nav-ink);
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; line-height: 1.2;
}
.opt-chip:hover { border-color: var(--brand); }
/* 選択中は太字＋リングで明示（ランクの固有色でも埋もれないよう box-shadow で囲う） */
.opt-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 800;
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--brand-deep); }
.opt-chip.opt-add { color: var(--brand-deep); border-style: dashed; }
/* ランクなどの色分け表示 */
.rank-badge { display: inline-block; min-width: 20px; padding: 1px 8px; border-radius: 4px; font-weight: 700; font-size: 12px; text-align: center; line-height: 1.5; background: #eef2ff; color: #4338ca; border: 1px solid #dfe4ff; }
.chip-color { width: 22px; height: 18px; border: 1px solid rgba(0,0,0,.2); border-radius: 3px; padding: 0; margin-left: 6px; background: none; cursor: pointer; vertical-align: middle; }
.cf-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.cf-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: #fff; }
.cf-chip input { margin: 0; }
.cf-chip:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); font-weight: 600; }
.cf-empty { font-size: 12px; color: var(--muted); }
/* API専用の受け皿（出品状況の中/小カテゴリなど）：グレーアウトで表示・手動編集不可 */
.cf-ro, input.cf-ro:disabled { background: #f0eee9; color: #6b6155; cursor: not-allowed; -webkit-text-fill-color: #6b6155; opacity: 1; }
/* 物品名プルダウンの一括登録 結果・折りたたみ */
.nio-details { margin-top: 6px; }
.nio-details > summary { cursor: pointer; font-size: 13px; color: var(--brand-deep); font-weight: 600; padding: 4px 0; }
.nio-details[open] > summary { margin-bottom: 6px; }
.nio-ok { font-size: 13px; margin-top: 8px; }
.nio-dup { color: var(--danger); font-weight: 600; }
.is-detail-head { font-weight: 700; font-size: 13.5px; color: #2a3542; margin: 14px 0 8px; }
/* 入庫明細・出庫明細（ZAICO風テーブル） */
#instock-modal .table-wrap, #outstock-modal .table-wrap { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 540px; }
.detail-table thead th { text-align: left; padding: 9px 12px; background: var(--canvas); color: var(--muted); font-weight: 700; font-size: 11.5px; border-bottom: 2px solid var(--line-strong); white-space: nowrap; }
.detail-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.detail-table tbody tr:last-child td { border-bottom: none; }
.detail-table tbody tr:hover { background: #fafbfc; }
.detail-table .dt-mgmt { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: 12px; white-space: nowrap; }
.detail-table .dt-name { font-weight: 700; color: #2a3542; }
.detail-table .dt-kind { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--brand-deep); background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 4px; padding: 0 6px; margin-left: 6px; vertical-align: 1px; }
.detail-table .dt-loc { color: var(--nav-ink); white-space: nowrap; }
.detail-table .dt-num { text-align: right; white-space: nowrap; }
.detail-table .dt-cur { font-weight: 700; color: #2a3542; }
.detail-table .dt-qtycell { color: var(--brand-deep); font-weight: 600; }
.detail-table .dt-input { width: 62px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; text-align: right; }
.detail-table .dt-fixed { color: var(--muted); }
/* 入庫は＋緑、出庫は−赤で増減を明示 */
.detail-table .dt-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 14px; }
.detail-table .dt-delta .dt-input { margin: 0 2px; font-weight: 700; }
.detail-table .dt-plus { color: #15803d; }
.detail-table .dt-plus .dt-input { border-color: #86c9a1; color: #15803d; }
.detail-table .dt-minus { color: #dc2626; }
.detail-table .dt-minus .dt-input { border-color: #e6a3a3; color: #dc2626; }
#instock-modal .with-btn, #outstock-modal .with-btn { display: flex; gap: 6px; align-items: stretch; }
#instock-modal .with-btn input, #outstock-modal .with-btn input { flex: 1; }
#instock-modal .with-btn .btn, #outstock-modal .with-btn .btn { flex: 0 0 auto; padding: 0 12px; }
/* 設定タブ */
.settings-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.settings-tabs .stab { padding: 9px 16px; font-size: 13.5px; font-weight: 700; color: var(--muted); background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.settings-tabs .stab:hover { color: var(--brand-deep); }
.settings-tabs .stab.active { color: var(--brand-deep); border-bottom-color: var(--brand); }

/* 追加項目カード（見やすい区切り） */
.cfa-list { display: flex; flex-direction: column; gap: 14px; }
.cfa-row { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.cfa-rowhead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cfa-rowhead b { font-size: 14.5px; color: #2a3542; }
.cfa-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); font-size: 12px; font-weight: 800; }
.cfa-badge { font-size: 11px; font-weight: 700; color: var(--brand-deep); background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 4px; padding: 1px 8px; }
.cfa-scope { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.cfa-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }
.cfa-f { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.cfa-f input, .cfa-f select { font-size: 13px; font-weight: 400; }
.cfa-opts { margin-top: 12px; }
.cfa-f-cats { grid-column: 1 / -1; }
.cfa-cats-hint { font-size: 11px; color: var(--muted); font-weight: 400; margin: 1px 0 5px; }
.cfa-cats-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 12px; max-height: 170px; overflow: auto; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; }
.cfa-catchk { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer; }
.cfa-catchk input { flex: 0 0 auto; width: 16px; height: 16px; }
.cfa-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.cfa-locked { background: #fbfbfa; }
.cfa-locked .cfa-rowhead { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.cfa-readopts { font-size: 12.5px; color: #4b5563; margin-top: 8px; }
.cfa-readopts span { color: var(--muted); font-weight: 600; }
.cfa-editing { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.cfa-editflag { font-size: 11px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 4px; padding: 1px 8px; margin-left: auto; }
.cfa-newbox { margin-top: 18px; padding: 14px 16px; border: 2px dashed #d9c4b5; border-radius: 10px; background: #fffaf6; }
.cfa-newtitle { font-weight: 800; font-size: 13.5px; color: var(--brand-deep); margin-bottom: 12px; }
.cfa-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cfa-add #nameopt-file { flex: 1 1 auto; }
@media (max-width: 860px) { .cfa-grid { grid-template-columns: 1fr; } }
/* 表示項目（列）設定 */
.dispcol-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.dispcol { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; cursor: pointer; background: #fff; }
.dispcol:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.dispcol.is-fixed { opacity: .7; cursor: default; background: var(--canvas); }
.dispcol input { margin: 0; }
.dispcol-tag { font-size: 10px; font-weight: 700; border-radius: 3px; padding: 0 5px; margin-left: 2px; }
.dispcol-tag.req { color: var(--muted); background: var(--line); }
.dispcol-tag.cf { color: var(--brand-deep); background: #fff3e9; border: 1px solid #f0cfba; }
/* 入庫/出庫一覧＝操作ログ表示 */
.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-row { display: grid; grid-template-columns: 130px 1fr; gap: 4px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.log-row:hover { border-color: var(--brand); }
.log-when { grid-row: 1 / span 2; font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; align-self: center; }
.log-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-name { font-size: 14px; color: #2a3542; }
.log-mgmt { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.log-sub { font-size: 12px; color: var(--muted); }
.log-action { font-size: 11.5px; font-weight: 800; color: #fff; border-radius: 4px; padding: 2px 9px; }
.log-入庫 { background: #7c3aed; }
.log-出庫 { background: #2563eb; }
.log-再入庫 { background: #16a34a; }
.log-登録 { background: #8b8578; }
.log-編集 { background: #e06c2c; }
.log-調整 { background: #0d9488; }
.log-qty { font-weight: 800; font-size: 13px; }
.log-qty.up { color: #16a34a; }
.log-qty.down { color: #c62828; }
/* 出庫一覧＝登録（バッチ）単位カード（1回の出庫確定＝1カード、クリックで明細展開） */
/* まとめてCSV：チェックしたまとまりを1つのCSVにする操作バー */
.ob-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.ob-selall { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--nav-ink); cursor: pointer; white-space: nowrap; }
.ob-selall input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.ob-selcount { font-size: 12.5px; color: var(--muted); flex: 1 1 auto; min-width: 0; }
.ob-selcount b { font-size: 15px; color: var(--brand-deep); }
.ob-check { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; flex: 0 0 auto; }
.ob-list { display: flex; flex-direction: column; gap: 8px; }
.ob-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden; }
.ob-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; cursor: pointer; }
.ob-head:hover { background: var(--brand-soft); }
.ob-caret { width: 14px; color: var(--muted); font-size: 12px; flex: none; }
.ob-when { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.ob-count { font-size: 15px; color: var(--nav-ink); font-variant-numeric: tabular-nums; }
.ob-sub { font-size: 12px; color: var(--muted); margin-left: -6px; }
.ob-op { font-size: 12px; color: var(--muted); }
.ob-note { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-body { border-top: 1px solid var(--line); background: var(--canvas); }
.ob-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px 8px 28px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.ob-item:hover { background: var(--brand-soft); }
.ob-mgmt { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.ob-name { color: var(--ink); font-weight: 700; }
.ob-qty { font-weight: 800; font-size: 12.5px; color: var(--nav-ink); }
.ob-meta { font-size: 12px; color: var(--muted); margin-left: auto; }
.ob-actions { padding: 10px 14px; text-align: right; }
/* 編集モーダルのタブ（基本情報／操作履歴） */
.edit-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 2px solid var(--line); background: var(--panel); }
.edit-tabs .etab { padding: 10px 18px; font-size: 13.5px; font-weight: 700; color: var(--muted); background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.edit-tabs .etab:hover { color: var(--brand-deep); }
.edit-tabs .etab.active { color: var(--brand-deep); border-bottom-color: var(--brand); }
/* 作成日時・更新日時（基本情報タブ下部） */
.edit-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 16px 20px 4px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.edit-meta b { color: var(--nav-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
/* 編集画面の操作履歴 */
.item-logs { display: flex; flex-direction: column; gap: 6px; }
.ilog-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ilog-when { font-family: ui-monospace, monospace; color: var(--muted); }
.ilog-meta { color: var(--muted); }

/* 棚卸一覧 */
.stk-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stk-head-note { font-size: 12.5px; color: var(--muted); }
.stk-pc-only { font-size: 13px; color: var(--brand-deep); font-weight: 700; background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 8px; padding: 7px 12px; }
.modal.restock-modal { max-width: 460px; }
.restock-fields { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.restock-cb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--nav-ink); padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.restock-cb:hover { background: var(--brand-soft); }
.restock-cb input { width: 16px; height: 16px; accent-color: var(--brand); }
.btn-refresh-view.has-updates { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.stk-updated { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stk-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.stk-badge-active { font-size: 11px; font-weight: 800; color: #fff; background: var(--brand); border-radius: 4px; padding: 1px 8px; margin-left: 6px; }
.stk-badge-closed { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--canvas); border: 1px solid var(--line); border-radius: 4px; padding: 1px 8px; margin-left: 6px; }
.stk-ok { color: #2e7d32; }
.stk-miss { color: #c62828; }
.stk-un { color: #e06c2c; }
/* ツール画面 */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tool-card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.tool-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.tool-ico { font-size: 26px; flex: 0 0 auto; }
.tool-body { display: flex; flex-direction: column; gap: 2px; }
.tool-body b { font-size: 14px; color: #2a3542; }
.tool-body small { font-size: 12px; color: var(--muted); }
/* ===================== リアルタイム更新 ===================== */
/* 作業中に他の人の変更が届いたときに出る「更新しますか」ボタン */
.rt-chip {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 60;
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 700; padding: 11px 18px; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.rt-chip:hover { filter: brightness(1.05); }
@media (max-width: 600px) { .rt-chip { bottom: 86px; } } /* 下部タブに重ねない */
/* アプリが新しくなったときのお知らせ（画面上部・クリックで更新） */
.update-bar {
  position: fixed; left: 50%; transform: translateX(-50%); top: 10px; z-index: 200;
  background: #15803d; color: #fff; border: none; cursor: pointer; text-align: center;
  font-size: 13px; font-weight: 800; padding: 8px 18px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100vw - 24px); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.update-bar:hover { filter: brightness(1.08); }
.update-bar.hidden { display: none; }
.update-bar .ub-sub { font-size: 11px; font-weight: 600; opacity: .9; margin-left: 8px; }
/* 狭い画面ではモーダルの見出し・✕に被らないよう下部に出す（下タブの上） */
@media (max-width: 860px) {
  .update-bar { top: auto; bottom: 86px; font-size: 12.5px; padding: 9px 16px; }
  .update-bar .ub-sub { display: none; }   /* 幅が足りないので補足は省く */
}

/* 編集中に他の人がこの商品を更新したときの警告バナー */
.edit-conflict {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 20px 12px; padding: 11px 14px; border-radius: 8px;
  background: #fef3c7; border: 1px solid #f0c674; color: #7a5b13;
  font-size: 13px; font-weight: 700;
}
.edit-conflict .ec-reload {
  margin-left: auto; background: var(--brand); color: #fff; border: none; cursor: pointer;
  font-size: 12.5px; font-weight: 700; padding: 7px 12px; border-radius: 6px;
}

/* 在庫金額（評価額） */
.val-now { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 12px; padding: 16px 18px; margin-bottom: 8px; }
.val-now-total { display: flex; flex-direction: column; gap: 2px; }
.val-now-total span { font-size: 12px; color: var(--muted); font-weight: 700; }
.val-now-total b { font-size: 28px; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.val-now-total small { color: var(--muted); font-size: 12px; }
.val-now-act { display: flex; gap: 8px; align-items: center; }
.val-h { font-size: 13px; color: var(--muted); font-weight: 700; margin: 16px 0 6px; }
.val-tablewrap { overflow-x: auto; }
.val-total td { font-weight: 800; color: #2a3542; background: #fbfcfd; border-top: 2px solid var(--line-strong); }
/* 指定日 在庫金額バー */
.asof-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.asof-datelbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--nav-ink); font-weight: 700; }
.asof-datelbl input { font-size: 14px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); }
/* ページごとに物品名幅がばらつくのを防ぐ：物品名は最小幅を確保、備考は固定幅（table-layout:auto の再配分対策） */
.grid-table .td-name { min-width: 200px; }
.grid-table .td-notes { width: 190px; min-width: 190px; max-width: 190px; }
.grid-table td.td-notes { white-space: normal; word-break: break-word; font-size: 12px; color: var(--muted); }
.grid-table .td-supplier { min-width: 130px; max-width: 160px; white-space: normal; word-break: break-word; }
/* 各列の幅を固定し、カテゴリ等が細切れに折り返して行が縦長になるのを防ぐ（幅の中だけで折り返す） */
.grid-table .td-mgmt { min-width: 92px; }
.grid-table .td-category { width: 150px; min-width: 150px; max-width: 170px; white-space: normal; word-break: break-word; }
.grid-table .td-name .cat-tag { white-space: nowrap; }        /* 物品名内のカテゴリタグは1行に収める */
.grid-table .td-loc { min-width: 96px; }
.grid-table .td-status { min-width: 84px; }
.grid-table .td-qty { min-width: 56px; }
.grid-table .td-flea { min-width: 92px; white-space: nowrap; }
.grid-table .td-createdby { min-width: 96px; white-space: nowrap; }
.asof-note { font-size: 11.5px; color: var(--muted); flex-basis: 100%; }

/* 割当て待ち（在庫ID未発行） */
.status-badge.st-割当て待ち { background: #fef3c7; color: #92600a; }
.regmode-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 12px; background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 10px; }
.regmode-label { font-size: 12px; font-weight: 800; color: var(--brand-deep); }
.regmode-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.regmode-toggle .rm-btn { font-size: 12.5px; font-weight: 700; padding: 6px 14px; cursor: pointer; color: var(--muted); background: var(--panel); border: none; }
.regmode-toggle .rm-btn + .rm-btn { border-left: 1px solid var(--line-strong); }
.regmode-toggle .rm-btn.active { background: var(--brand); color: #fff; }
.regmode-hint { font-size: 11.5px; color: var(--muted); flex: 1 1 100%; }
.field.mgmt-pending input { background: #fff7ed; color: #92600a; }

/* エクスポート履歴 */
.exlog-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.exlog-table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.exlog-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--nav-ink); }
.exlog-table td.num, .exlog-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.exlog-table .exlog-filter { color: var(--muted); font-size: 12px; }

/* 現在の在庫状態（編集画面の読み取り専用表示） */
.stockstate-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 6px; padding: 10px 12px; background: var(--chip);
  border: 1px dashed var(--line-strong); border-radius: 10px;
}
.stockstate-box .ss-dates { color: var(--muted); font-size: 12.5px; }

/* ===================== スマホ用ホーム＋下部タブ ===================== */
.home-view { display: block; }
.home-alert {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 15px;
  padding: 16px 18px; border-radius: 14px; margin-bottom: 16px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(214,132,50,.25);
}
.home-alert .ha-ico { font-size: 20px; }
.home-alert .ha-go { margin-left: auto; font-size: 22px; opacity: .9; }
/* 🛍 買取の割り当て・入庫待ちお知らせ（ホーム） */
.home-notice { margin: 0 0 14px; }
.home-notice-btn {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #fff3ef; border: 2px solid #f0a99a; color: #8a2a12;
  border-radius: 14px; padding: 14px 18px; font-size: 15px; font-weight: 700;
}
.home-notice-btn b { color: #c0330f; }
.home-notice-btn:hover { background: #ffe8e0; }
.home-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.home-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  aspect-ratio: 1 / .82; background: #fff; border: 1px solid var(--line); border-radius: 18px;
  cursor: pointer; transition: box-shadow .15s, transform .05s;
  box-shadow: 0 3px 10px rgba(0,0,0,.05);
}
.home-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.home-card:active { transform: scale(.98); }
.home-card .hc-ico { font-size: 46px; line-height: 1; }
.home-card .hc-lbl { font-size: 17px; font-weight: 800; color: #2a3542; letter-spacing: .08em; }
.home-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.home-stats .hs-chip {
  flex: 1 1 30%; min-width: 96px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
}
.home-stats .hs-chip i { font-style: normal; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.home-stats .hs-chip b { font-size: 19px; color: #2a3542; }
.home-stats .hs-tap { cursor: pointer; }

/* 下部タブ：スマホのみ表示 */
.tabbar { display: none; }
@media (max-width: 600px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px 0;
  }
  .tabbar-item .tb-ico { font-size: 20px; line-height: 1; }
  .tabbar-item .tb-lbl { font-size: 10.5px; font-weight: 700; }
  .tabbar-item.active { color: var(--brand-deep); }
  .tabbar-item.active .tb-ico { filter: none; }
  .main { padding-bottom: 78px !important; }
}
@media (min-width: 601px) {
  .home-view { display: none !important; }   /* ホーム画面はスマホ専用 */
}

/* ===================== 集計 ===================== */
.agg-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.agg-field { display: flex; flex-direction: column; gap: 4px; }
.agg-field label { font-size: 11px; font-weight: 700; color: var(--muted); }
.agg-field.agg-kw { flex: 1 1 240px; min-width: 200px; }
.agg-field input, .agg-field select {
  padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel); font-size: 13.5px; color: var(--nav-ink); height: 38px; }
.agg-bar .btn { height: 38px; }
.agg-result { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.agg-tablewrap { overflow-x: auto; }
.agg-table { width: 100%; border-collapse: collapse; }
.agg-table thead th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted);
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: #fbfcfd; white-space: nowrap; }
.agg-table th.num, .agg-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.agg-table tbody tr { border-bottom: 1px solid var(--line); }
.agg-table tbody tr:hover { background: var(--brand-soft); }
.agg-table td { padding: 11px 16px; font-size: 13.5px; color: var(--nav-ink); }
.agg-table tfoot .agg-total td { padding: 12px 16px; font-weight: 800; color: #2a3542;
  background: #fbfcfd; border-top: 2px solid var(--line-strong); }
.f-date { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.f-date input { font-size: 13px; }
.f-qty { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.f-qty input { font-size: 13px; width: 66px; padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--nav-ink); }
#f-custom { display: contents; }
.td-loc { color: var(--nav-ink); white-space: nowrap; }
.chip-unprinted { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--brand-deep); background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 4px; padding: 0 6px; vertical-align: 1px; }
.btn-unprinted.has-unprinted, #btn-unprinted.has-unprinted { border-color: var(--brand); color: var(--brand-deep); }
#unprinted-count { font-weight: 700; color: var(--brand-deep); }
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--nav-ink); }
.profit-pos { color: var(--ok); font-weight: 700; }
.profit-neg { color: var(--danger); font-weight: 700; }

.status-badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-未入庫  { background: #ede9fe; color: #6d28d9; }
.st-在庫あり { background: #dcfce7; color: #15803d; }
.st-在庫なし { background: #e5e7eb; color: #4b5563; }
.st-在庫    { background: #eef1f5; color: #55606e; }
.st-出品中  { background: #e0f2fe; color: #0369a1; }
.st-売約済  { background: #fef3c7; color: #b45309; }
.st-販売済  { background: #dcfce7; color: #15803d; }
.st-出庫済  { background: #e5e7eb; color: #374151; }
.st-返品    { background: #fee2e2; color: #b91c1c; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.hidden { display: none !important; }

/* 新規登録履歴（フォルダ別） */
.folder-view { display: flex; flex-direction: column; gap: 12px; }
.fv-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.fv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fv-name { font-size: 16px; font-weight: 800; color: #2a3542; }
.fv-counts { font-size: 13px; color: var(--muted); }
.fv-counts b { color: var(--nav-ink); font-size: 15px; }
.fv-notyet { color: #6d28d9 !important; }
.fv-meta { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }
.fv-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fv-btn { padding: 8px 14px; font-size: 13px; }
.fv-btn:disabled { opacity: .45; cursor: not-allowed; }
.fv-empty { text-align: center; color: var(--muted); padding: 44px 20px; line-height: 1.8; }

/* ===================== モーダル ===================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23,32,43,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; z-index: 60; overflow: auto;
}
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 60px rgba(2,6,23,.35); overflow: hidden; margin: auto;
  /* モーダル全体を画面内に収め、本文だけスクロール・フッター(保存ボタン)を常に表示（スマホで保存が押せない対策） */
  display: flex; flex-direction: column; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
.modal.scan { max-width: 460px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
/* ページ切替モード：編集を全画面ページ化（URL: #item/在庫ID）。ポップアップ既定は影響なし。 */
.modal-backdrop.as-page { background: var(--canvas); align-items: stretch; padding: 0; }
.modal-backdrop.as-page > .modal { max-width: none; width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; box-shadow: none; margin: 0; }
.edit-back { display: none; background: none; border: none; color: var(--brand-deep); font-size: 13.5px; font-weight: 700; cursor: pointer; padding: 5px 10px; border-radius: 7px; }
.edit-back:hover { background: var(--brand-soft); }
.modal-backdrop.as-page .edit-back { display: inline-flex; align-items: center; }
/* 「商品を開く方法」トグル（設定→表示項目） */
.ivm-box { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; background: var(--canvas); }
.ivm-title { font-size: 13px; font-weight: 800; color: var(--nav-ink); margin-bottom: 6px; }
.ivm-opt { display: flex; align-items: flex-start; gap: 8px; padding: 6px 2px; font-size: 13px; color: var(--ink); cursor: pointer; line-height: 1.6; }
.ivm-opt input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.ivm-opt code { font-family: ui-monospace, monospace; font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.ivm-hint { font-size: 12px; color: var(--ok); margin-top: 6px; min-height: 15px; font-weight: 600; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex: 0 0 auto; }
.modal-foot .spacer { flex: 1; }
.close { border: none; background: none; font-size: 18px; color: var(--muted); padding: 4px 8px; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 10px 14px 14px; }
legend { font-size: 12px; font-weight: 700; color: var(--brand-deep); padding: 0 6px; }
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.field.wide { grid-column: 1 / -1; }
.reqmark { color: var(--danger); font-weight: 700; }
.hint-mini { font-weight: 400; color: var(--muted); font-size: 11px; }
/* 直接仕入登録：入力したフォルダ名が既存か新規かの案内（登録漏れの追加時に取り違えないように） */
.dp-folder-hint { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.dp-folder-hint.is-existing { color: var(--brand-deep); }
/* 既存フォルダを選ぶプルダウン（登録漏れの追加用）。見つけやすいよう枠色を変える */
.dp-folder-pick { margin-top: 6px; width: 100%; font-size: 12.5px; border-color: var(--brand); color: var(--brand-deep); }
.field input[readonly] { background: var(--canvas); color: var(--muted); cursor: not-allowed; font-family: ui-monospace, Menlo, monospace; }
.field input.fld-locked[readonly] { font-family: inherit; } /* フォルダ等の名前系はモノスペースにしない */
.bc-value { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); background: var(--canvas); border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 12px; word-break: break-all; user-select: all; } /* バーコード：表示のみ・グレー・値を選択コピーしやすく */
/* 割り当て入庫：GamaQ買取システムの登録個数を参考表示（実物と突き合わせて入庫個数のミス防止） */
.ac-gamaq { margin: 2px 0 8px; padding: 9px 11px; background: #fff7ed; border: 1.5px solid #f59e0b; border-radius: 8px; font-size: 14px; color: #92400e; font-weight: 700; }
.ac-gamaq b { font-size: 19px; color: #b45309; margin: 0 2px; }
.ac-gamaq-hint { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 400; color: #a16207; }
.ac-qty-cmp { margin-top: 6px; font-size: 13px; font-weight: 700; }
.ac-qty-cmp.ok { color: #0f6e56; }
.ac-qty-cmp.warn { color: #b23c2c; }
.field input, .field textarea, .field select {
  padding: 12px 12px; border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: 14.5px; line-height: 1.4; color: var(--ink); background: var(--panel); font-weight: 400;
}
.field input:not([type=date]):not([type=number]), .field select { min-height: 44px; }
.field textarea { min-height: 64px; }
/* スマホ(iOS Safari)は、フォント16px未満の入力にフォーカスすると画面を自動で拡大する。
   日付・検索・数値などどの入力に触れても表示が動く（ズームされる）のを防ぐため、
   タッチ端末では全ての入力・選択・テキストエリアを16pxに統一する（＝表示を固定）。
   デスクトップ(マウス)は拡大が起きないので従来サイズのまま。 */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
/* 一括編集モーダル */
#be-value-wrap { font-size: 12px; color: var(--muted); font-weight: 600; }
.be-mode { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--nav-ink); font-weight: 500; }
.be-mode label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.be-mode input { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); }
.be-hint { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.7; }
/* フリマ管理チェック：目立つカード。ON/OFFは「チェックボックス＋見出し」だけで切替。
   説明文や周りの余白をクリックしても切り替わらない（誤操作防止）。 */
.field.wide.flea-box { display: block; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 9px; padding: 8px 11px; }
.field.wide.flea-box:has(.flea-cb:checked) { border-color: var(--brand-deep); }
/* クリックで切り替わる範囲は、チェックボックス＋見出しの幅だけ（inline-flex で横いっぱいに広げない） */
.flea-toggle { display: inline-flex; align-items: center; gap: 8px; width: auto; cursor: pointer; user-select: none; }
/* 高い詳細度で .field input の min-height:44px を上書き（チェックボックスは少し大きめの通常サイズ） */
.field.wide.flea-box input[type=checkbox].flea-cb { width: 19px; height: 19px; min-height: 0; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--brand); cursor: pointer; }
.flea-ttl { font-size: 13.5px; font-weight: 700; color: var(--brand-deep); line-height: 1.3; }
/* 説明文はクリック対象外（カーソルも通常に） */
.flea-desc { margin: 5px 0 0; padding-left: 27px; font-size: 11.5px; font-weight: 500; color: var(--muted); line-height: 1.5; cursor: default; }
.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; }
#name-control { display: block; }
#name-control input, #name-control select { width: 100%; }
.mini { padding: 6px 10px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px; font-size: 12px; }

/* 諸経費・原価 */
.costs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cost-rows { display: flex; flex-direction: column; gap: 6px; }
.cost-row { display: grid; grid-template-columns: 1fr 120px 150px 32px; gap: 8px; align-items: center; }
.cost-row input { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 14px; color: var(--ink); background: var(--panel); }
.cost-row .cost-amount { text-align: right; }
.cost-row .cost-paid { font-size: 12.5px; color: var(--muted); }
.cost-del { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px; color: var(--danger); padding: 6px 0; }
.total-cost-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.tc-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.total-cost-box { font-size: 20px; font-weight: 800; color: var(--brand-deep); font-variant-numeric: tabular-nums; }

/* 設定：カテゴリ別費目 */
.settings-note { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.settings-cat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.settings-cat-name { font-weight: 800; color: #2a3542; margin-bottom: 8px; }
.settings-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cost-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-deep); border: 1px solid #f0cfba; border-radius: 999px; padding: 4px 6px 4px 8px; font-size: 13px; font-weight: 600; }
.cost-chip .chip-del { border: none; background: none; color: var(--brand-deep); font-size: 12px; padding: 0 2px; cursor: pointer; }
.cost-chip .chip-grip { cursor: grab; color: var(--muted); font-size: 13px; line-height: 1; letter-spacing: -2px; user-select: none; }
.cost-chip.chip-dragging { opacity: .5; }
/* 並び替えバー（昇順/降順・ドラッグ案内） */
.chip-sort-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.chip-sort-row .chip-sort { padding: 3px 10px; font-size: 12.5px; }
.chip-sort-hint { font-size: 11.5px; }
.settings-empty { color: var(--muted); font-size: 12px; }
.settings-field { margin-top: 10px; }
.settings-sub { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.name-type-sel { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); color: var(--ink); font-size: 13px; }

/* 棚卸／月次レポート */
.modal.report { max-width: 880px; }
.report-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.report-controls label { font-size: 13px; font-weight: 700; color: var(--nav-ink); }
.report-controls input[type=month] { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 14px; color: var(--ink); background: var(--panel); }
.report-note { font-size: 12px; color: var(--muted); }
.report-note b { color: var(--brand-deep); }
.report-cards { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.report-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--panel); display: flex; flex-direction: column; gap: 2px; }
.report-card i { font-style: normal; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.report-card b { font-size: 22px; font-weight: 800; color: #2a3542; font-variant-numeric: tabular-nums; }
.report-card small { font-size: 11px; color: var(--muted); }
.report-card.big { background: var(--brand-soft); border-color: #f0cfba; }
.report-card.big b { color: var(--brand-deep); }
.report-card.warn { border-color: #f3c9a0; }
.report-card.warn b { color: var(--warn); }
.report-h { font-size: 13px; font-weight: 800; color: #2a3542; margin: 18px 0 8px; }
.report-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-table th { text-align: left; background: #fbfcfd; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.report-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.report-table tr:last-child td { border-bottom: none; }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table th.num { text-align: right; }
.rp-mgmt { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); }
.rp-empty { text-align: center; color: var(--muted); padding: 16px 0; }

@media (max-width: 720px) {
  .report-cards { grid-template-columns: 1fr; }
  .cost-row { grid-template-columns: 1fr 90px 34px; grid-template-areas: "label amount del" "paid paid paid"; }
  .cost-row .cost-label { grid-area: label; }
  .cost-row .cost-amount { grid-area: amount; }
  .cost-row .cost-del { grid-area: del; }
  .cost-row .cost-paid { grid-area: paid; }
}

.cost-add { padding: 6px 10px; border: 1px dashed var(--line-strong); border-radius: 999px; font-size: 13px; width: 140px; background: var(--panel); color: var(--ink); }
.td-name .total, .money.total b { color: var(--brand-deep); }

/* スキャン */
#reader { width: 100%; border-radius: 10px; overflow: hidden; }
/* カメラズーム・バー（対応端末のみ表示）。小さいQRを大きく写して読み取りやすくする。 */
.scan-zoom { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; padding: 6px 10px; background: var(--canvas); border: 1px solid var(--line-strong); border-radius: 10px; }
.scan-zoom .sz-lbl { font-size: 13px; font-weight: 800; color: var(--nav-ink); flex: 0 0 auto; }
.scan-zoom .sz-btn { flex: 0 0 auto; width: 40px; height: 40px; border: 1.5px solid var(--brand); background: #fff; color: var(--brand-deep); font-size: 22px; font-weight: 800; border-radius: 10px; cursor: pointer; line-height: 1; }
.scan-zoom .sz-btn:active { background: var(--brand-soft); }
.scan-zoom #sz-range { flex: 1 1 auto; min-width: 0; height: 32px; accent-color: var(--brand); }
.scan-zoom .sz-val { flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--brand-deep); min-width: 42px; text-align: right; }
#reader-file { position: absolute; width: 0; height: 0; overflow: hidden; }
.scan-hint { text-align: center; color: var(--muted); font-size: 13px; }
.scan-https-link {
  display: inline-block; margin: 10px auto 6px; padding: 12px 18px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 15px; text-decoration: none;
}
.scan-https-link:active { opacity: .85; }
.scan-https-note { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.scan-modes { display: flex; gap: 5px; margin-bottom: 8px; }
.scan-modes button {
  flex: 1; padding: 9px 2px; border: 1px solid var(--line-strong); background: var(--panel);
  border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--nav-ink); white-space: nowrap;
}
.scan-modes button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.scan-mode-desc { font-size: 12px; color: var(--muted); margin: 0 0 5px; text-align: center; line-height: 1.35; }
/* 棚卸スキャン中はカメラを少しでも上に：上部ボックスの余白を詰める（文言は変えない） */
.modal.scan .modal-body { padding-top: 10px; }
.scan-stock-summary { text-align: center; font-size: 14px; padding: 7px 8px; border-radius: 8px; margin-bottom: 6px; }
.scan-stock-summary b { font-size: 18px; }
.scan-stock-summary.live { background: #fef2f2; color: #991b1b; border: 1px solid #f2c9c9; }
.scan-stock-summary.idle { background: var(--canvas); color: var(--muted); border: 1px solid var(--line); }
.st-live { font-weight: 800; color: #dc2626; margin-right: 6px; }
/* いまスキャン中の棚を「作業中」枠の中で目立たせる */
.st-shelf { margin-top: 4px; padding: 5px 8px; background: #fff; border: 1.5px solid #dc2626; border-radius: 8px; font-size: 15px; color: #1f2937; }
.st-shelf b { font-size: 22px; color: #b91c1c; }
.st-line { font-size: 13px; margin-top: 2px; color: var(--nav-ink); }
.st-line b { font-size: 20px; }
.stkcols-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.stkcols-list .lc-field { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.st-sub { font-size: 11px; color: #a06b6b; margin-top: 2px; }
.st-started { color: var(--muted); font-size: 12px; }
.st-hint { color: var(--muted); font-size: 12px; }
.st-result-title { font-weight: 700; color: #2a3542; margin-bottom: 6px; font-size: 13px; }
/* 棚卸 締めパネル（PC専用） */
.stocktake-pc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel); }
.st-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.st-actions .btn { padding: 8px 12px; font-size: 13px; }
.st-columns { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.st-columns-note { width: 100%; font-size: 12px; font-weight: 700; color: var(--muted); }
.st-columns .lc-field { flex-direction: row !important; align-items: center; gap: 5px !important; font-size: 13px !important; color: var(--nav-ink) !important; font-weight: 500 !important; }
#st-result { margin-top: 10px; }
.st-summary { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--nav-ink); margin-bottom: 10px; }
.st-summary b { font-size: 16px; }
.st-summary .st-ok b { color: var(--ok); }
.st-summary .st-miss b { color: var(--danger); }
.st-summary .st-un b { color: var(--warn); }
.st-csv { display: inline-flex; }

/* 出庫 2段階（確認カード＋仮登録） */
.out-panel { margin-bottom: 10px; }
.out-status-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--ink); background: var(--brand-soft); border: 1px solid #eecdb4; border-radius: 8px; padding: 8px 12px; }
.out-status-bar select { flex: 1; max-width: 200px; }
.out-note-bar { margin-bottom: 10px; }
.out-note-bar input { width: 100%; box-sizing: border-box; padding: 8px 12px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; }
/* 棚入れスキャン：現在の棚バナー */
.shelve-panel { margin-bottom: 10px; }
.shelve-current { border: 2px solid var(--brand); background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; text-align: center; }
.shelve-loc-label { font-size: 12px; color: var(--brand-deep); }
.shelve-loc-val { font-size: 30px; font-weight: 800; color: var(--brand-deep); line-height: 1.2; margin: 2px 0; font-variant-numeric: tabular-nums; }
.shelve-count { font-size: 13px; color: var(--ink); }
.shelve-loc-empty { font-size: 15px; color: var(--brand-deep); font-weight: 700; padding: 6px 0; }
.shelve-pending-h { margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--brand-deep); }
.shelve-pending-empty { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.shelve-pending { margin: 6px 0; max-height: 240px; overflow-y: auto; text-align: left; }
.shelve-prow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 4px; }
.shelve-prow-main { flex: 1; min-width: 0; font-size: 13px; }
.shelve-prow-main .sl-mgmt { color: var(--muted); font-size: 11px; }
.shelve-prow-loc { font-size: 12px; color: var(--nav-ink); margin-top: 1px; }
.shelve-prow-del { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; color: var(--muted); flex: none; }
.shelve-prow-del:hover { background: #fde8e8; color: #c0392b; border-color: #e6b8b8; }
.shelve-save-btn { width: 100%; margin-top: 6px; font-size: 15px; padding: 12px; }
/* アクションスキャン パネル */
.action-panel { margin-top: 12px; }
.action-current { border: 2px solid var(--brand); background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; }
.action-empty { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; padding: 6px 0; }
.action-pick { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px dashed #e6c6ab; }
.action-pick-lbl { font-size: 12px; font-weight: 700; color: var(--brand-deep); }
.action-pick select { width: 100%; box-sizing: border-box; padding: 9px 12px; font-size: 15px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); }
.action-fv { font-size: 13px; color: var(--nav-ink); }
.action-pending-h { margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--brand-deep); }
.action-pending-empty { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }
.action-pending { margin: 6px 0; max-height: 220px; overflow-y: auto; }
.action-prow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 4px; font-size: 13px; }
.action-prow span { flex: 1; min-width: 0; }
.action-prow .sl-mgmt { color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.action-prow-del { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; color: var(--muted); flex: none; }
.action-prow-del:hover { background: #fde8e8; color: #c0392b; border-color: #e6b8b8; }
.action-apply-btn { width: 100%; margin-top: 8px; font-size: 15px; padding: 12px; }
.action-apply-btn:disabled { opacity: .5; }
/* アクション管理（設定）：一覧の行 */
.act-row .act-main { display: flex; flex-direction: column; gap: 2px; }
.act-row .act-fv { font-size: 12px; color: var(--muted); }
/* 保管場所：棚QR読取ボタン */
/* 棚のQR読取はカメラのあるスマホ専用。PCではカメラを使わないので出さない。 */
.loc-scan-btn { margin-top: 8px; display: none; width: 100%; justify-content: center; background: #eef4fb; border: 1.5px solid #2f6fd0; color: #1d4e8f; font-weight: 700; padding: 12px; font-size: 15px; }
.loc-scan-btn:hover { background: #e0ecfa; }
@media (max-width: 860px) { .loc-scan-btn { display: flex; } }
/* 棚QR印刷モーダル */
.sl-add { display: flex; gap: 8px; margin: 6px 0 12px; }
.sl-add input, #addshelf-modal #sl-new { flex: 1; width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; background: var(--panel); color: var(--ink); }
.sl-addrow { margin: 4px 0 10px; }
.sl-filter { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; background: var(--panel); color: var(--ink); margin-bottom: 8px; }
.stk-loc-panel { margin-bottom: 10px; }
.stk-loc-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; color: var(--ink); }
.stk-loc-pick { cursor: pointer; }
.sl-toolbar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.sl-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 46vh; overflow-y: auto; }
.sl-item { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 3px 4px 3px 10px; font-size: 14px; font-variant-numeric: tabular-nums; background: var(--panel); }
.sl-item .sl-pick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 4px 4px 0; }
.sl-item .sl-cb { width: 16px; height: 16px; accent-color: var(--brand); }
.sl-item .sl-del { flex: 0 0 auto; width: 26px; height: 26px; border: 1px solid var(--line-strong); background: #fff; color: #b23c2c; font-size: 13px; font-weight: 800; border-radius: 6px; cursor: pointer; line-height: 1; }
.sl-item .sl-del:hover { background: #fdecea; border-color: #d8695a; }
.sl-item.on { border-color: var(--brand); background: var(--brand-soft); }
.sl-qtywrap { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--brand-deep); font-weight: 700; }
.sl-qty { width: 64px; height: 36px; padding: 4px 6px; box-sizing: border-box; border: 2px solid var(--brand); border-radius: 8px; font-size: 18px; font-weight: 800; text-align: center; background: #fff; color: var(--ink); }
.oc-card { border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.oc-card.oc-bad { border-color: #f0c2c2; background: #fee2e2; color: #991b1b; }
.oc-mgmt { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.oc-name { font-size: 16px; font-weight: 800; color: #2a3542; margin: 2px 0; }
.oc-meta { font-size: 12px; color: var(--muted); }
.oc-calc { font-size: 15px; margin: 8px 0; color: var(--nav-ink); }
.oc-calc b { font-size: 18px; }
.oc-calc b.ok { color: var(--ok); }
.oc-calc b.ng { color: var(--danger); }
.oc-warn { font-weight: 700; color: var(--danger); padding: 6px 0; }
.oc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.oc-actions .btn { padding: 9px 14px; }
/* 出庫：カメラ下部の仮登録。内部スクロールで蓄積してもカメラが動かない */
.out-pending-panel { margin-top: 12px; }
.out-pending { display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow-y: auto; }
.op-qty { color: var(--brand-deep); font-weight: 800; margin: 0 2px; }
.oc-ok { font-weight: 700; color: var(--ok); padding: 6px 0; }
.op-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.op-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; background: var(--canvas); border-radius: 6px; font-size: 13px; }
.op-del { border: none; background: none; color: var(--danger); font-size: 18px; cursor: pointer; line-height: 1; padding: 0 4px; }
.op-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; }
.out-commit { width: 100%; margin-top: 10px; padding: 12px; font-size: 15px; }

.scan-log { max-height: 200px; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.scan-log-row { font-size: 12.5px; padding: 6px 10px; border-radius: 6px; background: var(--canvas); }
.scan-log-row.ok { background: #dcfce7; color: #14532d; }
.scan-log-row.dup { background: #fef9c3; color: #854d0e; }
.scan-log-row.err { background: #fee2e2; color: #991b1b; }
.scan-log-row.head { background: none; font-weight: 700; color: var(--ink); padding-bottom: 2px; }
.scan-log-row.miss { background: none; color: var(--nav-ink); padding: 2px 10px; }
.sl-mgmt { font-family: ui-monospace, monospace; color: var(--muted); font-size: 11px; }
/* 棚卸：積み上がる一覧（在庫IDを大きく） */
.scan-log-row .sl-id { font-family: ui-monospace, Menlo, monospace; font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: .3px; }
.scan-log-row .sl-sub { font-size: 12.5px; margin-top: 2px; }
/* 棚卸ログ：本文＋「取消」ボタンの横並び */
.scan-log-row.sl-flex { display: flex; align-items: center; gap: 10px; }
.scan-log-row.sl-flex .sl-body { flex: 1 1 auto; min-width: 0; }
.scan-log-row .sl-unscan { flex: 0 0 auto; background: #fff; border: 1.5px solid #d8695a; color: #b23c2c; font-weight: 800; font-size: 13px; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.scan-log-row .sl-unscan:hover { background: #fdecea; }
.sl-ok { color: #1d4ed8; font-weight: 800; }
.sl-dup { color: #dc2626; font-weight: 800; }
.sl-out { color: #92400e; font-weight: 700; }
.sl-restored { color: #0369a1; font-weight: 800; }   /* 棚卸で在庫0→1に在庫化 */

/* 棚卸：カメラ上部のスキャン結果バナー */
.scan-feedback { text-align: center; border-radius: 10px; padding: 7px 10px; margin-bottom: 6px; border: 1px solid var(--line); }
.scan-feedback .fb-id { font-family: ui-monospace, Menlo, monospace; font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.scan-feedback .fb-name { font-size: 13.5px; margin-top: 2px; color: var(--nav-ink); }
.scan-feedback .fb-loc { color: var(--muted); }
.scan-feedback .fb-status { font-size: 16px; font-weight: 800; margin-top: 4px; }
.scan-feedback.fb-ok { background: #eff6ff; border-color: #bfdbfe; }
.scan-feedback.fb-ok .fb-status { color: #1d4ed8; }        /* 青：スキャンOK */
.scan-feedback.fb-dup { background: #fef2f2; border-color: #fecaca; }
.scan-feedback.fb-dup .fb-status { color: #dc2626; }        /* 赤：すでにスキャン済 */
.scan-feedback.fb-err { background: #fef2f2; border-color: #fecaca; }
.scan-feedback.fb-err .fb-status { color: #b91c1c; font-size: 14px; }

/* 棚卸：複数個カウントのポップアップ */
.stc-head { text-align: center; margin-bottom: 14px; }
.stc-head .stc-id { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 800; }
.stc-head .stc-name { font-size: 14px; color: var(--nav-ink); margin-top: 2px; }
.stc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; }
.stc-cell { text-align: center; }
.stc-lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stc-sys { font-size: 26px; font-weight: 800; }
.stc-input { width: 100%; font-size: 22px; font-weight: 800; text-align: center; padding: 8px; border: 2px solid var(--brand-deep); border-radius: 8px; background: var(--panel); color: var(--ink); }
.stc-diff { font-size: 26px; font-weight: 800; }
.stc-diff.diff-zero { color: #16a34a; }
.stc-diff.diff-nonzero { color: #dc2626; }
.adj-head { font-weight: 800; font-size: 15px; color: var(--brand-deep); margin-bottom: 10px; }
.adj-diff { min-height: 22px; font-size: 15px; font-weight: 800; margin: 6px 0 2px; color: var(--muted); }
.adj-diff.adj-plus { color: #16a34a; }
.adj-diff.adj-minus { color: #dc2626; }
.scan-fallback { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; font-size: 13px; color: var(--muted); }
.scan-manual { display: flex; gap: 8px; margin-top: 12px; }
.scan-manual input { flex: 1; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 6px; }

/* 選択バー */
.select-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff; border-radius: 999px; padding: 8px 10px 8px 20px;
  display: flex; align-items: center; gap: 12px; z-index: 45; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.select-bar .sb-count { font-size: 13px; }
.select-bar .sb-count b { font-size: 16px; color: #fdd9c2; }
.select-bar .btn { padding: 8px 14px; }
.select-bar .btn-outline { background: transparent; color: #cbd5e1; border-color: #3a4653; }

/* ラベル印刷モーダル */
.modal.label-modal { max-width: 720px; }
.label-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
.lc-title { font-size: 12px; font-weight: 800; color: var(--brand-deep); margin-bottom: 8px; }
.lc-title2 { font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.label-preview-col { display: flex; flex-direction: column; align-items: center; }
.label-preview {
  display: inline-flex; align-items: center; justify-content: center;
  background: repeating-conic-gradient(#f0f2f5 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  border: 1px dashed var(--line-strong); border-radius: 6px; padding: 8px; min-height: 60px;
}
.label-count-note { margin-top: 10px; font-size: 12px; color: var(--muted); }
.label-config label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.lc-inline { margin-bottom: 10px; }
.lc-blank-count-wrap { background: var(--brand-soft); border: 1px solid #f0cfba; border-radius: 8px; padding: 8px 10px; }
.lc-blank-count-wrap input { font-size: 16px; font-weight: 700; }
.label-config select, .label-config input[type=number] {
  padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; color: var(--ink); background: var(--panel); font-weight: 400;
}
.lc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
/* 保存済みプリセットの操作ボタン */
.lc-preset-actions { display: flex; gap: 6px; margin: -4px 0 10px; }
.lc-preset-actions .btn { flex: 1; justify-content: center; }
.lc-preset-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.lc-a4opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; align-items: end; }
.lc-check { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 13px !important; color: var(--nav-ink) !important; }
.lc-fields { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.lc-field { flex-direction: row !important; align-items: center; gap: 5px !important; font-size: 13px !important; color: var(--nav-ink) !important; font-weight: 500 !important; }

/* ラベル（プレビュー共通） */
/* QRを中央上、その下に在庫ID（縦並び・中央揃え） */
/* 左右の余白は広め（2.5mm）＝裁断機で切るときに、端に寄せた文字が切れないための安全マージン */
.label { display: flex; flex-direction: column; gap: 1mm; align-items: center; justify-content: center; padding: 1.5mm 2.5mm; overflow: hidden; background: #fff; color: #111; box-shadow: 0 1px 4px rgba(0,0,0,.15); text-align: center; }
.label-preview .label-qr img { width: var(--qr, 18mm); height: var(--qr, 18mm); display: block; }
.label-preview .label-fields { font-size: var(--font, 8pt); line-height: 1.25; min-width: 0; max-width: 100%; text-align: center; }
.label-preview .lf-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.label-preview .lf-mgmt { font-family: ui-monospace, monospace; font-weight: 700; }
.label-preview .lf-name { font-weight: 700; white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
.label-preview .lf-notes { white-space: normal; word-break: break-word; }   /* 備考は長くなり得るので折り返して表示 */
/* 横レイアウト：QRを左に、選んだ項目を右に。QRの下に在庫IDを表記。 */
.label-side { flex-direction: row; align-items: center; justify-content: flex-start; gap: 1.5mm; }
.label-qrcol { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; gap: 0.5mm; min-width: 0; }
.label-side .label-fields { text-align: left; align-self: center; flex: 1 1 auto; min-width: 0; }
.lf-underqr { font-size: var(--font, 8pt); line-height: 1.1; word-break: break-all; text-align: center; }

@media (max-width: 720px) {
  .label-layout { grid-template-columns: 1fr; }
}

/* CSV一括取込 */
.modal.import-modal { max-width: 720px; }
.import-note { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.import-tmpl { margin-bottom: 14px; }
.import-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.import-controls .field { font-size: 12px; color: var(--muted); font-weight: 600; }
.import-controls input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 14px; color: var(--ink); background: var(--panel); font-weight: 400; }
.import-count { font-size: 13px; color: var(--nav-ink); margin-bottom: 8px; }
.import-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow-y: auto; }
.import-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.import-table th { position: sticky; top: 0; background: #fbfcfd; color: var(--muted); font-weight: 700; text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.import-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.import-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px; border: 1px dashed var(--line); border-radius: 8px; }

@media (max-width: 720px) { .import-controls { grid-template-columns: 1fr; } }

/* ログイン画面 */
.auth-overlay { position: fixed; inset: 0; background: var(--canvas); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.auth-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px 26px; width: 100%; max-width: 360px; box-shadow: 0 20px 60px rgba(2,6,23,.18); }
.auth-brand { font-size: 20px; font-weight: 800; color: #2a3542; text-align: center; margin-bottom: 20px; }
.auth-brand .brand-mark { color: var(--brand); }
.auth-brand b { color: var(--brand); }
.auth-title { font-size: 16px; margin: 0 0 14px; color: #2a3542; }
.auth-note { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.auth-box input { display: block; width: 100%; padding: 11px 12px; margin-bottom: 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 15px; color: var(--ink); background: var(--panel); }
.auth-box input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.auth-submit { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.auth-err { background: #fee2e2; color: #991b1b; font-size: 13px; padding: 8px 10px; border-radius: 6px; margin-bottom: 10px; }

.header-logout { border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius); padding: 5px 12px; font-size: 12px; color: var(--nav-ink); cursor: pointer; }
.header-logout:hover { background: #fafbfc; }

/* ユーザー管理 */
.user-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--canvas); border-radius: 6px; font-size: 13px; }
.user-del { border: 1px solid #f0c2c2; background: var(--panel); color: var(--danger); border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.user-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 10px; border-top: 1px dashed var(--line); }
.user-add input { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; color: var(--ink); background: var(--panel); }
.nu-adminlbl { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--nav-ink); }

/* トースト */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.err { background: var(--danger); }

/* ===================== フリマサイト管理 ===================== */
.flea-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.flea-sum-chip {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.flea-sum-chip:hover { border-color: var(--brand); }
.flea-sum-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.flea-sum-chip.danger.active { background: var(--danger); border-color: var(--danger); }
.flea-sum-chip.warn.active { background: var(--warn); border-color: var(--warn); }
.flea-searchbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.flea-searchbar input[type="search"] {
  flex: 1; max-width: 420px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; background: var(--panel); color: var(--ink);
}
.flea-note { color: var(--muted); font-size: 12.5px; }
.flea-filter-sel, .flea-filter-month { border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: var(--panel); color: var(--ink); }
.flea-filter-sel { max-width: 180px; }
.flea-billing { margin: -4px 0 12px; padding: 9px 14px; background: var(--brand-soft, #fbeadf); border: 1px solid #eecdb4; border-radius: 10px; font-size: 14px; color: var(--ink); }
.flea-billing b { font-size: 16px; color: var(--brand-deep, #b4531c); }
.flea-billing-note { color: var(--muted); font-size: 12px; }
.flea-note-inp { min-width: 140px; }
/* 表の枠の中だけで縦横スクロールさせる（高さは JS の fitFleaTableHeight で画面下まで広げる）。
   ページごとスクロールすると sticky の見出しも一緒に流れてしまうため、枠内スクロールにして見出しを固定する。 */
.flea-tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.flea-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.flea-table thead th {
  text-align: left; background: var(--canvas); color: var(--nav-ink); font-weight: 700;
  padding: 9px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
  position: sticky; top: 0; z-index: 5; /* スクロールしても列見出しを上端に固定 */
}
.flea-table tbody td { padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.flea-table tbody tr.flea-row { cursor: pointer; }
.flea-table tbody tr.flea-row:hover { background: var(--brand-soft); }
/* 列が多く物品名が折り返しすぎる問題：短い列は1行固定、物品名だけ十分な幅を確保して見やすく。
   物品名は白スペース normal で1〜2行に収める（td.flea-name の詳細度で下の nowrap を上書き）。
   幅が足りなければ表を横スクロール（.flea-tablewrap の overflow-x）。 */
.flea-table th, .flea-table td { white-space: nowrap; }
.flea-table td.flea-name { white-space: normal; min-width: 300px; max-width: 400px; line-height: 1.4; font-weight: 600; }
.flea-name .cat-tag { display: inline-block; margin-top: 2px; font-size: 11px; color: var(--muted); font-weight: 400; }
.flea-track { font-variant-numeric: tabular-nums; }
.flea-track-by { margin-top: 4px; font-size: 11.5px; color: var(--muted); font-variant-numeric: normal; }
.flea-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.flea-overdue { color: var(--danger); font-weight: 700; white-space: nowrap; }
.flea-arrived { color: var(--ok); font-weight: 700; white-space: nowrap; }
/* 到着確認のチェック（到着状況のすぐ右） */
.flea-arrchk-cell { text-align: center; }
.flea-arrchk { display: inline-flex; align-items: center; justify-content: center; padding: 6px; cursor: pointer; }
.flea-arrchk input { width: 20px; height: 20px; accent-color: var(--ok); cursor: pointer; }
.flea-arrchk input:disabled { cursor: default; opacity: .55; }
.flea-rating-lb { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 700; user-select: none; }
.flea-rating-lb.undone { color: var(--danger); }
.flea-rating-lb.done { color: var(--ok); }
.flea-rating-cb { width: 17px; height: 17px; cursor: pointer; accent-color: var(--brand); }
.flea-na { color: var(--muted); font-size: 12px; }
/* フリマ管理：タブ切替（未完了／完了済） */
.flea-tabs { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.flea-tab {
  padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel);
  color: var(--nav-ink); font-weight: 700; font-size: 13px; cursor: pointer;
}
.flea-tab:hover { border-color: var(--brand); }
.flea-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
/* 商品ページURLリンク */
.flea-url-wrap { margin-top: 3px; }
.flea-url { display: inline-block; font-size: 12px; color: var(--brand-deep); font-weight: 700; text-decoration: none; }
.flea-url:hover { text-decoration: underline; }
/* 行内入力（追跡番号・到着予定） */
.flea-inp { width: 100%; min-width: 130px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 14.5px; background: var(--panel); color: var(--ink); }
.flea-inp:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.flea-inp.saved { border-color: var(--ok); background: #f0fdf4; }
.flea-track-inp { font-variant-numeric: tabular-nums; min-width: 155px; letter-spacing: .2px; }
/* 操作ボタン列 */
.flea-act { white-space: nowrap; text-align: center; }
/* 完了済の状態バッジ */
.flea-badge { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; color: #fff; }
.flea-badge.rated { background: var(--ok, #16a34a); }
.flea-badge.cancel { background: #6b7280; }
.trash-pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
/* カテゴリの入れ子（表示だけ）：子カテゴリは親の直下に字下げ表示 */
.settings-cat-child { margin-left: 20px; border-left: 3px solid var(--brand-soft); }
.settings-cat-name { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.settings-parent { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; display: inline-flex; align-items: center; gap: 4px; }
.settings-parent select { padding: 4px 26px 4px 8px; font-size: 12px; }
.settings-global { background: linear-gradient(180deg, var(--brand-soft), var(--panel)); border-color: #eecdb4; }
.settings-global-note { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.opts-edit { margin-top: 8px; }
/* ===================== プルダウン選択肢エディタ ===================== */
#optedit-modal { z-index: 70; } /* 設定モーダルの上に重ねる */
#addshelf-modal { z-index: 70; } /* 棚QR印刷モーダルの上に重ねる */
/* スキャンモーダルは他モーダル（割当て確認 等）の上に開く。同じ z-index だと後発DOMの確認モーダルの裏に隠れて「無反応」に見えるため引き上げる。 */
#scan-modal { z-index: 90; }
/* スキャンモーダルの上に重ねて開く小モーダル（棚卸カウント・この棚を終了・スキャン取消）は scan-modal(z90) より前面に。 */
#stk-count-modal, #stk-finish-modal, #stk-unscan-modal { z-index: 100; }
.su-item { text-align: center; padding: 12px; margin: 6px 0 12px; background: #fef2f2; border: 2px solid #f0a99a; border-radius: 12px; }
.su-item .su-id { font-family: ui-monospace, Menlo, monospace; font-size: 26px; font-weight: 900; color: #b23c2c; letter-spacing: .5px; }
.su-item .su-name { font-size: 13px; color: #7f1d1d; margin-top: 4px; }
/* この棚の棚卸を終了：棚番を大きく強調して最終確認 */
.stkf-q { font-size: 14px; margin-bottom: 10px; color: var(--ink); }
.stkf-shelf { text-align: center; padding: 12px 12px 16px; margin: 6px 0 12px; background: #fff5f5; border: 2px solid #dc2626; border-radius: 12px; font-size: 12.5px; color: #7f1d1d; }
.stkf-shelf b { display: block; font-size: 34px; font-weight: 900; color: #b91c1c; margin-top: 4px; letter-spacing: .5px; overflow-wrap: anywhere; }
.stkf-count { text-align: center; margin: 0 0 10px; font-size: 15px; color: #1f2937; }
.stkf-count b { font-size: 28px; font-weight: 900; color: #b45309; margin: 0 5px; }
.stkf-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
/* 途中離脱の再開バナー（棚選択フェーズの先頭に出す） */
.stk-resume { border: 2px solid #f59e0b; background: #fff7ed; border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; }
.stk-resume-ttl { font-size: 13px; font-weight: 800; color: #b45309; margin-bottom: 8px; }
.stk-resume-btn { display: block; width: 100%; text-align: left; padding: 12px 14px; margin: 6px 0; border: 2px solid #f59e0b; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: 15px; font-weight: 700; cursor: pointer; }
.stk-resume-btn:hover { background: #fef3c7; }
.stk-resume-btn b { font-size: 18px; color: #b45309; margin: 0 3px; }
.stk-resume-cnt { font-size: 12.5px; font-weight: 600; color: #a16207; }
.stk-resume-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
/* スキャン画面：確定済み（ロック）を読んだ時の表示 */
.sl-locked { color: #b23c2c; font-weight: 700; }
/* 検品用の保管場所欄は、すぐ上の「検品あり／なし」ボタンと近すぎるので区切り線＋余白で離す。 */
#ac-loc-field { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal-optedit { max-width: 640px; }
.opt-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.opt-tools input[type="search"] { flex: 1; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; background: var(--panel); color: var(--ink); }
.opt-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; max-height: 48vh; min-height: 200px; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.opt-item { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 6px 6px 12px; font-size: 13.5px; font-weight: 600; height: fit-content; }
.opt-item .opt-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 5px; }
.opt-item .opt-x:hover { background: #fde2e2; color: var(--danger); }
.opt-item .opt-color { width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 4px; background: none; padding: 0; cursor: pointer; }
.opt-add { display: flex; gap: 8px; margin-top: 12px; align-items: flex-start; }
.opt-add textarea { flex: 1; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical; min-height: 42px; background: var(--panel); color: var(--ink); }
.opt-add .btn { flex: 0 0 auto; white-space: nowrap; }

/* ===================== ユーザー権限エディタ ===================== */
.user-row2 { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; padding: 8px 10px; }
.ur-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ur-btns { display: inline-flex; align-items: center; gap: 8px; }
.ua-editor { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ua-adminlbl { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.ua-screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; margin-bottom: 12px; }
.ua-screen { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.ua-screen select { padding: 5px 26px 5px 8px; font-size: 12.5px; }
.ua-pw-editor { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ua-pw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ua-pw-row input { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13px; color: var(--ink); background: var(--panel); min-width: 160px; }
.ua-pw-note { margin: 8px 0 0; }
.flea-view .fv-empty { color: var(--muted); text-align: center; padding: 28px 0; }

/* ===================== API連携（APIキー） ===================== */
.apikey-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.apikey-add input { flex: 1 1 240px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13.5px; color: var(--ink); background: var(--panel); }
.apikey-add select { padding: 8px 30px 8px 10px; font-size: 13px; }
.apikey-issued { background: #eefaf1; border: 1px solid #b8e6c6; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.ak-issued-head { font-size: 13.5px; color: #14663a; margin-bottom: 8px; }
.ak-issued-key { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ak-issued-key code { flex: 1 1 260px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #fff; border: 1px solid #c7e6d3; border-radius: 6px; padding: 8px 10px; word-break: break-all; color: var(--ink); }
.apikey-list { display: flex; flex-direction: column; gap: 8px; }
.apikey-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px; background: var(--panel); }
.apikey-row.ak-revoked { opacity: .6; background: #f7f5f2; }
.ak-main { min-width: 0; }
.ak-name { font-weight: 700; color: var(--ink); }
.ak-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.ak-meta code { font-family: ui-monospace, Menlo, monospace; color: var(--brand-deep); }
.ak-badge { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 9px; vertical-align: middle; }
.ak-badge.ak-read { background: #eef4fb; color: #2456a6; border: 1px solid #cfe0f2; }
.ak-badge.ak-edit { background: #fbeadf; color: var(--brand-deep); border: 1px solid #eecdb4; }
.ak-badge.ak-off { background: #f3e3e3; color: #a33; border: 1px solid #e6c5c5; }
.apikey-help { margin-top: 14px; font-size: 13px; color: var(--ink); }
.apikey-help summary { cursor: pointer; font-weight: 700; color: var(--brand-deep); }
.apikey-code { background: #f3ede5; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; }

/* ===================== 割当て（空ラベル→割当て待ち→入庫） ===================== */
.modal-narrow { max-width: 480px; }
.btn-sm { padding: 4px 12px; font-size: 12.5px; }
.ap-no, .ac-no { font-family: ui-monospace, Menlo, monospace; color: var(--brand-deep); font-weight: 700; }
.ap-folder-note { color: var(--muted); font-size: 12px; }
.ap-folder-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--nav-ink); margin: 8px 0 2px; }
.ap-folder-select { flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; font-size: 14px; background: var(--panel); color: var(--ink); }
/* 割当てスキャンのモード先決め */
.am-choice { display: block; width: 100%; text-align: left; background: var(--panel); border: 2px solid var(--line-strong); border-radius: 12px; padding: 14px 16px; margin: 10px 0; cursor: pointer; font-size: 16px; color: var(--ink); }
.am-choice b { font-weight: 800; }
.am-choice:hover { border-color: var(--brand); background: var(--brand-soft); }
.am-choice .am-sub { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.am-folder-pick { border-top: 1px dashed var(--line-strong); margin-top: 8px; padding-top: 12px; }
.am-folder-pick .ap-folder-label { flex-direction: column; align-items: stretch; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.ac-kaitori-note { background: #fff3ef; border: 1px solid #f0a99a; color: #8a2a12; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; }
.ac-kaitori-note b { color: #c0330f; }
.ap-search { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; font-size: 14px; margin: 4px 0 10px; background: var(--panel); color: var(--ink); }
.ap-listwrap { max-height: 56vh; overflow-y: auto; }
/* 割当て候補：カード全体をタップして選ぶ（スマホで押しやすい）。
   ※ .ap-list は flex縦並びにしない：iOS Safariで flex item が min-height まで圧縮され中身が溢れる不具合の対策。
   ブロック配置なら子カードは常に中身ぶんの高さになる。 */
.ap-list { display: block; }
.ap-card { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); color: var(--ink);
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; min-height: 56px; -webkit-tap-highlight-color: rgba(0,0,0,.06);
  -webkit-appearance: none; appearance: none; box-sizing: border-box; }
.ap-card:last-child { margin-bottom: 0; }
.ap-card:hover { background: #fafbfc; }
.ap-card:active { background: var(--brand-soft); }
.ap-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ap-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 auto; }
.ap-card-name { font-weight: 700; font-size: 15px; line-height: 1.4; color: #2a3542; overflow-wrap: anywhere; word-break: break-word; }
.ap-card-meta { font-size: 12px; line-height: 1.35; color: var(--muted); }
.ap-track { font-variant-numeric: tabular-nums; }
/* 単価：同名で単価違いの商品を見分けるための決め手なので目立たせる */
.ap-card-price { font-size: 14px; font-weight: 800; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.ac-price { font-variant-numeric: tabular-nums; color: var(--brand-deep); }
/* 備考：状態や仕入先表記など、見分けの手がかり。割当てミス防止のため青色＋太字で目立たせる */
.ap-card-note { font-size: 12px; line-height: 1.4; color: #1558d6; font-weight: 700; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ac-note { white-space: pre-line; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; color: #1558d6; font-weight: 700; }
.ap-card-go { flex: 0 0 auto; font-weight: 700; color: var(--brand-deep); background: var(--brand-soft);
  border: 1px solid #f0cfba; border-radius: 8px; padding: 8px 12px; font-size: 14px; white-space: nowrap; }
.ap-empty { color: var(--muted); text-align: center; padding: 22px 0; }
.assign-summary { border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); padding: 10px 12px; margin-bottom: 12px; }
.assign-summary .ac-row { display: flex; gap: 10px; padding: 3px 0; font-size: 13.5px; }
.assign-summary .ac-lbl { flex: 0 0 76px; color: var(--muted); font-size: 12px; padding-top: 1px; }
.ac-confirm-q { font-weight: 800; font-size: 15px; color: var(--brand-deep); margin-bottom: 8px; }

/* ===================== 直接仕入登録 ===================== */
.fv-toolbar { margin: 0 0 12px; }
/* 直接仕入登録の明細は列が多く、物品名も長い。画面が広ければ広く使う（狭い画面では従来どおり） */
.modal-wide { max-width: 1180px; width: 96%; }
.dp-file { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dp-file-hint { color: var(--muted); font-size: 12.5px; }
.dp-template-dl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.dp-template-dl a.btn { text-decoration: none; }
/* 明細 物品名の自作ドロップダウン（検索窓＝入力欄／全件スクロール） */
.dp-name-pop { position: fixed; z-index: 3000; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.20); overflow-y: auto; padding: 4px; }
.dp-name-pop .dpnp-h { font-size: 11px; font-weight: 800; color: var(--muted); padding: 7px 8px 3px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.dp-name-pop .dpnp-item { padding: 8px 10px; font-size: 13px; color: var(--ink); border-radius: 6px; cursor: pointer; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.35; }
.dp-name-pop .dpnp-item:hover, .dp-name-pop .dpnp-item.hi { background: var(--brand-soft); }
.dp-name-pop .dpnp-item.is-cand { color: var(--brand-deep); font-weight: 600; }
.dp-name-pop .dpnp-empty { padding: 12px 10px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
/* その場で新しい物品名を追加する行（プルダウン最上部・目立たせる） */
.dp-name-pop .dpnp-add { padding: 9px 10px; margin-bottom: 2px; font-size: 13px; font-weight: 700; color: var(--brand-deep); background: var(--brand-soft); border: 1px dashed var(--brand); border-radius: 6px; cursor: pointer; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.35; }
.dp-name-pop .dpnp-add:hover { background: var(--brand); color: #fff; border-style: solid; }
.dp-name-pop .dpnp-add:hover b { color: #fff; }
.dp-name-pop .dpnp-add b { color: var(--brand-deep); }
.dp-blank-tag { background: #fff6e5; border: 1px solid #f0cdb2; border-radius: 4px; padding: 0 6px; color: #8a4b1f; font-weight: 700; }
/* カテゴリ未選択の間は②以降を薄く・触れなくする（誤カテゴリ登録の防止） */
.dp-locked { opacity: .45; pointer-events: none; }
.dp-catlock-note { margin: 8px 0 0; padding: 8px 12px; background: var(--brand-soft); border: 1px solid #eecdb4;
  border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--brand-deep); }
.dp-catlock-note.hidden { display: none; }
.dp-cat-field select { max-width: 420px; }
.dp-listwrap { max-height: 46vh; overflow-y: auto; }
.dp-table { min-width: 980px; }
.dp-table td { padding: 5px 8px; }
.dp-src { font-size: 12px; color: var(--muted); max-width: 200px; }
/* 物品名は長い（例「Game New Nintendo 3DS LL メタリックブラック」）。
   後半が見えないと選び間違えるので、この列を一番広く取る。 */
.dp-name-inp { min-width: 380px; }
.dp-name-inp.dp-unset { background: #fff6e5; border-color: #eab890; }
.dp-in { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 8px; font-size: 13px; background: var(--panel); color: var(--ink); font-family: inherit; }
.dp-qty { width: 60px; text-align: right; } .dp-unit { width: 88px; text-align: right; }
.dp-note-col { min-width: 260px; }
.dp-note-inp { min-width: 240px; }
.dp-rowact { white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dp-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.dp-summary { font-size: 13px; color: var(--ink); }
.dp-total { margin-left: auto; font-size: 14px; color: var(--ink); display: flex; flex-direction: column; align-items: flex-end; line-height: 1.4; }
.dp-total b { font-size: 16px; color: var(--brand-deep, #b4531c); }
.dp-warn { color: var(--danger); font-weight: 700; }
/* 請求書合計との差額（明細合計の下に少し小さく） */
.dp-diff { font-size: 11.5px; font-weight: 600; margin-top: 1px; }
.dp-diff.dp-diff-ok { color: var(--ok); }
.dp-diff.dp-diff-warn { color: var(--danger); }
.dp-diff b { font-size: inherit; color: inherit; }

/* ===================== レスポンシブ ===================== */
/* PC（デスクトップ）ではスキャンは使わないので隠す（スキャンはスマホ用） */
@media (min-width: 601px) {
  #btn-scan, .rail-item[data-nav="scan"] { display: none; }
}

@media (max-width: 860px) {
  /* 絞り込みパネルは狭い画面ではドロワー（左からスライドイン）＝⚙️で開閉 */
  .side {
    display: block; position: fixed; top: var(--header-h); left: 0; bottom: 0;
    width: min(300px, 86vw); z-index: 46; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25); height: auto;
  }
  .side.side-open { transform: translateX(0); }
  .side-backdrop { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 45; }
  .side-backdrop.show { display: block; }
  .app-header-right .user, .plan-badge { display: none; }
  .brand-text { font-size: 16px; white-space: nowrap; }
  .app-header-right .company { font-size: 12px; white-space: nowrap; }
  /* 締め作業（集計・CSV）はPCのみ */
  .stocktake-pc { display: none !important; }
  /* 商品フォームは縦1列に（横スクロール防止） */
  .grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 12px 8px; }
  .modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); } /* スマホは画面いっぱいまで使う（保存ボタンを確実に画面内に） */
  .modal-foot { flex-wrap: wrap; }
  .modal-body { overflow-x: hidden; }
  .main { padding: 12px 14px 60px; }
  .page-title { font-size: 19px; }
  .btn-detail { display: none; }
  .stat-chips { margin-left: 0; width: 100%; }
  .msel-menu { max-width: 86vw; }
}
/* PCでは⚙️/絞り込みで絞り込みパネルを畳んで表を広げられる */
@media (min-width: 861px) { .side.side-collapsed { display: none; } }

/* ここから下はスマホ実機幅（600px以下）だけ：左レール非表示＋一覧をカード化＋下タブ */
@media (max-width: 600px) {
  .rail { display: none; }

  /* テーブル → カード化 */
  .grid-table thead { display: none; }
  .grid-table, .grid-table tbody, .grid-table tr, .grid-table td { display: block; width: 100%; }
  .grid-table tbody tr {
    border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 10px 12px;
    position: relative;
  }
  .table-wrap { background: none; border: none; overflow: visible; }
  .grid-table td { padding: 2px 0; border: none; }
  .grid-table td.td-mgmt { color: var(--muted); }
  .grid-table td.td-status { position: absolute; top: 10px; right: 12px; left: auto; width: auto; padding: 0; }
  .grid-table td.td-mgmt { padding-right: 84px; }
  .grid-table td.td-check { display: none; }
  .grid-table td.money::before { content: attr(data-label); color: var(--muted); font-weight: 600; margin-right: 6px; }
  .grid-table td.money { display: inline-block; width: auto; margin-right: 14px; }
  .grid-table td.td-loc:empty { display: none; }
  /* フリマ管理：スマホは表を横スクロール、検索は全幅 */
  .flea-searchbar { flex-wrap: wrap; }
  .flea-searchbar input[type="search"] { max-width: none; width: 100%; }
  .flea-sum-chip { padding: 7px 12px; font-size: 12.5px; }
}

/* ===================== 配色は「ライト固定」 =====================
   OSがダークモードの端末でも、このアプリは常に白基調で表示する。
   （以前は @media (prefers-color-scheme: dark) で色を反転していたが、
     配色の直書きが多数残っていたため「数量が背景と同化して読めない」等が発生した。
     全員が同じ見た目＝マニュアルの画面写真とも一致する状態に統一する。
     :root の color-scheme: only light と index.html の <meta name="color-scheme" content="light">
     で、入力欄などのブラウザ標準パーツもダーク化させない。）             */

/* ===================== 📣 要望（改善リクエスト） ===================== */
.req-view { max-width: 900px; }
.req-loading, .req-empty { padding: 24px; text-align: center; color: var(--muted); }
.req-intro { background: var(--brand-soft); border: 1px solid #eecdb4; border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.7; margin-bottom: 14px; }
.req-intro b { display: block; font-size: 14px; margin-bottom: 2px; }
.req-form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.req-form input, .req-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel); }
.req-form input:focus, .req-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.req-form textarea { resize: vertical; min-height: 72px; }
.req-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.req-hint { font-size: 12px; color: var(--muted); }
.req-tabs { display: flex; gap: 6px; margin: 16px 0 10px; }
.req-tab { padding: 8px 14px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--nav-ink); }
.req-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.req-card.rs-new   { border-left-color: #e06c2c; }
.req-card.rs-think { border-left-color: #7c3aed; }
.req-card.rs-doing { border-left-color: #0f6fb8; }
.req-card.rs-done  { border-left-color: #15803d; }
.req-card.rs-skip  { border-left-color: #9aa4b2; }
.req-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-title { font-size: 15px; font-weight: 800; margin: 0; flex: 1; min-width: 200px; color: var(--ink); }
.req-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.req-badge.rs-new   { background: #fdf1e8; color: #a2521f; }
.req-badge.rs-think { background: #ede9fe; color: #6d28d9; }
.req-badge.rs-doing { background: #e0f2fe; color: #0369a1; }
.req-badge.rs-done  { background: #dcfce7; color: #15803d; }
.req-badge.rs-skip  { background: #e5e7eb; color: #4b5563; }
.req-status { padding: 5px 28px 5px 10px; font-size: 13px; min-height: 0; }
.req-body { margin: 8px 0 0; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; color: var(--ink); }
.req-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.btn-link { border: 0; background: none; padding: 0; font-size: 12px; color: var(--danger); text-decoration: underline; }
.req-adminbox { display: flex; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.req-note { flex: 1; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; color: var(--ink); background: var(--panel); }
.req-reply { margin-top: 10px; padding: 8px 12px; background: var(--canvas); border-radius: 8px; font-size: 13px; line-height: 1.7; color: var(--ink); }
.req-reply b { color: var(--brand-deep); margin-right: 6px; }
@media (max-width: 860px) {
  .req-title { min-width: 0; }
  .req-adminbox { flex-direction: column; }
}

/* 割当て・入庫：検品の要否（必須選択） */
/* 修理品チェック（検品選択の上）。ONで検品を隠し、修理品の保管場所を出す。 */
.ac-repair { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 12px; border: 1.5px solid #e0a94a; background: #fff8ec; border-radius: 10px; font-weight: 700; color: #8a5a12; }
.ac-repair input { width: 18px; height: 18px; accent-color: #c26a12; }
.ac-insp { display: flex; gap: 10px; margin-top: 2px; }
.ac-insp-btn {
  flex: 1; padding: 12px 10px; border: 2px solid var(--line-strong); background: var(--panel);
  border-radius: 10px; font-size: 14px; font-weight: 800; color: var(--nav-ink); cursor: pointer; line-height: 1.3;
}
.ac-insp-btn .ai-sub { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.ac-insp-btn:hover { border-color: var(--brand); }
.ac-insp-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ac-insp-btn.active .ai-sub { color: #fff; opacity: .9; }
/* 未選択のまま実行しようとしたときに気づけるよう強調 */
.ac-insp-need .ac-insp-btn { border-color: var(--danger); animation: acInspShake .3s; }
@keyframes acInspShake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* 入庫スキャン：セッションの最初に選ぶ検品の要否 */
.scan-insp { margin: 4px 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.scan-insp.hidden { display: none; }
.scan-insp-lbl { font-size: 13px; font-weight: 800; color: var(--nav-ink); margin-bottom: 8px; }
