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

html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-y: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #E9F1FA;
    background-attachment: fixed;
    color: #000;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-top: 0;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(233, 241, 250, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 171, 228, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 171, 228, 0.7);
}

/* Reserve space so fixed navbar never overlaps content */
:root {
    --navbar-top-height: 52px;
    --navbar-stats-height: 36px;
    --replay-bar-height: 48px;
    --filter-bar-height: 38px;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    padding-top: calc(var(--navbar-top-height) + var(--navbar-stats-height) + var(--replay-bar-height) + var(--filter-bar-height));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: visible;
}

/* Main header – fixed bar at top */
.main-header {
    background: #FFFFFF;
    padding: 0;
    border-radius: 0;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Row 1: Brand + Nav + Date/Time */
.navbar-top {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 24px;
    height: var(--navbar-top-height);
    background: #FFFFFF;
    border-bottom: 1px solid rgba(0, 171, 228, 0.2);
}

.navbar-brand {
    font-size: 20px;
    font-weight: 800;
    color: #00ABE4;
    text-decoration: none;
    letter-spacing: -0.5px;
    margin-right: 32px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-brand:hover { color: #0099cc; }
.navbar-brand::before { content: '📊'; font-size: 22px; }

.navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-auth-link {
    font-size: 13px;
    font-weight: 600;
    color: #00ABE4;
    text-decoration: none;
    padding: 6px 16px;
    border: 1px solid #00ABE4;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.navbar-auth-link:hover {
    background: #00ABE4;
    color: #fff;
}
.navbar-auth-register {
    background: #00ABE4;
    color: #fff;
}
.navbar-auth-register:hover {
    background: #0099cc;
    border-color: #0099cc;
}

/* Row 2: Stats marquee */
.navbar-stats {
    display: flex;
    align-items: center;
    height: var(--navbar-stats-height);
    background: #FFFFFF;
    border-bottom: 1px solid rgba(0, 171, 228, 0.15);
    overflow: hidden;
    position: relative;
}

.marquee-track {
    display: block;
    width: 100%;
    overflow: hidden;
    flex: 1;
    position: relative;
}

.marquee-inner {
    display: inline-flex;
    white-space: nowrap;
    animation: marquee-scroll 20s linear infinite;
}

.marquee-content {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    padding-right: 80px;
}

.marquee-sep {
    color: rgba(0, 171, 228, 0.3);
    font-size: 14px;
    font-weight: 300;
    user-select: none;
}

.navbar-stats:hover .marquee-inner {
    animation-play-state: paused;
}

@keyframes marquee-scroll {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    flex-shrink: 0;
}
.stat-pill svg { flex-shrink: 0; }
.stat-pill-label {
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-pill-value {
    font-weight: 800;
    font-size: 15px;
    color: #0f172a;
}
.stat-pill-buy { color: #27ae60; }
.stat-pill-buy .stat-pill-value { color: #27ae60; }
.stat-pill-sell { color: #e74c3c; }
.stat-pill-sell .stat-pill-value { color: #e74c3c; }
.stat-pill-date { color: #00ABE4; }
.stat-pill-date .stat-pill-label { color: #475569; }
.stat-pill-date .stat-pill-value { color: #00ABE4; font-size: 13px; }
.stat-pill-closed .stat-pill-value { color: #b45309; font-weight: 700; font-size: 13px; }

#replayBar {
    position: relative;
    z-index: 999;
    background: #fff;
    padding: 8px 24px;
    border-top: 1px solid rgba(0, 171, 228, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-height: var(--replay-bar-height);
    box-sizing: border-box;
}

#replayBar label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #0b3c5d;
}

#replayBar #replayDate {
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid rgba(0, 171, 228, 0.4);
    border-radius: 6px;
    background: #fff;
}

#replayBar .time-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

#replayBar #replayTimeSlider,
#replayBar .replay-time-slider {
    flex: 1;
    min-width: 80px;
    height: 8px;
    margin: 0;
    vertical-align: middle;
    accent-color: #00ABE4;
}

#replayBar #timeBack,
#replayBar #timeForward {
    width: 36px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(0, 171, 228, 0.5);
    border-radius: 6px;
    background: #fff;
    color: #00ABE4;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#replayBar #timeBack:hover,
#replayBar #timeForward:hover {
    background: #00ABE4;
    color: #fff;
}

#replayBar #timeDisplay {
    font-size: 14px;
    font-weight: 600;
    color: #0b3c5d;
    min-width: 44px;
    text-align: center;
}

#replayBar #liveModeBtn {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid #00ABE4;
    border-radius: 6px;
    background: #fff;
    color: #00ABE4;
    cursor: pointer;
}

#replayBar #liveModeBtn:hover {
    background: #00ABE4;
    color: #fff;
}

.replay-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: wait;
}
.replay-loading-overlay * {
    pointer-events: none;
}
.replay-loading-box {
    text-align: center;
    padding: 24px 32px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 171, 228, 0.2);
}
.replay-loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border: 3px solid rgba(0, 171, 228, 0.25);
    border-top-color: #00ABE4;
    border-radius: 50%;
    animation: replay-spin 0.8s linear infinite;
}
.replay-loading-text {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #0b3c5d;
}
@keyframes replay-spin {
    to { transform: rotate(360deg); }
}

/* Navigation links */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    background: rgba(0, 171, 228, 0.05);
    padding: 4px;
    border-radius: 8px;
}

.nav-link,
.nav-link:link,
.nav-link:visited,
.nav-link:hover,
.nav-link:active,
.nav-link:focus {
    text-decoration: none;
    border-bottom: none !important;
    outline: none !important;
}

.nav-link {
    padding: 8px 20px;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-link:hover:not(.active) {
    background: rgba(0, 171, 228, 0.08);
    color: #00ABE4;
}

.nav-link.active {
    background: linear-gradient(135deg, #00ABE4 0%, #0099cc 100%);
    color: #FFFFFF !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 171, 228, 0.3);
}

.nav-link.active:hover {
    background: linear-gradient(135deg, #0099cc 0%, #0088bb 100%) !important;
    color: #FFFFFF !important;
}


.day-picker {
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid rgba(0, 171, 228, 0.4);
    border-radius: 6px;
    background: #fff;
    color: #0b3c5d;
    cursor: pointer;
}
.day-picker:focus {
    outline: none;
    border-color: #00ABE4;
    box-shadow: 0 0 0 2px rgba(0, 171, 228, 0.2);
}
.date-time-bar-time-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}
.time-slider-label {
    font-size: 13px;
    font-weight: 600;
    color: #00ABE4;
    min-width: 58px;
}
.time-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #e2e8f0 0%, #00ABE4 100%);
    border-radius: 4px;
    cursor: pointer;
}
.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00ABE4;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
}
.time-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00ABE4;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
}
.date-time-bar-live-btn {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid #00ABE4;
    border-radius: 6px;
    background: #fff;
    color: #00ABE4;
    cursor: pointer;
    flex-shrink: 0;
}
.date-time-bar-live-btn:hover {
    background: #00ABE4;
    color: #fff;
}

