/* ============================================================
   FX 運用ダッシュボード v3 — シンプル / ライトテーマ
   ・アクセントは青 1 色。緑=利益、赤=損失のみ。
   ・大きな文字と余白。詳細はモーダルへ。
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --card: #12151c;
  --line: #232833;
  --line-soft: #1a1e27;
  --text: #e8eaef;
  --text-2: #c3c8d2;
  --muted: #8b93a3;
  --faint: #626a79;

  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, .12);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, .1);
  --red: #f05252;
  --red-soft: rgba(240, 82, 82, .1);
  --amber: #f5b14a;
  --amber-soft: rgba(245, 177, 74, .08);
  --amber-line: rgba(245, 177, 74, .3);
  --hover: #151922;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 10px 30px rgba(17, 24, 39, .05);

  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
          "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd, dt { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 13px; font-weight: 500; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.flat { color: var(--muted); }

/* ── ヘッダー ─────────────────────────────────────────── */
.top {
  background: rgba(11, 13, 18, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.top-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(150deg, #3b82f6, #2563eb 60%, #3b7af0);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
  position: relative; flex: 0 0 auto;
}
.brand-mark::after {
  content: ""; position: absolute; left: 9px; right: 9px; top: 12px;
  height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .85);
  box-shadow: 0 7px 0 rgba(255, 255, 255, .55);
}
.brand-text h1 { font-size: 19px; font-weight: 700; letter-spacing: .01em; line-height: 1.3; }
.brand-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge-test {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--amber);
  background: var(--amber-soft); border: 1px solid var(--amber-line);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.badge-test::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #f59e0b;
}

.btn {
  border: 1px solid transparent; border-radius: 12px;
  padding: 9px 17px; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .22); }
.btn-primary:hover { background: #3b7af0; }
.btn-quiet { background: var(--card); border-color: var(--line); color: var(--text-2); }
.btn-quiet:hover { border-color: var(--line); background: var(--hover); }
.btn:focus-visible, .seg-btn:focus-visible, .icon-btn:focus-visible, .row-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── レイアウト ───────────────────────────────────────── */
.wrap {
  max-width: 1120px; margin: 0 auto;
  padding: 26px 24px 44px;
  display: grid; gap: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 16.5px; font-weight: 700; letter-spacing: .01em; }
.label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: .09em; margin-bottom: 7px;
}

/* ── 警告バナー ───────────────────────────────────────── */
.banner {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.banner-mark {
  flex: 0 0 auto;
  width: 24px; height: 24px; margin-top: 2px;
  border-radius: 50%;
  background: #fbbf24; color: #78350f;
  font-size: 15px; font-weight: 800; line-height: 24px; text-align: center;
}
.banner-main { font-size: 15.5px; font-weight: 700; color: var(--amber); line-height: 1.5; }
.banner-sub { font-size: 13.5px; color: #c9a26a; margin-top: 3px; line-height: 1.5; }

/* ── 状態カード ───────────────────────────────────────── */
.status-card { padding: 28px; }
.status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0 28px;
}
.status-col { min-width: 0; }
.status-col-main, .status-col-pnl {
  border-left: 1px solid var(--line-soft);
  padding-left: 28px;
}
.price { font-size: 44px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.change { font-size: 15px; font-weight: 600; margin-top: 4px; }
.status { font-size: 30px; font-weight: 700; letter-spacing: .01em; line-height: 1.25; }
.reason { font-size: 15.5px; color: var(--text-2); margin-top: 6px; line-height: 1.6; }
.next { font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.next::before { content: "次に: "; color: var(--faint); font-weight: 600; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tag {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--line-soft); border-radius: 999px; padding: 4px 11px;
}
.pnl { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.record { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.status-foot { display: flex; justify-content: flex-end; margin-top: 20px; }

/* ── エントリー条件 ───────────────────────────────────── */
.entry-side { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.entry-count { font-size: 20px; font-weight: 700; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 15px; background: var(--card); color: var(--muted);
}
.chip .mark { font-size: 13px; line-height: 1; }
.chip.is-ok { color: var(--green); border-color: rgba(34,197,94,.3); background: var(--green-soft); }
.chip.is-ng { color: var(--red); border-color: rgba(240,82,82,.3); background: var(--red-soft); }
.entry-note { font-size: 13.5px; color: var(--muted); margin-top: 14px; }

/* ── チャート ─────────────────────────────────────────── */
.chart-card .card-head { margin-bottom: 8px; }
.seg {
  display: inline-flex; gap: 3px; padding: 4px;
  background: var(--line-soft); border-radius: 12px;
}
.seg-btn {
  border: 0; background: transparent; border-radius: 9px;
  padding: 7px 18px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.seg-btn:hover { color: var(--text-2); }
.seg-btn.is-active {
  background: var(--card); color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--faint); margin: 2px 0 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-legend .dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); height: 2px; }
.chart-wrap { height: 380px; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }

/* ── 今月の成績 ───────────────────────────────────────── */
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  background: var(--hover); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 16px 18px;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; }

/* ── 直近トレード ─────────────────────────────────────── */
.trade-list { display: grid; gap: 0; }
.trade-row {
  display: grid;
  grid-template-columns: 110px 54px minmax(0, 1fr) 120px 96px;
  gap: 12px; align-items: center;
  padding: 13px 6px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px; color: var(--text-2);
  background: transparent; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; cursor: pointer;
}
.trade-row:last-child { border-bottom: 0; }
.trade-row:hover { background: var(--hover); }
.trade-row .when { color: var(--muted); font-size: 13.5px; }
.side-pill {
  display: inline-block; text-align: center;
  font-size: 12.5px; font-weight: 700; border-radius: 7px; padding: 2px 0;
  width: 42px;
}
.side-pill.long { color: var(--green); background: var(--green-soft); }
.side-pill.short { color: var(--red); background: var(--red-soft); }
.trade-row .pnl-cell { text-align: right; font-weight: 700; }
.trade-row .exit-cell { text-align: right; font-size: 12.5px; color: var(--muted); }
.trade-empty { color: var(--faint); font-size: 14px; padding: 8px 0; }

/* ── フッター ─────────────────────────────────────────── */
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--faint);
  padding: 2px 4px 8px;
}

/* ── モーダル ─────────────────────────────────────────── */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(17, 24, 39, .38);
  backdrop-filter: blur(3px);
}
.modal-dialog {
  position: relative; z-index: 1;
  width: min(780px, calc(100vw - 32px));
  max-height: 88vh;
  margin: 56px 16px;
  background: var(--card); border-radius: 20px;
  box-shadow: 0 24px 80px rgba(17, 24, 39, .25);
  display: flex; flex-direction: column;
  animation: modal-in .16s ease-out;
}
.modal-dialog-wide { width: min(1060px, calc(100vw - 32px)); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 19px; font-weight: 700; }
.modal-head .muted { margin-top: 2px; }
.icon-btn {
  flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  font-size: 20px; line-height: 1; color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--text); }
