/* =====================================================================
 * nexxjp v3 — スタイルシート
 * モバイルファースト / 明るいテーマ固定 / 依存ライブラリ・外部フォントなし
 * (CSP が style-src 'self' のため、HTML 側にインラインの style は書かない)
 *
 * 目次
 *   1. トークン       … 色・角丸・影・余白・文字サイズ(ここだけ触れば全体の色味が変わる)
 *   2. ベース         … リセット / タイポグラフィ / フォーカスリング / モーション
 *   3. レイアウト     … PR バー / ヘッダー / フッター / ラッパー
 *   4. コンポーネント … ボタン / バッジ / ストアバッジ / カード / 表 / フォーム / ページャ
 *   5. ページ別       … 一覧・検索 / 商品ページ / 管理画面
 *   6. ユーティリティ
 *   7. 画面幅ごとの調整(600 / 720 / 900 / 1120px)
 * ===================================================================== */

/* =====================================================================
 * 1. トークン
 * ===================================================================== */

:root {
  /* --- 面と線 ------------------------------------------------------- */
  --bg: #f4f6f9;            /* ページの地。白いカードを浮かせるためのごく薄いグレー */
  --surface: #ffffff;       /* カード・パネルの面 */
  --surface-2: #f7f9fc;     /* 面の中の一段沈んだ帯(表の見出し・画像の下地) */
  --surface-3: #eef1f6;     /* さらに沈んだ帯 */
  --line: #e2e6ee;          /* 1px の境界線 */
  --line-2: #eef0f5;        /* 表の行区切りなど、より薄い線 */

  /* --- 文字(いずれも白地でコントラスト比 4.5:1 以上) ---------------- */
  --ink: #121924;           /* 見出し */
  --text: #1f2836;          /* 本文 */
  --muted: #5f6b7a;         /* 補助・メタ情報(12〜13px でも 4.5:1 以上) */
  --faint: #8a94a3;         /* 装飾のみ。文字色には使わない */

  /* --- アクセント(色味を変えるならここ) ---------------------------- */
  /* ロゴ(assets/logo.svg)の青 #2b53d4 に合わせた系列。白地でのコントラストは 6.3:1 以上 */
  --accent: #2b53d4;        /* リンク・強調 */
  --accent-strong: #2345b5; /* ボタンの地・hover */
  --accent-ink: #1c3a96;    /* 淡い地の上に置く濃いアクセント文字 */
  --accent-soft: #eff3ff;   /* 淡い地 */
  --accent-line: #c7d4fb;   /* 淡い地の枠線 */
  --focus: #2345b5;         /* フォーカスリング */

  /* --- 状態色 ------------------------------------------------------- */
  --in: #15803d;  --in-bg: #e8f7ee;  --in-line: #bde5cb;   /* 在庫あり・成功 */
  --out: #b91c1c; --out-bg: #fdecec; --out-line: #f4c9c9;  /* 在庫なし・エラー */
  --unk: #46505f; --unk-bg: #eef1f5; --unk-line: #dce1ea;  /* 不明・中立 */
  --best: #8a4b00; --best-bg: #fff4e2; --best-line: #f6d4a5; /* 最安 */

  /* --- 角丸 --------------------------------------------------------- */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --radius: var(--r);       /* 旧トークン名の互換 */

  /* --- 影(淡く・広く。白地に軽い奥行きを出すだけ) ------------------ */
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-2: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 12px -4px rgba(16, 24, 40, .10);
  --shadow-3: 0 2px 4px rgba(16, 24, 40, .06), 0 12px 28px -12px rgba(16, 24, 40, .22);

  /* --- 余白のリズム ------------------------------------------------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* --- 文字サイズ --------------------------------------------------- */
  --t-2xs: 11px;
  --t-xs: 12px;
  --t-sm: 13px;
  --t-base: 15px;
  --t-md: 16px;
  --t-lg: 18px;
  --t-xl: 21px;
  --t-2xl: 26px;

  /* --- その他 ------------------------------------------------------- */
  --wrap: 1680px;           /* コンテンツの最大幅(フルワイド。帯は画面幅いっぱい) */
  --read: 75ch;             /* 読ませる文章の最大幅 */
  --tap: 40px;              /* タップ領域の最小の高さ */
  --header-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

/* =====================================================================
 * 2. ベース
 * ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px); /* アンカー移動でヘッダーに隠れないように */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.65;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); font-weight: 800; letter-spacing: -.01em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-3);
  color: var(--unk);
  padding: .1em .4em;
  border-radius: var(--r-xs);
  overflow-wrap: anywhere;
}

small { font-size: .8em; }
s { color: var(--muted); }

/* フォーカスリング: キーボード操作時だけ、どの面の上でも見えるように二重にする */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent-line); color: var(--ink); }

/* 動きを減らす設定を尊重する */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================================
 * 3. レイアウト
 * ===================================================================== */

/* 横幅の器。スマホでも左右 16px は必ず空け、広い画面では余白も一緒に広がる。 */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: clamp(16px, 3vw, 40px);
}

.main {
  padding-top: var(--sp-4);
  padding-bottom: var(--sp-7);
  min-height: 60vh;
}
/* 帯を画面幅いっぱいに敷くページ(トップ)。中身の側が .wrap を置く。 */
.main-wide { padding-top: 0; }