.replay-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: 24px;
    padding-left: 24px;
    border-left: 1px solid rgba(0, 171, 228, 0.25);
}
.replay-controls .day-picker { margin: 0; }
.replay-controls .time-slider { min-width: 120px; }
.replay-controls .time-slider-label { min-width: 40px; }

.filters-section {
    background: transparent;
    padding: 0;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: flex-start;
    align-items: flex-start;
}

.filters {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    width: auto;
    min-width: 150px;
}

.filters .filter-group {
    margin-bottom: 8px;
}

.filters .filter-group:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: flex-start;
    justify-content: flex-start;
    width: 100%;
    min-width: 150px;
}

.filter-group label {
    font-size: 10px;
    color: #000;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #000;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.3s ease;
    background: #FFFFFF;
    width: 100%;
    color: #000;
    cursor: pointer;
    appearance: none;
    padding-right: 12px;
}

.filter-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #00ABE4;
    box-shadow: 0 0 0 2px rgba(0, 171, 228, 0.2);
}

/* Signal Type Select Styling */
.signal-type-select {
    font-weight: 500;
}

.signal-type-select option {
    padding: 8px;
    font-weight: 500;
}

.signal-type-select option[value=""] {
    color: #000;
}

.signal-type-select option[value="BUY"] {
    color: #27ae60;
    background-color: rgba(39, 174, 96, 0.1);
}

