/* 策略看板样式（方块导航、工具栏、子页签、行业列表、图表卡片） */
:root {
    --blue: #2a78d6;
    --blue-bg: #eaf2fd;
    --line: #dcdcd8;
    --ink: #1f1f1d;
    --muted: #6b6b66;
    --bg: #f6f6f4;
    --hover: #f1f1ef;
}

* { box-sizing: border-box; }

html { height: 100%; overflow: hidden; }

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
    font-size: 14px;
}

/* 顶部导航 / 工具栏 / 子页签：白底横条 */
.bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.nav, .tabs { flex-wrap: nowrap; overflow-x: auto; }
.tabs { padding-top: 8px; padding-bottom: 8px; }

/* 方块按钮：导航与子页签共用 */
.tile {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tile:hover { border-color: var(--blue); }
.tile.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.tabs .tile { padding: 4px 14px; font-weight: 500; }

/* 工具栏（字号比正文小一号） */
.toolbar { flex-wrap: wrap; row-gap: 8px; padding-top: 6px; padding-bottom: 6px; font-size: 12px; }
.toolbar .name { font-weight: 700; margin-right: 8px; }
.toolbar .label { color: var(--muted); }
.toolbar .fixed { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--hover); }
.toolbar select, .toolbar input[type=date] {
    font: inherit;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}
.toolbar .status { margin-left: auto; color: var(--muted); white-space: nowrap; }
.toolbar .logout {
    font: inherit;
    padding: 3px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
}
.toolbar .logout:hover { border-color: var(--blue); color: var(--blue); }

