/* 標準フォントで読みやすさを保ち、既存の研究画面と色調を揃える。 */
:root {
  --bg: #f4f7f8;
  --panel: #fff;
  --ink: #21363e;
  --muted: #637780;
  --line: #dfe7e9;
  --teal: #13756f;
  --teal-light: #e7f3ef;
  --red: #a53e49;
  --amber: #8e651d;
  --navy: #263d4b;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; font-size: 14px; line-height: 1.7; }
button, input, select { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
a { color: inherit; }
a, button, input, select, summary, [tabindex] { outline-offset: 4px; }
:focus-visible { outline: 3px solid #3297ae; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10; left: 20px; top: -100px; background: #fff; border: 1px solid var(--teal); padding: 10px 18px; }
.skip-link:focus { top: 10px; }
.topbar { display: flex; align-items: center; gap: 32px; min-height: 80px; padding: 0 max(28px, calc((100vw - 1340px) / 2)); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; font-size: 15px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; background: var(--teal); font-size: 17px; }
.brand small { display: block; font-size: 8px; letter-spacing: .18em; color: var(--muted); font-weight: 600; }
.topbar nav { display: flex; align-items: stretch; align-self: stretch; gap: 25px; flex: 1; }
.topbar nav a { display: flex; align-items: center; white-space: nowrap; border-bottom: 3px solid transparent; padding-top: 3px; text-decoration: none; font-size: 12px; color: var(--muted); }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: var(--teal); border-bottom-color: var(--teal); }
.topbar nav a[aria-current="page"] { font-weight: 700; }
.mode { display: flex; gap: 7px; align-items: center; font-size: 11px; color: var(--teal); white-space: nowrap; }
.mode > span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
main { max-width: 1396px; padding: 32px 28px 20px; margin: 0 auto; }
.page-heading, .section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-heading { margin-bottom: 23px; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .14em; font-weight: 650; margin: 0 0 5px; }
h1 { font-size: 27px; font-weight: 650; line-height: 1.4; letter-spacing: .025em; margin: 0; }
h2 { font-size: 18px; font-weight: 650; line-height: 1.5; margin: 0; }
h3 { font-size: 14px; font-weight: 650; margin: 0; }
p { margin-top: 0; }
.lead { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.button { border: 1px solid #ccdadd; border-radius: 7px; background: #fff; padding: 9px 15px; font-size: 12px; font-weight: 600; min-height: 40px; white-space: nowrap; }
.button:hover:not(:disabled) { background: var(--teal-light); border-color: #a3c5bf; }
.button > span { font-size: 20px; line-height: 1; margin-right: 7px; vertical-align: -1px; }
.button.compact { min-height: 34px; padding: 5px 12px; font-size: 11px; }
.selection-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 10px; background: #edf3f2; }
.selection-bar label, .table-controls label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
input, select { border: 1px solid #cad8dc; border-radius: 6px; background: #fff; padding: 9px 12px; font-size: 12px; min-height: 38px; max-width: 100%; color: var(--ink); }
select { min-width: 220px; }
#strategy-select { min-width: 270px; }
.selection-meta { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 10px; color: var(--muted); }
.selection-meta span:last-child { color: var(--ink); }
.load-state { color: var(--muted); font-size: 11px; margin: 10px 2px 22px; }
.load-state.error { color: var(--red); background: #fff1f2; padding: 10px 14px; border-radius: 6px; }
.portfolio-heading { margin-bottom: 13px; }
.subtext { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid transparent; border-radius: 5px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.neutral, .badge.quiet { color: #5c727c; background: #eaf0f2; }
.badge.caution, .badge.reference, .badge.warning { color: var(--amber); background: #fff3dd; border-color: #f0e1c1; }
.badge.error, .badge.incomplete { color: var(--red); background: #faecee; border-color: #eed7dc; }
.badge.success, .badge.strict { color: var(--teal); background: var(--teal-light); }
.metrics-grid { display: grid; grid-template-columns: 1.22fr 1fr 1fr; gap: 16px; }
.metrics-grid.prospective { grid-template-columns: 1.15fr 1fr 1fr 1fr; }
.metric-card { padding: 21px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.metric-card h3 { font-size: 11px; color: var(--muted); font-weight: 500; }
.metric-amount { font-size: clamp(24px, 2.25vw, 32px); font-weight: 620; line-height: 1.35; letter-spacing: -.025em; font-variant-numeric: tabular-nums; min-height: 43px; margin: 9px 0 10px; white-space: nowrap; }
.primary-metric { background: #eff8f4; border-color: #bed9ce; }
.primary-metric h3 { color: #42695d; }
.primary-metric .metric-amount { color: var(--teal); }
.metric-caption { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 10px; color: var(--muted); }
#pnl-return { font-size: 12px; font-weight: 600; color: var(--teal); }
.positive { color: var(--teal) !important; }
.negative { color: var(--red) !important; }
.case-context { margin: 12px 2px 19px; font-size: 12px; }
.case-context p { margin-bottom: 0; }
.case-context .subtext { font-size: 10px; }
.chart-layout { display: grid; grid-template-columns: minmax(0, 2.65fr) minmax(270px, 1fr); gap: 18px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 22px; }
.panel-heading { margin-bottom: 18px; }
.chart-heading { margin-bottom: 12px; }
.chart-heading h3 { font-size: 15px; }
.segmented { display: flex; gap: 2px; border-radius: 6px; padding: 3px; background: #eff3f4; }
.segmented button { border: 0; padding: 5px 11px; background: transparent; border-radius: 4px; font-size: 10px; color: var(--muted); min-height: 30px; }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px #16302d0d; }
.chart { height: 262px; width: 100%; position: relative; }
.chart svg, .drawdown-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text, .drawdown-chart text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-grid { stroke: #e9eff0; stroke-width: 1; }
.equity-line { stroke: var(--teal); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.equity-area { fill: #e7f3ee; }
.drawdown-line { stroke: #8ba5b4; stroke-width: 1.4; fill: none; }
.drawdown-area { fill: #eaf0f3; }
.chart-baseline { stroke: #a0b4bd; stroke-width: 1; stroke-dasharray: 4 4; }
.chart-cursor { stroke: #70988f; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { fill: var(--teal); stroke: #fff; stroke-width: 2; }
.chart-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12px; color: var(--muted); margin: 0; }
.drawdown-heading { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 6px; color: var(--muted); font-size: 9px; }
.drawdown-heading i { display: inline-block; width: 15px; height: 2px; background: #8ba5b4; vertical-align: middle; margin-right: 5px; }
.drawdown-chart { height: 81px; }
.chart-point { color: #526d73; font-size: 10px; min-height: 18px; margin: 9px 0 0; font-variant-numeric: tabular-nums; }
.table-note { font-size: 10px; color: var(--muted); margin: 8px 0 0; }
.breakdown-panel h3 { margin-bottom: 13px; }
.summary-list { margin: 0; }
.summary-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid #edf1f2; }
.summary-list dt { color: var(--muted); font-size: 11px; }
.summary-list dd { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cost-heading { margin-top: 23px; padding-bottom: 6px; color: var(--muted); font-size: 10px; }
.costs-list > div { padding: 9px 0; }
.summary-list .summary-total { border-bottom: 0; }
.summary-total dt, .summary-total dd { color: var(--ink); font-weight: 600; }
.breakdown-note { margin: 17px 0 12px; background: #f3f7f6; border-radius: 6px; padding: 12px; font-size: 10px; color: var(--muted); line-height: 1.85; }
.text-link { font-size: 11px; color: var(--teal); text-underline-offset: 4px; text-decoration-color: #a9c7bf; }
.text-link:hover { text-decoration-color: currentColor; }
.meta, .count { font-size: 11px; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.section-note { margin: -7px 0 17px; font-size: 11px; color: var(--muted); line-height: 1.9; }
.table-controls { display: flex; align-items: flex-end; gap: 14px; margin: 0 0 17px; }
.table-controls select { min-width: 180px; }
.table-controls input { width: 235px; }
.table-controls .count { margin-left: auto; padding-bottom: 8px; }
input::placeholder { color: #7a8d94; }
.table-scroll { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { border-collapse: collapse; width: 100%; font-size: 12px; white-space: nowrap; }
th { padding: 11px 12px; border-bottom: 1px solid var(--line); background: #f7faf9; color: var(--muted); text-align: left; font-size: 10px; font-weight: 500; }
td { padding: 13px 12px; border-bottom: 1px solid #eaf0f1; color: #455d68; }
tbody tr:hover { background: #f8fbfa; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-cell { color: var(--muted); text-align: center; padding: 33px 16px !important; font-size: 11px; white-space: normal; }
.stock-name { display: block; font-size: 12px; color: var(--ink); font-weight: 600; }
.stock-code, .cell-sub { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.reason-cell { white-space: normal; min-width: 180px; max-width: 300px; font-size: 10px; color: var(--muted); }
.action { display: inline-block; border-radius: 4px; padding: 2px 7px; background: #edf2f4; color: #5f7581; font-size: 10px; }
.action.buy, .action.matched { background: var(--teal-light); color: var(--teal); }
.action.sell { background: #faecee; color: var(--red); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 15px; font-size: 10px; color: var(--muted); }
.pagination > span { margin-right: 5px; }
.paper-panel { border-top: 3px solid #bdd4ce; }
.paper-facts { display: flex; flex-wrap: wrap; gap: 12px 25px; color: var(--muted); font-size: 11px; margin: 0 0 15px; }
.paper-facts:empty { display: none; }
.paper-facts p { margin: 0; }
.section-link { display: inline-block; margin-top: 15px; }
.reading-guide { border: 1px solid var(--line); border-radius: 9px; background: #eef3f3; padding: 15px 19px; margin-bottom: 16px; }
.reading-guide summary { color: #45646a; font-size: 12px; font-weight: 600; }
.reading-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 30px; padding-top: 18px; }
.reading-grid h3 { font-size: 11px; margin: 0 0 5px; }
.reading-grid p { font-size: 11px; color: var(--muted); line-height: 1.9; margin-bottom: 0; }
.source-note { font-size: 10px; color: var(--muted); overflow-wrap: anywhere; margin: 15px 2px; }
footer { display: flex; justify-content: space-between; gap: 14px; color: #6d838a; font-size: 10px; padding: 12px 2px 5px; border-top: 1px solid var(--line); }
@media (min-width: 1500px) {
  main { padding-top: 38px; }
  .chart { height: 280px; }
}
@media (max-width: 1120px) {
  .topbar { padding: 0 24px; gap: 24px; }
  .topbar nav { gap: 19px; }
  .topbar .mode { display: none; }
  .selection-bar { gap: 15px; }
  .selection-meta { max-width: 190px; overflow-wrap: anywhere; }
  .chart-layout { grid-template-columns: minmax(0, 2fr) 270px; }
  .metric-card { padding: 20px; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 0; padding: 15px 22px 0; min-height: auto; }
  .brand { margin-bottom: 12px; }
  .topbar .mode { display: flex; margin-left: auto; margin-bottom: 12px; }
  .topbar nav { flex-basis: 100%; gap: 26px; overflow-x: auto; min-height: 43px; }
  .topbar nav a { padding: 0 0 9px; }
  main { padding: 26px 22px 18px; }
  .selection-bar { flex-wrap: wrap; }
  .selection-bar label { flex: 1; }
  #strategy-select, .selection-bar select { min-width: 0; width: 100%; }
  .selection-meta { max-width: none; flex-direction: row; flex-basis: 100%; gap: 10px; justify-content: flex-end; }
  .metrics-grid { gap: 10px; grid-template-columns: 1.1fr 1fr 1fr; }
  .metric-card { padding: 17px 15px; }
  .metric-amount { font-size: 25px; min-height: 34px; }
  .chart-layout { grid-template-columns: 1fr; gap: 0; }
  .breakdown-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; }
  .breakdown-panel > h3 { grid-column: 1 / -1; }
  .breakdown-panel > .summary-list:not(.costs-list) { grid-column: 1; grid-row: 2 / 4; }
  .cost-heading { grid-column: 2; grid-row: 2; margin-top: 0; }
  .costs-list { grid-column: 2; grid-row: 3; }
  .breakdown-note { grid-column: 1; grid-row: 4; }
  .breakdown-panel .text-link { grid-column: 2; grid-row: 4; align-self: center; }
}
@media (max-width: 580px) {
  body { font-size: 13px; }
  .topbar { padding: 13px 16px 0; }
  .brand { font-size: 14px; }
  .brand-mark { width: 33px; height: 33px; }
  .topbar nav { gap: 22px; margin-right: -16px; padding-right: 16px; }
  .topbar nav a { font-size: 11px; }
  .mode { font-size: 10px; }
  main { padding: 24px 16px 15px; }
  .page-heading { align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  h1 { font-size: 21px; }
  h2 { font-size: 16px; }
  .eyebrow { font-size: 8px; }
  .lead { font-size: 11px; max-width: 210px; }
  .page-heading .button { padding: 7px 9px; font-size: 10px; min-height: 36px; }
  .page-heading .button > span { font-size: 17px; margin-right: 3px; }
  .selection-bar { padding: 13px; gap: 11px; }
  .selection-bar label { flex-basis: 100%; }
  .selection-meta { justify-content: flex-start; flex-wrap: wrap; font-size: 9px; }
  .load-state { font-size: 10px; margin-bottom: 18px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .primary-metric { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .primary-metric .metric-amount { grid-column: 2; grid-row: 1 / 3; margin: 0; align-self: center; font-size: 29px; }
  .primary-metric .metric-caption { grid-column: 1; gap: 3px 8px; }
  .primary-metric .metric-caption > span:last-child { flex-basis: 100%; font-size: 9px; }
  .metric-card { padding: 16px 13px; }
  .metric-card h3 { font-size: 10px; }
  .metric-amount { font-size: 24px; }
  .metric-caption { font-size: 9px; }
  .case-context { font-size: 11px; margin-bottom: 16px; }
  .panel { padding: 18px 15px; margin-bottom: 18px; }
  .panel-heading { gap: 12px; margin-bottom: 16px; }
  .panel-heading .meta { font-size: 10px; max-width: 150px; text-align: right; }
  .chart-heading { align-items: flex-start; }
  .chart-heading h3 { font-size: 14px; }
  .chart-heading .subtext { font-size: 9px; }
  .segmented button { padding: 4px 8px; font-size: 9px; min-height: 29px; }
  .chart { height: 230px; }
  .drawdown-heading { font-size: 8px; gap: 8px; }
  .drawdown-chart { height: 72px; }
  .chart-point, .table-note { font-size: 9px; }
  .breakdown-panel { display: block; }
  .cost-heading { margin-top: 20px; }
  .breakdown-note { margin-bottom: 10px; }
  .section-note { font-size: 10px; }
  .table-controls { flex-wrap: wrap; gap: 11px; }
  .table-controls label { font-size: 10px; flex: 1; }
  .table-controls .search-control { flex-basis: 100%; }
  .table-controls input, .table-controls select { width: 100%; min-width: 0; }
  .table-controls .count { margin-left: 0; padding-bottom: 9px; font-size: 10px; }
  .table-scroll { margin: 0 -15px; padding: 0 15px; }
  th { padding: 10px; font-size: 9px; }
  td { padding: 12px 10px; font-size: 11px; }
  .pagination { font-size: 9px; }
  .reading-guide { padding: 13px 15px; }
  .reading-grid { grid-template-columns: 1fr; gap: 16px; }
  .source-note { font-size: 9px; }
  footer { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* 将来模擬運用は4指標を端末幅に合わせて折り返す。 */
@media (max-width: 1100px) { .metrics-grid.prospective { grid-template-columns: 1fr 1fr; } }
@media (max-width: 580px) { .metrics-grid.prospective .daily-metric { grid-column: 1 / -1; } }

/* QVM＋コアETF戦略ダッシュボード用のレイアウト・チャート装飾 */
.topbar { justify-content: space-between; }
.topbar-meta { display: flex; align-items: center; gap: 12px; }
#qvm-plan-select { min-width: 340px; font-weight: 600; }
#qvm-scenario-select { min-width: 280px; }
.portfolio-section { margin-top: 18px; }
.subchart-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 6px; padding-top: 14px; border-top: 1px solid #edf1f2; }
.subchart-header h3 { font-size: 13px; font-weight: 650; }
.legend-inline { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend-dot { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot::before { content: ""; width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.stock-dot::before { background: #4f46e5; }
.etf-dot::before { background: #0d9488; }
.cash-dot::before { background: #cbd5e1; }
.alloc-chart { height: 155px; width: 100%; position: relative; }
.alloc-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.alloc-chart text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.drawdown-chart { height: 110px; }
.line-R2 { stroke: #7c3aed; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.line-H6 { stroke: #2563eb; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.line-F3 { stroke: #059669; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.line-H5 { stroke: #d97706; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.line-ETF60 { stroke: #94a3b8; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 4 3; }
.line-active { stroke-width: 2.6; }
.line-muted { stroke-width: 1.5; opacity: 0.72; }
.area-cash { fill: #e2e8f0; }
.area-etf { fill: #99f6e4; }
.area-stock { fill: #a5b4fc; }
.dd-limit-line { stroke: #dc2626; stroke-width: 1.2; stroke-dasharray: 4 3; }
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.trades-scroll { max-height: 420px; overflow-y: auto; }
.plan-row { cursor: pointer; }
.plan-row.selected-row { background: #eff8f4; font-weight: 600; }
@media (max-width: 960px) {
  .two-col-grid { grid-template-columns: 1fr; gap: 0; }
  #qvm-plan-select, #qvm-scenario-select { min-width: 0; width: 100%; }
}

/* 立花証券API 口座残高・取引結果・実現損益画面 (/account) */
.api-status-bar { align-items: center; gap: 28px; }
.api-status-item { display: flex; flex-direction: column; gap: 4px; }
.api-label { font-size: 10px; color: var(--muted); }
.api-badge-row { display: flex; align-items: center; gap: 8px; }
.api-sub { font-size: 11px; color: var(--muted); }
.api-value { font-size: 12px; color: var(--ink); font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; background: #e6efee; padding: 2px 6px; border-radius: 4px; color: var(--navy); }
.inline-filter select { min-width: 150px; min-height: 32px; padding: 4px 10px; font-size: 11px; }
.bar-profit { fill: #0d9488; }
.bar-loss { fill: #dc2626; }
.bar-zero-line { stroke: #94a3b8; stroke-width: 1; }
.line-realized { stroke: #059669; stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.order-id-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; color: var(--muted); }