.signal-type-select option[value="SELL"] {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

/* Dynamic styling based on selected value */
.signal-type-select[data-selected="BUY"] {
    border-color: #27ae60;
    color: #27ae60;
    background-color: rgba(39, 174, 96, 0.05);
}

.signal-type-select[data-selected="BUY"]:focus {
    border-color: #27ae60;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

.signal-type-select[data-selected="SELL"] {
    border-color: #e74c3c;
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

.signal-type-select[data-selected="SELL"]:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

/* Autocomplete styling */
.ui-autocomplete {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #FFFFFF;
    border: 1px solid #00ABE4;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.ui-autocomplete .ui-menu-item {
    padding: 0;
    border: none;
}

.ui-autocomplete .ui-menu-item-wrapper {
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #000;
}

.ui-autocomplete .ui-menu-item-wrapper:hover,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active {
    background: #00ABE4;
    color: #FFFFFF;
    border-color: transparent;
}

.ui-autocomplete .ui-menu-item:last-child .ui-menu-item-wrapper {
    border-bottom: none;
}

.btn {
    padding: 8px 20px;
    background: #00ABE4;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    align-self: flex-start;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 171, 228, 0.3);
    height: fit-content;
    white-space: nowrap;
}

/* Filter Icon Button */
.filter-icon-btn {
    padding: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    border-radius: 6px;
}

.filter-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: #FFFFFF;
}

.btn:hover {
    background: #0099cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 171, 228, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Legacy stat-card kept for backward compatibility */
.stats { display: flex; gap: 0; min-width: 220px; flex-wrap: nowrap; }
.stat-card { display: none; }


.signals-table {
    background: #FFFFFF;
    border-radius: 0;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 0;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Dashboard (index): no extra min-height so footer sits after content, no big gap */
.dashboard-page .container {
    min-height: auto;
}

/* Sector scope & heatmap */
.sector-scope-section {
    padding: 12px 16px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.heatmap-section {
    padding: 8px 16px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 8px;
    clear: both;
}
.sector-scope-title {
    font-size: 18px;
    font-weight: 700;
    color: #0b3c5d;
    margin-bottom: 10px;
    letter-spacing: -0.2px;
}
.heatmap-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}
.sector-scope-chart {
    min-height: 200px;
    width: 100%;
    background: linear-gradient(135deg, #fafbfc 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 8px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
    border: 1px solid #e8ecf0;
}
.heatmap-container {
    width: 100%;
    background: #f5f5f5;
    border-radius: 8px;
    position: relative;
}
.heatmap-grid {
    margin: 0 auto;
    position: relative;
}
.hm-sector {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hm-sector-hdr {
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.hm-tile {
    transition: box-shadow 0.15s ease, outline 0.15s ease;
}
.hm-tile:active {
    transform: scale(0.98);
}
/* Sector scope D3 */
.sector-scope-svg .axis text {
    fill: #475569;
    font-size: 11px;
}
.sector-scope-svg .axis-y text {
    font-size: 12px;
    font-weight: 600;
    fill: #334155;
}
.sector-scope-svg .axis path,
.sector-scope-svg .axis line {
    stroke: #e2e8f0;
}
.sector-scope-svg .axis-x .tick line {
    stroke: #e2e8f0;
    stroke-dasharray: 3,3;
    opacity: 0.5;
}
.sector-scope-svg .zero-line {
    stroke: #334155;
    stroke-width: 1.5;
    stroke-dasharray: none;
    opacity: 0.4;
}
.sector-scope-svg .ss-bar {
    cursor: pointer;
    transition: filter 0.12s ease;
}
.sector-scope-svg .zone {
    pointer-events: none;
}
.sector-scope-svg .zone.zone-weakness {
    fill: rgba(254, 226, 226, 0.45);
}
.sector-scope-svg .zone.zone-support {
    fill: rgba(254, 249, 195, 0.35);
}
.sector-scope-svg .zone.zone-leadership {
    fill: rgba(220, 252, 231, 0.45);
}
.sector-scope-svg .zone-label {
    pointer-events: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.sector-scope-svg .zone-label-weak {
    fill: #dc2626;
}
.sector-scope-svg .zone-label-support {
    fill: #a16207;
}
.sector-scope-svg .zone-label-leaders {
    fill: #15803d;
}
.sector-scope-svg .ss-value-label {
    pointer-events: none;
    user-select: none;
}
.ss-summary-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 2px 0 8px;
    font-size: 15px;
    font-weight: 500;
    color: #475569;
    letter-spacing: 0.1px;
}
.ss-summary-positive {
    color: #15803d;
}
.ss-summary-positive strong {
    font-size: 18px;
    font-weight: 800;
    color: #16a34a;
}
.ss-summary-negative {
    color: #dc2626;
}
.ss-summary-negative strong {
    font-size: 18px;
    font-weight: 800;
    color: #ef4444;
}
.ss-summary-dot {
    color: #cbd5e1;
    font-size: 18px;
    line-height: 1;
}

/* D3 tooltips */
.d3-tooltip {
    position: absolute;
    z-index: 9999;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(6px);
    color: #f1f5f9;
    font-size: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    pointer-events: none;
    max-width: 260px;
    line-height: 1.5;
    display: none;
    overflow: hidden;
}
.d3-tooltip.heatmap-tooltip {
    position: fixed;
    pointer-events: none;
    padding: 8px 12px;
}
.d3-tooltip.sector-scope-tooltip {
    padding: 0;
}
.d3-tooltip strong {
    color: #fff;
}
.ss-tip-header {
    padding: 6px 12px 4px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    letter-spacing: 0.2px;
}
.ss-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 12px;
}
.ss-tip-row:last-child {
    padding-bottom: 6px;
}
.ss-tip-label {
    color: rgba(255,255,255,0.55);
    font-size: 11px;
}
.ss-tip-value {
    font-weight: 700;
    font-size: 13px;
}

.heatmap-container .no-data,
.sector-scope-chart .no-data {
    padding: 24px;
    text-align: center;
    color: #666;
}

#tableWrapper {
    min-height: 100px;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    flex: 1;
    height: 100%;
    padding: 12px;
    box-sizing: border-box;
}

/* Sector cards layout */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 18px;
    padding: 16px;
    padding-bottom: 80px;
    align-items: start;
}

.sector-card {
    --sector-card-height: 520px;
    --sector-header-height: 56px;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    width: 100%;
    height: var(--sector-card-height);
    display: flex;
    flex-direction: column;
    transition: box-shadow .3s ease, border-color .3s ease;
}
.sector-card-flash {
    animation: sectorFlash 1.5s ease;
}
@keyframes sectorFlash {
    0%   { box-shadow: 0 0 0 0 rgba(0,171,228,.6); border-color: #00ABE4; }
    20%  { box-shadow: 0 0 20px 4px rgba(0,171,228,.35); border-color: #00ABE4; }
    50%  { box-shadow: 0 0 8px 2px rgba(0,171,228,.2); border-color: #00ABE4; }
    100% { box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08); border-color: rgba(0,0,0,.05); }
}

.sector-card-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-height: var(--sector-header-height);
    height: var(--sector-header-height);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #F7FBFF;
    gap: 12px;
    overflow: hidden;
}

.sector-body {
    display: grid;
    grid-template-rows: auto 1fr;
    height: calc(var(--sector-card-height) - var(--sector-header-height));
    min-height: 0;
    overflow: hidden;
}

.sector-header-left {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.sector-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    flex-shrink: 0;
}

.sector-name {
    font-size: 13px;
    font-weight: 700;
    color: #0b3c5d;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
    display: inline-block;
    max-width: 100%;
}

.market-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.12);
    flex-shrink: 0;
}

.market-indicator.is-open {
    background: #27ae60;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.18);
}

.market-indicator.is-closed {
    background: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.18);
}

.market-status-text {
    font-size: 11px;
    font-weight: 600;
    color: #7a8b9a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap !important;
    flex-shrink: 0;
    display: inline-block;
}

.market-status-text.is-open {
    color: #1f8a4c;
}

.market-status-text.is-closed {
    color: #b03a2e;
}

.view-stats-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #0b3c5d;
    background: #eef6ff;
    border: 1px solid #cfe3ff;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.view-stats-btn:hover {
    background: #e2f0ff;
}

.view-stats-btn svg {
    display: block;
}

.trend-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: #ffffff;
}

.trend-badge.trend-up {
    background: #27ae60;
}

.trend-badge.trend-down {
    background: #e74c3c;
}

/* Symbol name as trend badge in sector cards */
.symbol-trend-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
}

.symbol-trend-badge .symbol-link,
.symbol-trend-badge a {
    color: #ffffff !important;
    text-decoration: none;
}

.symbol-trend-badge .symbol-link:hover,
.symbol-trend-badge a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

.symbol-trend-badge.trend-up {
    background: #27ae60;
}

.symbol-trend-badge.trend-down {
    background: #e74c3c;
}

.symbol-trend-badge.trend-neutral {
    background: #95a5a6;
}