.modal-body { padding: 22px 24px 26px; overflow: auto; }
.seg-wide { margin: 14px 24px 0; }

/* ── 詳細モーダル内 ───────────────────────────────────── */
.d-sec { margin-bottom: 26px; }
.d-sec:last-child { margin-bottom: 0; }
.d-sec h3 {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  letter-spacing: .1em; margin-bottom: 10px;
}
.d-lead { font-size: 15px; color: var(--text-2); line-height: 1.7; }
.d-lead + .d-lead { margin-top: 6px; }
.d-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px;
  background: var(--line-soft); color: var(--muted);
}
.pill.executed { background: var(--green-soft); color: var(--green); }
.pill.rejected { background: var(--red-soft); color: var(--red); }
.pill.kill_switch { background: rgba(167,139,250,.12); color: #a78bfa; }
.pill.flat-pill { background: var(--line-soft); color: var(--text-2); }
.mono-sm { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.check-list { display: grid; gap: 7px; }
.check-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px 8px; padding: 9px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--hover);
}
.check-item .mark { grid-row: span 2; font-weight: 700; }
.check-item.is-ok .mark { color: var(--green); }
.check-item.is-ng .mark { color: var(--red); }
.check-item.is-ng { border-color: rgba(240,82,82,.3); background: var(--red-soft); }
.check-name { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.check-desc { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.risk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.risk-cell {
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--hover); padding: 10px 12px;
}
.risk-cell dt { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .05em; }
.risk-cell dd { font-family: var(--mono); font-size: 15px; font-weight: 700; margin-top: 1px; }
.formula { display: grid; }
.formula-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 10px; align-items: baseline;
  padding: 6px 0; border-bottom: 1px dashed var(--line-soft);
  font-size: 13px; color: var(--muted);
}
.formula-row:last-child { border-bottom: 0; }
.formula-row .eq { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.formula-row b { font-family: var(--mono); font-size: 13px; color: var(--text); }
.ind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.ind-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.ind-row dt { font-size: 12.5px; color: var(--muted); }
.ind-row dd { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-2); }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.kv-row dt { font-size: 12.5px; color: var(--muted); }
.kv-row dd { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.note-box {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--hover); padding: 14px 16px;
  font-size: 13.5px; color: var(--text-2); line-height: 1.65;
}
.stat-mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-mini {
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--hover); padding: 10px 12px;
}
.stat-mini .k { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .05em; }
.stat-mini .v { font-family: var(--mono); font-size: 16px; font-weight: 700; margin-top: 1px; }

