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

:root {
    --bg: #fafafa;
    --card: #ffffff;
    --border: #e5e5e5;
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --accent: #171717;
    --red: #dc2626;
    --green: #16a34a;
    --amber: #d97706;
    --orange: #ea580c;
    --blue: #2563eb;
    --purple: #7c3aed;
    --teal: #0d9488;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* iOS safe areas */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.container { max-width: 960px; margin: 0 auto; padding: 24px; }

/* Site Navigation */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}
.nav-container {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 24px;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}
.nav-brand:hover { opacity: 0.8; }
.nav-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
}
.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
}
.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg);
}
.nav-link.active {
    color: var(--text-primary);
    background: var(--bg);
    font-weight: 600;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}
.nav-action-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
}
.nav-action-link:hover {
    color: var(--text-primary);
    background: var(--bg);
}
.nav-action-link.active {
    color: var(--text-primary);
    background: var(--bg);
}
.nav-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 6px;
}
.nav-mobile-toggle:hover { background: var(--bg); }
.nav-mobile-menu {
    display: none;
    flex-direction: column;
    padding: 8px 0 16px;
    border-top: 1px solid var(--border);
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-link {
    display: block;
    padding: 12px 16px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.nav-mobile-link:hover {
    color: var(--text-primary);
    background: var(--bg);
}
.nav-mobile-link.active {
    color: var(--text-primary);
    background: var(--bg);
    font-weight: 600;
}
.nav-mobile-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}

/* Mobile navigation */
@media (max-width: 768px) {
    .nav-menu { display: none; }
    .nav-actions { display: none; }
    .nav-mobile-toggle { display: flex; }
}

/* Header */
header {
    padding: 48px 0 40px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.brand p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Notification Button */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lang-toggle {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-toggle:hover { border-color: var(--text-muted); }
.notify-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.notify-btn:hover { opacity: 0.85; }
.notify-btn.subscribed { background: var(--green); }
.notify-btn.disabled { background: var(--text-muted); cursor: not-allowed; opacity: 0.6; }
.notify-btn.disabled:hover { opacity: 0.6; }
.settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.125rem;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.settings-btn:hover { border-color: var(--text-muted); background: var(--card); }
.settings-btn.text-btn {
    width: auto;
    padding: 0 12px;
    font-size: 0.875rem;
    font-weight: 500;
}
.preset-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--card);
}

/* Welcome Section (Homepage) */
.welcome-section {
    padding: 24px 0 16px;
    margin-bottom: 8px;
}
.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}
.market-update-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-top: 10px;
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    background: var(--card);
    font-size: 0.75rem;
}
.market-update-status.is-completed {
    border-color: var(--green);
    color: var(--green);
}
.market-update-status.is-partial {
    border-color: var(--amber);
    color: var(--amber);
}
.market-update-status.is-failed {
    border-color: var(--red);
    color: var(--red);
}

/* Section Title */
.section-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

/* Featured Card (Summary) */
.featured-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
}
.featured-card:hover {
    border-color: var(--text-muted);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.featured-card .card-content {
    flex: 1;
}
.featured-card .card-title {
    font-size: 1.25rem;
    margin-bottom: 4px;
}
.featured-card .card-desc {
    font-size: 0.875rem;
}
.featured-card .badge {
    top: 16px;
    right: 16px;
}

/* HSI RSI 5 Indicator */
.hsi-rsi-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    color: var(--text-primary);
}
.hsi-rsi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}
.hsi-rsi-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}
.hsi-rsi-value {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.hsi-rsi-value.buy { color: var(--green); }
.hsi-rsi-value.sell { color: var(--red); }
.hsi-rsi-value.neutral { color: var(--amber); }
.hsi-rsi-bar {
    position: relative;
    height: 8px;
    background: linear-gradient(to right, var(--green) 0%, var(--green) 20%, var(--amber) 20%, var(--amber) 80%, var(--red) 80%, var(--red) 100%);
    border-radius: 4px;
}
.hsi-rsi-zones {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 6px;
}
.hsi-rsi-zones .zone-buy {
    color: var(--green);
}
.hsi-rsi-zones .zone-sell {
    color: var(--red);
}
.hsi-rsi-pointer {
    position: absolute;
    top: -5px;
    width: 18px;
    height: 18px;
    background: var(--card);
    border: 2px solid var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.16);
    transform: translateX(-50%);
    transition: left 0.3s ease;
}
.hsi-rsi-hint {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 10px;
}
.hsi-rsi-hint.buy { color: var(--green); }
.hsi-rsi-hint.sell { color: var(--red); }

/* Analysis Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.cards-grid.disabled-section {
    opacity: 0.6;
    margin-top: 8px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.card:hover {
    border-color: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card.disabled {
    cursor: default;
    opacity: 0.5;
}
.card.disabled:hover {
    border-color: var(--border);
    box-shadow: none;
}

.card-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-bottom: 16px;
}
.card-indicator.purple { background: var(--purple); }
.card-indicator.blue { background: var(--blue); }
.card-indicator.green { background: var(--green); }
.card-indicator.amber { background: var(--amber); }
.card-indicator.orange { background: var(--orange); }
.card-indicator.teal { background: var(--teal); }

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-muted);
    border-radius: 4px;
}
.badge.new {
    background: var(--blue);
    color: #fff;
}
.badge.beta {
    background: #8b5cf6;
    color: #fff;
}
.badge.hot {
    background: #dc2626;
    color: #fff;
}

/* Signal Badges (for Stock List table) */
.signal-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}
.signal-badge.green {
    background: rgba(22, 163, 74, 0.15);
    color: #16a34a;
}
.signal-badge.red {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}
.signal-badge.amber {
    background: rgba(217, 119, 6, 0.15);
    color: #d97706;
}
.signal-badge.slate {
    background: rgba(100, 116, 139, 0.15);
    color: #475569;
}

