/* ================================================================
   投資ダッシュボード スタイルシート
   オニミネ BY MARU - Phase 1 (UIのみ)
   ================================================================ */

/* ── リセット & 基本設定 ─────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* カラーパレット */
  --color-primary: #1a1f36;
  --color-sidebar-bg: #ffffff;
  --color-sidebar-border: #f0f0f5;
  --color-header-bg: rgba(255, 255, 255, 0.85);
  --color-body-bg-start: #e8f0fe;
  --color-body-bg-mid: #f5e6ff;
  --color-body-bg-end: #fce4f0;
  --color-card-white: #ffffff;
  --color-card-dark: #1a1f36;
  --color-card-green: #16a34a;
  --color-card-green-dark: #14532d;
  --color-text-primary: #1a1f36;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-light: #f8fafc;
  --color-green: #16a34a;
  --color-green-light: #22c55e;
  --color-red: #dc2626;
  --color-red-light: #ef4444;
  --color-orange: #ea580c;
  --color-blue: #3b82f6;
  --color-accent: #f59e0b;

  /* レイアウト */
  --sidebar-width: 220px;
  --header-height: 64px;
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 6px 24px rgba(0, 0, 0, 0.14);

  /* フォント */
  --font-primary: 'Inter', 'Noto Sans JP', system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--color-text-primary);
  background: linear-gradient(
    135deg,
    var(--color-body-bg-start) 0%,
    var(--color-body-bg-mid) 50%,
    var(--color-body-bg-end) 100%
  );
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ================================================================
   レイアウト
   ================================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ── サイドバー ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 2px;
}

