/* 
 * 株式リサーチ & AI売買ダッシュボード スタイルシート
 * Modern Fintech / Bloomberg Terminal / TradingView Style Dark UI
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    /* カラーパレット */
    --bg-base: #0a0d14;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --bg-card-active: rgba(30, 58, 138, 0.25);
    --bg-surface: #111827;
    --bg-surface-elevated: #1e293b;
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(16, 185, 129, 0.4);
    --border-accent: rgba(56, 189, 248, 0.3);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* 強調色（フィンテック） */
    --bull-green: #10b981;
    --bull-green-glow: rgba(16, 185, 129, 0.25);
    --bear-red: #f43f5e;
    --bear-red-glow: rgba(244, 63, 94, 0.25);
    --ai-cyan: #06b6d4;
    --ai-cyan-glow: rgba(6, 182, 212, 0.25);
    --vwap-purple: #a855f7;
    --star-gold: #fbbf24;
    --star-gold-glow: rgba(251, 191, 36, 0.3);
    --amber-warning: #f59e0b;

    /* フォント */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Outfit', var(--font-sans);
    --font-mono: 'JetBrains Mono', monospace;

    /* シャドウ & エフェクト */
    --glass-blur: blur(16px);
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow-cyan: 0 0 25px rgba(6, 182, 212, 0.2);
    --shadow-glow-green: 0 0 25px rgba(16, 185, 129, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.07) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(168, 85, 247, 0.05) 0px, transparent 50%);
}

/* カスタムスクロールバー */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================
   1. ヘッダー & マーケットティッカー
   ========================================================== */
.app-header {
    height: 60px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    flex-shrink: 0;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    box-shadow: var(--shadow-glow-cyan);
}

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

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-pill {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: rgba(6, 182, 212, 0.15);
    color: var(--ai-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* 市場ティッカー（インデックスバー） */
.market-ticker-container {
    display: flex;
    align-items: center;
    gap: 18px;
    overflow-x: auto;
    padding: 0 16px;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    white-space: nowrap;
}

.ticker-name {
    color: var(--text-muted);
    font-weight: 500;
}

.ticker-val {
    font-family: var(--font-mono);
    font-weight: 600;
}

.ticker-change {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.74rem;
    padding: 1px 4px;
    border-radius: 3px;
}

.ticker-change.positive {
    color: var(--bull-green);
    background: rgba(16, 185, 129, 0.1);
}

.ticker-change.negative {
    color: var(--bear-red);
    background: rgba(244, 63, 94, 0.1);
}

/* ヘッダー右側ステータス */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-badge {
    font-size: 0.68rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: var(--font-mono);
    background: rgba(16, 185, 129, 0.15);
    color: var(--bull-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-engine-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--ai-cyan);
    font-weight: 500;
}

.pulsing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--ai-cyan);
    border-radius: 50%;
    position: relative;
}

.pulsing-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: inherit;
    border-radius: inherit;
    animation: pulseGlow 1.8s ease-out infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* ==========================================================
   2. 3ペイン レイアウト
   ========================================================== */
.main-dashboard {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ----------------------------------------------------------
   左ペイン: 銘柄レーダー (Radar / Screening)
   ---------------------------------------------------------- */
.pane-radar {
    width: 320px;
    min-width: 300px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.pane-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pane-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pane-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-add-stock {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: var(--ai-cyan);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-add-stock:hover {
    background: rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* 検索 & フィルタタブ */
.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 7px 10px 7px 30px;
    font-size: 0.8rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--ai-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 6px;
    gap: 2px;
}

.filter-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
}

.filter-tab-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ==========================================================
   マルチお気に入りタブバー (Multi Watchlist Tabs)
   ========================================================== */
.watchlist-group-container {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.watchlist-tabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    padding-bottom: 2px;
}

.watchlist-tabs-bar::-webkit-scrollbar {
    height: 3px;
}

.wl-tab-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.15s;
    user-select: none;
}

.wl-tab-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.wl-tab-pill.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--star-gold);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}

