:root {
    /* Dhan-Style Simple Light Palette */
    --bg: #ffffff;
    --sidebar-bg: #f8f9fb;
    --card: #ffffff;
    --accent: #2962ff;
    --green: #089981;
    --red: #f23645;
    --text: #131722;
    --text-low: #6a707c;
    --border: #e0e3eb;
    --nav-hover: #eef2ff;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
}

.pro-app {
    display: flex;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    padding: 25px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-box {
    width: 32px; height: 32px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; border-radius: 8px;
    font-family: 'Outfit';
}

.brand h2 {
    font-size: 1.2rem;
    font-family: 'Outfit';
    color: var(--text);
    letter-spacing: 0.5px;
}

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

nav { flex: 1; padding: 10px 0; }

.nav-item {
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-low);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    text-align: left;
}

.nav-item:hover { background: var(--nav-hover); color: var(--accent); }
.nav-item.active {
    background: var(--nav-hover);
    color: var(--accent);
    font-weight: 600;
    border-right: 3px solid var(--accent);
}

.nav-item .icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer p { font-size: 0.75rem; color: var(--text-low); margin-bottom: 10px; }

.scan-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: 0.3s;
}

.scan-btn:hover { background: #1e4bd8; transform: translateY(-1px); }

/* Status Bar & Countdown */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    background: #f1f3f6;
    border-radius: 6px;
    padding: 6px 10px;
}

.status-online {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--green);
    letter-spacing: 0.5px;
}

.status-offline {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 0.5px;
    animation: blink 1s step-start infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.countdown {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-low);
    font-variant-numeric: tabular-nums;
}

/* Main Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Breadth Bar */
.breadth-bar {
    padding: 15px 30px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 25px;
    position: sticky; top: 0; z-index: 10;
}

.breadth-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 500; }
.label { color: var(--text-low); }
.val { font-weight: 700; }
.val.green { color: var(--green); }
.val.red { color: var(--red); }

.ratio-container { flex: 1; height: 6px; background: #f1f3f6; border-radius: 3px; overflow: hidden; max-width: 200px; }
.ratio-bar { height: 100%; background: var(--green); border-right: 2px solid var(--red); transition: 0.5s; }

.search-container { flex: 1; display: flex; justify-content: flex-end; }
#pro-search {
    background: #f1f3f6;
    border: 1px solid var(--border);
    padding: 8px 15px;
    border-radius: 6px;
    color: var(--text);
    width: 250px;
}

/* Tab Views */
.tab-view { display: none; padding: 30px; }
.tab-view.active { display: block; }

.view-header h2 { font-size: 1.4rem; margin-bottom: 20px; font-family: 'Outfit'; }

/* Table Styling */
/* Table Styling */
.table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto; /* Handles both X and Y scroll */
    max-height: calc(100vh - 200px); /* Keeps headers sticky within the view */
    position: relative;
}

table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0;
}

thead th { 
    text-align: left; 
    padding: 14px 15px; 
    font-size: 0.75rem; 
    color: var(--text-low); 
    text-transform: uppercase; 
    border-bottom: 2px solid var(--border);
    background-color: #f8f9fb !important; /* Force solid color */
    position: sticky;
    top: 0;
    z-index: 110; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Sticky First Column (Symbol) */
th:first-child, td:first-child {
    position: sticky;
    left: 0;
    background-color: #ffffff !important; /* Force solid white */
    z-index: 100;
    border-right: 1px solid var(--border);
}

th:first-child { 
    z-index: 120; 
    background-color: #f8f9fb !important;
}

td { padding: 12px 15px; border-bottom: 1px solid #f1f3f6; vertical-align: middle; background: inherit; }
tr:hover { background-color: var(--row-hover); }

.sym-pro { font-weight: 700; color: var(--text); font-size: 1rem; }
.ind-pro { font-size: 0.75rem; color: var(--text-low); }

.spike-tag {
    background: #eef2ff;
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold; font-size: 0.75rem;
}

.signal-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 5px;
}
.signal-tag.bull { background: #e6f4f1; color: var(--green); }
.signal-tag.bear { background: #fdebed; color: var(--red); }

.btn-tv {
    padding: 6px 12px;
    background: #f1f3f6;
    color: var(--text);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    transition: 0.2s;
}
.btn-tv:hover { background: var(--accent); color: #fff; }

.range-meter {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    position: relative;
    margin: 4px 0;
}

.range-meter.year {
    background: #e3f2fd;
}

.range-meter .marker {
    position: absolute;
    top: -4px;
    width: 8px;
    height: 12px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transform: translateX(-50%);
    z-index: 2;
}

.range-meter::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--red);
    border-radius: 2px 0 0 2px;
    opacity: 0.5;
}

.range-meter::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0; width: 4px;
    background: var(--green);
    border-radius: 0 2px 2px 0;
    opacity: 0.5;
}

.range-track { width: 100px; height: 4px; background: #f1f3f6; border-radius: 2px; position: relative; }
.range-marker {
    width: 6px; height: 6px; background: var(--accent);
    border-radius: 50%; position: absolute; top: -1px;
}

.live-launch {
    text-decoration: none;
    color: var(--accent) !important;
    background: rgba(41, 98, 255, 0.1);
    border: 1px solid rgba(41, 98, 255, 0.2);
    border-radius: 6px;
    margin: 5px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: 0.2s;
}

.live-launch:hover {
    background: var(--accent);
    color: #fff !important;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .container { padding: 5px; }
    .sidebar { position: fixed; bottom: 0; left: 0; width: 100%; height: 60px; flex-direction: row; padding: 0; border-right: none; border-top: 1px solid var(--border); z-index: 1000; }
    .brand { display: none; }
    nav { flex-direction: row; height: 100%; width: 100%; overflow-x: auto; padding: 5px; gap: 5px; }
    .nav-item { flex: 1; padding: 8px; justify-content: center; font-size: 0.8rem; white-space: nowrap; }
    .sidebar-footer { display: none; }
    main { margin-left: 0; margin-bottom: 60px; padding: 10px; }
    
    .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 1000px; }
    
    th:first-child, td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 10;
        box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    }
    th:first-child { background: #f8f9fb; }
    
    .industry { display: none; }
    .range-meter { width: 70px; }
    td { padding: 8px 6px; font-size: 0.8rem; }
}