/* ── 記録モーダル内 ───────────────────────────────────── */
.seg + .modal-body { padding-top: 16px; }
.rec-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 12.5px; font-weight: 600; border-radius: 999px;
  padding: 5px 12px; cursor: pointer;
}
.filter-btn.is-active { border-color: rgba(79,140,255,.35); background: var(--accent-soft); color: var(--accent); }
.rec-note { font-size: 12.5px; color: var(--faint); }
.rec-list { display: grid; gap: 0; }
.rec-row {
  display: grid; grid-template-columns: 128px 72px minmax(0, 1fr) 96px 104px;
  gap: 10px; align-items: center;
  width: 100%; text-align: left; background: none;
  border: 0; border-bottom: 1px solid var(--line-soft);
  padding: 10px 6px; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.rec-row:hover { background: var(--hover); }
.rec-row--log { grid-template-columns: 128px 64px 116px 92px minmax(0, 1fr); }
.rec-row .when { color: var(--muted); }
.rec-row .reason { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row .pnl-cell { text-align: right; font-weight: 700; }
.empty-note {
  padding: 26px 16px; text-align: center; color: var(--faint);
  border: 1px dashed var(--line); border-radius: 12px; font-size: 13.5px;
}
.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 20px; }
.model-card {
  border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 14px 16px; background: var(--hover);
}
.model-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-name { font-size: 14px; font-weight: 700; }
.model-status { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--line-soft); border-radius: 999px; padding: 2px 9px; }
.model-status.long { color: var(--green); background: var(--green-soft); }
.model-status.short { color: var(--red); background: var(--red-soft); }
.model-status.blocked { color: var(--amber); background: var(--amber-soft); }
.model-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.model-nums { display: flex; gap: 14px; margin-top: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.model-nums b { color: var(--text-2); font-family: var(--mono); }
.timeline { display: grid; gap: 10px; }
.tl-item { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.tl-when { color: var(--muted); font-size: 12px; padding-top: 1px; }
.tl-main { border-left: 2px solid var(--line); padding-left: 12px; }
.tl-main b { font-weight: 600; }
.tl-reason { font-size: 12px; color: var(--muted); margin-top: 2px; }
.table-wrap { border: 1px solid var(--line-soft); border-radius: 12px; overflow: auto; }
.simple-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.simple-table th {
  position: sticky; top: 0; background: var(--card);
  text-align: left; font-size: 11px; letter-spacing: .06em;
  color: var(--muted); font-weight: 700;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.simple-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); color: var(--text-2); white-space: nowrap; }
.simple-table tr:last-child td { border-bottom: 0; }
.chart-wrap--modal { height: 300px; margin-top: 4px; }
.chart-wrap--modal canvas { display: block; width: 100%; height: 100%; }

/* ── データ待ち ───────────────────────────────────────── */
.wait {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(247, 248, 250, .94);
  backdrop-filter: blur(4px);
}
.wait[hidden] { display: none; }
.wait-card {
  text-align: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 40px;
  box-shadow: var(--shadow);
}
.wait-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.wait-card p { font-size: 13.5px; color: var(--muted); }
.wait-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.wait-dots i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: dot 1s ease-in-out infinite;
}
.wait-dots i:nth-child(2) { animation-delay: .12s; }
.wait-dots i:nth-child(3) { animation-delay: .24s; }
@keyframes dot { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
.wait-note { margin-top: 8px; font-size: 12px; color: var(--faint); }

/* ── レスポンシブ ─────────────────────────────────────── */
@media (max-width: 980px) {
  .status-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .status-col-main, .status-col-pnl { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: 18px; }
  .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-wrap { height: 320px; }
  .risk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-row { grid-template-columns: 92px 48px minmax(0, 1fr) 104px; }
  .trade-row .exit-cell { display: none; }
  .rec-row { grid-template-columns: 110px 64px minmax(0, 1fr) 92px; }
  .rec-row .exit-cell { display: none; }
  .rec-row--log { grid-template-columns: 110px 56px 100px minmax(0, 1fr); }
  .rec-row--log .reason { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px 14px 32px; gap: 14px; }
  .top-inner { padding: 12px 14px; }
  .card { padding: 20px 18px; }
  .price { font-size: 36px; }
  .pnl { font-size: 32px; }
  .status { font-size: 25px; }
  .month-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 27px; }
  .entry-count { font-size: 17px; }
  .chip { font-size: 13.5px; padding: 8px 12px; }
  .seg-btn { padding: 6px 12px; }
  .ind-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-dialog { margin: 20px 10px; max-height: 92vh; width: calc(100vw - 20px); }
  .modal-body { padding: 18px; }
  .rec-row { grid-template-columns: 100px minmax(0, 1fr) 88px; }
  .rec-row .side-cell { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-dialog { animation: none; }
  .wait-dots i { animation: none; }
}

/* 直近トレード: pips を右寄せにして損益列と揃える */
.trade-row .pips-cell { text-align: right; }

.entry-head-right { display: flex; align-items: center; gap: 14px; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; border-radius: 10px; }

/* ============================================================
   v4: AIエージェント（タブ / 4体カード / 合議 / トークン / 履歴 / 架空口座）
   ============================================================ */

.view { display: contents; }
.view[hidden] { display: none; }
.agents-content { display: contents; }

/* ヘッダーのタブ */
.view-tabs {
  display: inline-flex; gap: 3px; padding: 4px;
  background: var(--line-soft); border-radius: 12px;
  flex: 0 0 auto;
}
.view-tab {
  border: 0; background: transparent; border-radius: 9px;
  padding: 7px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.view-tab:hover { color: var(--text-2); }
.view-tab.is-active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.tab-metric {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 1px 7px; letter-spacing: 0;
}
.view-tab:not(.is-active) .tab-metric { color: var(--muted); background: rgba(148, 163, 184, .14); }

/* サマリ行 */
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-big { font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; font-family: var(--mono); }
.summary-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* エージェントカード */
.agent-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.agent-card {
  padding: 18px 18px 16px;
  border-top: 3px solid var(--agent-color, var(--accent));
  display: grid; gap: 8px; align-content: start;
  min-width: 0;
}
.agent-head { display: flex; align-items: flex-start; gap: 9px; }
.agent-dot {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: var(--agent-color, var(--accent)); margin-top: 6px;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .12);
}
.agent-name { font-size: 15px; font-weight: 700; line-height: 1.35; }
.agent-role { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.agent-action { font-size: 26px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; }
.agent-action.buy, .agent-action.allow { color: var(--green); }
.agent-action.sell, .agent-action.deny { color: var(--red); }
.agent-action.hold { color: var(--muted); }
.agent-reason {
  font-size: 13px; color: var(--text-2); line-height: 1.55;
  background: var(--hover); border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 8px 10px; min-height: 58px;
}
.agent-meta {
  display: flex; flex-wrap: wrap; gap: 5px 12px;
  font-size: 11.5px; color: var(--muted);
}
.agent-meta b { font-family: var(--mono); color: var(--text-2); font-weight: 600; }

/* 合議 */
.consensus-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px; align-items: center;
}
.consensus-decision { min-width: 0; }
.decision { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: .01em; }
.decision.enter { color: var(--green); }
.decision.blocked { color: var(--red); }
.decision.conflict { color: var(--amber); }
.decision.hold { color: var(--text-2); }
.decision-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.score-box { min-width: 0; display: grid; gap: 9px; }
.score-line { display: grid; grid-template-columns: 34px minmax(0, 1fr) 46px; gap: 10px; align-items: center; }
.score-key { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.score-bar { height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.score-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--green); transition: width .2s ease; }
.score-bar.is-sell i { background: var(--red); }
.score-line b { font-size: 16px; text-align: right; color: var(--text); }
.score-note { font-size: 11.5px; color: var(--faint); }
.vote-box { display: grid; gap: 6px; align-content: center; min-width: 0; }
.vote-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); min-width: 0; }
.vote-item .dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.vote-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-item .ac { margin-left: auto; font-weight: 700; white-space: nowrap; }
.vote-item .ac.buy, .vote-item .ac.allow { color: var(--green); }
.vote-item .ac.sell, .vote-item .ac.deny { color: var(--red); }
.vote-item .ac.hold { color: var(--muted); }
.consensus-reason {
  margin-top: 16px; font-size: 13.5px; color: var(--text-2); line-height: 1.6;
  background: var(--hover); border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 10px 14px;
}