.wl-tab-del-btn {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0 2px;
    border-radius: 3px;
    display: inline-block;
    transition: color 0.15s;
}

.wl-tab-del-btn:hover {
    color: var(--bear-red);
}

.wl-tab-add-btn {
    background: rgba(6, 182, 212, 0.12);
    border: 1px dashed rgba(6, 182, 212, 0.4);
    border-radius: 6px;
    color: var(--ai-cyan);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wl-tab-add-btn:hover {
    background: rgba(6, 182, 212, 0.25);
    border-style: solid;
    transform: scale(1.05);
}

/* 銘柄カードリスト */
.stock-card-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stock-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.stock-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.2s;
}

.stock-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.stock-card.active {
    background: var(--bg-card-active);
    border-color: var(--border-accent);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.12);
}

.stock-card.active::before {
    background: var(--ai-cyan);
}

.card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.card-symbol-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-symbol {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.card-market-tag {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.card-actions-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* お気に入りスターボタン */
.card-fav-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 2px 3px;
    transition: all 0.2s;
    line-height: 1;
}

.card-fav-btn:hover {
    color: var(--star-gold);
    transform: scale(1.15);
}

.card-fav-btn.is-fav {
    color: var(--star-gold);
    text-shadow: 0 0 8px var(--star-gold-glow);
}

/* 銘柄削除ボタン */
.card-delete-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-delete-btn:hover {
    color: var(--bear-red);
    background: rgba(244, 63, 94, 0.15);
    transform: scale(1.15);
}

/* 銘柄名行 ＆ リネームボタン */
.card-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.card-name {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.card-name.is-custom {
    color: #38bdf8;
    font-weight: 500;
}

.card-rename-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 3px;
    transition: all 0.15s;
    line-height: 1;
    opacity: 0;
}

.stock-card:hover .card-rename-btn {
    opacity: 1;
}

.card-rename-btn:hover {
    color: var(--ai-cyan);
    background: rgba(6, 182, 212, 0.15);
}

.hero-rename-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    transition: all 0.2s;
}

.hero-rename-btn:hover {
    color: var(--ai-cyan);
    border-color: var(--ai-cyan);
    background: rgba(6, 182, 212, 0.15);
}

.score-badge {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.score-badge.strong-buy {
    background: rgba(16, 185, 129, 0.2);
    color: var(--bull-green);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.score-badge.buy {
    background: rgba(6, 182, 212, 0.2);
    color: var(--ai-cyan);
    border: 1px solid rgba(6, 182, 212, 0.4);
}

.card-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.07);
}

