:root {
  color-scheme: light dark;
  --bg: #ffffff; /* SellPilot AI: 撮影用デモと同じ白背景 */
  --surface: #ffffff;
  --fg: #1a2333;
  --muted: #5a6577;
  --axis-muted: #8a94a6;
  --border: #e3e8f1;
  --accent: #2563eb;
  --danger-bg: #fde2e2;
  --danger-fg: #991b1b;
  --warning: #fab219;
  --critical: #d03b3b;
  --series-mercari: #e34948;
  --series-yahoo: #2a78d6;
  --series-sales: #2a78d6;
  --series-profit: #8a63d2;
  --grid: #e9edf4;
  --baseline: #cdd4e0;
  --card-shadow: 0 4px 18px rgba(30, 50, 90, 0.06);
  --hero-blue: linear-gradient(135deg, #2f6bff 0%, #55a4ff 100%);
  --hero-purple: linear-gradient(135deg, #7c4dff 0%, #c86dd7 100%);
  --hero-orange: linear-gradient(135deg, #f6588a 0%, #ff9a3d 100%);
  --hero-green: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
  --hero-rainbow: linear-gradient(90deg, #2f6bff, #7c4dff, #c86dd7, #f6588a, #ff9a3d);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #1a2130;
    --fg: #f2f5fa;
    --muted: #b7c0cf;
    --axis-muted: #8a94a6;
    --border: #2a3346;
    --danger-bg: #4a1d1d;
    --danger-fg: #f3b4b4;
    --series-mercari: #e66767;
    --series-yahoo: #3987e5;
    --series-sales: #3987e5;
    --series-profit: #8f6ad4;
    --grid: #252d3f;
    --baseline: #38425a;
    --card-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--fg);
  padding: 1.5rem;
  max-width: 1240px;
  margin-inline: auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 { font-size: 1.3rem; margin: 0; }
h2 { font-size: 0.95rem; margin: 0; color: var(--fg); font-weight: 700; }
.head-sub { font-size: 0.78rem; color: var(--axis-muted); font-weight: 500; }
.subtitle { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--axis-muted); }

/* ── カード共通 ─────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 1rem 1.1rem 0.8rem;
  margin-bottom: 1rem;
  position: relative;
}

/* ── 売上の日付ページャ（＜ 今日 8/7 ＞） ───────── */
.day-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
/* ゴミの日バッジ（日・水=燃えるゴミ、火=資源、木=段ボール・燃えないゴミ）: ページャの下の行に中央表示 */
.day-trash {
  flex-basis: 100%;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--critical);
  margin-top: 0.25rem;
}
.day-nav {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}
.day-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.day-nav:disabled { opacity: 0.35; cursor: default; }
.day-label {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 1.35rem;
  font-weight: 800;
  padding: 0.4rem 1.4rem;
  min-width: 8.5em;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  font-variant-numeric: tabular-nums;
}
.day-label:hover { border-color: var(--accent); }

/* ── グラデーションのサマリーカード ───────────── */
.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.hero-card {
  border-radius: 16px;
  padding: 0.9rem 1.1rem 1rem;
  color: #fff;
  box-shadow: var(--card-shadow);
}
.hero-card.hero-blue { background: var(--hero-blue); }
.hero-card.hero-purple { background: var(--hero-purple); }
.hero-card.hero-orange { background: var(--hero-orange); }
.hero-card.hero-green { background: var(--hero-green); }
.hero-head { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.5rem; }
.hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.95rem;
}
.hero-label { font-size: 0.85rem; font-weight: 600; }
.hero-count {
  margin-left: auto;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
}
.hero-caption { font-size: 0.75rem; opacity: 0.9; }
/* 売上・利益・利益率を同じサイズで横並びに表示する(2026-09-05改定) */
.hero-metrics { display: flex; gap: 0.5rem 1.1rem; flex-wrap: wrap; }
.hero-metric { min-width: 0; }
.hero-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.hero-foot { display: flex; gap: 1rem; align-items: center; font-size: 0.8rem; margin-top: 0.35rem; flex-wrap: wrap; }
.hero-foot b { font-variant-numeric: tabular-nums; }
.hero-missing {
  font-size: 0.7rem;
  opacity: 0.85;
  border: 1px dashed rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  padding: 0 0.45em;
}

/* ── トレンドカード ─────────────────────────── */
.trend-controls { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ── マーケット別パフォーマンス ────────────────── */
.market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
  padding-bottom: 0.4rem;
}
.market-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem 0.5rem;
}
.market-head { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.35rem; }
.market-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.market-name { font-weight: 700; font-size: 0.9rem; }
.market-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.market-sales { font-size: 1.05rem; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.market-sales b { font-size: 1.2rem; }
.market-profit { font-size: 0.78rem; color: var(--muted); }
.market-share { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.spark { display: block; width: 100%; height: 40px; margin-top: 0.3rem; }

/* ── 下部の統計カード(控えめ) ─────────────────── */
.bottom-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 0.55rem 0.8rem;
}
.stat-label { font-size: 0.72rem; color: var(--axis-muted); }
.stat-value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.72rem; font-weight: 500; color: var(--muted); margin-left: 0.1rem; }
.stat-value .stat-warn { color: var(--critical); }
.stat-value .stat-time { font-size: 0.95rem; }
.stat-sub { font-size: 0.7rem; color: var(--axis-muted); margin-top: 0.1rem; }