/* ---- PR バー(アフィリエイト表記。常に最上部) ---------------------- */
.pr-bar {
  background: var(--ink);
  color: #e7ecf3;
  font-size: var(--t-2xs);
  text-align: center;
  padding: 5px 12px;
  letter-spacing: .02em;
}
.pr-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: #cfe0ff;
  border: 1px solid rgba(207, 224, 255, .5);
  border-radius: var(--r-xs);
  padding: 0 5px;
  margin-right: 6px;
  line-height: 1.5;
  vertical-align: 1px;
}
/* フッターの PR タグは白地の上に載るので色を戻す */
.site-footer .pr-tag { color: var(--muted); border-color: var(--line); }

/* ---- ヘッダー(細めの固定ヘッダー) ---------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 800;
  font-size: var(--t-lg);
  letter-spacing: -.02em;
  min-height: var(--tap);
  flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand-name span { color: var(--accent); }

/* ロゴ用の枠。将来 <img> を入れたらそのまま差し替わる(下の :has を参照)。
   いまは CSS で描いた仮のマーク。 */
.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(140deg, #3b82f6 0%, var(--accent-strong) 55%, #4f2fbf 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 1px 3px rgba(16, 24, 40, .25);
  overflow: hidden;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 2px;
}
.brand-mark::before { left: 9px;  top: 9px;  width: 4px; height: 13px; }
.brand-mark::after  { left: 16px; top: 13px; width: 4px; height: 9px; opacity: .72; }
/* ロゴ画像を入れたら仮のマークは消える */
.brand-mark:has(img) { background: none; box-shadow: none; }
.brand-mark:has(img)::before,
.brand-mark:has(img)::after { content: none; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* 主ナビ */
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: 0 0 auto;
}
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-weight: 700;
  font-size: var(--t-sm);
}
.nav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--accent-ink); background: var(--accent-soft); }

/* ヘッダー内の検索(広い画面のみ。狭い画面は各ページの絞り込みバーを使う) */
.header-search { display: none; }

/* ---- フッター -------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--t-xs);
  padding: var(--sp-5) 0 var(--sp-6);
}
.site-footer p { margin: 6px 0; max-width: 70ch; }

/* =====================================================================
 * 4. コンポーネント
 * ===================================================================== */

