/* ============================================
   SmartFlow — Minimalist Light Theme
   Professional Options Intelligence Dashboard
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
    /* Surfaces */
    --bg-page: #f8f9fb;
    --bg-card: #ffffff;
    --bg-elevated: #f1f3f5;
    --bg-hover: #f4f6f8;
    --bg-active: #eef1f4;
    --bg-strike: #f7f8fa;

    /* Text */
    --text-primary: #1a1d23;
    --text-secondary: #5a6170;
    --text-muted: #8b92a0;
    --text-accent: #2563eb;

    /* Accents */
    --accent: #2563eb;
    --accent-light: #dbeafe;
    --accent-bg: rgba(37, 99, 235, 0.06);

    /* Semantic Colors */
    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.08);
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.08);
    --red-light: #fee2e2;
    --amber: #d97706;
    --amber-bg: rgba(217, 119, 6, 0.08);

    /* Borders */
    --border: #e5e7eb;
    --border-light: #f0f1f3;
    --border-focus: #2563eb;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.06);

    /* Layout */
    --header-height: 52px;
    --controls-height: 44px;
    --summary-height: 64px;
    --alerts-width: 340px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition: 150ms ease;
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* ==========================================
   HEADER
   ========================================== */
#app-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.2rem;
}

.logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.header-center {
    display: flex;
    align-items: center;
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-badge.connected .status-dot {
    background: var(--green);
    box-shadow: 0 0 6px rgba(22, 163, 74, 0.4);
    animation: pulse 2s infinite;
}

.status-badge.connected {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-bg);
}

.status-badge.error .status-dot {
    background: var(--red);
    animation: none;
}

.status-badge.error {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.market-clock,
.last-update {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.clock-label,
.update-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.clock-time,
.update-time {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================
   CONTROLS BAR
   ========================================== */
#controls {
    height: var(--controls-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
}

.symbol-selector,
.metric-selector,
.expiry-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.symbol-selector label,
.metric-selector label,
.expiry-selector label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.expiry-badge {
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.expiry-badge.is-expiry-day {
    background: #FFF4E5;
    border-color: var(--amber);
    color: #D97706;
}

#controls select {
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

#controls select:hover {
    border-color: var(--text-muted);
}

#controls select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* View Toggles */
.view-toggles {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-sm);
    padding: 1px;
    margin-left: auto;
}

.toggle-btn {
    background: var(--bg-card);
    border: none;
    color: var(--text-muted);
    padding: 4px 14px;
    font-size: 0.72rem;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.toggle-btn.active {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

/* Auto-refresh */
.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

#auto-refresh {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.refresh-indicator {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
}

.refresh-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
    line-height: 1;
}

.refresh-btn:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

/* ==========================================
   SUMMARY BAR
   ========================================== */
#summary-bar {
    height: var(--summary-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
}

.summary-card {
    flex: 1;
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    transition: all var(--transition);
}

.summary-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.summary-card.anomaly-count {
    border-color: var(--red);
    border-left-width: 3px;
    background: var(--red-bg);
}

.card-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.card-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-trend {
    font-size: 0.65rem;
    font-weight: 500;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
#main-content {
    flex: 1;
    display: flex;
    gap: 0;
    overflow: hidden;
}

/* ==========================================
   HEATMAP AREA
   ========================================== */
.heatmap-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.heatmap-side-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.calls-label {
    color: var(--green);
}

.puts-label {
    color: var(--red);
}

.heatmap-center-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.heatmap-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

/* Loading State */
.heatmap-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.heatmap-loading .sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   HEATMAP ROWS
   ========================================== */
.heatmap-row {
    display: grid;
    grid-template-columns: 1fr 72px 1fr;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
    min-height: 34px;
}

.heatmap-row:hover {
    background: var(--bg-hover);
}

.heatmap-row.atm {
    border-top: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    background: var(--accent-bg);
}

/* Strike (center) */
.strike-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-strike);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
}

