:root {
    --bg-main: #0b0c0d;
    --bg-card: #111316;
    --bg-sub: #181a1f;
    --bg-panel: #14161a;
    --border-color: #272b31;
    --border-soft: #1b1f25;
    --text-main: #f3fbff;
    --text-title: #f4f6fa;
    --text-muted: #d4e3ec;
    
    /* 莫兰迪低饱和度状态色带 */
    --color-up-dark: #205c31;      /* 80-100% 满仓 🟢 */
    --color-warn: #8a6a1c;         /* 50% 轻仓 🟡 */
    --color-blue-light: #2b5a8f;   /* 30% 控仓 🔵 */
    --color-down-dark: #631717;    /* 0% 熔断 🔴 */
    
    /* 界面常规红绿 */
    --color-green: #2ea043;
    --color-red: #f85149;
    --color-blue: #58a6ff;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: Consolas, Monaco, "Courier New", monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px 12px 12px;
}

/* Header Header Section */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px 10px 8px;
    border-bottom: 1px solid #1b1e23;
    margin-bottom: 10px;
}

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

.wolf-icon {
    font-size: 20px;
}

.logo-section h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: 0;
}

.logo-section .badge {
    background-color: var(--bg-sub);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.view-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.view-switcher {
    display: flex;
    background-color: var(--bg-sub);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px;
}

.switch-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.switch-btn:hover {
    color: var(--text-title);
}

.switch-btn.active {
    background-color: var(--bg-card);
    color: var(--color-blue);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.esc-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

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

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator.live {
    background-color: var(--color-green);
    box-shadow: 0 0 6px var(--color-green);
}

.date-text {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.date-text.stale {
    color: #f3c969;
}

/* Main Main Section */
.main-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 376px;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

/* Left Heatmap Panel */
.left-panel {
    background-color: #0d0f12;
    border: 1px solid #252a31;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 3px;
    position: relative;
}

#heatmap-container {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.heatmap-empty {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f8fafc;
    font-weight: 800;
    letter-spacing: 0;
    background: #111418;
    border: 1px solid rgba(148, 163, 184, 0.24);
}

#heatmap-container.stock-custom-mode > div:not(.custom-stock-heatmap) {
    opacity: 0;
    pointer-events: none;
}

.custom-stock-heatmap {
    position: absolute;
    inset: 0;
    background: #0b0d0f;
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.custom-stock-heatmap.is-panning {
    cursor: grabbing;
}

.custom-stock-zoom-wrapper {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.custom-stock-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    min-width: 1320px;
    min-height: 720px;
}

.custom-industry-box {
    position: absolute;
    overflow: hidden;
    border-radius: 3px;
    background: #101216;
}

.custom-industry-shell {
    position: absolute;
    inset: 0;
    border-radius: 3px;
    overflow: hidden;
    background: #101216;
    border: 1px solid #20262d;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.custom-industry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 7px;
    background: rgba(15, 17, 20, 0.94);
    color: #b7bec8;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-industry-title {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.custom-industry-change {
    flex: 0 0 auto;
    color: #8e98a6;
    font-family: var(--font-mono);
    font-size: 12px;
}

.custom-industry-body {
    position: relative;
    width: 100%;
    background: #0b0d0f;
    overflow: hidden;
}

.custom-industry-summary {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    text-align: center;
    color: #f1f2f6;
    background: transparent;
}

.custom-industry-summary .summary-name {
    max-width: 100%;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-industry-summary .summary-change {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 800;
}

.custom-industry-summary .summary-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #9ca3af;
}

.custom-industry-summary.compact .summary-name {
    font-size: 13px;
}

.custom-industry-summary.compact .summary-change {
    font-size: 12px;
}

.custom-industry-summary.compact .summary-meta {
    display: none;
}

.custom-industry-summary.tiny {
    padding: 3px;
    gap: 2px;
}

.custom-industry-summary.tiny .summary-name {
    font-size: 10px;
}

.custom-industry-summary.tiny .summary-change {
    display: none;
}

.custom-stock-svg {
    display: block;
    width: 100%;
    height: 100%;
    background: #0b0d0f;
}

.custom-stock-link {
    cursor: pointer;
}

.custom-stock-rect {
    transition: filter 0.12s ease, stroke 0.12s ease, stroke-width 0.12s ease;
    vector-effect: non-scaling-stroke;
}

.custom-stock-link:hover .custom-stock-rect {
    filter: brightness(1.28);
    stroke: rgba(227, 228, 229, 0.72);
    stroke-width: 1.4;
}

.custom-stock-label {
    pointer-events: none;
    fill: #ffffff;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: var(--font-sans);
    font-weight: 750;
}

.custom-stock-label .ticker {
    font-size: 14px;
}

.custom-stock-label .change {
    font-size: 11px;
    fill: #c8d0dc;
    font-weight: 600;
}

.custom-stock-tooltip {
    position: absolute;
    z-index: 20;
    min-width: 220px;
    max-width: 280px;
    padding: 10px 12px;
    border: 1px solid #2b2d33;
    border-radius: 4px;
    background: rgba(18, 19, 22, 0.96);
    color: #d1d2d6;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 4px, 0);
    transition: opacity 0.1s ease, transform 0.1s ease;
    font-size: 12px;
}

.custom-stock-tooltip.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.custom-stock-tooltip .tip-title {
    color: #f1f2f6;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 4px;
}

.custom-stock-tooltip .tip-sub {
    color: #8c95a3;
    margin-bottom: 8px;
}

.custom-stock-tooltip .tip-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
}

.custom-stock-tooltip .tip-label {
    color: #72767e;
}

.custom-stock-tooltip .tip-value {
    color: #d1d2d6;
    text-align: right;
    font-family: var(--font-mono);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 7px 0 3px 0;
    border-top: 1px solid #1e232a;
    font-size: 11px;
    color: var(--text-muted);
}

.legend-title {
    font-weight: 500;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.border-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background-color: #111111;
    display: inline-block;
}

.color-dot.green-dark { background-color: var(--color-up-dark); }
.color-dot.flat-dark { background-color: #000000; border: 1px solid #3a3a3a; }
.color-dot.yellow-warn { background-color: var(--color-warn); }
.color-dot.blue-light { background-color: var(--color-blue-light); }
.color-dot.red-dark { background-color: var(--color-down-dark); }
.border-dot.border-full { border: 3px solid var(--color-up-dark); }
.border-dot.border-half { border: 3px solid var(--color-warn); }
.border-dot.border-low { border: 3px solid var(--color-blue-light); }
.border-dot.border-zero { border: 3px solid var(--color-down-dark); }

/* Right Detail Panel */
.right-panel {
    background-color: #0f1114;
    border: 1px solid #252a31;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    position: relative;
    overflow-y: auto;
    min-height: 0;
}

/* Scrollbar Style */
.right-panel::-webkit-scrollbar {
    width: 4px;
}
.right-panel::-webkit-scrollbar-track {
    background: transparent;
}
.right-panel::-webkit-scrollbar-thumb {
    background: var(--bg-sub);
    border-radius: 2px;
}
.right-panel::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 6, 6, 0.85);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Panel Cards */
.card {
    background-color: var(--bg-panel);
    border: 1px solid #252a31;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    color: #f4f7fb;
    margin-bottom: 10px;
    border-left: 2px solid #3b82f6;
    padding-left: 7px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chart-sub-title {
    font-size: 9px;
    color: #9aa3af;
    font-family: var(--font-mono);
    margin-left: auto;
}

.chart-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid #2a3039;
    border-radius: 5px;
    background: #101216;
}

.chart-mode-btn {
    min-width: 34px;
    height: 20px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #8f98a5;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.chart-mode-btn:hover {
    color: #f4f7fb;
}

.chart-mode-btn.active {
    background: #1d232c;
    color: #dbeafe;
}

/* Quote Card Style */
.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #242932;
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quote-symbol {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #9aa3af;
}

.quote-name {
    font-size: 14px;
    font-weight: 700;
    color: #f7f8fb;
}

.quote-price-group {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quote-price {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: #f7f8fb;
}

.quote-change {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.quote-change.up { color: var(--color-green); }
.quote-change.down { color: var(--color-red); }

.quote-grid {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 8px;
}

.grid-item {
    background-color: #101216;
    border: 1px solid #242a33;
    padding: 6px 4px;
    border-radius: 2px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.grid-label {
    font-size: 9px;
    color: #8f98a5;
}

.grid-value {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: #f3f6fb;
}

.grid-value.up { color: var(--color-green); }
.grid-value.down { color: var(--color-red); }

/* Micro Candlestick Chart */
#mini-kline-container {
    height: 160px;
    width: 100%;
}

/* Components Table Section */
.table-card {
    flex: 1;
    min-height: 0;
}

.table-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

th {
    position: sticky;
    top: 0;
    background-color: var(--bg-panel);
    color: #9aa3af;
    font-weight: 500;
    text-align: left;
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

td {
    padding: 6px 6px;
    border-bottom: 1px solid #222831;
    color: #eef2f7;
    font-family: var(--font-sans);
}

tr:hover {
    background-color: #191d23;
}

.sym-td {
    font-family: var(--font-mono);
    font-weight: 500;
}

.name-td {
    color: #d2d8e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price-td {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 600;
}

.change-td {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 700;
}

.change-td.up { color: var(--color-green); }
.change-td.down { color: var(--color-red); }

/* Component Row Custom Style (ETF Badge) */
.etf-badge {
    background-color: rgba(88, 166, 255, 0.15);
    border: 1px solid var(--color-blue);
    color: var(--color-blue);
    padding: 0px 4px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: 700;
    margin-left: 4px;
    display: inline-block;
    vertical-align: middle;
}

/* Referee status box styling */
.referee-status-box {
    background-color: #101216;
    border: 1px solid #252b35;
    border-radius: 6px;
    padding: 8px 9px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.referee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.referee-label {
    font-size: 11px;
    color: #9aa3af;
}

.referee-val {
    font-size: 11px;
    font-weight: 700;
    color: #f4f7fb;
    font-family: var(--font-mono);
}

#referee-ceiling {
    color: #dbeafe;
    background-color: rgba(59, 130, 246, 0.18);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(96, 165, 250, 0.38);
}

#referee-signals {
    font-size: 10px;
    color: #eebbc3;
}

.up { color: var(--color-green) !important; }

.down { color: var(--color-red) !important; }

.signal-tag {
    display: inline-block;
    margin: 1px 0 1px 5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.24);
    color: #f4f7fb;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
}
