/* v-ledger+ アプリスタイル（ログインシェル + 在庫取り込み画面） */

:root {
  --green: #1f7a4d;
  --green-dark: #17603c;
  --green-050: #eaf5ef;
  --ink: #1c2b24;
  --muted: #5c6b63;
  --line: #dfe6e1;
  --bg: #f4f7f5;
  --card: #ffffff;
  --danger: #b3261e;
  --danger-050: #fdecea;
  --warn: #8a5a00;
  --warn-050: #fdf3e2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 40, 30, 0.08), 0 4px 16px rgba(20, 40, 30, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- ローディング ---------- */
.loading-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.loading-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text { color: var(--muted); font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ログイン ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px 26px 20px;
}
.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .app-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  border-radius: 9px;
}
.brand-mark { width: 44px; height: 44px; font-size: 18px; }
.app-brand-mark { width: 26px; height: 26px; font-size: 12px; border-radius: 7px; }
.brand-title { font-weight: 700; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.login-section { margin-bottom: 14px; }
.email-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.email-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 10px;
}
.email-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-050); }
.email-hint { font-size: 12px; color: var(--muted); }

.login-divider {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0;
  position: relative;
}
.login-divider::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line);
}
.login-divider span { background: var(--card); padding: 0 10px; position: relative; }

.login-message, .login-error {
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius); margin-top: 8px;
}
.login-message { background: var(--green-050); color: var(--green-dark); }
.login-error { background: var(--danger-050); color: var(--danger); }

