/* ============================================
   安全边际 · 价值投资助手
   响应式样式 - 移动优先
   ============================================ */

/* === 变量 === */
:root {
    --c-bg: #f5f6fa;
    --c-surface: #fff;
    --c-hover: #f0f1f5;
    --c-border: #e8e9ee;
    --c-text: #1a1a2e;
    --c-text2: #6b7280;
    --c-text3: #9ca3af;
    --c-up: #dc2626;
    --c-down: #16a34a;
    --c-up-bg: #fef2f2;
    --c-down-bg: #f0fdf4;
    --c-blue: #3b82f6;
    --c-blue-bg: #eff6ff;
    --c-amber: #d97706;
    --c-amber-bg: #fffbeb;
    --r: 8px;
    --r-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,.1);
}

/* === 全局 === */
*, *::before, *::after { box-sizing: border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

/* === 顶部栏 === */
.topbar {
    display: flex; align-items: center; gap: 8px;
    height: 48px; padding: 0 12px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; z-index: 100;
}
.hamburger {
    width: 36px; height: 36px;
    border: none; background: none;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 4px; cursor: pointer; padding: 4px; border-radius: 6px;
}
.hamburger span { display:block; width:18px; height:2px; background:var(--c-text); border-radius:1px; }
.hamburger:active { background: var(--c-hover); }

.brand { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.brand-icon { font-size: 18px; }
.brand-text { font-size: 14px; font-weight: 700; color: var(--c-text); }

.search-wrap {
    flex: 1; display: flex; position: relative; min-width: 0;
}
.search-wrap input {
    flex: 1; height: 36px; min-width: 0;
    padding: 0 10px; border: 1px solid var(--c-border);
    border-right: none; border-radius: var(--r) 0 0 var(--r);
    background: var(--c-bg); font-size: 13px; outline: none;
    color: var(--c-text);
}
.search-wrap input:focus { border-color: var(--c-blue); }
.search-wrap input::placeholder { color: var(--c-text3); }
.search-wrap button {
    height: 36px; padding: 0 14px;
    background: var(--c-blue); color: #fff;
    border: none; border-radius: 0 var(--r) var(--r) 0;
    font-size: 13px; font-weight: 500; cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
}
.search-wrap button:active { background: #2563eb; }

/* 搜索下拉 */
.search-drop {
    position: absolute; top: 40px; left: 0; right: 48px;
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); max-height: 260px; overflow-y: auto;
    z-index: 200; display: none; box-shadow: var(--shadow-lg);
}
.search-drop.show { display: block; }
.search-drop .item {
    padding: 10px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--c-border); font-size: 13px;
}
.search-drop .item:last-child { border-bottom: none; }
.search-drop .item:hover, .search-drop .item.active { background: var(--c-blue-bg); }
.search-drop .item .code { color: var(--c-text3); font-size: 11px; margin-left: auto; flex-shrink:0; }
.search-drop .item .name { flex: 1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* 市场标签 */
.mkt-badge { font-size:10px; padding:1px 5px; border-radius:3px; font-weight:600; flex-shrink:0; }
.mkt-sh { background:#fef2f2; color:#dc2626; }
.mkt-sz { background:#f0fdf4; color:#16a34a; }
.mkt-bj { background:#fffbeb; color:#d97706; }
.mkt-hk { background:#eff6ff; color:#3b82f6; }
.mkt-us { background:#faf5ff; color:#9333ea; }

.search-drop .loading, .search-drop .empty {
    padding: 16px; text-align: center; font-size: 13px; color: var(--c-text3);
}

/* === 主布局 === */
.app-body { display: flex; min-height: calc(100vh - 48px - 36px); }

/* 侧边栏遮罩 */
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 90;
    display: none;
}
.sidebar-overlay.show { display: block; }

/* 左侧栏 */
.sidebar {
    position: fixed; top:0; left:0; bottom:0; z-index: 95;
    width: 280px; max-width: 85vw;
    background: var(--c-surface); box-shadow: var(--shadow-lg);
    transform: translateX(-100%); transition: transform .25s;
    display: flex; flex-direction: column;
}
.sidebar.open { transform: translateX(0); }
.sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--c-border);
    font-weight: 600; font-size: 14px;
}
.sidebar-close {
    width: 32px; height: 32px; border: none; background: none;
    font-size: 22px; cursor: pointer; color: var(--c-text2);
    display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
.sidebar-close:active { background: var(--c-hover); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

/* 侧边卡片 */
.side-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 12px; position: relative;
}
.side-card h4 { font-size: 13px; color: var(--c-text2); margin-bottom: 8px; font-weight: 600; }

/* 右侧栏 - 桌面可见 */
.sidebar-right { display: none; flex-direction: column; gap: 8px; width: 300px; flex-shrink: 0; padding: 8px 8px 8px 0; }

/* === 主内容 === */
.content { flex: 1; min-width: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

/* 欢迎面板 */
.welcome { flex:1; display:flex; align-items:center; justify-content:center; min-height:400px; }
.welcome-body { text-align:center; max-width:400px; padding:24px; }
.welcome-avatar { font-size:56px; margin-bottom:12px; }
.welcome-body h2 { font-size:20px; margin-bottom:6px; }
.welcome-body p { color:var(--c-text2); font-size:13px; margin-bottom:16px; }
.welcome-rules {
    background: var(--c-surface); border:1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 16px; text-align: left; margin-bottom: 16px;
}
.welcome-rules div {
    padding: 6px 0; font-size: 13px; color: var(--c-text2);
    border-bottom: 1px solid var(--c-border);
}
.welcome-rules div:last-child { border-bottom: none; }
.welcome-hint { color: var(--c-blue); font-size:14px; }

/* 分析面板 */
.analysis { display: flex; flex-direction: column; gap: 8px; }

/* 股票卡片 */
.stock-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 14px 16px;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.stock-card .info h2 { font-size: 17px; }
.stock-card .info .code { font-size: 12px; color: var(--c-text3); }
.stock-card .price-block { text-align: right; }
.stock-card .price { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stock-card .change { font-size: 13px; }
.stock-card .meta { display: flex; gap: 12px; font-size: 11px; color: var(--c-text3); flex-wrap: wrap; margin-top: 2px; }

/* === 标签栏 === */
.tab-bar {
    display: flex; gap: 2px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; background: var(--c-surface);
    border: 1px solid var(--c-border); border-radius: var(--r);
    padding: 3px;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
    flex-shrink: 0; padding: 8px 12px; border: none; background: none;
    font-size: 12px; color: var(--c-text2); cursor: pointer;
    border-radius: 6px; white-space: nowrap; transition: all .15s;
    min-height: 36px; display: flex; align-items: center; gap: 3px;
    -webkit-tap-highlight-color: transparent;
}
.tab-btn:active { background: var(--c-hover); }
.tab-btn.active { background: var(--c-blue); color: #fff; font-weight: 500; }

.tab-body {}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* === 图表容器 === */
.chart-box {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); height: 300px; margin-bottom: 8px;
    overflow: hidden;
}
.chart-box.half { height: 240px; }
.chart-row { display: flex; gap: 8px; flex-direction: column; }
.chart-row .chart-box { flex: 1; }

/* === 指标网格 === */
.ind-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 8px; }
.ind-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 12px; text-align: center;
}
.ind-card .label { font-size: 11px; color: var(--c-text3); margin-bottom: 4px; }
.ind-card .value { font-size: 17px; font-weight: 700; }
.ind-card .signal { font-size: 10px; margin-top: 3px; padding: 2px 8px; border-radius: 10px; display: inline-block; }

.sig-up { background: var(--c-up-bg); color: var(--c-up); }
.sig-down { background: var(--c-down-bg); color: var(--c-down); }
.sig-neutral { background: var(--c-blue-bg); color: var(--c-blue); }

/* 详细分析文本 */
.detail-text {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 14px; font-size: 12px;
    white-space: pre-wrap; color: var(--c-text2); line-height: 1.7;
    max-height: 400px; overflow-y: auto;
}

/* === 大师对话 === */
.master-chat {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-lg); padding: 14px; min-height: 200px;
    max-height: 400px; overflow-y: auto; margin-bottom: 8px;
}
.chat-msg { display: flex; gap: 10px; margin-bottom: 14px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-av { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.chat-msg.master .chat-av { background: var(--c-blue-bg); }
.chat-msg.user .chat-av { background: var(--c-hover); }
.chat-bub {
    max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; white-space: pre-wrap;
}
.chat-msg.master .chat-bub { background: var(--c-bg); border: 1px solid var(--c-border); border-top-left-radius: 4px; }
.chat-msg.user .chat-bub { background: var(--c-blue-bg); border: 1px solid rgba(59,130,246,.2); border-top-right-radius: 4px; }

.master-input { display: flex; gap: 6px; }
.master-input input {
    flex: 1; height: 42px; padding: 0 12px; background: var(--c-bg);
    border: 1px solid var(--c-border); border-radius: var(--r);
    font-size: 13px; outline: none; color: var(--c-text);
}
.master-input input:focus { border-color: var(--c-blue); }
.master-input button {
    height: 42px; padding: 0 20px; background: var(--c-blue); color: #fff;
    border: none; border-radius: var(--r); font-size: 13px; font-weight: 500; cursor: pointer;
}

/* === 预测卡片 === */
.pred-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.pred-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 14px; text-align: center;
}
.pred-card.warn { border-color: var(--c-amber); background: var(--c-amber-bg); }
.pred-card.danger { border-color: var(--c-up); background: var(--c-up-bg); }
.pred-card.ok { border-color: var(--c-down); background: var(--c-down-bg); }
.pred-card.info { border-color: var(--c-blue); background: var(--c-blue-bg); }
.pred-card .label { font-size: 11px; color: var(--c-text3); margin-bottom: 4px; }
.pred-card .value { font-size: 18px; font-weight: 700; }
.pred-card .sub { font-size: 11px; color: var(--c-text3); margin-top: 2px; }

/* === 评分 === */
.score-wrap { text-align: center; padding: 12px 0; }
.score-num { font-size: 42px; font-weight: 800; line-height: 1; }
.score-lbl { font-size: 13px; margin-top: 4px; font-weight: 500; }
.score-detail { font-size: 12px; color: var(--c-text2); line-height: 1.8; margin-top: 8px; }

/* === 新闻 === */
.news-list { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow-y: auto; }
.news-item {
    padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
    border-bottom: 1px solid var(--c-border); line-height: 1.5;
}
.news-item:last-child { border-bottom: none; }
.news-item:active { background: var(--c-hover); }
.news-item .title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-weight: 500; margin-bottom: 2px;
}
.news-item .meta { font-size: 10px; color: var(--c-text3); display: flex; justify-content: space-between; }
.news-item .summary {
    font-size: 12px; color: var(--c-text2); margin-top: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.5;
}
.news-item .news-detail {
    display: none; margin-top: 6px; padding: 8px; background: var(--c-bg);
    border-radius: 6px; font-size: 12px; color: var(--c-text2); line-height: 1.7;
}
.news-item.expanded .news-detail { display: block; }
.news-item.expanded { background: var(--c-blue-bg); border-bottom-color: transparent; }
.news-item .news-detail-actions {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px;
}
.news-item .news-detail-actions a {
    font-size: 11px; color: var(--c-blue); text-decoration: none;
    padding: 4px 10px; border: 1px solid var(--c-blue); border-radius: 4px;
}
.news-item .news-detail-actions a:active { background: var(--c-blue); color: #fff; }

.load-more {
    width: 100%; padding: 10px; margin-top: 6px; border: 1px solid var(--c-border);
    border-radius: 6px; background: var(--c-surface); color: var(--c-blue);
    font-size: 13px; cursor: pointer; text-align: center;
}
.load-more:active { background: var(--c-blue-bg); }
.load-more:disabled { opacity: .5; }
.load-end { text-align: center; padding: 8px; color: var(--c-text3); font-size: 11px; }

/* === 大盘/热股 列表 === */
.idx-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.idx-item:active { background: var(--c-hover); }
.idx-item .idx-name { font-weight: 500; }
.idx-item .idx-right { text-align: right; }
.idx-item .idx-price { font-weight: 600; }

.hot-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px; border-radius: 6px; cursor: pointer; border-bottom: 1px solid var(--c-border);
}
.hot-item:last-child { border-bottom: none; }
.hot-item:active { background: var(--c-hover); }
.hot-item .hot-name { font-size: 13px; font-weight: 500; }
.hot-item .hot-code { font-size: 11px; color: var(--c-text3); }
.hot-item .hot-right { text-align: right; }
.hot-item .hot-price { font-weight: 600; font-size: 13px; }
.hot-item .hot-chg { font-size: 11px; }

/* === 自选股 === */
.wl-count {
    font-size: 11px; font-weight: 400; color: var(--c-text3);
    float: right;
}
.wl-add-row {
    display: flex; gap: 4px; margin-bottom: 6px;
}
.wl-add-row input {
    flex: 1; padding: 5px 8px; border: 1px solid var(--c-border);
    border-radius: 5px; font-size: 12px; background: var(--c-bg);
    color: var(--c-text); outline: none; min-height: 32px;
}
.wl-add-row input:focus { border-color: var(--c-blue); }
.wl-add-row button {
    padding: 5px 12px; border: none; border-radius: 5px;
    background: var(--c-blue); color: #fff; font-size: 16px;
    font-weight: 600; cursor: pointer; min-width: 36px; min-height: 32px;
    display: flex; align-items: center; justify-content: center;
}
.wl-add-row button:active { opacity: 0.8; }
.wl-drop {
    display: none; position: absolute; z-index: 10;
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); margin-top: -2px; max-height: 180px;
    overflow-y: auto; width: calc(100% - 24px); box-shadow: var(--shadow);
}
.wl-drop.show { display: block; }
.wl-drop .wl-drop-item {
    padding: 7px 10px; cursor: pointer; font-size: 12px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--c-border);
}
.wl-drop .wl-drop-item:last-child { border-bottom: none; }
.wl-drop .wl-drop-item:hover { background: var(--c-blue-bg); }
.wl-drop .wl-drop-item .wd-name { font-weight: 500; }
.wl-drop .wl-drop-item .wd-code { color: var(--c-text3); font-size: 11px; }
.watch-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 6px; border-radius: 6px; cursor: pointer;
    border-bottom: 1px solid var(--c-border); position: relative;
}
.watch-item:last-child { border-bottom: none; }
.watch-item:hover, .watch-item:active { background: var(--c-hover); }
.watch-item .wi-info { flex: 1; min-width: 0; }
.watch-item .wi-name { font-size: 13px; font-weight: 500; }
.watch-item .wi-code { font-size: 11px; color: var(--c-text3); }
.watch-item .wi-right { text-align: right; flex-shrink: 0; margin-left: 4px; }
.watch-item .wi-price { font-weight: 600; font-size: 13px; }
.watch-item .wi-chg { font-size: 11px; }
.watch-item .wi-del {
    position: absolute; right: 4px; top: 4px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--c-bg2); border: none; color: var(--c-text3);
    font-size: 12px; line-height: 18px; text-align: center;
    cursor: pointer; display: none; padding: 0;
}
.watch-item:hover .wi-del, .watch-item:active .wi-del { display: block; }
.watch-item .wi-del:hover { background: #e74c3c; color: #fff; }
.wl-empty {
    text-align: center; padding: 16px 8px; color: var(--c-text3);
    font-size: 12px;
}
.wl-full {
    text-align: center; padding: 4px; color: #e67e22;
    font-size: 11px; display: none;
}
.wl-full.show { display: block; }

/* === 资金流向 === */
.cap-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.cap-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 12px;
}
.cap-card.full { grid-column: 1/-1; }
.cap-card .cap-label { font-size: 10px; color: var(--c-text3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.cap-card .cap-value { font-size: 18px; font-weight: 700; }
.cap-card .cap-sub { font-size: 11px; color: var(--c-text2); margin-top: 3px; line-height: 1.4; }

.big-order { margin-bottom: 8px; }
.big-order h4, .unusual-blk h4 { font-size: 12px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--c-border); color: var(--c-text2); }
.big-order .order-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
    font-size: 11px; border-bottom: 1px solid var(--c-border);
}
.big-order .order-row:last-child { border-bottom: none; }
.big-order .order-row.buy { border-left: 3px solid var(--c-up); padding-left: 6px; }
.big-order .order-row.sell { border-left: 3px solid var(--c-down); padding-left: 6px; }
.order-time { color: var(--c-text3); width: 40px; flex-shrink: 0; }
.order-badge { padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 600; }
.order-row.buy .order-badge { background: var(--c-up-bg); color: var(--c-up); }
.order-row.sell .order-badge { background: var(--c-down-bg); color: var(--c-down); }
.order-dir { width: 28px; font-weight: 500; }
.order-amt { flex: 1; text-align: right; font-weight: 600; }
.order-mult { color: var(--c-text3); width: 30px; text-align: center; }
.order-px { width: 48px; text-align: right; }