/* ---- 見出し・説明文 -------------------------------------------------- */
.page-title {
  font-size: var(--t-xl);
  line-height: 1.3;
  margin: var(--sp-2) 0 var(--sp-1);
}
.page-title small { font-weight: 600; font-size: .6em; }
.lead { color: var(--muted); margin: 0 0 var(--sp-4); font-size: var(--t-sm); }
.section-title {
  font-size: var(--t-md);
  margin: 0 0 var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sub-title { font-size: var(--t-sm); margin: var(--sp-5) 0 var(--sp-1); color: var(--ink); }
.note { color: var(--muted); font-size: var(--t-xs); margin: var(--sp-1) 0 var(--sp-3); max-width: 76ch; }

/* パンくず */
.crumbs {
  font-size: var(--t-xs);
  color: var(--muted);
  margin: 0 0 var(--sp-2);
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  align-items: center;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

/* ---- パネル ---------------------------------------------------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.error-panel { text-align: center; padding: var(--sp-7) var(--sp-4); }
.error-panel h1 { font-size: var(--t-xl); margin: 0 0 var(--sp-2); }

/* ---- 空の状態 -------------------------------------------------------- */
.empty {
  color: var(--muted);
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  margin: var(--sp-4) 0;
}
.empty-title { color: var(--ink); font-weight: 700; font-size: var(--t-md); margin: 0 0 var(--sp-1); }
.empty-hint { margin: 0; font-size: var(--t-sm); }

/* ---- ボタン ---------------------------------------------------------- */
/* ボタンは狭い行でも縮めない(縮むと日本語が 1 文字ずつ折り返されてしまう) */
button, input[type="submit"], input[type="button"] { white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 5em;
  min-height: var(--tap);
  border: 1px solid var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--t-sm);
  line-height: 1.3;
  border-radius: var(--r-sm);
  padding: 8px 16px;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-1);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn:hover { background: #1c3a96; border-color: #1740b5; color: #fff; text-decoration: none; box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.btn-ghost {
  background: var(--surface);
  color: var(--accent-ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }

.btn-danger { background: var(--out); border-color: var(--out); }
.btn-danger:hover { background: #8f1616; border-color: #8f1616; }

.btn-buy { white-space: nowrap; }
.btn-sm { min-height: 34px; font-size: var(--t-xs); padding: 5px 12px; border-radius: var(--r-xs); }

/* ---- バッジ / ピル ---------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 1.6;
  border-radius: var(--r-pill);
  padding: 0 9px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.stock-in { color: var(--in); background: var(--in-bg); border-color: var(--in-line); }
.stock-out { color: var(--out); background: var(--out-bg); border-color: var(--out-line); }
.stock-unknown { color: var(--unk); background: var(--unk-bg); border-color: var(--unk-line); }

/* 最安 / 1個あたり最安 */
.badge-best {
  color: var(--best);
  background: var(--best-bg);
  border-color: var(--best-line);
  margin-left: 4px;
}
/* Amazon の招待制出品: 控えめな輪郭のタグ。価格は隠さない */
.badge-invite {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line);
  font-weight: 600;
  margin-left: 4px;
  padding: 0 8px;
}
/* セット販売(6個セット など) */
.badge-pack {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  font-weight: 700;
  margin-left: 4px;
  padding: 0 8px;
}
.unit-price {
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- ストアバッジ ----------------------------------------------------- */
/* 各ストアの雰囲気に寄せた淡い色。文字色は地色の上で 4.5:1 以上を確保している。
   クラスは lib/layout.php の store_brand_class() が付ける。 */
.brand-amazon    { --bd-bg: #fff3e3; --bd-line: #f6d6a9; --bd-ink: #8a4b00; }
.brand-rakuten   { --bd-bg: #fdeaea; --bd-line: #f3c6c6; --bd-ink: #a81616; }
.brand-yahoo     { --bd-bg: #fdeaf1; --bd-line: #f3c3d6; --bd-ink: #a3134f; }
.brand-joshin    { --bd-bg: #e9f1ff; --bd-line: #c3d8fb; --bd-ink: #14509e; }
.brand-biccamera { --bd-bg: #fff0e8; --bd-line: #fbceb6; --bd-ink: #9c3d12; }
.brand-amiami    { --bd-bg: #e7f5ef; --bd-line: #bde2d1; --bd-ink: #0d6a4a; }
.brand-default   { --bd-bg: #eef1f5; --bd-line: #d8dee7; --bd-ink: #3c4758; }

.store-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 1px 11px;
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  font-weight: 700;
  background: var(--bd-bg, #eef1f5);
  color: var(--bd-ink, #3c4758);
  border: 1px solid var(--bd-line, #d8dee7);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.store-badge:hover { text-decoration: none; filter: brightness(.96); }

/* ---- 感知時刻 -------------------------------------------------------- */
.ago { color: var(--muted); font-size: var(--t-xs); white-space: nowrap; }
.raw { color: var(--muted); margin-left: 4px; }
.chg { display: inline-block; font-size: var(--t-2xs); font-weight: 700; margin-left: 4px; white-space: nowrap; }
.chg-up { color: var(--out); }
.chg-down { color: var(--in); }

/* ---- 画像 ------------------------------------------------------------ */
.noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: var(--t-2xs);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  letter-spacing: .04em;
}

/* ---- 検索・絞り込みバー ----------------------------------------------- */
.search {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.search-q { flex: 1 1 100%; }
/* セレクトも潰れないように下限を持たせる(380px でもラベルが読める) */
.search-store { flex: 1 1 auto; width: auto; min-width: 8em; }
.search .btn { flex: 0 0 auto; }

input[type="text"], input[type="search"], select {
  font: inherit;
  font-size: var(--t-md); /* iOS の自動ズーム回避 */
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--faint); }
input[type="text"]:hover, input[type="search"]:hover, select:hover { border-color: #cdd4df; }
input[type="text"]:focus, input[type="search"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-line);
  outline: none;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
select {
  appearance: none;
  padding-right: 34px;
  /* 三角は border で描いた擬似要素が使えないので、背景の線形グラデーションで代用 */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ---- チップ型リンク(カテゴリ / 絞り込み) ----------------------------- */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 var(--sp-3);
  padding: 0;
  list-style: none;
}
.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  font-size: var(--t-sm);
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px 14px;
  color: var(--text);
  background: var(--surface);
  white-space: nowrap;
  box-shadow: var(--shadow-1);
}
.chip-link:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); text-decoration: none; }
.chip-link.is-active {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
  font-weight: 700;
}
.chip-link.is-active .muted { color: rgba(255, 255, 255, .78); }

/* カテゴリのクイックフィルタ: 数が増えても壁にならないよう、スマホは 1 行の横スクロールにする
   (件数の上限は PHP 側の CATEGORY_CHIP_MAX。あふれた分は「すべてのカテゴリ」へ) */
.cat-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
/* 深い階層でも名前が長すぎるときは省略して、行が崩れないようにする */
.chip-label { min-width: 0; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-more { border-style: dashed; color: var(--accent-ink); font-weight: 700; }

/* ---- 商品カード(一覧) ----------------------------------------------- */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow-3); border-color: #d3dae6; transform: translateY(-1px); }
.card:focus-within { border-color: var(--accent); }

.card-link {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  color: var(--text);
  height: 100%;
  align-items: flex-start;
}
.card-link:hover { text-decoration: none; }

.card-media { flex: 0 0 92px; }
.card-img, .card-media .noimg {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  display: block;
}
.card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.card-title {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--sp-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ストア別の価格行 */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
/* カードのオファー行は 1 行だけ(最新の 1 件)。折り返さず、店名が長いときは店名を省略する */
.chip {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  font-size: var(--t-xs);
  border-radius: var(--r-xs);
  padding: 2px 0;
}
.chip-store {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: 700;
  font-size: var(--t-2xs);
  line-height: 1.7;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--bd-bg, #eef1f5);
  color: var(--bd-ink, #3c4758);
  border: 1px solid var(--bd-line, #d8dee7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* カードは 1 行なのでストア名を広めに(省略は本当に長いときだけ) */
  max-width: 62%;
}
.chip-price {
  margin-left: auto;
  white-space: nowrap;
  font-weight: 800;
  font-size: var(--t-sm);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip .badge-invite, .chip .badge-pack { font-size: 10px; padding: 0 6px; line-height: 1.6; margin-left: 0; }
.chip .unit-price { font-size: 10px; }

.card-seen {
  font-size: var(--t-xs);
  color: var(--muted);
  margin-top: auto;
  padding-top: var(--sp-2);
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  align-items: baseline;
}
.card-seen time { color: var(--muted); }

/* ---- 表(広い画面は比較表 / 狭い画面はカード) ------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.rtable {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
}
.rtable th {
  text-align: left;
  font-size: var(--t-xs);
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  white-space: nowrap;
}
.rtable th:first-child { border-top-left-radius: var(--r-sm); }
.rtable th:last-child { border-top-right-radius: var(--r-sm); }
.rtable th small { font-weight: 400; }
.rtable td {
  padding: 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable .price {
  font-weight: 800;
  font-size: var(--t-md);
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- ページャ -------------------------------------------------------- */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 0;
}
.pager-num { color: var(--muted); font-size: var(--t-sm); font-weight: 600; }

/* ---- フラッシュメッセージ --------------------------------------------- */
.flash {
  border-radius: var(--r-sm);
  padding: 10px 14px;
  margin: var(--sp-2) 0;
  font-size: var(--t-sm);
  border: 1px solid transparent;
}
.flash-ok { background: var(--in-bg); color: #10662f; border-color: var(--in-line); }
.flash-error { background: var(--out-bg); color: #971616; border-color: var(--out-line); }

/* ---- 数値サマリ ------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
  margin: var(--sp-3) 0;
}
.stats div {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 10px 12px;
}
.stats dt { color: var(--muted); font-size: var(--t-xs); line-height: 1.4; }
.stats dd {
  margin: 2px 0 0;
  font-size: var(--t-xl);
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* ---- フォーム部品 ----------------------------------------------------- */
.form-stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.form-stack .btn { align-self: flex-start; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--t-xs); color: var(--muted); font-weight: 700; }
.field-help { font-size: var(--t-xs); color: var(--muted); line-height: 1.55; }
.inline-fields { display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-2) 0; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  margin: var(--sp-2) 0;
  min-height: var(--tap);
}
.check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-strong); }

details.help, details.add-key { font-size: var(--t-sm); margin: var(--sp-2) 0 var(--sp-3); }
details.help > summary, details.add-key > summary {
  cursor: pointer;
  color: var(--accent-ink);
  font-weight: 700;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.help ul { padding-left: 20px; margin: var(--sp-2) 0; }
.help li { margin: 4px 0; word-break: break-all; }

/* =====================================================================
 * 5. ページ別
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * 5-0. ポータル風トップ
 * ------------------------------------------------------------------- */

/* トップの検索・絞り込み(ヘッダー直下の最初のブロック) */
.front-tools { padding-block: var(--sp-4) var(--sp-2); }

.badge-drop { color: var(--out); background: var(--out-bg); border-color: var(--out-line); }

/* 本体 + 右カラム */
.front-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); padding-bottom: var(--sp-6); }
.front-main { min-width: 0; }
.front-side { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); }

/* 棚 */
.front-section { margin: 0 0 var(--sp-6); }
.front-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--sp-3); margin: 0 0 var(--sp-3); }
.front-title {
  font-size: var(--t-lg);
  /* h2 と span の両方で使うので、太さと行間をここで固定する(片方だけ細く見えていた) */
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  margin: 0;
  position: relative;
  padding-left: 12px;
}
.front-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: .18em;
  bottom: .18em;
  width: 4px;
  border-radius: 2px;
  background: var(--accent-strong);
}
.front-sub { color: var(--muted); font-size: var(--t-xs); margin: 0; }
.front-more {
  margin-left: auto;
  font-size: var(--t-sm);
  font-weight: 700;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

/* 棚の中身: スマホは横スクロール、広い画面はグリッド */
.front-row {
  list-style: none;
  margin: 0;
  padding: 0 0 6px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 68%);
  gap: var(--sp-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.front-row > .mcard { scroll-snap-align: start; }

.mcard {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.mcard:hover { box-shadow: var(--shadow-3); border-color: #d3dae6; transform: translateY(-1px); }
.mcard-link { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); height: 100%; color: var(--text); }
.mcard-link:hover { text-decoration: none; }
.mcard-media { width: 100%; }
.mcard-img, .mcard-media .noimg {
  width: 100%;
  height: 112px;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  display: block;
}
.mcard-body { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; flex: 1 1 auto; min-width: 0; width: 100%; }
.mcard-title {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mcard-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; }
.mcard-now { font-size: var(--t-md); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.mcard-was { color: var(--muted); font-size: var(--t-xs); }
.mcard-note { color: var(--muted); font-size: var(--t-2xs); font-weight: 700; }
.mcard-meta { font-size: var(--t-2xs); color: var(--muted); margin-top: auto; padding-top: 2px; }

/* ライブ感知タイムライン */
.tl-panel { margin: 0; padding: var(--sp-4); }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: var(--sp-2); padding: 8px 0; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
/* 小さなサムネイル。画像が無い行も枠を残して左端をそろえる */
.tl-thumb { flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--r-xs);
            background: var(--surface-2); border: 1px solid var(--line-2); overflow: hidden; }
/* 商品全体が見えるように(cover だと寄って切れる。オーナー指摘 2026-09-16) */
.tl-img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.tl-item:last-child { border-bottom: 0; }
.tl-time { flex: 0 0 42px; display: flex; flex-direction: column; font-size: var(--t-2xs); color: var(--muted); line-height: 1.35; }
.tl-time time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tl-body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.tl-title {
  display: block;
  width: 100%;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-price { font-size: var(--t-sm); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* カテゴリ棚のあとに置く「カテゴリ一覧」への導線 */
.front-allcats { margin: var(--sp-5) 0 0; }

/* ---------------------------------------------------------------------
 * 5-0b. 索引ページ(/v3/c/ カテゴリ一覧 ・ /v3/s/ ストア一覧)
 * カテゴリやストアが増えても、全件はここだけで受け止める。
 * ------------------------------------------------------------------- */
.index-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); margin: var(--sp-4) 0; align-items: stretch; }
.index-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  padding: var(--sp-4) var(--sp-5);
  min-width: 0;
  margin: 0 0 var(--sp-4);
}
/* 見出し: カテゴリ名は大きく、件数は右のピル */
.index-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--t-lg);
  margin: 0 0 var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.index-title a { color: var(--ink); }
.index-count {
  flex: 0 0 auto;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  font-variant-numeric: tabular-nums;
}
/* 子カテゴリ: 1 行 1 件。行全体がリンクで、長い名前は省略せず折り返す */
.index-children { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.index-children li { display: block; }
.index-children a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-height: var(--tap);
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--t-sm);
}
.index-children a:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; }
.index-row-name { overflow-wrap: anywhere; }
.index-row-count { flex: 0 0 auto; color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.index-card-plain { grid-column: 1 / -1; }

/* Apple Store 店頭在庫(/iphone/ の要約)。カード全体が 1 つのリンク(オーナー指示: 全体クリック) */
.ip-panel { margin: 0; padding: 0; overflow: hidden; }
.ip-link { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); color: var(--text); }
.ip-link:hover { text-decoration: none; background: var(--surface-2); }
.ip-link .front-head { margin-bottom: 2px; }
.ip-title { line-height: 1.3; }
.ip-total { font-size: var(--t-xs); color: var(--muted); }
.ip-total strong { font-size: var(--t-xl); color: var(--ink); font-weight: 800; letter-spacing: -.02em;
                   font-variant-numeric: tabular-nums; }
.ip-models { display: flex; flex-direction: column; margin-top: 2px; }
/* 1 行 = 1 モデル。商品カードっぽく: 画像 + 名前 + 在庫バー + 件数ピル */
.ip-row { display: flex; align-items: center; gap: var(--sp-3); padding: 7px 0;
          border-bottom: 1px solid var(--line-2); }
.ip-row:last-child { border-bottom: 0; }
.ip-row.is-zero { opacity: .55; }
.ip-thumb { flex: 0 0 34px; }
.ip-img, .ip-thumb .noimg { width: 34px; height: 34px; object-fit: contain; display: block;
            border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--line-2); }
.ip-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ip-model { font-size: var(--t-sm); font-weight: 600; color: var(--ink);
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-bar { display: block; height: 4px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.ip-bar-fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); }
.ip-count { flex: 0 0 auto; font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums;
            background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 1px 9px; }
.ip-count strong { color: var(--ink); font-size: var(--t-sm); font-weight: 800; }
.ip-row.is-zero .ip-count strong { color: var(--muted); }
.ip-stores { font-size: var(--t-xs); color: var(--muted); overflow-wrap: anywhere; }
.ip-meta { font-size: var(--t-xs); color: var(--muted); }
/* バーの幅。CSP で style 属性が使えないので 5% 刻みのクラスで出す */
.ip-w0 { width: 0%; }
.ip-w5 { width: 5%; }
.ip-w10 { width: 10%; }
.ip-w15 { width: 15%; }
.ip-w20 { width: 20%; }
.ip-w25 { width: 25%; }
.ip-w30 { width: 30%; }
.ip-w35 { width: 35%; }
.ip-w40 { width: 40%; }
.ip-w45 { width: 45%; }
.ip-w50 { width: 50%; }
.ip-w55 { width: 55%; }
.ip-w60 { width: 60%; }
.ip-w65 { width: 65%; }
.ip-w70 { width: 70%; }
.ip-w75 { width: 75%; }
.ip-w80 { width: 80%; }
.ip-w85 { width: 85%; }
.ip-w90 { width: 90%; }
.ip-w95 { width: 95%; }
.ip-w100 { width: 100%; }

/* サイトマップ */
.sitemap { margin: 0; }
.sitemap-more { margin: var(--sp-2) 0 0; font-size: var(--t-sm); font-weight: 700; }
.sitemap-title { font-size: var(--t-sm); margin: var(--sp-4) 0 var(--sp-2); }
.sitemap-title:first-child { margin-top: 0; }
.sitemap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sitemap-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 32px; font-size: var(--t-sm); }
.sitemap-list .muted { font-size: var(--t-xs); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
 * 5-1. 商品ページ
 * ------------------------------------------------------------------- */
.product-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin: 0 0 var(--sp-4);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.product-media { text-align: center; }
/* 画像は正方形で固定。横に情報が並ぶので、伸び縮みさせない */
.product-img, .product-media .noimg {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  margin: 0 auto;
}
.product-info { min-width: 0; }
.product-title {
  font-size: var(--t-lg);
  line-height: 1.4;
  margin: 0 0 var(--sp-3);
}

/* カテゴリ(見出しのすぐ下の 1 行) */
.product-cat { font-size: var(--t-xs); color: var(--muted); margin: 0 0 var(--sp-3); overflow-wrap: anywhere; }

/* JAN / ASIN / 型番。ラベルを縦に積まず、小さなチップで折り返す */
.product-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 var(--sp-4); padding: 0; }
.pchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-2xs);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  max-width: 100%;
}
.pchip-label { font-weight: 700; letter-spacing: .03em; }
.pchip code { background: none; padding: 0; color: var(--text); font-size: var(--t-xs); overflow-wrap: anywhere; }

/* 価格と購入。ページのいちばんの見どころなので上に大きく置く */
.buybox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-3);
  padding: var(--sp-4);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
}
.buybox-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.buybox-note { font-size: var(--t-xs); color: var(--muted); font-weight: 700; }
.buybox-price {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  color: var(--accent-ink);
  letter-spacing: -.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.buybox-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--t-xs); }