/* Page Views */
.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 32px; }
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Compact Page Header Row */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.header-link-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}
.header-link-arrow {
    font-size: 0.875rem;
    transition: transform 0.15s;
}
.header-link-btn:hover .header-link-arrow {
    transform: translateX(2px);
}
.scan-info-inline {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
@media (max-width: 480px) {
    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* Search Box */
.search-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.search-input-wrapper {
    display: flex;
    gap: 12px;
}
.search-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--accent);
}
.search-input::placeholder {
    color: var(--text-muted);
}
.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.search-btn:hover { opacity: 0.85; }
.search-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.search-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
}
.search-result {
    background: var(--card);
    border: 1px solid var(--blue);
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}
.search-result .section-header {
    background: rgba(37, 99, 235, 0.05);
}
.search-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.search-close-btn:hover { color: var(--text-primary); }
.search-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}
.search-error {
    padding: 20px;
    text-align: center;
    color: var(--red);
}
.search-no-signal {
    padding: 20px;
    background: rgba(163, 163, 163, 0.05);
}
.search-no-signal .stock-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.search-no-signal .stock-name {
    font-size: 1.125rem;
    font-weight: 600;
}
.search-no-signal .stock-ticker {
    font-size: 0.875rem;
    color: var(--text-muted);
}
.search-no-signal .td-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.search-no-signal .no-signal-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Date Tabs */
.date-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.date-tab {
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.date-tab:hover {
    border-color: var(--text-muted);
}
.date-tab.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.date-tab .tab-count {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    font-size: 0.6875rem;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
.date-tab:not(.active) .tab-count {
    background: var(--border);
    color: var(--text-muted);
}
.date-content {
    display: none;
}
.date-content.active {
    display: block;
}

/* Timeframe Toggle */
.timeframe-toggle {
    display: inline-flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}
.timeframe-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.timeframe-btn:hover {
    color: var(--text-primary);
    background: var(--card);
}
.timeframe-btn.active {
    background: var(--purple);
    color: white;
}

.scan-info {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e40af;
    background: #eff6ff;
    padding: 10px 16px;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    margin-bottom: 24px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.stats.two-col {
    grid-template-columns: repeat(2, 1fr);
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}
.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stat-up .stat-value { color: var(--red); }
.stat-down .stat-value { color: var(--green); }
.stat-approaching .stat-value { color: var(--amber); }
.stat-overbought .stat-value { color: var(--red); }
.stat-oversold .stat-value { color: var(--green); }
.stat-squeeze .stat-value { color: var(--amber); }

.section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}
.section-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
/* Watchlist Actions */
.watchlist-actions {
    display: flex;
    gap: 12px;
    margin: 16px 20px;
    flex-wrap: wrap;
    align-items: center;
}
.watchlist-actions .search-input {
    flex: 1;
    min-width: 180px;
}

.signal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.signal-up .signal-dot { background: var(--red); }
.signal-down .signal-dot { background: var(--green); }
.signal-approaching .signal-dot { background: var(--amber); }
.signal-overbought .signal-dot { background: var(--red); }
.signal-oversold .signal-dot { background: var(--green); }

.section-title-text {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}
.section-subtitle-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Table wrapper for horizontal scroll on mobile */
.date-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { padding: 10px 8px; text-align: left; white-space: nowrap; }
/* Compact columns for indicators */
th.col-compact, td.col-compact { padding: 10px 6px; text-align: center; }
/* First two columns (code, name) need more space */
th:nth-child(1), td:nth-child(1) { padding-left: 12px; }
th:nth-child(2), td:nth-child(2) { min-width: 100px; }
th {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg);
    position: sticky;
    top: 0;
}
tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
td { font-size: 0.875rem; }

.ticker-cell { display: flex; align-items: center; gap: 10px; }
.market-flag {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: var(--bg);
    border-radius: 4px;
    color: var(--text-muted);
    font-weight: 500;
}
.market-toggle {
    display: inline-flex;
    gap: 2px;
}
.market-toggle-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s ease;
    text-decoration: none;
}
.market-toggle-btn:hover {
    color: var(--text-primary);
    background: transparent;
}
.market-toggle-btn.active {
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--text-primary);
}
.ticker {
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', monospace;
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.name-cn { font-weight: 500; color: var(--text-primary); }
.name-en { color: var(--text-muted); font-size: 0.75rem; margin-top: 1px; }

.price {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.count-badge, .rsi-badge, .score-badge, .option-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8125rem;
}
.count-up, .option-put { background: #fef2f2; color: var(--red); }
.count-down, .option-call { background: #f0fdf4; color: var(--green); }
.date-badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Menlo', monospace;
}
.rsi-high { background: #fef2f2; color: var(--red); }
.rsi-low { background: #f0fdf4; color: var(--green); }
.rsi-tf-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    vertical-align: middle;
    background: var(--bg-secondary, #eef2f7);
    color: var(--text-muted, #6b7280);
}
.rsi-tf-intraday { color: #b45309; background: #fef3c7; }
.rsi-tf-daily { color: #1d4ed8; background: #dbeafe; }
.macd-bullish { background: #f0fdf4; color: var(--green); }
.macd-bearish { background: #fef2f2; color: var(--red); }
/* Custom RSI zone colors for short-term settings */
.rsi-critical-buy { background: #16a34a; color: #fff; }
.rsi-warning-buy { background: #bbf7d0; color: #166534; }
.rsi-warning-sell { background: #fef3c7; color: #92400e; }
.rsi-critical-sell { background: #dc2626; color: #fff; }
/* Watch-only "approaching" band — amber, distinct from actionable triggers */
.rsi-watch { background: #fde68a; color: #92400e; }
tr.rsi-watch-row td:first-child { border-left: 3px solid var(--amber); }
tr.rsi-watch-row:hover { background: #fffbeb; }
.signal-badge-rsi { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 0.82rem; font-weight: 600; }
.bb-high { background: #fef2f2; color: var(--red); }
.bb-low { background: #f0fdf4; color: var(--green); }
.score-a { background: #f0fdf4; color: var(--green); }
.score-b { background: #fef3c7; color: var(--amber); }
.score-c { background: #fef2f2; color: var(--red); }

.indicator-icons {
    display: flex;
    gap: 6px;
    font-size: 0.75rem;
}
.indicator-icon {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-muted);
}
.indicator-icon.active {
    background: var(--blue);
    color: #fff;
}

/* AI Badge (for modal indicator details) */
.ai-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    margin-right: 6px;
}
.ai-badge.div { background: var(--blue); color: #fff; }
.ai-badge.vol { background: var(--green); color: #fff; }
.ai-badge.sq { background: var(--amber); color: #fff; }

/* Indicator badges for separate columns */
.indicator-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.indicator-badge.muted {
    background: transparent;
    color: var(--text-muted);
}
.indicator-badge.active {
    background: var(--blue);
    color: #fff;
}
.indicator-badge.bullish {
    background: #dcfce7;
    color: #166534;
}
.indicator-badge.bearish {
    background: #fee2e2;
    color: #991b1b;
}

.option-rec {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.option-details {
    display: flex;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.option-strike {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Menlo', monospace;
}
.option-expiry {
    color: var(--text-secondary);
}
.option-price {
    color: var(--blue);
    font-family: 'SF Mono', 'Menlo', monospace;
}
.option-note {
    font-style: italic;
}

.empty-state, .loading-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.9375rem;
}
.loading {
    padding: 16px;
    color: var(--text-muted);
}
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Clickable rows */
tr.clickable { cursor: pointer; transition: background 0.15s; }
tr.clickable:hover { background: var(--bg); }

/* Column Info Icon & Tooltip */
.column-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border-radius: 50%;
    background: #93c5fd;
    color: #1e40af;
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    text-transform: none;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1;
}
.info-icon:hover {
    background: #60a5fa;
    color: #1e3a8a;
    transform: scale(1.1);
}
.info-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    min-width: 280px;
    max-width: 360px;
    width: max-content;
    white-space: normal;
    text-align: left;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.info-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #1f2937;
}
.info-icon:hover .info-tooltip {
    opacity: 1;
    visibility: visible;
}
/* Adjust tooltip position for rightmost columns */
th:nth-last-child(-n+4) .info-tooltip {
    left: auto;
    right: -10px;
    transform: none;
}
th:nth-last-child(-n+4) .info-tooltip::after {
    left: auto;
    right: 20px;
    transform: none;
}
/* First columns - align left */
th:nth-child(-n+2) .info-tooltip {
    left: -10px;
    right: auto;
    transform: none;
}
th:nth-child(-n+2) .info-tooltip::after {
    left: 20px;
    right: auto;
    transform: none;
}
@media (max-width: 768px) {
    .info-tooltip {
        min-width: 200px;
        max-width: 280px;
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-section {
    margin-bottom: 24px;
}
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.detail-item {
    background: var(--bg);
    padding: 12px;
    border-radius: 6px;
}
.detail-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.detail-value.green { color: var(--green); }
.detail-value.red { color: var(--red); }
.option-card {
    background: var(--bg);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.option-card:last-child { margin-bottom: 0; }
.option-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.option-card-type {
    font-weight: 600;
    font-size: 0.875rem;
}
.option-card-type.call { color: var(--green); }
.option-card-type.put { color: var(--red); }
.option-card-badge {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--card);
    color: var(--text-muted);
}
.option-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    font-size: 0.8125rem;
}
.option-card-item {
    text-align: center;
}
.option-card-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.option-card-value {
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', monospace;
}
.external-links {
    display: flex;
    gap: 8px;
}
.external-link {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: var(--bg);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}
.external-link:hover {
    background: var(--accent);
    color: #fff;
}

/* Custom Input/Confirm Modal */
.custom-modal {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.custom-modal-header {
    padding: 20px 24px 0;
}
.custom-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}
.custom-modal-body {
    padding: 16px 24px 20px;
}
.custom-modal-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 16px;
}
.custom-modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s;
}
.custom-modal-input:focus {
    border-color: var(--accent);
}
.custom-modal-input::placeholder {
    color: var(--text-muted);
}
.custom-modal-footer {
    display: flex;
    gap: 12px;
    padding: 0 24px 20px;
}
.custom-modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.custom-modal-btn-cancel {
    background: var(--bg);
    color: var(--text-secondary);
}
.custom-modal-btn-cancel:hover {
    background: var(--border);
}
.custom-modal-btn-ok {
    background: var(--accent);
    color: #fff;
}
.custom-modal-btn-ok:hover {
    opacity: 0.9;
}
.custom-modal-btn-danger {
    background: var(--red);
    color: #fff;
}
.custom-modal-btn-danger:hover {
    opacity: 0.9;
}

/* User Button */
.user-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.user-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}
.user-btn.logged-in {
    background: var(--green);
    color: #fff;
}
.user-btn.logged-in:hover {
    background: #15803d;
}

/* Auth Modal */
.auth-modal {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalSlideIn 0.2s ease-out;
}
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.auth-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}
.auth-modal-body {
    padding: 24px;
}
.auth-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 20px;
    line-height: 1.5;
}
.auth-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    text-align: center;
}
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}
.google-signin-btn:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}
.google-signin-btn svg {
    flex-shrink: 0;
}

/* User Menu Dropdown */
.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1001;
    display: none;
}
.user-menu.show {
    display: block;
}
.user-menu-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.user-menu-email {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-all;
}
.user-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}
.user-menu-item:hover {
    background: var(--bg);
    color: var(--text-primary);
}
.user-menu-item.danger {
    color: var(--red);
}

/* Warrant/CBBC Cards */
.warrant-section {
    margin-bottom: 16px;
}
.warrant-section:last-child {
    margin-bottom: 0;
}
.warrant-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.warrant-card {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--accent);
}
.warrant-card:last-child {
    margin-bottom: 0;
}
.warrant-card.put-warrant, .warrant-card.bear-cbbc {
    border-left-color: var(--red);
}
.warrant-card.call-warrant, .warrant-card.bull-cbbc {
    border-left-color: var(--green);
}
.warrant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.warrant-card-title {
    font-weight: 600;
    font-size: 0.875rem;
}
.warrant-card-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Menlo', monospace;
}
.warrant-grade {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--card);
}
.warrant-grade.A { background: var(--green); color: #fff; }
.warrant-grade.B { background: var(--blue); color: #fff; }
.warrant-grade.C { background: var(--amber); color: #000; }
.warrant-grade.D { background: var(--text-muted); color: #fff; }
.warrant-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    font-size: 0.75rem;
}
.warrant-card-item {
    text-align: center;
}
.warrant-card-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-bottom: 1px;
}
.warrant-card-value {
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', monospace;
}
.sample-data-badge {
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--amber);
    color: #000;
    margin-left: 8px;
}
.warrant-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}
.warrant-error {
    text-align: center;
    padding: 16px;
    color: var(--red);
    font-size: 0.8125rem;
}

/* Description Box */
.info-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}
.info-box-collapsible {
    padding: 0;
}
.info-box-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
}
.info-box-header:hover {
    background: var(--bg);
}
.info-box-toggle {
    font-size: 0.75rem;
    transition: transform 0.2s;
}
.info-box-collapsible .info-box-detail.show + .info-box-toggle,
.info-box-detail.show ~ .info-box-toggle {
    transform: rotate(180deg);
}
.info-box-collapsible .info-box-detail {
    padding: 0 20px 20px;
}
.info-box-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.info-box-content {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.info-box-content p { margin-bottom: 8px; }
.info-box-content p:last-child { margin-bottom: 0; }
.info-box-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.info-item {
    background: var(--bg);
    padding: 12px;
    border-radius: 6px;
}
.info-item-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.info-item-value {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Admin Controls */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}
.admin-status-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
}
.admin-status-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.admin-status-box pre {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}
.btn.loading {
    opacity: 0.7;
    pointer-events: none;
}
.btn.loading::after {
    content: '...';
}
.scan-success { color: var(--green); }
.scan-error { color: var(--red); }
.info-item-value.red { color: var(--red); }
.info-item-value.green { color: var(--green); }
.info-item-value.amber { color: var(--amber); }
.info-toggle {
    background: none;
    border: none;
    color: var(--blue);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0;
    margin-top: 8px;
}
.info-toggle:hover { text-decoration: underline; }
.info-box-detail { display: none; margin-top: 12px; }
.info-box-detail.show { display: block; }

/* Icon button */
.icon-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.icon-btn:hover {
    color: var(--text-primary);
    background: var(--border);
}

/* Settings Page Styles */
.settings-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}
.settings-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.settings-section-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 16px;
}
.settings-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
}
.checkbox-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}
.checkbox-group .checkbox-label {
    flex: 0 0 auto;
}
@media (max-width: 600px) {
    .settings-section { padding: 20px 16px; }
    .settings-grid { grid-template-columns: 1fr; gap: 16px; }
    .settings-grid.three-col { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .checkbox-group { gap: 16px; }
}
.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.setting-item:last-child { margin-bottom: 0; }
.setting-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.setting-label.checkbox-label {
    cursor: pointer;
}
.setting-label.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.label-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.label-dot.green { background: #16a34a; }
.label-dot.amber { background: #f59e0b; }
.label-dot.watch { background: #fbbf24; }
.label-dot.red { background: #dc2626; }
.setting-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.setting-input {
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.setting-input-small {
    max-width: 120px;
}
.setting-input:focus {
    border-color: var(--accent);
}
.threshold-preview {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}
.threshold-bar {
    height: 32px;
    border-radius: 6px;
    display: flex;
    overflow: hidden;
    font-size: 0.6875rem;
    font-weight: 600;
}
.threshold-bar > div {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.zone-critical-buy { background: #16a34a; }
.zone-warning-buy { background: #4ade80; color: #166534 !important; }
.zone-approaching-buy { background: #bbf7d0; color: #166534 !important; }
.zone-neutral { background: #e5e5e5; color: #737373 !important; }
.zone-approaching-sell { background: #fde68a; color: #92400e !important; }
.zone-warning-sell { background: #fbbf24; color: #92400e !important; }
.zone-critical-sell { background: #dc2626; }
.threshold-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.btn {
    padding: 12px 24px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.saved-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}
.saved-toast.show { opacity: 1; }

/* Learn Page Styles - Accordion */
.learn-section {
    background: var(--card-bg);
    border-radius: 12px;
    scroll-margin-top: 72px;
    margin-bottom: 12px;
    overflow: hidden;
}
.learn-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}
.learn-section-title:hover {
    background: rgba(0,0,0,0.03);
}
.learn-section-title .title-text {
    display: flex;
    align-items: center;
    gap: 10px;
}
.learn-section-title .accordion-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: transform 0.3s;
}
.learn-section.open .accordion-icon {
    transform: rotate(180deg);
}
.learn-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s;
    padding: 0 20px;
}
.learn-section.open .learn-content {
    max-height: 5000px;
    padding: 0 20px 20px 20px;
}
.learn-content-inner {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
}
.learn-content p { margin-bottom: 16px; }
.learn-subsection {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.learn-subsection h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.learn-subsection ul {
    margin: 0;
    padding-left: 20px;
}
.learn-subsection li {
    margin-bottom: 8px;
}
.learn-subsection.warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}
.learn-subsection.warning h4 {
    color: #b45309;
}
.learn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 12px;
}
.learn-card {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.learn-card.green {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
}
.learn-card.red {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}
.learn-card-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.learn-card.green .learn-card-title { color: #16a34a; }
.learn-card.red .learn-card-title { color: #dc2626; }
.learn-card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.learn-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}

.learn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.learn-table th {
    background: var(--bg);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.learn-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: top;
}

.learn-table tr:last-child td { border-bottom: none; }

.learn-highlight {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.learn-note {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.6;
    margin-top: 16px;
}

.learn-feature {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}
.learn-feature-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.learn-feature p {
    margin: 0;
    font-size: 0.875rem;
}
@media (max-width: 768px) {
    .learn-grid { grid-template-columns: 1fr; }
}

/* About Page */
.about-hero {
    text-align: center;
    padding: 48px 32px 56px;
    margin-bottom: 56px;
}
.about-hero-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent);
    color: white;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 24px;
}
.about-hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 16px;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1.2;
}
.about-hero-desc {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0 auto 48px;
    max-width: 480px;
    line-height: 1.7;
}
.about-hero-stats {
    display: inline-flex;
    justify-content: center;
    gap: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.about-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 24px 48px;
    border-right: 1px solid var(--border);
}
.about-stat:last-child {
    border-right: none;
}
.about-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
}
.about-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.about-section {
    margin-bottom: 64px;
}
.about-section-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 32px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Feature Cards */
.about-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.about-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 28px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.2s;
}
.about-card:hover {
    border-color: var(--text-muted);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.about-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}
.about-card-icon-td9 { background: #fef2f2; color: #dc2626; }
.about-card-icon-rsi { background: #eff6ff; color: #2563eb; }
.about-card-icon-bb { background: #fffbeb; color: #d97706; }
.about-card-icon-macd { background: #ecfdf5; color: #059669; }
.about-card-icon-ai { background: #f5f3ff; color: #7c3aed; font-size: 1rem; }
.about-card-icon-star { background: #fefce8; color: #ca8a04; }
.about-card-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.about-card-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Timeline - Card Style */
.about-timeline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.about-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 28px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.about-timeline-dot {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    flex-shrink: 0;
}
.about-timeline-content {
    flex: 1;
}
.about-timeline-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.about-timeline-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Markets */
.about-markets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.about-market {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.about-market-flag {
    font-size: 2.5rem;
}
.about-market-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
}
.about-market-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Tech Tags */
.about-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.about-tech-tag {
    display: inline-block;
    padding: 10px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Note */
.about-note {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 40px;
}
.about-note p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

@media (max-width: 768px) {
    .about-hero { padding: 32px 20px 40px; }
    .about-hero-title { font-size: 1.75rem; letter-spacing: -0.5px; }
    .about-hero-desc { font-size: 1rem; margin-bottom: 32px; }
    .about-hero-stats { display: flex; width: 100%; }
    .about-stat { padding: 20px 0; flex: 1; }
    .about-stat-value { font-size: 1.5rem; }
    .about-section { margin-bottom: 48px; }
    .about-section-title { margin-bottom: 24px; }
    .about-cards { grid-template-columns: 1fr; gap: 16px; }
    .about-card { padding: 24px; }
    .about-timeline { grid-template-columns: 1fr; gap: 16px; }
    .about-timeline-item { padding: 24px; }
    .about-markets { grid-template-columns: 1fr; gap: 16px; }
    .about-market { padding: 24px; }
}

footer {
    text-align: center;
    padding: 48px 0 24px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Main Site Footer */
.site-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    margin-top: 48px;
}
.site-footer-content {
    max-width: 960px;
    margin: 0 auto;
    text-align: center;
}
.site-footer-disclaimer {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.site-footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.site-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}
.site-footer-links a:hover {
    color: var(--accent);
}
.site-footer-copyright {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

@media (max-width: 768px) {
    .container { padding: 16px; padding-bottom: 80px; }
    header { padding: 32px 0 24px; }
    .header-content { flex-direction: column; align-items: flex-start; gap: 16px; }
    .featured-card { padding: 20px; flex-direction: column; align-items: flex-start; gap: 16px; }
    .featured-card .card-title { font-size: 1.125rem; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .card { padding: 16px; }
    .hsi-rsi-box { padding: 14px; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: 0.6875rem; }
    th, td { padding: 8px 6px; }
    .section-header { padding: 14px 16px; }
    /* Hide DIV, VOL, Trend columns on mobile (columns 7,8,9 in RSI table) */
    .rsi-table th:nth-child(7), .rsi-table td:nth-child(7),
    .rsi-table th:nth-child(8), .rsi-table td:nth-child(8),
    .rsi-table th:nth-child(9), .rsi-table td:nth-child(9) { display: none; }
    /* Compact table mode on mobile */
    .compact-mobile th:nth-child(n+5), .compact-mobile td:nth-child(n+5) { display: none; }
}

/* =============================================== */
/* Bottom Navigation Bar */
/* =============================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    max-width: 600px;
    margin: 0 auto;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.2s;
}
.bottom-nav-item:hover, .bottom-nav-item.active {
    color: var(--accent);
}
.bottom-nav-item svg {
    width: 24px;
    height: 24px;
}
@media (max-width: 768px) {
    .bottom-nav { display: block; }
    .header-actions .settings-btn.text-btn { display: none; }
}

/* Bottom Nav More Menu */
.bottom-nav-more {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    padding: 8px 0;
    min-width: 140px;
    margin-bottom: 8px;
}
.bottom-nav-more.open { display: block; }
.bottom-nav-more-item {
    display: block;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.bottom-nav-more-item:hover, .bottom-nav-more-item.active {
    color: var(--text-primary);
    background: var(--bg);
}
.bottom-nav-more-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
}

/* =============================================== */
/* Loading Skeletons */
/* =============================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-stat {
    height: 48px;
    margin-bottom: 8px;
}
.skeleton-row {
    height: 60px;
    margin-bottom: 1px;
}
.skeleton-table {
    padding: 20px;
}

/* =============================================== */
/* Stat Counter Animation */
/* =============================================== */
.stat-value {
    transition: transform 0.3s ease-out;
}
.stat-value.counting {
    transform: scale(1.1);
}
@keyframes count-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================== */
/* Swipe Navigation Support */
/* =============================================== */
.page {
    touch-action: pan-y pinch-zoom;
}
.swipe-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 50;
    border-radius: 8px;
}
.swipe-indicator.left { left: 8px; }
.swipe-indicator.right { right: 8px; }
.swipe-indicator.show { opacity: 1; }

/* =============================================== */
/* Keyboard Focus Styles */
/* =============================================== */
.clickable-row:focus {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
    background: var(--bg);
}
.card:focus, .btn:focus, .date-tab:focus {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}
*:focus:not(:focus-visible) {
    outline: none;
}
*:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}
tr.keyboard-focused {
    background: var(--blue) !important;
    outline: none;
}
tr.keyboard-focused td {
    color: white;
}

/* =============================================== */
/* Empty State with Suggestions */
/* =============================================== */
.empty-state-enhanced {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.empty-state-desc {
    font-size: 0.875rem;
    margin-bottom: 16px;
}
.empty-state-action {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}
.empty-state-action:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* =============================================== */
/* Price Update Time Badge */
/* =============================================== */
.price-update-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: 4px;
}

/* =============================================== */
/* Performance Dashboard */
/* =============================================== */
.performance-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.performance-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.performance-stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.performance-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.performance-stat-value.positive { color: var(--green); }
.performance-stat-value.negative { color: var(--red); }
.performance-stat-value.neutral { color: var(--amber); }

.performance-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.performance-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

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

.performance-table th,
.performance-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.performance-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.performance-table td {
    font-size: 0.875rem;
    color: var(--text);
}

.performance-table tr:last-child td {
    border-bottom: none;
}

.performance-table .signal-type-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.performance-table .type-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.performance-table .type-indicator.buy { background: var(--green); }
.performance-table .type-indicator.sell { background: var(--red); }

.win-rate-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.win-rate-track {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    min-width: 60px;
}

.win-rate-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.win-rate-fill.high { background: var(--green); }
.win-rate-fill.medium { background: var(--amber); }
.win-rate-fill.low { background: var(--red); }

.win-rate-value {
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

.profit-value {
    font-weight: 600;
}

.profit-value.positive { color: var(--green); }
.profit-value.negative { color: var(--red); }

.signal-count {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.performance-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.performance-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.score-tier-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.score-tier-badge.high {
    background: #dcfce7;
    color: #166534;
}

.score-tier-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.score-tier-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

/* AI Analysis Styles */
.ai-score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.ai-score-badge.high {
    background: #dcfce7;
    color: #166534;
}

.ai-score-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.ai-score-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

.confidence-value {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.hold-period {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.indicator-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.indicator-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.indicator-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.indicator-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.indicator-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

/* Analysis Page Styles */
.analysis-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.analysis-card {
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

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

.analysis-card-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.analysis-card-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.analysis-card-change {
    font-size: 0.875rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.analysis-card-change.positive {
    background: #dcfce7;
    color: #166534;
}

.analysis-card-change.negative {
    background: #fee2e2;
    color: #991b1b;
}

.analysis-indicator-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.analysis-indicator-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.analysis-indicator-value {
    font-size: 0.875rem;
    font-weight: 600;
}

/* AI Summary Box */
.ai-summary-box {
    padding: 20px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-radius: 12px;
    border: 1px solid #c4b5fd;
    line-height: 1.7;
}

.ai-summary-box p {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.ai-summary-box p:last-child {
    margin-bottom: 0;
}

.ai-summary-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

/* AI Chat Container */
.ai-chat-container {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.ai-chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.ai-chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.ai-chat-message.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant {
    align-self: flex-start;
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.ai-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.9375rem;
    background: var(--card);
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: var(--accent);
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
}

.ai-chat-send-btn:active {
    transform: scale(0.95);
}

.preset-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg);
    border-radius: 4px;
}

/* TD9 Badge Styles */
.td9-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    gap: 4px;
}

.td9-badge-buy {
    background: #dcfce7;
    color: #166534;
}

.td9-badge-sell {
    background: #fee2e2;
    color: #991b1b;
}

/* Combined Signals List on Analysis Page */
.signals-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.signal-list-item {
    display: grid;
    grid-template-columns: 36px 1fr 80px 96px;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.signal-list-item:hover {
    background: var(--bg);
}

.signal-list-ticker {
    font-weight: 600;
}

.signal-list-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signal-list-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.signal-list-badges .signal-badge-small {
    padding: 2px 6px;
}

.signal-badge-small {
    display: inline-block;
    width: 76px;
    box-sizing: border-box;
    padding: 4px 4px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.signal-list-price {
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signal-badge-td9 {
    background: #dcfce7;
    color: #166534;
}

.signal-badge-rsi {
    background: #dbeafe;
    color: #1e40af;
}

.signal-list-confluence {
    border-left: 3px solid var(--purple, #8b5cf6);
    background: #faf5ff;
}

.signal-list-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.confluence-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
    background: #ede9fe;
    color: #6d28d9;
    white-space: nowrap;
    flex-shrink: 0;
}

.market-summary-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.market-summary-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.market-summary-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.market-stat {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border-radius: 8px;
    background: var(--card);
    border: 1px solid var(--border);
}

.market-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.market-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.market-bias-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.market-bias-label {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.market-bias-track {
    flex: 1;
    height: 6px;
    border-radius: 9999px;
    background: var(--border);
    overflow: hidden;
}

.market-bias-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.market-bias-result {
    font-weight: 600;
    flex-shrink: 0;
}

.section-divider-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 24px 0 16px;
}

.section-divider-label::before,
.section-divider-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Confluence notification-readiness redesign */
.confluence-readiness {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 24px;
    margin: 20px 0 24px;
    padding: 20px;
    color: var(--text-primary);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.confluence-readiness.is-ready { border-left: 4px solid var(--green); }
.confluence-readiness.is-blocked { border-left: 4px solid var(--amber); }
.confluence-readiness-main { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.readiness-icon { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; color: var(--text-secondary); background: var(--bg); font-size: 21px; line-height: 1; }
.is-ready .readiness-icon { color: var(--green); background: #f0fdf4; }
.is-blocked .readiness-icon { color: var(--amber); background: #fffbeb; }
.readiness-title { font-size: 1rem; line-height: 1.25; font-weight: 600; }
.readiness-copy { margin-top: 4px; max-width: 390px; color: var(--text-secondary); font-size: 0.8125rem; line-height: 1.45; }
.readiness-metrics { display: flex; align-items: stretch; }
.readiness-metric { min-width: 72px; padding: 0 14px; border-left: 1px solid var(--border); text-align: center; }
.readiness-value { display: block; color: var(--text-primary); font-size: 1.35rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.readiness-value.amber { color: var(--amber); }
.readiness-value.muted { color: var(--text-muted); }
.readiness-label { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.68rem; font-weight: 500; line-height: 1.25; text-transform: uppercase; letter-spacing: 0.03em; }
.readiness-rules { appearance: none; border: 0; padding: 0; color: var(--text-secondary); background: transparent; font: inherit; font-size: 0.8125rem; font-weight: 500; white-space: nowrap; cursor: pointer; }
.readiness-rules:hover, .readiness-rules:focus-visible { color: var(--text-primary); text-decoration: underline; outline: none; }
.notification-rules { display: flex; gap: 10px; margin: -12px 0 16px; padding: 11px 14px; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 0.75rem; line-height: 1.45; }
.notification-rules[hidden] { display: none; }
.notification-rules strong { flex: 0 0 auto; color: var(--text-primary); }

@media (max-width: 768px) {
    .confluence-readiness { grid-template-columns: 1fr; gap: 18px; padding: 18px; margin: 16px 0 20px; }
    .readiness-metrics { width: 100%; }
    .readiness-metric { flex: 1; min-width: 0; padding: 0 8px; }
    .readiness-metric:first-child { border-left: 0; }
    .readiness-rules { justify-self: start; }
    .notification-rules { display: block; margin-top: -14px; }
    .notification-rules span { display: block; margin-top: 3px; }
}

/* Analysis Page Two Column Layout */
.analysis-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.analysis-two-col .section {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .analysis-two-col {
        grid-template-columns: 1fr;
    }

    .signal-list-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .signal-list-item {
        grid-template-columns: 30px 1fr 66px 80px;
        gap: 6px;
        padding: 10px 12px;
    }

    /* Hide confluence badge text on mobile — border colour is enough */
    .confluence-badge {
        display: none;
    }

    .signal-badge-small {
        width: 62px;
        padding: 3px 3px;
        font-size: 0.7rem;
    }

    .signal-list-price {
        font-size: 0.85rem;
    }

    .market-summary-stats {
        gap: 8px;
    }

    .market-stat-value {
        font-size: 1.1rem;
    }
}

/* Stock Summary Overlay (inside AI Chat column) */
.analysis-result-overlay {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.analysis-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.analysis-result-header .section-title-text {
    font-weight: 600;
    color: var(--text-primary);
}

/* Summary Content Styles */
.summary-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.summary-header {
    margin-bottom: 12px;
}

.summary-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.summary-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-value.green {
    color: var(--green);
}

.summary-value.red {
    color: var(--red);
}

.summary-value.amber {
    color: #d97706;
}

.summary-price-tag {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.summary-price-change {
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 4px;
}

.summary-price-change.green { color: var(--green); }
.summary-price-change.red   { color: var(--red); }

.summary-strategy-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-strategy-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 6px 10px;
    align-items: baseline;
}

.summary-strategy-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.summary-strategy-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    grid-column: 2;
}

.summary-strategy-value.green { color: var(--green); }
.summary-strategy-value.red   { color: var(--red); }
.summary-strategy-value.amber { color: #d97706; }

.summary-strategy-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    grid-column: 2;
    margin-top: -4px;
}

.summary-macro-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
    font-size: 0.75rem;
    color: #92400e;
    line-height: 1.4;
}

.summary-macro-icon {
    flex-shrink: 0;
}

.summary-links {
    display: flex;
    gap: 12px;
}

.summary-link {
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.summary-link:hover {
    background: var(--bg);
}

/* AI Chat Loading Animation */
.ai-chat-message.loading {
    color: var(--text-muted);
}

.typing-dots {
    animation: typing 1.4s infinite;
    letter-spacing: 2px;
}

@keyframes typing {
    0%, 20% { opacity: 0.3; }
    50% { opacity: 1; }
    80%, 100% { opacity: 0.3; }
}

.ai-chat-message .error-text {
    color: var(--red);
}

.ai-chat-message .error-text a {
    color: var(--blue);
}

.ai-chat-message .warning-icon {
    font-size: 1rem;
}

/* Toggle Visibility Button for API Keys */
.toggle-visibility-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-visibility-btn:hover {
    color: var(--text-primary);
}

.toggle-visibility-btn .eye-icon {
    transition: opacity 0.15s;
}

/* AI Chat Hint */
.ai-chat-hint {
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.ai-model-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: 400;
    opacity: 0.7;
}

.ai-model-tag {
    display: block;
    margin-top: 8px;
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.ai-prompt-toggle {
    padding: 0 16px 8px;
    border-top: 1px solid var(--border);
}

.ai-prompt-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 8px 0;
    opacity: 0.7;
}

.ai-prompt-btn:hover { opacity: 1; }

.ai-prompt-content {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    line-height: 1.6;
    opacity: 0.8;
}

/* Signal Filter Tabs - Hyperlink Style */
.signal-filter-tabs {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 0;
    padding: 16px 20px;
}

a.filter-link {
    color: #2563eb !important;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

a.filter-link:hover {
    text-decoration: underline;
}

a.filter-link.active {
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* Buy/Sell Signal Type Badge */
.signal-type-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.signal-type-buy {
    background: #dcfce7;
    color: #166534;
}

.signal-type-sell {
    background: #fee2e2;
    color: #991b1b;
}

.signal-type-review {
    background: #fef3c7;
    color: #92400e;
}

/* ========================================================
   Index Context Bar (Analysis Page)
   ======================================================== */

.index-context-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.index-card {
    flex: 1;
    min-width: 110px;
    background: var(--card);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    position: relative;
    transition: border-color 0.2s;
}

.index-card.leading-up {
    border-color: var(--green);
    background: rgba(22, 163, 74, 0.06);
}

.index-card.leading-down {
    border-color: var(--red);
    background: rgba(220, 38, 38, 0.06);
}

.index-card-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.index-card-change {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.index-card-change.positive { color: var(--green); }
.index-card-change.negative { color: var(--red); }

.index-card-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.index-meta-rsi,
.index-meta-td9,
.index-meta-proxy {
    background: var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

/* Marks a card whose price level comes from a proxy instrument, not the index. */
.index-meta-proxy {
    background: transparent;
    border: 1px dashed var(--text-muted);
    cursor: help;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.leading-badge {
    position: absolute;
    top: -7px;
    right: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.leading-badge.up {
    background: var(--green);
    color: #fff;
}

.leading-badge.down {
    background: var(--red);
    color: #fff;
}

@media (max-width: 480px) {
    .index-card {
        min-width: 90px;
        padding: 8px 10px;
    }
    .index-card-change {
        font-size: 0.9rem;
    }
}

/* ---------------------------------------------------------------------------
   Push notification subscription panel (home page)
   --------------------------------------------------------------------------- */

.notify-panel {
    background: var(--card-bg, var(--bg-secondary));
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.notify-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.notify-topics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.notify-topic {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    cursor: pointer;
}

.notify-topic input {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.notify-btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: var(--purple, #8b5cf6);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.notify-btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

.notify-btn.subscribed {
    background: var(--green, #16a34a);
}

.notify-status {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    min-height: 1em;
}

.notify-status.is-error {
    color: var(--red, #dc2626);
}