.card-price-info {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.card-price {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.84rem;
}

.card-change {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
}

.card-rr {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* 空状態メッセージ */
.empty-state {
    padding: 30px 15px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* ----------------------------------------------------------
   中央ペイン: メインチャート (Main Chart)
   ---------------------------------------------------------- */
.pane-chart {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(10, 13, 20, 0.95);
    position: relative;
    overflow: hidden;
}

/* チャートヘッダーバー */
.chart-header-bar {
    padding: 10px 18px;
    background: rgba(17, 24, 39, 0.5);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.selected-stock-hero {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hero-fav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.hero-fav-btn:hover {
    color: var(--star-gold);
    border-color: rgba(251, 191, 36, 0.4);
}

.hero-fav-btn.is-fav {
    color: var(--star-gold);
    border-color: rgba(251, 191, 36, 0.6);
    background: rgba(251, 191, 36, 0.12);
    box-shadow: 0 0 12px var(--star-gold-glow);
}

.stock-headline {
    display: flex;
    flex-direction: column;
}

.stock-symbol-large {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-sector-pill {
    font-size: 0.68rem;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: var(--text-secondary);
    font-weight: 400;
}

.stock-name-large {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.price-hero-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-left: 14px;
    border-left: 1px solid var(--border-subtle);
}

.current-price-hero {
    font-family: var(--font-mono);
    font-size: 1.45rem;
    font-weight: 700;
}

.price-diff-badge {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* チャートコントロールツールバー */
.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 0.74rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-refresh:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-refresh.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* 取得期間セレクター */
.period-select-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 2px 6px;
    gap: 4px;
    transition: all 0.2s;
}

.period-select-wrapper:hover {
    border-color: rgba(6, 182, 212, 0.4);
}

.period-label {
    font-size: 0.76rem;
}

.period-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    padding: 2px 0;
}

.period-select option {
    background: #0f172a;
    color: #fff;
    padding: 6px;
}

.timeframe-group {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.tf-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.tf-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--ai-cyan);
}

.indicator-toggles {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.toggle-pill input {
    display: none;
}

.toggle-pill.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.4);
    color: var(--ai-cyan);
}

.toggle-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.toggle-pill.active .toggle-dot.vwap-dot {
    background-color: var(--vwap-purple);
    box-shadow: 0 0 6px var(--vwap-purple);
}

.toggle-pill.active .toggle-dot.forecast-dot {
    background-color: var(--ai-cyan);
    box-shadow: 0 0 6px var(--ai-cyan);
}

.toggle-pill.active .toggle-dot.ma-dot {
    background-color: #eab308;
    box-shadow: 0 0 6px #eab308;
}

/* チャート描画コンテナ */
.chart-viewport {
    flex: 1;
    width: 100%;
    position: relative;
}

#tradingview-chart-container {
    width: 100%;
    height: 100%;
}

/* チャート上のファンチャート（凡例オーバーレイ） */
.chart-legend-overlay {
    position: absolute;
    top: 14px;
    left: 20px;
    z-index: 10;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 12px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.band-68 {
    background: rgba(6, 182, 212, 0.5);
    height: 6px;
}

.legend-color.band-95 {
    background: rgba(6, 182, 212, 0.2);
    height: 6px;
}

/* ----------------------------------------------------------
   右ペイン: 分析根拠 & トレードプラン (Reasoning / Action)
   ---------------------------------------------------------- */
.pane-insights {
    width: 350px;
    min-width: 330px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.insights-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* AI確信度スコアカード */
.ai-score-card {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(16, 185, 129, 0.12) 100%);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 10px;
    padding: 14px;
    position: relative;
    overflow: hidden;
}

.ai-score-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
}

.score-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.score-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ai-cyan);
}