.buybox-cta { margin-left: auto; }

/* 価格の推移。小さく、横に並べる(値動きがあるときだけ出る) */
.spark-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.spark-inline .spark { max-width: 220px; flex: 0 0 auto; }
/* SVG は fill の既定が黒。指定が無いと面も線も真っ黒に塗りつぶされる(オーナー指摘 2026-09-16) */
.spark { width: 220px; height: 44px; display: block; }
.spark-area { fill: var(--accent-soft); stroke: none; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark-label { font-size: var(--t-xs); color: var(--text); font-weight: 700; }
.spark-range { font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }

.admin-link { font-size: var(--t-xs); text-align: right; margin-top: var(--sp-4); }

/* 取り扱いストアの比較表 */
/* 幅いっぱいだと「購入」ボタンだけ遠くに離れて見える(オーナー指摘 2026-09-16)。
   表の幅を抑え、購入列にも上限を付けて価格の近くに置く。 */
.offers th:last-child, .offers td.buy { width: 160px; }
.offers td.buy .btn { min-width: 120px; }
.offers td:first-child { font-weight: 600; }
/* 購入の見出しとボタンを同じ側にそろえる */
.offers thead th:last-child { text-align: right; }
.offers td.buy { text-align: right; }
.history td.price { font-size: var(--t-sm); }

/* ---------------------------------------------------------------------
 * 5-2. 管理画面
 * ------------------------------------------------------------------- */
.badge-count { color: #fff; background: var(--out); border-color: var(--out); margin-left: 4px; }
.badge-src { color: var(--unk); background: var(--unk-bg); border-color: var(--unk-line); font-weight: 700; }
.badge-collect { color: var(--in); background: var(--in-bg); border-color: var(--in-line); }
.badge-skip { color: var(--unk); background: var(--unk-bg); border-color: var(--unk-line); }
.verdict-ok { color: var(--in); background: var(--in-bg); border-color: var(--in-line); }
.verdict-review, .verdict-none { color: var(--best); background: var(--best-bg); border-color: var(--best-line); }
.verdict-mismatch, .verdict-not_found { color: var(--out); background: var(--out-bg); border-color: var(--out-line); }

.jan-top-link {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
  margin: var(--sp-3) 0;
  font-size: var(--t-sm);
}

/* ストア設定カード */
.store-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.store-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
}
.store-card.is-disabled { background: var(--surface-2); }
.store-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--sp-3);
  align-items: center;
  font-size: var(--t-sm);
}
.store-head .muted { font-size: var(--t-xs); }
.sample-link { font-size: var(--t-xs); color: var(--muted); word-break: break-all; margin: var(--sp-2) 0; }