/* 异常放量 */
.unusual-blk { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r); padding: 10px; }
.unusual-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 11px; border-bottom: 1px solid var(--c-border); }
.unusual-row:last-child { border-bottom: none; }
.unusual-date { color: var(--c-text3); width: 80px; flex-shrink: 0; }
.unusual-badge { padding: 1px 6px; border-radius: 3px; font-size: 9px; font-weight: 600; }
.badge-red { background: var(--c-up-bg); color: var(--c-up); }
.badge-amber { background: var(--c-amber-bg); color: var(--c-amber); }

/* === 大宗交易 === */
.bt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.bt-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 12px;
}
.bt-card.full { grid-column: 1/-1; background: var(--c-blue-bg); border-color: rgba(59,130,246,.2); }
.bt-card .bt-label { font-size: 10px; color: var(--c-text3); margin-bottom: 4px; } 
.bt-card .bt-value { font-size: 18px; font-weight: 700; }
.bt-card .bt-sub { font-size: 11px; color: var(--c-text2); margin-top: 3px; line-height: 1.4; }

.bt-warn { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r); padding: 10px; margin-bottom: 8px; }
.bt-warn h4 { font-size: 12px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--c-border); }
.bt-warn-row {
    display: flex; align-items: flex-start; gap: 6px; padding: 5px 0;
    font-size: 11px; border-bottom: 1px solid var(--c-border); flex-wrap: wrap; line-height: 1.4;
}
.bt-warn-row:last-child { border-bottom: none; }

