/* ライトテーマ（デフォルト） */
:root, [data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f5;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f5f7fa;
    --bg-hover: #e8ecf0;
    --bg-alert: #f8f9fb;
    --border: #e0e4ea;
    --border-light: #eef0f4;
    --text-primary: #1a1f2e;
    --text-secondary: #4a5568;
    --text-muted: #8896a6;
    --text-link: #2563eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --orange: #ea580c;
    --green: #16a34a;
    --red: #dc2626;
    --purple: #7c3aed;
    --yellow: #ca8a04;
    --shadow: rgba(0,0,0,0.08);
    --score-high-bg: #fee2e2;
    --score-high-text: #dc2626;
    --score-mid-bg: #fff7ed;
    --score-mid-text: #ea580c;
    --score-low-bg: #eff6ff;
    --score-low-text: #2563eb;
    --badge-vol-bg: #fff7ed;
    --badge-vol-text: #ea580c;
    --badge-rising-bg: #fefce8;
    --badge-rising-text: #ca8a04;
    --badge-insider-bg: #f0fdf4;
    --badge-insider-text: #16a34a;
    --badge-combined-bg: #fef2f2;
    --badge-combined-text: #dc2626;
    --badge-price-bg: #fef2f2;
    --badge-price-text: #dc2626;
    --badge-premarket-bg: #f5f3ff;
    --badge-premarket-text: #7c3aed;
}

/* ダークテーマ */
[data-theme="dark"] {
    --bg-primary: #060b14;
    --bg-secondary: #0d1a2d;
    --bg-tertiary: #0a1628;
    --bg-header: #0a1628;
    --bg-card: #0d1a2d;
    --bg-input: #0a1220;
    --bg-hover: #152035;
    --bg-alert: #0a1220;
    --border: #1a2840;
    --border-light: #1a284030;
    --text-primary: #e8f0ff;
    --text-secondary: #c8d8f0;
    --text-muted: #6880a0;
    --text-link: #3d9eff;
    --accent: #3d9eff;
    --accent-hover: #5ab0ff;
    --orange: #ff6600;
    --green: #4CAF50;
    --red: #ff0066;
    --purple: #9933ff;
    --yellow: #ffaa00;
    --shadow: rgba(0,0,0,0.3);
    --score-high-bg: #ff006630;
    --score-high-text: #ff0066;
    --score-mid-bg: #ff660030;
    --score-mid-text: #ff6600;
    --score-low-bg: #3d9eff20;
    --score-low-text: #3d9eff;
    --badge-vol-bg: #ff660030;
    --badge-vol-text: #ff6600;
    --badge-rising-bg: #ffaa0030;
    --badge-rising-text: #ffaa00;
    --badge-insider-bg: #4CAF5030;
    --badge-insider-text: #4CAF50;
    --badge-combined-bg: #ff006630;
    --badge-combined-text: #ff0066;
    --badge-price-bg: #ff006630;
    --badge-price-text: #ff0066;
    --badge-premarket-bg: #9933ff30;
    --badge-premarket-text: #9933ff;
}

/* テーマ切り替えボタン */
.theme-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.2s;
    line-height: 1;
}
.theme-toggle:hover {
    background: var(--bg-hover);
}

/* === モバイル対応 === */
@media (max-width: 768px) {
    .container, .main-content {
        padding: 8px !important;
        max-width: 100% !important;
    }
    .card, .alert-card, .stat-card {
        padding: 12px !important;
        margin-bottom: 8px !important;
    }
    .grid, .stats-grid, .alert-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    table {
        font-size: 12px !important;
    }
    table th, table td {
        padding: 6px 4px !important;
    }
    h1, .page-title {
        font-size: 20px !important;
    }
    h2, .section-title {
        font-size: 16px !important;
    }
    .header, .navbar {
        padding: 8px !important;
        flex-wrap: wrap;
    }
    .nav-links {
        gap: 4px !important;
    }
    .nav-links a {
        font-size: 12px !important;
        padding: 4px 8px !important;
    }
    .btn, button {
        font-size: 13px !important;
        padding: 8px 12px !important;
    }
    .search-input, input[type="text"] {
        font-size: 16px !important; /* iOS zoom防止 */
    }
    .inline-fields, .field-row {
        flex-direction: column !important;
    }
    .field-row > * {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .container, .main-content {
        padding: 4px !important;
    }
    table {
        font-size: 11px !important;
        display: block;
        overflow-x: auto;
    }
}