.nojan-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; font-size: var(--t-sm); }
.nojan-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--line-2);
  padding: 7px 0;
}
.nojan-list li:last-child { border-bottom: 0; }

.skip-stores > summary {
  cursor: pointer;
  font-size: var(--t-md);
  font-weight: 800;
  color: var(--ink);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 6px;
}
.skip-stores[open] > summary { margin-bottom: var(--sp-2); }

/* 商品統合・紐づけ解除のプレビュー */
.merge-preview { margin-top: var(--sp-4); }
.merge-cols { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.merge-col {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--t-sm);
  background: var(--surface-2);
}
.merge-col h3 { font-size: var(--t-xs); color: var(--muted); margin: 0 0 var(--sp-1); }
.merge-col p { margin: 3px 0; }
.merge-col ul { padding-left: 20px; margin: var(--sp-2) 0 0; font-size: var(--t-sm); }

/* JAN 確認待ちのキュー */
.jan-review-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
.jan-item {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.jan-offer-title {
  font-weight: 700;
  color: var(--ink);
  margin: var(--sp-2) 0 var(--sp-1);
  line-height: 1.45;
  word-break: break-word;
}
.jan-meta { font-size: var(--t-xs); margin: 3px 0; word-break: break-all; }

.jan-cands { list-style: none; margin: var(--sp-3) 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.jan-cand {
  display: flex;
  gap: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--sp-3);
  background: var(--surface-2);
}
.jan-cand.is-ok { border-color: var(--in-line); background: var(--in-bg); }
.jan-cand-img, .jan-cand .noimg {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
}
.jan-cand-body { flex: 1 1 auto; min-width: 0; font-size: var(--t-sm); }
.jan-cand-body p { margin: 3px 0; }
.jan-cand-title { word-break: break-word; color: var(--ink); }
.conflicts { color: var(--out); font-size: var(--t-xs); margin: var(--sp-1) 0; padding-left: 18px; }

.jan-inline-form { margin: var(--sp-2) 0 0; }
.jan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: flex-end;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-2);
}
.jan-manual { display: flex; gap: 6px; align-items: center; flex: 1 1 260px; }
.jan-manual input[type="text"] { flex: 1 1 auto; max-width: 15em; }