.tp-score-link {
    color: #0b3c5d;
    text-decoration: none;
    font-weight: 600;
}

.tp-score-link:hover {
    text-decoration: underline;
}

.tp-score-charts-wrap {
    width: 100%;
    margin-bottom: 8px;
}

.tp-score-chart-toolbar {
    margin-bottom: 6px;
    padding: 4px 0;
}

.tp-score-chart-toolbar .chart-toggle-label {
    font-size: 13px;
    color: #0b3c5d;
    cursor: pointer;
    user-select: none;
}

.tp-score-chart-toolbar .chart-toggle-label input {
    margin-right: 6px;
    vertical-align: middle;
}

.tp-score-chart {
    width: 100%;
    height: calc(100vh - 200px);
    max-height: calc(100vh - 120px);
    min-height: 360px;
    padding: 10px 12px 12px 10px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fafbfc 0%, #ffffff 100%);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid #e8ecf0;
    overflow: hidden;
    position: relative;
}

.stats-page .tp-score-chart {
    height: calc(100vh - 220px);
    min-height: 320px;
    max-height: calc(100vh - 200px);
}

.chart-tooltip {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(6px);
    color: #ffffff;
    padding: 0;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    min-width: 140px;
    overflow: hidden;
}
.chart-tooltip-header {
    padding: 6px 12px 4px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    letter-spacing: 0.3px;
}
.chart-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 12px;
}
.chart-tooltip-row:last-child {
    padding-bottom: 6px;
}
.chart-tooltip-label {
    color: rgba(255,255,255,0.6);
    font-size: 11px;
}
.chart-tooltip-value {
    font-weight: 700;
    font-size: 13px;
}
.chart-tooltip-pct-up {
    color: #4ade80 !important;
}
.chart-tooltip-pct-down {
    color: #f87171 !important;
}
.chart-legend-group text {
    user-select: none;
}
.chart-axis-y-price .domain,
.chart-axis-y-price .tick line {
    stroke: #2563eb;
    stroke-opacity: 0.3;
}
.chart-axis-y-tp .domain,
.chart-axis-y-tp .tick line {
    stroke: #f59e0b;
    stroke-opacity: 0.3;
}

.chart-grid .tick line {
    stroke: rgba(0, 0, 0, 0.06);
    stroke-width: 1;
}
.chart-axis .domain {
    stroke: #cbd5e1;
}
.chart-axis .tick line {
    stroke: #cbd5e1;
}
.chart-axis .tick text {
    fill: #64748b;
    font-size: 11px;
}
.chart-axis-label {
    font-size: 11px;
    fill: #64748b;
}
.chart-cap-hint {
    font-size: 11px;
    fill: #64748b;
}
.stock-chart-svg .stock-line {
    transition: opacity 0.15s ease, stroke-width 0.15s ease;
}

.stock-label {
    pointer-events: none;
    transition: opacity 0.15s ease, font-size 0.15s ease;
}

.stats-toggle {
    display: inline-flex;
    gap: 0;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 3px;
}

.stats-toggle-top {
    margin: 8px 0 14px;
    text-align: center;
}
.stats-header-row .stats-toggle {
    margin: 0;
    flex-shrink: 0;
}

/* Stats page layout override */
.stats-page .container {
    padding-top: calc(var(--navbar-top-height) + var(--replay-bar-height));
}
/* Stocks page: no filter bar in header */
.stocks-page .container {
    padding-top: calc(var(--navbar-top-height) + var(--navbar-stats-height) + var(--replay-bar-height));
}
.stats-page .signals-table {
    position: static;
    top: auto;
    bottom: auto;
    box-shadow: none;
    margin-top: 0;
    padding-bottom: 80px; /* Space so table rows are not hidden behind fixed footer */
}

.stats-page .table-wrapper {
    padding-top: 0;
}
.stats-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    gap: 12px;
    flex-wrap: wrap;
}
.stats-page-title {
    font-size: 18px;
    font-weight: 700;
    color: #0b3c5d;
    padding: 0;
    margin: 0;
}
.stats-replay-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: #00ABE4;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
}