/* トークン消費 */
.token-breakdown { display: grid; gap: 8px; margin-top: 16px; }
.token-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) 100px 96px; gap: 12px; align-items: center; }
.token-row .nm { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.token-row .nm i { width: 8px; height: 8px; border-radius: 50%; }
.token-row .bar { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.token-row .bar i { display: block; height: 100%; border-radius: 999px; }
.token-row .tk { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--text-2); }
.token-row .cl { font-family: var(--mono); font-size: 11px; text-align: right; color: var(--faint); white-space: nowrap; }

/* 判断履歴 */
.table-wrap--hist { max-height: 420px; }
.table-wrap--hist .simple-table td { white-space: normal; }
.table-wrap--hist .agent-cell { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.table-wrap--hist .agent-cell i { width: 8px; height: 8px; border-radius: 50%; }
.hist-action { font-weight: 700; white-space: nowrap; }
.hist-action.buy, .hist-action.allow { color: var(--green); }
.hist-action.sell, .hist-action.deny { color: var(--red); }
.hist-action.hold { color: var(--muted); }

/* 架空口座 */
.trade-row--agent { cursor: default; }
.trade-row--agent:hover { background: transparent; }

/* エージェント未起動 */
.empty-agents h2 { font-size: 18px; margin-bottom: 6px; }

@media (max-width: 1180px) {
  .agent-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .consensus-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vote-box { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .view-tabs { width: 100%; justify-content: center; order: 3; }
  .agent-cards { grid-template-columns: minmax(0, 1fr); }
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .consensus-row { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .vote-box { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-row { grid-template-columns: 96px minmax(0, 1fr) 84px; }
  .token-row .cl { display: none; }
}

/* 大きな数字の単位は小さく（折り返し防止） */
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); font-family: var(--sans); letter-spacing: 0; }
.stat-value { white-space: nowrap; }

/* ============================================================
   v5: 脱カード化 — 1枚の紙。罫線と余白だけで区切る
   ============================================================ */

/* ページは白 1 面 */
body { background: var(--bg); }

/* カード（箱）全廃 */
.card,
.empty-agents,
.agent-table-section {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 38px 0;
  margin: 0;
}
.agent-table-section { padding: 34px 0; }
.card:first-child, .empty-agents:first-child { border-top: 0; padding-top: 12px; }

/* セクション見出し: 小さくグレー・字間広め */
.card-head { margin-bottom: 20px; align-items: baseline; }
.card-head h2 {
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: .14em; line-height: 1.4;
}
.card-head .muted { font-size: 11.5px; }
.card-head .btn, .card-head .btn-quiet { font-size: 12.5px; }

/* ヘッダー（帯） */
.top { background: rgba(11, 13, 18, .9); backdrop-filter: blur(8px); }
.top-inner { padding: 16px 24px; }
.brand-text h1 { font-size: 18px; }
.brand-sub { font-size: 12px; }

/* 検証モードのラベルは箱にしない */
.badge-test {
  background: transparent; border: 0; padding: 0;
  font-size: 12px; color: var(--amber);
}
.badge-test::before { width: 6px; height: 6px; }

/* タブは下線で表現 */
.view-tabs, .seg {
  background: transparent; padding: 0; border-radius: 0;
  gap: 26px; box-shadow: none;
}
.view-tab, .seg-btn {
  background: transparent; border-radius: 0; box-shadow: none;
  padding: 8px 0 7px; border-bottom: 2px solid transparent;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.view-tab:hover, .seg-btn:hover { color: var(--text-2); }
.view-tab.is-active, .seg-btn.is-active {
  background: transparent; box-shadow: none;
  color: var(--text); border-bottom-color: var(--text);
}
.seg-wide { margin: 10px 0 0; }
.tab-metric { border-radius: 999px; } /* 小さなバッジのみ例外 */

/* 警告バナー: 背景色だけの帯（枠・影・角丸なし） */
.banner {
  background: var(--amber-soft);
  border: 0; border-radius: 0;
  padding: 15px 24px;
  margin: 0 -24px 6px;
}
.banner-mark { width: 20px; height: 20px; line-height: 20px; font-size: 13px; }

/* ボタン: 控えめなものは下線テキストに */
.btn-quiet {
  background: transparent; border: 0; padding: 4px 2px;
  color: var(--text-2); text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: var(--faint);
}
.btn-quiet:hover { background: transparent; color: var(--text); text-decoration-color: var(--text-2); }
.btn-primary { border-radius: 10px; padding: 10px 20px; }

/* 並列指標は箱ではなく横並び＋縦罫線 */
.month-grid, .summary-grid { gap: 0; }
.month-grid > .stat, .summary-grid > .stat,
.stat {
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 2px 26px;
}
.month-grid > .stat:first-child, .summary-grid > .stat:first-child {
  border-left: 0; padding-left: 0;
}
.stat-label { font-size: 11.5px; letter-spacing: .08em; }
.stat-value { font-size: 34px; }

/* 状態: 箱なし・3 列に余白で分ける */
.status-card { padding-top: 34px; }
.status-col-main, .status-col-pnl { border-left: 1px solid var(--line-soft); }
.price { font-size: 46px; }
.pnl { font-size: 42px; }
.status { font-size: 31px; }

/* 入口: チップは箱にしない */
.chips { gap: 22px; }
.chip {
  background: transparent; border: 0; border-radius: 0;
  padding: 2px 0; font-size: 14.5px; font-weight: 600; color: var(--muted);
}
.chip.is-ok, .chip.is-ng { background: transparent; border: 0; }
.chip.is-ok { color: var(--green); }
.chip.is-ng { color: var(--red); }
.entry-note { margin-top: 16px; }

/* チャート: 囲みなし・白地 */
.chart-card { padding-bottom: 30px; }
.chart-legend { margin: 0 0 10px; }
.chart-wrap { height: 400px; }

/* 表・リストの囲みを外す */
.table-wrap { border: 0; border-radius: 0; }
.table-wrap--agents { border-top: 1px solid var(--line); }
.table-wrap--hist { border-top: 1px solid var(--line); max-height: 420px; }
.trade-list { border-top: 1px solid var(--line); }
.trade-row { padding: 15px 0; }
.trade-row:hover { background: transparent; }
.simple-table th { background: var(--card); padding: 10px 12px 10px 0; }
.simple-table td { padding: 11px 12px 11px 0; }

/* エージェントは表 */
.agent-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.agent-table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: .08em; padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.agent-table td {
  padding: 16px 16px 16px 0; border-bottom: 1px solid var(--line-soft);
  vertical-align: top; font-size: 13.5px; color: var(--text-2);
}
.agent-table tr:last-child td { border-bottom: 0; }
.agent-table .who { display: flex; gap: 10px; min-width: 0; }
.agent-table .who .dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; }
.agent-table .name { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.35; }
.agent-table .role { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 3px; max-width: 250px; }
.agent-table .act { font-size: 16px; font-weight: 700; white-space: nowrap; }
.agent-table .act.buy, .agent-table .act.allow { color: var(--green); }
.agent-table .act.sell, .agent-table .act.deny { color: var(--red); }
.agent-table .act.hold { color: var(--muted); }
.agent-table .reason-cell { font-size: 12.5px; line-height: 1.6; }
.agent-table .num-cell { text-align: right; font-family: var(--mono); white-space: nowrap; }
.agent-table td.num-cell { text-align: right; }

/* 合議: 1 行サマリ＋細いバー */
.cons-summary { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cons-summary .decision { font-size: 26px; }
.cons-meta { font-size: 12.5px; color: var(--muted); }
.cons-scores { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; margin-top: 16px; }
.cons-scores .score { display: inline-flex; align-items: center; gap: 10px; }
.cons-scores .score-key { font-size: 12px; color: var(--muted); }
.cons-scores b { font-family: var(--mono); font-size: 14px; }
.mini-bar { display: inline-block; width: 140px; height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.mini-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--green); }
.mini-bar.is-sell i { background: var(--red); }
.score-note { font-size: 11.5px; }
.cons-votes { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.cons-votes .vote { display: inline-flex; align-items: center; gap: 6px; }
.cons-votes .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cons-votes b { font-weight: 700; }
.cons-votes b.buy, .cons-votes b.allow { color: var(--green); }
.cons-votes b.sell, .cons-votes b.deny { color: var(--red); }
.cons-votes b.hold { color: var(--muted); }
.vote-sep { color: var(--faint); margin: 0 8px; }
.cons-reason {
  margin-top: 12px; font-size: 13.5px; line-height: 1.65; color: var(--text-2);
  padding: 0; background: transparent; border: 0; border-radius: 0;
}

/* トークン: 横並び数値行＋細いバー */
.summary-line { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; font-size: 15px; color: var(--text-2); }
.summary-line b { font-size: 30px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.summary-line .sep { color: var(--faint); }
.summary-sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.token-breakdown { margin-top: 22px; gap: 10px; }
.token-row { grid-template-columns: 132px minmax(0, 1fr) 104px 104px; }
.token-row .bar { height: 6px; }

/* モーダル内も囲みを外す（ダイアログ面のみ残す） */
.modal-dialog { border-radius: 8px; }
.modal .stat-mini, .modal .note-box, .modal .model-card, .modal .empty-note, .modal .table-wrap {
  background: transparent; border: 0; border-radius: 0; padding: 0;
}
.modal .stat-mini { padding: 10px 0; }
.modal .model-card { border-top: 1px solid var(--line); padding: 16px 0; }
.modal .table-wrap { border-top: 1px solid var(--line); }
.modal .note-box { padding: 10px 0; }
.modal .empty-note { padding: 18px 0; }

/* ウェイト画面も箱を弱める */
.wait-card { border-radius: 8px; border: 1px solid var(--line); box-shadow: none; }

/* レスポンシブ: 縦積み時は縦罫線を外す */
@media (max-width: 980px) {
  .banner { margin: 0 -14px 6px; padding: 14px 14px; }
  .month-grid > .stat, .summary-grid > .stat { border-left: 0; padding: 12px 0; }
  .month-grid, .summary-grid { row-gap: 4px; }
  .summary-line b { font-size: 24px; }
  .status-col-main, .status-col-pnl { border-left: 0; border-top: 1px solid var(--line-soft); padding-top: 20px; }
  .card { padding: 30px 0; }
}
@media (max-width: 640px) {
  .banner { margin: 0 -14px 6px; }
  .view-tabs, .seg { gap: 18px; }
  .cons-scores { gap: 16px; }
  .mini-bar { width: 90px; }
  .summary-line b { font-size: 22px; }
  .price { font-size: 38px; }
  .pnl { font-size: 34px; }
}

/* グリッド内で表がはみ出さないように */
.card, .agent-table-section, .empty-agents, #agentCards { min-width: 0; }
.table-wrap { max-width: 100%; }
.agent-table-section { overflow: hidden; }

/* ============================================================
   v6: ダークテーマ＋PC/スマホの見やすさ調整
   ・余白を詰めて 1 画面に入る情報を増やす
   ・スマホは 2 列グリッドで縦長スクロールを短く
   ============================================================ */
body { background: var(--bg); color: var(--text); }
.wrap { max-width: 1240px; gap: 0; padding: 18px 28px 40px; }
.top-inner { max-width: 1240px; padding: 12px 28px; }
.top { border-bottom-color: var(--line); }
.brand-mark { box-shadow: 0 4px 14px rgba(79, 140, 255, .3); }

.card, .agent-table-section, .empty-agents { padding: 26px 0; }
.card-head { margin-bottom: 14px; }

/* バナーは1行に収まる控えめな帯 */
.banner {
  margin: 0 0 10px; border-radius: 10px;
  border: 1px solid var(--amber-line); padding: 10px 14px;
}
.banner-main { font-size: 14px; }
.banner-sub { font-size: 12.5px; margin-top: 1px; }

/* 状態: 3列＋ボタンを右下に寄せて縦の空きを消す */
.status-card { padding-top: 22px; }
.status-foot { margin-top: 8px; }
.price { font-size: 48px; }
.pnl { font-size: 44px; }
.change { font-size: 14px; }
.reason { font-size: 15px; }
.tag { background: var(--line); color: var(--text-2); }

/* チャート: PC は高く */
.chart-wrap { height: 460px; }
.chart-card { padding-bottom: 22px; }

/* 成績 */
.stat-value { font-size: 32px; }

/* トレード一覧 */
.trade-row { padding: 12px 6px; border-bottom-color: var(--line); }
.trade-row .pips-cell { text-align: right; white-space: nowrap; }
.trade-row .pnl-cell { white-space: nowrap; }

.btn-primary { box-shadow: 0 4px 16px rgba(79, 140, 255, .25); }
.modal-dialog { background: var(--card); border: 1px solid var(--line); }
.modal-backdrop { background: rgba(0, 0, 0, .65); }

@media (max-width: 980px) {
  .wrap { padding: 14px 18px 32px; }
  .top-inner { padding: 10px 18px; }
  .card { padding: 22px 0; }
  .chart-wrap { height: 340px; }
  /* 状態: 価格｜損益 を横並び、状態は下に全幅 */
  .status-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 20px; }
  .status-grid > .status-col:first-child { grid-column: 1; grid-row: 1; }
  .status-col-pnl { grid-column: 2; grid-row: 1; border-top: 0; padding-top: 0; border-left: 1px solid var(--line); padding-left: 20px; }
  .status-col-main { grid-column: 1 / -1; grid-row: 2; border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .month-grid, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .month-grid > .stat, .summary-grid > .stat { border-left: 0; padding: 10px 0; border-top: 1px solid var(--line-soft); }
  .month-grid > .stat:nth-child(-n+2), .summary-grid > .stat:nth-child(-n+2) { border-top: 0; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .wrap { padding: 10px 14px 28px; }
  /* ヘッダー: 1行目=ロゴ＋操作、2行目=タブ（全幅・均等） */
  .top-inner { padding: 8px 14px 0; gap: 6px 10px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
  .brand-mark::after { left: 7px; right: 7px; top: 9px; }
  .brand-text h1 { font-size: 16px; }
  .brand-sub { font-size: 11px; }
  .top-actions { gap: 10px; margin-left: auto; }
  .badge-test { font-size: 11px; }
  .top-actions .btn-quiet { font-size: 12.5px; }
  .view-tabs { order: 3; width: 100%; gap: 0; justify-content: stretch; }
  .view-tab { flex: 1 1 0; text-align: center; padding: 9px 0 8px; font-size: 13.5px; }

  .banner { padding: 9px 12px; margin: 0 0 4px; }
  .banner-main { font-size: 13px; }
  .banner-sub { font-size: 11.5px; }

  .card, .agent-table-section, .empty-agents { padding: 18px 0; }
  .card-head { margin-bottom: 10px; }
  .status-card { padding-top: 12px; }
  .label { font-size: 11px; margin-bottom: 4px; }
  .price { font-size: 32px; }
  .pnl { font-size: 30px; }
  .change { font-size: 12px; }
  .record { font-size: 12px; }
  .status-grid { gap: 12px 14px; }
  .status-col-pnl { padding-left: 14px; }
  .status { font-size: 22px; }
  .reason { font-size: 14px; }
  .next { font-size: 12.5px; }
  .status-foot { margin-top: 12px; }
  .status-foot .btn { width: 100%; }

  .chips { gap: 8px 16px; }
  .chip { font-size: 13px; padding: 0; }
  .entry-note { margin-top: 10px; font-size: 12.5px; }

  .chart-wrap { height: 300px; }
  .seg { gap: 16px; }

  .stat-label { font-size: 10.5px; }
  .stat-value { font-size: 24px; }

  /* トレード: 日時 / 売買 / pips / 円 を 1 行に */
  .trade-row { grid-template-columns: 78px 38px minmax(0, 1fr) 84px; gap: 8px; padding: 11px 0; font-size: 13px; }
  .trade-row .when { font-size: 12px; }
  .side-pill { width: 34px; font-size: 11.5px; }
  .trade-row .pips-cell { font-size: 12.5px; }
}

/* v6 追い込み */
@media (min-width: 981px) {
  /* ボタンを損益列の下の空きに重ねて 1 行分を詰める */
  .status-foot { margin-top: -46px; position: relative; }
}
@media (max-width: 640px) {
  .brand-sub, .badge-test { display: none; } /* 検証モードは直下のバナーで表示済み */
  .top-inner { flex-wrap: wrap; }
  .trade-row { grid-template-columns: 92px 34px minmax(0, 1fr) 80px; }
  .trade-row .when { white-space: nowrap; font-size: 11.5px; }
}
@media (max-width: 640px) {
  .summary-big { font-size: 19px; word-break: break-all; }
  .table-wrap--hist { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap--hist .simple-table { min-width: 560px; }
  .table-wrap--hist .simple-table td { font-size: 12.5px; }
  .table-wrap--hist .simple-table td:first-child { white-space: nowrap; }
}

/* トレード一覧（全件の表・CSV） */
.ledger-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ledger-sum { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.ledger-sum b { color: var(--text); }
.btn-csv { padding: 8px 16px; font-size: 13px; }
.ledger-wrap { overflow: auto; max-height: 62vh; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.ledger { width: 100%; border-collapse: collapse; min-width: 860px; font-size: 12.5px; }
.ledger th {
  position: sticky; top: 0; z-index: 1; background: var(--card);
  text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .04em;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.ledger td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); color: var(--text-2); white-space: nowrap; }
.ledger .r { text-align: right; }
.ledger .side-pill { width: 44px; font-size: 11px; }
.ledger tr.ledger-click { cursor: pointer; }
.ledger tr.ledger-click:hover td { background: var(--hover); }
.card-head [data-ledger] { margin-left: auto; }
@media (max-width: 640px) {
  .ledger-head { align-items: stretch; }
  .btn-csv { width: 100%; }
  .ledger-wrap { max-height: 58vh; }
}
@media (max-width: 640px) {
  .ledger { min-width: 720px; font-size: 12px; }
  .ledger th, .ledger td { padding: 8px 8px; }
  .ledger th:first-child, .ledger td:first-child { position: sticky; left: 0; background: var(--card); z-index: 2; }
}

/* 誰の判断が通ったか */
.card-head [data-decisions] { margin-left: auto; }
.pass-table { min-width: 760px; }
.pass-note { margin-top: 10px; font-size: 12.5px; line-height: 1.6; }
.dec-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dec-filters select {
  min-height: 36px; padding: 0 10px; font-size: 13px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
}
.ledger td.wrap { white-space: normal; min-width: 240px; }

/* テスト */
.test-periods { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.test-disclaimer { margin: 0 0 14px; font-size: 13px; color: var(--text-2); }
.test-compare { min-width: 900px; }
.test-compare .btn { min-height: 32px; padding: 0 10px; font-size: 12px; }
.test-month { min-width: 560px; }
.test-chart-wrap { height: 300px; }
.test-chart-wrap canvas { display: block; width: 100%; height: 100%; }
.test-key { display: inline-block; width: 14px; height: 3px; margin: 0 4px 3px 8px; vertical-align: middle; border-radius: 2px; }
.concept-sub { margin-top: 24px; }
#testContent[hidden] { display: none; }
.grid-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 4px; font-size: 13px; color: var(--text-2); }
.grid-stats b { color: var(--text); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grid-heat-wrap { max-height: none; }
.grid-heat { border-collapse: separate; border-spacing: 3px; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; margin: 6px 0; }
.grid-heat th { color: var(--muted); font-weight: 600; font-size: 11px; padding: 4px 6px; text-align: center; white-space: nowrap; }
.grid-heat th.grid-axis { text-align: left; }
.grid-heat td { min-width: 50px; height: 40px; padding: 3px 4px; text-align: center; border-radius: 6px; color: var(--text); cursor: pointer; line-height: 1.15; }
.grid-heat td small { display: block; font-size: 9.5px; color: var(--muted); }
.grid-heat td.grid-top { outline: 1.5px solid var(--amber); outline-offset: -1.5px; }
.grid-heat td.grid-sel { outline: 2px solid var(--text); outline-offset: -2px; }
.grid-list { min-width: 1120px; }
.grid-list th { cursor: pointer; user-select: none; }
.grid-list th[aria-sort] { color: var(--text); }
.grid-list tr.grid-sel td { background: var(--accent-soft); }
.grid-csv { margin-left: auto; }
.grid-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.grid-picks .btn { min-height: 30px; padding: 0 10px; font-size: 12px; font-family: var(--mono); }
.grid-trades { min-width: 1180px; }
.grid-trades td:last-child { white-space: normal; min-width: 260px; color: var(--muted); }