.trust-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.trust-form select { width: auto; max-width: 100%; font-size: var(--t-sm); min-height: 34px; padding: 4px 30px 4px 10px; }
.admin-mini-btn { margin-left: 8px; vertical-align: middle; }

/* 商品ページの管理パネル / 非表示の商品(オーナー指示 2026-09-16)
   管理者にだけ出る領域なので、本文と見分けが付くように左に帯を入れる。 */
.admin-panel { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.admin-panel .field-help { max-width: 60ch; }
.admin-sub { font-size: var(--t-md); font-weight: 700; margin: var(--sp-5) 0 var(--sp-1); }

/* オファーごとの編集ブロック。表の「編集」から飛んできたときに、どれを開いたか分かるようにする。 */
.admin-offer {
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: var(--sp-3);
  margin-top: var(--sp-3);
}
.admin-offer:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.admin-offer:focus { outline: none; }
.admin-offer-title {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  font-size: var(--t-sm);
  margin: 0 0 var(--sp-2);
}

/* 取り消しにくい操作。周りと見分けが付くように囲って、チェックを入れないと押せないようにする。 */
.admin-danger {
  border: 1px solid var(--out-line);
  background: var(--out-bg);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-3);
}
.admin-danger .field-help { color: var(--text); }
.confirm-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--out);
  margin-right: var(--sp-2);
}
.confirm-check input { width: 16px; height: 16px; accent-color: var(--out); }
.badge-why { color: var(--out); background: var(--out-bg); border-color: var(--out-line); margin-right: 4px; }
/* 非表示の商品一覧: 小さなサムネイル付きの商品セル(画像が無い行も枠を残す) */
.hid-prod { display: flex; gap: var(--sp-2); align-items: center; min-width: 0; }
.hid-prod > a { min-width: 0; }
.btn.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* =====================================================================
 * 6. ユーティリティ
 * ===================================================================== */

