/* ==========================================================================
   KAMA Investment Platform v2.0 - Master Precision High-Contrast Styling System
   ========================================================================== */

:root {
    /* High Contrast Slate Theme */
    --bg-main: #0f172a;          /* Rich Deep Slate */
    --bg-surface: #1e293b;       /* Bright Slate Surface */
    --bg-card: #1e293b;          /* Bright Slate Card */
    --bg-card-hover: #334155;    /* Hover State Slate */
    --bg-input: #334155;         /* High Contrast Input BG */
    
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-border-glow: rgba(0, 242, 254, 0.4);
    
    /* Pure High-Legibility Text Palette */
    --text-primary: #ffffff;      /* 100% Crisp White */
    --text-secondary: #e2e8f0;    /* Bright Silver */
    --text-muted: #94a3b8;        /* Clear Muted Slate */
    
    --accent-cyan: #00f2fe;
    --accent-blue: #38bdf8;
    --accent-purple: #a855f7;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-gold: #fbbf24;
    --accent-orange: #fb923c;
    
    --color-up: #ff3b69;          /* Korean Red (Up) */
    --color-down: #38bdf8;        /* Korean Blue (Down) */
    
    --font-main: 'Noto Sans KR', 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    
    --shadow-glass: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 25px rgba(0, 242, 254, 0.25);
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.dark-theme {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.fs-xs { font-size: 0.8rem; }
.text-right { text-align: right; }
.up { color: var(--color-up) !important; font-weight: 700; }
.down { color: var(--color-down) !important; font-weight: 700; }

/* Uniform Buttons & Input Elements */
button {
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    outline: none;
    background: transparent;
    transition: var(--transition-fast);
}

input, select, textarea {
    font-family: var(--font-main);
    outline: none;
    border: 1px solid var(--glass-border);
    background: var(--bg-input);
    color: #ffffff;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    height: 44px;
    width: 100%;
    transition: var(--transition-fast);
}

textarea {
    height: auto;
    min-height: 100px;
    resize: vertical;
}

input::placeholder, select::placeholder, textarea::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.35);
    background: #475569;
}

.input-readonly {
    background: #1e293b !important;
    color: var(--accent-cyan) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    text-align: left;
}

.form-group label {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.92rem;
    height: 44px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #0b0f19;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0, 242, 254, 0.55);
}

.btn-outline {
    background: #334155;
    border: 1px solid var(--glass-border);
    color: #ffffff;
}

.btn-outline:hover {
    background: #475569;
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; height: 38px; }
.btn-xs { padding: 6px 12px; font-size: 0.78rem; height: 32px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* Master Header */
.master-header {
    height: 68px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e293b;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.brand-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
}

.brand-title span { color: var(--accent-cyan); }

.header-search-mini {
    position: relative;
    display: flex;
    align-items: center;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    padding: 2px 4px 2px 10px;
    height: 42px;
    width: 380px;
    transition: var(--transition-fast);
}

.header-search-mini:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.25);
    background: #334155;
}

.header-search-mini input {
    flex: 1;
    border: none;
    background: transparent;
    padding-left: 8px;
    height: 100%;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.92rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: #334155;
    border: 1px solid var(--glass-border);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-btn:hover {
    background: #475569;
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.bell-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--accent-rose);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    border: 2px solid #1e293b;
}

.btn-auth-pill {
    padding: 9px 20px;
    border-radius: var(--radius-pill);
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 700;
    height: 42px;
}

.btn-auth-pill:hover {
    background: var(--accent-cyan);
    color: #0b0f19;
}

.ext-hours-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: rgba(168, 85, 247, 0.25);
    border: 1px solid var(--accent-purple);
    font-size: 0.8rem;
    color: #e9d5ff;
    font-weight: 700;
}

.badge-dot.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple);
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* Tile App Menu */
.tile-menu-dropdown {
    position: fixed;
    top: 76px;
    right: 28px;
    width: 350px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    padding: 18px;
    z-index: 200;
}

.tile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 16px;
}

.tile-menu-header h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-close-mini { font-size: 1.4rem; color: #94a3b8; }

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

.tile-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 6px;
    border-radius: var(--radius-md);
    background: #334155;
    transition: var(--transition-fast);
    height: auto;
}

