/* ============================================
   FINTECH DASHBOARD - PREMIUM DARK THEME
   ============================================ */

:root {
    /* Core Colors - Deep Charcoal Base */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;

    /* Sidebar */
    --sidebar-bg: #0d1117;
    --sidebar-border: rgba(48, 54, 61, 0.8);

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    /* Accent - Teal/Cyan */
    --accent-primary: #00d9ff;
    --accent-secondary: #00a8cc;
    --accent-glow: rgba(0, 217, 255, 0.2);

    /* Status Colors */
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;

    /* Borders */
    --border-primary: rgba(48, 54, 61, 0.8);
    --border-subtle: rgba(48, 54, 61, 0.4);

    /* Shadows */
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   APP LAYOUT - SIDEBAR + CONTENT
   ============================================ */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-layout.hidden {
    display: none !important;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-header {
    padding: 8px 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 217, 255, 0.08);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.nav-item svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.logout-btn:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

.views-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 40px;
}

.view-content {
    animation: fadeIn 0.3s ease;
}

.view-content.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   VIEW HEADER
   ============================================ */

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 32px;
}

.view-header-main {
    flex: 1;
}

.view-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.view-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.view-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Action Buttons */
.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.action-btn svg {
    flex-shrink: 0;
}

.action-btn.spinning svg {
    animation: spin 1s linear infinite;
}

.action-btn-danger {
    color: var(--danger);
    border-color: rgba(248, 81, 73, 0.3);
}

.action-btn-danger:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================
   DATA PANELS
   ============================================ */

.data-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timestamp {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.record-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   STATS GRID
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.1);
}

.stat-card.active {
    border-color: var(--accent-primary);
    background: rgba(0, 217, 255, 0.08);
}

.stat-card.accent {
    border-color: rgba(0, 217, 255, 0.3);
}

.stat-card.accent .stat-label {
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-value.price-up {
    color: var(--success);
}

.stat-value.price-down {
    color: var(--danger);
}

/* Stat Card Header with Refresh Button */
.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.stat-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Icon Button (for refresh icons in stat cards) */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.icon-btn.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Mini Toggle for Parallel Mode */
.toggle-wrapper-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.toggle-pill-mini {
    width: 28px;
    height: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    position: relative;
    transition: all 0.2s ease;
}

.toggle-pill-mini::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-checkbox:checked+.toggle-pill-mini {
    background: var(--success);
}

.toggle-checkbox:checked+.toggle-pill-mini::after {
    left: 14px;
    background: #fff;
}

.toggle-label-mini {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.toggle-checkbox:checked~.toggle-label-mini {
    color: var(--success);
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
    padding: 0 20px;
    min-height: 600px;
    /* Prevent table collapsing with few rows */
}

/* Value dashboards: fit all columns on desktop without horizontal scrolling */
#view-global .table-container,
#view-india-value .table-container {
    overflow-x: hidden;
    padding: 0 10px;
}

#global-table,
#india-value-table {
    width: 100%;
    table-layout: fixed;
}

#global-table th,
#global-table td,
#india-value-table th,
#india-value-table td {
    min-width: 0 !important;
    padding: 9px 6px !important;
}

#global-table th:nth-child(1),
#global-table td:nth-child(1),
#india-value-table th:nth-child(1),
#india-value-table td:nth-child(1) { width: 8%; }

#global-table th:nth-child(2),
#global-table td:nth-child(2),
#india-value-table th:nth-child(2),
#india-value-table td:nth-child(2) { width: 23%; }

#global-table th:nth-child(3),
#global-table td:nth-child(3),
#india-value-table th:nth-child(3),
#india-value-table td:nth-child(3) { width: 8%; }

#global-table th:nth-child(4),
#global-table td:nth-child(4),
#india-value-table th:nth-child(4),
#india-value-table td:nth-child(4) { width: 7%; }

#global-table th:nth-child(5),
#global-table td:nth-child(5),
#india-value-table th:nth-child(5),
#india-value-table td:nth-child(5) { width: 8%; }

#global-table th:nth-child(6),
#global-table td:nth-child(6),
#india-value-table th:nth-child(6),
#india-value-table td:nth-child(6) { width: 8%; }

#global-table th:nth-child(7),
#global-table td:nth-child(7),
#india-value-table th:nth-child(7),
#india-value-table td:nth-child(7) { width: 7%; }

#global-table th:nth-child(8),
#global-table td:nth-child(8),
#india-value-table th:nth-child(8),
#india-value-table td:nth-child(8) { width: 8%; }