.login-footer { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-google { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-google:hover:not(:disabled) { background: #f7faf8; }
.btn-secondary { background: var(--green-050); color: var(--green-dark); border-color: transparent; }
.btn-secondary:hover:not(:disabled) { background: #dcefe4; }
.btn-primary { background: var(--green); color: #fff; width: auto; padding: 11px 20px; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.btn-danger { background: var(--danger); color: #fff; width: auto; padding: 11px 20px; }
.btn-danger:hover:not(:disabled) { background: #8f1e17; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); width: auto; padding: 7px 12px; font-weight: 500; }
.btn-ghost:hover:not(:disabled) { background: #eef2ef; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 環境バッジ ---------- */
.env-badge {
  background: #b3261e; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; letter-spacing: 0.06em;
}
.env-badge-inline { transform: translateY(-1px); }

/* ---------- アプリシェル ---------- */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.app-header-inner {
  max-width: 1000px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
}
.app-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.app-header-spacer { flex: 1; }
.app-user { display: flex; align-items: center; gap: 10px; }
.app-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--green-050); color: var(--green-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.app-user-meta { line-height: 1.25; text-align: right; }
.app-user-name { font-size: 13px; font-weight: 600; }
.app-user-role { font-size: 11px; color: var(--muted); }

.app-main { max-width: 1000px; margin: 0 auto; padding: 24px 20px 48px; }
.app-version { color: var(--muted); font-size: 11px; text-align: center; margin-top: 24px; }

/* ---------- 在庫取り込み画面 ---------- */
.page-head { margin-bottom: 18px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-desc { color: var(--muted); font-size: 13px; margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.drop-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--green); background: var(--green-050); }
.drop-zone strong { color: var(--green-dark); }
.file-info { margin-top: 12px; font-size: 13px; color: var(--ink); }
.file-info .file-name { font-weight: 600; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 4px 0 16px;
}
.summary-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.summary-tile .num { font-size: 22px; font-weight: 700; }
.summary-tile .lbl { font-size: 12px; color: var(--muted); }
.summary-tile.accent { background: var(--green-050); border-color: transparent; }
.summary-tile.warn { background: var(--warn-050); border-color: transparent; }
.summary-tile.warn .num { color: var(--warn); }

.section-title { font-size: 14px; font-weight: 700; margin: 18px 0 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.diff {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px;
}
table.diff th, table.diff td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.diff th { background: #f6f9f7; color: var(--muted); font-weight: 600; position: sticky; top: 0; }
table.diff tr:last-child td { border-bottom: none; }
.diff-cell .before { color: var(--muted); }
.diff-cell .arrow { color: var(--muted); margin: 0 4px; }
.diff-cell .after { font-weight: 700; color: var(--green-dark); }
.diff-cell.zero .after { color: var(--danger); }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.badge.update { background: var(--green-050); color: var(--green-dark); }
.badge.zero { background: var(--danger-050); color: var(--danger); }
.badge.warn { background: var(--warn-050); color: var(--warn); }
.more-note { color: var(--muted); font-size: 12px; padding: 8px 10px; }

/* 出荷CSV一括の行テーブル：メモ列だけは折り返す（他の列は nowrap のまま） */
table.diff td.note-cell { white-space: normal; min-width: 240px; max-width: 420px; font-size: 12px; }
.note-err { color: var(--danger); }
.note-warn { color: var(--warn); }

/* ---------- ロジアークス同期（CSV2枚） ---------- */
.csv-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.req, .opt {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
.req { background: var(--danger-050); color: var(--danger); }
.opt { background: #eef2ef; color: var(--muted); }
@media (max-width: 720px) { .csv-pair { grid-template-columns: 1fr; } }

/* 「作らない理由」は理由でまとめて出す。1件ずつ並べると全体像が読めない */
.skip-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.skip-reason { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.skip-list { font-size: 12px; color: var(--muted); line-height: 1.7; }

.msg { padding: 12px 14px; border-radius: var(--radius); font-size: 13px; margin: 12px 0; }
.msg.info { background: var(--green-050); color: var(--green-dark); }
.msg.warn { background: var(--warn-050); color: var(--warn); }
.msg.error { background: var(--danger-050); color: var(--danger); }
.msg.ok { background: var(--green-050); color: var(--green-dark); }

.result-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }

/* ---------- 画面タブ ---------- */
/* タブが7枚あり、狭い画面では1行に収まらない。**ページごと横に流れる**と本文まで
   ずれて読みにくいので、はみ出しはタブ列の中だけで横スクロールさせる。
   スクロールバーは出さない（指やトラックパッドで流せれば足りる）。 */
.app-nav {
  display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav .tab {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
  font-family: inherit;
  flex: none;   /* 縮めるとラベルが潰れて読めなくなる。縮めずに流す */
  white-space: nowrap;
}
.app-nav .tab:hover { color: var(--ink); }
.app-nav .tab.active { color: var(--green-dark); border-bottom-color: var(--green); }

/* ---------- フォーム（出荷登録） ---------- */
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: span 2; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; box-sizing: border-box;
}
.field input:focus, .field select:focus { outline: 2px solid var(--green-050); border-color: var(--green); }
.field-note { font-size: 12px; color: var(--muted); min-height: 16px; }
.field-note.ok { color: var(--green-dark); }

/* 業者コンボボックス（1101件あるのでドロップダウンにせず絞り込み候補を出す） */
.combo { position: relative; }
.combo-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 280px; overflow-y: auto;
}
.combo-item {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 8px 11px; font-size: 13px; font-family: inherit; color: var(--ink); cursor: pointer;
}
.combo-item:last-child { border-bottom: none; }
.combo-item:hover { background: var(--green-050); }
.combo-id { font-weight: 700; color: var(--green-dark); flex: none; }
.combo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-meta { flex: none; font-size: 11px; color: var(--muted); }
.combo-empty { padding: 8px 11px; font-size: 12px; color: var(--muted); }

/* 出荷登録の期待値テーブル（.diff-cell 配下ではなくセル自体に付く） */
table.diff td.before { color: var(--muted); }
table.diff td.arrow { color: var(--muted); text-align: center; width: 1%; }
table.diff td.after { font-weight: 700; color: var(--green-dark); }
/* マイナス在庫は緑で出すと「よい結果」に見えてしまうので赤にする */
table.diff td.after.neg { color: var(--danger); }
table.diff tr.row-muted td { opacity: 0.6; }
.cell-sub { font-size: 11px; color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .field-wide { grid-column: span 2; }
}

/* ---------- 更新バナー ---------- */
#app-update-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 8px 10px 8px 18px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); z-index: 50; font-size: 13px;
}
#app-update-banner button {
  background: var(--green); color: #fff; border: none; border-radius: 999px;
  padding: 6px 14px; font-weight: 600; cursor: pointer;
}

@media (max-width: 560px) {
  .app-user-meta { display: none; }
  .btn-row { flex-direction: column; }
  .btn-primary, .btn-danger { width: 100%; }
}

/* ---------- 拠点属性の更新（拠点同期②） ---------- */
/* 変更候補は「拠点の見出し行 → その拠点の変更項目」の入れ子で並ぶ。
   見出しを塗らないと、どの項目がどの拠点のものか読み取れない。 */
table.diff tr.rec-head td {
  background: #f6f9f7; border-top: 2px solid var(--line);
  font-size: 13px; white-space: normal;
}
table.diff tr.rec-head:first-child td { border-top: none; }
table.diff input.pick { width: 16px; height: 16px; cursor: pointer; accent-color: var(--green); }

/* ---------- ユーザー管理 ---------- */
/* ロールのプルダウンは表の中に置くので .field の指定が効かない。ここで単体に効かせる。 */
select.role-select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff;
  min-width: 120px; cursor: pointer;
}
select.role-select:focus { outline: 2px solid var(--green-050); border-color: var(--green); }
select.role-select:disabled { background: #f2f5f3; color: var(--muted); cursor: not-allowed; }

/* ［修正］の入力欄も表の中に置くので、同じ理由で単体に効かせる。 */
table.diff input.cell-input {
  width: 100%; min-width: 12em; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff;
}
table.diff input.cell-input:focus { outline: 2px solid var(--green-050); border-color: var(--green); }
table.diff input.cell-input:disabled { background: #f2f5f3; color: var(--muted); }
/* 直している行は、どの行を触っているのか見失うと隣の人を書き換えてしまうので色を付ける。 */
table.diff tr.row-editing td { background: var(--green-050); }
table.diff td.row-ops .btn + .btn { margin-left: 6px; }
/* 回収の消し込み（§4e）: どの出荷行に台数を当てたのかが一目で分かるようにする。
   200台を何行かに割り当てるので、当たっている行が沈むと確認にならない。 */
table.diff tr.row-hit td { background: var(--green-050); }
/* 台数の欄は狭くてよい（cell-input の min-width 12em は名前の入力向け）。 */
table.diff input.alloc-input { min-width: 0; width: 6em; text-align: right; }
.warn-text { color: var(--warn); font-weight: 600; }
/* 修飾なしの .badge は色が付かない（「未ログイン」等の中立表示用）。 */
.badge { background: #eef2ef; color: var(--muted); }

/* ---------- ログイン登録 ---------- */

/* 契約業者は候補から選んでタグとして積む（IDを手打ちさせると打ち間違いが起きる）。 */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-050); color: var(--green-dark);
  border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px;
}
.chip-x {
  border: none; background: rgba(0, 0, 0, 0.08); color: inherit;
  width: 18px; height: 18px; border-radius: 50%; line-height: 1;
  font-size: 12px; cursor: pointer; padding: 0;
}
.chip-x:hover { background: rgba(0, 0, 0, 0.16); }

/* 🚨 パスワードはここでしか表示されない。
   「読み上げて電話で伝える」「スクリーンショットを撮る」使われ方をするので、
   等幅・大きめ・字間広めにして 0/O や 1/l の読み違いが起きにくい形にする
   （生成側でも紛らわしい字は除いてある。login-core.js の PW_ALPHABET）。 */
.pw-panel {
  border: 2px solid var(--green); border-radius: var(--radius);
  background: var(--green-050); padding: 14px 16px; margin: 12px 0;
}
.pw-head { font-weight: 700; color: var(--green-dark); margin-bottom: 8px; }
.pw-value {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 26px; font-weight: 700; letter-spacing: 0.14em;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px;
  user-select: all; word-break: break-all;
}
.pw-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- トースト（js/toast.js） ----------
   「終わったことを伝えるだけ」の一時通知。消えて困る情報は載せない。 */
.toast-host {
  position: fixed; right: 16px; bottom: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;   /* 下の画面を押せなくしない */
}
.toast {
  pointer-events: auto; cursor: pointer;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--green);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; font-size: 14px;
  animation: toast-in 0.18s ease-out;
}
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--danger); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-out { transition: none; }
}

/* ---------- 拠点在庫数一覧 ----------
   1拠点あたり「拠点合計3列」＋「品番5種 × ロジアークス/ブイレジャー」で **14列**ある。
   横に長い表なので、見出し2段と拠点の列を貼り付けて、表の中だけでスクロールさせる。 */

/* 絞り込み・並べ替えの行（打鍵ごとの通信はしないのでボタンは無い） */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filter-search {
  flex: 1 1 220px; min-width: 180px;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
.filter-select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff; cursor: pointer;
}
.filter-search:focus, .filter-select:focus { outline: 2px solid var(--green-050); border-color: var(--green); }
.filter-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer;
}
.filter-check input { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }

/* 数字列。桁位置を揃えないと大小が読み取れない。
   0 を薄くしないと「値の入っている列」が見つけられず、
   マイナス（出荷と回収の差引で出る）は赤にしないと異常に見えない。 */
table.diff th.num, table.diff td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.diff td.num.zero { color: #b9c4bd; }
table.diff td.num.neg { color: var(--danger); }
table.diff td.col-total { font-weight: 700; background: #f7faf8; }
table.diff tr.sum-row td { background: #eef4f0; font-weight: 700; border-top: 2px solid var(--line); }

.table-wrap.stock-wrap { max-height: 70vh; overflow: auto; }
table.stock-list { min-width: 0; }

/* 🚨 貼り付けの重なり順（手前ほど大きい）。**明示しないと埋もれる**。
   見出しも小計行も拠点列もすべて sticky なので、z-index が同じだと
   **DOM で後ろにある列が拠点列の上に流れ込む**（2026-07-29 に発生）。

     4  見出しの拠点セル（上にも左にも貼り付く角）
     3  見出しのその他 / 小計行
     2  本文の拠点セル
     auto  横に流れる本文のセル

   ⚠ セレクタの詳細度にも注意。`thead tr:first-child th` は (0,2,4) で、
     `th.loc` の (0,2,2) より強い。**同じ強さ以上で上書きしないと z-index が効かない**
     （これが上記の不具合の原因だった）。 */

/* 見出しは2段（1段目＝拠点合計・品番 / 2段目＝ロジアークス・ブイレジャー）。
   ⚠ 1段目の高さを固定しないと2段目の貼り付け位置(top)がずれて隙間や重なりが出る。 */
table.stock-list thead tr:first-child th { height: 38px; text-align: center; position: sticky; top: 0; z-index: 3; }
table.stock-list thead tr:nth-child(2) th { position: sticky; top: 38px; z-index: 3; font-weight: 600; }
table.stock-list th.sub { font-size: 11px; }

/* 拠点の列は横スクロールしても残す（どの拠点の数字か分からなくなるため）。 */
table.stock-list th.loc, table.stock-list td.loc {
  position: sticky; left: 0; background: var(--card);
  white-space: normal; min-width: 13em; max-width: 22em;
}
table.stock-list tbody td.loc { z-index: 2; }
/* 見出しの拠点セルは (0,3,4)。上の (0,2,4) に勝たせるため tr の指定ごと書く。 */
table.stock-list thead tr:first-child th.loc,
table.stock-list thead tr:nth-child(2) th.loc { z-index: 4; background: #f6f9f7; }

/* 小計は縦スクロールしても下に残す（絞り込んだ範囲の合計がこの画面の主目的）。 */
table.stock-list tfoot td { position: sticky; bottom: 0; z-index: 3; }
table.stock-list tfoot td.loc { z-index: 4; }
table.stock-list tr.sum-row td.loc { background: #eef4f0; }

/* 品番のかたまりの境目 */
table.stock-list th.grp, table.stock-list td.grp { border-left: 1px solid var(--line); }

/* ブイレジャーの台数は押すと根拠（出荷の記録）が出る。
   押せることが分かる最小限の見せ方にする（0のセルは押せないので普通の数字のまま）。 */
table.diff td.own-link { padding: 0; }
table.diff td.own-link .cell-btn {
  width: 100%; padding: 8px 10px; background: none; border: none;
  font: inherit; color: var(--green-dark); font-variant-numeric: tabular-nums;
  text-align: right; cursor: pointer; text-decoration: underline dotted;
  text-underline-offset: 3px;
}
table.diff td.own-link .cell-btn:hover { background: var(--green-050); }
table.diff td.own-link .cell-btn:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
table.diff td.own-link.neg .cell-btn { color: var(--danger); }
/* 0 も押せるが、表が下線だらけに見えないよう薄いまま置く（触れば押せると分かる）。 */
table.diff td.own-link.zero .cell-btn { color: #b9c4bd; }
table.diff td.own-link.zero .cell-btn:hover { color: var(--green-dark); }

/* 根拠の出荷一覧。業者名は長いものがあるので、その列だけ折り返す
   （ログイン一覧と同じ考え方。IDや日付は途中で折れると読みにくいので nowrap のまま）。 */
table.diff.event-list td.wrap {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 9em;
}

/* 記録合計とブイレジャー台数の突き合わせ。項目名に注記が付くので折り返させる
   （nowrap のままだと狭い画面でこの表だけ横に長くなる）。 */
table.diff.reconcile td:first-child { white-space: normal; }

/* 手打ちで直す欄（管理者・prod のみ）。押す前に「いくつになるか」が見える並びにする。 */
.adjust-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.adjust-row label { font-size: 13px; font-weight: 600; color: var(--muted); }
.adjust-row input {
  width: 9em; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
  text-align: right; font-variant-numeric: tabular-nums;
}
.adjust-row input:focus { outline: 2px solid var(--green-050); border-color: var(--green); }
.adjust-row .more-note { padding: 0; flex: 1 1 12em; }

/* ---------- ログイン一覧 ----------
   ログイン名や担当者は長いものがある。横スクロールさせるより**折り返して幅いっぱいに
   出す**ほうが読みやすい（ユーザー要望）。IDや日付は途中で折れると読みにくいので
   nowrap のまま残し、折り返すのは .wrap を付けた列だけにする。 */
table.diff.login-list { min-width: 0; }
table.diff.login-list td.wrap {
  white-space: normal;
  overflow-wrap: anywhere;   /* 空白の無い長い社名でも溢れさせない */
  min-width: 7em;
}