/* 看板区 */
/* 顶部三行保持固定，仅下方看板区滚动；min-height 允许其缩到窗口剩余高度。 */
.board-root { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 24px; }
.note { color: #b05c00; margin: 6px 0 0; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }

.layout-industry { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 6px; }
.chart-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* 左侧行业列表：不参与行高计算（contain: size），被拉伸到与右列 5 张图等高 */
.ind-panel {
    display: flex;
    flex-direction: column;
    contain: size;
    min-height: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.ind-search {
    margin: 8px;
    padding: 5px 8px;
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.ind-list { list-style: none; margin: 0; padding: 0 4px 8px; overflow-y: auto; flex: 1; }
.ind-list li { padding: 5px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.ind-list li:hover { background: var(--hover); }
.ind-list li.active { background: var(--blue-bg); color: var(--blue); font-weight: 600; }
.ind-list .rank {
    display: inline-block;
    min-width: 2.2em;
    margin-right: 8px;
    color: var(--muted);
    font-family: Consolas, "SF Mono", monospace;
    font-size: 12px;
    font-weight: 400;
    text-align: right;
}
.ind-list li.active .rank { color: var(--blue); }

/* 图表卡片：居中标题，下方绘图区（Plotly 需要容器有确定高度） */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 330px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.card-title {
    padding: 8px 12px 0;
    text-align: center;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-plot { flex: 1; min-height: 0; }
/* 图表区鼠标：Plotly 默认十字，改为普通箭头；在走势线上（.on-line）显示小手指 */
.card-plot .nsewdrag, .card-plot .draglayer .drag { cursor: default !important; }
.card-plot .nsewdrag.on-line { cursor: pointer !important; }
.card-wide { height: 340px; }
.card-tall { height: 400px; margin-bottom: 6px; }

/* 看板内切换按钮行（样式同 .tile） */
.switch-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.switch-row .tile { padding: 4px 14px; font-weight: 500; }

/* 引力水位：切换行 + 两张图，每张图高度由 JS 按窗口剩余高度平分 */
.wl-layout { display: flex; flex-direction: column; gap: 6px; }
.wl-layout .switch-row { margin-bottom: 0; }
/* 多列网格（宽基引力 2×2），行高同样由 JS 平分 */
.wl-grid { display: grid; grid-template-columns: repeat(var(--wl-columns, 2), minmax(0, 1fr)); gap: 6px; }
/* 左侧纵向切换列表 + 右侧图表（列表高度随右侧图表，超出时滚动）；紧凑布局：外边距、图间距更小 */
.board-root:has(.wl-side) { padding: 3px 3px 2px; }
.wl-side { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 2px; }
.wl-side .card-title { padding-top: 6px; }
.wl-side .wl-grid { gap: 2px; }
.wl-side .ind-list { padding-top: 6px; }
.wl-side .ind-list li { padding: 5px 10px; }

/* 紧凑排版（中证1000-日线加速度）：收紧看板区四周灰边、卡片间距与标题留白，图表更大 */
.board-root:has(.wl-layout.dense) { padding: 3px 3px 2px; }
.wl-layout.dense { gap: 3px; }
.wl-layout.dense .wl-grid { gap: 3px; }
.wl-layout.dense .card-title { padding: 5px 8px 0; }
.wl-layout.dense .card-legend { padding-top: 1px; }
/* 滚动版（图表上下滚动）：左侧列表不随图表拉长，滚动时固定在窗口顶部 */
.wl-layout[data-per-screen] .ind-panel { position: sticky; top: 0; align-self: start; contain: none; }
/* 0 轴线：Plotly 默认像素对齐（crispEdges）且线宽取整，Windows 125%/150% 缩放下各图粗细不一；
   改为抗锯齿并与走势线同宽（index_gravity.js 的 LINE_WIDTH） */
.wl-side .card-plot .zl { shape-rendering: geometricPrecision !important; stroke-width: 1.2px !important; }

/* 卡片标题下方的小图例（≥2 条序列时显示） */
.card-legend {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 2px;
    font-size: 11px;
    color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.legend-item i { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.legend-item i.legend-bar { width: 8px; height: 8px; opacity: 0.55; }
.tip-row + .tip-row { margin-top: 3px; }

/* 情绪波动：个股输入框（切换行内）、提示文字；水位分布的 全A 图占整行 */
.switch-row .ev-label { align-self: center; color: var(--muted); }
.ev-search {
    width: 200px;
    padding: 4px 8px;
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.ev-search:focus { outline: none; border-color: var(--blue); }
.switch-row .ev-note { align-self: center; color: var(--muted); font-size: 12px; }

/* 悬停提示框：白底圆角阴影卡片，跟随鼠标 */
.chart-tip {
    display: none;
    position: absolute;
    z-index: 5;
    padding: 7px 9px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    pointer-events: none;
    white-space: nowrap;
    font-size: 12px;
}
.tip-date { margin-bottom: 4px; color: var(--ink); }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; }
.tip-name { color: var(--muted); }
.tip-value { margin-left: 8px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip-extra { margin-top: 4px; color: var(--muted); font-size: 12px; }

/* 密码框 */
body.locked { overflow: auto; }
body.locked > .bar, body.locked > .board-root { display: none; }
.lock { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.lock-loading { color: var(--muted); }
.lock-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 320px;
    padding: 28px 28px 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}
.lock-title { font-size: 20px; font-weight: 700; }
.lock-sub { color: var(--muted); }
.lock-input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.lock-input:focus { outline: none; border-color: var(--blue); }
.lock-remember { color: var(--muted); font-size: 13px; cursor: pointer; }
.lock-button {
    font: inherit;
    font-weight: 600;
    padding: 8px 0;
    border: none;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
}
.lock-button:disabled { opacity: 0.6; cursor: wait; }
.lock-error { min-height: 1.2em; color: #c0392b; font-size: 13px; }

@media (max-width: 900px) {
    .layout-industry { grid-template-columns: 1fr; }
    .wl-side { grid-template-columns: 1fr; }
    .ind-panel { height: 260px; contain: none; }
    .chart-grid { grid-template-columns: 1fr; }
    .toolbar .status { margin-left: 0; }
}