.bt-late { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r); padding: 10px; margin-bottom: 8px; }
.bt-late h4 { font-size: 12px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--c-border); }
.bt-late .legend { font-size: 10px; color: var(--c-text3); margin-bottom: 8px; padding: 6px 8px; background: var(--c-blue-bg); border-radius: 4px; line-height: 1.4; }
.bt-late-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; font-size: 11px; border-bottom: 1px solid var(--c-border); flex-wrap: wrap; }
.bt-late-row:last-child { border-bottom: none; }

.bt-table { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r); padding: 10px; overflow-x: auto; }
.bt-table h4 { font-size: 12px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--c-border); }
.bt-th-row, .bt-tr {
    display: flex; gap: 4px; padding: 4px 0; font-size: 10px;
    min-width: 540px;
}
.bt-th-row { color: var(--c-text3); font-weight: 600; border-bottom: 1px solid var(--c-border); }
.bt-tr { border-bottom: 1px solid var(--c-border); }
.bt-tr:last-child { border-bottom: none; }
.bt-tr.up { border-left: 3px solid var(--c-up); padding-left: 3px; }
.bt-tr.down { border-left: 3px solid var(--c-down); padding-left: 3px; }
.bt-c-date { width: 80px; }
.bt-c-price { width: 52px; text-align: right; }
.bt-c-prem { width: 56px; text-align: center; font-weight: 600; }
.bt-c-vol { width: 60px; text-align: right; }
.bt-c-amt { width: 70px; text-align: right; font-weight: 600; }
.bt-c-buyer, .bt-c-seller { width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text3); }