/* ── 右上メニュー（トークン・ヤフオク設定） ────── */
.header-menu { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.header-updated { font-size: 0.75rem; color: var(--axis-muted); margin-right: 0.3rem; white-space: nowrap; }
.support-link {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.support-link:hover { border-color: var(--accent); color: var(--accent); }
.refresh-btn {
  cursor: pointer;
  padding: 0.35rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
}
.refresh-btn:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.refresh-btn:disabled { opacity: 0.6; cursor: default; }
.menu-item { position: relative; }
.menu-item summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.83rem;
  white-space: nowrap;
}
.menu-item summary::-webkit-details-marker { display: none; }
.menu-item[open] summary { background: var(--accent); color: #fff; border-color: var(--accent); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  width: min(92vw, 380px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.85rem;
}

.token-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.token-bar input { flex: 1; padding: 0.3rem; min-width: 0; }

/* ── 販売件数チャートの折りたたみ ─────────────── */
.count-details { margin-bottom: 1rem; }
.count-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.count-details .chart-section { margin-bottom: 0; }

/* ── チャート ─────────────────────────────── */
.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 0.8rem 1rem 0.5rem;
  margin-bottom: 1rem;
  position: relative;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.legend { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-wrap { width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  z-index: 10;
  white-space: nowrap;
}
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 0.35rem; }

/* ── 売上・純利益セクション ─────────────────── */
.period-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.3rem 1.9rem 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: var(--surface);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" fill="none" stroke="%238a94a6" stroke-width="1.6" stroke-linecap="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.period-select:hover { border-color: var(--accent); }

.trend-headline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 0.1rem 0 0.5rem;
}
.headline-main { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.headline-value { font-size: 1.65rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.headline-caption { font-size: 0.75rem; color: var(--muted); }
.headline-change { display: flex; align-items: center; }
.headline-diff {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.headline-diff.up { background: color-mix(in srgb, #0ca30c 14%, transparent); color: color-mix(in srgb, #0ca30c 75%, var(--fg)); }
.headline-diff.down { background: color-mix(in srgb, var(--critical) 14%, transparent); color: color-mix(in srgb, var(--critical) 85%, var(--fg)); }
.headline-diff-caption { font-size: 0.7rem; color: var(--axis-muted); margin-left: 0.35rem; }

.money-controls { display: flex; gap: 0.35rem; }
.money-controls button {
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}
.money-controls button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.money-note { font-size: 0.75rem; color: var(--axis-muted); margin: 0.3rem 0 0.4rem; }
.chart-tooltip .tt-sub { font-size: 0.72rem; color: var(--axis-muted); margin-left: 1rem; }
.chart-tooltip .tt-missing { font-size: 0.72rem; color: var(--axis-muted); }

/* ── フィルタ ─────────────────────────────── */
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.filters button {
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}
.filters button:hover { border-color: var(--accent); }
.filters button.active {
  background: var(--hero-blue);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(47, 107, 255, 0.35);
}
.filters.sub-row button.active {
  background: var(--hero-purple);
  box-shadow: 0 3px 10px rgba(124, 77, 255, 0.35);
}
.filters .sep { color: var(--border); margin: 0 0.3rem; }

.filters.platform-row { margin-bottom: 0.5rem; }
.filters.platform-row button[data-platform] { font-weight: 700; }
.filters.sub-row button { font-size: 0.83rem; padding: 0.3rem 0.7rem; }

/* ── テーブル（売上セクションと同じカード基調） ── */
.table-wrap {
  overflow-x: auto;
  /* 上端にヒーローカードと同系のグラデーションライン */
  background: var(--hero-rainbow) top / 100% 3px no-repeat, var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 0.55rem 0.9rem 0.6rem;
  margin-bottom: 0.6rem;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  font-size: 0.85rem;
  vertical-align: top;
  white-space: nowrap;
}
th {
  color: var(--axis-muted);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
td.num { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:not(.run-sep):hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }

tr.run-sep td {
  padding: 0.85rem 0.5rem 0.3rem;
  border-bottom: 2px solid transparent;
  border-image: var(--hero-rainbow) 1;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

tr.needs-action { background: color-mix(in srgb, var(--warning) 10%, transparent); }
tr.needs-action td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
tr.resolved { opacity: 0.55; }
tr.resolved .title-text,
tr.resolved a.title-link { text-decoration: line-through; }

.platform-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.platform-badge.mercari {
  background: color-mix(in srgb, var(--series-mercari) 14%, transparent);
  color: color-mix(in srgb, var(--series-mercari) 80%, var(--fg));
}
.platform-badge.yahoo {
  background: color-mix(in srgb, var(--series-yahoo) 14%, transparent);
  color: color-mix(in srgb, var(--series-yahoo) 80%, var(--fg));
}

.kind-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  white-space: nowrap;
}

.mail-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: color-mix(in srgb, var(--warning) 80%, var(--fg));
  white-space: nowrap;
}
.mail-badge a { color: inherit; text-decoration: none; }
.mail-badge a:hover { text-decoration: underline; }

/* 返信確認状態(顧客対応ページ。2026-10-15) */
.reply-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
}
.reply-badge.unreplied { background: var(--danger-bg); color: var(--danger-fg); }
.reply-badge.replied {
  background: color-mix(in srgb, #0ba360 14%, transparent);
  color: color-mix(in srgb, #0ba360 80%, var(--fg));
}
.reply-badge.unknown {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: color-mix(in srgb, var(--warning) 80%, var(--fg));
}

.action-badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--critical) 14%, transparent);
  color: color-mix(in srgb, var(--critical) 85%, var(--fg));
  white-space: nowrap;
}

.title-cell { white-space: normal; min-width: 220px; max-width: 420px; }
.title-text { overflow-wrap: anywhere; }
a.title-link { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a.title-link:hover { text-decoration: underline; }

.thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}
.img-cell { width: 56px; }

.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  font-size: 0.85rem;
}
.copy-btn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

.relist-badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
}
.relist-badge.ok { background: color-mix(in srgb, #0ca30c 14%, transparent); color: color-mix(in srgb, #0ca30c 75%, var(--fg)); }
.relist-badge.ng { background: color-mix(in srgb, var(--critical) 14%, transparent); color: color-mix(in srgb, var(--critical) 85%, var(--fg)); }

.sync-badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--series-yahoo) 14%, transparent);
  color: color-mix(in srgb, var(--series-yahoo) 80%, var(--fg));
}