.muted { color: var(--muted); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* =====================================================================
 * 7. 画面幅ごとの調整
 * ===================================================================== */

/* ---- 〜719px: 表を1件ずつのカードに畳む ------------------------------- */
@media (max-width: 719px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    margin: 0 0 var(--sp-3);
    padding: 4px 14px 10px;
  }
  .rtable td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    border-bottom: 1px dashed var(--line);
    padding: 8px 0;
    text-align: right;
    flex-wrap: wrap;
  }
  .rtable td:last-child { border-bottom: 0; }
  .rtable td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--t-xs);
    font-weight: 700;
    text-align: left;
    margin-right: auto;
  }
  /* 1列目(ストア)はカードの見出しとして扱う */
  .offers td:first-child { border-bottom: 1px solid var(--line); padding-top: 10px; }
  .rtable td.price { font-size: var(--t-lg); }
  .rtable td.buy { display: block; padding-top: 12px; }
  .rtable td.buy::before { content: none; }
  .rtable td.buy .btn { width: 100%; min-height: 46px; font-size: var(--t-md); }
  .history td.price { white-space: normal; font-size: var(--t-md); }
}

/* ---- 600px 以上 ------------------------------------------------------ */
@media (min-width: 600px) {
  .search-q { flex: 1 1 260px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .inline-fields { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
  .inline-fields .field { flex: 1 1 200px; }
  .inline-fields .field-grow { flex: 3 1 320px; }
  .merge-cols { flex-direction: row; }
  .merge-col { flex: 1 1 0; }

  /* カードを縦積み(画像が上)にして密度を上げる */
  .cards { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .card-link { flex-direction: column; gap: var(--sp-3); padding: var(--sp-3); }
  .card-media { flex: 0 0 auto; width: 100%; }
  .card-img, .card-media .noimg { width: 100%; height: 150px; }
  .card-body { width: 100%; flex: 1 1 auto; }
  .card-title { font-size: var(--t-sm); margin-bottom: var(--sp-2); }
}

/* ---- 720px 以上: 表を比較表として見せる ------------------------------- */
@media (min-width: 720px) {
  .offers tbody tr { transition: background-color .12s ease; }
  .offers tbody tr:hover { background: var(--surface-2); }
  .rtable td { padding: 12px; }

  /* 棚は横スクロールをやめてグリッドに */
  .front-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, 1fr);
    overflow-x: visible;
    scroll-snap-type: none;
    padding-bottom: 0;
  }
  /* カテゴリチップ: 広い画面では折り返すが、2 行分までに抑える */
  .cat-chips { flex-wrap: wrap; overflow-x: visible; max-height: 80px; padding-bottom: 0; }
  .index-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- 900px 以上 ------------------------------------------------------ */
@media (min-width: 900px) {
  .page-title { font-size: var(--t-2xl); }
  .cards { grid-template-columns: repeat(3, 1fr); }

  /* ヘッダーに検索を出す(狭い画面は各ページの絞り込みバーで代用) */
  .header-search {
    display: flex;
    flex: 0 1 320px;
    margin-left: auto;
    gap: 6px;
  }
  .header-search + .nav { margin-left: 0; }
  .header-search input[type="search"] { min-height: 36px; font-size: var(--t-sm); padding: 4px 12px; background: var(--surface-2); }
  .header-search input[type="search"]:focus { background: var(--surface); }
  .header-search .btn { min-height: 36px; padding: 4px 14px; }

  /* 商品ページ: 画像=左 / 情報=右 */
  .product-head { flex-direction: row; align-items: flex-start; gap: var(--sp-5); padding: var(--sp-5); }
  .product-media { flex: 0 0 320px; }
  .product-info { flex: 1 1 auto; min-width: 0; }
  .product-title { font-size: var(--t-xl); }
  .meta { grid-template-columns: repeat(3, 1fr); }
  .panel { padding: var(--sp-5); }
}

/* ---- 1000px 以上: トップ・商品ページを本体 + 右カラムの 2 段組に ------- */
@media (min-width: 1000px) {
  .front-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-6); }
  /* 商品ページも 2 段組。本文は 940px で止め、右に「最近の動き」を並べる */
  .product-page {
    grid-template-columns: minmax(0, 940px) minmax(300px, 380px);
    justify-content: center;
    align-items: start;
    gap: var(--sp-6);
  }
  .product-side { align-self: start; }
  .front-side { align-self: start; }
  .front-row { grid-template-columns: repeat(4, 1fr); }
  .index-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- 1120px 以上 ----------------------------------------------------- */
@media (min-width: 1120px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
  .card-img, .card-media .noimg { height: 160px; }
}

/* ---- 広いモニタ: 列を増やして画面を埋める --------------------------- */
@media (min-width: 1500px) {
  .cards { grid-template-columns: repeat(5, 1fr); }
  .front-row { grid-template-columns: repeat(5, 1fr); }
  .front-grid { grid-template-columns: minmax(0, 1fr) 380px; }
}

@media (min-width: 1800px) {
  .cards { grid-template-columns: repeat(6, 1fr); }
  .front-row { grid-template-columns: repeat(6, 1fr); }
}

/* 商品ページの ASIN は Amazon へのリンク(オーナー指示 2026-09-16) */
.asin-link { text-decoration: none; }
.asin-link code { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.asin-link:hover code { color: var(--accent-strong); }

/* 固定ページ(プライバシーポリシー・お問い合わせ) */
.doc { max-width: var(--read); }
.doc h2 { font-size: var(--t-lg); margin: var(--sp-5) 0 var(--sp-2); }
.doc h2:first-of-type { margin-top: 0; }
.doc p, .doc li { color: var(--ink-2); line-height: 1.85; }
.doc ul { padding-left: 1.2em; }
.footer-links a { color: var(--ink-2); }

/* ヘッダーの X / RSS アイコン */
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: var(--r-pill); color: #fff; transition: transform .12s ease, filter .12s ease; }
.nav-icon svg { display: block; }
.nav-icon:hover { filter: brightness(1.12); transform: translateY(-1px); }
.nav-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav .nav-icon, .nav .nav-icon:hover, .nav .nav-icon:visited { color: #fff; }   /* ナビのリンク色より優先(中身は白) */
.nav-x { background: #000; }
.nav-rss { background: #f26522; }
@media (max-width: 480px) { .nav-icon { width: 34px; height: 34px; } }

/* 商品ページ: カードも表も同じ幅にそろえる(オーナー指摘 2026-09-16「バランス悪くない?」) */
/* 商品ページ: 本文 + 右カラム(広い画面だけ 2 段組)。本文は読みやすい幅で止める */
.product-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); }
.product-main { min-width: 0; }
.product-side { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.product-page .panel, .product-page .product-head { max-width: 100%; }
.product-page .note, .product-page .lead { text-wrap: pretty; }

/* サイドのパネル(入荷ウォッチ / Apple 在庫)の共通の間合い(オーナー指摘: 見た目が違って違和感) */
.ip-panel > .ip-link { padding: var(--sp-4); }
.tl-item:last-child, .ip-row:last-child { border-bottom: 0; }
.tl-panel .front-head, .ip-panel .front-head { margin-bottom: var(--sp-2); }
