:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #222222;
    --border-color: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --accent-green: #00ff88;
    --accent-red: #ff4444;
    --accent-blue: #4488ff;
    --accent-yellow: #ffaa00;
    --accent-purple: #aa44ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
}

.container { max-width: 1200px; margin: 0 auto; padding: 10px; }

header {
    text-align: center; margin-bottom: 20px; padding: 20px 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: 12px;
}
header h1 {
    font-size: 1.8rem; margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.status-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.9rem; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-yellow); animation: pulse 2s infinite; }
.status-dot.online { background: var(--accent-green); }
.status-dot.offline { background: var(--accent-red); animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 20px; margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.card h2 { font-size: 1.3rem; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }

/* ─── 2層タブナビゲーション ─── */
/* メインタブ */
.main-tab-nav {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-primary); border-bottom: 1px solid var(--border-color);
    padding: 5px 0;
}
.main-tab-container { 
    display: flex; justify-content: center; gap: 5px; overflow-x: auto; scrollbar-width: none; 
}
.main-tab-container::-webkit-scrollbar { display: none; }
.main-tab-btn {
    background: var(--bg-secondary); border: 1px solid var(--border-color); 
    color: var(--text-muted); font-size: 1.1rem; font-weight: 500;
    padding: 16px 24px; cursor: pointer; white-space: nowrap;
    border-radius: 12px; transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.main-tab-btn:hover { 
    color: var(--text-secondary); background: var(--bg-card); 
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.main-tab-btn.active { 
    color: var(--accent-blue); background: var(--bg-card); 
    border-color: var(--accent-blue); box-shadow: 0 6px 12px rgba(68, 136, 255, 0.3);
}

/* サブタブ */
.sub-tab-nav {
    background: var(--bg-primary); border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px; min-height: 60px; padding: 0 10px;
}
.sub-tab-group { display: none; padding: 10px 0; }
.sub-tab-group.active { display: block; }
.sub-tab-container { 
    display: flex; justify-content: center; gap: 3px; overflow-x: auto; scrollbar-width: none;
    flex-wrap: wrap;
}
.sub-tab-container::-webkit-scrollbar { display: none; }
.sub-tab-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.85rem; padding: 8px 16px; cursor: pointer;
    white-space: nowrap; border-radius: 6px;
    transition: all 0.2s; border-bottom: 2px solid transparent;
}
.sub-tab-btn:hover { 
    color: var(--text-secondary); background: rgba(255,255,255,0.05); 
}
.sub-tab-btn.active { 
    color: var(--accent-green); border-bottom-color: var(--accent-green);
    background: rgba(0, 255, 136, 0.1);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .main-tab-container { 
        overflow-x: auto; justify-content: flex-start; 
        padding: 0 10px; gap: 8px;
    }
    .main-tab-btn { 
        font-size: 0.95rem; padding: 12px 16px; 
        min-width: 90px; text-align: center;
    }
    .sub-tab-container { 
        justify-content: flex-start; gap: 5px; 
        padding: 0 5px;
    }
    .sub-tab-btn { 
        font-size: 0.8rem; padding: 6px 12px; 
    }
}

/* ─── Total Assets Header ─── */
.total-assets-card { text-align: center; }
.total-assets-value { font-size: 2.5rem; font-weight: 700; color: var(--accent-green); }
.total-assets-change { margin: 8px 0; font-size: 1.1rem; }
.total-assets-label { font-size: 0.9rem; color: var(--text-muted); }
.change-amount, .change-percent { font-weight: 500; }
.change-amount.positive, .change-percent.positive { color: var(--accent-green); }
.change-amount.negative, .change-percent.negative { color: var(--accent-red); }
.last-updated { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: 10px; }

/* ─── Portfolio Pie + Breakdown ─── */
.portfolio-layout { display: flex; gap: 20px; align-items: center; }
.portfolio-chart-wrap { width: 200px; height: 200px; flex-shrink: 0; }
.portfolio-breakdown { flex: 1; }
.breakdown-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border-color);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.breakdown-name { font-weight: 500; min-width: 60px; }
.breakdown-value { flex: 1; text-align: right; color: var(--text-secondary); }
.breakdown-pct { font-weight: 600; min-width: 50px; text-align: right; color: var(--accent-blue); }