.score-display-group {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.score-number-big {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.score-number-big span {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.score-verdict-pill {
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.verdict-strong-buy {
    background: var(--bull-green);
    color: #052e16;
    box-shadow: var(--shadow-glow-green);
}

.verdict-buy {
    background: var(--ai-cyan);
    color: #083344;
    box-shadow: var(--shadow-glow-cyan);
}

.score-summary-text {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-top: 8px;
}

/* クオンツ指標クイックメトリクス */
.quick-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.metric-tile {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.metric-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--text-primary);
}

/* 分析根拠ファクター一覧 */
.factors-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.factor-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: border-color 0.2s;
}

.factor-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.factor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.factor-title {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.factor-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.factor-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--bull-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.factor-badge.info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--ai-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.factor-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* バックテストサマリーカード */
.backtest-summary-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backtest-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.bt-stat-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bt-stat-label {
    font-size: 0.64rem;
    color: var(--text-secondary);
}

.bt-stat-value {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 700;
}

.bt-stat-value.text-bull {
    color: var(--bull-green);
}

.bt-stat-value.text-bear {
    color: var(--bear-red);
}

.bt-stat-value.text-cyan {
    color: var(--ai-cyan);
}

/* トレードプランカード（資金管理） */
.trade-plan-card {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
    padding-bottom: 5px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.plan-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.plan-label {
    color: var(--text-secondary);
}

.plan-val {
    font-family: var(--font-mono);
    font-weight: 600;
}

.plan-val.target {
    color: var(--bull-green);
}

.plan-val.stop {
    color: var(--bear-red);
}

/* ==========================================================
   3. 銘柄追加モーダル
   ========================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 680px;
    max-width: 92vw;
    max-height: 88vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-accent);
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85), var(--shadow-glow-cyan);
    display: flex;
    flex-direction: column;
    gap: 14px;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.modal-overlay.open .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* 検索入力グループ */
.modal-search-row {
    display: flex;
    gap: 10px;
}

.modal-search-box {
    flex: 1;
    position: relative;
}

.modal-search-box input {
    width: 100%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px 10px 34px;
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-mono);
    transition: all 0.2s;
}

.modal-search-box input:focus {
    border-color: var(--ai-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.modal-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* おすすめディスカバリータブ */
.discovery-tabs-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.disc-header-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.disc-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(0, 0, 0, 0.35);
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.disc-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 7px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.disc-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.disc-tab-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.disc-tab-btn.tab-surge.active {
    color: var(--ai-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.disc-tab-btn.tab-hot.active {
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.disc-tab-btn.tab-dip.active {
    color: var(--amber-warning);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.disc-tab-btn.tab-conviction.active {
    color: var(--bull-green);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

/* 国内 / 米国 市場フィルターバー */
.disc-market-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    width: fit-content;
}

.disc-mkt-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.disc-mkt-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.disc-mkt-btn.active {
    background: rgba(6, 182, 212, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: var(--ai-cyan);
    font-weight: 700;
}

/* おすすめ銘柄グリッド */
.discovery-cards-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 2px 2px 6px 2px;
    max-height: 420px;
}

.disc-stock-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.disc-stock-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(6, 182, 212, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.disc-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.disc-symbol-group {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.disc-symbol {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.disc-market {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.disc-card-name {
    font-size: 0.74rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.disc-card-mid {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 4px 0;
}

.disc-price {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.92rem;
}

.disc-change {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 1px 6px;
    border-radius: 4px;
}

.disc-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
}

.disc-badge.surge {
    background: rgba(6, 182, 212, 0.18);
    color: var(--ai-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.disc-badge.hot {
    background: rgba(249, 115, 22, 0.18);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.disc-badge.dip {
    background: rgba(245, 158, 11, 0.18);
    color: var(--amber-warning);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.disc-badge.conviction {
    background: rgba(16, 185, 129, 0.18);
    color: var(--bull-green);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.disc-card-reason {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.35;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 8px;
    border-radius: 6px;
    margin-top: 2px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.modal-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    border: none;
    color: #fff;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-glow-cyan);
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* レスポンシブ */
@media (max-width: 1200px) {
    .pane-radar {
        width: 260px;
        min-width: 240px;
    }
    .pane-insights {
        width: 300px;
        min-width: 280px;
    }
}
/* ==========================================
   お気に入りフォルダ・マネージャー モーダル
   ========================================== */
.wl-create-box {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed rgba(251, 191, 36, 0.3);
}

.wl-create-box input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #fff;
    outline: none;
}

.wl-create-box input:focus {
    border-color: var(--star-gold);
}

.btn-create-wl {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    border: none;
    color: #000;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s;
}

.btn-create-wl:hover {
    transform: scale(1.02);
}

.wl-existing-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.wl-existing-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: all 0.2s;
}

.wl-existing-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.wl-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.wl-item-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.wl-item-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 10px;
    font-family: var(--font-mono);
}

.wl-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-wl-action {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.btn-wl-action:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
}

.btn-wl-action.del:hover {
    color: var(--bear-red);
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.15);
}

/* インライン編集行 */
.wl-item-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.wl-item-edit-row input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--star-gold);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.82rem;
    color: #fff;
    outline: none;
}

.btn-save-inline {
    background: var(--bull-green);
    border: none;
    color: #052e16;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-cancel-inline {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}