/* === 安全边际 === */
.mos-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.mos-head h3 { font-size: 16px; font-weight: 700; }
.mos-tag { font-size: 11px; padding: 2px 8px; background: var(--c-blue-bg); color: var(--c-blue); border-radius: 10px; }

.mos-gauge-sec { display: flex; gap: 12px; margin-bottom: 12px; flex-direction: column; }
.mos-gauge-card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 14px; text-align: center;
    display: flex; flex-direction: column; align-items: center;
}
.mos-gauge { width: 160px; height: 100px; }
.mos-level { font-size: 18px; font-weight: 700; margin: 4px 0; }
.mos-rating { font-size: 12px; color: var(--c-text2); }

.mos-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex: 1; }
.mos-m {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 10px; text-align: center;
}
.mos-m .ml { font-size: 10px; color: var(--c-text3); margin-bottom: 2px; }
.mos-m .mv { font-size: 16px; font-weight: 700; }

.mos-cmt {
    display: flex; gap: 10px; background: var(--c-blue-bg);
    border: 1px solid rgba(59,130,246,.2); border-radius: var(--r);
    padding: 12px 14px; margin-bottom: 12px;
}
.mos-cmt-icon { font-size: 24px; flex-shrink: 0; }
.mos-cmt-text { font-size: 12px; color: var(--c-text2); line-height: 1.7; }

.mos-val-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 12px; }
.mos-val {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); padding: 12px; text-align: center;
}
.mos-val.muted { opacity: .4; border-style: dashed; }
.mos-val .vl { font-size: 10px; color: var(--c-text3); margin-bottom: 4px; }
.mos-val .vv { font-size: 18px; font-weight: 700; color: var(--c-blue); }
.mos-val .vn { font-size: 9px; color: var(--c-text3); margin-top: 4px; }

.mos-scores { display: flex; flex-direction: column; gap: 8px; }
.mos-s {
    display: flex; align-items: center; gap: 8px;
}
.mos-s .sl { width: 50px; font-size: 11px; color: var(--c-text2); text-align: right; flex-shrink: 0; }
.mos-s .sb-wrap { flex: 1; height: 8px; background: var(--c-border); border-radius: 4px; overflow: hidden; }
.mos-s .sb-fill { height: 100%; border-radius: 4px; transition: width .5s; }
.mos-s .sv { width: 28px; font-size: 11px; font-weight: 600; color: var(--c-text2); }