.strike-cell.atm-strike {
    color: var(--accent);
    font-weight: 800;
    background: var(--accent-light);
}

/* Call / Put Cells */
.call-cell,
.put-cell {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    align-items: center;
    padding: 3px 10px;
    gap: 3px;
    position: relative;
    overflow: hidden;
}

.call-cell {
    direction: rtl;
}

.call-cell>* {
    direction: ltr;
}

.cell-value {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.cell-value.oi {
    color: var(--text-primary);
    font-weight: 600;
}

.cell-value.delta-positive {
    color: var(--green);
    font-weight: 600;
}

.cell-value.delta-negative {
    color: var(--red);
    font-weight: 600;
}

.cell-value.volume {
    color: var(--text-secondary);
}

.cell-value.ltp {
    color: var(--text-secondary);
    font-size: 0.68rem;
}

/* Heat Bars */
.heat-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.12;
    transition: width 250ms ease;
    border-radius: 2px;
}

.call-cell .heat-bar {
    right: 0;
}

.put-cell .heat-bar {
    left: 0;
}

.heat-bar.positive {
    background: linear-gradient(90deg, transparent, var(--green));
}

.heat-bar.negative {
    background: linear-gradient(90deg, transparent, var(--red));
}

/* Anomaly Row */
.heatmap-row.anomaly {
    animation: anomalyFlash 2s ease-in-out 3;
}

@keyframes anomalyFlash {

    0%,
    100% {
        background: transparent;
    }

    50% {
        background: var(--red-bg);
    }
}

/* Column Headers */
.heatmap-col-headers {
    display: grid;
    grid-template-columns: 1fr 72px 1fr;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
}

.col-header-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    padding: 5px 10px;
    gap: 3px;
}

.col-header-group.calls {
    direction: rtl;
}

.col-header-group.calls>* {
    direction: ltr;
}

.col-header {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: right;
}

.col-header-strike {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-strike);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
}

/* ==========================================
   TABLE VIEW
   ========================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.73rem;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
}

.table-section-header {
    padding: 7px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    border-bottom: 2px solid var(--border);
}

.calls-header {
    color: var(--green);
    text-align: left;
}

.puts-header {
    color: var(--red);
    text-align: right;
}

.table-strike-header {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    background: var(--bg-strike);
    border-bottom: 2px solid var(--border);
}

.table-sub-header th {
    padding: 5px 10px;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table td {
    padding: 5px 10px;
    text-align: right;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table .even-row {
    background: var(--bg-page);
}

.data-table .atm-row {
    background: var(--accent-bg);
    border-top: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
}

.data-table .strike-col {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-strike);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
}

.data-table .atm-strike {
    color: var(--accent) !important;
    font-weight: 800;
    background: var(--accent-light) !important;
}

.data-table .ltp-cell {
    color: var(--text-primary);
    font-weight: 500;
}

.data-table .oi-cell {
    color: var(--text-primary);
    font-weight: 600;
}

.data-table .delta-positive {
    color: var(--green);
    font-weight: 600;
}

.data-table .delta-negative {
    color: var(--red);
    font-weight: 600;
}

/* ==========================================
   ALERTS PANEL
   ========================================== */
.alerts-panel {
    width: var(--alerts-width);
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.alerts-header h2 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.alerts-clear {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}

.alerts-clear:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.alerts-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.alert-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 20px;
}

.alert-placeholder .sub {
    font-size: 0.68rem;
}

/* Alert Cards */
.alert-card {
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 6px;
    animation: slideIn 0.25s ease;
    transition: all var(--transition);
}

.alert-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.alert-card.bullish {
    border-left: 3px solid var(--green);
}

.alert-card.bearish {
    border-left: 3px solid var(--red);
}

.alert-card .alert-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-card .alert-score {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--red-bg);
    color: var(--red);
}

.alert-card .alert-body {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-family: var(--font-mono);
}