/* ─── PnL Grid ─── */
.pnl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; }
.pnl-item {
    text-align: center; padding: 15px;
    background: var(--bg-secondary); border-radius: 8px; border: 1px solid var(--border-color);
}
.pnl-item .value { font-size: 1.2rem; font-weight: bold; color: var(--accent-blue); margin-bottom: 5px; }
.pnl-item .label { font-size: 0.8rem; color: var(--text-secondary); }

/* ─── Task Stats ─── */
.task-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 15px; margin-bottom: 20px; padding: 15px;
    background: var(--bg-secondary); border-radius: 8px;
}
.stat-item { text-align: center; }
.stat-item .value { font-size: 1.5rem; font-weight: 600; color: var(--accent-blue); margin-bottom: 5px; }
.stat-item .label { font-size: 0.8rem; color: var(--text-muted); }
.stat-item.hikarimaru-special { border: 2px solid var(--accent-red); background: rgba(255,68,68,0.1); border-radius: 8px; padding: 10px; }
.stat-item.hikarimaru-special .value { color: var(--accent-red); font-weight: 700; }

/* ─── Task Filters ─── */
.task-filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-select {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    color: var(--text-primary); padding: 8px 12px; border-radius: 6px; font-size: 0.9rem;
}
.btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 500; }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); }

/* ─── Project Accordion ─── */
.project-accordion {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 8px; margin-bottom: 15px; overflow: hidden;
}
.project-header {
    padding: 15px 20px; cursor: pointer; display: flex; align-items: center;
    justify-content: space-between; background: var(--bg-card);
    border-bottom: 1px solid var(--border-color); transition: all 0.2s;
}
.project-header:hover { background: rgba(255,255,255,0.05); }
.project-info { flex: 1; }
.project-title { font-size: 1.1rem; font-weight: 500; margin-bottom: 3px; }
.project-id { font-size: 0.8rem; color: var(--text-muted); margin-left: 10px; background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; }
.project-description { font-size: 0.85rem; color: var(--text-secondary); }
.project-stats-mini { margin: 0 15px; font-size: 0.9rem; color: var(--text-muted); }
.toggle-icon { font-size: 1.2rem; color: var(--text-muted); }

