/* 商品DB（モバイル閲覧・編集）専用スタイル。
   グローバル変数（--カード/--罫線/--文字 等）と既存クラス（ページ/区画/入力欄/主ボタン）を流用する。 */

/* ============================================================
   一覧：検索バー
   ============================================================ */
.商品_検索バー {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.商品_検索行 {
  display: flex;
  gap: 8px;
  align-items: center;
}
.商品_検索行 .入力欄 {
  flex: 1;
  min-width: 0;
}
/* カメラ起動ボタン（検索バー右） */
.商品_スキャンボタン {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  /* 絵文字を上下左右の中央へ（button既定のline-height/ベースラインだと下に寄るため） */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  font-size: 22px;
  background: var(--文字);
  color: var(--カード);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
.商品_スキャンボタン:hover { background: #000; }

/* 絞り込み（折りたたみ） */
.商品_絞り込みトグル {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 14px;
  background: var(--カード);
  border: 1px solid var(--罫線);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--文字);
  cursor: pointer;
}
.商品_絞り込みトグル:hover { background: var(--背景); }
.商品_絞り込み件数 {
  display: inline-block;
  margin-left: 8px;
  background: var(--文字);
  color: var(--カード);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
}
.商品_絞り込みパネル {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  background: var(--カード);
  border: 1px solid var(--罫線);
  border-radius: 10px;
}
.商品_絞り込み欄 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.商品_絞り込みラベル {
  font-size: 11px;
  color: var(--文字弱);
}
/* パネル内の入れ子折りたたみ（出品ストアなど）。枠なしの見出し風 */
.商品_サブトグル {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 0;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--文字);
  cursor: pointer;
}
.商品_サブトグル:hover { color: var(--文字薄); }

/* 三状態セグメント（指定なし／あり／なし） */
.商品_三状態 {
  display: flex;
  border: 1px solid var(--罫線);
  border-radius: 8px;
  overflow: hidden;
}
.商品_三状態ボタン {
  flex: 1;
  padding: 9px 4px;
  background: var(--カード);
  border: none;
  border-left: 1px solid var(--罫線);
  font-family: inherit;
  font-size: 12px;
  color: var(--文字薄);
  cursor: pointer;
}
.商品_三状態ボタン:first-child { border-left: none; }
.商品_三状態ボタン.選択中 {
  background: var(--文字);
  color: var(--カード);
  font-weight: 700;
}

/* 複数選択ドロップダウン（押すと開くチェックリスト） */
.商品_複数選択ボタン {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.商品_複数選択ポップ {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--カード);
  border: 1px solid var(--罫線);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.商品_複数選択項目 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.商品_複数選択項目:hover { background: var(--背景); }
.商品_複数選択項目 input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.商品_複数選択クリア {
  align-self: flex-end;
  background: transparent;
  border: none;
  color: var(--文字薄);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 2px 4px 6px;
}
.商品_複数選択クリア:hover { color: var(--文字); }
.商品_クリア {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--文字薄);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
}
.商品_クリア:hover { color: var(--文字); }

/* ============================================================
   一覧：結果リスト
   ============================================================ */
.商品_件数 {
  font-size: 12px;
  color: var(--文字弱);
  margin-bottom: 8px;
}
.商品_リスト {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.商品_カード {
  display: block;
  padding: 12px 14px;
  background: var(--カード);
  border: 1px solid var(--罫線);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--文字);
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.商品_カード:hover {
  border-color: var(--文字);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.商品_カード本文 {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.商品_カード名 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.商品_カードメタ {
  font-size: 12px;
  color: var(--文字薄);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.商品_カード下段 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.商品_価格 {
  font-size: 14px;
  font-weight: 700;
}

/* 状態バッジ（中立トーン。状態ごとの色分けはしすぎず読みやすさ優先） */
.商品_状態 {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--背景);
  border: 1px solid var(--罫線);
  color: var(--文字薄);
  white-space: nowrap;
}
.商品_状態.売却済み { background: #eceff1; color: #455a64; border-color: #b0bec5; }
.商品_状態.出品中 { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }
.商品_状態.入金待ち { background: #fff8e1; color: #8d6e00; border-color: #ffe082; }
.商品_状態.売却・発送依頼 { background: #fff3e0; color: #bf360c; border-color: #ffcc80; }
.商品_状態.入金済み・確認待ち { background: #f3e5f5; color: #6a1b9a; border-color: #ce93d8; }

.商品_もっと {
  margin-top: 12px;
}
/* 結果エリアに最低の高さを持たせ、絞り込みで件数（ページの高さ）が変わっても
   スクロールが詰まってパネル/プルダウンの位置がずれないようにする */
.商品_結果領域 {
  min-height: 60vh;
}
.商品_空表示, .商品_読込 {
  text-align: center;
  padding: 40px 16px;
  color: var(--文字弱);
  font-size: 13px;
}

/* ============================================================
   詳細
   ============================================================ */
.商品_戻る {
  background: transparent;
  border: none;
  color: var(--文字薄);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
  margin-bottom: 8px;
}
.商品_戻る:hover { color: var(--文字); }

.商品_詳細ヘッダ {
  margin-bottom: 16px;
}
.商品_詳細名 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}
.商品_詳細SKU {
  font-size: 13px;
  color: var(--文字弱);
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* 読み取り項目（ラベル：値） */
.商品_項目 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--罫線);
}
.商品_項目:last-child { border-bottom: none; }
.商品_項目ラベル {
  font-size: 12px;
  color: var(--文字弱);
  flex-shrink: 0;
}
.商品_項目値 {
  font-size: 14px;
  text-align: right;
  word-break: break-word;
}
.商品_項目値.金額 { font-weight: 700; }

/* 編集項目 */
.商品_編集項目 {
  padding: 10px 0;
  border-bottom: 1px solid var(--罫線);
}
.商品_編集項目:last-child { border-bottom: none; }
.商品_編集ラベル {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--文字弱);
  font-weight: 600;
  margin-bottom: 6px;
}
.商品_保存中 { color: var(--情報); font-weight: 600; }
.商品_保存済 { color: var(--成功); font-weight: 600; }
.商品_編集行 {
  display: flex;
  gap: 8px;
  align-items: center;
}
.商品_編集行 .入力欄 { flex: 1; min-width: 0; }

/* 寸法（W×H×D＋ショルダー） */
.商品_寸法群 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.商品_寸法欄 {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.商品_寸法ラベル {
  font-size: 11px;
  color: var(--文字弱);
  text-align: center;
}

/* 出品状況チップ（読み取り） */
.商品_チップ群 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.商品_チップ {
  display: inline-block;
  padding: 3px 10px;
  background: var(--背景);
  border: 1px solid var(--罫線);
  border-radius: 999px;
  font-size: 12px;
  color: var(--文字);
}

/* ============================================================
   画像ギャラリー
   ============================================================ */
.商品_ギャラリー {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
}
.商品_ギャラリー画像 {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--背景);
  cursor: pointer;
  border: 1px solid var(--罫線);
}
.商品_ギャラリー空 {
  font-size: 13px;
  color: var(--文字弱);
  padding: 8px 0;
}

/* 画像拡大（ライトボックス） */
.商品_拡大背景 {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
}
.商品_拡大画像 {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ============================================================
   バーコードスキャナ
   ============================================================ */
.商品_スキャナ背景 {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 320;
  display: flex;
  flex-direction: column;
}
.商品_スキャナ映像 {
  flex: 1;
  width: 100%;
  object-fit: cover;
  background: #000;
}
/* 枠は「ここに入れば読める」という目安。以前は max-width:320px で頭打ちになり、実際より
   狭く見せてしまっていた（枠からはみ出しても読めたのはそのため）ので、幅は画面いっぱいに広げる。
   高さだけは意味がある: ZXing は上下方向の真ん中およそ44%しか走査しないので（15行を
   height/32 間隔で中央から外へ）、枠がその帯からはみ出すと「枠に入れたのに読めない」が起きる。
   40vh に抑えて、枠の中＝必ず走査される、という関係を守る */
.商品_スキャナ枠 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 96%;
  aspect-ratio: 5 / 3;
  max-height: 40vh;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}
.商品_スキャナ案内 {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  padding: 0 16px;
}
.商品_スキャナ操作 {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
}
.商品_スキャナ閉じる {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
/* 直接入力（読めない時の逃げ道）。黒背景で目立つ青系 */
.商品_スキャナ直接入力 {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}

/* 番号を打つパネル。画面中央に置く＝下に置くとスマホのキーボードで隠れるため */
.商品_スキャナ入力パネル {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 86%;
  max-width: 360px;
  background: var(--カード);
  border-radius: 12px;
  padding: 16px;
}
.商品_スキャナ入力ラベル {
  font-size: 13px;
  font-weight: 700;
  color: var(--文字);
  margin-bottom: 8px;
}
.商品_スキャナ入力行 {
  display: flex;
  gap: 8px;
}
.商品_スキャナ入力欄 {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  /* 16px 未満だと iOS が入力時に画面を勝手に拡大するので下げない */
  font-size: 16px;
  border: 1px solid var(--罫線);
  border-radius: 8px;
  font-family: inherit;
  color: var(--文字);
}
.商品_スキャナ入力ボタン {
  flex: 0 0 auto;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 700;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.商品_スキャナ入力ボタン:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.商品_スキャナエラー {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 86%;
  max-width: 360px;
  background: var(--カード);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}
/* モバイルKPIダッシュボード（/KPI）専用スタイル。
   スマホ/PC/タブレットで読みやすいよう、カードは自動折返しグリッド、横棒は自前のdivで描画。 */

/* ゾーン見出し（現在の状況 / 期間の実績）。ラベル＋細い区切り線 */
.KPIゾーン見出し {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 2px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--文字弱);
}
.KPIゾーン見出し:first-of-type {
  margin-top: 8px;
}
.KPIゾーン見出し::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--罫線);
}

/* 折りたたみセクション */
.KPI区画 {
  background: var(--カード);
  border: 1px solid var(--罫線);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.KPI区画ヘッダ {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 12px;
}
.KPI区画トグル {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--文字);
  text-align: left;
  transition: background 0.12s;
}
.KPI区画トグル:hover {
  background: var(--背景);
}
.KPI区画矢印 {
  flex-shrink: 0;
  width: 11px;
  font-size: 10px;
  color: var(--文字弱);
}
.KPI区画タイトル {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.KPI区画本文 {
  padding: 2px 14px 16px;
}

/* セクション見出しの右に出す「現在」「今月」などの期間ピル */
.KPI期間ピル {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--背景);
  border: 1px solid var(--罫線);
  font-size: 11px;
  font-weight: 600;
  color: var(--文字薄);
  vertical-align: middle;
  white-space: nowrap;
}

/* 数値カードの自動折返しグリッド */
.KPIグリッド {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

/* 数値カード1枚 */
.KPIカード {
  background: var(--背景);
  border: 1px solid var(--罫線);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.KPIカードラベル {
  font-size: 11.5px;
  color: var(--文字弱);
  font-weight: 600;
}
.KPIカード値 {
  font-size: 20px;
  font-weight: 700;
  color: var(--文字);
  line-height: 1.25;
  word-break: break-all;
}
.KPIカード値.小 {
  font-size: 17px;
}
.KPIカード副 {
  font-size: 11.5px;
  color: var(--文字薄);
}
/* 目標差など強調する小バッジ */
.KPI差バッジ {
  font-size: 12px;
  font-weight: 700;
}

/* 横棒チャート（担当者別・所属別・滞留構成比） */
.KPIバー一覧 {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.KPIバー行 {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: 8px;
}
.KPIバー名 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--文字);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.KPIバートラック {
  position: relative;
  height: 16px;
  background: var(--罫線);
  border-radius: 5px;
  overflow: hidden;
}
.KPIバー塗り {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
  min-width: 2px;
  transition: width 0.3s ease;
}
.KPIバー値 {
  font-size: 12px;
  color: var(--文字薄);
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}
.KPIバー副 {
  font-size: 11px;
  color: var(--文字弱);
  font-weight: 400;
}

/* 滞留の凡例（バケット色の説明）は使わず、行ごとに色を付ける */

/* 空・エラー時の注記カード */
.KPI注記 {
  background: var(--カード);
  border: 1px solid var(--罫線);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  color: var(--文字薄);
  font-size: 13px;
}

/* セクション内の区切り（サマリーの下に内訳バーを置くとき） */
.KPI小見出し {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--文字薄);
  margin: 16px 0 10px;
}

/* 小さな一覧表（在庫進捗表の曜日推移・売上進捗のカテゴリー別）。
   スマホでは列が入りきらないので、枠の中だけ横スクロールさせる（ページ自体は横に動かさない）。 */
.KPI表枠 {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.KPI表 {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}

.KPI表 th,
.KPI表 td {
  border-bottom: 1px solid var(--罫線);
  padding: 7px 8px;
  text-align: left;
}

.KPI表 th {
  color: var(--文字薄);
  font-weight: 700;
  font-size: 11.5px;
}

.KPI表 .数値 {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.KPI表 .合計行 td {
  font-weight: 700;
  border-top: 2px solid var(--罫線);
  border-bottom: none;
}

/* 画面が広いとき（タブレット/PC）はカードをやや大きく */
@media (min-width: 720px) {
  .KPIカード値 {
    font-size: 22px;
  }
}