#global-table th:nth-child(9),
#global-table td:nth-child(9),
#india-value-table th:nth-child(9),
#india-value-table td:nth-child(9) { width: 9%; }

#global-table th:nth-child(10),
#global-table td:nth-child(10),
#india-value-table th:nth-child(10),
#india-value-table td:nth-child(10) { width: 8%; }

#global-table th:nth-child(11),
#global-table td:nth-child(11),
#india-value-table th:nth-child(11),
#india-value-table td:nth-child(11) { width: 6%; }

#global-table th.col-wide,
#global-table td.col-company,
#india-value-table th.col-wide,
#india-value-table td.col-company {
    min-width: 0 !important;
    max-width: none !important;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 12px 10px;
    /* Reduced horizontal padding */
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
    position: relative;
    /* Added to anchor filter popovers */
}

td {
    padding: 12px 10px;
    /* Reduced horizontal padding */
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

/* Keep trending stocks rows compact by reserving room for patterns */
#stocks-table {
    min-width: 1160px;
}

#stocks-table th,
#stocks-table td {
    padding: 10px 8px;
}

#stocks-table th:nth-child(1),
#stocks-table td:nth-child(1) {
    width: 36px;
}

#stocks-table th:nth-child(2),
#stocks-table td:nth-child(2) {
    width: 120px;
}

#stocks-table th:nth-child(3),
#stocks-table td:nth-child(3) {
    width: 180px;
}

#stocks-table th:nth-child(4),
#stocks-table td:nth-child(4) {
    width: 150px;
}

#stocks-table th:nth-child(5),
#stocks-table td:nth-child(5) {
    width: 130px;
}

#stocks-table th:nth-child(6),
#stocks-table td:nth-child(6) {
    width: 120px;
}

#stocks-table th:nth-child(7),
#stocks-table td:nth-child(7) {
    width: 90px;
}

#stocks-table td:nth-child(3)>div,
#stocks-table td:nth-child(5)>div {
    overflow: hidden;
    text-overflow: ellipsis;
}

#stocks-table td:nth-child(4) .tag {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#stocks-table .patterns-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    min-height: 24px;
}

#stocks-table .patterns-inline .tag {
    margin-bottom: 0;
    flex: 0 0 auto;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td {
    border-bottom: none;
}

.price-up {
    color: var(--success);
    font-weight: 500;
}

.price-down {
    color: var(--danger);
    font-weight: 500;
}

