/* ============================================================
   楽天市場 運営AI秘書ダッシュボード - スタイルシート
   ------------------------------------------------------------
   このファイルはFable5で作成した初期土台です。
   後日Sonnet5でUI改善予定。セクションコメントを目印に編集してください。
   色の意味: 赤=緊急 / 黄=注意 / 緑=良好 / 青=情報
   ============================================================ */

/* ---------- 変数・リセット ---------- */
:root {
  /* ブランド色（楽天レッド系） */
  --red: #BF1F2E;
  --red-soft: #F5E6E8;
  --red-mid: #E8929A;
  /* テキスト */
  --ink: #141414;
  --ink-2: #3A3A3A;
  --ink-3: #6B6B6B;
  --ink-4: #A0A0A0;
  /* 面 */
  --rule: #E5E5E5;
  --bg: #F4F3F1;
  --surface: #FFFFFF;
  /* ステータス色（赤=緊急 黄=注意 緑=良好 青=情報） */
  --gold: #C08A20;
  --gold-soft: #FEF6E4;
  --green: #1A7A45;
  --green-soft: #E6F4ED;
  --blue: #1A5CB5;
  --blue-soft: #E6EEF9;
  --purple: #6B3FA0;
  --purple-soft: #F0EAF9;
  /* 在庫優先度色（在庫補充ダッシュボード由来） */
  --c-urgent: #e53e3e;  --bg-urgent: #fff5f5;  --bd-urgent: #feb2b2;
  --c-soon:   #dd6b20;  --bg-soon:   #fffaf0;  --bd-soon:   #fbd38d;
  --c-caution:#b7791f;  --bg-caution:#fffff0;  --bd-caution:#f6e05e;
  --c-safe:   #276749;  --bg-safe:   #f0fff4;  --bd-safe:   #9ae6b4;
  --c-excess: #2b6cb0;  --bg-excess: #ebf8ff;  --bd-excess: #90cdf4;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6; min-height: 100vh;
}

/* ---------- エラーバナー ---------- */
#error-banner {
  display: none; position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  z-index: 999; max-width: 640px; width: 90%;
  background: var(--bg-urgent); border: 2px solid var(--c-urgent); color: var(--c-urgent);
  padding: 12px 40px 12px 16px; border-radius: 8px; font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
#error-banner .eb-close {
  position: absolute; right: 10px; top: 8px; cursor: pointer; font-size: 16px;
  background: none; border: none; color: var(--c-urgent); font-weight: 900;
}

/* ---------- スマホ専用簡易ヘッダー（rakuten-master-027） ----------
   PC（>640px）では表示しない。アカウント表示をナビの横スクロール領域から分離し、
   ナビタブの操作を妨げないようにするための別行。ロゴ＋アカウントメニュー開閉ボタンのみ */
.mobile-topbar { display: none; }

/* ---------- ナビゲーション ---------- */
.nav {
  background: var(--ink); padding: 0 16px; display: flex; align-items: center;
  position: sticky; top: 0; z-index: 100; height: 52px; overflow-x: auto;
}
.nav-logo {
  font-size: 12px; font-weight: 700; color: var(--red-mid);
  letter-spacing: 0.08em; margin-right: 20px; white-space: nowrap;
}
.nav-tab {
  height: 52px; display: flex; align-items: center; padding: 0 13px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-4); cursor: pointer;
  border-bottom: 3px solid transparent; transition: color .15s, border-color .15s;
  white-space: nowrap; user-select: none;
}
.nav-tab:hover { color: #fff; }
.nav-tab.active { color: #fff; border-bottom-color: var(--red); }

/* ---------- レイアウト ---------- */
.page { display: none; }
.page.active { display: block; }
.container { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }
.container.wide { max-width: 1680px; }
.page-header { margin-bottom: 22px; }
.page-header h2 { font-size: 21px; font-weight: 900; }
.page-header p { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.sec {
  font-size: 11.5px; font-weight: 800; color: #4a5568; text-transform: uppercase;
  letter-spacing: .8px; margin: 20px 0 9px; display: flex; align-items: center; gap: 6px;
}
.sec::before { content: ''; width: 3px; height: 13px; background: var(--red); border-radius: 2px; display: inline-block; }

/* ---------- KPIカード ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi-card { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--rule); box-shadow: var(--shadow); position: relative; }
.kpi-label { font-size: 10px; color: var(--ink-4); letter-spacing: .06em; margin-bottom: 6px; font-weight: 700; text-transform: uppercase; }
.kpi-value { font-size: 23px; font-weight: 900; line-height: 1; margin-bottom: 4px; }
.kpi-value.red { color: var(--red); }
.kpi-value.green { color: var(--green); }
.kpi-value.gold { color: var(--gold); }
.kpi-value.blue { color: var(--blue); }
.kpi-sub { font-size: 11px; color: var(--ink-4); }
.kpi-delta { font-size: 11px; font-weight: 700; margin-top: 4px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.warn { color: var(--gold); }
/* 在庫KPIバリエーション */
.kpi-card.ku { background: var(--bg-urgent); border-color: var(--bd-urgent); }
.kpi-card.ku .kpi-value { color: var(--c-urgent); }
.kpi-card.ks { background: var(--bg-soon); border-color: var(--bd-soon); }
.kpi-card.ks .kpi-value { color: var(--c-soon); }
.kpi-card.kc { background: var(--bg-caution); border-color: var(--bd-caution); }
.kpi-card.kc .kpi-value { color: var(--c-caution); }
.kpi-card.ke { background: var(--bg-excess); border-color: var(--bd-excess); }
.kpi-card.ke .kpi-value { color: var(--c-excess); }

/* ---------- カード・チャート ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--rule); box-shadow: var(--shadow); margin-bottom: 14px; }
.card-title { font-size: 13px; font-weight: 900; margin-bottom: 3px; }
.card-sub { font-size: 11px; color: var(--ink-4); margin-bottom: 12px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.chart-grid .card { margin-bottom: 0; }
.chart-grid .full { grid-column: 1 / -1; }
.chart-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.chart-grid-3 .card { margin-bottom: 0; }
@media (max-width: 1300px) and (min-width: 901px) { .chart-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .chart-grid, .chart-grid-3 { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; height: 220px; }
.chart-wrap.tall { height: 300px; }
.chart-wrap.xtall { height: 340px; }

/* ---------- テーブル ---------- */
.tbl-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  font-size: 10px; letter-spacing: .06em; color: var(--ink-4); padding: 8px 10px;
  text-align: left; border-bottom: 2px solid var(--rule); white-space: nowrap;
  background: #f7f7f5; position: sticky; top: 0;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { background: #ececea; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.data-table tr:hover td { background: var(--bg); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
/*
 * rakuten156: セールテンプレート一覧の操作列（編集/素材/無効化）。
 * 操作列が最終列だと、狭い画面で .tbl-scroll の横スクロール外に出て到達できなくなる
 * （rakuten155実測: 375pxで805px右に隠れ、編集ボタンが完全に画面外）。
 * 先頭列へ移したうえで、横スクロールしても常に見えるよう左sticky にする。
 * ヘッダ側は既存の `th { position:sticky; top:0 }` と併用するため left も指定する。
 */
.data-table td.tpl-actions-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.data-table tr:hover td.tpl-actions-col { background: var(--bg); }
.data-table th.tpl-actions-col { left: 0; z-index: 3; }
.data-table .tn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.neg { color: var(--c-urgent); font-weight: 700; }
.pos { color: var(--c-safe); }

/* ---------- バッジ・タグ ---------- */
.tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.gold { background: var(--gold-soft); color: var(--gold); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.gray { background: #F0F0F0; color: var(--ink-4); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge-urgent  { background: var(--bg-urgent);  color: var(--c-urgent);  border: 1px solid var(--bd-urgent); }
.badge-soon    { background: var(--bg-soon);    color: var(--c-soon);    border: 1px solid var(--bd-soon); }
.badge-caution { background: var(--bg-caution); color: var(--c-caution); border: 1px solid var(--bd-caution); }
.badge-safe    { background: var(--bg-safe);    color: var(--c-safe);    border: 1px solid var(--bd-safe); }
.badge-excess  { background: var(--bg-excess);  color: var(--c-excess);  border: 1px solid var(--bd-excess); }

/* ---------- データ入力（アップロード） ---------- */
.upload-hero { text-align: center; padding: 24px 0 20px; }
.upload-hero h1 { font-size: clamp(22px, 3.5vw, 32px); font-weight: 900; line-height: 1.25; margin-bottom: 10px; }
.upload-hero h1 em { color: var(--red); font-style: normal; }
.upload-hero p { font-size: 13px; color: var(--ink-3); max-width: 560px; margin: 0 auto; }
.upload-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; margin-top: 28px; }
.upload-card { background: var(--surface); border: 2px dashed var(--rule); border-radius: 12px; padding: 20px; transition: border-color .15s; }
.upload-card:hover { border-color: var(--red); }
.upload-card.done { border-style: solid; border-color: var(--green); background: var(--green-soft); }
.uc-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.uc-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0; }
.uc-icon.red { background: var(--red-soft); }
.uc-icon.gold { background: var(--gold-soft); }
.uc-icon.blue { background: var(--blue-soft); }
.uc-icon.purple { background: var(--purple-soft); }
.uc-title { font-size: 14px; font-weight: 900; line-height: 1.3; }
.uc-where { font-size: 10px; color: var(--ink-4); margin-top: 3px; line-height: 1.5; }
.uc-desc { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; line-height: 1.5; }
.uc-btn {
  width: 100%; padding: 9px; border-radius: 7px; border: 1.5px solid var(--rule);
  background: var(--bg); font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.uc-btn:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.upload-card.done .uc-btn { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.uc-filename { margin-top: 8px; font-size: 11px; color: var(--green); text-align: center; word-break: break-all; display: none; }
.upload-card.done .uc-filename { display: block; }
.upload-hint { margin-top: 20px; text-align: center; font-size: 12px; color: var(--ink-4); }

/* ---------- 空状態 ---------- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--ink-4); }
.empty-state .es-icon { font-size: 38px; margin-bottom: 14px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--ink-3); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }
.es-link {
  display: inline-block; margin-top: 14px; padding: 9px 22px; background: var(--red);
  color: #fff; border-radius: 7px; font-weight: 700; font-size: 13px; cursor: pointer;
  border: none; font-family: inherit;
}

/* ---------- 今日やること ---------- */
.task-item {
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: 9px; padding: 13px 16px; margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.task-item.p-urgent  { border-left: 4px solid var(--c-urgent); }
.task-item.p-high    { border-left: 4px solid var(--gold); }
.task-item.p-normal  { border-left: 4px solid var(--green); }
.task-item.p-info    { border-left: 4px solid var(--blue); }
.task-pri { flex-shrink: 0; margin-top: 2px; }
.task-body { flex: 1; }
.task-text { font-size: 13.5px; font-weight: 700; line-height: 1.5; }
.task-note { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.task-src { font-size: 10px; color: var(--ink-4); margin-top: 3px; }

/* ---------- フィルタ・コントロール ---------- */
.ctrl {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 9px 13px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.pill {
  padding: 5px 12px; border-radius: 20px; border: 1.5px solid var(--rule);
  background: #fff; font-size: 11.5px; font-weight: 700; cursor: pointer; color: var(--ink-3);
  transition: all .15s; white-space: nowrap; font-family: inherit;
}
.pill:hover { background: #f0f4f8; color: var(--ink); }
.pill.on-all    { background: #2a4a7f; border-color: #2a4a7f; color: #fff; }
.pill.on-need   { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.pill.on-urgent { background: var(--bg-urgent); border-color: var(--c-urgent); color: var(--c-urgent); }
.pill.on-excess { background: var(--bg-excess); border-color: var(--c-excess); color: var(--c-excess); }
.srch { padding: 5px 11px; border: 1px solid var(--rule); border-radius: 7px; font-size: 12px; width: 200px; outline: none; margin-left: auto; font-family: inherit; }
.srch:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,92,181,.12); }
.clbl { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.twrap { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: auto; max-height: 520px; box-shadow: var(--shadow); }
.twrap table { min-width: 1400px; }

/* ---------- フォーム（AI販促・イベント追加） ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.form-field label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 7px;
  font-size: 13px; font-family: inherit; outline: none; background: #fff;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--red); }
.form-field textarea { resize: vertical; min-height: 60px; }
/* RPP手入力テーブル内の小型入力欄 */
.mini-input {
  padding: 4px 8px; border: 1px solid var(--rule); border-radius: 6px;
  font-size: 12px; font-family: inherit; outline: none; background: #fff;
}
.mini-input:focus { border-color: var(--red); box-shadow: 0 0 0 2px rgba(191,31,46,.1); }
.mini-input.num { text-align: right; }
.btn-primary {
  padding: 11px 32px; background: var(--red); color: #fff; border: none; border-radius: 8px;
  font-family: inherit; font-size: 14px; font-weight: 900; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: #9e1824; }
.btn-secondary {
  padding: 7px 16px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--rule);
  border-radius: 7px; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--red); color: var(--red); }
/* rakuten149: disabledなボタンが見た目上も押せない状態だと分かるように（既存の
   ${deleting?'disabled':''}パターンにも同時に効く。個別クラスは増やさない）。 */
.btn-primary:disabled, .btn-secondary:disabled {
  cursor: not-allowed; opacity: .5;
}
.btn-primary:disabled:hover { background: var(--red); }
.btn-secondary:disabled:hover { border-color: var(--rule); color: var(--ink-2); }
.btn-small { padding: 4px 10px; font-size: 11px; }

/* ---------- 月商目標・達成率パネル（売上タブ） ---------- */
.goal-setting {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 9px;
  padding: 10px 14px; box-shadow: var(--shadow);
}
.goal-setting label { font-size: 11px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.goal-setting input {
  width: 130px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 7px;
  font-size: 14px; font-weight: 700; text-align: right; font-family: inherit; outline: none;
}
.goal-setting input:focus { border-color: var(--red); }
.goal-unit { font-size: 12px; color: var(--ink-3); }
/* 達成率パネル（KPIの上に最優先で表示） */
.goal-panel { border-left: 4px solid var(--red); margin-bottom: 20px; }
.goal-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.goal-rate { font-size: 54px; font-weight: 900; line-height: 1; letter-spacing: -0.02em; }
.goal-rate.green { color: var(--green); }
.goal-rate.blue { color: var(--blue); }
.goal-rate.gold { color: var(--gold); }
.goal-rate.red { color: var(--red); }
.goal-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; font-weight: 700; }
.goal-forecast { text-align: right; }
.goal-forecast-val { font-size: 17px; font-weight: 900; margin-top: 6px; }
/* 達成率ゲージ */
.goal-gauge-track { height: 18px; background: #E9E7E4; border-radius: 99px; overflow: hidden; margin-top: 16px; }
.goal-gauge-fill { height: 100%; border-radius: 99px; transition: width .5s ease; min-width: 4px; }
.goal-gauge-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4); margin-top: 4px; font-weight: 700; }
.goal-gauge-meta .cur { color: var(--ink); font-size: 13px; }
/* 6項目のステータス */
.goal-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.goal-stat-label { font-size: 10px; color: var(--ink-4); font-weight: 700; letter-spacing: .05em; }
.goal-stat-value { font-size: 16px; font-weight: 900; margin-top: 2px; }
.goal-stat-sub { font-size: 10px; color: var(--ink-4); margin-top: 1px; }
.goal-note { margin-top: 12px; font-size: 11px; color: var(--gold); background: var(--gold-soft); padding: 8px 12px; border-radius: 6px; }

/* ---------- 売上（日別）ダッシュボード（すべて daily-sales- プレフィックス） ----------
   色の意味: blue=現在値/通常  green=良好/達成ペース以上  orange=注意/必要日商  red=不足/異常  gray=補助
   ------------------------------------------------------------------------------------ */
.daily-sales-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
/* rakuten013: 年月選択（同期状態ピルと縦に並べる。狭幅では見出し下へ自然に折り返す） */
.daily-sales-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.daily-sales-month-select {
  font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink-1); max-width: 100%; cursor: pointer;
}
/* 過去月（確定月）の注意書き・カバレッジ不完全の注意書き */
.daily-sales-past-note, .daily-sales-coverage-note {
  font-size: 11.5px; font-weight: 700; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px;
}
.daily-sales-past-note { color: var(--ink-3); background: #F6F5F3; border: 1px solid var(--rule); }
.daily-sales-coverage-note { color: var(--c-soon); background: var(--bg-soon); border: 1px solid var(--bd-soon); }
@media (max-width: 480px) {
  .daily-sales-header-right { align-items: flex-start; width: 100%; }
  .daily-sales-month-select { width: 100%; }
}
/* rakuten014: 月間目標編集ボックス */
.daily-sales-target-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; }
/* rakuten-master-129: hidden 属性を実際に効かせる（128 の CSV 帯と同じ原因。上の display:flex が UA の [hidden] に勝つ）。
   出し入れの判定は app.js salesApplyProviderChrome() の 1 か所のまま */
.daily-sales-target-box[hidden] { display: none; }
/* EC-DAILY-TARGET-20261007-091407: 日別目標の算出方式（選択・説明・算出不可の理由） */
.daily-sales-method-label { font-size: 12px; font-weight: 700; margin-left: 4px; }
.daily-sales-method-select { font-size: 12.5px; min-height: 32px; max-width: 100%; }
.daily-sales-method-note { flex: 1 1 100%; font-size: 12px; font-weight: 600; color: #475569; line-height: 1.5; }
.daily-sales-method-note.err { color: #b91c1c; }
.daily-alloc-method-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: 12.5px; line-height: 1.5; }
#daily-sales-target-current { color: var(--ink-2); white-space: nowrap; }
.daily-sales-target-input {
  width: 130px; font-size: 13px; font-weight: 700; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-1);
}
.daily-sales-target-msg { font-size: 11px; font-weight: 800; }
.daily-sales-target-msg.ok { color: var(--green); }
.daily-sales-target-msg.err { color: var(--red); }
@media (max-width: 480px) {
  .daily-sales-target-box { width: 100%; }
  .daily-sales-target-input { flex: 1 1 auto; width: auto; min-width: 0; }
}
/*
 * rakuten018: `.data-table td { color: var(--ink-2); ... }`（style.css内、要素+クラスでspecificity 0,1,1）が
 * 以下の単一クラス指定（specificity 0,1,0）より優先度が高く、color宣言だけが無効化されていた
 * （font-weightは`.data-table td`側で指定していないため正常に見えていた＝バグに気づきにくい形）。
 * 対策として、実際に付与される`.num`との複合セレクタ（0,2,0）にして確実に上書きする。
 * 影響: 差異（rakuten014）・進捗%/日別目標等（rakuten016追加3）が本番DOMで色付いていなかった。
 */
/* 累計差異の色分け（0以上=緑、負=赤） */
.num.daily-sales-variance-pos { color: var(--green); font-weight: 800; }
.num.daily-sales-variance-neg { color: var(--red); font-weight: 800; }
/* 差異ゼロ＝中立（色を装飾目的で使わない） */
.num.daily-sales-variance-zero { color: var(--ink-2); font-weight: 400; }
/* 進捗%の状態別色分け（100%以上=緑／90〜100%=標準／80〜90%=オレンジ／80%未満=赤） */
.num.daily-sales-progress-good { color: var(--green); font-weight: 800; }
.num.daily-sales-progress-warn { color: var(--c-soon); font-weight: 800; }
.num.daily-sales-progress-bad { color: var(--red); font-weight: 800; }
.num.daily-sales-progress-neutral { color: var(--ink-1); font-weight: 400; }
/* 日別目標・目標累計は基準値のため実績より弱い文字色にする */
.num.daily-sales-baseline-cell { color: var(--ink-3); font-weight: 400; }
/* 実績累計は差異ほど強調しないが、やや太字にして視認性を上げる（font-weightのみのため元々影響なし） */
.daily-sales-actual-cumulative { font-weight: 600; }

/* rakuten016追加: 楽天 日次店舗データCSV アップロード（未連携月のみ大きなドラッグ＆ドロップ） */
.daily-sales-csv-upload {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  border: 2px dashed var(--rule); border-radius: var(--radius); background: var(--surface);
  padding: 14px 16px; margin: 12px 0; cursor: pointer; transition: border-color .15s, background-color .15s, padding .15s;
}
/* rakuten-master-128: hidden 属性を実際に効かせる。上の display:flex（author rule）は UA stylesheet の
   [hidden]{display:none} に勝つため、app.js salesApplyProviderChrome() が Yahoo 選択時に hidden を立てても
   帯が見えたままだった。表示判定は salesApplyProviderChrome の 1 か所のまま（ここは hidden を尊重するだけ） */
.daily-sales-csv-upload[hidden] { display: none; }
.daily-sales-csv-upload:hover { border-color: var(--blue); }
.daily-sales-csv-upload.is-dragover { border-color: var(--blue); background: var(--blue-soft); }
.daily-sales-csv-upload-main { display: flex; align-items: center; gap: 12px; flex: 1 1 320px; min-width: 0; }
.daily-sales-csv-upload-icon { font-size: 28px; line-height: 1; flex: 0 0 auto; }
.daily-sales-csv-upload-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.daily-sales-csv-upload-text strong { font-size: 13.5px; color: var(--ink-1); }
.daily-sales-csv-upload-text span { font-size: 12px; color: var(--ink-3); }
.daily-sales-csv-upload-hint { font-size: 11px !important; color: var(--ink-4) !important; }
.daily-sales-csv-upload-msg { flex: 1 1 100%; font-size: 12px; font-weight: 700; }
.daily-sales-csv-upload-msg.ok { color: var(--green); }
.daily-sales-csv-upload-msg.err { color: var(--red); }
/* rakuten016追加2: 連携済み/一部連携はコンパクトな1行表示（CSV取込は月1回程度のため常時大きく出さない） */
.daily-sales-csv-upload.is-compact { padding: 8px 14px; border-style: solid; cursor: default; }
.daily-sales-csv-upload.is-compact:hover { border-color: var(--rule); }
.daily-sales-csv-compact { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; font-size: 12.5px; }
.daily-sales-csv-compact-icon { font-size: 15px; line-height: 1; flex: 0 0 auto; }
.daily-sales-csv-compact-text { color: var(--ink-2); font-weight: 700; flex: 1 1 auto; min-width: 0; }
.daily-sales-csv-compact .btn-small { flex: 0 0 auto; }
@media (max-width: 480px) {
  .daily-sales-csv-upload { flex-direction: column; align-items: stretch; }
  .daily-sales-csv-compact { flex-direction: column; align-items: flex-start; gap: 4px; }
  .daily-sales-csv-compact .btn-small { align-self: flex-start; }
}
/* rakuten018 STEP3: コンパクト表示時、ボタン操作で直下に展開する小さなドラッグ＆ドロップ領域 */
.daily-sales-csv-expand {
  width: 100%; margin-top: 10px; padding: 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--rule); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, background-color .15s;
}
.daily-sales-csv-expand:hover { border-color: var(--blue); }
.daily-sales-csv-expand.is-dragover { border-color: var(--blue); background: var(--blue-soft); }
.daily-sales-csv-expand-title { font-size: 13px; font-weight: 700; color: var(--ink-1); margin-bottom: 6px; }
.daily-sales-csv-expand-hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-bottom: 10px; }
.daily-sales-csv-expand-close {
  display: block; margin: 10px auto 0; padding: 4px; background: none; border: none;
  color: var(--ink-4); font-size: 11px; font-weight: 700; text-decoration: underline; cursor: pointer;
}

/* 共通トークン（既存 :root 変数を意味付きに割り当て） */
.daily-sales-hero, .daily-sales-action, .daily-sales-table-card { --ds-blue: var(--blue); --ds-blue-bg: var(--blue-soft); --ds-green: var(--green); --ds-green-bg: var(--green-soft); --ds-orange: var(--c-soon); --ds-orange-bg: var(--bg-soon); --ds-red: var(--red); --ds-red-bg: var(--red-soft); --ds-gray: var(--ink-3); --ds-gray-bg: #F6F5F3; }

.daily-sales-live-chip {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--green);
  background: var(--green-soft); border: 1px solid #BFE0CC; padding: 1px 7px; border-radius: 4px; vertical-align: middle;
}
.daily-sales-source { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--ink-4); align-items: center; }
.daily-sales-source span::before { content: '・'; }
.num.daily-sales-na { color: var(--ink-4); font-weight: 600; }

/* 取得中 / 取得失敗（DEMO値へは戻さない） */
.daily-sales-loading {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 28px 20px;
  text-align: center; color: var(--ink-3); font-size: 13px; font-weight: 700;
}
.daily-sales-error {
  background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--red); border-radius: 14px;
  padding: 22px 24px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.daily-sales-error-title { font-size: 15px; font-weight: 900; color: var(--red); }
.daily-sales-error-sub { font-size: 12px; color: var(--ink-3); }
.daily-sales-error .btn-secondary { margin-top: 8px; }

/* API同期状態（ヘッダー右） */
.daily-sales-sync {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; font-weight: 700;
  padding: 7px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow);
  max-width: 100%;
}
.daily-sales-sync-label, .daily-sales-sync-time, .daily-sales-sync-note { white-space: nowrap; }
.daily-sales-sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-4); }
.daily-sales-sync.green .daily-sales-sync-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.daily-sales-sync.orange .daily-sales-sync-dot { background: var(--c-soon); box-shadow: 0 0 0 3px var(--bg-soon); }
.daily-sales-sync.red .daily-sales-sync-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.daily-sales-sync.green .daily-sales-sync-label { color: var(--green); }
.daily-sales-sync.orange .daily-sales-sync-label { color: var(--c-soon); }
.daily-sales-sync.red .daily-sales-sync-label { color: var(--red); }
.daily-sales-sync-time { color: var(--ink-4); font-weight: 600; }
.daily-sales-sync-note { color: var(--ink-3); font-weight: 600; font-size: 11px; }
.daily-sales-sync.gray .daily-sales-sync-label { color: var(--ink-3); }

/* 1. 売上進捗サマリー */
.daily-sales-hero {
  background: var(--surface); border-radius: 14px; padding: 22px 26px 20px; margin-bottom: 18px;
  border: 1px solid var(--rule); box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.daily-sales-hero-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 18px; }
.daily-sales-hero-title { font-size: 17px; font-weight: 900; letter-spacing: .01em; }
.daily-sales-hero-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.daily-sales-hero-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 14px; align-items: stretch; }
.daily-sales-metric { border-radius: 12px; padding: 14px 16px; background: var(--ds-gray-bg); }
.daily-sales-metric-label { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: .04em; }
.daily-sales-metric-value { font-weight: 900; line-height: 1.1; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.daily-sales-metric-value small { font-size: .55em; font-weight: 800; margin-left: 2px; }
.daily-sales-metric-sub { font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.daily-sales-metric.primary   .daily-sales-metric-value { font-size: clamp(30px, 3.4vw, 44px); }
.daily-sales-metric.secondary .daily-sales-metric-value { font-size: clamp(26px, 2.8vw, 36px); }
.daily-sales-metric.tertiary  .daily-sales-metric-value { font-size: clamp(18px, 1.8vw, 24px); color: var(--ink-2); }
.daily-sales-metric.blue  { background: var(--ds-blue-bg);  } .daily-sales-metric.blue  .daily-sales-metric-value { color: var(--ds-blue); }
.daily-sales-metric.green { background: var(--ds-green-bg); } .daily-sales-metric.green .daily-sales-metric-value { color: var(--ds-green); }
.daily-sales-metric.gray  { background: var(--ds-gray-bg); }

/* 進捗バー */
.daily-sales-bar-wrap { margin-top: 16px; }
.daily-sales-bar-track { position: relative; height: 16px; background: #ECEAE6; border-radius: 99px; overflow: visible; }
.daily-sales-bar-fill { height: 100%; border-radius: 99px; min-width: 4px; transition: width .4s ease; }
.daily-sales-bar-fill.blue  { background: var(--blue); }
.daily-sales-bar-fill.green { background: var(--green); }
.daily-sales-bar-pace { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-3); opacity: .55; transform: translateX(-1px); }
.daily-sales-bar-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4); margin-top: 5px; font-weight: 700; }
.daily-sales-bar-meta .cur { font-size: 13px; }
.daily-sales-bar-meta .cur.blue { color: var(--blue); }
.daily-sales-bar-meta .cur.green { color: var(--green); }