.status-cell { white-space: normal; min-width: 180px; max-width: 320px; }

.detail-text {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.25rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
.detail-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

/* 値下げつき返信(お知らせ行): 価格を入れて送信すると価格変更→投稿の順で自動実行 */
.reply-price-row { font-size: 0.76rem; color: var(--muted); margin: 0.25rem 0; }
.reply-price-input { width: 6.5rem; padding: 0.2rem 0.4rem; font-size: 0.82rem; }
.reply-price-hint { font-size: 0.68rem; }
.reply-price-pending { font-size: 0.74rem; color: var(--accent); font-weight: 700; margin-right: 0.4rem; }

/* 返信せず既読化(ヤフオク質問行) */
.markread-btn {
  margin-top: 0.3rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.74rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.markread-btn:hover { color: var(--fg); }
.markread-badge { font-size: 0.74rem; color: var(--muted); margin-right: 0.3rem; }
.markread-cancel-btn {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

/* コメント履歴の吹き出し(お知らせ行。support.htmlと同じ見た目: 相手=左・自分=右) */
.thread-details { margin-top: 0.3rem; }
.thread-details > summary {
  cursor: pointer;
  font-size: 0.76rem;
  color: var(--muted);
  user-select: none;
}
.thread-details[open] > summary { margin-bottom: 0.3rem; }
.sc-thread { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.2rem 0 0.4rem; }
.bubble {
  max-width: 88%;
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  font-size: 0.83rem;
  line-height: 1.45;
}
.bubble.partner, .bubble.unknown {
  align-self: flex-start;
  background: color-mix(in srgb, var(--fg) 8%, var(--surface));
  border-bottom-left-radius: 4px;
}
.bubble.own {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-bottom-right-radius: 4px;
}
.bubble-meta { font-size: 0.68rem; color: var(--muted); margin-bottom: 0.15rem; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sc-thread-note { font-size: 0.68rem; color: var(--muted); margin-bottom: 0.3rem; }

.price-value { font-weight: 700; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.price-diff {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: 0.08em;
}
.price-diff.up { background: color-mix(in srgb, #0ca30c 14%, transparent); color: color-mix(in srgb, #0ca30c 75%, var(--fg)); }
.price-diff.down { background: color-mix(in srgb, var(--critical) 14%, transparent); color: color-mix(in srgb, var(--critical) 85%, var(--fg)); }

.stock-badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  color: var(--muted);
}
.stock-badge.out {
  background: color-mix(in srgb, var(--critical) 14%, transparent);
  color: color-mix(in srgb, var(--critical) 85%, var(--fg));
}

.sheet-chip {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: color-mix(in srgb, #7c4dff 12%, transparent);
  color: color-mix(in srgb, #a583ff 80%, var(--fg));
}

.resolve-toggle { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }

/* ── 対応履歴タブ ─────────────────────────────── */
.cat-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--series-profit) 14%, transparent);
  color: color-mix(in srgb, var(--series-profit) 80%, var(--fg));
}
.support-toggle { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }

.status-msg { font-size: 0.85rem; color: var(--muted); }

/* ── 取引メッセージ 返信文案 ─────────────────── */
.draft {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}
.draft .copy-btn { flex: 0 0 auto; }
.draft-label { flex: 0 0 auto; font-size: 0.75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.draft .detail-text { margin-top: 0.1rem; flex: 1 1 auto; }

/* ── 返信予約(お知らせ・質問) ─────────────────── */
.reply-box {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
}
.reply-box .reply-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  resize: vertical;
}
.reply-request-btn {
  margin-top: 0.3rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.reply-request-btn:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
/* 値下げ依頼行の ✅承認 / ❌拒否(2026-09-27) */
.price-req-actions {
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
  margin-bottom: 0.35rem; font-size: 0.78rem;
}
.price-req-info { color: var(--muted); font-weight: 600; }
.price-accept-btn, .price-reject-btn {
  border-radius: 8px; cursor: pointer; padding: 0.25rem 0.7rem;
  font-size: 0.78rem; font-weight: 600; background: var(--surface);
}
.price-accept-btn {
  border: 1px solid color-mix(in srgb, #0ca30c 45%, var(--border));
  color: color-mix(in srgb, #0ca30c 80%, var(--fg));
}
.price-accept-btn:hover { background: color-mix(in srgb, #0ca30c 14%, var(--surface)); }
.price-reject-btn {
  border: 1px solid color-mix(in srgb, var(--critical) 45%, var(--border));
  color: color-mix(in srgb, var(--critical) 85%, var(--fg));
}
.price-reject-btn:hover { background: color-mix(in srgb, var(--critical) 12%, var(--surface)); }
.price-accept-btn:disabled, .price-reject-btn:disabled { opacity: 0.5; cursor: default; }
.price-req-link { font-size: 0.74rem; color: var(--muted); text-decoration: underline; }
.reply-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.reply-pending { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.reply-cancel-btn {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
}
.reply-box.done { font-size: 0.8rem; color: color-mix(in srgb, #0ca30c 75%, var(--fg)); font-weight: 600; }
.reply-error {
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--critical) 85%, var(--fg));
  margin-bottom: 0.3rem;
}

/* ── メッセージチェック設定パネル（右上メニュー内） ── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 1rem;
  margin: 0.7rem 0;
}
.settings-grid label { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); font-size: 0.78rem; }
.settings-grid input { padding: 0.35rem; font-size: 0.85rem; }
.settings-grid .settings-wide { grid-column: 1 / -1; }
.settings-grid textarea {
  padding: 0.35rem;
  font-size: 0.82rem;
  font-family: inherit;
  resize: vertical;
}
.settings-actions { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.settings-actions button {
  padding: 0.35rem 1rem;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

/* 狭い画面ではテーブルをカード型に切り替え、横スクロールをなくす */
@media (max-width: 700px) {
  body { padding: 1rem; }
  .table-wrap {
    overflow-x: visible;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }

  table, thead, tbody { display: block; width: 100%; }
  thead { display: none; }

  tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--hero-rainbow) top / 100% 3px no-repeat, var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 0.7rem 0.8rem 0.6rem;
    margin-bottom: 0.75rem;
  }
  tbody tr.needs-action td:first-child { box-shadow: none; }
  tbody tr:not(.run-sep):hover td { background: transparent; }
  tbody tr.run-sep {
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.3rem 0;
    margin-bottom: 0.4rem;
  }
  tbody tr.run-sep td { display: block; border-bottom: 2px solid var(--accent); padding: 0.2rem 0.2rem 0.3rem; }
  tbody tr.needs-action { border-color: var(--warning); }

  tbody tr td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.3rem 0;
    border-bottom: 1px dashed var(--border);
    white-space: normal;
    min-width: 0;
    max-width: none;
  }
  tbody tr:last-child td { border-bottom: 1px dashed var(--border); }
  tbody tr td:last-child { border-bottom: none; }
  tbody tr td:empty { display: none; }

  tbody tr td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 0.78rem;
    flex: 0 0 auto;
  }

  tbody tr td.title-cell { order: -1; display: block; font-weight: 700; font-size: 0.95rem; padding-bottom: 0.5rem; }
  tbody tr td.img-cell { order: -2; display: block; width: auto; padding: 0.2rem 0; }
  tbody tr td.img-cell:empty { display: none; }
  .thumb { width: 84px; height: 84px; }
  tbody tr td.copy-cell { justify-content: flex-end; }
  .copy-btn { padding: 0.35rem 1.2rem; }
  .resolve-toggle, .support-toggle { width: 1.5rem; height: 1.5rem; }
}

/* ════ SellPilot AI ブランド（撮影用デモと共通） ════ */

/* ヘッダーのブランドロゴ */
.brand { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.brand-icon { font-size: 1.3rem; }
.brand-name {
  background: linear-gradient(90deg, #2f6bff, #7c4dff, #c86dd7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.brand-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--axis-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* AI稼働中インジケータ */
.ai-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #22c55e;
  border: 1px solid color-mix(in srgb, #22c55e 40%, var(--border));
  background: color-mix(in srgb, #22c55e 10%, var(--surface));
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
}
.ai-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  animation: ai-pulse 1.6s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* お知らせタブ: 選択した行をリストから消す(2026-09-17) */
.notice-tools {
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
  margin: 0.2rem 0 0.5rem; font-size: 0.8rem; color: var(--fg);
}
.notice-tools[hidden] { display: none; }
.notice-tool { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.notice-tool.muted { color: var(--muted); margin-left: auto; }
.hide-selected-btn {
  padding: 0.3rem 0.75rem; font-size: 0.78rem; font-weight: 600;
  border: 1px solid color-mix(in srgb, #d64545 40%, var(--border));
  background: color-mix(in srgb, #d64545 8%, var(--surface));
  color: #d64545; border-radius: 8px; cursor: pointer;
}
.hide-selected-btn:disabled { opacity: 0.45; cursor: default; }
.select-toggle { margin: 0 0.4rem 0 0; vertical-align: middle; transform: scale(1.15); }
tr.hidden-row { opacity: 0.4; }
tr.hidden-row td { background: color-mix(in srgb, var(--muted) 8%, transparent); }
.hidden-badge { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }
.unhide-btn {
  margin-top: 0.2rem; padding: 0.15rem 0.45rem; font-size: 0.72rem;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--fg); cursor: pointer;
}
.qanda-link { display: inline-block; font-size: 0.74rem; margin: 0 0.3rem; color: var(--accent); text-decoration: none; }
.qanda-link:hover { text-decoration: underline; }

/* ════ 行頭の状態チップと対応ボタン(2026-09-27) ════ */
.state-cell { white-space: nowrap; min-width: 9.5rem; vertical-align: top; }
.state-chip {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; white-space: nowrap; line-height: 1.5;
}
.state-chip.pending { background: color-mix(in srgb, var(--critical) 16%, transparent); color: color-mix(in srgb, var(--critical) 85%, var(--fg)); }
.state-chip.retry   { background: color-mix(in srgb, var(--accent) 16%, transparent);   color: color-mix(in srgb, var(--accent) 80%, var(--fg)); }
.state-chip.manual  { background: color-mix(in srgb, #0ca30c 16%, transparent);         color: color-mix(in srgb, #0ca30c 70%, var(--fg)); }
.state-chip.ok      { background: color-mix(in srgb, var(--muted) 14%, transparent);    color: var(--muted); font-weight: 600; }
.state-chip.muted   { background: color-mix(in srgb, var(--muted) 14%, transparent);    color: var(--muted); }
tr.resolved .state-chip { opacity: 1; }
.resolve-btn, .unresolve-btn {
  display: block; margin-top: 0.3rem; padding: 0.3rem 0.7rem; font-size: 0.78rem; font-weight: 700;
  border-radius: 8px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--fg);
}
.resolve-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.resolve-btn:hover { filter: brightness(1.08); }
.resolve-btn:disabled, .unresolve-btn:disabled { opacity: 0.5; cursor: default; }
.unresolve-btn { color: var(--muted); font-weight: 600; }
.retry-history { margin-top: 0.3rem; font-size: 0.76rem; }
.retry-history summary { cursor: pointer; color: color-mix(in srgb, var(--accent) 80%, var(--fg)); font-weight: 600; list-style: none; }
.retry-history summary::before { content: "▸ "; }
.retry-history[open] summary::before { content: "▾ "; }
.retry-detail { margin: 0.2rem 0 0 1rem; color: var(--muted); white-space: normal; }
.retry-detail.muted { font-style: italic; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0.2rem 0 0.6rem; font-size: 0.85rem; }
.list-legend { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; opacity: 0.85; }
.stat-alert { color: var(--critical); }
@media (max-width: 700px) {
  tbody tr td.state-cell { order: -3; display: flex; justify-content: space-between; align-items: center; min-width: 0; padding-bottom: 0.4rem; }
  tbody tr td.state-cell::before { display: none; }
  .resolve-btn, .unresolve-btn { margin-top: 0; padding: 0.4rem 0.9rem; }
  .list-legend { display: none; }
}

/* Chrome 拡張との接続(アカウントメニュー内) */
.acc-ext { margin: 10px 0; padding-top: 10px; border-top: 1px solid var(--line, #e5e5e5); display: grid; gap: 6px; }
.acc-ext-state { font-size: 12px; line-height: 1.5; }