/* ─── Task Items ─── */
.task-item {
    cursor: pointer; padding: 12px 15px;
    border-bottom: 1px solid var(--border-color); transition: background 0.2s;
}
.task-item:hover { background: rgba(255,255,255,0.02); }
.task-row-main { display: flex; justify-content: space-between; align-items: center; }
.task-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.task-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-title-text { font-size: 0.95rem; }
.task-id-label { font-size: 0.75rem; color: var(--text-muted); background: var(--bg-primary); padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.task-member-label { font-size: 1rem; }
.subtask-toggle { font-size: 0.8rem; cursor: pointer; color: var(--text-muted); padding: 2px; }
.subtask-spacer { width: 16px; display: inline-block; }

.task-tree-item.hikarimaru-pending { background: rgba(255,68,68,0.08); border-left: 3px solid var(--accent-red); }

.urgent-badge {
    background: var(--accent-red); color: #fff;
    font-size: 0.7rem; padding: 2px 6px; border-radius: 8px;
    font-weight: 500; animation: pulse 2s infinite;
}

/* Task Detail Inline */
.task-detail-inline {
    margin-top: 10px; padding: 12px; background: var(--bg-primary);
    border-radius: 8px; font-size: 0.85rem; color: var(--text-secondary);
}
.task-detail-id { margin-bottom: 8px; font-family: monospace; }
.task-detail-desc { margin-bottom: 8px; line-height: 1.5; }
.task-detail-meta { margin-bottom: 4px; color: var(--text-muted); }
.task-detail-notes { margin-top: 8px; border-top: 1px solid var(--border-color); padding-top: 8px; }
.note-line { margin-bottom: 4px; }
.note-ts { color: var(--text-muted); font-size: 0.8rem; margin-right: 8px; }

/* hikarimaru instructions */
.hik-instruction {
    margin: 10px 0; padding: 12px; background: rgba(255,170,0,0.1);
    border: 1px solid rgba(255,170,0,0.3); border-radius: 8px;
    font-size: 0.85rem; line-height: 1.6;
}
.hik-instruction code {
    background: var(--bg-card); padding: 2px 6px; border-radius: 4px;
    font-family: monospace; color: var(--accent-yellow);
}

.subtasks-container { margin-left: 15px; border-left: 2px solid var(--border-color); }

/* ─── Badges ─── */
.badge {
    padding: 3px 8px; border-radius: 12px; font-size: 0.7rem;
    font-weight: 500; text-transform: uppercase; white-space: nowrap;
}
.status-pending { background: #555; color: #fff; }
.status-in_progress, .status-in-progress { background: var(--accent-blue); color: #fff; }
.status-completed { background: var(--accent-green); color: #000; }
.status-blocked { background: var(--accent-red); color: #fff; }

/* ─── Trades Tab ─── */
.no-position { text-align: center; padding: 20px; color: var(--text-muted); font-style: italic; }

.position-card {
    background: var(--bg-secondary); border: 1px solid var(--accent-blue);
    border-radius: 8px; padding: 15px; margin-bottom: 10px;
}
.position-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.position-token { font-size: 1.2rem; font-weight: 600; }
.position-value { font-size: 1.3rem; font-weight: 700; color: var(--accent-green); }
.position-details { display: flex; gap: 20px; font-size: 0.9rem; color: var(--text-secondary); flex-wrap: wrap; }
.position-details .positive { color: var(--accent-green); font-weight: 600; }
.position-details .negative { color: var(--accent-red); font-weight: 600; }
.position-date { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

.roundtrip-card {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 15px; margin-bottom: 10px;
}
.rt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rt-token { font-size: 1.1rem; font-weight: 600; }
.rt-pnl { font-size: 1.2rem; font-weight: 700; }
.rt-pnl.positive { color: var(--accent-green); }
.rt-pnl.negative { color: var(--accent-red); }
.rt-details { font-size: 0.85rem; color: var(--text-secondary); }
.rt-details div { margin-bottom: 4px; }

.trade-table-container { overflow-x: auto; }
.trade-table { width: 100%; border-collapse: collapse; }
.trade-table th {
    background: var(--bg-secondary); padding: 10px 8px; text-align: left;
    font-size: 0.85rem; color: var(--text-secondary); border-bottom: 1px solid var(--border-color);
}
.trade-table td { padding: 10px 8px; font-size: 0.85rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.trade-table td small { color: var(--text-muted); }
.trade-table tbody tr:hover { background: rgba(255,255,255,0.05); }
.status-badge { font-size: 1rem; }
.status-badge.success { color: var(--accent-green); }
.status-badge.failed { color: var(--accent-red); }

/* ─── Signals Tab ─── */
.signal-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }
.signal-card {
    background: var(--bg-secondary); border-radius: 8px; padding: 15px;
    border: 2px solid var(--border-color); text-align: center;
}
.signal-card.signal-buy { border-color: var(--accent-green); background: rgba(0,255,136,0.05); }
.signal-card.signal-sell { border-color: var(--accent-red); background: rgba(255,68,68,0.05); }
.signal-card.signal-neutral { border-color: var(--border-color); }
.signal-pair { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.signal-cci { font-size: 1.5rem; margin-bottom: 5px; }
.signal-action { font-size: 0.9rem; margin-bottom: 5px; }
.signal-price { font-size: 0.85rem; color: var(--text-secondary); }
.signal-time { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
.signal-insight {
    margin-top: 15px; padding: 12px; background: var(--bg-secondary);
    border-radius: 8px; border: 1px solid var(--border-color);
    font-size: 0.9rem; line-height: 1.5;
}

.chart-controls { display: flex; gap: 5px; margin-bottom: 15px; }
.chart-btn {
    padding: 6px 12px; background: var(--bg-secondary);
    border: 1px solid var(--border-color); border-radius: 6px;
    color: var(--text-secondary); cursor: pointer; font-size: 0.8rem;
}
.chart-btn.active { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }
.chart-container { position: relative; height: 300px; background: var(--bg-secondary); border-radius: 8px; padding: 10px; }

.signal-legend { display: flex; gap: 15px; margin-top: 10px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ─── Reports ─── */
.report-item { margin-bottom: 10px; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.report-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; cursor: pointer; background: var(--bg-secondary);
}
.report-header:hover { background: var(--border-color); }
.report-date { font-weight: 500; color: var(--accent-blue); }
.report-content { padding: 0 16px; max-height: 0; overflow: hidden; transition: all 0.3s; }
.report-content.expanded { max-height: 500px; padding: 16px; overflow-y: auto; background: var(--bg-primary); }
.report-content h2,.report-content h3,.report-content h4 { color: var(--accent-green); margin: 10px 0 6px; }
.report-content li { color: var(--text-secondary); margin: 4px 0; }
.report-content strong { color: var(--text-primary); }

.loading { text-align: center; padding: 30px; color: var(--text-muted); font-style: italic; }
.no-data { text-align: center; padding: 20px; color: var(--text-muted); }

/* ─── Mobile ─── */
@media (max-width: 768px) {
    .container { padding: 5px; }
    .card { padding: 15px; }
    header h1 { font-size: 1.4rem; }
    .total-assets-value { font-size: 2rem; }
    .portfolio-layout { flex-direction: column; }
    .portfolio-chart-wrap { width: 180px; height: 180px; margin: 0 auto; }
    .pnl-grid { grid-template-columns: repeat(2, 1fr); }
    .task-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .task-filters { flex-direction: column; }
    .filter-select { width: 100%; }
    .signal-cards { grid-template-columns: 1fr; }
    .position-details { flex-direction: column; gap: 5px; }
    .chart-container { height: 250px; }
    .tab-btn { padding: 12px 14px; font-size: 0.85rem; }
}

/* Strategy Cards */
.strategies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.strategy-card {
    background: var(--card-bg, #1e1e2e);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border, #333);
}
.strategy-card.status-active { border-left: 4px solid #4caf50; }
.strategy-card.status-disabled { border-left: 4px solid #666; opacity: 0.6; }
.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.strategy-header h3 { margin: 0; font-size: 1.1em; }
.strategy-status { font-size: 0.85em; }
.strategy-body .strategy-info {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border, #333);
    font-size: 0.9em;
}
.strategy-info .label { color: var(--text-secondary, #888); }
.strategy-info .value { font-weight: 600; }
.strategy-params {
    margin-top: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 8px;
}
.strategy-params .param {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.85em;
}
.strategy-params .param span:first-child { color: var(--text-secondary, #999); }
.strategy-stats {
    margin-top: 8px;
    background: rgba(46, 204, 113, 0.08);
    border-radius: 8px;
    padding: 8px;
    border-left: 3px solid #2ecc71;
}
.strategy-stats .stats-header {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 4px;
    color: #2ecc71;
}
.strategy-stats .param {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.85em;
}
.strategy-stats .param span:first-child { color: var(--text-secondary, #999); }
.strategy-position {
    margin-top: 8px;
    background: rgba(52, 152, 219, 0.08);
    border-radius: 8px;
    padding: 8px;
    border-left: 3px solid #3498db;
}
.strategy-position .stats-header {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 4px;
    color: #3498db;
}
.strategy-position .param {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.85em;
}
.strategy-position .param span:first-child { color: var(--text-secondary, #999); }
.subtitle { color: var(--text-secondary, #888); margin-top: -8px; font-size: 0.9em; }


/* Memory tab styles */
.memory-agent-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.memory-tab-btn {
    padding: 8px 16px;
    border: 1px solid #444;
    background: #1a1a2e;
    color: #ccc;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.memory-tab-btn.active {
    background: #16213e;
    border-color: #0f3460;
    color: #e94560;
    font-weight: bold;
}
.memory-file-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.memory-file-btn {
    padding: 5px 12px;
    border: 1px solid #333;
    background: #111;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.memory-file-btn.active {
    background: #1a1a2e;
    border-color: #555;
    color: #fff;
}
.memory-content {
    background: #0a0a1a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #ddd;
}

/* ─── Folder View (Clawdia's Inner Files) ─── */
.memory-folder-btn {
    background: linear-gradient(135deg, #1a0a2e, #0a1a2e) !important;
    border-color: #4a2a6e !important;
    color: #c9a0dc !important;
}
.memory-folder-btn.active {
    background: linear-gradient(135deg, #2a1040, #1a2a4e) !important;
    border-color: #7b4a9e !important;
    color: #e8c8f8 !important;
    box-shadow: 0 0 12px rgba(123, 74, 158, 0.3);
}
.memory-tab-divider {
    color: #333;
    font-size: 12px;
    display: flex;
    align-items: center;
    padding: 0 4px;
}
.folder-view {
    display: flex;
    gap: 0;
    min-height: 50vh;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #2a1a3e;
}
.folder-sidebar {
    width: 180px;
    min-width: 180px;
    background: linear-gradient(180deg, #0e0818, #0a0a14);
    border-right: 1px solid #2a1a3e;
    padding: 0;
    overflow-y: auto;
}
.folder-header {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: bold;
    color: #c9a0dc;
    border-bottom: 1px solid #2a1a3e;
    background: rgba(74, 42, 110, 0.15);
    letter-spacing: 0.5px;
}
.folder-tree {
    padding: 8px 0;
}
.tree-dir {
    padding: 6px 12px;
    font-size: 11px;
    color: #7b6a8e;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tree-item {
    padding: 7px 16px;
    font-size: 12px;
    color: #8a7a9e;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.tree-item:hover {
    background: rgba(123, 74, 158, 0.1);
    color: #c9a0dc;
}
.tree-item.active {
    background: rgba(123, 74, 158, 0.2);
    color: #e8c8f8;
    border-left-color: #7b4a9e;
}
.tree-item-nested {
    padding-left: 28px;
}
.folder-content {
    flex: 1;
    background: #0a0a14;
    padding: 0;
    overflow-y: auto;
    max-height: 70vh;
}
.folder-content-path {
    padding: 10px 20px;
    font-size: 11px;
    color: #5a4a6e;
    border-bottom: 1px solid #1a1028;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: rgba(74, 42, 110, 0.08);
}
.folder-content-body {
    padding: 20px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.7;
    color: #d8c8e8;
    white-space: pre-wrap;
}
.folder-content-body h2,
.folder-content-body h3,
.folder-content-body h4 {
    color: #c9a0dc;
}
.folder-content-body strong {
    color: #e8c8f8;
}
.folder-content-body ul {
    padding-left: 20px;
}
@media (max-width: 600px) {
    .folder-view {
        flex-direction: column;
    }
    .folder-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 30vh;
        border-right: none;
        border-bottom: 1px solid #2a1a3e;
    }
    .folder-content {
        max-height: 50vh;
    }
}

/* Test trade styling */
.trade-row.test-trade {
    opacity: 0.5;
}
.test-badge {
    background: #555;
    color: #aaa;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7em;
    vertical-align: middle;
}

/* Strategy hierarchy styles */
.allocation-overview { margin-bottom: 20px; }
.allocation-overview h3 { margin-bottom: 10px; }
.allocation-bar { display: flex; height: 24px; border-radius: 12px; overflow: hidden; background: #333; margin-bottom: 8px; }
.alloc-segment { transition: width 0.3s; }
.allocation-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.85em; color: #aaa; }
.alloc-item { display: flex; align-items: center; gap: 4px; }
.alloc-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.strategy-section { background: #1a1a2e; border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.strategy-section.disabled { opacity: 0.6; }
.strat-header { padding-left: 12px; margin-bottom: 12px; }
.strat-title { display: flex; justify-content: space-between; align-items: center; }
.strat-title h3 { margin: 0; font-size: 1.2em; }
.strat-status { font-size: 0.85em; }
.strat-desc { color: #999; font-size: 0.85em; margin: 4px 0; }
.strat-meta { display: flex; gap: 16px; font-size: 0.8em; color: #888; margin-top: 4px; }
.strat-metrics { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.metric { background: #222; padding: 8px 12px; border-radius: 8px; text-align: center; min-width: 80px; }
.metric-val { display: block; font-size: 1.1em; font-weight: bold; }
.metric-lbl { display: block; font-size: 0.7em; color: #888; margin-top: 2px; }
.strat-conclusion { background: #1a2a1a; border-left: 3px solid #4c8; padding: 6px 10px; border-radius: 4px; font-size: 0.85em; color: #8c8; margin-bottom: 12px; }

.pairs-section h4 { margin: 8px 0; color: #aaa; font-size: 0.9em; }
.pairs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pair-card { background: #222; border-radius: 8px; padding: 12px; }
.pair-card.disabled { opacity: 0.5; }
.pair-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pair-name { font-weight: bold; font-size: 1.1em; }
.pair-params { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.pparam { background: #333; padding: 2px 6px; border-radius: 4px; font-size: 0.75em; color: #bbb; }
.pair-position { font-size: 0.85em; margin: 4px 0; color: #888; }
.pair-position.active { color: #4c8; }
.pair-stats { font-size: 0.8em; color: #aaa; margin: 4px 0; }
.pair-actions { margin-top: 6px; }
.link-btn { color: #4488ff; text-decoration: none; font-size: 0.8em; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Trade filters */
.trade-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-checkbox { display: flex; align-items: center; gap: 4px; font-size: 0.85em; color: #aaa; cursor: pointer; }
.cumulative-pnl { margin-top: 8px; font-size: 0.95em; color: #ccc; }

/* Dynamic allocation */
.alloc-total { font-size: 0.8em; color: #888; font-weight: normal; margin-left: 8px; }
.allocation-detail { margin-top: 8px; }
.alloc-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.85em; }
.alloc-name { min-width: 120px; color: #ccc; }
.alloc-vals { color: #999; }

/* Creative tab */
.creative-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.gallery-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}
.gallery-item:hover { transform: scale(1.02); }
.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.gallery-item .gallery-caption {
    padding: 10px 12px;
    font-size: 0.85em;
    color: #ccc;
}
.gallery-item .gallery-date {
    font-size: 0.75em;
    color: #888;
    margin-top: 4px;
}
.creative-essay-item, .creative-diary-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.creative-essay-item:hover, .creative-diary-item:hover {
    border-color: #9b59b6;
}
.creative-essay-item h3, .creative-diary-item h3 {
    margin: 0 0 8px 0;
    color: #e0e0e0;
    font-size: 1em;
}
.creative-essay-item .preview, .creative-diary-item .preview {
    color: #999;
    font-size: 0.85em;
    line-height: 1.5;
    max-height: 4.5em;
    overflow: hidden;
}
.creative-essay-item .date, .creative-diary-item .date {
    color: #888;
    font-size: 0.75em;
    margin-top: 8px;
}
.creative-full-content {
    background: var(--bg-secondary);
    border: 1px solid #9b59b6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 12px;
    color: #ddd;
    font-size: 0.9em;
    line-height: 1.8;
    white-space: pre-wrap;
}
.creative-full-content .back-btn {
    display: inline-block;
    margin-bottom: 12px;
    color: #9b59b6;
    cursor: pointer;
    font-size: 0.85em;
}
.creative-full-content .back-btn:hover { text-decoration: underline; }

/* ─── note Tab ─── */
.note-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
.note-stat {
    text-align: center;
    padding: 1rem;
    background: rgba(159, 122, 234, 0.1);
    border-radius: 8px;
}
.note-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #9f7aea;
}
.note-stat-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
}
.note-article-row {
    display: flex;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid #2d2d2d;
    gap: 1rem;
}
.note-article-row:last-child { border-bottom: none; }
.note-article-num {
    font-size: 0.9rem;
    color: #666;
    min-width: 2rem;
}
.note-article-info { flex: 1; }
.note-article-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.note-article-meta {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.note-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}
.note-badge.published { background: rgba(72, 187, 120, 0.2); color: #48bb78; }
.note-badge.draft { background: rgba(237, 137, 54, 0.2); color: #ed8936; }
.note-badge.planned { background: rgba(159, 122, 234, 0.2); color: #9f7aea; }
.note-article-stats {
    text-align: right;
    min-width: 6rem;
}
.note-article-likes {
    color: #e53e6b;
    font-weight: 600;
}
.note-article-date {
    font-size: 0.75rem;
    color: #666;
}
.note-schedule-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #2d2d2d;
}
.note-schedule-row:last-child { border-bottom: none; }
.note-schedule-icon { font-size: 1.1rem; }
.note-schedule-title { flex: 1; }
.note-schedule-date { color: #888; font-size: 0.85rem; }
.note-strategy-item {
    margin-bottom: 0.6rem;
    line-height: 1.5;
}
.note-strategy-goals {
    margin: 0.5rem 0 0.5rem 1rem;
}
.note-goal {
    padding: 0.3rem 0;
    color: #aaa;
}
.note-goal-phase {
    display: inline-block;
    min-width: 4rem;
    color: #9f7aea;
    font-weight: 600;
}
@media (max-width: 600px) {
    .note-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* note article content expand */
.note-article-content {
    padding: 1.5rem;
    margin: 0.5rem 0 1rem;
    background: rgba(159, 122, 234, 0.05);
    border-radius: 8px;
    border-left: 3px solid #9f7aea;
}
.note-article-thumb {
    margin-bottom: 1rem;
}
.note-article-thumb img {
    max-width: 100%;
    border-radius: 6px;
}
.note-article-body {
    line-height: 1.9;
    color: #ccc;
    font-size: 0.95rem;
}
.note-article-body p {
    margin-bottom: 1rem;
}
.note-article-body hr {
    border: none;
    border-top: 1px solid #444;
    margin: 1.5rem 0;
}
.note-article-body strong {
    color: #e2e8f0;
}

/* ─── ギャラリー ─── */
.gallery-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.gallery-stat {
    text-align: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.gallery-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 5px;
}
.gallery-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}
.gallery-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}
.gallery-item:hover {
    box-shadow: 0 4px 12px rgba(170, 68, 255, 0.3);
    transform: translateY(-2px);
}
.gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}
.gallery-item-info {
    padding: 12px;
}
.gallery-item-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.gallery-item-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-secondary);
    transition: all 0.3s;
}
.upload-area:hover {
    border-color: var(--accent-purple);
    background: rgba(170, 68, 255, 0.1);
}

/* ─── Essay Groups & Versioning ─── */
.essay-group-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.essay-group-header {
    padding: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.essay-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.essay-group-info h4 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.essay-group-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.essay-group-toggle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.essay-group-items {
    background: var(--bg-primary);
}

.essay-version-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s;
}

.essay-version-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.essay-version-item:last-child {
    border-bottom: none;
}

.essay-version-info {
    flex: 1;
}

.essay-version-label {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 4px;
}

.essay-version-title {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 500;
}

.essay-version-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.essay-version-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: 16px;
}

.essay-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.essay-header h3 {
    margin: 0;
    flex: 1;
}

.essay-metadata {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.essay-filename {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Status badges */
.status-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.note-draft {
    background: rgba(255, 170, 0, 0.15);
    color: var(--accent-yellow);
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.status-badge.published {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.note-ready {
    background: rgba(68, 136, 255, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(68, 136, 255, 0.3);
}

.status-badge.private {
    background: rgba(136, 136, 136, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(136, 136, 136, 0.3);
}

/* Responsive design for essay groups */
@media (max-width: 768px) {
    .essay-version-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .essay-version-meta {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .essay-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .essay-metadata {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