.tile-item:hover {
    background: #475569;
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.tile-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.tile-item span { font-size: 0.78rem; font-weight: 700; color: #ffffff; }

.icon-portfolio { background: linear-gradient(135deg, #10b981, #059669); }
.icon-chart { background: linear-gradient(135deg, #00f2fe, #38bdf8); }
.icon-holdings { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.icon-watchlist { background: linear-gradient(135deg, #fbbf24, #d97706); }
.icon-hot { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.icon-account { background: linear-gradient(135deg, #6366f1, #4338ca); }
.icon-chat { background: linear-gradient(135deg, #ec4899, #be185d); }
.icon-board { background: linear-gradient(135deg, #14b8a6, #0d9488); }

/* Google Search Hero */
.google-search-hero {
    min-height: calc(100vh - 68px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: radial-gradient(circle at 50% 30%, rgba(0, 242, 254, 0.12) 0%, transparent 65%);
}

.hero-content { max-width: 760px; width: 100%; }

.hero-brand-logo {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.4rem;
    box-shadow: 0 12px 32px rgba(0, 242, 254, 0.35);
}

.hero-brand-title {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.hero-brand-title span { color: var(--accent-cyan); }

.hero-subtitle {
    color: #cbd5e1;
    font-size: 1.08rem;
    font-weight: 500;
    margin-bottom: 36px;
}

.google-search-box-wrapper { position: relative; margin-bottom: 28px; }

.google-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    padding: 6px 14px 6px 24px;
    box-shadow: var(--shadow-glass);
    transition: var(--transition-fast);
    height: 56px;
}

.google-search-box:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 30px rgba(0, 242, 254, 0.4);
    background: #334155;
}

.search-main-icon { color: #94a3b8; width: 24px; height: 24px; margin-right: 14px; }

/* Search Country Toggle styling */
.search-country-toggle {
    display: flex;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    padding: 3px;
    margin-right: 12px;
    user-select: none;
    align-items: center;
}

.search-country-toggle.mini {
    margin-right: 6px;
    padding: 2px;
}

.country-pill {
    background: transparent;
    border: none;
    outline: none;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.search-country-toggle.mini .country-pill {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 10px;
}

.country-pill:hover {
    color: #f1f5f9;
}

.country-pill.active {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #0b0f19;
    box-shadow: 0 2px 8px rgba(0, 242, 254, 0.25);
}

/* Autocomplete Dropdown Styling */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    z-index: 999;
    max-height: 350px;
    overflow-y: auto;
    padding: 6px 0;
    backdrop-filter: blur(12px);
}

.search-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.search-dropdown-item:hover {
    background: #334155;
    color: var(--accent-cyan);
}

.dropdown-stock-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.dropdown-stock-code {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 700;
}

.google-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.15rem;
    padding: 0;
    color: #ffffff;
    font-weight: 600;
    height: 100%;
}

.search-submit-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #0b0f19;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.search-submit-btn:hover { transform: scale(1.06); }

.hero-search-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.filter-pill {
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    background: #334155;
    border: 1px solid var(--glass-border);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
}

.filter-pill:hover, .filter-pill.active {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.filter-pill.highlight {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(0, 242, 254, 0.3));
    border-color: var(--accent-purple);
    color: #f3e8ff;
}

.hot-stock-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tags-label { font-size: 0.88rem; color: #cbd5e1; font-weight: 700; }

.tag-btn {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: #334155;
    border: 1px solid var(--glass-border);
    font-size: 0.86rem;
    color: #ffffff;
    font-weight: 700;
    height: 36px;
}

.tag-btn:hover {
    background: rgba(244, 63, 94, 0.25);
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

/* Quick Test Login Banner */
.quick-login-banner {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid var(--accent-cyan);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-login-label { font-size: 0.85rem; font-weight: 800; color: var(--accent-cyan); }
.quick-login-buttons { display: flex; gap: 10px; }
.quick-login-buttons .btn { height: 36px; font-size: 0.82rem; flex: 1; }

/* Dashboard View */
.main-dashboard-view {
    padding: 24px 28px 80px;
    max-width: 1600px;
    margin: 0 auto;
}

.dashboard-stock-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 18px 24px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

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

.btn-back-hero {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #334155;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-title-wrap { display: flex; align-items: baseline; gap: 12px; }
.stock-title-wrap h2 { font-size: 1.8rem; font-weight: 800; color: #ffffff; }
.stock-symbol-badge { font-family: var(--font-mono); color: var(--accent-cyan); font-size: 0.98rem; font-weight: 700; }
.stock-market-tag { font-size: 0.8rem; padding: 4px 10px; border-radius: var(--radius-sm); background: #334155; color: #ffffff; font-weight: 700; }
.stock-live-price { display: flex; align-items: baseline; gap: 20px; justify-self: center; }
.price-main-wrap { display: flex; align-items: baseline; gap: 8px; }
.price-val { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: #ffffff; }
.price-unit { font-size: 1.05rem; color: #cbd5e1; font-weight: 600; }
.price-change-tag { font-weight: 800; font-size: 1.15rem; }
.dashboard-actions { display: flex; align-items: center; gap: 12px; }

/* Strategy Switcher Bar */
.strategy-switcher-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.switcher-label { font-size: 0.9rem; font-weight: 800; color: var(--accent-cyan); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.capsule-group { display: flex; align-items: center; gap: 10px; }

.capsule-btn {
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    background: #334155;
    border: 1px solid var(--glass-border);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    height: 42px;
    white-space: nowrap;
}

.capsule-btn:hover, .capsule-btn.active {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #0b0f19;
    border-color: transparent;
    box-shadow: 0 4px 18px rgba(0, 242, 254, 0.4);
}

/* Chart Workspace */
.chart-workspace {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    box-shadow: var(--shadow-glass);
}

.chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 16px;
}

.drawing-tools-group { display: flex; align-items: center; gap: 10px; }
.tool-label { font-size: 0.85rem; color: #cbd5e1; font-weight: 700; }

.tool-btn {
    padding: 7px 14px;
    border-radius: var(--radius-md);
    background: #334155;
    border: 1px solid var(--glass-border);
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 700;
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tool-btn:hover, .tool-btn.active {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.chart-canvas-container { position: relative; height: 480px; width: 100%; }

.pinned-signal-card {
    position: absolute;
    top: 14px; left: 14px;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
}

.signal-badge { padding: 5px 12px; border-radius: var(--radius-pill); font-weight: 800; font-size: 0.84rem; }
.signal-badge.buy { background: var(--color-up); color: #fff; }
.signal-badge.sell { background: var(--color-down); color: #fff; }
.signal-date { font-size: 0.8rem; color: #94a3b8; font-weight: 600; }
.signal-desc { font-size: 0.9rem; font-weight: 700; color: #ffffff; }

.signal-scrubber-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 16px;
    padding: 12px 20px;
    background: #334155;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.scrubber-controls { display: flex; align-items: center; gap: 10px; }

.btn-scrubber-nav {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #1e293b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scrubber-counter { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 800; color: var(--accent-orange); }
.scrubber-slider-wrap { flex: 1; }
.scrubber-range-slider { width: 100%; accent-color: var(--accent-orange); cursor: pointer; }

/* 10-Indicator Suite Control Bar & Tabs */
.sub-chart-suite-control {
    margin-top: 24px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.suite-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.suite-header h4 {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-all-suite-btn {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 800;
}

.toggle-all-suite-btn:hover {
    background: var(--accent-cyan);
    color: #0b0f19;
}

.indicator-page-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.indicator-tab {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: #334155;
    border: 1px solid var(--glass-border);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.indicator-tab:hover, .indicator-tab.active {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #0b0f19;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(0, 242, 254, 0.35);
}

/* Sub-Chart Flip-Book Carousel Alignment */
.sub-chart-flip-book {
    margin-top: 10px;
}

.flip-book-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.flip-book-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.flip-page-indicator { font-size: 0.92rem; font-weight: 800; color: #ffffff; }

.btn-flip-prev, .btn-flip-next {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #334155;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-pages-viewport {
    position: relative;
    height: 220px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #0f172a;
    border: 1px solid var(--glass-border);
}

.flip-page {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    transform: rotateY(90deg);
    transition: transform 0.4s ease, opacity 0.4s ease;
    pointer-events: none;
}

.flip-page.active {
    opacity: 1;
    transform: rotateY(0deg);
    pointer-events: auto;
}

.sub-chart-box {
    height: 100%;
    width: 100%;
    position: relative;
    padding: 10px;
}

.sub-chart-title {
    position: absolute;
    top: 8px; left: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.85);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    z-index: 5;
}

/* Multi-Indicator Grid Unfolded Layout */
.multi-indicator-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.grid-sub-chart-card {
    position: relative;
    height: 220px;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px;
}

/* Modals Base */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
}

.modal-card {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-glass);
    overflow: hidden;
}

.modal-card.modal-lg { max-width: 980px; }
.modal-card.modal-sm { max-width: 440px; }

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

.modal-header h3 { font-size: 1.2rem; font-weight: 800; color: #ffffff; display: flex; align-items: center; gap: 10px; }
.modal-close { font-size: 1.6rem; color: #94a3b8; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

.strategy-builder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 18px 0; }
.builder-card { padding: 18px; border-radius: var(--radius-md); background: #334155; border: 1px solid var(--glass-border); }
.builder-card.buy-rules { border-top: 4px solid var(--color-up); }
.builder-card.sell-rules { border-top: 4px solid var(--color-down); }
.builder-card h4 { margin-bottom: 14px; font-size: 1rem; font-weight: 800; color: #ffffff; }

.portfolio-summary-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.p-summary-item { padding: 16px 18px; border-radius: var(--radius-md); background: #334155; border: 1px solid var(--glass-border); display: flex; flex-direction: column; gap: 4px; }
.p-summary-item span { font-size: 0.84rem; color: #cbd5e1; font-weight: 700; }
.p-summary-item strong { font-size: 1.3rem; font-weight: 800; font-family: var(--font-display); color: #ffffff; }

.portfolio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.p-chart-box, .p-list-box { padding: 18px; border-radius: var(--radius-md); background: #334155; border: 1px solid var(--glass-border); }
.p-chart-box h4, .p-list-box h4 { font-size: 1.02rem; font-weight: 800; margin-bottom: 14px; color: var(--accent-cyan); }
.p-chart-canvas-wrapper { position: relative; height: 280px; width: 100%; }
.mini-holdings-list { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
.mini-holding-item { padding: 12px 16px; border-radius: var(--radius-md); background: #1e293b; border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; }

.form-row-grid { display: grid; grid-template-columns: 2fr 1.5fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 20px; }
.form-btn-align { margin-bottom: 14px; }

.data-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.92rem; color: #ffffff; font-weight: 600; }
.data-table th { color: #38bdf8; background: #334155; font-weight: 800; }

.hot-tab-buttons { display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; }
.hot-tab { padding: 10px 18px; border-radius: var(--radius-pill); background: #334155; border: 1px solid var(--glass-border); color: #ffffff; font-weight: 700; font-size: 0.88rem; height: 40px; white-space: nowrap; }
.hot-tab.active { background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue)); color: #0b0f19; border-color: transparent; }

.hot-ranking-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hot-card { padding: 14px 18px; border-radius: var(--radius-md); background: #334155; border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: var(--transition-fast); }
.hot-card:hover { background: #475569; border-color: var(--accent-cyan); }
.rank-num { font-family: var(--font-mono); font-weight: 800; color: var(--accent-gold); margin-right: 8px; }

.watchlist-items-container { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.watchlist-card { padding: 16px 20px; border-radius: var(--radius-md); background: #334155; border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: var(--transition-fast); }
.watchlist-card:hover { background: #475569; border-color: var(--accent-cyan); }
.watchlist-card strong { font-size: 1.05rem; color: #ffffff; }
.watchlist-card span { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 700; color: var(--accent-cyan); }

.toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; }
.toast { padding: 14px 22px; border-radius: var(--radius-md); background: #1e293b; border: 1px solid var(--accent-cyan); color: #ffffff; box-shadow: var(--shadow-glass); font-size: 0.94rem; font-weight: 800; }

/* AI Pattern Matching Panel Styles */
.ai-pattern-panel {
    margin-top: 24px;
    padding: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(139, 92, 246, 0.25); /* Subtle purple glow */
    box-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.1);
    backdrop-filter: blur(12px);
    transition: var(--transition-normal);
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.ai-panel-header h4 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-icon {
    color: #a78bfa; /* Lavender purple */
    width: 22px;
    height: 22px;
}

.ai-accuracy-badge {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c084fc;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
}

.ai-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ai-stat-card {
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-stat-card .stat-label {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 700;
}

.ai-stat-card .stat-val {
    font-size: 1.35rem;
    font-weight: 800;
    font-family: var(--font-display);
    color: #ffffff;
}

.ai-stat-card .stat-val.up {
    color: var(--color-up);
}

.ai-stat-card .stat-val.down {
    color: var(--color-down);
}

.ai-pattern-list-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 18px;
}

.ai-pattern-list-section h5 {
    font-size: 0.92rem;
    font-weight: 800;
    color: #cbd5e1;
    margin-bottom: 12px;
}

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

.ai-match-card {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.ai-match-card:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.ai-match-date {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
}

.ai-match-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
}

.ai-match-sim {
    color: var(--accent-cyan);
}

.ai-match-perf {
    color: #cbd5e1;
}

.ai-match-perf.up {
    color: var(--color-up);
}

.ai-match-perf.down {
    color: var(--color-down);
}

@media (max-width: 1199px) {
    .main-dashboard-view { padding: 16px; }
    .dashboard-stock-header { grid-template-columns: 1fr; gap: 16px; text-align: center; }
    .stock-live-price { justify-self: center; }
    .portfolio-grid, .strategy-builder-grid, .hot-ranking-grid, .watchlist-items-container, .multi-indicator-grid { grid-template-columns: 1fr; }
    .form-row-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .master-header { padding: 0 16px; }
    .brand-title { font-size: 1.1rem; }
    .header-search-mini { display: none; }
    .hero-brand-title { font-size: 2.4rem; }
    .chart-canvas-container { height: 320px; }
    .mobile-bottom-nav { display: flex; }
    .main-dashboard-view { padding-bottom: 80px; }
}