/* 月末着地予測 */
.daily-sales-hero-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.daily-sales-forecast { display: flex; flex-direction: column; }
.daily-sales-forecast-value { font-size: clamp(20px, 2.2vw, 28px); font-weight: 900; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.daily-sales-forecast.green  .daily-sales-forecast-value { color: var(--green); }
.daily-sales-forecast.orange .daily-sales-forecast-value { color: var(--c-soon); }
.daily-sales-forecast.red    .daily-sales-forecast-value { color: var(--red); }
.daily-sales-forecast-note { font-size: 12px; font-weight: 700; color: var(--ink-3); }

/* 2. 行動判断KPI */
.daily-sales-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.daily-sales-action {
  background: var(--surface); border-radius: 14px; padding: 16px 18px; border: 1px solid var(--rule);
  box-shadow: 0 1px 3px rgba(0,0,0,.05); border-top: 4px solid var(--ds-gray);
}
.daily-sales-action.gray   { border-top-color: var(--ink-4); }
.daily-sales-action.orange { border-top-color: var(--c-soon); }
.daily-sales-action.green  { border-top-color: var(--green); }
.daily-sales-action.red    { border-top-color: var(--red); }
.daily-sales-action-value { font-size: clamp(22px, 2.3vw, 30px); font-weight: 900; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--ink); }
.daily-sales-action-value small { font-size: .5em; font-weight: 700; color: var(--ink-3); }
.daily-sales-action.orange .daily-sales-action-value { color: var(--c-soon); }
.daily-sales-action.green  .daily-sales-action-value { color: var(--green); }
.daily-sales-action.red    .daily-sales-action-value { color: var(--red); }
.daily-sales-action.today .daily-sales-action-value { font-size: clamp(26px, 2.8vw, 36px); }
.daily-sales-judge { display: inline-block; font-size: 12px; font-weight: 800; margin-top: 8px; padding: 4px 10px; border-radius: 99px; }
.daily-sales-judge.green  { color: var(--green);  background: var(--green-soft); }
.daily-sales-judge.orange { color: var(--c-soon); background: var(--bg-soon); }
.daily-sales-judge.red    { color: var(--red);    background: var(--red-soft); }
.daily-sales-today-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.daily-sales-today-sub b { font-weight: 800; }
.daily-sales-today-sub .muted { color: var(--ink-4); }