/* ロゴエリア */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--color-sidebar-border);
  background: linear-gradient(135deg, #1a1f36 0%, #2d3748 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.logo-main {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 16px;
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.logo-sub {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.05em;
  margin-top: 1px;
}

/* ナビゲーション */
.sidebar-nav {
  padding: 8px 0 24px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-category {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  padding: 10px 16px 4px;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin: 1px 8px;
  border-radius: var(--border-radius-sm);
  transition: background 0.15s;
}

.nav-item:hover {
  background: #f8fafc;
}

.nav-item--active {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
}

.nav-item--active .nav-label {
  color: #1d4ed8;
  font-weight: 600;
}

.nav-item--active .nav-icon {
  opacity: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  font-size: 12.5px;
  color: var(--color-text-secondary);
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--color-text-primary);
}

.nav-icon {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-bullet {
  width: 18px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── メインラッパー ───────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── ヘッダー ─────────────────────────────────────── */
.header {
  height: var(--header-height);
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s;
}

.hamburger-btn:hover {
  background: #f1f5f9;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  transition: transform 0.2s;
}

.search-bar {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 0 14px;
  height: 38px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--color-text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background 0.15s;
}

.icon-btn:hover {
  background: #f1f5f9;
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border: 2px solid white;
  border-radius: 50%;
}

.profile-area {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 24px;
  transition: background 0.15s;
}

.profile-area:hover {
  background: #f1f5f9;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.profile-role {
  font-size: 10px;
  color: #7c3aed;
  font-weight: 500;
}

/* ── メインコンテンツ ─────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px 24px 40px;
  max-width: 1400px;
  width: 100%;
}

/* ================================================================
   ダッシュボードタイトルエリア
   ================================================================ */

.dashboard-title-area {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: start;
}

.title-left {
  grid-column: 1;
  grid-row: 1;
}

.title-right {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.info-box {
  grid-column: 1 / -1;
  grid-row: 2;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.last-updated {
  font-size: 12px;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

.info-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.info-text {
  font-size: 12px;
  color: #92400e;
}

/* ================================================================
   ダッシュボードグリッド
   ================================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.grid-item {
  min-width: 0;
}

.grid-item--half {
  grid-column: span 1;
}

.grid-item--full {
  grid-column: span 2;
}

/* ================================================================
   カード共通スタイル
   ================================================================ */

.card {
  background: var(--color-card-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: box-shadow 0.2s;
  height: 100%;
  /* iOS Safari: border-radius + overflow:hidden の組み合わせを避ける */
  /* overflow は各カード側で個別に制御する */
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card--dark {
  background: var(--color-card-dark);
  color: var(--color-text-light);
}

.card--green {
  background: linear-gradient(135deg, #15803d 0%, #166534 60%, #14532d 100%);
  color: var(--color-text-light);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-shrink: 0;  /* flex親でもヘッダーが潰れないよう固定 */
}

.card-icon {
  font-size: 18px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.card-title--light {
  color: var(--color-text-light);
}

/* ================================================================
   カード2：相場サマリー
   ================================================================ */

.market-summary-card {
  background: linear-gradient(145deg, #1e2a4a 0%, #1a1f36 100%);
  min-height: 160px;
}

/* サマリー本文エリア */
.summary-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.summary-line {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(248, 250, 252, 0.9);
  margin: 0;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  border-left: 3px solid rgba(245, 158, 11, 0.6);
}

/* カテゴリ別ボーダー色 */
.summary-line--trend  { border-left-color: #60a5fa; }  /* 青: トレンド */
.summary-line--macro  { border-left-color: #a78bfa; }  /* 紫: マクロ */
.summary-line--sector { border-left-color: #34d399; }  /* 緑: セクター */
.summary-line--weekly { border-left-color: #fbbf24; }  /* 黄: 週間 */
.summary-line--alert  { border-left-color: #f87171; background: rgba(248, 113, 113, 0.08); } /* 赤: アラート */

/* エラーバナー非表示デフォルト */
#summary-error-banner {
  display: none;
}
[data-state="error"] #summary-error-banner {
  display: flex;
}

/* ================================================================
   カード3：オニミネトレンド
   ================================================================ */

.onine-trend-card {
  min-height: 160px;
}

.trend-header {
  margin-bottom: 16px;
}

.trend-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.trend-title {
  font-size: 26px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.trend-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 4px 12px;
}

.trend-status-icon {
  color: #86efac;
  font-size: 12px;
}

.trend-status-text {
  font-size: 13px;
  font-weight: 600;
  color: #86efac;
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.ticker-card {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--border-radius-md);
  padding: 12px 10px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.ticker-symbol {
  font-size: 12px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
}

.ticker-name {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
}

.ticker-value {
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.ticker-change {
  font-size: 12px;
  font-weight: 600;
}

.ticker-change--pos {
  color: #86efac;
}

.ticker-change--neg {
  color: #fca5a5;
}

/* ================================================================
   カード4：経済指標
   ================================================================ */

/* ── 経済指標カード ──
   iOS Safari 対応の確実な方法：
   flex:1 による計算高さは iOS Safari が認識しないため、
   スクロールコンテナの height を px で直接固定する。
   カード 420px - card-header 約52px - footer 約36px = 約332px
   ─────────────────────────────────────────── */
.economic-events-card {
  display: flex;
  flex-direction: column;
  height: 420px;
  overflow: hidden;
  box-sizing: border-box;
}

.events-scroll-container {
  /* iOS Safari: flex計算高さではなく px 固定が必須 */
  display: block;
  height: 332px;                       /* 420 - header52 - footer36 */
  flex-shrink: 0;
  /* スクロール設定 */
  overflow-y: scroll;                  /* auto より scroll の方が iOS で確実 */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  /* スクロールバー */
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
  overflow-x: auto;
  box-sizing: border-box;
}

.events-scroll-container::-webkit-scrollbar {
  width: 4px;
}

.events-scroll-container::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 2px;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
}

.events-th {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f5;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.events-row {
  border-bottom: 1px solid #f8fafc;
  transition: background 0.1s;
}

.events-row:last-child {
  border-bottom: none;
}

.events-row:hover {
  background: #f8fafc;
}

.events-td {
  padding: 8px 8px;
  font-size: 12px;
  vertical-align: middle;
}

.events-date {
  color: var(--color-text-muted);
  white-space: nowrap;
  font-size: 11px;
}

.events-time {
  color: #ef4444;
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
}

.events-name {
  color: var(--color-text-primary);
  font-weight: 500;
  font-size: 12.5px;
}

.events-forecast {
  color: var(--color-text-secondary);
  white-space: nowrap;
  font-size: 11px;
}

/* ── Phase 5: 実績値・状態スタイル ── */

/* ── スマホ向け：経済指標スクロールエリアの高さ調整 ── */
@media (max-width: 768px) {
  .economic-events-card {
    height: 380px;
  }
  .events-scroll-container {
    height: 292px;   /* 380 - header52 - footer36 */
  }
}
@media (max-width: 480px) {
  .economic-events-card {
    height: 340px;
  }
  .events-scroll-container {
    height: 252px;   /* 340 - header52 - footer36 */
  }
}

/* テーブルヘッダー列幅 */
.events-th--date  { width: 66px; }
.events-th--time  { width: 56px; }
.events-th--name  { min-width: 120px; }
.events-th--forecast, .events-th--actual, .events-th--prev {
  width: 64px;
  text-align: right;
}

/* 予想値・前回値・実績値を右揃え */
.events-forecast,
.events-actual,
.events-prev {
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* 実績値 色分け */
.events-actual--better {
  color: #22c55e;
  font-weight: 700;
}
.events-actual--worse {
  color: #ef4444;
  font-weight: 700;
}
.events-actual--inline {
  color: #94a3b8;
  font-weight: 600;
}
.events-actual--pending {
  color: #cbd5e1;
}

/* 未発表ダッシュ */
.events-pending {
  color: #cbd5e1;
  font-size: 14px;
}

/* 今日の行ハイライト */
.events-row--today {
  background: rgba(99, 102, 241, 0.06);
  border-left: 3px solid #6366f1;
}
.events-row--today:hover {
  background: rgba(99, 102, 241, 0.1);
}
.events-row--today .events-date {
  color: #6366f1;
  font-weight: 700;
}

/* スケルトン行 */
.events-row--skeleton .events-td {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* フッター：凡例 */
.events-footer {
  padding: 6px 8px 0;
  border-top: 1px solid #f0f0f5;
  margin-top: 4px;
  flex-shrink: 0;  /* スクロール領域に押し潰されないよう固定 */
}
.events-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 3px;
}
.legend-dot--better { background: #22c55e; }
.legend-dot--worse  { background: #ef4444; }
.legend-dot--inline { background: #94a3b8; }

/* エラーバナー（data-state連動） */
#card-economic-events[data-state="error"] .events-table-body,
#card-economic-events[data-state="retrying"] .events-table-body {
  opacity: 0.4;
}
#card-economic-events[data-state="loading"] #events-error-banner,
#card-economic-events[data-state="success"] #events-error-banner {
  display: none !important;
}
#card-economic-events[data-state="error"] #events-error-banner,
#card-economic-events[data-state="retrying"] #events-error-banner {
  display: flex;
  flex-shrink: 0;   /* flex子要素として潰れないよう固定 */
}

/* ================================================================
   カード5：週間パフォーマンス
   ================================================================ */

.weekly-performance-card {
  background: linear-gradient(145deg, #1e2a4a 0%, #0f172a 100%);
  min-height: 220px;
}

.perf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  row-gap: 8px;
}

.perf-title-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.perf-icon {
  font-size: 16px;
}

.perf-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 3px;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.perf-tab {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  min-height: 32px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* iPhone Safari タップ遅延・阻害を完全除去 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.15);
  user-select: none;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.perf-tab--active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.perf-tab:hover:not(.perf-tab--active) {
  color: rgba(255, 255, 255, 0.85);
}

.perf-total {
  display: flex;
  align-items: center;
  gap: 4px;
}

.perf-change-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.perf-change-value {
  font-size: 14px;
  font-weight: 700;
  color: #86efac;
}

.chart-container {
  position: relative;
  width: 100%;
}

.chart-wrapper {
  display: block;
}

.chart-wrapper--hidden {
  display: none;
}

.perf-svg {
  width: 100%;
  height: 100px;
  display: block;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  padding: 0 10px;
}

.chart-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* ================================================================
   カード6：セクターETFパフォーマンス
   ================================================================ */

.sector-etf-card {}

/* 期間バッジ「1D」 */
.sector-period-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

.sector-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 各セクター行: 名前 | シンボル | 中央基点バー | 変化率 */
.sector-row {
  display: grid;
  grid-template-columns: 72px 1fr 100px 54px;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}

.sector-name {
  font-size: 12px;
  color: var(--color-text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sector-ticker {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 中央基点バー ─────────────────────────────────── */
/* 全体ラッパー: 左エリア + 中央線 + 右エリアを横並び */
.sector-bar-center-wrap {
  display: flex;
  align-items: center;
  height: 10px;
  gap: 0;
}

/* 左側（マイナス方向）エリア: 右端から伸びる */
.sector-bar-left-area {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* バーを右端（中央線側）に配置 */
  overflow: hidden;
}

/* 右側（プラス方向）エリア: 左端から伸びる */
.sector-bar-right-area {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;  /* バーを左端（中央線側）に配置 */
  overflow: hidden;
}

/* 中央線 */
.sector-bar-center-line {
  width: 2px;
  height: 14px;
  background: rgba(100,116,139,0.35);
  flex-shrink: 0;
  border-radius: 1px;
}

/* プラスバー（右側：緑、左→右グラデ） */
.sector-bar-pos-bar {
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  transition: width 0.4s ease;
}

/* マイナスバー（左側：赤、右→左グラデ） */
.sector-bar-neg-bar {
  height: 8px;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(270deg, #f87171, #dc2626);
  transition: width 0.4s ease;
}

/* ローディング状態（グレー） */
.sector-bar--loading {
  background: #e2e8f0 !important;
  animation: pulse 1.5s ease-in-out infinite;
}

.sector-change {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

/* ================================================================
   テーマ別ETFパフォーマンス（日本）2列グリッド
   ================================================================ */

/* 2列グリッドコンテナ */
.jp-sector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 0;
}

/* 各アイテム */
.jp-sector-item {
  padding: 7px 8px;
  background: var(--color-bg-secondary, #f8fafc);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 6px;
  transition: background 0.15s;
}
.jp-sector-item:hover {
  background: #f1f5f9;
}

/* 上段：テーマ名 ＋ 変化率 */
.jp-sector-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.jp-sector-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.jp-sector-change {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 下段：銘柄タグ行 */
.jp-sector-sym-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}
.jp-sector-sym-tag {
  font-size: 10px;
  color: var(--color-text-muted, #64748b);
  background: var(--color-bg-primary, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .jp-sector-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   カード7：セクター別ランキング
   ================================================================ */

/* ── Phase 5: 3期間横並びランキング ── */

.sector-ranking-card {
  /* 横並び3カラム対応 */
}

/* 既存タブヘッダーは非表示 */
.ranking-tabs-header {
  display: none;
}

/* 全期間ラッパー: 横並び3等分 */
.ranking-all-periods {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid #e8edf5;
  border-radius: 10px;
  overflow: hidden;
}

/* 各期間セクション */
.ranking-period-section {
  border: none;
  border-radius: 0;
  overflow: hidden;
  /* 縦分割線（右隣がある場合） */
}
.ranking-period-section:not(:last-child) {
  border-right: 1px solid #e8edf5;
}

/* 期間ヘッダー */
.ranking-period-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e8edf5;
  flex-wrap: wrap;
}

/* 期間バッジ */
.ranking-period-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.ranking-period-badge--daily {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}
.ranking-period-badge--weekly {
  background: #dbeafe;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.ranking-period-badge--monthly {
  background: #f3e8ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
}

/* 期間ラベル（"03/07〜03/13" など） */
.ranking-period-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ランキングリスト（各期間） */
.ranking-period-list {
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  gap: 2px;
}

/* 各行（横並びコンパクト化） */
.ranking-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px;
  border-radius: 5px;
  background: transparent;
  transition: background 0.1s;
  /* <a>タグのリセット */
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.ranking-row:hover {
  background: #f1f5f9;
}

/* ランク番号 */
.ranking-rank {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ranking-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0;
}

.ranking-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-ticker {
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.ranking-change {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}

/* ================================================================
   ユーティリティクラス
   ================================================================ */

.text-green { color: var(--color-green); }
.text-red { color: var(--color-red); }
.text-orange { color: var(--color-orange); }
.text-muted { color: var(--color-text-muted); }

/* サイドバーオーバーレイ（モバイル） */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* サイドバー展開中はmain-wrapperのスクロールを止める（bodyは触らない） */
.sidebar-is-open .main-wrapper {
  overflow-y: hidden;
}

/* ================================================================
   レスポンシブ
   ================================================================ */

/* タブレット（1024px以下） */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }

  .dashboard-grid {
    gap: 14px;
  }

  .ticker-grid {
    gap: 8px;
  }
}

/* モバイル・タブレット共通（768px以下） */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
    --header-height: 56px;
  }

  /* サイドバーをオフキャンバスに */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  /* ヘッダー */
  .hamburger-btn {
    display: flex;
  }

  .search-bar {
    max-width: 200px;
  }

  .profile-info {
    display: none;
  }

  /* メインコンテンツ */
  .main-content {
    padding: 16px 14px 32px;
  }

  /* タイトルエリア */
  .dashboard-title-area {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .title-right {
    grid-column: 1;
    text-align: left;
  }

  .page-title {
    font-size: 22px;
  }

  /* グリッド：1カラム */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .grid-item--half {
    grid-column: span 1;
  }

  /* 経済指標テーブル */
  .events-th,
  .events-td {
    padding: 6px 4px;
    font-size: 11px;
  }

  .events-name {
    font-size: 11px;
  }

  /* セクター行 */
  .sector-row {
    grid-template-columns: 80px 40px 1fr 52px;
    gap: 6px;
  }

  /* ランキング */
  .ranking-tabs-header {
    gap: 0;
  }

  .ranking-tab {
    padding: 5px 12px;
    font-size: 12px;
  }

  /* 横並びランキング: 768px以下は縦に戻す */
  .ranking-all-periods {
    grid-template-columns: 1fr;
  }
  .ranking-period-section:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid #e8edf5;
  }
}

/* スマホ（480px以下） */
@media (max-width: 480px) {
  .main-content {
    padding: 12px 10px 28px;
  }

  .card {
    padding: 16px;
  }

  .trend-title {
    font-size: 22px;
  }

  .ticker-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .ticker-value {
    font-size: 15px;
  }

  .ticker-card {
    padding: 10px 6px;
  }

  .events-th,
  .events-td {
    font-size: 10px;
    padding: 5px 3px;
  }

  .sector-row {
    grid-template-columns: 70px 35px 1fr 48px;
    gap: 4px;
  }

  .sector-name {
    font-size: 11px;
  }

  .search-bar {
    display: none;
  }

  /* 再試行UI: card-meta を縦並びに */
  .card-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  /* 再試行ボタン: 小さくコンパクトに */
  .retry-btn {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* エラーバナー: フォントサイズ縮小 */
  .card-error-banner {
    font-size: 10px;
    padding: 5px 8px;
  }
}

/* ================================================================
   Phase 2 追加スタイル
   ローディング・エラー・最終更新時刻
   ================================================================ */

/* ── スケルトンアニメーション ────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-text {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.12) 25%,
    rgba(255,255,255,0.28) 50%,
    rgba(255,255,255,0.12) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 4px;
  color: transparent !important;
  user-select: none;
  min-width: 60px;
  display: inline-block;
}

/* 白カード用スケルトン（セクターETF行） */
.sector-row--loading .sector-change {
  background: linear-gradient(
    90deg,
    #e2e8f0 25%,
    #f1f5f9 50%,
    #e2e8f0 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 4px;
  color: transparent !important;
  min-width: 48px;
  display: inline-block;
}

/* sector-bar--loading は上部 .sector-bar--loading ルールで定義済み */

/* ── ティッカーカード ローディング ─────────────────────── */
.ticker-card--loading .ticker-value,
.ticker-card--loading .ticker-change {
  /* skeleton-text クラスで処理 */
}

/* ── ティッカーカード エラー ───────────────────────────── */
.ticker-card--error {
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

.ticker-card--error .ticker-value {
  font-size: 11px !important;
  color: #fca5a5 !important;
  font-weight: 500 !important;
}

.ticker-card--error .ticker-change {
  color: #fca5a5 !important;
  font-size: 11px !important;
}

/* ── 最終更新時刻バッジ ──────────────────────────────── */
/* カード右上に配置するためのヘッダーレイアウト調整 */
.trend-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 8px;
  flex-wrap: wrap;
}

.card-header-row .card-header {
  margin-bottom: 0;
}

.card-update-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.update-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 1px;
}

/* 白カード用ラベル */
.card:not(.card--green):not(.card--dark) .update-label {
  color: var(--color-text-muted);
}

.update-value {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 44px;
  text-align: center;
  white-space: nowrap;
}

/* 白カード用 */
.card:not(.card--green):not(.card--dark) .update-value {
  color: var(--color-text-secondary);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

/* ローディング中 */
.update-value--loading {
  animation: shimmer 1.4s infinite linear;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.08) 25%,
    rgba(255,255,255,0.20) 50%,
    rgba(255,255,255,0.08) 75%
  ) !important;
  background-size: 400px 100% !important;
  color: transparent !important;
}

/* エラー時 */
.update-value--error {
  color: #fca5a5 !important;
  background: rgba(239,68,68,0.15) !important;
}

/* 白カード用エラー */
.card:not(.card--green):not(.card--dark) .update-value--error {
  color: #ef4444 !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

/* ── ステータスバッジ（api/health等） ───────────────── */
.api-status-ok    { color: #22c55e; }
.api-status-error { color: #ef4444; }

/* ================================================================
   Phase 2 追加: 再試行ボタン・カード状態インジケーター
   ================================================================ */

/* ── カードヘッダー右側まとめコンテナ ─────────────── */
/* update-time + retry-btn を横並びに束ねる */
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 再試行ボタン ─────────────────────────────────── */
.retry-btn {
  display: none;               /* 初期非表示。エラー時のみ表示 */
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid currentColor;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  white-space: nowrap;
  line-height: 1.4;
  background: transparent;
}

.retry-btn:hover:not(:disabled) {
  opacity: 0.8;
  transform: translateY(-1px);
}

.retry-btn:active:not(:disabled) {
  transform: translateY(0);
}

.retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 緑カード上の再試行ボタン */
.card--green .retry-btn {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}
.card--green .retry-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

/* 白カード上の再試行ボタン */
.card:not(.card--green):not(.card--dark) .retry-btn {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}
.card:not(.card--green):not(.card--dark) .retry-btn:hover:not(:disabled) {
  background: #fee2e2;
}

/* エラー状態のとき表示 */
[data-state="error"] .retry-btn {
  display: inline-flex;
}

/* 再取得中のとき再表示（スピナーアイコンを回す） */
[data-state="retrying"] .retry-btn {
  display: inline-flex;
}

/* ── 再試行ボタンのスピナーアイコン ──────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.retry-btn__icon {
  font-size: 12px;
  display: inline-block;
  transition: transform 0.1s;
}

[data-state="retrying"] .retry-btn__icon {
  animation: spin 0.7s linear infinite;
}

/* ── カード状態インジケーター（ヘッダー左端の細線） */
/* loading: 青くパルス / success: 緑で静止 / error: 赤で点滅 */
.card-state-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

/* カード自体を relative に */
.onine-trend-card,
.sector-etf-card,
.weekly-performance-card,
.economic-events-card {
  position: relative;
}
/* overflow:hidden は weekly/events には付けない（スクロール阻害を防ぐ） */
.onine-trend-card,
.sector-etf-card {
  overflow: hidden;
}

@keyframes pulse-bar {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* loading / retrying: 青パルス */
[data-state="loading"] .card-state-bar,
[data-state="retrying"] .card-state-bar {
  opacity: 1;
  background: linear-gradient(90deg, #3b82f6, #93c5fd, #3b82f6);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear, pulse-bar 1.4s ease-in-out infinite;
}

/* success: 緑で2秒後フェードアウト */
[data-state="success"] .card-state-bar {
  opacity: 0;          /* JSでフェードアウト制御 */
  background: linear-gradient(90deg, #22c55e, #86efac);
}

/* error: 赤で常時表示 */
[data-state="error"] .card-state-bar {
  opacity: 1;
  background: linear-gradient(90deg, #ef4444, #fca5a5);
}

/* ── 成功フラッシュアニメーション ────────────────── */
@keyframes success-flash {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

[data-state="success"] .card-state-bar {
  animation: success-flash 2s ease-out forwards;
}

/* ── エラー状態のカード強調 ──────────────────────── */
/* 緑カードのエラー */
.card--green[data-state="error"] {
  background: linear-gradient(135deg, #1c3a2a 0%, #14201a 60%, #0f1a14 100%) !important;
}

/* 白カードのエラー */
.card:not(.card--green):not(.card--dark)[data-state="error"] {
  border: 1px solid #fecaca;
}

/* ── エラーメッセージバナー ──────────────────────── */
.card-error-banner {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 10px;
}

[data-state="error"] .card-error-banner {
  display: flex;
}

/* 緑カード上 */
.card--green .card-error-banner {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* 白カード上 */
.card:not(.card--green):not(.card--dark) .card-error-banner {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.card-error-banner__icon {
  font-size: 13px;
  flex-shrink: 0;
}

/* ── 成功状態のチェックマーク（updatedAt内） ─────── */
.update-value--success::before {
  content: '✓ ';
  font-size: 10px;
  opacity: 0.7;
}

/* ── ローディング中に再試行ボタンを非表示 ────────── */
[data-state="loading"] .retry-btn {
  display: none;
}

/* ================================================================
   Phase 3 スタイル
   ================================================================ */

/* ── オニミネトレンド: トレンドレベルバッジ ────────────── */
.trend-level-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.trend-level-badge--strong {
  background: rgba(22, 163, 74, 0.35);
  color: #bbf7d0;
  border-color: rgba(22, 163, 74, 0.5);
}

.trend-level-badge--good {
  background: rgba(101, 163, 13, 0.35);
  color: #d9f99d;
  border-color: rgba(101, 163, 13, 0.5);
}

.trend-level-badge--neutral {
  background: rgba(100, 116, 139, 0.35);
  color: #cbd5e1;
  border-color: rgba(100, 116, 139, 0.5);
}

.trend-level-badge--weak {
  background: rgba(220, 38, 38, 0.35);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.5);
}

/* ── オニミネトレンド: カード背景色（data-trend） ─── */
#card-onine-trend[data-trend="strong"],
#card-jp-trend[data-trend="strong"] {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
}

#card-onine-trend[data-trend="good"],
#card-jp-trend[data-trend="good"] {
  background: linear-gradient(135deg, #3f6212 0%, #4d7c0f 100%);
}

#card-onine-trend[data-trend="neutral"],
#card-jp-trend[data-trend="neutral"] {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

#card-onine-trend[data-trend="weak"],
#card-jp-trend[data-trend="weak"] {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
}

/* 強い弱気 */
#card-onine-trend[data-trend="strong-weak"],
#card-jp-trend[data-trend="strong-weak"] {
  background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
}

/* ── Phase 6: レベルバッジ（5段階） ───────────────── */
.trend-level-badge--strong-weak {
  background: rgba(127, 29, 29, 0.9);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

/* ── オニミネトレンド: 平均騰落率表示 ───────────────── */
.trend-avg-change {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-avg-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.trend-avg-value {
  font-size: 13px;
  font-weight: 700;
}

/* ── 週間パフォーマンスカード: Phase 3 スタイル ───── */
#card-weekly-perf {
  /* card--dark と同じ基本スタイルを継承 */
}

/* 累積変化率の色 */
#perf-total-value.text-green { color: #4ade80; }
#perf-total-value.text-red   { color: #f87171; }

/* エラーバナー（暗いカード上） */
#card-weekly-perf .card-error-banner {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: none;
}

[data-state="error"] #weekly-perf-error-banner,
[data-state="error"] .card-error-banner {
  display: flex;
}

/* ── セクターランキングカード: Phase 3 スタイル ──── */
/* ランキング順位の上位バッジ */
.ranking-rank--top1 {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: white !important;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.ranking-rank--top2 {
  background: linear-gradient(135deg, #94a3b8, #64748b) !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(148, 163, 184, 0.4);
}

.ranking-rank--top3 {
  background: linear-gradient(135deg, #d97706, #92400e) !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(180, 83, 9, 0.4);
}

/* Phase 4 プレースホルダーボタン */
.ranking-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ランキングカードの状態バー */
#card-sector-ranking.card-state-bar {
  height: 3px;
}

/* ── 週間パフォーマンスのタブ（IWM追加） ─────────── */
.perf-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── スマホ向け：週間パフォーマンスのタブを大きく ── */
@media (max-width: 768px) {
  .perf-header {
    /* タイトル行とタブ群・メタを縦方向に整理 */
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .perf-title-area {
    width: 100%;
  }
  .perf-tabs {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .perf-tab {
    /* スマホでタブを押しやすいサイズに拡大 */
    font-size: 13px;
    padding: 7px 18px;
    min-height: 38px;
    min-width: 64px;
    border-radius: 8px;
  }
  .perf-total {
    width: 100%;
  }
  /* 更新時刻とリトライボタンを右寄せ */
  .weekly-performance-card .card-meta {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── テキストカラーユーティリティ ──────────────────── */
.text-red  { color: #f87171; }
.text-green { color: #4ade80; }



/* ================================================================ */
/* Phase 4: 市場マクロ状況カード（MacroIndicatorsCard）              */
/* ================================================================ */

/* ── カード基本 ─────────────────────────────────────── */
.macro-indicators-card {
  background: var(--card-bg, #1e2535);
}

/* ── リスクレベルバッジ ─────────────────────────────── */
.macro-risk-badge-wrap {
  display: flex;
  align-items: center;
}

.macro-risk-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.risk-badge--stable {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.risk-badge--caution {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.risk-badge--high {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ── カード背景: リスクレベル連動 ──────────────────── */
#card-macro-indicators[data-risk="high"] {
  border-left: 3px solid #f87171;
}

#card-macro-indicators[data-risk="caution"] {
  border-left: 3px solid #fbbf24;
}

#card-macro-indicators[data-risk="stable"] {
  border-left: 3px solid #4ade80;
}

/* ── 指標グリッド（3列） ───────────────────────────── */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 480px) {
  .macro-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ── 指標アイテム ────────────────────────────────────── */
.macro-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s;
}

.macro-item--loading {
  opacity: 0.7;
}

.macro-item--error {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
}

/* アイコン + ラベル行 */
.macro-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.macro-item-icon {
  font-size: 18px;
  line-height: 1;
}

.macro-item-labels {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.macro-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #f0f4f8);
  letter-spacing: 0.04em;
}

.macro-item-desc {
  font-size: 11px;
  color: var(--text-muted, #8899aa);
}

/* 価格表示 */
.macro-item-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary, #f0f4f8);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* 前日比 */
.macro-item-change {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #8899aa);
}

/* ── data-state 連動表示制御 ───────────────────────── */
/* エラーバナー（デフォルト非表示、エラー時表示） */
#macro-error-banner {
  display: none;
}

[data-state="error"] #macro-error-banner {
  display: flex;
}

/* 再試行ボタン（エラー/再試行時のみ表示 → 既存 CSS と同一パターン） */

/* ================================================================
   Phase 6: トレンドカード 詳細スタイル
   ================================================================ */

/* ヘッダー左側 */
.trend-header-left {
  flex: 1;
  min-width: 0;
}

/* エクスポージャー表示 */
.trend-exposure {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-exposure-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.trend-exposure-value {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
}

.trend-exposure-value--strong      { background: rgba(34,197,94,0.25); color: #86efac; }
.trend-exposure-value--good        { background: rgba(132,204,22,0.25); color: #bef264; }
.trend-exposure-value--neutral     { background: rgba(148,163,184,0.2); color: #cbd5e1; }
.trend-exposure-value--weak        { background: rgba(239,68,68,0.2);   color: #fca5a5; }
.trend-exposure-value--strong-weak { background: rgba(127,29,29,0.4);   color: #fca5a5; }

/* ── 売り抜け日 / FTD / ラリー 詳細セクション ─── */
.trend-details {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: rgba(0,0,0,0.18);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
}

/* 売り抜け日カウント行 */
.trend-dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.trend-dist-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.trend-dist-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

.trend-dist-total {
  font-size: 22px;
  font-weight: 800;
  color: #f0f4f8;
  line-height: 1;
}

.trend-dist-unit {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.trend-dist-breakdown {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-dist-sym {
  color: rgba(255,255,255,0.4);
}

/* FTD / ラリー フラグ行 */
.trend-flags-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.trend-flag {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
}

.trend-flag-icon {
  font-size: 12px;
  font-weight: 700;
  width: 14px;
  text-align: center;
}

.trend-flag-label {
  color: rgba(255,255,255,0.7);
}

.trend-flag--yes {
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.3);
}
.trend-flag--yes .trend-flag-icon { color: #4ade80; }

.trend-flag--no {
  background: rgba(148,163,184,0.1);
  border: 1px solid rgba(148,163,184,0.2);
}
.trend-flag--no .trend-flag-icon { color: #94a3b8; }

.trend-flag--rally {
  background: rgba(251,191,36,0.15);
  border: 1px solid rgba(251,191,36,0.3);
}
.trend-flag--rally .trend-flag-icon { color: #fbbf24; }

/* ── 参考情報セクション ───────────────────────────── */
.trend-ref-section {
  margin-top: 10px;
}

.trend-ref-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* ── 平均騰落率 + VIX 行 ─────────────────────────── */
.trend-avg-change {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.trend-avg-label,
.trend-vix-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.trend-avg-value {
  font-size: 13px;
  font-weight: 700;
}

.trend-avg-sep {
  color: rgba(255,255,255,0.25);
  font-size: 11px;
}

.trend-vix-value {
  font-size: 13px;
  font-weight: 700;
}

/* text-orange ユーティリティ */
.text-orange { color: #fb923c; }

/* ================================================================
   テーマ別パフォーマンスカード（Phase 7）
   ================================================================ */

.theme-performance-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── ヘッダー ── */
.theme-card-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.theme-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.theme-title-row .card-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── レベルタブ（大分類/中分類/小分類） ── */
.theme-level-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.theme-level-tab {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  touch-action: manipulation;
}

.theme-level-tab--active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}

.theme-tab-sub {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.8;
  margin-left: 2px;
}

/* ── コントロール行（期間 + ソート） ── */
.theme-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-period-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
}

.theme-period-tab {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}

.theme-period-tab--active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.theme-sort-tabs {
  display: flex;
  gap: 4px;
}

.theme-sort-tab {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}

.theme-sort-tab--active {
  color: #1e293b;
  background: #fff;
  border-color: #cbd5e1;
}

/* ── リストコンテナ ── */
.theme-list-container {
  display: block;
  /* iOS Safari: px固定でスクロールを確実に有効化 */
  height: 480px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
  box-sizing: border-box;
}

.theme-list-container::-webkit-scrollbar { width: 4px; }
.theme-list-container::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* ── 各行 ── */
.theme-row {
  padding: 8px 4px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.theme-row:hover {
  background: #f8fafc;
}

.theme-row:last-child {
  border-bottom: none;
}

.theme-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.theme-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.theme-color-bar {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.theme-row-names {
  min-width: 0;
}

.theme-row-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-row-category {
  font-size: 10px;
  color: #94a3b8;
  display: block;
}

/* 騰落率 */
.theme-row-change {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
}

.theme-row-change--pos { color: #16a34a; }
.theme-row-change--neg { color: #dc2626; }
.theme-row-change--neu { color: #64748b; }

/* ── テーマ行ヘッダー（クリック可能エリア）── */
.theme-row-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* シェブロン（展開アイコン）*/
.theme-row-chevron {
  font-size: 9px;
  color: #94a3b8;
  transition: transform 0.22s ease;
  flex-shrink: 0;
  margin-left: 2px;
  line-height: 1;
}

.theme-row--open .theme-row-chevron {
  transform: rotate(90deg);
}

/* 銘柄タグ行（展開エリア）*/
.theme-row-symbols {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease, padding 0.2s ease;
  background: #fff;
  border-top: 1px solid transparent;
}

.theme-row--open .theme-row-symbols {
  max-height: 200px;
  padding: 6px 4px 6px 12px;
  border-top-color: #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.theme-symbol-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  /* <a>タグ化対応 */
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  transition: opacity 0.15s, transform 0.1s;
}

.theme-symbol-tag:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.theme-symbol-tag--pos { background: #dcfce7; color: #15803d; }
.theme-symbol-tag--neg { background: #fee2e2; color: #b91c1c; }
.theme-symbol-tag--neu { background: #f1f5f9; color: #475569; }
.theme-symbol-tag--na  { background: #f1f5f9; color: #94a3b8; }
.theme-symbol-tag--no-ftd { background: transparent; color: #64748b; font-style: italic; border: 1px dashed #cbd5e1; }

/* ── テーマ名下のFTDインラインタグ（常時表示）── */
.theme-row-ftd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.theme-ftd-inline {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

/* FTD発生銘柄あり：緑系 */
.theme-ftd-inline--pos {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  cursor: pointer;
}
.theme-ftd-inline--pos:hover { opacity: 0.8; }

/* FTD発生銘柄なし：グレー点線 */
.theme-ftd-inline--none {
  background: transparent;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  font-style: italic;
  font-weight: 400;
}

/* ── テーマ名下のポケットピボット（PP）インラインタグ（常時表示）── */
/* .theme-row-ftd-tags コンテナを共用 */
.theme-pp-inline {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

/* PP発生銘柄あり：オレンジ系（FTDの緑と区別） */
.theme-pp-inline--pos {
  background: rgba(234, 88, 12, 0.10);
  color: #c2410c;
  cursor: default;
}

/* PP発生銘柄なし：グレー点線 */
.theme-pp-inline--none {
  background: transparent;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  font-style: italic;
  font-weight: 400;
}

/* スケルトン */
.theme-row--skeleton .theme-row-name { min-width: 120px; }
.theme-row--skeleton .theme-row-change { min-width: 60px; }

/* ── カード state 制御 ── */
#card-theme-perf[data-state="loading"] .theme-list-container,
#card-theme-perf[data-state="retrying"] .theme-list-container {
  opacity: 0.6;
}

#card-theme-perf[data-state="error"] .card-error-banner,
#card-theme-perf[data-state="retrying"] .card-error-banner {
  display: flex;
}

/* ── レスポンシブ ── */
@media (max-width: 768px) {
  .grid-item--full {
    grid-column: span 2;
  }
  .theme-list-container {
    height: 420px;
  }
}

@media (max-width: 480px) {
  .grid-item--full {
    grid-column: span 2;
  }
  .theme-level-tab {
    font-size: 11px;
    padding: 5px 10px;
  }
  .theme-row-name {
    font-size: 12px;
  }
  .theme-row-change {
    font-size: 13px;
    min-width: 60px;
  }
  .theme-list-container {
    height: 380px;
  }
}

/* ================================================================
   サイト内検索
   ================================================================ */

/* ── 検索バー wrapper（ドロップダウンのアンカーに） ── */
.search-bar {
  position: relative;   /* ドロップダウンの基点 */
}

/* ── クリアボタン ── */
.search-clear-btn {
  display: none;        /* JS で切替 */
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.search-clear-btn:hover {
  background: #cbd5e1;
  color: #1e293b;
}

/* ── ドロップダウン本体 ── */
.search-dropdown {
  display: none;           /* 初期非表示 */
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 320px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
  z-index: 500;
  overflow: hidden;
}

.search-dropdown--open {
  display: block;
}

/* ドロップダウン内スクロール領域 */
.search-dropdown-inner {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
  padding: 6px;
}

.search-dropdown-inner::-webkit-scrollbar { width: 4px; }
.search-dropdown-inner::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* ── 各候補アイテム ── */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.search-result-item:hover,
.search-result-item--focused {
  background: #f1f5f9;
}

.search-result-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.search-result-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.search-result-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-type {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
}

.search-result-arrow {
  color: #cbd5e1;
  flex-shrink: 0;
  transition: color 0.1s, transform 0.1s;
}

.search-result-item:hover .search-result-arrow,
.search-result-item--focused .search-result-arrow {
  color: #64748b;
  transform: translateX(2px);
}

/* クエリ一致部分のハイライト */
.search-highlight {
  background: #fef08a;
  color: #78350f;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── 結果なし ── */
.search-no-result {
  padding: 16px 14px;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

/* ── カードジャンプ時のフラッシュアニメーション ── */
@keyframes search-flash-anim {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5), var(--shadow-card); }
  25%  { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.35), var(--shadow-card); }
  60%  { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.15), var(--shadow-card); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0), var(--shadow-card); }
}

.search-flash {
  animation: search-flash-anim 1.2s ease-out forwards;
}

/* ── レスポンシブ ── */
@media (max-width: 768px) {
  .search-dropdown {
    min-width: unset;
    left: -10px;
    right: -10px;
    border-radius: 12px;
  }
}

/* ── 検索ドロップダウン セクションラベル ── */
.search-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px 4px;
}
.search-section-label:first-child { padding-top: 4px; }

/* ── 銘柄検索中インジケーター ── */
.search-ticker-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 10px;
  font-size: 11px;
  color: #94a3b8;
}
.search-ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #93c5fd;
  animation: ticker-pulse 1s ease-in-out infinite;
}
@keyframes ticker-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.2); }
}

/* ── 取引所バッジ（NASDAQ, NYSE…） ── */
.search-exchange-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

/* ================================================================
   日本市場ダッシュボード固有スタイル
   ================================================================ */

/* ── 主要指数カード ─────────────────────────────────── */
.jp-prices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 0;
}
.jp-index-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.jp-index-name {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 6px;
}
.jp-index-price {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}
.jp-index-change {
  font-size: 14px;
  font-weight: 700;
}
.jp-index-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 10px;
  height: 80px;
}

/* ── テーマバスケットランキング ─────────────────────── */
.jp-basket-periods {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.jp-period-btn {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.jp-period-btn--active {
  color: #1e293b;
  background: white;
  border-color: #cbd5e1;
}
.jp-basket-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 360px;
  overflow-y: auto;
}
.jp-basket-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 5px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
.jp-basket-row:hover { background: #f8fafc; }
.jp-basket-row:last-child { border-bottom: none; }
.jp-basket-info {
  flex: 1;
  min-width: 0;
}
.jp-basket-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  display: block;
}
.jp-basket-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}
.jp-basket-tag {
  font-size: 10px;
  padding: 1px 5px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.jp-basket-tag:hover { opacity: 0.7; }
.jp-basket-change {
  font-size: 14px;
  font-weight: 700;
  min-width: 64px;
  text-align: right;
}

/* ── 経済指標カレンダー（日本） ─────────────────────── */
#jp-events-scroll {
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── レスポンシブ対応 ───────────────────────────────── */
@media (max-width: 768px) {
  .jp-prices-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .jp-index-price {
    font-size: 16px;
  }
  .jp-basket-list {
    max-height: 300px;
  }
}