/* Symbol Cell */
.symbol-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.name-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Country Flag */
.country-flag {
    width: 22px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Column limits */
/* Column limits */
.col-company {
    /* Allow to take available space */
    min-width: 200px;
}

.col-mcap {
    width: 100px;
}

.col-price {
    width: 120px;
}

.col-buyval {
    width: 110px;
}

.col-buypct {
    width: 90px;
}

.col-industry {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   PERCENTILE VISUALIZATION
   ============================================ */

.percentile-track {
    width: 100px;
    height: 6px;
    background: linear-gradient(to right, var(--success) 0%, var(--warning) 50%, var(--danger) 100%);
    border-radius: 3px;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.percentile-pointer {
    width: 4px;
    height: 12px;
    background: #fff;
    border: 1px solid var(--bg-primary);
    position: absolute;
    top: -3px;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.percentile-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 8px;
    text-transform: uppercase;
}

.percentile-top {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0f172a;
}

.percentile-high {
    background: rgba(0, 217, 255, 0.2);
    color: var(--accent-primary);
}

.percentile-mid {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-secondary);
}

/* Overvaluation Badges */
.overval-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.overval-good {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
}

.overval-fair {
    background: rgba(210, 153, 34, 0.15);
    color: var(--warning);
}

.overval-bad {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
}

.overval-vbad {
    background: rgba(248, 81, 73, 0.25);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ============================================
   TAGS
   ============================================ */

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 2px;
}

.tag-growth {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
}

.tag-vcp {
    background: rgba(0, 217, 255, 0.15);
    color: var(--accent-primary);
}

.tag-uptrend {
    background: rgba(163, 113, 247, 0.15);
    color: #a371f7;
}

/* ============================================
   ACTION ROW HIGHLIGHTING
   ============================================ */

tr.row-rocket td {
    background: rgba(248, 81, 73, 0.04) !important;
    border-bottom-color: rgba(248, 81, 73, 0.15);
}

tr.row-rocket td:first-child {
    box-shadow: inset 3px 0 0 var(--danger);
}

tr.row-launchpad td {
    background: rgba(63, 185, 80, 0.04) !important;
    border-bottom-color: rgba(63, 185, 80, 0.15);
}

tr.row-launchpad td:first-child {
    box-shadow: inset 3px 0 0 var(--success);
}

tr.row-midtrend td {
    background: rgba(0, 217, 255, 0.04) !important;
    border-bottom-color: rgba(0, 217, 255, 0.15);
}

tr.row-midtrend td:first-child {
    box-shadow: inset 3px 0 0 var(--accent-primary);
}

tr.row-buysignal td {
    background: rgba(210, 153, 34, 0.06) !important;
    border-bottom-color: rgba(210, 153, 34, 0.2);
}

tr.row-buysignal td:first-child {
    box-shadow: inset 3px 0 0 var(--warning);
}

/* ============================================
   FILTERS
   ============================================ */

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.filter-group-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 3px;
}

.filter-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-tab:hover {
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* Star Filter */
.star-filter {
    display: flex;
    gap: 2px;
}

/* ============================================
   TOGGLE SWITCH (Standard Size)
   ============================================ */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    width: 36px;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    position: relative;
    transition: all 0.2s ease;
    border: 1px solid var(--border-primary);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-input:checked+.toggle-slider {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.toggle-input:checked+.toggle-slider::after {
    left: 18px;
    background: var(--success);
}

.toggle-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-input:checked~.toggle-label {
    color: var(--text-primary);
}

/* ============================================
   TREND TAG COLORS (Professional Palette)
   ============================================ */
.tag-strong-uptrend {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.25), rgba(16, 185, 129, 0.15));
    color: #34d399;
    /* Emerald-400 */
    border: 1px solid rgba(52, 211, 153, 0.5);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(52, 211, 153, 0.3);
    padding: 4px 10px;
}

.tag-uptrend {
    background: rgba(45, 90, 80, 0.3);
    color: #6ee7b7;
    /* Emerald-300 - lighter, softer */
    border: 1px solid rgba(110, 231, 183, 0.2);
    font-weight: 500;
}

.tag-sideways {
    background: rgba(120, 100, 40, 0.25);
    color: #fcd34d;
    /* Amber-300 */
    border: 1px solid rgba(252, 211, 77, 0.25);
}

.tag-downtrend {
    background: rgba(120, 60, 60, 0.3);
    color: #fca5a5;
    /* Red-300 - softer salmon */
    border: 1px solid rgba(252, 165, 165, 0.2);
    font-weight: 500;
}

.tag-strong-downtrend {
    background: linear-gradient(135deg, rgba(153, 27, 27, 0.35), rgba(185, 28, 28, 0.25));
    color: #f87171;
    /* Red-400 */
    border: 1px solid rgba(248, 113, 113, 0.5);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
    padding: 4px 10px;
}

.tag-neutral {
    background: rgba(100, 100, 110, 0.2);
    color: #9ca3af;
    /* Gray-400 */
    border: 1px solid rgba(156, 163, 175, 0.2);
}

.star-btn {
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s ease;
    padding: 2px;
}

.star-btn:hover,
.star-btn.active {
    color: #fbbf24;
}

/* Toggle */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-checkbox {
    display: none;
}

.toggle-pill {
    width: 36px;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s ease;
}

.toggle-pill::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.2s ease;
}

.toggle-checkbox:checked+.toggle-pill {
    background: var(--accent-primary);
}

.toggle-checkbox:checked+.toggle-pill::after {
    transform: translateX(16px);
    background: var(--bg-primary);
}

.toggle-label-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================
   EXPAND BUTTON
   ============================================ */

.expand-container {
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.expand-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.expand-link:hover {
    opacity: 0.8;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination-controls {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    position: relative;
}

.selection-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pagination-controls button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-controls button:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.pagination-controls button.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */

#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#login-screen.hidden {
    display: none !important;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    margin: 0 auto 24px auto;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-card p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.error-msg {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    display: none;
    text-align: center;
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
    display: none !important;
}

/* Spinning animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinning svg {
    animation: spin 1s linear infinite;
}

/* Icon buttons (for any remaining) */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .views-container {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--sidebar-border);
        overflow-x: auto;
    }

    .sidebar-header {
        border-bottom: none;
        padding: 12px 16px;
    }

    .sidebar-nav {
        display: flex;
        padding: 0;
        overflow-x: auto;
    }

    .nav-section {
        display: flex;
        align-items: center;
        margin-bottom: 0;
    }

    .nav-section-header {
        padding: 8px 12px;
        white-space: nowrap;
    }

    .nav-item {
        padding: 12px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }

    .nav-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent-primary);
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        height: calc(100vh - 80px);
    }

    .views-container {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   LEGACY COMPATIBILITY (for JS that may use old classes)
   ============================================ */

.glass-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.text-btn:hover {
    opacity: 0.8;
}

/* Accent Gold for special cards */
:root {
    --accent-gold: #fbbf24;
}

/* Global Stocks Filter Popover */
:root {
    --color-accent: var(--accent-primary);
    --color-primary: var(--accent-primary);
}

#global-table th {
    position: relative;
    cursor: pointer;
}