/* 3. 日別実績テーブル */
.daily-sales-table-card { border-radius: 14px; padding: 18px 20px; }
.daily-sales-table-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 4px; }
.daily-sales-table th.num { text-align: right; }
.daily-sales-table td, .daily-sales-table th { padding: 10px 12px; }
.daily-sales-table td { font-size: 13px; }
.daily-sales-sales-cell { font-weight: 800; font-size: 13.5px; }
.daily-sales-sales-cell.green  { color: var(--green); }
.daily-sales-sales-cell.orange { color: var(--c-soon); }
.daily-sales-table tr.is-today td { background: var(--blue-soft); }
.daily-sales-table tr.is-today:hover td { background: var(--blue-soft); }
.daily-sales-today-tag { display: inline-block; font-size: 10px; font-weight: 800; color: var(--blue); background: #fff; border: 1px solid #C9D8F0; padding: 0 6px; border-radius: 99px; margin-left: 4px; vertical-align: middle; }
/* rakuten013: 本日（集計未完了）の日別行に付けるタグ。「未取得」（daily-sales-na）とは区別する */
.daily-sales-inprogress-tag { display: inline-block; font-size: 10px; font-weight: 800; color: var(--c-soon); background: var(--bg-soon); border: 1px solid var(--bd-soon); padding: 0 6px; border-radius: 99px; margin-left: 4px; vertical-align: middle; }

/* レスポンシブ */
@media (max-width: 1024px) {
  .daily-sales-hero-grid { grid-template-columns: 1fr 1fr; }
  .daily-sales-metric.primary { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .daily-sales-hero { padding: 18px 16px 16px; }
  .daily-sales-hero-grid { grid-template-columns: 1fr; }
  .daily-sales-actions { grid-template-columns: 1fr; }
  .daily-sales-hero-foot { flex-direction: column; align-items: flex-start; }
  .daily-sales-header { flex-direction: column; }
}

/* ---------- AI販促 出力 ---------- */
.promo-output { margin-top: 8px; }
.po-block { margin-bottom: 14px; }
.po-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.po-title { font-size: 12px; font-weight: 900; }
.po-copy { font-size: 11px; padding: 3px 12px; }
.po-block textarea {
  width: 100%; min-height: 70px; padding: 10px 12px; border: 1px solid var(--rule);
  border-radius: 8px; font-size: 12.5px; font-family: inherit; line-height: 1.6;
  background: #fcfcfb; resize: vertical;
}

/* ---------- チェックリスト ---------- */
.progress-bar-wrap { margin: 14px 0 6px; height: 8px; background: var(--rule); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), #e05560); border-radius: 99px; width: 0%; transition: width .4s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4); }
.cl-category { margin-bottom: 28px; }
.cl-cat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 9px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.cl-cat-icon { width: 30px; height: 30px; border-radius: 6px; background: var(--red-soft); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.cl-cat-title { font-size: 14px; font-weight: 900; }
.cl-cat-sub { font-size: 11px; color: var(--ink-4); margin-left: auto; }
.cl-items { display: flex; flex-direction: column; gap: 6px; }
.cl-item {
  display: flex; align-items: flex-start; gap: 10px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: 7px; padding: 11px 14px; cursor: pointer;
  transition: all .12s; user-select: none;
}
.cl-item:hover { border-color: var(--red); box-shadow: 0 2px 8px rgba(191,31,46,.07); }
.cl-item.high { border-left: 3px solid var(--red); }
.cl-item.checked { background: var(--green-soft); border-color: var(--green); opacity: .82; }
.cl-item.high.checked { border-left-color: var(--green); }
.cl-item.checked .cl-item-text { text-decoration: line-through; color: var(--ink-4); }
.cl-checkbox {
  width: 20px; height: 20px; border: 2px solid var(--rule); border-radius: 4px; flex-shrink: 0;
  margin-top: 1px; display: flex; align-items: center; justify-content: center;
  transition: all .12s; background: var(--surface);
}
.cl-item.checked .cl-checkbox { background: var(--green); border-color: var(--green); }
.cl-checkbox svg { display: none; }
.cl-item.checked .cl-checkbox svg { display: block; }
.cl-item-content { flex: 1; }
.cl-item-text { font-size: 13px; font-weight: 500; line-height: 1.5; }
.cl-item-note { font-size: 11px; color: var(--ink-4); margin-top: 2px; line-height: 1.4; }
.cl-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; flex-shrink: 0; }
.cl-badge.must { background: var(--red-soft); color: var(--red); }
.cl-badge.rec { background: var(--gold-soft); color: var(--gold); }
.cl-badge.low { background: #F0F0F0; color: var(--ink-4); }

/* ---------- イベントカレンダー ---------- */
.ev-flags span { display: inline-block; margin-right: 4px; }

/* ---------- フッター ---------- */
.footer { text-align: center; padding: 14px; font-size: 11px; color: var(--ink-4); border-top: 1px solid var(--rule); margin-top: 8px; }

/* ---------- レスポンシブ（PC優先・最低限） ---------- */
@media (max-width: 640px) {
  .nav { padding: 0 8px; }
  .nav-tab { padding: 0 9px; font-size: 11px; }
  .container { padding: 20px 14px 60px; }
}

/* ============================================================
   楽天LP戦略（追加機能 lp-strategy.js 用）
   ------------------------------------------------------------
   既存スタイルには手を入れず、.lp- プレフィックスで分離。
   ============================================================ */

/* --- サブナビ --- */
.lp-subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.lp-pill {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--surface); font-size: 12px; font-weight: 700; color: var(--ink-3);
  cursor: pointer; transition: all .15s;
}
.lp-pill:hover { border-color: var(--red); color: var(--red); }
.lp-pill.active { background: var(--red); border-color: var(--red); color: #fff; }

/* --- プロジェクトバー --- */
.lp-project-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; box-shadow: var(--shadow); font-size: 13px;
}
.lp-pb-label { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.lp-pb-date { font-size: 11px; color: var(--ink-4); }

/* --- KPI・ステップ --- */
.lp-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.lp-kpi { text-align: center; margin-bottom: 0; }
.lp-kpi-num { font-size: 28px; font-weight: 900; color: var(--red); line-height: 1.2; }
.lp-kpi-label { font-size: 11px; color: var(--ink-3); font-weight: 700; margin-top: 2px; }
.lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.lp-step { cursor: pointer; margin-bottom: 0; transition: border-color .15s, transform .15s; }
.lp-step:hover { border-color: var(--red); transform: translateY(-1px); }
.lp-step-title { font-size: 13px; font-weight: 900; color: var(--ink); margin-bottom: 4px; }
.lp-step-desc { font-size: 12px; color: var(--ink-3); }

/* --- バッジ --- */
.lp-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 700; background: var(--bg); border: 1px solid var(--rule); color: var(--ink-2);
  margin: 1px 2px;
}
.lp-badge-cat  { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.lp-badge-ok   { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.lp-badge-warn { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.lp-badge-gap  { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.lp-badge-none { background: var(--bg); color: var(--ink-4); }

/* --- テーブル --- */
.lp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lp-table th, .lp-table td { padding: 9px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.lp-table thead th { background: var(--bg); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.lp-row-active { background: var(--red-soft); }
.lp-compare-table td, .lp-compare-table th { text-align: center; }
.lp-compare-table td:first-child, .lp-compare-table th:first-child { text-align: left; white-space: nowrap; }
.lp-own-col { background: var(--green-soft); font-weight: 900; }
.lp-gap-row { background: var(--gold-soft); }
.lp-strong { color: var(--red); font-weight: 900; }
.lp-ok { color: var(--green); font-weight: 700; }
.lp-none { color: var(--ink-4); }
.lp-weak { color: var(--c-urgent); }

/* --- 詳細テーブル（th=項目名 / td=内容） --- */
.lp-detail-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lp-detail-table th {
  width: 160px; padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--rule);
  font-size: 11px; color: var(--ink-3); text-align: left; vertical-align: top; white-space: nowrap;
}
.lp-detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
@media (max-width: 640px) { .lp-detail-table th { width: 96px; white-space: normal; } }

/* --- 競合カード・リスト --- */
.lp-comp-card { border-left: 4px solid var(--blue); }
.lp-comp-empty { border-left-color: var(--rule); }
.lp-dim { color: var(--ink-4); font-size: 12px; }
.lp-list { margin: 4px 0 4px 18px; font-size: 13px; }
.lp-list li { margin-bottom: 6px; }
.lp-ol li { margin-bottom: 8px; }
.lp-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 14px; }
.lp-two-col .card { margin-bottom: 0; }

/* --- シナリオカード --- */
.lp-scenario-card { border-left: 4px solid var(--red); }
.lp-sc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lp-sc-no {
  width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; flex-shrink: 0;
}
.lp-sc-name { font-size: 14px; font-weight: 900; }
.lp-psych { color: var(--purple); }

/* --- スコア --- */
.lp-score-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.lp-score-circle {
  width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.lp-score-circle span { font-size: 13px; margin-left: 2px; }
.lp-score-good { background: var(--green); }
.lp-score-mid  { background: var(--gold); }
.lp-score-low  { background: var(--c-urgent); }
.lp-score-note { font-size: 13px; color: var(--ink-2); }

/* --- コピー生成 --- */
.lp-copy-block { margin-bottom: 10px; }
.lp-copy-text {
  display: block; margin-top: 4px; padding: 10px 12px; background: var(--bg);
  border: 1px dashed var(--rule); border-radius: 8px; font-size: 13.5px; font-weight: 700;
  cursor: copy; transition: background .15s, border-color .15s;
}
.lp-copy-text:hover { border-color: var(--red); }
.lp-copied { background: var(--green-soft); border-color: var(--green); }
span.lp-copy-text { display: inline-block; font-weight: 400; padding: 4px 8px; }
.lp-qa { font-size: 13px; line-height: 1.8; }
.lp-ng-card { border: 2px solid var(--c-urgent); background: var(--bg-urgent); }

/* --- その他 --- */
.lp-empty { text-align: center; padding: 34px 20px; color: var(--ink-3); }
.lp-empty p { margin-bottom: 14px; }
.lp-note { background: var(--blue-soft); border-color: var(--blue); font-size: 12.5px; }
.lp-note ul { margin: 6px 0 0 18px; }
.lp-note li { margin-bottom: 4px; }
.lp-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.lp-actions .btn-secondary { padding: 4px 8px; font-size: 11px; }
.lp-danger:hover { border-color: var(--c-urgent) !important; color: var(--c-urgent) !important; }

/* ── TOP監視表示（#today-health、GET /api/health）── rakuten042
   色ルールは日別UIと同じ: 緑=正常 / オレンジ=注意(warning) / 赤=要対応(error) / グレー=不明 */
#today-health { margin-bottom: 14px; }
#today-health:empty { display: none; }
.top-health-pill {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line, #E5E3DF); color: var(--ink-3); max-width: 100%;
}
.top-health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-4); flex: 0 0 auto; }
.top-health-pill.green { color: var(--green); border-color: var(--green-soft); background: var(--green-soft); }
.top-health-pill.green .top-health-dot { background: var(--green); box-shadow: 0 0 0 3px #cde9d9; }
.top-health-pill.gray .top-health-dot { background: var(--ink-4); }
.top-health-sub { color: var(--ink-3); font-weight: 600; font-size: 11px; }
.top-health-backup { color: var(--ink-3); font-weight: 600; font-size: 11px; margin-top: 4px; overflow-wrap: anywhere; }
.top-health-card {
  border-radius: 10px; padding: 10px 14px; border: 1px solid; max-width: 100%;
}
.top-health-card.orange { background: var(--bg-soon); border-color: var(--bd-soon); }
.top-health-card.red { background: var(--bg-urgent); border-color: var(--bd-urgent); }
.top-health-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.top-health-title { font-size: 13px; font-weight: 800; }
.top-health-card.orange .top-health-title { color: var(--c-soon); }
.top-health-card.red .top-health-title { color: var(--c-urgent); }
.top-health-card.orange .top-health-dot { background: var(--c-soon); box-shadow: 0 0 0 3px #fde8cf; }
.top-health-card.red .top-health-dot { background: var(--c-urgent); box-shadow: 0 0 0 3px #fbd5d5; }
.top-health-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.top-health-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.5; min-width: 0; }
.top-health-item-badge {
  flex: 0 0 auto; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; margin-top: 2px;
  background: var(--surface); border: 1px solid;
}
.top-health-item.orange .top-health-item-badge { color: var(--c-soon); border-color: var(--bd-soon); }
.top-health-item.red .top-health-item-badge { color: var(--c-urgent); border-color: var(--bd-urgent); }
.top-health-item-msg { color: var(--ink-2); overflow-wrap: anywhere; word-break: break-word; min-width: 0; }

/* ── AI販促作成: 生成結果の比較UI（rakuten028） ─────────────────────────
   3案を横に並べて比較するのが目的なので、幅が足りない環境では必ず縦積みへ落とす。
   長いprompt文字列が入るため、はみ出す可能性のある箇所には overflow-wrap を効かせ、
   ページ全体の横スクロールが出ないようにする（min-width:0 が無いとgrid子要素が縮まない）。 */
.promo-warnings { margin: 10px 0 4px; padding: 10px 12px; border-radius: 8px; font-size: 12px;
  background: #fff8e6; border: 1px solid #f0dca8; color: #6b5514; line-height: 1.7; }
.promo-warnings.is-error { background: #fdecec; border-color: #f0b8b8; color: #8a2020; }
.promo-warnings > div + div { margin-top: 4px; }

.promo-note { font-size: 11px; color: var(--ink-3); line-height: 1.7; margin-bottom: 10px; }
.promo-image-status { font-weight: 700; color: var(--ink-2); }

.promo-variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.promo-image-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }

.promo-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff;
  display: flex; flex-direction: column; gap: 8px; }
.promo-card.is-selected { border-color: var(--red); box-shadow: 0 0 0 2px rgba(191, 0, 0, 0.12); }
.promo-card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.promo-card-title { font-size: 12px; font-weight: 900; }
.promo-card-sub { font-size: 11px; color: var(--ink-3); }
.promo-card-body { margin: 0; font-size: 12px; line-height: 1.8; white-space: pre-wrap;
  overflow-wrap: anywhere; font-family: inherit; background: var(--bg-2, #fafafa);
  border-radius: 6px; padding: 10px; max-height: 320px; overflow-y: auto; }
.promo-card-meta { font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.promo-meta-label { display: inline-block; min-width: 74px; font-weight: 700; color: var(--ink-3); }
.promo-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.promo-card-actions .btn-secondary { font-size: 11px; padding: 4px 14px; }
.promo-adopt { font-weight: 700; }
.promo-card.is-selected .promo-adopt { background: var(--red); color: #fff; border-color: var(--red); }

@media (max-width: 900px) {
  .promo-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  /* 375px想定: すべて縦積み。カードが画面幅を超えないよう1カラムに固定する */
  .promo-variants, .promo-image-grid { grid-template-columns: minmax(0, 1fr); }
  .promo-card-body { max-height: 260px; }
  .promo-meta-label { display: block; min-width: 0; }
}

/* ── AI販促作成: 入力グループ見出し・CTA/送料無料フィールド（rakuten034） ──────── */
.promo-input-group-title { font-size: 12px; font-weight: 900; color: var(--ink-2); margin: 18px 0 8px; }
.promo-input-group-title:first-of-type { margin-top: 4px; }
.promo-input-hint { font-size: 11px; color: var(--ink-3); line-height: 1.6; margin: 6px 0 0; }
.promo-checkbox-field { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: var(--ink-2); margin-top: 10px; }
.promo-checkbox-field input { width: 15px; height: 15px; }

/* ── AI販促作成: バナー案カード（bannerPlan・rakuten034） ─────────────────────
   英語promptはユーザー向けの主役にせず<details>の折りたたみへ収める。
   ユーザーが見るのは色調・背景コンセプト・掲載予定テキスト・商品/ブランド・CTA。 */
.promo-banner-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-3); margin-right: 4px; margin-bottom: 4px; }
.promo-banner-section { font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.promo-banner-section + .promo-banner-section { margin-top: 6px; }
.promo-banner-section-label { font-weight: 700; color: var(--ink-3); margin-right: 4px; }
.promo-banner-details { margin-top: 8px; font-size: 11px; }
.promo-banner-details summary { cursor: pointer; color: var(--ink-3); font-weight: 700; }
.promo-banner-details pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: inherit; background: var(--bg-2, #fafafa); border-radius: 6px; padding: 8px;
  max-height: 200px; overflow-y: auto; }

/* ── AI販促生成履歴（rakuten032） ─────────────────────────────────────
   「履歴に保存」バーは promo-output 内（生成後のみ表示）。生成履歴カードは常時表示だが
   既定で折りたたみ、情報量を増やしすぎない。詳細はアコーディオン（同時に1件だけ開く）。 */
.promo-save-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.promo-save-status { font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }
.promo-save-status.is-error { color: #8a2020; }
.promo-save-status.is-ok { color: #2a7a3b; font-weight: 700; }

.promo-history-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
.promo-history-toggle-icon { font-size: 10px; color: var(--ink-3); transition: transform .15s; }
.promo-history-toggle.is-open .promo-history-toggle-icon { transform: rotate(90deg); }

.promo-history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.promo-history-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.promo-history-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.promo-history-row-id { font-size: 11px; font-weight: 900; color: var(--ink-3); min-width: 34px; }
.promo-history-row-date { font-size: 12px; font-weight: 700; }
.promo-history-row-meta { font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }
.promo-history-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap; }
.promo-history-badge.is-adopted { color: var(--red); border-color: var(--red); }
.promo-history-badge.is-neutral { color: #6b5514; border-color: #f0dca8; background: #fff8e6; }

.promo-history-detail { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.promo-history-detail-sec { font-weight: 900; margin: 10px 0 4px; font-size: 11px; }
.promo-history-detail-sec:first-child { margin-top: 0; }
.promo-history-detail pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: inherit; background: var(--bg-2, #fafafa); border-radius: 6px; padding: 8px; }

@media (max-width: 640px) {
  .promo-history-row-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .promo-save-bar { flex-direction: column; align-items: flex-start; }
}

/* ============================================================================
   rakuten-master-005: 認証（ログイン画面・ユーザーチップ）
   ============================================================================ */
#rk-auth-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
#rk-auth-overlay[hidden] { display: none; }
body.rk-auth-locked > *:not(#rk-auth-overlay) { visibility: hidden; }
.rk-auth-card {
  width: min(380px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 28px 20px;
}
.rk-auth-logo { font-size: 13px; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 4px; }
.rk-auth-title { font-size: 20px; margin: 0 0 14px; }
.rk-auth-label { display: block; font-size: 12px; color: var(--ink-3); margin: 10px 0 4px; }
.rk-auth-input {
  width: 100%; box-sizing: border-box; font-size: 15px; padding: 9px 10px;
  border: 1px solid var(--rule); border-radius: 6px; background: #fff;
}
.rk-auth-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.rk-auth-submit {
  width: 100%; margin-top: 16px; padding: 10px; font-size: 15px; font-weight: 600;
  color: #fff; background: var(--blue); border: 0; border-radius: 6px; cursor: pointer;
}
.rk-auth-submit:disabled { opacity: .6; cursor: default; }
.rk-auth-message {
  margin: 0 0 6px; padding: 8px 10px; font-size: 13px; border-radius: 6px;
  color: var(--c-urgent); background: var(--bg-urgent); border: 1px solid var(--bd-urgent);
}
.rk-auth-note { margin: 14px 0 0; font-size: 11px; color: var(--ink-4); text-align: center; }
.rk-auth-user {
  position: fixed; top: 8px; right: 12px; z-index: 900;
  display: flex; gap: 8px; align-items: center;
  font-size: 12px; color: var(--ink-3);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  padding: 4px 8px 4px 12px; box-shadow: var(--shadow);
}
.rk-auth-user[hidden] { display: none; }
.rk-auth-mini {
  font-size: 11px; padding: 3px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: #fff; color: var(--ink-2, #333);
}
.rk-auth-mini:hover { background: var(--bg); }
/* rakuten-master-036G: Step-up / MFA モーダル（ログイン画面と同じカードを流用。背景は半透明で元画面を隠さない） */
/* ---------- rakuten-master-039U: PC（>640px）のヘッダーを 2 段に分ける ----------
 *
 * これまでの構造と、その問題:
 *   管理者・店舗操作エリア（#rk-auth-user）は position: fixed の右上ピルで、機能ナビ（nav.nav）とは
 *   別々に置かれた「重なり得る 2 枚」だった。表示できる Feature が増えてタブが右まで伸びると、
 *   後半のタブがピルの下に入り込んで見づらく・押しづらくなる。
 *   rakuten-master-039S では nav 末尾にピルの実測幅ぶんの余白を入れて回避したが、
 *   重なる構造そのものは残ったままで、画面幅・店舗名の長さ・ボタン数が変わるたびに
 *   余白を測り直す必要があった（幅ごとの固定値を足す運用になりやすい）。
 *
 * 039U の構造:
 *   PC では通常フローの sticky な 2 段ヘッダーにする。
 *     1 段目 = 管理者・店舗操作（#rk-auth-user）… top: 0
 *     2 段目 = 機能ナビ（nav.nav）              … top: var(--rk-admin-bar-h)
 *   2 つは別の行を占めるので、どんな画面幅・どんな文字数でも定義上重ならない。
 *   幅ごとの分岐も、実測した px を流し込む処理も不要（--rk-admin-bar-h だけがヘッダーの幾何を決める）。
 *   ナビ自身の横スクロール（overflow-x: auto）は従来どおりで、右端まで到達できる。
 *
 * スマホ（≤640px）:
 *   rakuten-master-027 の mobile-topbar + ドロップダウン設計をそのまま使う。
 *   この規則は min-width: 641px の中だけに書き、mobile へ持ち込まない。
 */
@media (min-width: 641px) {
  :root { --rk-admin-bar-h: 40px; }

  .rk-auth-user {
    position: sticky; top: 0; right: auto; left: auto; z-index: 110;
    box-sizing: border-box; height: var(--rk-admin-bar-h);
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 0 16px; overflow-x: auto;
    background: var(--surface); border: 0; border-bottom: 1px solid var(--rule);
    border-radius: 0; box-shadow: none;
  }
  /* 店舗名・利用者名は左端。長くてもボタンを押し出さず、足りなければ省略記号にする */
  .rk-auth-user #rk-auth-user-label {
    margin-right: auto; flex: 0 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .rk-auth-user .rk-auth-mini { flex: 0 0 auto; padding: 5px 10px; min-height: 26px; }

  /* ナビは 1 段目の下へ貼り付く。未ログイン時は 1 段目が出ないので画面上端に戻す */
  .nav { top: var(--rk-admin-bar-h); }
  body.rk-auth-locked .nav { top: 0; }
}

.rk-modal-overlay { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; background: rgba(20,20,20,.55); padding: 16px; }
.rk-modal-overlay[hidden] { display: none; }
/*
 * rakuten-master-195: 本人確認（Step-up）は業務の modal（.rk-modal-overlay）より上の層。開くときは auth-client.js が
 *   body の最後へ移して背面を inert にする（重なり順の大小だけに頼らない）。ここでは層の上下を宣言として固定する。
 */
#rk-stepup-overlay { z-index: 10003; }
.rk-modal-card { max-height: calc(100vh - 32px); overflow-y: auto; }
.rk-modal-desc { margin: 0 0 8px; font-size: 13px; color: var(--ink-2, #333); line-height: 1.6; }
.rk-modal-hint { margin: 8px 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.rk-modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.rk-modal-actions .rk-auth-mini { margin-top: 16px; padding: 9px 12px; font-size: 13px; }
.rk-modal-submit { flex: 1; }
.rk-mfa-secret { font-family: ui-monospace, Menlo, monospace; font-size: 15px; letter-spacing: .12em; word-break: break-all; padding: 8px 10px; margin: 6px 0; background: var(--ink-6, #f2f2f2); border-radius: 6px; user-select: all; }
.rk-mfa-uri { font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; color: var(--ink-3); margin: 0 0 6px; user-select: all; }

/* EC-ALCHE-003: 旧 localStorage RPP の移行カード（RPP タブの先頭・PC / 375px 共通） */
.rpp-legacy { border-left: 4px solid var(--gold, #C08A20); }
.rpp-legacy-head { margin-bottom: 8px; }
.rpp-legacy-period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.rpp-legacy-period label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2, #333); }
.rpp-legacy-period input[type="date"] { font-size: 15px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
.rpp-legacy-preview { margin-top: 10px; padding: 10px 12px; background: var(--ink-6, #f2f2f2); border-radius: 6px; font-size: 13px; line-height: 1.7; }
.rpp-legacy-preview .btn-primary { margin-top: 8px; }
.rpp-legacy-warn { margin-top: 6px; color: #8a5300; }
@media (max-width: 480px) {
  .rpp-legacy-period { flex-direction: column; align-items: stretch; }
  .rpp-legacy-period label { justify-content: space-between; }
  .rpp-legacy-period input[type="date"] { flex: 1 1 auto; min-width: 0; }
  .rpp-legacy-period button { width: 100%; }
}
/* rakuten-master-047: 楽天 RMS API 設定モーダル（036G の Step-up / MFA カードと同じ部品を流用。PC / スマホ 375px 共通） */
.rk-rms-card { width: min(440px, calc(100vw - 32px)); }
/* 保存・解除で開く Step-up（#rk-stepup-overlay: 10001）と認証アプリ登録（#rk-mfa-overlay: 10001）を常に手前にする（同じ z-index だと DOM 順で後ろのこの overlay が上に来て、本人確認の入力欄が隠れる） */
#rk-rms-overlay { z-index: 10000; }
.rk-rms-status { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 4px 10px; margin: 0 0 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; background: var(--ink-6, #f2f2f2); border-radius: 6px; }
.rk-rms-status dt { color: var(--ink-3); font-weight: 600; }
.rk-rms-status dd { margin: 0; color: var(--ink-2, #333); overflow-wrap: anywhere; }
.rk-rms-status dd.rk-rms-ok { color: #1a7f37; font-weight: 600; }
.rk-rms-status dd.rk-rms-ng { color: var(--c-urgent); font-weight: 600; }
/* rakuten-master-047: licenseKey 期限の予告段階（30日/14日以内）。期限切れ・7日以内は rk-rms-ng で強く出す */
.rk-rms-status dd.rk-rms-warn { color: #8a5300; font-weight: 600; }
.rk-rms-success { margin: 0 0 6px; padding: 8px 10px; font-size: 13px; border-radius: 6px; color: #1a7f37; background: #e9f7ee; border: 1px solid #b7e1c4; }
.rk-rms-replace-hint { color: #8a5300; }
.rk-rms-actions-2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.rk-rms-actions-2 .rk-auth-mini { padding: 9px 12px; font-size: 13px; }
.rk-rms-danger { color: var(--c-urgent); border-color: var(--bd-urgent); }
.rk-rms-revoke-confirm { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--bd-urgent); border-radius: 6px; background: var(--bg-urgent); }
.rk-rms-secret-input { font-family: ui-monospace, Menlo, monospace; letter-spacing: .04em; }
/* rakuten-master-225: 秘密値の欄は text 型（ブラウザがログインパスワードを自動入力しない）。表示だけ ● で隠す */
.rk-secret-mask { -webkit-text-security: disc; text-security: disc; }
/* rakuten-master-047: 接続・店舗確認に成功したときだけ現れる保存ブロック（確認前は保存できない） */
.rk-rms-commit-row { margin-top: 10px; padding: 10px 12px; border: 1px solid #b7e1c4; border-radius: 6px; background: #f3fbf6; }
.rk-rms-commit-row .rk-rms-success { margin: 0 0 8px; }
.rk-rms-commit-row .rk-modal-submit { width: 100%; }
@media (max-width: 480px) {
  .rk-rms-card { padding: 20px 16px 14px; }
  .rk-rms-status { grid-template-columns: 6.5em minmax(0, 1fr); }
  .rk-rms-actions-2 .rk-auth-mini { flex: 1 1 auto; text-align: center; }
  .rk-rms-commit-row { padding: 10px; }
}
/*
 * rakuten-master-277: モーダル上部の固定ヘッダーと右上の「×」。
 *   カード（.rk-modal-card）全体が overflow-y: auto でスクロールするため、ヘッダーを position: sticky にして上端へ残す。
 *   margin はカードの padding（PC 28px・≤480px は 20px 16px）を打ち消してカードの端まで広げる（背景の upper edge に隙間を作らない）。
 *   sticky の top はスクロールするカードの padding を内側へ数える（top: 0 だと本文が padding 分だけヘッダーの上にはみ出して見える）ため、padding と同じ負の値（PC -28px・≤480px は -20px）にする。
 *   「×」は 44px 四方（タップ領域）。Yahoo!連携（#rk-provider-form）だけが使う。overscroll-behavior はスクロールが背景のページへ繋がるのを止める。
 */
.rk-modal-sticky-head { position: sticky; top: -28px; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: -28px -28px 10px; padding: 20px 14px 8px 28px; background: var(--surface); border-bottom: 1px solid var(--rule); text-align: left; }
.rk-modal-sticky-head .rk-auth-title { margin-bottom: 6px; }
.rk-modal-x { flex: 0 0 auto; width: 44px; height: 44px; margin: -6px 0 0; padding: 0; font-size: 28px; line-height: 1; color: var(--ink-2, #333); background: #fff; border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; }
.rk-modal-x:hover { background: var(--bg); }
.rk-modal-x:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rk-provider-card { overscroll-behavior: contain; }
@media (max-width: 480px) {
  .rk-rms-card .rk-modal-sticky-head { top: -20px; margin: -20px -16px 8px; padding: 12px 8px 8px 16px; }
  .rk-modal-sticky-head .rk-auth-title { font-size: 17px; }   /* 「×」の分だけ狭いので、タイトルが 1 行に収まる大きさ */
}

/* rakuten-master-027: スマホ（≤640px）向けアカウントメニュー。
   PC の常時表示ピル（position:fixed で右上に固定）はナビが横スクロールする幅では
   ナビタブの上に常時かぶさり、タブ操作を妨げていた（実機 iPhone で確認）。
   スマホでは (1) アカウント表示をナビと別行の専用バーへ分離し、
   (2) ピルは既定で隠し、タップ式トグルで開閉するドロップダウンへ変える。
   これによりナビの横スクロール領域には一切アカウント要素が重ならない。
   店舗切替・ログアウトの処理（auth-client.js）自体は変更しない。 */
@media (max-width: 640px) {
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 40px; padding: 0 12px; background: var(--ink);
    position: sticky; top: 0; z-index: 110;
  }
  .mobile-topbar-logo {
    font-size: 12px; font-weight: 700; color: var(--red-mid); letter-spacing: 0.08em; white-space: nowrap;
  }
  .mobile-topbar-account {
    font-size: 12px; font-weight: 600; color: #fff; background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.28); border-radius: 999px; cursor: pointer;
    padding: 0 12px; height: 32px; max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobile-topbar-account[hidden] { display: none; }
  .mobile-topbar-account:active { background: rgba(255,255,255,.22); }

  /* ナビはスマホ専用バーの下に固定し続ける（アカウント要素とは別行なので重ならない） */
  .nav { top: 40px; }

  /* 常時表示ピルをやめ、トグルで開閉するドロップダウンパネルにする。認証状態は
     引き続き [hidden] 属性（renderUserChip）が管理し、開閉は .rk-auth-user--open が管理する */
  .rk-auth-user {
    position: fixed; top: 44px; right: 8px; left: auto;
    display: none; flex-direction: column; align-items: stretch; gap: 8px;
    max-width: calc(100vw - 16px); padding: 10px 12px; z-index: 950;
  }
  .rk-auth-user.rk-auth-user--open { display: flex; }
  .rk-auth-user #rk-auth-user-label { font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
  .rk-auth-user .rk-auth-mini { font-size: 13px; padding: 9px 10px; min-height: 40px; }
}

/* rakuten-master-006/014: 未リリース（この店舗で Feature OFF）バッジ。platform_admin にだけ表示される（店舗ユーザーには tab 自体が出ない） */
.nav-tab.rk-feature-off, .nav-tab.rk-feature-unreleased { opacity: .55; color: var(--ink-3, #888); background: rgba(128,128,128,.08); }
.nav-tab.rk-feature-off::after, .nav-tab.rk-feature-unreleased::after {
  content: '未リリース'; display: inline-block; margin-left: 5px; padding: 0 5px; font-size: 9.5px; line-height: 15px;
  font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--gold); border-radius: 999px; vertical-align: 1px;
}
/* ============================================================================
   rakuten-master-036A: 商品一覧（在庫優先レイアウト）
   ----------------------------------------------------------------------------
   常時大きく出すのは 商品画像 / 商品タイトル / 販売価格 / 在庫数 の 4 つ。
   管理番号・状態・セール・原価・SKU は補助情報として小さく、または accordion の中へ。
   1 商品あたりの高さを抑えて 1 画面の表示件数を増やす（楽天 RMS の商品一覧と同じ考え方）。
   ========================================================================== */
.pm-card { margin-bottom: 6px; padding: 10px 12px; }
.pm-row {
  display: grid; gap: 8px 14px; align-items: center;
  /* rakuten-master-046: 商品カードは 1 枚ずつ別の grid。列を auto にすると商品名の長さで販売価格・在庫数の X 座標が
     行ごとにずれるため、desktop は画像・価格・在庫・操作を固定幅にし、商品情報だけが伸縮する */
  grid-template-columns: 88px minmax(0, 1fr) 184px 112px 180px;
  grid-template-areas: "thumb main price stock actions";
}
.pm-thumb {
  grid-area: thumb; width: 88px; height: 88px; border-radius: 8px; background: var(--ink-6, #f2f2f2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.pm-main { grid-area: main; min-width: 0; }
.pm-title {
  font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--ink-1, #111);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pm-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 5px; }
.pm-code { font-size: 12.5px; color: var(--ink-3); }
.pm-sale-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--ok-bg, #e8f5e9); color: var(--ok, #1b6b2a);
}
.pm-sale-badge.is-none { background: var(--ink-6, #f2f2f2); color: var(--ink-3); }
.pm-sale-badge.is-attention { background: var(--warn-bg, #fff4e0); color: var(--warn, #8a5300); }

/* rakuten-master-150: 商品マスター「在庫と仕入れの目安」。状態は必ず文字で示す（色は補助）。行の高さは変えない */
.pm-repl-badge {
  display: inline-block; max-width: 100%; font-size: 10.5px; font-weight: 700; line-height: 1.5; padding: 1px 8px; border-radius: 999px;
  border: 1px solid transparent; background: var(--ink-6, #f2f2f2); color: var(--ink-2, #444); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.pm-repl-badge.is-out-of-stock { background: #fdecea; color: #8c1d18; border-color: #b3261e; }
.pm-repl-badge.is-stockout-soon { background: var(--warn-bg, #fff4e0); color: #6b4000; border-color: #8a5300; }
.pm-repl-badge.is-replenish { background: #e8f0fe; color: #174ea6; border-color: #1a5fb4; }
.pm-repl-badge.is-sufficient { background: var(--ok-bg, #e8f5e9); color: var(--ok, #1b6b2a); }
.pm-repl-badge.is-insufficient-data, .pm-repl-badge.is-unset { background: #fff; color: var(--ink-2, #444); border-color: var(--ink-4, #c8c8c8); border-style: dashed; }
.pm-repl-badge.is-no-sales, .pm-repl-badge.is-excluded { background: var(--ink-6, #f2f2f2); color: var(--ink-3, #666); }
.pm-repl-notice { margin-top: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.6; border-radius: var(--radius); background: #eef4ff; color: var(--ink-1, #111); overflow-wrap: anywhere; }
.pm-repl-notice.is-error { background: #fdecea; }
.pm-repl { margin-top: 10px; padding: 10px; background: #fff; border: 1px solid var(--ink-5, #e0e0e0); border-radius: var(--radius); min-width: 0; }
.pm-repl-head { font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.pm-repl-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.pm-repl-reason { font-size: 11.5px; color: var(--ink-2, #444); overflow-wrap: anywhere; }
.pm-repl-muted { font-size: 12px; color: var(--ink-3, #666); }
.pm-repl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; margin: 0 0 10px; }
.pm-repl-item { min-width: 0; margin: 0; }
.pm-repl-item dt { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-3, #666); }
.pm-repl-item dd { margin: 1px 0 0; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pm-repl-item-note { display: block; font-size: 10.5px; font-weight: 400; color: var(--ink-3, #666); }
.pm-repl-scroll { max-width: 100%; overflow-x: auto; }
.pm-repl-table { min-width: 720px; }
.pm-repl-table td.num, .pm-repl-table th, .pm-repl-table .pm-repl-badge { white-space: nowrap; }
.pm-repl-table .pm-repl-badge { overflow: visible; max-width: none; }
.pm-repl-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pm-repl-table td.pm-repl-buy { font-weight: 800; }
.pm-repl-sku { min-width: 140px; max-width: 260px; }
.pm-repl-sku-name { font-weight: 700; overflow-wrap: anywhere; }
.pm-repl-sku-code { font-size: 10.5px; font-weight: 400; color: var(--ink-3, #666); overflow-wrap: anywhere; }
.pm-repl-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 5px; border: 1px solid var(--ink-4, #c8c8c8); border-radius: 4px; color: var(--ink-2, #444); white-space: nowrap; }
.pm-repl-basis { margin-top: 10px; font-size: 12px; }
.pm-repl-basis > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.pm-repl-basis > summary:focus-visible { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 2px; }
.pm-repl-explain, .pm-repl-warnings, .pm-repl-malls { margin: 6px 0; padding-left: 18px; line-height: 1.6; overflow-wrap: anywhere; }
.pm-repl-warnings { color: #6b4000; }
.pm-repl-basis-unit { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--ink-5, #e0e0e0); }
.pm-repl-basis-title { font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }
.pm-repl-sub { font-size: 11px; font-weight: 700; color: var(--ink-3, #666); }
@media (max-width: 640px) {
  .pm-repl { padding: 8px; }
  .pm-repl-grid { grid-template-columns: 1fr 1fr; }
  /* 一覧の badge だけ折り返しを許す（長い言葉でも見切れない）。表の中の badge は折り返さない（表の内部だけを横スクロール） */
  .pm-meta .pm-repl-badge, .pm-repl-status .pm-repl-badge { white-space: normal; }
}
@media (max-width: 400px) {
  .pm-repl-grid { grid-template-columns: 1fr; }
  .pm-repl-item { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid var(--ink-6, #f2f2f2); padding-bottom: 4px; }
  .pm-repl-item dd { text-align: right; }
}

.pm-metrics { grid-area: metrics; display: flex; gap: 20px; align-items: center; }
.pm-metric { text-align: right; }
.pm-metric-label { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-4); }
.pm-metric-note { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.pm-price { min-width: 104px; }
.pm-price-value { font-size: 19px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm-price-value.is-muted { font-size: 16px; color: var(--ink-4); }
.pm-price-sep { font-size: 13px; font-weight: 700; }
/* 在庫数は一覧で最も見たい数字。画像の一回り小さい程度の存在感にする */
.pm-stock { min-width: 96px; }
.pm-stock-value { font-size: 34px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.pm-stock.is-zero .pm-stock-value { color: #b3261e; }
.pm-stock.is-partial .pm-stock-value, .pm-stock.is-stale .pm-stock-value { color: #8a5300; }
/* 取得失敗・未取得は 0 と見せない（数字を出さず「—」＋注記） */
.pm-stock.is-unknown .pm-stock-value { font-size: 26px; color: var(--ink-4); }

.pm-actions { grid-area: actions; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.pm-acc-btn { white-space: nowrap; }
.pm-bulk-check { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; color: var(--ink-3); }
.pm-sort-toggle { display: inline-flex; gap: 4px; align-items: center; font-size: 11.5px; color: var(--ink-3); }
.pm-acc { margin-top: 8px; padding: 10px; background: var(--ink-6, #f2f2f2); border-radius: var(--radius); }
.pm-acc-btn:focus-visible, .pm-bulk-check input:focus-visible, .pm-sort-toggle input:focus-visible { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 2px; }
/* rakuten-master-158: 並び順の選択欄（検索・絞り込みと同じ行。狭い幅では折り返して画面内に収まる） */
.pm-sort-field { display: inline-flex; gap: 6px; align-items: center; flex: 0 1 auto; max-width: 100%; min-width: 0; font-size: 11.5px; color: var(--ink-3); }
.pm-sort-select { max-width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--ink-4); border-radius: var(--radius); font-size: 12px; color: var(--ink-1, #111); background: #fff; }
.pm-sort-select:focus-visible { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 2px; }
.pm-sort-note { flex: 1 1 100%; font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.pm-sort-note.is-error { color: #a4262c; }

/* SKU 別 在庫・原価 */
.pm-sku-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pm-sku-table tr.is-hidden-sku { color: var(--ink-3); }
/*
 * rakuten-master-164: SKU 表の操作列（原価を登録 / 編集 / 履歴）は右端に固定する。
 * 最終列のままだと 375px で .tbl-scroll の横スクロールの外に出て見えない（rakuten156 の左 sticky と同じ考え方）。
 * 表の内部スクロールはそのまま（ページ全体の横スクロールは作らない）。
 */
.pm-sku-table td.pm-sku-action { position: sticky; right: 0; z-index: 1; background: var(--surface, #fff); box-shadow: -4px 0 6px -4px rgba(0,0,0,0.18); }
.pm-sku-table th.pm-sku-action { right: 0; z-index: 3; }
.pm-sku-table tr.is-cost-short td { background: #fff4f3; }
.pm-sku-table tr.is-cost-short td.pm-sku-action { background: #fff4f3; }
/* 編集フォームの行は 9 列ぶんの幅になる。折り返しを許し、表の横スクロールの左端に固定して画面幅に収める（375px で選択肢が切れない） */
.pm-sku-table td.sc-edit-cell { white-space: normal; }
.pm-sku-table td.sc-edit-cell > div { position: sticky; left: 0; max-width: calc(100vw - 72px); box-sizing: border-box; }
.sc-uncovered { margin: 0 0 6px; padding: 6px 8px; border: 1px solid #f1c4c0; border-radius: var(--radius); background: #fff8f7; font-size: 11.5px; color: #8a1c14; overflow-wrap: anywhere; }
.sc-uncovered ul { margin: 4px 0 0; padding-left: 18px; }
/* rakuten-master-165: 過去の原価不足期間を補完（入力・保存前の確認・確認チェック）。375px でも折り返して画面内に収める */
.gf-panel { margin-top: 6px; padding: 8px 10px; border: 1px solid #b7cdf0; border-radius: var(--radius); background: #f5f9ff; font-size: 12px; white-space: normal; overflow-wrap: anywhere; max-width: 100%; box-sizing: border-box; }
.gf-title { font-weight: 700; font-size: 12.5px; }
.gf-subtitle { font-weight: 700; margin-bottom: 4px; }
.gf-note, .gf-facts { color: var(--ink-2); margin-top: 2px; }
.gf-facts { font-weight: 700; margin: 6px 0; }
.gf-inputs { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 6px; }
.gf-inputs label { display: block; font-size: 11px; color: var(--ink-2); }
.gf-preview { margin-top: 8px; padding: 8px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); }
.gf-preview dl { display: grid; grid-template-columns: minmax(7em, max-content) minmax(0, 1fr); gap: 3px 10px; margin: 0; }
.gf-preview dt { color: var(--ink-2); }
.gf-preview dd { margin: 0; min-width: 0; }
.gf-ack { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; line-height: 1.5; }
.gf-ack input { flex: 0 0 auto; margin-top: 3px; }
.gf-actions { margin-top: 8px; }
.gf-warn { margin-top: 6px; color: #8a5300; font-weight: 700; }
.gf-error { margin-top: 6px; color: var(--red); }
.gf-done { margin-top: 6px; color: var(--green); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gf-guide { margin-top: 6px; padding: 6px 8px; border: 1px solid #f1d7a6; border-radius: var(--radius); background: #fffaf0; font-size: 12px; white-space: normal; overflow-wrap: anywhere; display: grid; gap: 4px; justify-items: start; }
@media (max-width: 480px) { .gf-preview dl { grid-template-columns: minmax(0, 1fr); } .gf-preview dd { padding-left: 6px; margin-bottom: 2px; } }
.pm-from-profit { margin-bottom: 8px; padding: 8px 10px; border: 1px solid #b7cdf0; border-radius: var(--radius); background: #eef4ff; font-size: 12.5px; overflow-wrap: anywhere; }
.pm-from-profit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pm-sku-stock { font-weight: 700; }
.pm-sku-stock.is-zero { color: #b3261e; }
.pm-sku-stock.is-stale { color: #8a5300; }
.pm-sku-stock.is-unknown { color: var(--ink-4); font-weight: 600; }
.pm-sku-stock-note { font-size: 10px; color: #8a5300; margin-left: 2px; }

/* rakuten-master-046: desktop は販売価格・在庫数を独立した固定列へ（.pm-metrics は箱を作らず子を grid に直接並べる） */
@media (min-width: 1024px) {
  .pm-metrics { display: contents; }
  .pm-price { grid-area: price; }
  .pm-stock { grid-area: stock; }
  /* SKU 別価格レンジは「〜」の位置だけで折り返す（¥ と数字・桁区切りの途中では改行されない） */
  .pm-price .pm-price-value { white-space: normal; }
}
/* 商品名 = 詳細の開閉（旧「詳細」ボタンの代わり）。リンク色にはせず、押せることを cursor / hover / focus で示す */
.pm-title-toggle { cursor: pointer; border-radius: 4px; }
.pm-title-toggle:hover { text-decoration: underline; text-decoration-color: var(--ink-4, #999); text-underline-offset: 3px; }
.pm-title-toggle[aria-expanded="true"] { text-decoration: underline; text-underline-offset: 3px; }
.pm-title-toggle:focus-visible { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 2px; }
/* 原価登録状況の数字（押すと絞り込み） */
.pm-cost-count {
  display: inline-block; min-width: 2.4em; padding: 0 8px; margin: 0 1px; font: inherit; font-weight: 700; line-height: 1.7;
  font-variant-numeric: tabular-nums; color: var(--ink-1, #111); background: #fff; border: 1px solid var(--ink-4, #c8c8c8);
  border-radius: 999px; cursor: pointer;
}
.pm-cost-count:hover { border-color: var(--ink-2, #666); }
.pm-cost-count:focus-visible { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 2px; }
.pm-cost-count.is-bad { color: #b3261e; border-color: #b3261e; }
.pm-cost-count.is-warn { color: #8a5300; border-color: #8a5300; }
.pm-cost-count.is-active { color: #fff; background: var(--ink-1, #111); border-color: var(--ink-1, #111); }
.pm-cost-filter-banner {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 8px; padding: 6px 10px;
  font-size: 12px; background: var(--info-bg, #eef4ff); border-radius: var(--radius);
}
.pm-saved-note { margin-top: 8px; padding: 6px 10px; font-size: 12px; color: #1b6b2a; background: var(--ok-bg, #e8f5e9); border-radius: var(--radius); }

@media (max-width: 1023px) {
  .pm-row { grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "thumb main metrics" "thumb actions actions"; }
  .pm-thumb { width: 72px; height: 72px; }
  .pm-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 639px) {
  .pm-row { grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "thumb main" "metrics metrics" "actions actions"; }
  .pm-thumb { width: 64px; height: 64px; }
  .pm-title { font-size: 15px; }
  .pm-metrics { justify-content: space-between; gap: 12px; }
  .pm-metric { text-align: left; }
  .pm-stock-value { font-size: 30px; }
  .pm-price-value { font-size: 18px; }
  /* rakuten-master-046R: スマホでは件数ピルのタップ領域を確保する（高さ約 30px。desktop の見た目は変えない） */
  .pm-cost-count { min-height: 30px; line-height: 2.4; padding: 0 12px; margin: 2px 1px; }
  .pm-cost-filter-banner .btn-small { min-height: 30px; }
}

.rk-feature-off-banner {
  margin-bottom: 8px; padding: 8px 10px; font-size: 12px; border-radius: 6px;
  color: var(--gold); background: var(--gold-soft); border: 1px solid var(--gold);
}

/* rakuten-master-006: Feature OFF のタブは hidden 属性で非表示にする。.nav-tab の display 指定より優先させる */
.nav-tab[hidden] { display: none !important; }


/* ============================================================================
   rakuten-master-042D: 利用規約への同意（全画面ブロッキング）

   ・#rk-auth-overlay（ログイン）と同じ「背面を visibility:hidden にする」方式で、
     未同意のあいだ dashboard / nav / 業務画面を一切操作できないようにする。
     背面を消すのは server Gate の代わりではなく UX（server は 403 で必ず止める）。
   ・モバイル（375px）優先。本文は画面いっぱいに伸ばさず、スクロール可能な panel に閉じ込め、
     同意ボタンが常に届く位置に残るよう flex column + min-height:0 で組む（100vh は使わない）。
   ・iPhone のホームインジケータ／ノッチに被らないよう safe-area を見る。
   ============================================================================ */
#rk-terms-overlay {
  position: fixed; inset: 0; z-index: 10002;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: calc(16px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px))
           calc(16px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
}
#rk-terms-overlay[hidden] { display: none; }
body.rk-terms-locked > *:not(#rk-terms-overlay) { visibility: hidden; }

.rk-terms-card {
  width: min(760px, 100%);
  /* 100vh を使わない: iOS の URL バー伸縮で下端（同意ボタン）が画面外へ出るため */
  max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 20px 16px;
}
.rk-terms-head { flex: 0 0 auto; }
.rk-terms-title { font-size: 19px; margin: 2px 0 8px; }
.rk-terms-desc { font-size: 13px; line-height: 1.7; color: var(--ink-2); margin: 0 0 12px; }

.rk-terms-tabs { flex: 0 0 auto; display: flex; gap: 8px; margin-bottom: 8px; }
.rk-terms-tab {
  appearance: none; border: 1px solid var(--rule); background: var(--bg);
  color: var(--ink-2); border-radius: var(--radius); padding: 9px 14px;
  font-size: 13px; min-height: 40px; cursor: pointer;
}
.rk-terms-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); border-color: var(--ink-3); font-weight: 600; }
.rk-terms-tab:focus-visible, .rk-terms-doc:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }

.rk-terms-meta { flex: 0 0 auto; font-size: 12px; color: var(--ink-3); margin: 0 0 6px; line-height: 1.6; }

/* 本文パネル: ここだけがスクロールする。min-height:0 が無いと flex 内で縮まず、ボタンが画面外へ出る */
.rk-terms-doc {
  flex: 1 1 auto; min-height: 0;
  max-height: 50dvh;
  overflow-y: auto; overflow-x: auto;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--bg); padding: 14px 16px;
  font-size: 13px; line-height: 1.85; color: var(--ink);
  overscroll-behavior: contain;
}
.rk-terms-doc h2 { font-size: 15px; margin: 0 0 10px; }
.rk-terms-doc h3 { font-size: 13.5px; margin: 18px 0 6px; color: var(--ink); }
.rk-terms-doc h3:first-child { margin-top: 0; }
.rk-terms-doc p { margin: 0 0 10px; word-break: break-word; }
.rk-terms-doc hr { border: 0; border-top: 1px solid var(--rule); margin: 12px 0; }
.rk-terms-doc .rk-terms-loading { color: var(--ink-3); }

.rk-terms-error { flex: 0 0 auto; margin: 10px 0 0; padding: 8px 10px; font-size: 13px; border-radius: 6px; line-height: 1.7;
  color: var(--c-urgent); background: var(--bg-urgent); border: 1px solid var(--bd-urgent); }
.rk-terms-error[hidden] { display: none; }
.rk-terms-retry { flex: 0 0 auto; margin-top: 8px; align-self: flex-start; }
.rk-terms-retry[hidden] { display: none; }

.rk-terms-consent {
  flex: 0 0 auto; display: flex; align-items: flex-start; gap: 10px;
  margin: 14px 0 0; padding: 10px 2px; font-size: 13.5px; line-height: 1.6; cursor: pointer;
  min-height: 44px;   /* タップ領域 */
}
.rk-terms-consent input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; cursor: pointer; }
.rk-terms-consent input:disabled { cursor: default; }
.rk-terms-consent input:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }

.rk-terms-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.rk-terms-submit { flex: 1 1 auto; margin-top: 0; min-height: 46px; }
.rk-terms-actions .rk-auth-mini { flex: 0 0 auto; min-height: 46px; padding: 10px 14px; }

/* モバイル（375px 想定）: カードを画面いっぱいに使い、本文パネルを少し低くしてボタンを確実に見せる */
@media (max-width: 640px) {
  #rk-terms-overlay { padding: calc(10px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px))
                              calc(10px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px)); }
  .rk-terms-card { padding: 16px 14px 12px; border-radius: var(--radius); }
  .rk-terms-title { font-size: 17px; }
  .rk-terms-desc { font-size: 12.5px; }
  .rk-terms-doc { max-height: 42dvh; padding: 12px; font-size: 12.5px; }
  .rk-terms-tab { padding: 9px 12px; font-size: 12.5px; }
  .rk-terms-actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .rk-terms-actions .rk-auth-mini { width: 100%; }
}

/* ============================================================================
   rakuten-master-044R: 売上（日別）日商目標管理 — 前日比・前年同日比 / 今日の目標 KPI / ペース判定 / イベント名 / 日別配分の編集
   ----------------------------------------------------------------------------
   ・375px 最優先。売上（日別）の主役は「売上実績・日別目標・達成率」で、前日比・前年同日比は補助情報。
     狭い画面では比較 2 列（.daily-sales-compare-cell）を隠し、本日カードの chip（.daily-sales-compare-chips）で本日分を見せる。
   ・色は必ず記号・文言と併記する（ペース判定 ▲●▼・合計 ok/ng の文言）。
   ============================================================================ */

/* 本日カードの比較 chip（前日比・前年同日比） */
.daily-sales-compare-chips { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12.5px; }
.daily-sales-compare-chips .muted { color: var(--ink-3); }
.daily-sales-chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.05); white-space: nowrap; }
.daily-sales-chip b { font-variant-numeric: tabular-nums; }
.daily-sales-chip.up { background: rgba(22, 133, 74, 0.12); color: #14663a; }
.daily-sales-chip.warn { background: rgba(191, 31, 46, 0.10); color: #9a1f2a; }

/* 比較列（テーブル）。数字は等幅で桁を揃える */
td.daily-sales-compare-cell, th.daily-sales-compare-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 日付セルのイベント名（手入力 event_label） */
.daily-sales-event-chip { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: rgba(184, 120, 0, 0.12); color: #7a4f00; vertical-align: middle; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 今日の目標 KPI（本日カード内） */
.daily-sales-today-target { margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; background: rgba(0, 0, 0, 0.04); }
.daily-sales-today-target.green { background: rgba(22, 133, 74, 0.10); }
.daily-sales-today-target.orange { background: rgba(230, 126, 34, 0.12); }
.daily-sales-today-target.blue { background: rgba(26, 95, 180, 0.08); }
.daily-sales-today-target.is-unset { background: transparent; padding: 4px 0; }
.daily-sales-today-target-row { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.daily-sales-today-target b { font-weight: 800; font-variant-numeric: tabular-nums; }
.daily-sales-today-target small { color: var(--ink-3); margin-left: 2px; }
.daily-sales-today-need { font-weight: 700; }

/* ペース判定バッジ（目標累計 vs 実績累計） */
.daily-sales-pace-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.daily-sales-pace-ahead { background: rgba(22, 133, 74, 0.12); color: #14663a; }
.daily-sales-pace-on { background: rgba(26, 95, 180, 0.10); color: #1a4f8a; }
.daily-sales-pace-behind { background: rgba(191, 31, 46, 0.10); color: #9a1f2a; }

/* 日別配分の編集パネル */
.daily-alloc-panel { margin: 0 0 12px; }
.daily-alloc-card { padding: 12px 14px; }
.daily-alloc-head { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: flex-start; }
.daily-alloc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.daily-alloc-preset-note { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
.daily-alloc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 16px; margin-top: 10px; }
.daily-alloc-row { display: grid; grid-template-columns: 74px 96px minmax(0, 1fr); gap: 6px; align-items: center; padding: 2px 0; }
.daily-alloc-row.is-weekend .daily-alloc-date { color: #9a1f2a; }
.daily-alloc-date { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.daily-alloc-date small { font-weight: 400; color: var(--ink-3); }
.daily-alloc-pct { display: inline-flex; align-items: center; gap: 3px; }
.daily-alloc-pct input { width: 68px; min-height: 30px; padding: 4px 6px; border: 1px solid var(--ink-4); border-radius: var(--radius); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.daily-alloc-unit { font-size: 12px; color: var(--ink-3); }
.daily-alloc-label { min-height: 30px; padding: 4px 8px; border: 1px solid var(--ink-4); border-radius: var(--radius); font-size: 12.5px; min-width: 0; }
.daily-alloc-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); display: flex; flex-direction: column; gap: 6px; }
.daily-alloc-sum { font-weight: 700; font-variant-numeric: tabular-nums; }
.daily-alloc-sum.ok { color: #14663a; }
.daily-alloc-sum.ng { color: #9a1f2a; }
.daily-alloc-invalid { font-size: 12px; color: #9a1f2a; }
.daily-alloc-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.daily-alloc-buttons .muted { color: var(--ink-3); font-size: 12px; }
.daily-alloc-pct input:focus-visible, .daily-alloc-label:focus-visible { outline: 2px solid var(--blue, #1a5fb4); outline-offset: 1px; }
/* rakuten-master-044S: 自動配分の根拠・日別の理由 */
.daily-alloc-reason { grid-column: 1 / -1; font-size: 11px; color: var(--ink-3); padding: 0 0 4px 2px; line-height: 1.4; }
.daily-alloc-auto-mode { display: flex; align-items: center; gap: 6px; margin-top: 8px; min-height: 32px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.daily-alloc-auto-mode input { width: 20px; height: 20px; margin: 0; flex: 0 0 20px; }
.daily-alloc-auto-box { margin-top: 10px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; }
.daily-alloc-auto-title { font-weight: 700; color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.daily-alloc-auto-box ul { margin: 4px 0 0; padding-left: 18px; line-height: 1.6; font-size: 12px; }
.daily-alloc-quality { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.daily-alloc-quality-HIGH { background: var(--green-soft); color: var(--green); }
.daily-alloc-quality-MEDIUM { background: var(--gold-soft); color: var(--gold); }
.daily-alloc-quality-LOW { background: var(--red-soft); color: var(--red); }
/* rakuten-master-044T: 出所 chip・メモ・本体の標準配分マスター */
.daily-alloc-row { grid-template-columns: 74px 96px minmax(0, 1fr); }
.daily-alloc-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 0 0 6px 2px; }
.daily-alloc-src { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border-radius: 10px; font-size: 10.5px; white-space: nowrap; background: #F0F0F0; color: var(--ink-3); }
.daily-alloc-src-STANDARD { background: var(--blue-soft); color: var(--blue); }
.daily-alloc-src-TENANT_CUSTOM { background: var(--gold-soft); color: var(--gold); }
.daily-alloc-src-AUTO_GENERATED { background: var(--green-soft); color: var(--green); }
.daily-alloc-tplval { font-size: 10.5px; color: var(--ink-4); }
.daily-alloc-memo { flex: 1 1 160px; min-width: 120px; min-height: 30px; padding: 4px 8px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 12px; }
.daily-alloc-reset-day { min-height: 28px; font-size: 11px; }
.daily-alloc-danger { border-color: var(--red); color: var(--red); }
.daily-alloc-source-summary { margin-top: 6px; font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.daily-alloc-outdated { color: var(--gold); font-size: 11.5px; }
.daily-tpl-admin-card { padding: 12px 14px; margin-bottom: 12px; border-left: 4px solid var(--blue, #1a5fb4); }
.daily-tpl-admin-head { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.daily-tpl-file { position: relative; overflow: hidden; display: inline-flex; align-items: center; cursor: pointer; }
.daily-tpl-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.daily-tpl-preview { margin: 10px 0; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-size: 12.5px; }
.daily-tpl-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 10px; margin: 8px 0; font-size: 11.5px; color: var(--ink-2); }
.daily-tpl-preview-grid small { color: var(--ink-4); }
.daily-tpl-dist { margin-top: 12px; }
.daily-tpl-dist-title { font-weight: 700; margin-bottom: 6px; }
.daily-tpl-dist-table td { white-space: normal; }
.daily-tpl-dist-table .muted { font-size: 11px; }
/* rakuten-master-044U: 本体の標準日別配分 画面（overlay）・Excel preview・一括配布 */
.rk-alloc-master-card { width: min(1180px, calc(100vw - 32px)); text-align: left; }
.rk-alloc-master-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rk-alloc-master-head .rk-auth-mini { margin-top: 0; }
.daily-tpl-admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 6px 0 12px; }
.daily-tpl-month input { min-height: 34px; padding: 4px 8px; border: 1px solid var(--rule); border-radius: 7px; font-size: 13px; margin-left: 6px; }
.daily-tpl-admin-link { margin: 0 0 10px; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-size: 12.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.daily-tpl-warnings { margin: 6px 0; padding-left: 18px; font-size: 12px; color: var(--gold); line-height: 1.6; }
.daily-tpl-warn { color: var(--gold); font-size: 12px; }
.daily-tpl-initial { color: var(--green); font-weight: 600; }   /* rakuten-master-044X: 初回 = 月全体へ適用 */
/* rakuten-master-050: 売上（月別）月次 店舗データ（Server DB 正本）— 旧データ案内・取込プレビュー */
.msg-ok { margin: 8px 0; padding: 8px 10px; border-radius: 7px; background: rgba(22, 133, 74, 0.10); color: #14663a; font-size: 12.5px; line-height: 1.6; }
.msg-error { margin: 8px 0; padding: 8px 10px; border-radius: 7px; background: rgba(191, 31, 46, 0.08); color: #9a1f2a; font-size: 12.5px; line-height: 1.6; }
.monthly-store-legacy { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--gold); background: rgba(184, 120, 0, 0.08); border-radius: 8px; font-size: 12.5px; line-height: 1.7; }
.monthly-store-legacy.is-synced { border-color: var(--rule); background: var(--bg); color: var(--ink-3); }
.monthly-store-legacy .btn-small { margin-left: 6px; }
.rk-monthly-store-card { width: min(920px, calc(100vw - 32px)); text-align: left; }
.monthly-store-preview-scroll { max-height: 46vh; overflow: auto; margin: 8px 0; }
.monthly-store-preview td { white-space: nowrap; }
.monthly-store-changed td:last-child { color: var(--gold); font-weight: 700; }
.monthly-store-new td:last-child { color: var(--green); }
.monthly-store-same td:last-child { color: var(--ink-3); }
.monthly-store-replace-warn { margin: 6px 0; padding: 8px 10px; border-radius: 7px; background: rgba(191, 31, 46, 0.08); color: #9a1f2a; font-size: 12.5px; }
.monthly-store-replace-check { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; font-size: 12.5px; min-height: 32px; }
.monthly-store-replace-check input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
/* rakuten-master-044Y: 選択した店舗だけ・保護された日の内訳・日別の詳細 */
.daily-tpl-preserve-note { margin: 6px 0 8px; padding: 8px 10px; background: var(--bg); border-radius: 7px; font-size: 12px; line-height: 1.7; }
.daily-tpl-kept { color: var(--gold); font-weight: 600; }
.daily-tpl-detail-btn { margin-left: 6px; }
.daily-tpl-detail-row > td { background: var(--bg); padding: 8px; }
.daily-tpl-day-table { font-size: 11.5px; }
.daily-tpl-day-table th, .daily-tpl-day-table td { white-space: nowrap; }
.daily-tpl-detail-row .tbl-scroll { max-height: 320px; overflow: auto; }
.daily-tpl-act-PRESERVE_MANUAL td, .daily-tpl-act-PRESERVE_CUSTOM td, .daily-tpl-act-PRESERVE_AUTO td { color: var(--gold); }
.daily-tpl-act-NO_CHANGE td, .daily-tpl-act-PAST_FIXED td { color: var(--ink-3); }
.daily-tpl-preview-table td { white-space: normal; }
.daily-tpl-preview .tbl-scroll { max-height: 280px; overflow: auto; margin: 8px 0; }
.daily-tpl-bulk-controls { margin-top: 10px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.daily-tpl-mode { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; font-size: 12.5px; }
.daily-tpl-mode label { display: flex; align-items: flex-start; gap: 6px; min-height: 28px; cursor: pointer; }
.daily-tpl-mode input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 18px; }
.daily-tpl-check { width: 20px; height: 20px; }
.daily-tpl-bulk-preview, .daily-tpl-bulk-result { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; font-size: 12.5px; }
.daily-tpl-bulk-table td { white-space: normal; }
.daily-tpl-dist-table td:nth-child(2), .daily-tpl-bulk-table td:first-child { white-space: nowrap; }
.daily-tpl-bulk-apply td:nth-child(2) { color: var(--green); }
.daily-tpl-bulk-protected td:nth-child(2), .daily-tpl-bulk-past_month td:nth-child(2) { color: var(--gold); }
.daily-tpl-bulk-failed td:nth-child(2), .daily-tpl-bulk-not_found td:nth-child(2) { color: var(--red); }
.daily-tpl-bulk-result ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.7; }

/* 375px: rakuten-master-050（追加修正）— PC とまったく同じ 13 列・同じ順番を出し、画面に収まらない分は
   日別実績テーブルの中だけを左右スワイプして見る（列を display:none で消さない・body は横に伸びない）。
   ・.daily-sales-table-scroll（.tbl-scroll）だけが overflow-x: auto。iPhone Safari 用に -webkit-overflow-scrolling: touch
   ・表は max-content 幅（min-width 100%）。375px に無理に圧縮して文字を潰さない
   ・「日付」列は左に sticky。右端の前日比・前年同日比を見ているときも何日の行か分かる
   配分エディタは 1 列・入力は 30px 以上 */
@media (max-width: 640px) {
  .daily-sales-table-card { padding: 14px 10px; }
  .daily-sales-table-card .daily-sales-table-scroll { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .daily-sales-table { width: max-content; min-width: 100%; }
  .daily-sales-table td, .daily-sales-table th { padding: 8px 8px; font-size: 12px; white-space: nowrap; }
  .daily-sales-table th { font-size: 10px; }
  /* 日付列を左へ固定（背景を必ず塗る。行の状態別の背景も引き継ぐ） */
  .daily-sales-table th:first-child, .daily-sales-table td:first-child { position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--rule); }
  .daily-sales-table td:first-child { z-index: 2; font-weight: 700; }
  .daily-sales-table th:first-child { z-index: 3; background: #f7f7f5; }
  .daily-sales-table tr.is-today td:first-child, .daily-sales-table tr.is-today:hover td:first-child { background: var(--blue-soft); }
  .daily-sales-table tr:hover td:first-child { background: var(--bg); }
  .daily-sales-table .daily-sales-event-chip { max-width: 6em; font-size: 9.5px; padding: 0 4px; }
  .daily-sales-table .daily-sales-today-tag, .daily-sales-table .daily-sales-inprogress-tag { font-size: 9.5px; padding: 0 4px; }
  .daily-sales-compare-chips { font-size: 12px; gap: 6px 8px; }
  .daily-alloc-grid { grid-template-columns: 1fr; gap: 2px; }
  .daily-alloc-row { grid-template-columns: 70px 92px minmax(0, 1fr); }
  .daily-alloc-pct input { width: 64px; min-height: 32px; }
  .daily-alloc-label { min-height: 32px; }
  .daily-alloc-actions .btn-small, .daily-alloc-buttons .btn-small { min-height: 32px; }
  .daily-alloc-auto-box { font-size: 12px; padding: 8px 10px; }
  .daily-alloc-memo { min-height: 32px; flex-basis: 100%; }
  .daily-alloc-reset-day { min-height: 32px; }
  .daily-tpl-preview-grid { grid-template-columns: 1fr 1fr; }
  .daily-tpl-admin-card .btn-small, .daily-tpl-file { min-height: 32px; }
  .rk-alloc-master-card { width: calc(100vw - 16px); padding: 12px; }
  .rk-monthly-store-card { width: calc(100vw - 16px); padding: 12px; }
  .monthly-store-preview-scroll { max-height: 40vh; }
  .monthly-store-legacy .btn-small { display: block; margin: 8px 0 0; min-height: 36px; width: 100%; }
  .daily-tpl-mode label { min-height: 32px; }
  .daily-tpl-check { width: 24px; height: 24px; }
  .daily-tpl-detail-btn { display: block; margin: 4px 0 0; min-height: 32px; }
  .daily-tpl-detail-row .tbl-scroll { max-height: 260px; }
  .daily-alloc-reason { font-size: 10.5px; }
  .daily-sales-today-target-row { gap: 4px 12px; font-size: 12px; }
}

/* ============================================================================
   rakuten-master-039R: RPP広告 運用判断ダッシュボード（KPI / 状態ラベル / フィルター / 商品別一覧 / 詳細行）
   ============================================================================ */
.rpp-toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.rpp-toolbar-left, .rpp-toolbar-right { display: flex; flex-direction: column; gap: 6px; }
.rpp-toolbar-label { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.rpp-scope-select, .rpp-sort-select { min-height: 36px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); font-size: 13px; color: var(--ink); max-width: 100%; }
.rpp-period-note, .rpp-upload-note { font-size: 11.5px; color: var(--ink-3); }
.rpp-upload-btn { min-height: 36px; }
.rpp-message { background: var(--green-soft); border: 1px solid var(--green); color: var(--ink); border-radius: 7px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 12px; }
.rpp-error { background: var(--red-soft); border: 1px solid var(--red); color: var(--red); border-radius: 7px; padding: 10px 12px; font-size: 13px; }
.rpp-loading { padding: 24px; color: var(--ink-3); font-size: 13px; }
.rpp-kpi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.rpp-summary { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: -8px 0 14px; font-size: 12px; color: var(--ink-2); }
.rpp-summary-item { display: inline-flex; align-items: center; gap: 4px; }
.rpp-status { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; white-space: nowrap; background: var(--ink-6, #f2f2f2); color: var(--ink-2); }
.rpp-status b { font-weight: 700; }
.rpp-status-strengthen { background: var(--green-soft); color: var(--green); }
.rpp-status-continue { background: #F0F0F0; color: var(--ink-3); }
.rpp-status-cvr_improve, .rpp-status-ctr_improve, .rpp-status-cpc_review, .rpp-status-stock_check { background: var(--gold-soft); color: var(--gold); }
.rpp-status-stop_candidate { background: var(--red-soft); color: var(--red); }
.rpp-status-insufficient { background: #F0F0F0; color: var(--ink-4); }
.rpp-filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rpp-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rpp-filter-chip { min-height: 32px; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: 12px; cursor: pointer; }
.rpp-filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.rpp-filter-count { font-variant-numeric: tabular-nums; opacity: .8; margin-left: 2px; }
.rpp-card .card-sub { margin-bottom: 8px; }
.rpp-table td { vertical-align: middle; }
.rpp-table td.rpp-col-product { white-space: normal; min-width: 220px; max-width: 340px; }
.rpp-product { display: flex; align-items: center; gap: 8px; cursor: pointer; border-radius: 6px; }
.rpp-product:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rpp-thumb { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 6px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.rpp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rpp-thumb span { font-size: 10px; color: var(--ink-4); }
.rpp-cards { display: none; }
.rpp-card-item { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.rpp-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rpp-card-head .rpp-product { flex: 1 1 auto; min-width: 0; }
.rpp-card-head .rpp-status { flex: 0 0 auto; margin-top: 2px; }
.rpp-card-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-top: 8px; font-size: 13px; }
.rpp-card-metrics > div { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; border-bottom: 1px dashed var(--rule); padding: 3px 0; }
.rpp-card-k { font-size: 11px; color: var(--ink-4); }
.rpp-card-metrics b { font-variant-numeric: tabular-nums; }
.rpp-card-toggle { width: 100%; min-height: 36px; margin-top: 8px; border: 1px solid var(--rule); border-radius: 7px; background: var(--bg); color: var(--ink-2); font-size: 12px; cursor: pointer; text-align: left; padding: 0 10px; }
.rpp-card-item .rpp-detail { margin-top: 8px; }
.rpp-product-text { min-width: 0; }
.rpp-product-title { font-size: 12.5px; color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rpp-product-code { font-size: 11px; color: var(--ink-4); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.rpp-toggle-btn { min-width: 32px; min-height: 32px; border: 1px solid var(--rule); background: var(--surface); border-radius: 6px; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.rpp-table td.rpp-col-toggle { width: 40px; text-align: center; padding-left: 4px; padding-right: 4px; }
.rpp-row-open td { background: var(--bg); }
.rpp-detail-row td { white-space: normal; background: var(--bg); padding: 12px 14px 14px; }
.rpp-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin-bottom: 10px; }
.rpp-detail-k { font-size: 10.5px; color: var(--ink-4); }
.rpp-detail-v { font-size: 12.5px; color: var(--ink); }
.rpp-detail-reasons { font-size: 12px; color: var(--ink-2); }
.rpp-detail-reasons ul { margin: 4px 0 0; padding-left: 18px; line-height: 1.7; }
.rpp-detail-reasons .rpp-note { color: var(--ink-3); }
.rpp-detail-profit-note { font-size: 11px; color: var(--ink-4); margin-top: 6px; }
.rpp-muted { color: var(--ink-4); font-size: 12px; }
.rpp-empty .es-icon { font-size: 34px; }
/* ── rakuten-master-049A: コンサルタント型ダッシュボード（総合診断 / ROAS帯別 / 優先順位 / 散布図） ──
   グラフは .chart-wrap の固定高さで描く（canvas を横スクロールさせない）。375px では散布図を出さない。 */
.rpp-diagnosis { border-left: 4px solid var(--ink-4); }
.rpp-diagnosis.rpp-diag-good { border-left-color: #1a7f37; }
.rpp-diagnosis.rpp-diag-caution { border-left-color: #c08a20; }
.rpp-diagnosis.rpp-diag-bad { border-left-color: var(--c-urgent); }
.rpp-diag-head { display: flex; align-items: center; gap: 10px; }
.rpp-diag-head .card-title { margin: 0; }
.rpp-diag-badge { flex: 0 0 auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; background: var(--ink-4); }
.rpp-diag-good .rpp-diag-badge { background: #1a7f37; }
.rpp-diag-caution .rpp-diag-badge { background: #c08a20; }
.rpp-diag-bad .rpp-diag-badge { background: var(--c-urgent); }
.rpp-diag-lead { margin: 10px 0 6px; font-size: 15px; font-weight: 700; line-height: 1.6; }
.rpp-diag-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }
.rpp-diag-note { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: #fff9ec; border: 1px solid #f0dca8; font-size: 12px; line-height: 1.7; }
.rpp-chart-grid { align-items: start; }
.rpp-analysis-card { margin-bottom: 0; }
.rpp-chart-wrap { margin-top: 10px; }
.rpp-chart-band { height: 190px; }
.rpp-chart-costsales { height: 260px; }
/* rakuten-master-049A1: 列数を固定しない。widthに応じて折り返すだけにして、どの幅でも
   「PC 幅のまま横へ伸びる」状態も「空トラックで要素が痩せる」状態も作らない */
.rpp-band-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rpp-band-card { flex: 1 1 190px; min-width: 0; border: 1px solid var(--rule); border-left-width: 4px; border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.rpp-band-good { border-left-color: #1a7f37; }
.rpp-band-warn { border-left-color: #c08a20; }
.rpp-band-low { border-left-color: #dd6b20; }
.rpp-band-bad { border-left-color: #bf1f2e; }
.rpp-band-unknown { border-left-color: var(--ink-4); }
.rpp-band-label { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.rpp-band-count { font-size: 20px; font-weight: 800; line-height: 1.2; margin: 2px 0 4px; }
.rpp-band-count span { font-size: 11px; font-weight: 700; color: var(--ink-4); }
.rpp-band-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; line-height: 1.7; }
.rpp-band-kv span { color: var(--ink-4); }
.rpp-prio-list { display: grid; gap: 10px; margin-top: 10px; }
.rpp-prio-item { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.rpp-prio-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rpp-prio-rank { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--ink-6, #f2f2f2); color: var(--ink-2, #333); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.rpp-prio-title { flex: 1 1 200px; min-width: 0; font-size: 13px; line-height: 1.5; }
.rpp-prio-title b { display: block; white-space: normal; overflow-wrap: anywhere; }
.rpp-prio-code { font-size: 11px; color: var(--ink-4); }
.rpp-prio-metrics { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 8px 0; }
.rpp-prio-metrics > div { flex: 1 1 92px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rpp-prio-metrics span { font-size: 10.5px; color: var(--ink-4); }
.rpp-prio-metrics b { font-size: 13px; }
.rpp-prio-advice { display: grid; grid-template-columns: minmax(0, 8em) minmax(0, 1fr); gap: 2px 10px; margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--ink-6, #f7f7f5); font-size: 12px; line-height: 1.7; }
.rpp-prio-advice dt { font-weight: 700; color: var(--ink-3); }
.rpp-prio-advice dd { margin: 0; overflow-wrap: anywhere; }
/* rakuten-master-049A1: 641〜900px の compact 版。
   iPhone Safari が「デスクトップ用Webサイト」/ページズームで 980px 相当の layout viewport になると
   max-width:640px の mobile CSS は一切発火しない。その帯でも 049A のブロックが PC 幅のまま横へ伸びないよう、
   既存 .chart-grid（900px で 1 列）と同じ境界で縦積みにし、散布図は出さない（生成もしない = JS 側の
   RPP_MOBILE_QUERY と同じ 900px）。375px 用の調整は下の 640px ブロックが引き続き勝つ。 */
@media (max-width: 900px) {
  .rpp-pc-only { display: none; }
  .rpp-chart-grid { grid-template-columns: 1fr; }
  .rpp-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .rpp-chart-band { height: 180px; }
  .rpp-chart-costsales { height: 230px; }
  .rpp-prio-metrics > div { flex-basis: 140px; }
  .rpp-diag-lead { font-size: 14px; }
  .rpp-prio-advice { grid-template-columns: 1fr; }
  .rpp-prio-advice dt { margin-top: 4px; }
}
@media (max-width: 640px) {
  .rpp-toolbar { flex-direction: column; }
  .rpp-scope-select { width: 100%; }
  .rpp-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rpp-tbl-scroll { display: none; }
  .rpp-cards { display: grid; gap: 10px; }
  .rpp-thumb { width: 40px; height: 40px; flex-basis: 40px; }
  .rpp-product-title { font-size: 13px; }   /* rakuten-master-049A1: 実機で読めるサイズへ（11.5px は小さすぎた） */
  .rpp-detail-grid { grid-template-columns: 1fr; }
  .rpp-filter-chip { min-height: 32px; }
  /* rakuten-master-049A / 049A1: 375px の調整。散布図の非表示・縦積み・折り返しは 900px ブロックで済んでいるので、
     ここは電話の幅でだけ効かせたい値（帯カード 1 列・グラフ高さ）に絞る */
  .rpp-band-card { flex-basis: 100%; }
  .rpp-prio-metrics > div { flex-basis: 84px; }   /* 375px の指標欄は 3 列（コンテナ 283px に 84*3 + gap*2 が収まる） */
  .rpp-chart-band { height: 170px; }
  .rpp-chart-costsales { height: 220px; }
  .rpp-prio-advice { gap: 0 0; }
}

/* rakuten-master-052B1: tenant sale runtime v2（sidecar）パネル。PC / 375px 共通（flex-wrap・表は .tbl-scroll） */
.tsv2-card { border-left: 4px solid var(--gold, #C08A20); }
.tsv2-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.tsv2-tab { border: 1px solid var(--rule, #ddd); background: #fff; border-radius: 6px; padding: 6px 10px; font-size: 12.5px; cursor: pointer; }
.tsv2-tab.active { background: var(--gold, #C08A20); color: #fff; border-color: var(--gold, #C08A20); }
.tsv2-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 8px 0; }
.tsv2-field { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink-2, #333); flex: 1 1 220px; min-width: 0; }
.tsv2-field.tsv2-small { flex: 0 1 160px; }
.tsv2-field input, .tsv2-field select, .tsv2-field textarea { font-size: 13px; padding: 6px 8px; border: 1px solid var(--rule, #ddd); border-radius: 6px; background: #fff; min-width: 0; }
.tsv2-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-right: 6px; }
.tsv2-legend { font-size: 11.5px; color: var(--ink-2, #333); margin-right: 4px; }
.tsv2-sub { margin: 12px 0 6px; font-size: 13px; }
.tsv2-selected td { background: rgba(192,138,32,0.08); }
@media (max-width: 640px) { .tsv2-field, .tsv2-field.tsv2-small { flex: 1 1 100%; } .tsv2-row button { width: 100%; } }

/* rakuten-master-053A: 商品マスターの「RMS最終同期」スタンプ。在庫数がいつ時点の値かを常に見せる */
.pm-sync-stamp { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2, #666); margin-bottom: 8px; flex-wrap: wrap; }
.pm-sync-stamp b { color: var(--ink, #222); font-weight: 600; }
.pm-sync-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--ink-4, #bbb); }
.pm-sync-stamp.is-fresh .pm-sync-dot { background: var(--ok, #1b6b2a); }
.pm-sync-stamp.is-delayed .pm-sync-dot { background: var(--warn, #8a5300); }
.pm-sync-stamp.is-delayed { color: var(--warn, #8a5300); }
.pm-sync-stamp.is-stale .pm-sync-dot, .pm-sync-stamp.is-never .pm-sync-dot { background: var(--danger, #b3261e); }
.pm-sync-stamp.is-stale, .pm-sync-stamp.is-never { color: var(--danger, #b3261e); }
@media (max-width: 640px) { .pm-sync-stamp { font-size: 11.5px; } }

/* rakuten-master-111: 外部連携（Yahoo!ショッピング）モーダルの公開鍵入力（PEM の複数行） */
.rk-provider-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.4; resize: vertical; min-height: 84px; }

/* ============================================================================
   rakuten-master-117: 売上（日別）/（月別）のモール切替（楽天 / Yahoo!ショッピング）
   ・選択状態は色だけで表さない（aria-selected + 枠線 + 太字 + 下線）
   ・375px でも横スクロールを起こさない。タブは折り返し、タップ領域は 40px 以上
   ・日別推移テーブルは既存の .daily-sales-table-scroll に相乗りする（列は隠さない）
   ============================================================================ */
.sales-provider-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.sales-provider-tabs[hidden] { display: none; }
.sales-provider-tab {
  appearance: none; border: 1px solid var(--rule); background: var(--bg);
  color: var(--ink-2); border-radius: var(--radius); padding: 9px 16px;
  font-size: 13px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.sales-provider-tab[aria-selected="true"] {
  background: var(--surface); color: var(--ink); border-color: var(--ink-3);
  font-weight: 700; box-shadow: inset 0 -2px 0 var(--ink-3);
}
.sales-provider-tab:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }
.sales-provider-tab.is-unreleased { opacity: .72; }
.sales-provider-badge {
  display: inline-block; padding: 0 5px; font-size: 9.5px; line-height: 15px; font-weight: 700;
  letter-spacing: .04em; color: #fff; background: var(--gold); border-radius: 999px;
}

/* 同期状態・未接続 / 未同期の案内（売上の数字とは別の行に置く） */
.sales-provider-sync { font-size: 12px; color: var(--ink-3, #888); margin: 0 0 10px; }
.sales-provider-note {
  font-size: 12.5px; color: var(--ink-2, #666); background: var(--bg);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px;
}

/*
 * rakuten-master-124: DEMO 表示。実売上と見間違えないよう、バッジは警告色・注意文は帯で常時表示する。
 * 楽天市場のタブ / 画面には一切適用されない（DEMO 中の provider にだけ is-demo が付く）。
 */
.sales-provider-badge.is-demo { background: var(--warn, #b45309); color: #fff; }
.sales-provider-tab.is-demo { border-color: var(--warn, #b45309); }
.sales-provider-tab.is-demo[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--warn, #b45309); }
.sales-provider-demo {
  border: 1px solid var(--warn, #b45309); border-left-width: 4px; border-radius: var(--radius);
  background: var(--warn-bg, #fff7ed); padding: 10px 12px; margin: 0 0 12px;
}
.sales-provider-demo-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sales-provider-demo-title { font-size: 12.5px; font-weight: 700; color: var(--warn, #8a5300); }
.sales-provider-demo-body { font-size: 12.5px; line-height: 1.7; color: var(--ink-2, #666); overflow-wrap: anywhere; }

/* 売上の集計基準（既定は閉じている。画面を説明文で埋めない） */
.sales-provider-def { margin: 12px 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.sales-provider-def > summary { cursor: pointer; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); min-height: 40px; display: flex; align-items: center; }
.sales-provider-def > summary:focus-visible { outline: 2px solid var(--ink-3); outline-offset: -2px; }
.sales-provider-def-list { margin: 0; padding: 0 14px 12px 30px; font-size: 12.5px; color: var(--ink-2); line-height: 1.8; }
.sales-provider-def-warn { color: var(--warn, #8a5300); font-weight: 600; }

@media (max-width: 640px) {
  .sales-provider-tabs { gap: 6px; margin-bottom: 10px; }
  .sales-provider-tab { flex: 1 1 auto; justify-content: center; padding: 9px 10px; font-size: 12.5px; }
  .sales-provider-def-list { padding-left: 24px; font-size: 12px; }
  .provider-sales-table td, .provider-sales-table th { white-space: nowrap; }
  /* rakuten-master-124: 375px でもバッジが見切れず、注意文が折り返して収まるようにする */
  .sales-provider-demo { padding: 9px 10px; }
  .sales-provider-demo-body { font-size: 12px; }
  .sales-provider-demo-title { font-size: 12px; }
}

/* ==========================================================================
   rakuten-master-134: 全モールダッシュボード（🏬 全モール）
   外部ライブラリを増やさず、既存の kpi-card / card / data-table に乗せる。
   状態は色だけでなく必ず文字（バッジ）でも示す。
   ========================================================================== */
/* rakuten-master-142: 見出し行。売上（日別）の .daily-sales-header と同じ並べ方（見出し左・年月と状態は右。狭幅では下へ折り返す）。
   幅と左右余白は親の .container（正規コンテナ）が決めるので、ここでは位置を指定しない */
.allmall-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.allmall-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* rakuten-master-142: KPI は常に 4 枚（売上 / 注文数 / 商品数量 / 客単価）。共通の .kpi-grid は auto-fill のため、
   広い画面では空の track が右に余り、4 枚が左へ固まっていた。利用可能幅を 4 等分する（DEMO 参考枠の 4 枚も同じ） */
.allmall-kpi, .allmall-demo-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.allmall-status { min-height: 20px; }

.allmall-incomplete {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--gold, #B8860B); border-radius: var(--radius, 8px);
  background: #FFF8E6; color: #7A5B00; padding: 8px 12px; margin-bottom: 10px;
  font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere;
}
.allmall-included { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; overflow-wrap: anywhere; }

/* モール別カード */
/* rakuten-master-142: auto-fill → auto-fit。空の track を作らず、あるカードで利用可能幅を使い切る（2 モールなら 2 列で等幅）。
   モール数は応答で決まるので列数は固定しない。align-items の既定（stretch）で同じ行のカードは高さがそろう */
.allmall-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-bottom: 20px; }
.allmall-card { border: 1px solid var(--rule); border-radius: var(--radius, 8px); background: var(--surface); padding: 12px 14px; }
.allmall-card.is-demo { border-style: dashed; border-color: var(--gold, #B8860B); background: #FFFDF7; }
.allmall-card.is-error { border-color: var(--red-mid, #E8929A); background: #FEF7F8; }
.allmall-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.allmall-card-name { font-size: 14px; font-weight: 700; color: var(--ink-1); overflow-wrap: anywhere; }
.allmall-card-status { font-size: 11.5px; color: var(--ink-3); margin-bottom: 8px; overflow-wrap: anywhere; }
.allmall-card-note { font-size: 12px; color: var(--ink-3); padding: 6px 0; overflow-wrap: anywhere; }
.allmall-card-figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px; }
.allmall-card-figures > div { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.allmall-fig-label { font-size: 11.5px; color: var(--ink-3); }
.allmall-fig-value { font-size: 13.5px; font-weight: 700; color: var(--ink-1); }

/* 状態バッジ（色に加えて必ず文字で示す） */
.allmall-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.allmall-badge.is-actual { background: var(--green-soft, #E6F4ED); color: var(--green, #1A7A45); border-color: var(--green, #1A7A45); }
.allmall-badge.is-zero { background: #F2F2F2; color: var(--ink-3); border-color: var(--rule); }
.allmall-badge.is-unsynced { background: #F2F2F2; color: var(--ink-3); border-color: var(--rule); }
.allmall-badge.is-disconnected { background: #F2F2F2; color: var(--ink-3); border-color: var(--rule); }
.allmall-badge.is-demo { background: #FFF3D6; color: #7A5B00; border-color: var(--gold, #B8860B); }
.allmall-badge.is-error { background: var(--red-soft, #F5E6E8); color: var(--red, #BF1F2E); border-color: var(--red-mid, #E8929A); }

/* 集計基準（折りたたみ） */
.allmall-def { margin-top: 8px; }
.allmall-def summary { font-size: 11.5px; color: var(--ink-3); cursor: pointer; }
.allmall-def-body { padding: 6px 0 0; font-size: 11.5px; color: var(--ink-2, #3C3C3C); overflow-wrap: anywhere; }
.allmall-def-sub { color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }

/* 日別推移（CSS だけの積み上げ棒。ライブラリを追加しない） */
.allmall-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 10px; font-size: 11.5px; color: var(--ink-3); }
.allmall-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.allmall-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.allmall-swatch.s0, .allmall-bar-seg.s0, .allmall-share-fill.s0 { background: var(--red, #BF1F2E); }
.allmall-swatch.s1, .allmall-bar-seg.s1, .allmall-share-fill.s1 { background: var(--blue, #1F5FBF); }
.allmall-swatch.s2, .allmall-bar-seg.s2, .allmall-share-fill.s2 { background: var(--green, #1A7A45); }
.allmall-swatch.s3, .allmall-bar-seg.s3, .allmall-share-fill.s3 { background: #8A5CBF; }
.allmall-chart {
  display: flex; align-items: flex-end; gap: 2px; height: 180px;
  padding: 8px 0 0; border-bottom: 1px solid var(--rule); overflow: hidden;
}
.allmall-bar-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.allmall-bar { width: 100%; max-width: 22px; display: flex; flex-direction: column-reverse; border-radius: 2px 2px 0 0; overflow: hidden; min-height: 1px; }
.allmall-bar-seg { display: block; width: 100%; }
.allmall-bar-label { font-size: 9px; color: var(--ink-4, #8A8A8A); margin-top: 2px; }

/* 構成比（横棒） */
.allmall-share-row { display: grid; grid-template-columns: minmax(96px, 160px) 1fr 56px; align-items: center; gap: 8px; margin: 6px 0; }
.allmall-share-name { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-1); min-width: 0; overflow-wrap: anywhere; }
.allmall-share-track { background: #F2F2F2; border-radius: 999px; height: 12px; overflow: hidden; }
.allmall-share-fill { height: 100%; border-radius: 999px; }
.allmall-share-value { font-size: 12.5px; font-weight: 700; text-align: right; color: var(--ink-1); }

/* DEMO 参考枠（実データと同じ配色にしない） */
.allmall-demo-card { border: 2px dashed var(--gold, #B8860B); background: #FFFDF7; }
.allmall-demo-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #7A5B00; overflow-wrap: anywhere; }
.allmall-demo-kpi .kpi-card { background: #FFFDF7; border-style: dashed; }
.allmall-demo-kpi .kpi-value { color: #7A5B00; }

/* warnings */
.allmall-warnings ul { margin: 6px 0 0; padding-left: 20px; }
.allmall-warnings li { font-size: 12.5px; color: var(--ink-2, #3C3C3C); margin: 3px 0; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .allmall-head-right { width: 100%; }
  .allmall-head-right .daily-sales-month-select { flex: 1 1 auto; min-width: 0; }
  /* KPI は 2×2（ページ全体を横スクロールさせない） */
  .allmall-kpi, .allmall-demo-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* モールカードは縦積み */
  .allmall-cards { grid-template-columns: minmax(0, 1fr); }
  .allmall-chart { height: 140px; }
  .allmall-bar-label { font-size: 8px; }
  /* 構成比は縦並び（名前 → 棒 → 数値） */
  .allmall-share-row { grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 10px 0; }
  .allmall-share-value { text-align: left; }
  /* 表だけは内側で横スクロール（ページ全体はスクロールさせない） */
  .allmall-table { min-width: 560px; }
}

/* ═══════════ rakuten-master-167: AI販促 Campaign（一覧・編集状態・商品選択） ═══════════ */
.cp-card .sr-only, .cp-table .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cp-list-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.cp-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); min-width: 0; flex: 1 1 160px; }
.cp-field input, .cp-field select { width: 100%; min-width: 0; box-sizing: border-box; }
.cp-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cp-table-wrap { width: 100%; overflow-x: auto; }
.cp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cp-table th { text-align: left; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; color: var(--ink-2); }
.cp-table td { padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; color: var(--ink-2); }
.cp-table tr.is-current td { background: #F4F8FF; }
.cp-col-name { font-weight: 600; min-width: 140px; overflow-wrap: anywhere; }
.cp-col-actions { white-space: nowrap; text-align: right; }
.cp-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; white-space: nowrap; }
.cp-badge.is-draft { background: #E8F5E9; color: #1B6B2A; }
.cp-badge.is-archived { background: #EEEEEE; color: #555555; }
.cp-empty { color: var(--ink-2); font-size: 12.5px; margin: 8px 0; }
.cp-error { color: #B3261E; font-size: 12.5px; margin: 8px 0; overflow-wrap: anywhere; }
.cp-warn { color: #8A5300; }
.cp-notice { background: #FFF8E1; border: 1px solid #F3D48A; border-radius: 6px; padding: 6px 10px; font-size: 12.5px; margin: 6px 0; overflow-wrap: anywhere; }
.cp-more { margin-top: 8px; }
.cp-editor-bar { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: #FAFAFA; }
.cp-editor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cp-editor-title { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.cp-save-state { font-size: 12.5px; padding: 2px 8px; border-radius: 10px; background: #EEEEEE; overflow-wrap: anywhere; }
.cp-save-state.is-dirty { background: #FFF4E0; color: #8A5300; }
.cp-save-state.is-saving { background: #E3F2FD; color: #0D47A1; }
.cp-save-state.is-saved { background: #E8F5E9; color: #1B6B2A; }
.cp-save-state.is-error { background: #FDECEA; color: #B3261E; }
.cp-save-state.is-archived { background: #EEEEEE; color: #555555; }
.cp-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cp-danger { color: #B3261E; }
/* rakuten-master-203: AI 販促 Content（版管理）カードと dialog。状態・配信可否・差分は色だけでなく文字で示す */
.pc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 8px 0; }
.pc-campaign { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
.pc-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.pc-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.pc-table .pc-col-label { overflow-wrap: anywhere; min-width: 120px; }
.pc-table .pc-col-check { width: 28px; }
.pc-row.is-archived td { color: var(--ink-3); }
.pc-status.is-selected { background: #E3F2FD; color: #0D47A1; }
.pc-status.is-pending { background: #FFF4E0; color: #8A5300; }
.pc-status.is-approved { background: #E8F5E9; color: #1B6B2A; }
.pc-status.is-rejected { background: #FDECEA; color: #B3261E; }
.pc-deliv { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 10px; white-space: nowrap; border: 1px solid currentColor; }
.pc-deliv.is-ok { color: #1B6B2A; background: #E8F5E9; }
.pc-deliv.is-ng { color: #B3261E; background: #FDECEA; }
.pc-deliv.is-unknown { color: var(--ink-3); }
.pc-deliv-count { font-size: 11.5px; color: var(--ink-3); margin-left: 4px; }
.pc-reasons { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.pc-modal { width: min(920px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; margin: 16px auto; text-align: left; background: var(--surface, #fff); border-radius: 12px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); box-sizing: border-box; }
.pc-dialog-body { font-size: 13px; }
.pc-info { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 4px 10px; margin: 0 0 10px; font-size: 12.5px; }
.pc-info dt { color: var(--ink-3); } .pc-info dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.pc-section { margin-top: 12px; } .pc-section h4 { margin: 0 0 6px; font-size: 13px; }
.pc-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-height: 320px; overflow: auto; margin: 0; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: #FAFAFA; font: 13px/1.6 inherit; font-family: inherit; }
.pc-meta { font-size: 12.5px; color: var(--ink-2); margin: 0 0 8px; overflow-wrap: anywhere; }
.pc-confirm-text { font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
.pc-actions { justify-content: flex-start; }
.pc-compare-pick { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin-top: 8px; font-size: 12.5px; }
.pc-compare-pick label { display: flex; flex-direction: column; gap: 3px; }
.pc-cmp-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.pc-cmp-ref { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; overflow-wrap: anywhere; }
.pc-cmp-tools { margin: 6px 0; }
.pc-diff { border: 1px solid var(--rule); border-radius: 8px; max-height: 60vh; overflow: auto; font-size: 13px; }
.pc-diff-line { display: flex; gap: 8px; align-items: flex-start; padding: 2px 8px; border-bottom: 1px solid #F0F0F0; }
.pc-diff-line:last-child { border-bottom: none; }
.pc-diff-tag { flex: none; width: 58px; font-size: 11px; font-weight: 700; text-align: center; border-radius: 6px; padding: 1px 0; border: 1px solid currentColor; }
.pc-diff-text { flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.pc-diff-line.is-add { background: #E8F5E9; } .pc-diff-line.is-add .pc-diff-tag { color: #1B6B2A; }
.pc-diff-line.is-del { background: #FDECEA; } .pc-diff-line.is-del .pc-diff-tag { color: #B3261E; } .pc-diff-line.is-del .pc-diff-text { text-decoration: line-through; text-decoration-color: rgba(179, 38, 30, .5); }
.pc-diff-line.is-equal .pc-diff-tag { color: var(--ink-3); }
[data-pc-action]:focus-visible { outline: 2px solid #2C5FB3; outline-offset: 2px; }
/* rakuten-master-206: 承認欄（理由・コメントは改行を保った文字・長い URL も折り返す） */
.pc-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.pc-subhead { margin: 10px 0 4px; font-size: 12.5px; color: var(--ink-2); }
.pc-approvals .pc-text { min-width: 160px; }
.pc-approval textarea, #pc-apv-comment { width: 100%; box-sizing: border-box; }
/* rakuten-master-207: AI 文章生成（入力は 2 列・長い欄は全幅・375px は 1 列） */
.pc-ai { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.pc-ai-head h4 { margin: 0 0 4px; font-size: 13.5px; }
.pc-ai-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.pc-ai-form .pc-ai-wide { grid-column: 1 / -1; }
.pc-ai-form textarea, .pc-ai-form select, .pc-ai-fields textarea, .pc-ai-fields input, .pc-ai-target input:not([type="radio"]), .pc-ai-target select { width: 100%; box-sizing: border-box; }
.pc-ai-target .pc-check { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.pc-ai-checks { border: 1px solid #F0C36D; background: #FFF8E6; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 12.5px; overflow-wrap: anywhere; }
.pc-ai-checks ul { margin: 4px 0; padding-left: 18px; }
.pc-ai-target { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 12px 8px; margin: 8px 0; min-width: 0; }
.pc-ai-target legend { font-size: 12.5px; font-weight: 600; padding: 0 4px; }
.pc-ai-facts { margin: 6px 0 8px; font-size: 12.5px; }
.pc-ai-facts summary { cursor: pointer; color: var(--ink-2); }
@media (max-width: 640px) {
  .pc-toolbar-actions { margin-left: 0; width: 100%; } .pc-toolbar-actions button { flex: 1 1 auto; min-height: 40px; }
  .pc-table thead { display: none; }
  .pc-table, .pc-table tbody, .pc-table tr, .pc-table td { display: block; width: 100%; box-sizing: border-box; }
  .pc-table tr { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
  .pc-table td { border-bottom: none; padding: 3px 0; overflow-wrap: anywhere; }
  .pc-table td[data-label]::before { content: attr(data-label) "："; color: var(--ink-2); font-size: 11.5px; margin-right: 4px; }
  .pc-table .pc-col-check { width: auto; } .pc-table .pc-col-check:empty { display: none; }
  .pc-table .cp-col-actions button { min-height: 40px; margin: 4px 4px 0 0; }
  .pc-modal { margin: 8px; padding: 12px; max-height: calc(100dvh - 16px); }   /* 100vh は使わない（iOS の URL バー伸縮で下端が切れる） */
  .pc-info { grid-template-columns: minmax(0, 1fr); gap: 2px; } .pc-info dt { font-size: 11.5px; }
  .pc-cmp-head { grid-template-columns: minmax(0, 1fr); }
  .pc-actions button { min-height: 40px; }
  .pc-approvals .pc-text { min-width: 0; }   /* rakuten-master-206 */
  .pc-ai-form { grid-template-columns: minmax(0, 1fr); }   /* rakuten-master-207 */
}
/* rakuten-master-208: 手順の案内・テンプレート原稿・画像プロンプト・配信前チェック・コピー（375px は 1 列・ボタンは押しやすい高さ） */
.pc-guide { margin: 10px 0; font-size: 12.5px; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 12px; }
.pc-guide summary { cursor: pointer; font-weight: 600; }
.pc-guide ol { margin: 6px 0; padding-left: 22px; } .pc-guide li { margin: 2px 0; }
.pc-tpl { margin: 12px 0; padding-top: 10px; border-top: 1px solid var(--rule); }
.pc-tpl-box { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 12px 8px; margin: 8px 0; min-width: 0; }
.pc-tpl-box legend { font-size: 12.5px; font-weight: 600; padding: 0 4px; }
.pc-tpl-box input:not([type="checkbox"]), .pc-tpl-box select, .pc-tpl-box textarea, #pc-img-prompt, #pc-pf-planned, #pc-pf-channel, #pc-tpl-planned2 { width: 100%; box-sizing: border-box; }
.pc-tpl-box label.pc-check { display: flex; gap: 6px; align-items: center; }
.pc-tpl-box input[type="checkbox"] { width: auto; margin: 0; }
.pc-verdict { border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 12.5px; overflow-wrap: anywhere; border: 1px solid var(--rule); }
.pc-verdict.is-ok { border-color: #8BC49A; background: #EEF8F0; }
.pc-verdict.is-warn { border-color: #F0C36D; background: #FFF8E6; }
.pc-verdict.is-ng { border-color: #E3A09A; background: #FDECEA; }
.pc-verdict-head { margin: 0 0 4px; }
.pc-verdict-items { margin: 4px 0; padding-left: 18px; }
.pc-verdict-items li { margin: 2px 0; white-space: pre-wrap; }
.pc-verdict-level { display: inline-block; font-size: 11px; font-weight: 700; border: 1px solid currentColor; border-radius: 6px; padding: 0 5px; margin-right: 6px; }
.pc-verdict-items li.is-ng .pc-verdict-level { color: #B3261E; } .pc-verdict-items li.is-warn .pc-verdict-level { color: #8A5300; }
.pc-copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; }
.pc-copy-label { font-size: 12.5px; color: var(--ink-2); min-width: 110px; }
.pc-copied { background: #EEF3FB; color: #2C5FB3; }
.pc-save-list { margin: 6px 0; padding-left: 18px; font-size: 12.5px; overflow-wrap: anywhere; }
#pc-img-prompt { font-family: inherit; line-height: 1.6; }
@media (max-width: 640px) {
  .pc-copy-row { flex-direction: column; align-items: stretch; } .pc-copy-row button { min-height: 40px; }
  .pc-copy-label { min-width: 0; }
  .pc-verdict { padding: 8px; }
  .pc-tpl-box { padding: 6px 8px 8px; }
}
#promo-input-card.is-readonly input, #promo-input-card.is-readonly select, #promo-input-card.is-readonly textarea { background: #F5F5F5; }
.cp-products { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 10px; }
.cp-product-search label { font-size: 12.5px; color: var(--ink-2); }
.cp-search-row { display: flex; gap: 8px; margin-top: 4px; }
.cp-search-row input { flex: 1 1 auto; min-width: 0; }
.cp-count { font-size: 12px; color: var(--ink-2); margin: 6px 0; }
.cp-product-list, .cp-selected-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.cp-product { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.cp-product.is-chosen { opacity: .75; }
.cp-pos { flex: 0 0 22px; font-size: 12px; color: var(--ink-2); text-align: right; padding-top: 2px; }
.cp-thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 6px; background: #F2F2F2; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 10px; color: var(--ink-2); }
.cp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cp-pinfo { flex: 1 1 auto; min-width: 0; }
.cp-ptitle { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.cp-pmeta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.cp-pmeta code { overflow-wrap: anywhere; }
.cp-note { display: inline-block; font-size: 11.5px; color: #8A5300; margin-right: 8px; }
.cp-pact { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cp-chosen { font-size: 12px; color: #1B6B2A; }
.cp-selected-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.cp-template-note { margin-top: 8px; }

@media (max-width: 640px) {
  .cp-toolbar-actions { margin-left: 0; width: 100%; }
  .cp-toolbar-actions button { flex: 1 1 auto; }
  .cp-products { grid-template-columns: minmax(0, 1fr); }
  /* 一覧は 1 件 1 カード（ページ全体の横スクロールを作らない） */
  .cp-table thead { display: none; }
  .cp-table, .cp-table tbody, .cp-table tr, .cp-table td { display: block; width: 100%; box-sizing: border-box; }
  .cp-table tr { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
  .cp-table td { border-bottom: none; padding: 3px 0; overflow-wrap: anywhere; }
  .cp-table td[data-label]::before { content: attr(data-label) "："; color: var(--ink-2); font-size: 11.5px; margin-right: 4px; }
  .cp-col-actions { text-align: left; white-space: normal; }
  .cp-col-actions button { margin-top: 4px; }
}

/* ============================================================
   レビュー特典発送管理（rakuten-master-181）
   ------------------------------------------------------------
   .rb- プレフィックスで分離。375px は一覧を 1 件 1 カード（横スクロールを作らない）。
   ============================================================ */
.rb-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.rb-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rb-reload-status { font-size: 12px; color: var(--ink-3); }
.rb-reload-status.is-error { color: #B3261E; }
.rb-feature-off { padding: 14px; border: 1px solid var(--rule); border-radius: var(--radius, 8px); background: #F7F7F7; color: var(--ink-2); margin-bottom: 16px; }
.rb-card { margin-bottom: 16px; }
.rb-hint { font-size: 12.5px; color: var(--ink-3); margin: 6px 0; overflow-wrap: anywhere; }
.rb-muted { color: var(--ink-3); font-size: 12px; overflow-wrap: anywhere; }
.rb-loading, .rb-empty { padding: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }
.rb-error { padding: 10px 12px; border-radius: 8px; background: #FDECEA; color: #B3261E; font-size: 13px; margin: 8px 0; overflow-wrap: anywhere; }
.rb-error-inline { color: #B3261E; font-size: 12.5px; }
.rb-ok { padding: 10px 12px; border-radius: 8px; background: #E8F5E9; color: #1B6B2A; font-size: 13px; margin: 8px 0; }
.rb-warn { padding: 10px 12px; border-radius: 8px; background: #FFF4E5; color: #8A5300; font-size: 13px; margin: 8px 0; overflow-wrap: anywhere; }
.rb-danger-box { background: #FDECEA; color: #B3261E; }
.rb-danger { color: #B3261E; }
.rb-blocked { font-size: 12.5px; color: #B3261E; }

/* 集計 */
.rb-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0 0 8px; }
.rb-kpi { border: 1px solid var(--rule); border-radius: var(--radius, 8px); background: var(--surface); padding: 10px 12px; min-width: 0; }
.rb-kpi-label { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.rb-kpi-num { font-size: 26px; font-weight: 900; line-height: 1.2; color: var(--ink); }
.rb-kpi-sub { font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }
.rb-kpi.is-review { border-color: #B3261E; background: #FDECEA; }
.rb-kpi.is-review .rb-kpi-num, .rb-kpi.is-review .rb-kpi-label { color: #B3261E; }
.rb-kpi.is-unshipped { border-color: var(--red); }
.rb-kpi.is-shipped .rb-kpi-num { color: #1B6B2A; }
.rb-summary-meta { font-size: 12.5px; color: var(--ink-2); margin-bottom: 16px; overflow-wrap: anywhere; }

/* CSV */
.rb-import-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.rb-file-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.rb-csv-meta { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.rb-import-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.rb-csv-counts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin: 8px 0; }
.rb-csv-counts .is-review { color: #B3261E; }
.rb-csv-counts .is-error { color: #8A5300; }
.rb-csv-title { font-weight: 700; margin-top: 6px; }
.rb-csv-notes { font-size: 12.5px; color: var(--ink-2); padding-left: 18px; margin: 8px 0; }
.rb-csv-notes li { margin: 3px 0; }
.rb-csv-rows summary { cursor: pointer; font-size: 13px; margin: 6px 0; }

/* 絞り込み */
.rb-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 12px; align-items: end; }
.rb-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.rb-field input, .rb-field select { width: 100%; box-sizing: border-box; min-height: 32px; }
.rb-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rb-filter-note { margin-top: 8px; }

/* 一覧 */
.rb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rb-table th, .rb-table td { border-bottom: 1px solid var(--rule); padding: 6px 6px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.rb-table th { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.rb-list-table .rb-col-benefit, .rb-list-table .rb-col-shipto { background: #FFFDF7; }
.rb-list-table .rb-col-item { max-width: 220px; }
.rb-col-actions { white-space: nowrap; }
/* rakuten-master-183: 一覧は 1 注文 = 1 行（固定幅の列・長い文字は最大 2 行で省略・全文は詳細）。表示だけを短くする */
.rb-list-table { table-layout: fixed; }
.rb-list-table .rb-w-order { width: 188px; }
.rb-list-table .rb-w-review { width: 104px; }
.rb-list-table .rb-w-rating { width: 112px; }
.rb-list-table .rb-w-posted { width: 78px; }
.rb-list-table .rb-w-benefit { width: 14%; }
.rb-list-table .rb-w-shipto { width: 12%; }
.rb-list-table .rb-w-status { width: 112px; }
.rb-list-table .rb-w-ship { width: 88px; }
.rb-list-table .rb-w-actions { width: 64px; }
.rb-list-table .rb-col-updated { display: none; }
/* rakuten-master-184: 評価と低評価の警告（色だけに頼らず ⚠ と文字・読み上げ文）。警告だけの列は 375px のカードでだけ使う */
.rb-list-table .rb-col-warn { display: none; }
.rb-low { display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 800; white-space: nowrap; border: 1px solid currentColor; }
.rb-low.is-bad { color: #B3261E; background: #FDECEA; }
.rb-low.is-warn { color: #8A5300; background: #FFF4DB; }
.rb-contact { margin: 8px 0 0; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.rb-plain-inline { font-family: ui-monospace, monospace; font-weight: 700; }
.rb-list-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rb-view-tabs { display: flex; gap: 6px; margin: 0 0 12px; border-bottom: 1px solid var(--rule); }
.rb-view-tab { border: 1px solid var(--rule); border-bottom: none; background: #F6F6F6; color: var(--ink-2); padding: 8px 14px; border-radius: 8px 8px 0 0; font-weight: 700; cursor: pointer; min-height: 40px; }
.rb-view-tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: inset 0 3px 0 var(--red); }
.rb-view-tab:focus-visible { outline: 2px solid #2C5FB3; outline-offset: 2px; }
.rb-an-period { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: end; margin: 0 0 10px; }
.rb-an-period-text { font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; }
.rb-an-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 8px; }
.rb-an-block { border: 1px solid var(--rule); border-radius: 10px; padding: 10px; min-width: 0; }
.rb-an-block h4 { margin: 0 0 6px; font-size: 13px; }
.rb-dist { display: grid; gap: 3px; }
.rb-dist-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 56px; gap: 6px; align-items: center; font-size: 12px; }
.rb-dist-row.is-low .rb-dist-label { color: #B3261E; font-weight: 700; }
.rb-dist-bar { display: block; height: 10px; background: #EFEFEF; border-radius: 5px; overflow: hidden; }
.rb-dist-bar > span { display: block; height: 100%; background: #6B8DD6; }
.rb-dist-row.is-low .rb-dist-bar > span { background: #D9534F; }
.rb-dist-num { text-align: right; white-space: nowrap; }
.rb-dist.is-compact .rb-dist-row { grid-template-columns: 26px minmax(40px, 1fr) 44px; font-size: 11px; }
.rb-trend { list-style: none; padding: 0; margin: 0; display: grid; gap: 3px; max-height: 320px; overflow-y: auto; }
.rb-trend li { display: grid; grid-template-columns: 58px minmax(0, 1fr) 118px; gap: 6px; align-items: center; font-size: 12px; }
.rb-trend-bar { display: block; height: 10px; background: #EFEFEF; border-radius: 5px; overflow: hidden; }
.rb-trend-bar > span { display: block; height: 100%; background: #8AA36B; }
.rb-trend-num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-an-defs { margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.rb-an-table { table-layout: fixed; }
.rb-an-table th:nth-child(1) { width: 30%; }
.rb-an-table th:nth-child(4) { width: 22%; }
.rb-an-table th:nth-child(7) { width: 64px; }
.rb-an-terms h5 { margin: 8px 0 4px; font-size: 12.5px; }
/* rakuten-master-199: 経営ダッシュボード（8 KPI・前期間比・推移グラフ・判定・確認すべきこと・ショップレビュー） */
.rb-an-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rb-an-custom[hidden] { display: none; }
/* rakuten-master-200: 一覧のコンパクト化（PC は 1 注文 1 行・12px）・出力済みバッジ・検索結果件数・PDF の開始位置 */
.rb-list-count { font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; }
.rb-list-table { font-size: 12px; }
.rb-list-table th { font-size: 11.5px; padding: 6px 6px; white-space: nowrap; }
.rb-list-table td { padding: 5px 6px; line-height: 1.35; vertical-align: top; }
.rb-list-table .rb-w-order { width: 156px; }
.rb-list-table .rb-w-review { width: 118px; }
.rb-list-table .rb-w-item { width: auto; }
.rb-list-table .rb-w-benefit { width: 15%; }
.rb-list-table .rb-w-shipto { width: 11%; }
.rb-list-table .rb-w-status { width: 104px; }
.rb-list-table .rb-w-export { width: 118px; }
.rb-list-table .rb-w-actions { width: 58px; }
.rb-list-table .rb-col-order { white-space: normal; }
.rb-list-table .rb-order-date { display: block; font-size: 11.5px; color: var(--ink-2); }
.rb-list-table .rb-order-no { display: block; white-space: nowrap; font-size: 11.5px; }
.rb-list-table .rb-col-review .rb-muted { font-size: 11px; }
.rb-list-table .rb-clamp2 { -webkit-line-clamp: 2; line-clamp: 2; }
.rb-list-table .rb-badge, .rb-list-table .rb-tag { font-size: 11px; padding: 1px 6px; }
.rb-list-table .rb-low { font-size: 11px; }
.rb-list-table .rb-reason-inline { font-size: 11px; }
.rb-list-table .btn-small { padding: 3px 8px; min-height: 26px; font-size: 12px; }
.rb-export-badges { display: flex; flex-direction: column; gap: 2px; }
.rb-export-badge { display: inline-block; font-size: 11px; line-height: 1.3; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--rule); background: #F6F6F6; color: var(--ink-3); white-space: nowrap; }
.rb-export-badge.is-done { background: #E8F0FB; color: #1F4E96; border-color: #9DB7E5; }
.rb-export-badge.is-done.is-pdf { background: #EAF5EC; color: #1B6B2A; border-color: #9CCBA7; }
/* rakuten-master-202: 対象商品を狭く（16%）・注文時特典を広く（26%）・送付先 12%。PC は商品名 / 特典名 / 送付先 / 要確認の理由を 1 行で末尾省略（全文は title と詳細）。
   1 注文 1 行の高さを揃える（2 行）: 低評価の注意は 2 行目の要約の先頭（要約は末尾省略）・badge / 出力 badge / 詳細 button は折り返さない。表示だけで、データ・API は変えない */
.rb-list-table .rb-w-item { width: 16%; }
.rb-list-table .rb-w-benefit { width: 26%; }
.rb-list-table .rb-w-shipto { width: 12%; }
.rb-list-table .rb-col-item > .rb-clamp2 { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; overflow: hidden; -webkit-line-clamp: unset; line-clamp: none; overflow-wrap: normal; }
.rb-list-table .rb-col-item .rb-mng, .rb-list-table .rb-col-item .rb-more { flex: none; }
.rb-list-table .rb-col-item .rb-item-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-list-table .rb-col-benefit > .rb-benefit-name, .rb-list-table .rb-col-shipto > .rb-shipto-kind, .rb-list-table .rb-col-status > .rb-reason-inline { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; line-clamp: none; overflow-wrap: normal; }
.rb-list-table .rb-col-review .rb-low { margin: 0 4px 0 0; vertical-align: baseline; }
.rb-list-table .rb-col-review .rb-muted { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-list-table .rb-badge, .rb-list-table .rb-export-badge, .rb-list-table .rb-col-actions .btn-small { white-space: nowrap; }
.rb-slot-grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 3px; margin: 6px 0; }
.rb-slot { height: 26px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; font-size: 11.5px; cursor: pointer; padding: 0; }
.rb-slot.is-skip { background: #F0F0F0; color: var(--ink-3); }
.rb-slot.is-start { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }
.rb-slot.is-use { background: #E8F5EC; border-color: #9CCBA7; }
.rb-slot:focus-visible { outline: 2px solid #2C5FB3; outline-offset: 1px; }
.rb-slot-wrap { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.rb-slot-legend { font-size: 12px; color: var(--ink-2); }
.rb-export-facts { margin: 6px 0; }
.rb-export-facts dt { font-weight: 700; font-size: 12.5px; }
.rb-export-facts dd { margin: 0 0 4px; font-size: 13px; }
.rb-export-skip { font-size: 12.5px; color: var(--ink-2); }
   /* .rb-field の display: flex が hidden 属性に勝つため（128 と同じ原因） */
.rb-shop-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rb-delta { display: inline-block; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rb-delta.is-up { color: #1B6B2A; }
.rb-delta.is-down { color: #B3261E; }
.rb-delta.is-flat { color: var(--ink-3); }
.rb-delta.is-na { color: var(--ink-3); font-weight: 400; }
.rb-verdict { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.rb-verdict.is-needs { background: #FDECEA; color: #B3261E; border-color: #B3261E; }
.rb-verdict.is-caution { background: #FFF4E5; color: #8A5300; border-color: #8A5300; }
.rb-verdict.is-good { background: #E8F5EC; color: #1B6B2A; border-color: #1B6B2A; }
.rb-verdict.is-insufficient { background: #F2F2F2; color: var(--ink-3); border-color: var(--rule); }
.rb-an-row.is-needs_improvement td:first-child { box-shadow: inset 3px 0 0 #B3261E; }
.rb-an-row.is-caution td:first-child { box-shadow: inset 3px 0 0 #8A5300; }
.rb-an-trend { min-width: 0; }
.rb-chart { display: block; width: 100%; height: auto; max-height: 240px; background: #FAFAFA; border-radius: 8px; }
.rb-chart-bar { fill: #8AA36B; }
.rb-chart-bar-low { fill: #D9534F; }
.rb-chart-line { fill: none; stroke: #2C5FB3; stroke-width: 2; }
.rb-chart-dot { fill: #2C5FB3; }
.rb-chart-axis { stroke: #CCC; stroke-width: 1; }
.rb-chart-x, .rb-chart-y, .rb-chart-y2 { font-size: 11px; fill: var(--ink-3); }
.rb-chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.rb-chart-key { display: inline-block; width: 12px; height: 10px; margin-right: 4px; vertical-align: middle; border-radius: 2px; }
.rb-chart-key.is-bar { background: #8AA36B; }
.rb-chart-key.is-low { background: #D9534F; }
.rb-chart-key.is-line { background: #2C5FB3; height: 3px; }
.rb-actions { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rb-action { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--rule); border-left: 4px solid #8A5300; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.rb-action.is-none { border-left-color: #1B6B2A; color: var(--ink-2); }
.rb-action-text { overflow-wrap: anywhere; }
.rb-review-filter { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-review-filter h4 { margin: 0; }
.rb-seg { display: inline-flex; gap: 4px; }
.rb-seg .is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.rb-an-table th:nth-child(1) { width: 14%; }
.rb-an-table th:nth-child(2) { width: 22%; }
.rb-an-table th:nth-child(4) { width: auto; }
.rb-an-table th:nth-child(7) { width: auto; }
.rb-an-table th:nth-child(11) { width: 64px; }
#page-reviewbenefit .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rb-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rb-chip { border: 1px solid var(--rule); border-radius: 999px; padding: 2px 10px; font-size: 12px; background: #FAFAFA; overflow-wrap: anywhere; }
.rb-warn-box { border: 1px solid #E0A93B; background: #FFF8E6; color: #5C3D00; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin: 8px 0; }
.rb-check { display: flex; gap: 6px; align-items: center; font-size: 13px; margin: 6px 0; }
.rb-modal-narrow { width: min(560px, 100%); }
.rb-list-table td { overflow: hidden; }
.rb-order-no { white-space: nowrap; font-size: 11.5px; }
.rb-list-table .rb-col-order { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-list-table .rb-col-review, .rb-list-table .rb-col-posted, .rb-list-table .rb-col-ship { overflow-wrap: normal; word-break: keep-all; }
.rb-clamp2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.rb-clamp1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; overflow: hidden; overflow-wrap: anywhere; }
.rb-benefit-name { font-weight: 700; }
.rb-mng { font-size: 11px; color: var(--ink-2); background: #F3F3F3; padding: 0 3px; border-radius: 3px; }
.rb-more { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.rb-badges { display: flex; flex-wrap: wrap; gap: 3px; }
.rb-list-table .rb-col-actions { position: sticky; right: 0; background: var(--bg-card, #fff); text-align: right; }
/* 自動照合の進捗 */
.rb-reconcile-box { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; background: #FAFCFF; }
.rb-reconcile-head { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-reconcile-head.is-done { color: #1E6B3A; }
.rb-reconcile-head.is-warn { color: #8A5300; }
.rb-reconcile-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.rb-reconcile-stats .is-review b { color: #B3261E; }
.rb-reconcile-stats .is-error b { color: #B3261E; }
.rb-reconcile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rb-reconcile-actions:empty { display: none; }
.rb-spinner { width: 12px; height: 12px; border: 2px solid #9DB7E0; border-top-color: #2C5FB3; border-radius: 50%; display: inline-block; animation: rb-spin 0.9s linear infinite; }
@keyframes rb-spin { to { transform: rotate(360deg); } }
.rb-shipto-kind { font-weight: 700; }
.rb-shipto-reason { margin-top: 2px; }
.rb-masked { font-family: ui-monospace, monospace; font-size: 12px; color: var(--ink-2); }
.rb-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #EEE; color: #555; white-space: nowrap; }
.rb-badge.is-ready { background: #E8F5E9; color: #1B6B2A; }
.rb-badge.is-review { background: #FDECEA; color: #B3261E; }
.rb-badge.is-shipped { background: #E3F2FD; color: #0D47A1; }
.rb-badge.is-awaiting { background: #FFF4E5; color: #8A5300; }
.rb-badge.is-excluded { background: #EEEEEE; color: #555; }
/* rakuten-master-182: 長期未解決・個人情報消去済み */
.rb-badge.is-long { background: #FFF4E5; color: #8A5300; margin-left: 4px; }
.rb-kpi.is-long { border-color: #8A5300; background: #FFF4E5; }
.rb-kpi.is-long .rb-kpi-num, .rb-kpi.is-long .rb-kpi-label { color: #8A5300; }
.rb-purged { font-size: 12px; color: var(--ink-2); background: #EEEEEE; border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; }
.rb-pii-bar.is-purged { background: #EEEEEE; color: #555; }
.rb-reason-inline { font-size: 11.5px; color: #B3261E; margin-top: 3px; white-space: normal; overflow-wrap: anywhere; }
.rb-reasons { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; }
.rb-reason-box { padding: 8px 12px; border-radius: 8px; background: #FDECEA; color: #B3261E; margin: 8px 0; }
.rb-tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #EEE; color: #555; margin-left: 4px; }
.rb-tag.is-review { background: #FDECEA; color: #B3261E; }
.rb-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.rb-page { font-size: 12.5px; color: var(--ink-2); }

/* 詳細・操作 */
.rb-overlay { align-items: flex-start; overflow-y: auto; }
.rb-modal { width: min(920px, 100%); max-height: none; margin: 16px auto; text-align: left; background: var(--surface, #fff); border-radius: 12px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.rb-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.rb-modal-head h3 { margin: 0; font-size: 16px; }
.rb-detail-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.rb-order { font-size: 14px; }
.rb-section { border-top: 1px solid var(--rule); padding: 12px 0; }
.rb-section h4 { margin: 0 0 8px; font-size: 14px; }
.rb-shipto-section { border: 2px solid var(--red); border-radius: 10px; padding: 12px; background: #FFF8F6; }
.rb-shipto-main { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.rb-shipto-kind-big { font-size: 15px; font-weight: 800; color: var(--red); }
.rb-party { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; background: var(--surface); min-width: 0; flex: 1 1 260px; }
.rb-party.is-emphasis { border-color: var(--red); background: #fff; }
.rb-party-title { font-size: 12px; color: var(--ink-3); font-weight: 700; margin-bottom: 4px; }
.rb-plain { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.rb-missing { font-size: 12px; color: #B3261E; margin-top: 4px; }
.rb-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.rb-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 13px; margin: 8px 0; }
.rb-facts dt { color: var(--ink-3); font-weight: 700; }
.rb-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.rb-pii-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); padding: 8px 10px; border-radius: 8px; background: #F7F7F7; margin: 8px 0; }
.rb-pii-bar.is-shown { background: #FFF4E5; color: #8A5300; }
.rb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.rb-benefit-main { font-size: 14px; margin-bottom: 6px; }
.rb-benefit-name { font-size: 16px; color: var(--red); }
.rb-raw { font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; }
.rb-review { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.rb-review-head { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.rb-review-item { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.rb-review-title { font-size: 13px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.rb-review-body { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.rb-old-records summary { cursor: pointer; font-size: 12.5px; margin-top: 6px; }
.rb-old-record { font-size: 12.5px; padding: 6px 0; border-top: 1px dashed var(--rule); }
.rb-timeline { list-style: none; margin: 0; padding: 0; }
.rb-timeline li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--rule); font-size: 12.5px; }
.rb-tl-when { color: var(--ink-3); }
.rb-op-body { max-height: 70vh; overflow-y: auto; }
.rb-op-field { margin-bottom: 8px; }
.rb-op-field input, .rb-op-field textarea { width: 100%; box-sizing: border-box; }
.rb-op-confirm { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; background: #FFFDF7; margin-bottom: 8px; }
.rb-op-confirm h5 { margin: 0 0 4px; font-size: 13px; }
.rb-op-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 6px 0; }
.rb-op-check input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.rb-op-checks { margin: 10px 0; }
.rb-op-changes { font-size: 12.5px; color: #8A5300; margin: 6px 0; }
.rb-op-message { padding: 8px 10px; border-radius: 8px; background: #FDECEA; color: #B3261E; font-size: 13px; }
.rb-modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rb-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); display: block; margin-bottom: 3px; }

@media (max-width: 640px) {
  .rb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rb-kpi.is-review { grid-column: 1 / -1; }
  .rb-filters { grid-template-columns: minmax(0, 1fr); }
  .rb-filter-actions button { flex: 1 1 auto; min-height: 40px; }
  .rb-import-actions button { flex: 1 1 auto; min-height: 40px; }
  /* 一覧は 1 件 1 カード。特典と送付先を上に出す（ページ全体の横スクロールを作らない） */
  .rb-list-table thead { display: none; }
  .rb-list-table, .rb-list-table tbody, .rb-list-table tr, .rb-list-table td { display: block; width: 100%; box-sizing: border-box; }
  .rb-list-table tr { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
  .rb-list-table td { border-bottom: none; padding: 3px 0; overflow-wrap: anywhere; }
  .rb-list-table td[data-label]::before { content: attr(data-label) "："; color: var(--ink-2); font-size: 11.5px; margin-right: 4px; }
  /* rakuten-master-183: カード上部 = 状態 → 注文番号 → 特典名 → 送付先。その下は 1 行ずつ（長い商品名でカードを縦長にしない） */
  .rb-list-table td { order: 7; overflow: visible; }
  /* rakuten-master-184: 状態 → 低評価の警告 → 注文番号 → 評価 → 特典 → 送付先 → …… → 詳細（当時の並び）
     rakuten-master-200: カードの順 = 状態 → 注文日・注文番号 → 特典名 → 送付先区分 → CSV / PDF 出力状態 → …… → 詳細 */
  .rb-list-table td.rb-col-status { order: 0; }
  .rb-list-table td.rb-col-warn { order: 1; display: flex; }
  .rb-list-table td.rb-col-order { order: 2; white-space: normal; }
  .rb-list-table td.rb-col-benefit { order: 3; background: transparent; }
  .rb-list-table td.rb-col-shipto { order: 4; background: transparent; }
  .rb-list-table td.rb-col-export { order: 5; }
  .rb-list-table td.rb-col-review { order: 6; }
  .rb-list-table td.rb-col-actions { order: 8; }
  .rb-list-table { font-size: 13px; }
  .rb-list-table .rb-order-no { white-space: normal; overflow-wrap: anywhere; }
  .rb-export-badges { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  /* rakuten-master-202: カードでは PC の nowrap を解き、商品名 / 特典名 / 送付先は 2 行まで（横スクロールを作らない） */
  .rb-list-table td.rb-col-item > .rb-clamp2 { flex-wrap: wrap; white-space: normal; overflow: visible; }
  .rb-list-table td.rb-col-item .rb-item-name { flex: 1 1 100%; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
  .rb-list-table td.rb-col-benefit > .rb-benefit-name, .rb-list-table td.rb-col-shipto > .rb-shipto-kind { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
  .rb-list-table td.rb-col-review .rb-muted { white-space: normal; overflow-wrap: anywhere; }
  .rb-slot-grid { grid-template-columns: repeat(3, 40px); }
  .rb-an-period { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rb-an-grid { grid-template-columns: minmax(0, 1fr); }
  .rb-an-kpis, .rb-shop-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* rakuten-master-199 */
  .rb-kpi-num { font-size: 22px; }
  .rb-action { flex-direction: column; align-items: stretch; }
  .rb-action button { width: 100%; min-height: 40px; }
  .rb-an-table td[data-label="判定"]::before, .rb-an-table td[data-label="増減"]::before { content: attr(data-label) "："; }
  .rb-an-table thead { display: none; }
  .rb-an-table, .rb-an-table tbody, .rb-an-table tr, .rb-an-table td { display: block; width: 100%; box-sizing: border-box; }
  .rb-an-table tr { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
  .rb-an-table td { border-bottom: none; padding: 3px 0; }
  .rb-an-table td[data-label]::before { content: attr(data-label) "："; color: var(--ink-2); font-size: 11.5px; margin-right: 4px; }
  .rb-an-table td.rb-col-actions::before { content: none; }
  .rb-trend li { grid-template-columns: 46px minmax(0, 1fr) 104px; }
  .rb-view-tab { flex: 1 1 0; }
  .rb-list-table td.rb-col-updated { display: block; }
  .rb-list-table td.rb-col-item .rb-clamp2 { -webkit-line-clamp: 1; line-clamp: 1; }
  .rb-list-table td.rb-col-status .rb-reason-inline.rb-clamp2 { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
  .rb-list-table td.rb-col-actions { position: static; text-align: left; }
  /* 見出しと値を 1 行に（値が block でも見出しの下へ落とさない）。要確認の理由・＋他N商品は 1 行を使い切る */
  .rb-list-table td:not(.rb-col-actions) { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; }
  .rb-list-table td:not(.rb-col-actions) > * { min-width: 0; }
  .rb-list-table td .rb-reason-inline, .rb-list-table td .rb-more { flex-basis: 100%; }
  .rb-list-table td.rb-col-item > .rb-clamp2, .rb-list-table td.rb-col-benefit > .rb-clamp2, .rb-list-table td.rb-col-shipto > .rb-clamp2 { flex: 1 1 0; }
  .rb-list-table td.rb-col-actions { order: 9; }
  .rb-list-table .rb-col-item { max-width: none; }
  .rb-col-actions button { min-height: 40px; width: 100%; }
  .rb-list-table td.rb-col-actions::before { content: none; }   /* rakuten-master-182: 見出し「操作：」の分だけ幅 100% の button がカードからはみ出していた */
  .rb-csv-table thead { display: none; }
  .rb-csv-table, .rb-csv-table tbody, .rb-csv-table tr, .rb-csv-table td { display: block; width: 100%; box-sizing: border-box; }
  .rb-csv-table tr { border: 1px solid var(--rule); border-radius: 8px; padding: 4px 8px; margin-bottom: 6px; }
  .rb-csv-table td { border-bottom: none; padding: 2px 0; }
  .rb-csv-table td[data-label]::before { content: attr(data-label) "："; color: var(--ink-2); font-size: 11.5px; margin-right: 4px; }
  .rb-choice-table thead { display: none; }
  .rb-choice-table, .rb-choice-table tbody, .rb-choice-table tr, .rb-choice-table td { display: block; width: 100%; box-sizing: border-box; }
  .rb-choice-table td[data-label]::before { content: attr(data-label) "："; color: var(--ink-2); font-size: 11.5px; margin-right: 4px; }
  .rb-facts { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .rb-facts dt { margin-top: 6px; }
  .rb-timeline li { grid-template-columns: minmax(0, 1fr); }
  .rb-modal { margin: 8px auto; padding: 12px; }
  .rb-modal-actions button, .rb-actions button { min-height: 40px; }
  .rb-op-body { max-height: none; }
  .rb-detail-head { flex-direction: column; }
}

/* rakuten-master-213: データ入力カード ⑤（Yahoo 日別売上 CSV）と取込プレビュー・取込データの売上表示 */
.uc-icon.green { background: var(--green-soft); }
.rk-provider-csv-card { width: min(980px, calc(100vw - 32px)); text-align: left; }
.provider-csv-preview-scroll { max-height: 48vh; }
.provider-csv-preview th, .provider-csv-preview td { white-space: nowrap; }
.provider-csv-changed td:last-child { color: var(--gold); font-weight: 700; }
.provider-csv-new td:last-child { color: var(--green); }
.provider-csv-same td:last-child { color: var(--ink-3); }
.provider-csv-warn { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--gold-soft); color: var(--ink); font-size: 13px; }
.provider-csv-check { display: block; margin: 10px 0; font-size: 13px; }
.sales-provider-source { margin: 6px 0 10px; font-size: 13px; color: var(--ink-2); }
@media (max-width: 640px) {
  .rk-provider-csv-card { width: calc(100vw - 16px); padding: 12px; }
}

/* rakuten-master-214: 全モールのモール別カード — 取得元（CSV取込）のバッジと客単価の分母の注記 */
.allmall-badge.is-source { margin-left: 6px; background: var(--blue-soft); color: var(--blue); }
.allmall-coverage { margin: 6px 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2, #f4f6fa); color: var(--ink-2); font-size: 13px; }
.allmall-fig-basis { font-weight: 400; font-size: 11px; color: var(--ink-3); margin-left: 2px; }

/* EC-RPP-UI-IMPLEMENT-20261007-220604: RPP 画面 — 全体サマリー・商品別の検索 / 比較 / 合計・入札単価（設定値）の区別 */
.rpp-overview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rpp-aux-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rpp-aux-grid { margin-top: 8px; }
.rpp-overview-grid .kpi-value { font-size: 20px; overflow-wrap: anywhere; }
.rpp-overview-grid .kpi-sub { overflow-wrap: anywhere; }
.rpp-warn-text { color: var(--gold); font-weight: 600; }
.rpp-notes { margin: 10px 0 14px; padding: 8px 12px; border-radius: 8px; background: var(--gold-soft); color: var(--ink-2); font-size: 12px; display: grid; gap: 2px; }
.rpp-notes .rpp-muted { color: var(--ink-3); }
.rpp-sort { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rpp-search { min-height: 36px; min-width: 220px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); font-size: 13px; color: var(--ink); max-width: 100%; }
.rpp-th-sub { display: block; font-weight: 400; font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.rpp-col-bid, .rpp-col-bid.num { background: #FAF7FF; color: var(--ink-2); }
.rpp-set-badge { display: inline-block; padding: 0 6px; border-radius: 999px; border: 1px solid #D4C5F2; background: #F1ECFB; color: #6B46C1; font-size: 10px; font-weight: 600; }
.rpp-product-line { display: flex; align-items: center; gap: 8px; }
.rpp-cmp-label { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; cursor: pointer; }
.rpp-cmp-cb { width: 16px; height: 16px; }
.rpp-tot-row th, .rpp-tot-row td { background: var(--bg-2, #F6F7F9); font-weight: 700; border-top: 2px solid var(--rule); }
.rpp-tot-label { text-align: left; font-size: 12px; overflow-wrap: anywhere; }
.rpp-totals-box { display: none; margin: 10px 0; }
.rpp-totals-set { padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); margin-bottom: 8px; }
.rpp-totals-title { font-size: 12px; font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }
.rpp-totals-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rpp-totals-grid > div { display: flex; flex-direction: column; min-width: 0; }
.rpp-compare-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rpp-cmp-table th, .rpp-cmp-table td { vertical-align: top; }
.rpp-cmp-table th[scope=row] { text-align: left; white-space: nowrap; font-weight: 600; }
.rpp-cmp-h { min-width: 140px; text-align: left; }
.rpp-cmp-bar { height: 6px; border-radius: 3px; background: var(--rule); margin-top: 3px; }
.rpp-cmp-bar i { display: block; height: 6px; border-radius: 3px; background: var(--blue, #2B6CB0); }
.rpp-card-head .rpp-cmp-label { flex: 0 0 auto; }
.rpp-card-bid { font-size: 12px; color: var(--ink-2); margin: 6px 0 2px; }
/* 長い商品名・管理番号（途中で改行できない文字列）でカードや表が親からはみ出さない */
.rpp-product-text { min-width: 0; }
.rpp-product-title, .rpp-product-code, .rpp-cmp-h { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .rpp-overview-grid, .rpp-aux-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rpp-totals-box { display: block; }
  .rpp-search { width: 100%; min-width: 0; }
  .rpp-sort { width: 100%; }
  .rpp-cards { grid-template-columns: minmax(0, 1fr); }
  .rpp-card-item { min-width: 0; }
  .rpp-card-head .rpp-product { min-width: 0; flex: 1 1 auto; }
}

/* EC-RPP-DAILY-IMPLEMENT-20261008-101540: RPP 画面 — 表示の切替（商品別分析 / 日次管理）と日次管理（予算・日次の表・取込の確認） */
.rpp-view-switch { display: inline-flex; gap: 4px; margin-bottom: 14px; padding: 3px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.rpp-view-btn { min-height: 34px; padding: 4px 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.rpp-view-btn.is-on { background: var(--ink); color: #fff; }
.rpp-daily-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rpp-daily-grid .kpi-value { font-size: 20px; overflow-wrap: anywhere; }
.rpp-daily-grid .kpi-sub { overflow-wrap: anywhere; }
.rpp-daily-card-main .kpi-value { color: var(--blue, #2B6CB0); }
.rpp-kpi-warn { border-color: var(--gold); }
.rpp-daily-budget { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); display: grid; gap: 6px; }
.rpp-daily-budget-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.rpp-daily-budget-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rpp-daily-budget-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rpp-daily-budget-in { min-height: 36px; width: 200px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rpp-daily-budget-note { font-size: 12px; color: var(--ink-2); }
.rpp-daily-budget-warn { font-size: 12px; color: var(--gold); font-weight: 600; padding: 6px 10px; border-radius: 8px; background: var(--gold-soft); }
.rpp-daily-table td { white-space: nowrap; }
.rpp-daily-table th { white-space: normal; min-width: 64px; vertical-align: bottom; }
.rpp-daily-table tfoot td, .rpp-daily-table .rpp-th-sub { white-space: normal; }
.rpp-daily-table .rpp-daily-date { text-align: left; font-weight: 600; }
.rpp-daily-table tr.is-future td, .rpp-daily-table tr.is-future th { color: var(--ink-3); }
.rpp-daily-table tr.is-today th, .rpp-daily-table tr.is-today td { background: var(--blue-soft, #EEF4FF); }
.rpp-daily-table tr.is-missing .rpp-daily-spend { color: var(--ink-3); }
.rpp-daily-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--blue-soft, #EEF4FF); color: var(--blue, #2B6CB0); font-size: 10px; font-weight: 600; }
.rpp-daily-tag.is-missing { background: var(--gold-soft); color: var(--gold); }
.rpp-daily-over { color: var(--red, #BF1F2E); font-weight: 600; }
.rpp-daily-under { color: var(--green, #1A7A45); }
.rpp-daily-partial { color: var(--gold); font-weight: 700; margin-left: 2px; }
.rpp-daily-cards { display: none; }
.rpp-daily-card { padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); margin-bottom: 8px; min-width: 0; }
.rpp-daily-card.is-today { border-color: var(--blue, #2B6CB0); }
.rpp-daily-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.rpp-daily-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; }
.rpp-daily-card-grid > div { display: flex; flex-direction: column; min-width: 0; font-variant-numeric: tabular-nums; }
.rpp-daily-card-grid b { font-size: 13px; overflow-wrap: anywhere; }
.rpp-daily-cl { font-size: 10px; color: var(--ink-3); }
.rpp-daily-pending { border: 2px solid var(--blue, #2B6CB0); margin-bottom: 14px; }
.rpp-daily-overlap { margin: 8px 0; font-size: 13px; }
.rpp-daily-older-confirm { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 600; color: var(--ink); cursor: pointer; }
.rpp-daily-older-confirm input { width: 18px; height: 18px; }
.rpp-daily-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rpp-daily-diff th[scope=row] { text-align: left; white-space: nowrap; }
.rpp-daily-history { margin-top: 12px; font-size: 13px; }
.rpp-daily-history summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.rpp-daily-history tr.is-superseded td { color: var(--ink-3); }
.rpp-daily-fn { overflow-wrap: anywhere; max-width: 240px; white-space: normal; }
@media (max-width: 640px) {
  .rpp-view-switch { display: flex; }
  .rpp-view-btn { flex: 1 1 0; }
  .rpp-daily-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rpp-daily-tbl-scroll { display: none; }
  .rpp-daily-cards { display: block; }
  .rpp-daily-budget-in { width: 100%; }
  .rpp-daily-toolbar { flex-direction: column; }
}
