/* 股票自动交易工具 - 样式 */
/* 蒸蒸日上 - 让财富每日向上 */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --gold: #d97706;
    --gold-light: #fef3c7;
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* 导航栏 */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { font-size: 18px; font-weight: 700; color: var(--primary); }
.nav-links { display: flex; gap: 8px; }
.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    background: #eff6ff;
    color: var(--primary);
}
.nav-status {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: #f8fafc;
    border-radius: 20px;
}
.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 自动刷新控件 */
.ar-widget {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: inherit;
    padding: 4px 10px;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 20px;
    white-space: nowrap;
}
.ar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}
.ar-dot.on {
    background: #22c55e;
    animation: pulse 2s infinite;
}
.ar-dot.off { background: #cbd5e1; }
.ar-text { font-size: 12px; color: inherit; }
.ar-time {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 11px;
    color: rgba(148, 163, 184, 0.95);
}
.ar-select {
    font-size: 11px;
    padding: 2px 4px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    outline: none;
}
.ar-select:focus { border-color: var(--primary); }
.ar-select option { color: #1e293b; }
.ar-btn {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: transform 0.3s;
}
.ar-btn:hover { color: var(--primary); transform: rotate(180deg); }

/* 数据变更高亮 */
@keyframes arFlash {
    0%   { background: rgba(37, 99, 235, 0.18); transform: scale(1.04); }
    100% { background: transparent; transform: scale(1); }
}
.ar-flash {
    animation: arFlash 1.2s ease-out;
    border-radius: 6px;
    padding: 2px 6px;
    margin: -2px -6px;
    display: inline-block;
}

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

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* 卡片行 */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.card-value { font-size: 24px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.card.positive .card-value { color: var(--danger); }
.card.negative .card-value { color: var(--success); }

/* 两列布局 */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 1000px) {
    .grid-2col { grid-template-columns: 1fr; }
}

/* 面板 */
.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h3 { font-size: 15px; font-weight: 600; }

/* 表格 */
.table-container { overflow-x: auto; padding: 0 20px 16px; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table .empty { text-align: center; color: var(--text-secondary); padding: 24px; }
.data-table .profit { color: var(--danger); }
.data-table .loss { color: var(--success); }

/* 图表 */
.chart-container {
    position: relative;
    padding: 16px 20px;
    height: 280px;
}

/* 徽章 */
.badge {
    display: inline-block;
    background: #eff6ff;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge.danger { background: #fef2f2; color: var(--danger); }
.badge.success { background: #f0fdf4; color: var(--success); }
.badge.warning { background: #fffbeb; color: var(--warning); }

/* 引擎运行诊断面板 */
.diag-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed rgba(148,163,184,0.25);
    line-height: 1.7;
    font-size: 13px;
}
.diag-row:last-child { border-bottom: none; }
.diag-label {
    flex: 0 0 78px;
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    padding-top: 1px;
}
.diag-time { margin-left: auto; color: #94a3b8; font-size: 11px; white-space: nowrap; padding-left: 12px; }
.diag-reason { color: #b45309; background: rgba(245,158,11,0.08); padding: 4px 10px; border-radius: 6px; font-size: 12px; }
.diag-errors { color: var(--danger); font-size: 12px; background: rgba(220,38,38,0.06); padding: 4px 10px; border-radius: 6px; max-height: 90px; overflow-y: auto; }

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: white; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { background: #f8fafc; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 市场信息 */
.market-info { padding: 16px 20px; }
.market-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.market-item .label { color: var(--text-secondary); }
.market-item .value { font-weight: 500; }

/* 持仓行情卡片 */
.quote-card {
    border: 1px solid var(--border);
    border-left: 4px solid #94a3b8;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: #fcfdfe;
    transition: box-shadow 0.2s;
}
.quote-card.profit { border-left-color: #e02424; }
.quote-card.loss { border-left-color: #089981; }
.quote-card.flat { border-left-color: #94a3b8; }
.quote-card:last-child { margin-bottom: 0; }
.quote-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.quote-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}
.quote-name { font-weight: 600; font-size: 14px; flex-shrink: 0; }
.quote-name small { color: var(--text-secondary); font-weight: 400; font-size: 12px; }
.quote-price { font-size: 17px; font-weight: 700; margin-left: auto; }
.quote-change { font-size: 13px; font-weight: 600; min-width: 80px; text-align: right; }

.quote-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px 10px;
    padding: 8px 0;
    border-top: 1px dashed #eef2f7;
    border-bottom: 1px dashed #eef2f7;
    margin-bottom: 8px;
}
.quote-grid div { display: flex; flex-direction: column; gap: 2px; }
.quote-grid span { font-size: 11px; color: var(--text-secondary); }
.quote-grid b { font-size: 13px; font-weight: 500; }
@media (max-width: 480px) {
    .quote-grid { grid-template-columns: repeat(3, 1fr); }
}

.quote-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    flex-wrap: wrap;
    gap: 4px;
}
.quote-foot .quote-pos { color: var(--text-secondary); }

/* 策略页 */
.strategy-form {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* 回测 */
.backtest-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
}
@media (max-width: 900px) {
    .backtest-container { grid-template-columns: 1fr; }
}

/* 进度 */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.empty { text-align: center; color: var(--text-secondary); padding: 24px; }

/* 筛选器 */
.screener-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: end;
}
.screener-controls .form-group { margin-bottom: 0; }
.screener-controls .form-group input { width: 120px; }

/* 股票代码输入 */
.stock-input {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.stock-input input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.stock-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.stock-tag {
    padding: 4px 10px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stock-tag .remove { cursor: pointer; opacity: 0.6; }
.stock-tag .remove:hover { opacity: 1; }

/* ====================================================== */
/* 蒸蒸日上 - 品牌区与新仪表盘                            */
/* ====================================================== */

/* 导航栏品牌 */
.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}
.nav-brand .brand-seal {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35);
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
}

/* 仪表盘英雄区 */
.brand-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #d97706 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.brand-hero::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}
.brand-hero::after {
    content: '蒸蒸日上';
    position: absolute;
    right: 32px;
    bottom: -12px;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    font-size: 88px;
    font-weight: 700;
    color: rgba(255,255,255,0.07);
    letter-spacing: 18px;
    pointer-events: none;
}
.brand-hero-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.brand-hero-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand-hero-logo {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    font-size: 32px;
    font-weight: 800;
    backdrop-filter: blur(8px);
}
.brand-hero-text h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 2px;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
}
.brand-hero-text p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.85;
    letter-spacing: 1px;
}
.brand-hero-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.brand-hero-chip {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.brand-hero-chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s infinite;
}
.brand-hero-clock {
    font-size: 13px;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

/* KPI 卡片 */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.kpi-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.kpi-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.kpi-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.kpi-card-icon.blue { background: #dbeafe; color: #2563eb; }
.kpi-card-icon.gold { background: #fef3c7; color: #d97706; }
.kpi-card-icon.green { background: #dcfce7; color: #16a34a; }
.kpi-card-icon.red { background: #fee2e2; color: #dc2626; }
.kpi-card-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
}
.kpi-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
}
.kpi-card.positive .kpi-card-value { color: var(--danger); }
.kpi-card.negative .kpi-card-value { color: var(--success); }

/* 二级 KPI - 紧凑型 */
.kpi-grid-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.kpi-mini {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kpi-mini-label {
    font-size: 12px;
    color: var(--text-secondary);
}
.kpi-mini-value {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 目标进度 */
.target-progress {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}
.target-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* 频率下拉（交易引擎卡片，原仪表盘自动交易控制条迁移） */
.auto-bar-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

/* 状态徽章 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge.running { background: #dcfce7; color: #16a34a; }
.status-badge.stopped { background: #f1f5f9; color: #64748b; }
.status-badge.completed { background: #fef3c7; color: #d97706; }
.status-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-badge.running .dot {
    animation: pulse 2s infinite;
}

/* 走势胶囊 */
.trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.trend-pill.up { background: #fef2f2; color: #dc2626; }
.trend-pill.down { background: #f0fdf4; color: #16a34a; }
.trend-pill.flat { background: #f1f5f9; color: #64748b; }

/* 面板升级 */
.panel { border-radius: var(--radius); }
.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 持仓进度条 */
.pos-progress {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.pos-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* 简洁卡片标题 */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #2563eb, #d97706);
    border-radius: 2px;
}

/* 图表高度统一 */
.chart-container {
    height: 320px;
}

/* 信号条目紧凑 */
.signal-strength {
    display: flex;
    align-items: center;
    gap: 8px;
}
.signal-strength-bar {
    flex: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}
.signal-strength-fill {
    height: 100%;
    border-radius: 3px;
}

/* 加载骨架 */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 4px;
    color: transparent;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 心跳 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 响应式微调 */
@media (max-width: 768px) {
    .brand-hero { padding: 20px; }
    .brand-hero-text h1 { font-size: 20px; }
    .brand-hero-logo { width: 44px; height: 44px; font-size: 24px; }
    .brand-hero::after { font-size: 56px; right: 16px; }
}

/* ===== 模拟设置页：运行中横幅 ===== */
.running-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    animation: pulse-banner 2s ease-in-out infinite;
}
@keyframes pulse-banner {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}
.running-banner .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    flex-shrink: 0;
}

/* ===== 手机验证码弹窗 ===== */
.sms-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.sms-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 380px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    animation: sms-pop 0.2s ease-out;
}
@keyframes sms-pop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.sms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
}
.sms-modal-close {
    border: none;
    background: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
}
.sms-modal-close:hover { color: var(--danger); }
.sms-modal-body { padding: 20px; }
.sms-modal-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.sms-field { margin-bottom: 14px; }
.sms-field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.sms-field input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.sms-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.sms-code-row { display: flex; gap: 8px; }
.sms-code-row input { flex: 1; }
.sms-code-row .btn { white-space: nowrap; flex-shrink: 0; }
.sms-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}
.sms-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

/* ===== 用户认证（登录/注册/交易密码） ===== */
.nav-auth { display: flex; align-items: center; gap: 8px; }
.nav-auth-btn {
    font-size: 12px;
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 20px;
    white-space: nowrap;
}
.nav-user-name { color: var(--primary); font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.nav-user-logout {
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 0 2px;
    text-decoration: underline;
}
.nav-user-logout:hover { color: var(--danger); }

/* 登录/注册 Tab */
.auth-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
}
.auth-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.auth-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hidden { display: none !important; }

/* ====================================================== */
/* 双端适配：移动端导航（≤900px 折叠为汉堡菜单）            */
/* ====================================================== */

/* 汉堡按钮（桌面端隐藏） */
.nav-toggle {
    display: none;
    border: none;
    background: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s;
}
.nav-toggle:hover { color: var(--primary); background: #f1f5f9; }

@media (max-width: 900px) {
    /* ---- 导航栏：汉堡 + 下拉菜单 ---- */
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .navbar {
        padding: 0 14px;
        gap: 8px;
        height: auto;
        min-height: 54px;
        flex-wrap: wrap;
    }
    .nav-brand { font-size: 16px; }
    .nav-brand .brand-seal { width: 26px; height: 26px; font-size: 14px; border-radius: 6px; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 2px;
        order: 20;
        padding: 6px 0 10px;
        border-top: 1px solid var(--border);
    }
    .navbar.nav-open .nav-links { display: flex; }
    .nav-links a {
        padding: 11px 12px;
        font-size: 15px;
        border-radius: 8px;
    }
    .nav-right { margin-left: auto; gap: 8px; }
    .nav-status { display: none; }
    /* 自动刷新控件改小，保证手机端不溢出 */
    .ar-widget { padding: 3px 8px; }
    .ar-text { display: none; }
    .ar-time { font-size: 10px; }
    .ar-select { font-size: 10px; }

    /* ---- 容器与间距 ---- */
    .container { padding: 14px; }

    /* ---- 品牌英雄区 ---- */
    .brand-hero { padding: 18px 16px; margin-bottom: 16px; }
    .brand-hero-logo { width: 40px; height: 40px; font-size: 22px; border-radius: 10px; }
    .brand-hero-text h1 { font-size: 20px; letter-spacing: 1px; }
    .brand-hero-text p { font-size: 11px; }
    .brand-hero::after { font-size: 48px; right: 8px; letter-spacing: 8px; }
    .brand-hero-chip { padding: 4px 10px; font-size: 11px; }

    /* ---- KPI 卡片 ---- */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .kpi-card { padding: 14px; }
    .kpi-card-value { font-size: 21px; }
    .kpi-card-sub { font-size: 11px; }
    .kpi-grid-mini { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
    .kpi-mini { padding: 10px 14px; }

    /* ---- 面板与表格 ---- */
    .panel-header { padding: 12px 14px; }
    .table-container { padding: 0 14px 12px; }
    .chart-container { height: 240px; padding: 12px 14px; }
    .data-table { font-size: 12px; }
    .data-table th { padding: 10px 6px; }
    .data-table td { padding: 9px 6px; }

    /* ---- 表单与策略 ---- */
    .strategy-form { padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr; gap: 12px; }
    .screener-controls .form-group input { width: 100%; }
    .screener-controls { flex-direction: column; align-items: stretch; gap: 10px; }
    .stock-input { flex-direction: column; }
    .stock-input .btn { width: 100%; }

    /* ---- 持仓行情卡片 ---- */
    .quote-grid { grid-template-columns: repeat(3, 1fr); }
    .quote-head { flex-wrap: wrap; }
    .quote-price { margin-left: 0; }
    .quote-change { min-width: 0; }

    /* ---- 弹窗 ---- */
    .sms-modal { width: 92vw; }

    /* ---- 按钮组换行 ---- */
    .btn { padding: 9px 14px; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-card-value { font-size: 18px; }
    .brand-hero::after { display: none; }
    .brand-hero-row { gap: 10px; }
    .brand-hero-right { width: 100%; justify-content: flex-start; }
    .quote-grid { grid-template-columns: repeat(2, 1fr); }
    .toast { left: 12px; right: 12px; transform: none; text-align: center; }
    @keyframes toastPop { from{transform:scale(0.8);opacity:0} to{transform:scale(1);opacity:1} }
    .log-filter { flex-direction: column; }
    .log-keyword { min-width: 0; width: 100%; }
}

/* ====================================================== */
/* 手机端体验补强（8/22）                                  */
/* ====================================================== */

/* 图表高度等级：配合模板 class 使用，mobile 自动降级 */
.chart-lg { height: 400px; }
.chart-md { height: 300px; }
.chart-sm { height: 260px; }
.chart-xs { height: 200px; }

@media (max-width: 900px) {
    /* 输入框放大到 16px，防止 iOS 聚焦自动缩放 */
    input, select, textarea,
    .form-group input, .form-group select,
    .sms-field input, .engine-stat select,
    .auto-bar-select, .ar-select {
        font-size: 16px !important;
    }

    /* 页签触控区 >= 44px */
    .page-tab, .bt-tab {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 表格横向滚动增强：iOS 惯性 + 滚动阴影提示 */
    .table-container {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        position: relative;
        padding-bottom: 4px;
    }
    .table-container.scroll-hint::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 24px;
        background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.92));
        pointer-events: none;
        opacity: 0.7;
    }
    .data-table { min-width: max-content; }
    .data-table th, .data-table td { padding: 9px 6px; }

    /* 面板标题允许换行 */
    .panel-header { flex-wrap: wrap; gap: 8px; }

    /* 按钮最小触控高度 */
    .btn { min-height: 40px; }

    /* 发现/回测：筛选按钮占满 */
    .screener-controls .btn-primary { width: 100%; }
    .stock-input { flex-direction: column; }
    .stock-input input { width: 100%; }

    /* 股票详情：MA 控件允许换行 */
    .chart-controls { flex-wrap: wrap; gap: 10px; width: 100%; }
    .chart-controls label {
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 0;
    }
    .chart-controls input[type="checkbox"] {
        width: 18px; height: 18px;
    }
}

@media (max-width: 480px) {
    /* 窄屏进一步降高 */
    .chart-lg { height: 300px; }
    .chart-md { height: 240px; }
    .chart-sm { height: 200px; }
    .chart-xs { height: 160px; }

    /* 表格更紧凑 */
    .data-table { font-size: 11px; }
    .data-table th, .data-table td { padding: 8px 4px; }

    /* 主按钮占满 */
    .btn.btn-start,
    #runBtn,
    .bt-action-btn { width: 100%; }

    /* KPI 更小 */
    .kpi-card { padding: 12px; }
    .kpi-card-value { font-size: 18px; }
    .kpi-card-sub { font-size: 11px; }

    /* 回测预设按钮两列 */
    .preset-btns { gap: 8px; }
    .preset-btn {
        flex: 1 1 calc(50% - 4px);
        padding: 8px 10px;
        font-size: 12px;
        text-align: center;
    }

    /* 手动交易买入/卖出按钮占满 */
    .trade-action-row { flex-direction: column; gap: 10px; }
    .trade-action-row .btn { width: 100%; }
}

/* ===== AI 投研观点（软信号） ===== */
.ai-brief-empty { color: var(--text-secondary); font-size: 13px; padding: 8px 0; }
.ai-brief-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ai-brief-time { font-size: 12px; color: var(--text-secondary); }
.ai-brief-tag { font-size: 11px; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 999px; }
.ai-dir-tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.ai-brief-text { font-size: 14px; color: var(--text); line-height: 1.8; }
.ai-brief-more { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.badge-auto-apply { font-size: 11px; color: #059669; background: rgba(16,185,129,0.14); border: 1px solid rgba(16,185,129,0.35); padding: 3px 10px; border-radius: 999px; }

/* AI 应用状态摘要条（仪表盘） */
.ai-status-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 12px; border-bottom: 1px dashed rgba(148,163,184,0.25); margin-bottom: 12px; }
.ai-status-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 11px; border-radius: 999px; background: #f8fafc; color: var(--text-secondary); border: 1px solid var(--border); white-space: nowrap; cursor: default; }
.ai-status-chip .ai-chip-icon { font-size: 13px; line-height: 1; }
.ai-status-chip.on { color: #059669; background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); }
.ai-status-chip.off { color: #94a3b8; }
.ai-status-chip.warn { color: #d97706; background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }

/* ===== AI 对话问答（20260818o） ===== */
.ai-chat-wrap { margin-top: 14px; border-top: 1px dashed rgba(148,163,184,0.25); padding-top: 12px; }
.ai-chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-chat-title { font-size: 13px; font-weight: 500; color: var(--text); }
.ai-chat-log { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.ai-chat-row { display: flex; }
.ai-chat-row.user { justify-content: flex-end; }
.ai-chat-row.bot { justify-content: flex-start; }
.ai-chat-bubble { max-width: 88%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.7; word-break: break-word; }
.ai-chat-bubble.user { background: #2563eb; color: #fff; border-bottom-right-radius: 2px; white-space: pre-wrap; }
.ai-chat-bubble.bot { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 2px; }
.ai-chat-tip { font-size: 12px; color: var(--text-secondary); padding: 6px 0; }
.ai-chat-input-row { display: flex; gap: 8px; margin-top: 10px; }
.ai-chat-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); outline: none; min-width: 0; }
.ai-chat-input:focus { border-color: #2563eb; }

/* ===== 新手 3 步引导卡（仪表盘，未启动模拟时显示） ===== */
.onboarding-card {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06);
}
.onboarding-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.onboarding-text { flex: 1; min-width: 220px; }
.onboarding-title { font-size: 17px; font-weight: 700; color: #1e3a8a; margin-bottom: 6px; }
.onboarding-sub { font-size: 13px; color: #475569; line-height: 1.7; }
.onboarding-steps { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.onboarding-step { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.step-badge {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: #fff;
    font-size: 12px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step-name { font-size: 13px; font-weight: 600; color: var(--text); }
.step-tip { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.onboarding-arrow { color: var(--primary); font-size: 16px; font-weight: 600; }

@media (max-width: 768px) {
    .onboarding-inner { flex-direction: column; align-items: stretch; gap: 14px; }
    .onboarding-steps { justify-content: flex-start; }
    .onboarding-arrow { display: none; }
}

/* ===== P0-6 双模式徽标 ===== */
.mode-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600;
    border-radius: 999px; padding: 3px 10px;
    border: 1px solid transparent; white-space: nowrap;
}
.mode-paper { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.mode-live { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ===== P0-5 免责声明页脚 ===== */
.disclaimer-footer {
    margin-top: 2rem; padding: 14px 16px 22px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
    text-align: center; line-height: 1.8;
}
.disclaimer-footer .d-strong { color: #b45309; font-weight: 600; }

/* ==========================================================
   侧边栏导航框架（9 页新架构 20260824）
   页面使用方式：body 加 class="with-sidebar"，include _nav.html，
   内容放在 main.page-main 中；sidebar.js 负责抽屉与状态灯。
   ========================================================== */
body.with-sidebar { padding-left: 224px; }

.app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 224px;
    background: var(--card-bg); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 1200; overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 14px 12px; border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    width: 36px; height: 36px; border-radius: 10px; flex: none;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; font-weight: 700; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-brand-text { line-height: 1.25; min-width: 0; }
.sidebar-name { font-weight: 700; font-size: 15px; display: block; }
.sidebar-sub { font-size: 11px; color: var(--text-secondary); display: block; }

.sidebar-nav { flex: 1; padding: 10px 10px 12px; }
.nav-group { margin-bottom: 8px; }
.nav-group-title {
    font-size: 11px; color: var(--text-secondary);
    padding: 6px 10px 4px; letter-spacing: .06em;
}
.nav-link {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px; margin-bottom: 2px;
    color: var(--text); text-decoration: none; font-size: 13.5px;
}
.nav-link:hover { background: #f1f5f9; }
.nav-link.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-single { margin: 4px 0 8px; }
.nav-ico { width: 20px; text-align: center; flex: none; }
.nav-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 99px;
    background: #f1f5f9; color: var(--text-secondary);
    border: 1px solid var(--border); margin-left: auto;
}
/* 待人工决策角标（调教副驾 pending 提案数，红色醒目提醒） */
.nav-badge-decision {
    background: #dc2626; color: #fff; border-color: #dc2626;
    font-weight: 700; margin-left: 6px; flex-shrink: 0;
}
/* 仪表盘「待您决策」卡片（调教副驾提案醒目展示） */
.decision-card {
    margin: 0 20px 14px; padding: 14px 16px;
    background: #fffbeb; border: 1px solid #f59e0b; border-radius: 12px;
}
.decision-head {
    display: flex; align-items: center; gap: 8px;
    color: #92400e; font-size: 14px;
}
.decision-icon { font-size: 18px; }
.decision-head strong { flex: 1; }
.decision-go {
    color: #fff; background: #f59e0b; border-radius: 8px;
    padding: 4px 12px; font-size: 13px; text-decoration: none; white-space: nowrap;
}
.decision-go:hover { background: #d97706; }
.decision-list {
    margin: 10px 0 0; padding: 0 0 0 26px; color: #78350f; font-size: 13px;
}
.decision-list li { margin-bottom: 4px; }
@media (max-width: 768px) {
    .decision-card { margin: 0 12px 12px; }
    .decision-head { flex-wrap: wrap; }
}

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); }
/* 侧边栏底部登录/用户信息区（8/24 补齐全站认证入口） */
.sidebar-auth { display: flex; align-items: center; margin-top: 10px; }
.sidebar-auth .sidebar-auth-btn { width: 100%; font-size: 13px; padding: 8px 10px; }
.sidebar-auth .nav-user { justify-content: space-between; flex: 1; min-width: 0; }
.engine-light {
    display: flex; align-items: center; gap: 8px; font-size: 12px;
    color: var(--text-secondary); background: #f8fafc;
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.engine-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; flex: none; }
.engine-dot[data-state="run"] { background: var(--success); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.engine-dot[data-state="warn"] { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.engine-dot[data-state="down"] { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .15); }
.engine-light[data-state="run"] { color: #15803d; }
.engine-light[data-state="warn"] { color: #b45309; }
.engine-light[data-state="down"] { color: #b91c1c; }

.sidebar-toggle {
    display: none; position: fixed; top: 10px; left: 10px; z-index: 1300;
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--card-bg);
    box-shadow: var(--shadow-md); font-size: 18px; cursor: pointer; color: var(--text);
    /* 手机端：禁用双击缩放/300ms 点击延迟，保证抽屉开关即点即响应 */
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1150; }

/* 新页面主内容区与页头 */
.page-main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 700; }
.page-head .page-sub { color: var(--text-secondary); font-size: 13px; }
.page-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 1023px) {
    body.with-sidebar { padding-left: 0; }
    body.sidebar-open { overflow: hidden; }
    .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .app-sidebar {
        transform: translateX(-100%); transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-mask.show { display: block; }
    .page-main { padding: 64px 14px 40px; }
}