.alert-card .alert-time {
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-top: 4px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   FOOTER
   ========================================== */
#app-footer {
    height: 28px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* ==========================================
   ANOMALY HISTORY TAB
   ========================================== */
.anomaly-history-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
}

.anomaly-filters {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-group label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.filter-group select,
.filter-group input:not([type="checkbox"]) {
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    outline: none;
    transition: border-color var(--transition);
    min-width: 100px;
}

.filter-group select:focus,
.filter-group input:not([type="checkbox"]):focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.filter-group input[type="number"] {
    width: 70px;
    min-width: 70px;
}

.filter-group input[type="date"] {
    min-width: 120px;
}

.filter-apply-btn,
.filter-reset-btn {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.filter-apply-btn {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.filter-apply-btn:hover {
    opacity: 0.9;
}

.filter-reset-btn {
    background: var(--bg-page);
    color: var(--text-secondary);
    border-color: var(--border);
}

.filter-reset-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.anomaly-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.anomaly-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.anomaly-stats .stat-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.anomaly-table-wrap {
    flex: 1;
    overflow-y: auto;
}

.anomaly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.73rem;
}

.anomaly-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
}

.anomaly-table th {
    padding: 7px 10px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.anomaly-table td {
    padding: 8px 10px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.anomaly-table tbody tr {
    transition: background var(--transition);
}

.anomaly-table tbody tr:hover {
    background: var(--bg-hover);
}

.anomaly-table tbody tr:nth-child(even) {
    background: var(--bg-page);
}

.anomaly-table tbody tr:nth-child(even):hover {
    background: var(--bg-hover);
}

.anomaly-table .col-time {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
}

.anomaly-table .col-symbol {
    font-weight: 600;
    color: var(--text-primary);
}

.anomaly-table .col-strike {
    font-family: var(--font-mono);
}

.anomaly-table .col-score {
    font-family: var(--font-mono);
    font-weight: 700;
}

.anomaly-table .col-oi {
    font-family: var(--font-mono);
    font-weight: 500;
}

.anomaly-table .col-message {
    white-space: normal;
    max-width: 300px;
    font-size: 0.68rem;
    line-height: 1.4;
}

.intent-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.intent-badge.long-buildup {
    background: var(--green-bg);
    color: var(--green);
}

.intent-badge.short-covering {
    background: var(--green-bg);
    color: var(--green);
}

.intent-badge.short-buildup {
    background: var(--red-bg);
    color: var(--red);
}

.intent-badge.long-unwinding {
    background: var(--red-bg);
    color: var(--red);
}

.score-high {
    color: var(--red);
}

.score-medium {
    color: var(--amber);
}

.score-low {
    color: var(--green);
}

.type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 700;
}

.type-badge.ce {
    background: var(--green-light);
    color: var(--green);
}

.type-badge.pe {
    background: var(--red-light);
    color: var(--red);
}

.anomaly-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.page-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.68rem;
    color: var(--text-muted);
    padding: 0 8px;
}


/* ==========================================
   MULTI-SELECT DROPDOWN
   ========================================== */
.multi-select {
    position: relative;
    display: inline-block;
}

.ms-toggle {
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 28px 5px 10px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 130px;
    text-align: left;
    position: relative;
    transition: border-color var(--transition);
    line-height: 1.4;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.ms-toggle:hover {
    border-color: var(--text-muted);
}

.ms-count {
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 4px;
    display: inline-block;
    line-height: 1.3;
}

.ms-count:empty {
    display: none;
}

.ms-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    z-index: 200;
    padding: 3px 0;
}

.ms-dropdown.open {
    display: block;
}

/* Scrollbar styling */
.ms-dropdown::-webkit-scrollbar {
    width: 5px;
}

.ms-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.ms-dropdown::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-family: -apple-system, BlinkMacSystemFont, var(--font-sans);
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s ease;
    white-space: nowrap;
}

.ms-option:hover {
    background: #3b82f6;
    color: #fff;
}

