/* ============================================================
   楽天市場 運営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; }
#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;
}
.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 モーダル（ログイン画面と同じカードを流用。背景は半透明で元画面を隠さない） */
.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; }
.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; }

/* 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;
  grid-template-columns: 88px minmax(0, 1fr) auto auto;
  grid-template-areas: "thumb main metrics 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); }

.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; }

/* 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); }
.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; }

@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; }
}

.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%; }
}