.stats-toggle .toggle-btn {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.1px;
}
.stats-toggle .toggle-btn:hover:not(.active) {
    color: #334155;
    background: rgba(0,0,0,0.04);
}
.stats-toggle .toggle-btn.active {
    background: #ffffff;
    color: #0b3c5d;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

/* Stocks page */
.stocks-page .signals-table {
    margin-top: 0;
    padding-bottom: 80px; /* Space so table rows are not hidden behind fixed footer */
}

.stocks-page .table-wrapper {
    padding: 4px 12px 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.stocks-page .table-wrapper .history-table-wrapper {
    flex: 1;
    min-height: 0;
}

.stocks-page .sector-table {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.stocks-page .sector-table th,
.stocks-page .sector-table td {
    padding: 10px 8px;
}

.stocks-page .sector-table tbody tr:hover {
    background: rgba(0, 171, 228, 0.06);
}

/* Sector names as tags in stocks table – pastel pill tags with white text */
.stocks-page .sector-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.stocks-page .sector-tag {
    display: inline-block;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    color: #fff;
    border: none;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    background: #7b8ba8;
}
.stocks-page .sector-tag--0 { background: #6b9b6b; }   /* light green */
.stocks-page .sector-tag--1 { background: #d47373; }   /* light red/pink */
.stocks-page .sector-tag--2 { background: #e09b5c; }   /* light orange */
.stocks-page .sector-tag--3 { background: #c9b24a; }   /* light yellow/gold */
.stocks-page .sector-tag--4 { background: #9b7bb8; }   /* light purple */
.stocks-page .sector-tag--5 { background: #5c9fd4; }   /* light blue */
.stocks-page .sector-tag--6 { background: #5ab8a8; }   /* teal */
.stocks-page .sector-tag--7 { background: #7b8ba8; }   /* muted blue */
.stocks-page .sector-tag:only-child {
    margin: 0;
}
/* Allow sector cell to show tags (override table td overflow/nowrap) */
.stocks-page .sector-table td.sector-cell {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    text-align: left;
    vertical-align: middle;
    min-width: 100px;
}
.stocks-page .sector-table th:nth-child(2) {
    min-width: 100px;
    text-align: left;
}

/* Stocks table: scroll container so sticky thead works; table header stays in flow, no overlap */
.stocks-page .history-table-wrapper[data-section="table"] {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.stocks-page .stocks-table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.stocks-page .stocks-table-scroll .sector-table.stocks-table {
    border-radius: 10px;
}
/* Sticky table header – stays at top of scroll area only, does not overlap body */
.stocks-page .sector-table.stocks-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #00ABE4 !important;
    color: #ffffff;
    box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.08);
}

/* Stocks page: left filter sidebar + main content layout (row, no overlap) */
.stocks-page .signals-table.stocks-page-with-filters {
    flex-direction: row;
    width: 100%;
    padding-top: 0;
    box-sizing: border-box;
}

.stocks-page-with-filters {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

.stocks-filters-sidebar {
    flex: 0 0 220px;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    background: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0 24px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
    transition: transform 0.25s ease;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    top: calc(var(--navbar-top-height) + var(--navbar-stats-height) + var(--replay-bar-height));
    max-height: calc(100vh - var(--navbar-top-height) - var(--navbar-stats-height) - var(--replay-bar-height));
    align-self: flex-start;
}

.stocks-filters-inner {
    padding: 0 12px 32px 24px;
    min-height: min-content;
}

.stocks-filters-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.stocks-filters-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: #0b3c5d;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.filter-section-title-row .filter-section-title {
    margin-bottom: 0;
}

.filter-sector-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.filter-actions-sep {
    color: rgba(0, 0, 0, 0.3);
}

.filter-link-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: #00ABE4;
    cursor: pointer;
    text-decoration: underline;
}

.filter-link-btn:hover {
    color: #0b3c5d;
}

.filter-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: none;
    color: #333;
    margin-bottom: 10px;
}

.filter-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.filter-options li {
    margin-bottom: 6px;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.filter-checkbox-label:hover {
    color: #0b3c5d;
}

.filter-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #00ABE4;
}

.filter-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.filter-radio-label:hover {
    color: #0b3c5d;
}

.filter-radio,
.filter-view .filter-radio {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #00ABE4;
}

.filter-section-view {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* TP Score range slider (dual-thumb) */
.filter-section-tp-range .filter-section-title {
    margin-bottom: 12px;
}

.tp-score-range-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-range-value {
    font-size: 12px;
    font-weight: 600;
    color: #0b3c5d;
    min-width: 28px;
    text-align: center;
}

.tp-score-range-track {
    position: relative;
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
}

.tp-score-range-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(0, 171, 228, 0.25);
    border-radius: 3px;
    pointer-events: none;
}

.tp-score-range-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: #00ABE4;
    border-radius: 3px;
    pointer-events: none;
    transition: left 0.05s ease, width 0.05s ease;
}

.tp-score-range-input {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 24px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.tp-score-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00ABE4;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.tp-score-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00ABE4;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.tp-score-range-input::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    background: transparent;
    height: 24px;
}

.tp-score-range-input::-moz-range-track {
    background: transparent;
    height: 24px;
}

.tp-score-range-input.tp-score-max {
    pointer-events: none;
    z-index: 2;
}

.tp-score-range-input.tp-score-max::-webkit-slider-thumb {
    pointer-events: auto;
}

.tp-score-range-input.tp-score-max::-moz-range-thumb {
    pointer-events: auto;
}

/* Sector & Stocks tree filter */
.filter-tree {
    margin-top: 6px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
}

.tree-node-sector {
    margin-bottom: 4px;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    cursor: default;
}

.tree-node-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    color: #555;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
}

.tree-node-toggle:hover {
    background: rgba(0, 171, 228, 0.15);
    color: #0b3c5d;
}

.tree-node-label-wrap {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.tree-node-sector.collapsed .tree-node-children {
    display: none;
}

.tree-node-children {
    list-style: none;
    margin: 4px 0 4px 18px;
    padding: 0;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding-left: 8px;
}

.tree-node-stock {
    margin-bottom: 4px;
}

.tree-node-stock .filter-checkbox-label {
    padding-left: 0;
}

.stocks-filter-clear-btn {
    margin: 0;
    padding: 3px 10px;
    font-size: 11px;
    background: #f0f0f0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    white-space: nowrap;
}

.stocks-filter-clear-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.stocks-main-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.stocks-main-content .table-wrapper {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.stocks-main-content .table-wrapper .tp-score-charts-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stocks-main-content .table-wrapper .tp-score-charts-wrap .tp-score-chart {
    flex: 1;
    min-height: 320px;
    height: 100%;
}

/* Ensure consistent font size for sector table cells */
.sector-table td,
.sector-table td:nth-child(2),
.sector-table td:nth-child(3),
.sector-table td:nth-child(4),
.sector-table td:nth-child(5),
.sector-table td:nth-child(6) {
    font-size: 12px;
    font-family: inherit;
}

.sector-search {
    display: flex;
    justify-content: flex-end;
}

.sector-search input {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #FFFFFF;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    width: 140px;
}

.sector-search input:focus {
    outline: none;
    border-color: #00ABE4;
    box-shadow: 0 0 0 2px rgba(0, 171, 228, 0.15);
}

.sector-metrics {
    padding: 12px 16px 4px;
}

.sector-metrics-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #516173;
    margin-bottom: 8px;
}

.sector-up {
    color: #1B7F5A;
    font-weight: 600;
}

.sector-down {
    color: #C0392B;
    font-weight: 600;
}

.sector-bar {
    position: relative;
    height: 8px;
    background: rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    overflow: hidden;
    display: flex;
}

.sector-bar-up {
    background: linear-gradient(90deg, #27ae60, #1abc9c);
    height: 100%;
}

.sector-bar-down {
    background: linear-gradient(90deg, #e67e22, #e74c3c);
    height: 100%;
}

.sector-table-wrapper {
    overflow-x: auto;
    padding: 0 6px 12px;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

.sector-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.sector-table thead {
    background: #00ABE4;
}

.sector-table th {
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    padding: 8px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sector-table th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 18px;
}

.sector-table th.sortable::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #000000;
}

.sector-table th.sortable[data-sort-dir="asc"]::after {
    content: '▲';
}

.sector-table th.sortable[data-sort-dir="desc"]::after {
    content: '▼';
}

.sector-table td {
    font-size: 12px;
    padding: 8px 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sector-table th:first-child,
.sector-table td:first-child {
    min-width: 130px;
}

.sector-table td:first-child {
    text-align: left;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.sector-table tbody tr:hover {
    background: rgba(0, 171, 228, 0.08);
}

.sector-card table {
    margin: 0;
}

.market-closed-banner {
    margin: 6px 8px 14px;
    padding: 10px 14px;
    background: #fff3cd;
    border: 1px solid #ffe08a;
    color: #7a5d00;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.sector-table .sector-empty-row td {
    text-align: center;
    color: #8a97a4;
    font-style: italic;
    padding: 16px 8px;
}

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

thead {
    background: #00ABE4;
    color: #FFFFFF;
    position: sticky;
    top: 0;
    z-index: 100;
}

thead tr:hover {
    background: #00ABE4 !important;
}

thead tr:hover th {
    color: #FFFFFF;
}

th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.3px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    text-overflow: ellipsis;
}

tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

tbody tr:nth-child(even) {
    background-color: #E9F1FA;
}

tbody tr:hover {
    background: rgba(0, 171, 228, 0.1) !important;
    transform: scale(1.001);
}


tbody tr.inactive-row {
    opacity: 0.6;
}

tbody tr.inactive-row:hover {
    opacity: 0.8;
}

td {
    padding: 10px 8px;
    font-size: 14px;
    color: #000;
    vertical-align: middle;
    font-weight: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td:nth-child(1) { text-align: left; padding-left: 10px; } /* Symbol - left align */
td:nth-child(2) { text-align: center; } /* Signal */
td:nth-child(3) { text-align: center; } /* Time */
td:nth-child(4) { text-align: center; } /* Price */

td strong {
    font-weight: 500;
}

.signal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    width: 28px;
    height: 28px;
}

.signal-badge svg {
    width: 18px;
    height: 18px;
    stroke: #FFFFFF;
    display: block;
}

.signal-badge.buy {
    background: #27ae60;
    color: #FFFFFF;
}

.signal-badge.sell {
    background: #e74c3c;
    color: #FFFFFF;
}

.signal-badge.both {
    background: linear-gradient(135deg, #27ae60 0%, #e74c3c 100%);
    color: #FFFFFF;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.condition-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 700;
    background: #27ae60;
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 32px;
    height: 32px;
    text-align: center;
    line-height: 1;
    transition: all 0.2s ease;
}

.condition-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.condition-badge.false {
    background: #e74c3c;
    color: #FFFFFF;
}

.condition-cell {
    text-align: center;
    padding: 8px 4px !important;
}


.condition-cell .condition-badge {
    display: inline-flex;
    width: 32px;
    height: 32px;
    text-align: center;
    margin: 0 auto;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: #27ae60;
    color: #FFFFFF;
}

.status-badge.inactive {
    background: #e74c3c;
    color: #FFFFFF;
}

/* Notes Cell and Badge */
.notes-cell {
    padding: 10px 8px;
    text-align: left;
    max-width: 300px;
}

.notes-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(0, 171, 228, 0.1);
    border-left: 3px solid #00ABE4;
    border-radius: 4px;
    font-size: 12px;
    color: #000;
    cursor: help;
    word-wrap: break-word;
    max-width: 100%;
}

.notes-empty {
    color: #999;
    font-style: italic;
}

/* Add Note Button */
.add-note-btn {
    background: transparent;
    border: 1px solid #00ABE4;
    color: #00ABE4;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.add-note-btn:hover {
    background: #00ABE4;
    color: #FFFFFF;
    transform: scale(1.05);
}

/* Note Modal */
.note-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
    pointer-events: none;
}

.note-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.note-modal-content {
    background-color: #FFFFFF;
    margin: auto;
    border-radius: 8px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.note-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #00ABE4;
    color: #FFFFFF;
    border-radius: 8px 8px 0 0;
}

.note-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.note-modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    font-weight: 300;
    color: #FFFFFF;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.note-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.note-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #000;
    font-size: 14px;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: #00ABE4;
    box-shadow: 0 0 0 2px rgba(0, 171, 228, 0.2);
}

.note-info {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: #f0f0f0;
    color: #000;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-save {
    background: #00ABE4;
    color: #FFFFFF;
}

.btn-save:hover {
    background: #0099cc;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #000;
}

.no-data p {
    font-size: 15px;
    color: #000;
}

a {
    transition: all 0.2s ease;
    color: #00ABE4;
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    color: #0099cc !important;
    text-decoration: underline !important;
}

/* Override for navigation links - no underline */
a.nav-link:hover,
a.nav-link:active,
a.nav-link:focus,
a.nav-link:visited {
    text-decoration: none !important;
}

/* Override for symbol links - keep them black */
td:first-child a,
td:first-child a:hover {
    color: #000 !important;
}

.loading {
    text-align: center;
    padding: 30px 20px;
    color: #000;
    font-size: 15px;
    font-weight: 500;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Price styling */
td:nth-child(4) {
    font-weight: normal;
    color: #000;
    font-size: 14px;
}

/* Time styling */
td:nth-child(3) {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: normal;
    color: #000;
    font-size: 14px;
}

/* Symbol link styling */
td:first-child a {
    font-size: 14px;
    font-weight: normal;
    color: #000;
    position: relative;
}

td:first-child a:hover {
    color: #000 !important;
    text-decoration: underline;
}


/* History Button Styles */
.action-cell {
    text-align: center;
    padding: 8px 4px !important;
}

.history-btn {
    background: #00ABE4;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #FFFFFF;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 171, 228, 0.3);
}

.history-btn:hover {
    background: #0099cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 171, 228, 0.4);
}

.history-btn:active {
    transform: translateY(0);
}

.history-btn svg {
    width: 18px;
    height: 18px;
}

/* History Modal Styles */
.history-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
    pointer-events: none;
}

.history-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.history-modal-content {
    background-color: #FFFFFF;
    margin: auto;
    border-radius: 8px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.history-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #00ABE4;
    color: #FFFFFF;
    border-radius: 8px 8px 0 0;
}

.history-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.history-modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    font-weight: 300;
    color: #FFFFFF;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.history-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.history-table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.history-table thead {
    background: #00ABE4;
    color: #FFFFFF;
    position: sticky;
    top: 0;
    z-index: 10;
}

.history-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.history-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.history-table tbody tr:nth-child(even) {
    background-color: #E9F1FA;
}

.history-table tbody tr:hover {
    background: rgba(0, 171, 228, 0.1) !important;
}


.history-table td {
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.history-table td:first-child {
    text-align: left;
    padding-left: 12px;
}

.history-table td strong {
    font-weight: 600;
    color: #000;
}

/* Mobile responsive for history modal */
@media (max-width: 768px) {
    .history-modal-content {
        width: 98%;
        max-height: 95vh;
    }
    
    .history-modal-header {
        padding: 15px 20px;
    }
    
    .history-modal-header h2 {
        font-size: 18px;
    }
    
    .history-modal-body {
        padding: 15px;
    }
    
    .history-table {
        font-size: 11px;
    }
    
    .history-table th,
    .history-table td {
        padding: 8px 4px;
    }
}

.chart-tooltip-inner {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.main-footer {
    background: #FFFFFF;
    padding: 15px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.footer-content p {
    margin: 0;
    font-size: 12px;
    color: #000;
    font-weight: normal;
}

.footer-content .footer-subtitle {
    font-size: 11px;
    color: #00ABE4;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .navbar-top { padding: 0 16px; }
    .navbar-stats { padding: 0 16px; gap: 12px; }
    #replayBar { padding: 8px 16px; }
    .dashboard-filter-bar { padding: 6px 16px; }
}

@media (max-width: 768px) {
    .navbar-top {
        padding: 0 12px;
        height: auto;
        min-height: 44px;
        flex-wrap: wrap;
        gap: 0;
    }
    .navbar-brand { font-size: 17px; margin-right: 16px; }
    .navbar-brand::before { font-size: 18px; }
    .main-nav { gap: 2px; }
    .nav-link { padding: 6px 12px; font-size: 12px; }
    .navbar-right { margin-left: auto; }
    .navbar-auth-link { font-size: 12px; padding: 5px 12px; }
    .navbar-stats { padding: 0 12px; gap: 10px; height: auto; min-height: 32px; flex-wrap: wrap; }
    .stat-pill { font-size: 12px; }
    .stat-pill-value { font-size: 13px; }
    #replayBar { padding: 6px 12px; }
    .dashboard-filter-bar { padding: 5px 12px; gap: 10px; }
    .signal-type-select {
        font-size: 14px;
        padding: 10px 35px 10px 12px;
    }
}

@media (max-width: 480px) {
    .navbar-top { padding: 0 10px; }
    .navbar-brand { font-size: 15px; margin-right: 8px; }
    .navbar-brand::before { font-size: 16px; }
    .nav-link { padding: 5px 10px; font-size: 11px; }
    .navbar-stats { padding: 0 10px; gap: 8px; }
    .stat-pill-label { font-size: 10px; }
    .stat-pill-value { font-size: 12px; }
    .navbar-auth-link { font-size: 11px; padding: 4px 10px; }
    
    .signal-type-select {
        font-size: 13px;
        padding: 9px 32px 9px 10px;
    }
    
    .filter-group label {
        font-size: 9px;
    }
}

.symbol-link {
    cursor: pointer;
}

/* ========== Responsive: Stocks page (filter sidebar + main) ========== */
@media (max-width: 992px) {
    /* Allow page to scroll on mobile so results are never clipped */
    .stocks-page .container {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    .stocks-page .signals-table.stocks-page-with-filters {
        position: static;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        height: auto;
        min-height: 0;
        margin-top: 90px;
        margin-bottom: 24px;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }
    .stocks-page-with-filters {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow: visible;
        min-height: 0;
    }
    .stocks-filters-sidebar {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        max-height: 55vh;
        overflow-y: auto;
        overflow-x: hidden;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding: 12px 16px 24px;
    }
    .stocks-main-content {
        min-width: 0;
        min-height: 320px;
        flex: 1 1 auto;
        flex-basis: auto;
        overflow: visible;
        display: block;
    }
    .stocks-main-content .table-wrapper {
        min-height: 320px;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    .stocks-page .sector-table.stocks-table {
        font-size: 12px;
    }
    .stocks-page .sector-table.stocks-table th,
    .stocks-page .sector-table.stocks-table td {
        padding: 8px 6px;
    }
    .tp-score-chart {
        min-height: 280px;
        height: 320px;
    }
}

@media (max-width: 768px) {
    .stocks-page .signals-table.stocks-page-with-filters {
        margin-top: 200px;
    }
    .stocks-filters-sidebar {
        max-height: 50vh;
        padding: 10px 12px 24px;
    }
    .filter-section-title-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-sector-actions {
        margin-top: 4px;
    }
    .sector-grid {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }
    .sector-card {
        --sector-card-height: auto;
        min-height: 320px;
        height: auto;
    }
    .sector-body {
        height: auto;
        min-height: 280px;
    }
}

@media (max-width: 480px) {
    .stocks-page .signals-table.stocks-page-with-filters {
        margin-top: 200px;
    }
    .stocks-filters-sidebar {
        max-height: 48vh;
        padding: 8px 10px 24px;
    }
    .table-wrapper {
        padding: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sector-table {
        min-width: 500px;
    }
    .stocks-page .sector-table.stocks-table {
        font-size: 11px;
    }
    .stocks-page .sector-table.stocks-table th,
    .stocks-page .sector-table.stocks-table td {
        padding: 6px 4px;
    }
}

/* ========== Responsive: Tables and content overflow ========== */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sector-table {
        min-width: 400px;
    }
}

@media (max-width: 480px) {
    .sector-grid {
        padding: 8px;
    }
    .main-footer {
        padding: 10px 12px;
    }
    .footer-content p {
        font-size: 11px;
    }
}

/* ========== Kite Quotes page ========== */
.kite-page .kite-content {
    margin-top: 90px;
    padding: 24px 24px 32px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.kite-page .kite-intro {
    font-size: 14px;
    color: #516173;
    margin-bottom: 24px;
    line-height: 1.5;
}

.kite-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 20px 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.kite-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: #0b3c5d;
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 171, 228, 0.2);
}

.kite-card p {
    font-size: 13px;
    color: #516173;
    margin: 0 0 14px 0;
    line-height: 1.45;
}

.kite-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.kite-alert.error {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid rgba(192, 57, 43, 0.3);
}

.kite-alert.success {
    background: #e8f8f0;
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.kite-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-bottom: 12px;
}

.kite-form-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #0b3c5d;
}

.kite-form-row input[type="text"],
.kite-form-row input[type="password"] {
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 13px;
    min-width: 200px;
    transition: border-color 0.2s;
}

.kite-form-row input:focus {
    outline: none;
    border-color: #00ABE4;
    box-shadow: 0 0 0 2px rgba(0, 171, 228, 0.15);
}

.kite-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kite-btn-primary {
    background: #00ABE4;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 171, 228, 0.35);
}

.kite-btn-primary:hover:not(:disabled) {
    background: #0099cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 171, 228, 0.4);
}

.kite-btn-primary:disabled {
    background: #aaa;
    cursor: not-allowed;
    transform: none;
}

.kite-btn-secondary {
    background: #f0f4f8;
    color: #0b3c5d;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.kite-btn-secondary:hover {
    background: #e4eaf0;
}

.kite-btn-danger {
    background: #fff;
    color: #c0392b;
    border: 1px solid rgba(192, 57, 43, 0.4);
    padding: 6px 12px;
    font-size: 12px;
}

.kite-btn-danger:hover {
    background: #fde8e8;
}

.kite-refresh-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.kite-refresh-bar .kite-btn-primary {
    padding: 12px 24px;
    font-size: 14px;
}

#refreshStatus {
    font-size: 13px;
    color: #516173;
}

#refreshStatus.loading {
    color: #00ABE4;
    font-weight: 500;
}

.kite-page .sector-table {
    max-width: 100%;
}

.kite-page .sector-table th,
.kite-page .sector-table td {
    padding: 10px 12px;
}

.kite-empty {
    color: #516173;
    font-size: 13px;
    padding: 12px 0;
}

/* ===== Login Page ===== */
body.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-top: 0 !important;
}
.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
    padding: 40px 36px 36px;
    text-align: center;
}
.login-brand {
    display: inline-block;
    font-size: 26px;
    font-weight: 800;
    color: #00ABE4;
    text-decoration: none;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.login-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}
.login-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 28px;
}
.login-alert {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    text-align: left;
}
.login-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.login-alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.login-field {
    text-align: left;
    margin-bottom: 18px;
}
.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}
.login-field input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #1e293b;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.login-field input:focus {
    border-color: #00ABE4;
    box-shadow: 0 0 0 3px rgba(0,171,228,.15);
    background: #fff;
}
.login-field input::placeholder { color: #94a3b8; }
.login-password-wrap {
    position: relative;
}
.login-password-wrap input { padding-right: 42px; }
.login-toggle-pw {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 2px;
    line-height: 0;
}
.login-toggle-pw:hover { color: #64748b; }
.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #00ABE4;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}
.login-btn:hover { background: #0099cc; }
.login-btn:active { transform: scale(.98); }
.login-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
}
.login-btn-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: login-spin .7s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
    .login-card { padding: 28px 20px 24px; }
    .login-wrapper { padding: 16px; }
}

/* Navbar user menu (logged-in state) */
.navbar-user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}
.navbar-logout-btn {
    font-size: 12px;
    font-weight: 600;
    color: #ef4444;
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    transition: all .2s ease;
    cursor: pointer;
    background: none;
}
.navbar-logout-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* ── Dashboard Filter Bar (inside fixed header) ─── */
.dashboard-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    height: var(--filter-bar-height);
    box-sizing: border-box;
}
.df-select, .df-input {
    font-size: 13px;
    padding: 4px 10px;
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}
.df-select:focus, .df-input:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,.12); }
.df-input { width: 150px; }
.df-checkbox-label { font-size: 13px; color: #334155; display: flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.df-checkbox-label input[type="checkbox"] { accent-color: #6366f1; width: 15px; height: 15px; cursor: pointer; }
.df-clear-btn {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 14px;
    height: 28px;
    box-sizing: border-box;
    cursor: pointer;
    transition: all .2s;
    margin-left: auto;
}
.df-clear-btn:hover { color: #ef4444; border-color: #fca5a5; background: #fef2f2; }