.ms-option:hover input[type="checkbox"] {
    accent-color: #fff;
}

.ms-option input[type="checkbox"] {
    accent-color: var(--accent);
    width: 11px;
    height: 11px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    appearance: checkbox;
    -webkit-appearance: checkbox;
}

/* ==========================================
   JUMP TO ATM BUTTON
   ========================================== */
.jump-atm-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: all var(--transition);
    z-index: 100;
}

.jump-atm-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ==========================================
   SORTABLE TABLE HEADERS
   ========================================== */
.table-sub-header th[onclick] {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
}

.table-sub-header th[onclick]:hover {
    color: var(--accent);
}

/* ==========================================
   RESPONSIVE
   ==========================================  */
@media (max-width: 1200px) {
    .alerts-panel {
        width: 260px;
    }

    .tagline {
        display: none;
    }
}

@media (max-width: 900px) {
    .alerts-panel {
        display: none;
    }

    .header-right {
        gap: 10px;
    }

    .market-clock {
        display: none;
    }
}

/* ============================================
   ANOMALY V2 — SIGNAL BREAKDOWN STYLES
   ============================================ */

/* V2 Table */
.v2-table {
    font-size: 12px;
}

.v2-table th {
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.v2-table td {
    vertical-align: middle;
    padding: 6px 8px;
}

/* Score badges */
.v2-score {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    min-width: 36px;
    text-align: center;
}

.v2-table .score-high {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

.v2-table .score-mid {
    background: rgba(234, 179, 8, 0.12);
    color: #b45309;
}

.v2-table .score-low {
    background: rgba(22, 163, 74, 0.10);
    color: #16a34a;
}

/* Signal breakdown bars */
.signal-bars {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    max-width: 160px;
}

.sig-bar {
    height: 5px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
    cursor: help;
}

.sig-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Signal colors */
.sig-fill.sig-vol {
    background: #2563eb;
}

/* Blue - Volume/OI */
.sig-fill.sig-iv {
    background: #dc2626;
}

/* Red - IV Change */
.sig-fill.sig-pcr {
    background: #7c3aed;
}

/* Purple - PCR */
.sig-fill.sig-oiz {
    background: #16a34a;
}

/* Green - ΔOI Z-Score */

/* Signal legend */
.sig-legend {
    display: flex;
    gap: 6px;
    font-size: 9px;
    color: var(--text-muted);
    align-items: center;
    margin-top: 1px;
}

.sig-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 4px;
}

.sig-dot.sig-vol {
    background: #2563eb;
}

.sig-dot.sig-iv {
    background: #dc2626;
}

.sig-dot.sig-pcr {
    background: #7c3aed;
}

.sig-dot.sig-oiz {
    background: #16a34a;
}

/* Type badges */
.type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.badge-ce {
    background: rgba(37, 99, 235, 0.10);
    color: #2563eb;
}

.badge-pe {
    background: rgba(220, 38, 38, 0.10);
    color: #dc2626;
}

/* Repeated badge */
.badge-repeated {
    font-size: 12px;
    opacity: 0.7;
}

.row-repeated {
    opacity: 0.6;
}

.row-repeated:hover {
    opacity: 1;
}

/* Severity badges */
.severity-extreme {
    display: inline-block;
    background: linear-gradient(135deg, #ff1744, #ff5252);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    animation: pulse-glow 1.5s ease-in-out infinite;
    vertical-align: middle;
}

.severity-high {
    display: inline-block;
    background: linear-gradient(135deg, #ff9100, #ffab40);
    color: #1a1a2e;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.row-extreme {
    border-left: 3px solid #ff1744;
    background: rgba(255, 23, 68, 0.06);
}

.row-extreme:hover {
    background: rgba(255, 23, 68, 0.12);
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(255, 23, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 12px rgba(255, 23, 68, 0.8);
    }
}

/* Cell styles */
.cell-time {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 11px;
}

.cell-intent {
    font-size: 11px;
    white-space: nowrap;
}