.th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    user-select: none;
}

.th-content:hover {
    color: var(--color-primary);
}

.filter-icon {
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.45;
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    min-height: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.th-content:hover .filter-icon {
    opacity: 1;
    color: var(--color-accent);
}

.filter-icon.active {
    opacity: 1;
    color: var(--accent-gold);
}

.filter-popover {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 260px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 16px;
    z-index: 100;
    margin-top: 8px;
    animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-popover.show {
    display: block;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
    margin-top: 8px;
}

.btn-xs {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-clear {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-text-secondary);
}

.btn-clear:hover {
    border-color: var(--color-text-primary);
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-apply {
    background: var(--color-primary);
    border: none;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-apply:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -1px rgba(99, 102, 241, 0.5);
}


.header-count {
    font-size: 0.6em;
    color: var(--color-text-secondary);
    margin-left: 12px;
    font-weight: 400;
    vertical-align: middle;
}


/* Utility Classes for Stacked Columns */
.text-xs {
    font-size: 0.75rem;
    line-height: 1.2;
}

.text-sm {
    font-size: 0.85rem;
}

.text-secondary {
    color: var(--color-text-secondary);
}

.font-bold {
    font-weight: 600;
}

.filter-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.filter-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* Fix Link Visiblity */
.stock-link {
    color: var(--accent-primary) !important;
    text-decoration: none;
    font-weight: 600;
}

.stock-link:hover {
    text-decoration: underline;
    color: var(--accent-secondary) !important;
}


/* Refined Merged Column Sub-text */
.merged-sub {
    display: block;
    font-size: 0.70rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.02em;
    line-height: 1.2;
}


/* Tighten Global Table to prevent scroll */
#global-table th,
#global-table td {
    padding: 10px 8px !important;
}

/* Ensure Sticky Col doesn't break */
#global-table .sticky-col-2 {
    left: 0;
    z-index: 3;
    background: var(--bg-secondary);
    /* Ensure opaque */
}


/* Optimizing Column Widths */
th.col-narrow,
td.col-narrow {
    width: 90px;
    max-width: 100px;
}

th.col-wide,
td.col-company {
    /* Mapping td.col-company to this width logic */
    min-width: 220px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure the text inside also truncates */
td.col-company>div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Tighten Filter Arrow Logic */
.th-content {
    justify-content: initial !important;
    /* Kill space-between */
    gap: 3px !important;
}

/* Align arrow to right for numeric cols */
th.text-right .th-content {
    justify-content: flex-end !important;
}

/* Align arrow to left for text cols */
th:not(.text-right) .th-content {
    justify-content: flex-start !important;
}



/* Fix Header Formatting */
th.col-narrow,
td.col-narrow {
    width: auto !important;
    min-width: 90px !important;
    /* Reduced from 110px */
    max-width: none !important;
}

/* Specific Tighter Widths for Moat Categories to prevent horizontal scroll */
th[data-sort="moat_score"],
td:nth-child(8),
th[data-sort="efficiency.score"],
td:nth-child(9),
th[data-sort="health.score"],
td:nth-child(10) {
    min-width: 80px !important;
    width: 80px !important;
}

/* Reduce Header Font slightly to fit long titles */
#global-table th {
    font-size: 0.75rem !important;
    white-space: nowrap;
    /* Keep single line if possible */
}

/* Specific tweaks for very long columns if needed */
th[data-sort='ebit_/_interest_expense_ltm'],
th[data-sort='computed_owners_earnings'] {
    min-width: 110px !important;
    /* Reduced from 130px */
}


/* Utility Alignment Classes */
.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

.text-left {
    text-align: left !important;
}

/* Ensure block children inherit misalignment if needed, or align themselves */
.text-right>div {
    text-align: right;
    /* Explicitly align divs inside */
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* Pagination Refinement */
.pagination-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.pagination-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================
   MOAT SCORE BADGES
   ============================================ */

.moat-score-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.moat-badge {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.moat-widest {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.moat-wide {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.moat-narrow {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6 !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.moat-weak,
.moat-developing {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316 !important;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.moat-none {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.moat-watch {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.moat-neutral {
    background: rgba(148, 163, 184, 0.16);
    color: #94a3b8 !important;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

/* Valuation Score Cell - Styled like MOAT */
.valuation-score-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* Valuation Badges - Styled like MOAT badges */
.valuation-badge {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.valuation-deep {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.valuation-cheap {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e !important;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.valuation-reasonable {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308 !important;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.valuation-rich {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.valuation-expensive {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316 !important;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.valuation-very-expensive {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.valuation-extreme {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626 !important;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.valuation-na {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8 !important;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Moat Score Column Width */
th.col-moat,
th[data-sort="moat_score"] {
    min-width: 100px !important;
    width: 100px !important;
}

/* Quality Column */
th[data-sort="quality_score"] {
    min-width: 70px !important;
    width: 70px !important;
}

/* --- JOBS MANAGEMENT PAGE STYLES --- */

.jobs-info {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.badge {
    padding: 0.375rem 0.75rem;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

#scheduler-status {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

#jobs-count {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

#thesis-jobs-count {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
}

#jobs-table,
#thesis-jobs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

#jobs-table th,
#thesis-jobs-table th {
    text-align: left;
    padding: 0.875rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

#jobs-table td,
#thesis-jobs-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.875rem;
    vertical-align: top;
}

#jobs-table tbody tr:hover,
#thesis-jobs-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

#jobs-table tbody tr:last-child td,
#thesis-jobs-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-idle {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.status-running {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    animation: pulse-status 2s infinite;
}

.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

@keyframes pulse-status {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.run-job-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.run-job-btn:hover:not(.disabled) {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

.run-job-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
}

.run-job-btn svg {
    flex-shrink: 0;
}

/* Small run button variant */
.run-job-btn-small {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    gap: 0.375rem;
}

.run-job-btn-small svg {
    width: 14px;
    height: 14px;
}

/* Jobs table responsive adjustments */
@media (max-width: 1024px) {
    #jobs-table,
    #thesis-jobs-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    #jobs-table th,
    #jobs-table td,
    #thesis-jobs-table th,
    #thesis-jobs-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Link styles in jobs table */
#jobs-table td a {
    color: #3b82f6;
    text-decoration: none;
}

#jobs-table td a:hover {
    text-decoration: underline;
}

/* --- JOB PROGRESS BAR STYLES --- */

.job-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.job-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.job-phase {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.job-result {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #10b981;
}

.job-error {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #ef4444;
    cursor: help;
}

/* Stopped status badge */
.status-stopped {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Stopped message */
.job-stopped {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #f59e0b;
}

/* Stop button styles */
.stop-job-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stop-job-btn:hover:not(.disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.stop-job-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
}

.stop-job-btn svg {
    flex-shrink: 0;
}

/* Small stop button variant */
.stop-job-btn-small {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    gap: 0.375rem;
}

.stop-job-btn-small svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   JOB SETTINGS POPUP
   ============================================ */

.job-settings-popup-overlay,
.job-error-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.job-settings-popup,
.job-error-popup {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.job-settings-header,
.job-error-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.job-settings-header h3,
.job-error-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.job-settings-close,
.job-error-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.job-settings-close:hover,
.job-error-close:hover {
    color: var(--text-primary);
}

.job-settings-body {
    padding: 1.25rem;
}

.job-settings-row {
    margin-bottom: 1.5rem;
}

.job-settings-row:last-child {
    margin-bottom: 0;
}

.job-settings-row label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.job-threads-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.job-threads-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

.job-threads-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.job-threads-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.job-threads-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 24px;
    text-align: center;
}

.job-settings-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Toggle switch styling */
.job-toggle-label {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.job-continue-toggle {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
}

.job-continue-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.job-continue-toggle:checked {
    background: var(--accent-primary);
}

.job-continue-toggle:checked::after {
    transform: translateX(20px);
    background: white;
}

.job-toggle-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.job-settings-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-primary);
}

.job-settings-save,
.job-settings-run {
    flex: 1;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.job-settings-save {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.job-settings-save:hover {
    background: var(--border-primary);
}

.job-settings-run {
    background: var(--accent-primary);
    color: #0d1117;
    border: 1px solid var(--accent-primary);
}

.job-settings-run:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

/* Settings button in job row */
.job-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.job-settings-btn:hover {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

/* ============================================
   JOB ERROR POPUP
   ============================================ */

.job-error-popup {
    max-width: 600px;
}

.job-error-body {
    padding: 1.25rem;
    max-height: 60vh;
    overflow-y: auto;
}

.job-error-message {
    padding: 1rem;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.job-error-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.job-error-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.job-error-stat.success {
    border-color: rgba(63, 185, 80, 0.3);
    background: rgba(63, 185, 80, 0.1);
}

.job-error-stat.error {
    border-color: rgba(248, 81, 73, 0.3);
    background: rgba(248, 81, 73, 0.1);
}

.job-error-stat.skipped {
    border-color: rgba(211, 153, 34, 0.3);
    background: rgba(211, 153, 34, 0.1);
}

.job-error-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.job-error-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.job-error-stat.success .job-error-stat-value {
    color: var(--success);
}

.job-error-stat.error .job-error-stat-value {
    color: var(--danger);
}

.job-error-stat.skipped .job-error-stat-value {
    color: var(--warning);
}

.job-error-list h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.job-error-items {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-primary);
}

.job-error-item {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.job-error-item:last-child {
    border-bottom: none;
}

.job-error-item strong {
    color: var(--danger);
    font-weight: 500;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.notification {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-color: rgba(63, 185, 80, 0.3);
    background: rgba(63, 185, 80, 0.1);
    color: var(--success);
}

.notification-error {
    border-color: rgba(248, 81, 73, 0.3);
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
}

.notification-info {
    border-color: rgba(0, 217, 255, 0.3);
    background: rgba(0, 217, 255, 0.1);
    color: var(--accent-primary);
}


/* ==========================================
   INSIDER DASHBOARD STYLES
   ========================================== */

/* Score Circle */
.score-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.score-circle.high {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.score-circle.medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.score-circle.low {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

/* Signal Badges */
.signal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    margin-right: 4px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.signal-badge:hover {
    transform: scale(1.1);
}

/* Stock Info */
.stock-info .stock-symbol {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.stock-info .stock-sector {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Price Info */
.price-info .current-price {
    font-weight: 600;
    font-size: 14px;
}

.price-info .discount {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
    margin-top: 2px;
}

/* Buy Value */
.buy-value .value {
    font-weight: 600;
    font-size: 14px;
}

.buy-value .buyers {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Heatmap */
.heatmap-container {
    padding: 24px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.heatmap-cell {
    padding: 16px 12px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.heatmap-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.heatmap-cell.strong-buy {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    color: white;
}

.heatmap-cell.buy {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.heatmap-cell.neutral {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.heatmap-cell.sell {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.heatmap-cell.strong-sell {
    background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
    color: white;
}

.heatmap-cell .cell-sector {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.heatmap-cell .cell-ratio {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.heatmap-cell .cell-net {
    font-size: 12px;
    opacity: 0.9;
}

/* Heatmap Legend */
.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.heatmap-legend .legend-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.heatmap-legend .legend-gradient {
    width: 200px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #065f46, #10b981, #6b7280, #ef4444, #991b1b);
}

/* Chart Placeholder */
.chart-placeholder {
    padding: 48px 32px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.chart-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 24px;
}

.chart-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-stats .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-stats .stat-value {
    font-size: 28px;
    font-weight: 700;
}

.chart-stats .stat-value.positive {
    color: #10b981;
}

.chart-stats .stat-value.negative {
    color: #ef4444;
}

.chart-note {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Insider Dashboard - Professional Filter Bar */
.filter-bar .filter-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    min-width: 120px;
}

.filter-bar .filter-select:hover {
    border-color: var(--accent-primary);
}

.filter-bar .filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Time Range Selector */
.time-range-selector {
    display: flex;
    gap: 4px;
}

.time-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.time-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.time-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.pagination-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* Button Icon */
.btn-icon {
    padding: 8px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Final override: force value tables to fit without horizontal scrollbar */
#view-global .data-panel,
#view-india-value .data-panel {
    overflow-x: hidden !important;
}

#view-global .table-container,
#view-india-value .table-container {
    overflow-x: hidden !important;
    padding: 0 8px !important;
}

.india-value-warning-banner {
    margin: 0 10px 10px 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(210, 153, 34, 0.45);
    background: rgba(210, 153, 34, 0.12);
    color: #f5d58a;
    font-size: 0.82rem;
    line-height: 1.4;
}

.india-research-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 10px 10px 10px;
    flex-wrap: wrap;
}

.research-filter-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.research-filter-btn {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.18s ease;
}

.research-filter-btn:hover {
    border-color: rgba(96, 165, 250, 0.5);
    color: var(--text-primary);
}

.research-filter-btn.active {
    border-color: rgba(96, 165, 250, 0.75);
    color: #dbeafe;
    background: rgba(30, 64, 175, 0.38);
}

.india-research-slot {
    display: flex;
    justify-content: center;
    align-items: center;
}

.india-research-cell {
    min-width: 68px;
    max-width: 72px;
}

#india-value-table th.col-research {
    text-align: center !important;
    min-width: 64px !important;
    max-width: 72px !important;
}

.india-research-state-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.india-research-btn,
.india-research-pill {
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    min-height: 24px;
    min-width: 56px;
    padding: 2px 8px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.india-research-inline-meta {
    font-size: 0.58rem;
    color: var(--text-secondary);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    text-align: center;
}

.india-research-btn.start {
    background: rgba(15, 23, 42, 0.55);
    color: #cbd5e1;
}

.india-research-btn.start:hover {
    border-color: rgba(96, 165, 250, 0.7);
    color: #dbeafe;
}

.india-research-btn.retry {
    background: rgba(127, 29, 29, 0.28);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.55);
}

.india-research-btn.retry:hover {
    background: rgba(127, 29, 29, 0.38);
}

.india-research-progress-btn,
.india-research-circle {
    border: 1px solid rgba(148, 163, 184, 0.35);
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    cursor: pointer;
    position: relative;
    padding: 0;
    transition: all 0.18s ease;
}

.india-research-progress-btn:hover,
.india-research-circle:hover {
    transform: translateY(-1px);
}

.india-progress-circle {
    position: relative;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.india-progress-circle svg {
    width: 28px;
    height: 28px;
    transform: rotate(-90deg);
}

.india-progress-circle circle {
    fill: none;
    stroke-width: 3.2;
}

.india-progress-circle circle.bg {
    stroke: rgba(148, 163, 184, 0.28);
}

.india-progress-circle circle.fg {
    stroke: #60a5fa;
    stroke-linecap: round;
}

.india-progress-text {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.52rem;
    font-weight: 800;
    color: #dbeafe;
    line-height: 1;
}

.india-research-circle span {
    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
}

.india-research-circle.terminal.buy {
    background: rgba(6, 95, 70, 0.35);
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.65);
}

.india-research-circle.terminal.no-buy {
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.65);
}

.india-research-circle.terminal.pending {
    background: rgba(120, 53, 15, 0.35);
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.65);
}

.india-research-pill.running {
    background: rgba(30, 64, 175, 0.36);
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.7);
}

.india-research-pill.terminal.buy {
    background: rgba(6, 95, 70, 0.35);
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.65);
}

.india-research-pill.terminal.no-buy {
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.65);
}

.india-research-pill.terminal.pending {
    background: rgba(120, 53, 15, 0.35);
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.65);
}

.research-report-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.research-report-popup {
    width: min(980px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.research-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.research-report-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.research-report-close {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.research-report-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 14px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.research-report-body {
    padding: 12px 14px;
    overflow: auto;
    background: rgba(2, 6, 23, 0.45);
}

.research-report-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#global-table,
#india-value-table {
    table-layout: fixed !important;
    width: 100% !important;
}

#global-table th,
#global-table td,
#india-value-table th,
#india-value-table td {
    min-width: 0 !important;
    max-width: none !important;
    padding: 10px 8px !important;
}

/* Header-only spacing so filter arrows don't visually merge across columns */
#global-table th,
#india-value-table th {
    padding-left: 9px !important;
    padding-right: 11px !important;
    white-space: normal;
}

#global-table th,
#india-value-table th {
    font-size: 0.72rem !important;
    letter-spacing: 0.035em !important;
}

#global-table th.col-wide,
#global-table td.col-company,
#india-value-table th.col-wide,
#india-value-table td.col-company {
    min-width: 0 !important;
    max-width: none !important;
}

/* keep value badges compact inside fixed layout columns */
#global-table .moat-badge,
#india-value-table .moat-badge {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#global-table th:nth-child(1),
#global-table td:nth-child(1),
#india-value-table th:nth-child(1),
#india-value-table td:nth-child(1) { width: 8% !important; }

#global-table th:nth-child(2),
#global-table td:nth-child(2),
#india-value-table th:nth-child(2),
#india-value-table td:nth-child(2) { width: 18% !important; }

#global-table th:nth-child(3),
#global-table td:nth-child(3),
#india-value-table th:nth-child(3),
#india-value-table td:nth-child(3) { width: 8% !important; }

#global-table th:nth-child(4),
#global-table td:nth-child(4),
#india-value-table th:nth-child(4),
#india-value-table td:nth-child(4) { width: 8% !important; }

#global-table th:nth-child(5),
#global-table td:nth-child(5),
#india-value-table th:nth-child(5),
#india-value-table td:nth-child(5) { width: 8% !important; }

#global-table th:nth-child(6),
#global-table td:nth-child(6),
#india-value-table th:nth-child(6),
#india-value-table td:nth-child(6) { width: 8% !important; }

#global-table th:nth-child(7),
#global-table td:nth-child(7),
#india-value-table th:nth-child(7),
#india-value-table td:nth-child(7) { width: 7% !important; }

#global-table th:nth-child(8),
#global-table td:nth-child(8),
#india-value-table th:nth-child(8),
#india-value-table td:nth-child(8) { width: 7% !important; }

#global-table th:nth-child(9),
#global-table td:nth-child(9),
#india-value-table th:nth-child(9),
#india-value-table td:nth-child(9) { width: 10% !important; }

#global-table th:nth-child(10),
#global-table td:nth-child(10),
#india-value-table th:nth-child(10),
#india-value-table td:nth-child(10) { width: 9% !important; }

#global-table th:nth-child(11),
#global-table td:nth-child(11),
#india-value-table th:nth-child(11),
#india-value-table td:nth-child(11) { width: 9% !important; }

/* India Value 13-column layout with dedicated compact Research column. */
#india-value-table th:nth-child(1),
#india-value-table td:nth-child(1) { width: 7.5% !important; }
#india-value-table th:nth-child(2),
#india-value-table td:nth-child(2) { width: 15% !important; }
#india-value-table th:nth-child(3),
#india-value-table td:nth-child(3) { width: 8% !important; }
#india-value-table th:nth-child(4),
#india-value-table td:nth-child(4) { width: 7% !important; }
#india-value-table th:nth-child(5),
#india-value-table td:nth-child(5) { width: 7.5% !important; }
#india-value-table th:nth-child(6),
#india-value-table td:nth-child(6) { width: 7% !important; }
#india-value-table th:nth-child(7),
#india-value-table td:nth-child(7) { width: 6% !important; }
#india-value-table th:nth-child(8),
#india-value-table td:nth-child(8) { width: 6% !important; }
#india-value-table th:nth-child(9),
#india-value-table td:nth-child(9) { width: 9% !important; }
#india-value-table th:nth-child(10),
#india-value-table td:nth-child(10) { width: 7% !important; }
#india-value-table th:nth-child(11),
#india-value-table td:nth-child(11) { width: 6% !important; }
#india-value-table th:nth-child(12),
#india-value-table td:nth-child(12) { width: 6% !important; }
#india-value-table th:nth-child(13),
#india-value-table td:nth-child(13) { width: 8% !important; }

#global-table thead .th-content,
#india-value-table thead .th-content {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: initial !important;
    width: 100% !important;
    gap: 5px !important;
    padding: 0 !important;
}

#global-table th.text-right .th-content,
#india-value-table th.text-right .th-content {
    justify-content: flex-end !important;
    margin-left: auto !important;
}

#global-table th:not(.text-right) .th-content,
#india-value-table th:not(.text-right) .th-content {
    justify-content: flex-start !important;
    margin-right: auto !important;
}

#global-table thead .th-content > span:first-child,
#india-value-table thead .th-content > span:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.15;
}

#india-value-table thead .th-content.roic-roe-wrap > span:first-child {
    line-height: 1.05;
}

#global-table thead .filter-icon,
#india-value-table thead .filter-icon {
    flex: 0 0 auto;
    font-size: 0.84rem !important;
    margin-left: 6px !important;
    min-width: auto !important;
    min-height: auto !important;
}

/* subtle visual separator between header cells for clearer column ownership */
#global-table thead th,
#india-value-table thead th {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

#global-table thead th:last-child,
#india-value-table thead th:last-child {
    border-right: none;
}

#india-value-table .score-circle.india-insider-score {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

#india-value-table .india-insider-empty {
    display: inline-block;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

/* Improve spacing and prevent ticker overlap into company column */
#global-table td:nth-child(1),
#india-value-table td:nth-child(1) {
    padding-right: 12px !important;
}

#global-table td:nth-child(2),
#india-value-table td:nth-child(2) {
    padding-left: 12px !important;
}

#global-table td:nth-child(1) .font-bold,
#india-value-table td:nth-child(1) .font-bold,
#global-table td:nth-child(1) .stock-link,
#india-value-table td:nth-child(1) .stock-link {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