/* === 加载/错误 === */
.loading-sm { text-align: center; color: var(--c-text3); padding: 14px; font-size: 13px; }
.loading-spin { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--c-border); border-top-color: var(--c-blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { text-align: center; color: var(--c-up); padding: 20px; font-size: 13px; }

/* === 辅助类 === */
.t-up { color: var(--c-up); }
.t-down { color: var(--c-down); }
.t-muted { color: var(--c-text3); }
.t-warn { color: var(--c-amber); }

/* === 板块行情 === */
.sector-list { padding: 4px 0; }
.sector-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; font-size: 12px; line-height: 1.4;
    border-bottom: 1px solid var(--c-border);
    cursor: pointer; border-radius: 4px;
    transition: background .15s;
}
.sector-item:hover { background: var(--c-blue-bg); }
.sector-item:last-child { border-bottom: none; }
.sector-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--c-text2); }
.sector-price { width: 54px; text-align: right; font-variant-numeric: tabular-nums; color: var(--c-text); font-weight: 500; }
.sector-chg { width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* === 板块走势图视图 === */
.sector-chart-view {
    display: flex; flex-direction: column; gap: 12px;
    width: 100%;
}
.sector-chart-header {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
}
.back-btn {
    padding: 6px 14px; font-size: 13px;
    border: 1px solid var(--c-border); border-radius: 6px;
    background: var(--c-surface); color: var(--c-blue);
    cursor: pointer; white-space: nowrap;
    transition: background .15s;
}
.back-btn:hover { background: var(--c-blue-bg); }
.sector-chart-title {
    font-size: 15px; font-weight: 700; color: var(--c-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* === 底部 === */
.footer { padding: 8px 12px; text-align: center; font-size: 10px; color: var(--c-text3); background: var(--c-surface); border-top: 1px solid var(--c-border); }

/* ============ 平板端 (>= 600px) ============ */
@media (min-width: 600px) {
    .ind-grid { grid-template-columns: repeat(4, 1fr); }
    .pred-grid { grid-template-columns: repeat(2, 1fr); }
    .cap-grid { grid-template-columns: repeat(2, 1fr); }
    .bt-grid { grid-template-columns: repeat(2, 1fr); }
    .mos-val-grid { grid-template-columns: repeat(3, 1fr); }
    .chart-box { height: 350px; }
    .chart-box.half { height: 280px; }
    .mos-gauge-sec { flex-direction: row; align-items: flex-start; }
    .mos-gauge-card { flex: 0 0 200px; }
    .tab-btn { font-size: 13px; padding: 8px 14px; }
    .chart-row { flex-direction: row; }
}

/* ============ 桌面端 (>= 900px) ============ */
@media (min-width: 900px) {
    .hamburger { display: none; }
    .sidebar {
        position: static; transform: none; box-shadow: none;
        width: 260px; max-width: none; flex-shrink: 0;
        border-right: 1px solid var(--c-border);
    }
    .sidebar-head { display: none; }
    .sidebar-overlay { display: none !important; }
    .sidebar-right { display: flex; }
    .chart-box { height: 400px; }
    .chart-box.half { height: 320px; }
    .mos-val-grid { grid-template-columns: repeat(5, 1fr); }
    .mos-metrics { grid-template-columns: repeat(3, 1fr); }
    .app-body { padding: 0; }
    .content { padding: 8px 12px; }
    .stock-card .price { font-size: 30px; }
    .tab-btn { font-size: 13px; padding: 10px 18px; }
}

/* ============ 大屏 (>= 1200px) ============ */
@media (min-width: 1200px) {
    .sidebar { width: 280px; }
    .sidebar-right { width: 320px; }
    .ind-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ 基本面分析面板 ============ */
.fund-dashboard {
    max-width: 900px;
    animation: fadeIn 0.3s ease;
}

.fund-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.fund-head h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-text1);
    margin: 0;
}

.fund-ind-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--c-blue-bg, #e8f0fe);
    color: var(--c-blue, #3b82f6);
    font-weight: 500;
}

.fund-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.fund-card {
    background: var(--c-card, #fff);
    border: 1px solid var(--c-border, #e8e9ee);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.fund-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.fund-label {
    font-size: 11px;
    color: var(--c-text3, #9ca3af);
    margin-bottom: 6px;
}

.fund-value {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

/* 持仓盈亏计算器 */
.fund-pnl-card {
    background: var(--c-card, #fff);
    border: 1px solid var(--c-border, #e8e9ee);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.fund-pnl-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--c-text2, #4b5563);
}

.pnl-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.pnl-input-row label {
    font-size: 12px;
    color: var(--c-text3, #9ca3af);
    white-space: nowrap;
}

.pnl-input-row input {
    width: 110px;
    padding: 8px 10px;
    border: 1px solid var(--c-border, #e8e9ee);
    border-radius: 8px;
    font-size: 14px;
    background: var(--c-bg, #fff);
    color: var(--c-text1, #1f2937);
    outline: none;
    transition: border-color 0.2s;
}

.pnl-input-row input:focus {
    border-color: var(--c-blue, #3b82f6);
}

.pnl-input-row button {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: var(--c-blue, #3b82f6);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pnl-input-row button:hover { opacity: 0.85; }

.pnl-result {
    min-height: 40px;
}

.pnl-hint {
    text-align: center;
    padding: 12px;
    color: var(--c-text3, #9ca3af);
    font-size: 13px;
}

.pnl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.pnl-item {
    background: var(--c-bg2, #f8f9fa);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.pnl-item.pnl-highlight {
    background: var(--c-blue-bg, #e8f0fe);
}

.pnl-label {
    font-size: 11px;
    color: var(--c-text3, #9ca3af);
    margin-bottom: 4px;
}

.pnl-val {
    font-size: 16px;
    font-weight: 700;
}

.pnl-advice {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--c-bg2, #f8f9fa);
    font-size: 13px;
    font-weight: 500;
}

/* 基本面评分 */
.fund-scores {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fund-score-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fund-score-label {
    width: 80px;
    font-size: 12px;
    color: var(--c-text2, #4b5563);
    flex-shrink: 0;
}

.fund-score-bar {
    flex: 1;
    height: 8px;
    background: var(--c-bg2, #f0f1f5);
    border-radius: 4px;
    overflow: hidden;
}

.fund-score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.fund-score-val {
    width: 30px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
}

/* 基本面点评 */
.fund-commentary {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 14px;
    background: var(--c-card, #fff);
    border: 1px solid var(--c-border, #e8e9ee);
    border-radius: 10px;
}

.fund-cmt-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.fund-cmt-text {
    font-size: 13px;
    line-height: 1.8;
    color: var(--c-text2, #4b5563);
}

/* 财务趋势表 */
.fund-history {
    margin-top: 16px;
    overflow-x: auto;
}

.fund-history h4 {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--c-text2, #4b5563);
}

.fund-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.fund-table th {
    background: var(--c-bg2, #f8f9fa);
    padding: 8px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--c-text2, #4b5563);
    border-bottom: 2px solid var(--c-border, #e8e9ee);
}

.fund-table td {
    padding: 7px 10px;
    text-align: center;
    border-bottom: 1px solid var(--c-border, #e8e9ee);
    color: var(--c-text1, #1f2937);
}

.fund-table tr:hover { background: var(--c-bg2, #f8f9fa); }

/* 移动端基本面面板适配 */
@media (max-width: 768px) {
    .fund-grid { grid-template-columns: repeat(2, 1fr); }
    .pnl-grid { grid-template-columns: repeat(2, 1fr); }
    .pnl-input-row input { width: 90px; }
    .fund-table { font-size: 11px; }
    .fund-table th, .fund-table td { padding: 6px 6px; }
}

/* ==================== AI 智能研报 ==================== */

.ai-toolbar {
    padding: 16px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-btn {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--r, 8px);
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, opacity .18s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .28);
    font-family: inherit;
}

.ai-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(99, 102, 241, .38);
}

.ai-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
}

.ai-hint {
    font-size: 12px;
    color: var(--c-text3, #9ca3af);
    line-height: 1.6;
}

.ai-report { padding: 0 14px 24px; }

.ai-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--c-text3, #9ca3af);
    font-size: 13px;
    line-height: 1.7;
    background: var(--c-hover, #f0f1f5);
    border: 1px dashed var(--c-border, #e8e9ee);
    border-radius: var(--r-lg, 12px);
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    color: var(--c-text2, #6b7280);
    font-size: 13px;
}

.ai-error {
    padding: 16px;
    border-radius: var(--r, 8px);
    background: var(--c-up-bg, #fef2f2);
    color: var(--c-up, #dc2626);
    font-size: 13px;
    line-height: 1.6;
}

.ai-meta {
    font-size: 12px;
    color: var(--c-text3, #9ca3af);
    padding: 6px 0 12px;
    border-bottom: 1px solid var(--c-border, #e8e9ee);
    margin-bottom: 14px;
}

.ai-content {
    font-size: 14px;
    color: var(--c-text, #1a1a2e);
    line-height: 1.78;
}

.ai-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #6366f1;
    margin: 18px 0 8px;
    padding-left: 9px;
    border-left: 3px solid #6366f1;
}

.ai-content h4:first-child { margin-top: 4px; }
.ai-content p { margin: 0 0 10px; }
.ai-content ul { margin: 0 0 12px; padding-left: 20px; }
.ai-content li { margin-bottom: 6px; }
.ai-content strong { font-weight: 600; color: var(--c-text, #1a1a2e); }

.ai-disclaimer {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--c-border, #e8e9ee);
    font-size: 11px;
    color: var(--c-text3, #9ca3af);
    text-align: center;
}

@media (max-width: 768px) {
    .ai-toolbar { padding: 12px 10px 10px; }
    .ai-report { padding: 0 10px 20px; }
    .ai-content { font-size: 13px; }
}

/* ============================================
   账号体系：顶部入口 / 登录注册弹窗 / 改密弹窗
   ============================================ */

.user-wrap { position: relative; flex-shrink: 0; }

.user-btn {
    display: flex; align-items: center; gap: 4px;
    height: 36px; padding: 0 10px;
    border: 1px solid var(--c-border); border-radius: var(--r);
    background: var(--c-surface); color: var(--c-text2);
    font-size: 12px; cursor: pointer; white-space: nowrap;
}
.user-btn:hover { background: var(--c-hover); }
.user-btn:active { background: var(--c-border); }
.user-btn.logged-in {
    color: var(--c-blue); border-color: #bfdbfe; background: var(--c-blue-bg);
}
.user-ico { font-size: 14px; line-height: 1; }
.user-name {
    max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-menu {
    position: absolute; top: 42px; right: 0; z-index: 210;
    min-width: 176px; padding: 6px;
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); box-shadow: var(--shadow-lg);
    display: none;
}
.user-menu.show { display: block; }
.um-head {
    padding: 8px 10px 10px; margin-bottom: 6px;
    border-bottom: 1px solid var(--c-border);
}
.um-phone { font-size: 13px; font-weight: 600; color: var(--c-text); word-break: break-all; }
.um-tag { font-size: 11px; color: var(--c-down); margin-top: 3px; }
.um-item {
    display: block; width: 100%; text-align: left;
    height: 34px; padding: 0 10px; border: none; border-radius: 6px;
    background: none; color: var(--c-text); font-size: 13px; cursor: pointer;
}
.um-item:hover { background: var(--c-hover); }
.um-item.danger { color: var(--c-up); }
.um-item.danger:hover { background: var(--c-up-bg); }

/* ---------- 弹窗 ---------- */
.auth-mask {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(17, 24, 39, .48);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.auth-mask.show { display: flex; }

.auth-modal {
    position: relative; width: 100%; max-width: 360px;
    max-height: calc(100vh - 40px); overflow-y: auto;
    padding: 26px 22px 22px;
    background: var(--c-surface); border-radius: var(--r-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
    animation: authIn .18s ease-out;
}
@keyframes authIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.auth-close {
    position: absolute; top: 10px; right: 12px;
    width: 30px; height: 30px;
    border: none; border-radius: 50%; background: none;
    color: var(--c-text3); font-size: 22px; line-height: 1; cursor: pointer;
}
.auth-close:hover { background: var(--c-hover); color: var(--c-text); }

.auth-head { text-align: center; margin-bottom: 18px; }
.auth-logo { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.auth-head h3 { font-size: 17px; font-weight: 700; }
.auth-head p { font-size: 12px; color: var(--c-text3); margin-top: 5px; line-height: 1.5; }

.auth-tabs {
    display: flex; gap: 4px; padding: 3px; margin-bottom: 16px;
    background: var(--c-bg); border-radius: var(--r);
}
.auth-tab {
    flex: 1; height: 32px; border: none; border-radius: 6px;
    background: none; color: var(--c-text2); font-size: 13px; cursor: pointer;
}
.auth-tab.active {
    background: var(--c-surface); color: var(--c-text); font-weight: 600;
    box-shadow: var(--shadow);
}

.auth-pane { display: none; }
.auth-pane.active { display: block; }

.auth-field { display: block; margin-bottom: 12px; }
.auth-field > span {
    display: block; font-size: 12px; color: var(--c-text2); margin-bottom: 5px;
}
.auth-field em { font-style: normal; color: var(--c-text3); }
.auth-field input {
    width: 100%; height: 40px; padding: 0 12px;
    border: 1px solid var(--c-border); border-radius: var(--r);
    background: var(--c-bg); color: var(--c-text); font-size: 14px; outline: none;
    transition: border-color .15s, background .15s;
}
.auth-field input:focus { border-color: var(--c-blue); background: var(--c-surface); }
.auth-field input::placeholder { color: var(--c-text3); }

.auth-err {
    min-height: 17px; margin-bottom: 6px;
    font-size: 12px; color: var(--c-up); line-height: 1.4;
}

.auth-submit {
    width: 100%; height: 42px;
    border: none; border-radius: var(--r);
    background: var(--c-blue); color: #fff;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.auth-submit:hover { background: #2563eb; }
.auth-submit:active { background: #1d4ed8; }
.auth-submit:disabled { opacity: .65; cursor: not-allowed; }

.auth-tip {
    margin-top: 12px; font-size: 11px; color: var(--c-text3);
    line-height: 1.6; text-align: center;
}

/* ---------- AI 未登录引导 ---------- */
.ai-lock {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 52px 28px; text-align: center;
}
.ai-lock-ico { font-size: 40px; margin-bottom: 12px; }
.ai-lock h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.ai-lock p {
    max-width: 300px; margin-bottom: 20px;
    font-size: 13px; color: var(--c-text2); line-height: 1.7;
}
.ai-lock p b { color: var(--c-blue); font-weight: 600; }
.ai-lock-btn {
    height: 40px; padding: 0 30px;
    border: none; border-radius: var(--r);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ai-lock-btn:active { opacity: .88; }

/* ---------- 对话里的登录按钮 ---------- */
.chat-login-btn {
    display: inline-block; margin-left: 6px;
    height: 26px; padding: 0 12px;
    border: none; border-radius: 13px;
    background: var(--c-blue); color: #fff;
    font-size: 12px; cursor: pointer; vertical-align: middle;
}

/* ---------- 全局轻提示 ---------- */
#appToast {
    position: fixed; left: 50%; bottom: 40px; z-index: 900;
    transform: translateX(-50%) translateY(16px);
    max-width: 80vw; padding: 10px 20px;
    background: rgba(26, 26, 46, .94); color: #fff;
    border-radius: 20px; font-size: 13px; line-height: 1.5;
    opacity: 0; pointer-events: none; transition: all .25s;
}
#appToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#appToast.err { background: rgba(220, 38, 38, .95); }

@media (max-width: 480px) {
    .auth-modal { padding: 22px 16px 18px; }
    .user-name { max-width: 54px; }
    .ai-lock { padding: 40px 16px; }
}

/* ============================================
   VIP 会员 / 充值
   ============================================ */

.user-btn.is-vip {
    color: #b45309; border-color: #fde68a; background: #fffbeb;
}
.um-tag.is-vip { color: #b45309; }
.um-item.vip { color: #b45309; font-weight: 600; }
.um-item.vip:hover { background: var(--c-amber-bg, #fffbeb); }

/* ---------- 弹窗头部 ---------- */
.vip-modal { max-width: 380px; }
.vip-head { text-align: center; margin-bottom: 14px; }
.vip-crown { font-size: 32px; line-height: 1; margin-bottom: 4px; }
.vip-head h3 { font-size: 17px; font-weight: 700; }
.vip-status {
    margin-top: 6px; font-size: 12px; color: var(--c-text2); line-height: 1.6;
}
.vip-status b { color: #b45309; font-size: 14px; }
.vip-exp { color: var(--c-text3); font-size: 11px; }

.vip-quota {
    padding: 9px 12px; margin-bottom: 14px;
    background: var(--c-amber-bg, #fffbeb); border: 1px solid #fde68a;
    border-radius: var(--r); font-size: 12px; color: #92400e; text-align: center;
}
.vip-quota b { font-size: 14px; }

/* ---------- 套餐卡 ---------- */
.vip-plans {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px;
}
.vip-plan {
    position: relative; padding: 14px 10px 12px; cursor: pointer;
    background: var(--c-bg); border: 2px solid var(--c-border);
    border-radius: var(--r-lg); text-align: center;
    transition: border-color .15s, background .15s, transform .12s;
}
.vip-plan:active { transform: scale(.98); }
.vip-plan.selected {
    border-color: #f59e0b; background: #fffbeb;
    box-shadow: 0 2px 10px rgba(245, 158, 11, .16);
}
.vip-plan-tag {
    position: absolute; top: -9px; right: 8px;
    padding: 1px 8px; border-radius: 20px;
    background: #f59e0b; color: #fff; font-size: 10px; font-weight: 600;
}
.vip-plan-name { font-size: 13px; font-weight: 600; color: var(--c-text); }
.vip-plan-price { margin: 4px 0 2px; color: #b45309; }
.vip-plan-price i {
    font-style: normal; font-size: 12px; margin-right: 1px;
}
.vip-plan-price {
    font-size: 26px; font-weight: 700; letter-spacing: -1px;
}
.vip-plan-sub { font-size: 10px; color: var(--c-text3); }
.vip-plan-save {
    display: inline-block; margin-top: 5px; padding: 1px 6px;
    background: #fef3c7; color: #b45309; border-radius: 4px;
    font-size: 10px; font-weight: 600;
}

.vip-buy {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.vip-buy:hover { background: linear-gradient(135deg, #f59e0b, #b45309); }

.vip-notice {
    margin-top: 12px; font-size: 11px; color: var(--c-text3);
    line-height: 1.7; text-align: center;
}
.vip-law { color: #9ca3af; }

.vip-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 16px 0 10px; color: var(--c-text3); font-size: 11px;
}
.vip-divider::before, .vip-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--c-border);
}

.vip-redeem { display: flex; gap: 8px; }
.vip-redeem input {
    flex: 1; height: 38px; padding: 0 10px; min-width: 0;
    border: 1px solid var(--c-border); border-radius: var(--r);
    background: var(--c-bg); font-size: 13px; outline: none;
    text-transform: uppercase;
}
.vip-redeem input:focus { border-color: var(--c-blue); background: var(--c-surface); }
.vip-redeem button {
    height: 38px; padding: 0 16px; border: none; border-radius: var(--r);
    background: var(--c-text); color: #fff; font-size: 13px; cursor: pointer;
    white-space: nowrap;
}
.vip-redeem button:active { opacity: .85; }

.vip-link {
    display: block; width: 100%; margin-top: 12px;
    background: none; border: none; color: var(--c-text3);
    font-size: 12px; text-align: center; cursor: pointer;
}
.vip-link:hover { color: var(--c-blue); }

/* ---------- 支付视图 ---------- */
.vip-back {
    display: inline-block; margin-bottom: 12px;
    background: none; border: none; color: var(--c-text3);
    font-size: 13px; cursor: pointer; padding: 0;
}
.vip-back:hover { color: var(--c-blue); }
.vip-pay-head { text-align: center; margin-bottom: 14px; }
.vip-pay-amount { font-size: 13px; color: var(--c-text2); }
.vip-pay-amount b { font-size: 28px; color: #b45309; letter-spacing: -1px; }
.vip-order-no { margin-top: 6px; font-size: 12px; color: var(--c-text3); }
.vip-order-no span { color: var(--c-text); font-family: ui-monospace, monospace; }

.vip-qr-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.vip-qr-tab {
    flex: 1; height: 36px; border: 1px solid var(--c-border); border-radius: var(--r);
    background: var(--c-bg); color: var(--c-text2); font-size: 13px; cursor: pointer;
}
.vip-qr-tab.active {
    border-color: #16a34a; background: #f0fdf4; color: #15803d; font-weight: 600;
}

.vip-qr-box { text-align: center; }
.vip-qr {
    max-width: 210px; max-height: 210px; width: auto; height: auto;
    border: 1px solid var(--c-border); border-radius: var(--r);
}
.vip-qr-missing {
    padding: 34px 16px; color: var(--c-text3); font-size: 13px; line-height: 1.8;
    background: var(--c-bg); border: 1px dashed var(--c-border); border-radius: var(--r);
}
.vip-qr-missing span { font-size: 11px; }
.vip-qr-cap { margin-top: 10px; font-size: 12px; color: var(--c-text2); line-height: 1.6; }
.vip-qr-cap b { color: var(--c-text); }

.vip-pay-tip {
    margin: 12px 0; padding: 10px 12px;
    background: var(--c-bg); border-radius: var(--r);
    font-size: 11px; color: var(--c-text2); line-height: 1.9;
}
.vip-msg { margin-top: 10px; font-size: 12px; color: #15803d; text-align: center; }

/* ---------- 订单记录 ---------- */
.vip-order-list { display: flex; flex-direction: column; gap: 8px; }
.vip-order {
    padding: 10px 12px; background: var(--c-bg); border-radius: var(--r);
}
.vip-order-top { display: flex; align-items: center; gap: 8px; }
.vip-order-plan { font-size: 13px; font-weight: 600; flex: 1; }
.vip-order-st { font-size: 11px; padding: 1px 7px; border-radius: 20px; }
.vip-order-st.st-paid { background: #f0fdf4; color: #15803d; }
.vip-order-st.st-submitted { background: #fffbeb; color: #b45309; }
.vip-order-st.st-pending { background: #f3f4f6; color: var(--c-text2); }
.vip-order-st.st-cancelled { background: #f3f4f6; color: var(--c-text3); }
.vip-order-mid { margin-top: 4px; font-size: 12px; color: var(--c-text); }
.vip-order-time { margin-top: 2px; font-size: 10px; color: var(--c-text3); }
.vip-empty { padding: 28px 0; text-align: center; color: var(--c-text3); font-size: 13px; }

/* ---------- AI 面板额度条 / VIP 按钮 ---------- */
/* 注意：上方 933 行的 .ai-toolbar 是纵向布局，这里必须显式改回横向，
   否则「生成研报」和「开通 VIP」两个按钮会叠在一起 */
.ai-toolbar {
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
}
.ai-toolbar .ai-btn { width: auto; flex: 1; }
.ai-vip-btn {
    flex: 0 0 auto; height: auto; min-height: 38px; padding: 0 14px;
    border: 1px solid #fde68a; border-radius: var(--r);
    background: #fffbeb; color: #b45309;
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.ai-vip-btn:active { background: #fef3c7; }

.ai-quota {
    margin: 0 10px 10px; padding: 7px 12px;
    background: var(--c-bg); border-radius: var(--r);
    font-size: 12px; color: var(--c-text2); text-align: center;
}
.ai-quota b { color: var(--c-text); }
.ai-quota.is-vip { background: var(--c-amber-bg, #fffbeb); color: #92400e; }

@media (max-width: 480px) {
    .vip-plans { gap: 8px; }
    .vip-plan-price { font-size: 22px; }
    .ai-toolbar { flex-wrap: wrap; }
    .ai-vip-btn { flex: 1; }
}
