/* ============================================================
   BPA · Binance Price Alert — Design System v2
   设计语言：专业交易终端（Trading Terminal）
   深色画布 + 品牌金 + 行情红绿（中国习惯：涨红跌绿）
   ============================================================ */

:root {
    /* ---- 背景层级（Elevation：越亮越高） ---- */
    --bg-0: #07090d;
    --bg-1: #0b0e14;
    --bg-2: #10151e;
    --surface-1: rgba(255, 255, 255, 0.03);
    --surface-2: rgba(255, 255, 255, 0.055);
    --surface-3: rgba(255, 255, 255, 0.09);
    --surface-overlay: rgba(16, 21, 30, 0.92);

    /* ---- 边框 ---- */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);

    /* ---- 文字 ---- */
    --text-1: #eceef2;
    --text-2: #a6aebb;
    --text-3: #6b7380;
    --text-4: #4a4f5a;

    /* ---- 品牌金 ---- */
    --brand: #f0b90b;
    --brand-hi: #fcd535;
    --brand-ink: #171200;      /* 金底上的深色文字 */
    --brand-dim: rgba(240, 185, 11, 0.12);
    --brand-glow: rgba(240, 185, 11, 0.28);

    /* ---- 行情色（涨红跌绿） ---- */
    --up: #f6465d;
    --up-dim: rgba(246, 70, 93, 0.12);
    --up-glow: rgba(246, 70, 93, 0.32);
    --down: #2ebd85;
    --down-dim: rgba(46, 189, 133, 0.12);
    --down-glow: rgba(46, 189, 133, 0.32);
    --warn: #f0b90b;
    --info: #4c9aff;

    /* ---- 阴影 ---- */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-3: 0 12px 48px rgba(0, 0, 0, 0.55);

    /* ---- 圆角 ---- */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;

    /* ---- 动效 ---- */
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --t-fast: 0.15s var(--ease);
    --t-med: 0.25s var(--ease);

    /* ---- 字体 ---- */
    --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

    /* 顶栏高度（供布局计算） */
    --topbar-h: 56px;
}

/* ============ Reset & Base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    background: var(--bg-0);
    color: var(--text-1);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* 全局氛围光（极淡，提升质感） */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 90% 45% at 50% -15%, rgba(240, 185, 11, 0.05), transparent),
        radial-gradient(ellipse 55% 40% at 88% 90%, rgba(46, 189, 133, 0.035), transparent),
        radial-gradient(ellipse 55% 40% at 8% 88%, rgba(246, 70, 93, 0.03), transparent);
    z-index: 0;
}

a { color: var(--brand); text-decoration: none; transition: var(--t-fast); }
a:hover { color: var(--brand-hi); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
h2 { font-size: 19px; margin-bottom: 6px; }
h3 { font-size: 15px; }

::selection { background: rgba(240, 185, 11, 0.28); }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* 数字统一用等宽字体 + 表格数字 */
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.09);
    border-radius: 5px;
    border: 2px solid var(--bg-0);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* ============ 表单 ============ */
input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-1);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 13px;
    width: 100%;
    outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.14);
    background: rgba(0, 0, 0, 0.45);
}
input::placeholder { color: var(--text-4); }
input[type=checkbox] { width: auto; margin-right: 4px; accent-color: var(--brand); }
input[type=number] { font-family: var(--font-mono); }
select { cursor: pointer; appearance: none; padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a6aebb' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
select option { background: var(--bg-2); color: var(--text-1); }

.form-row { display: flex; gap: 10px; align-items: center; }
.form-row > input { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label {
    font-size: 12.5px;
    color: var(--text-2);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.form-error { color: var(--up); font-size: 13px; min-height: 20px; margin-top: 4px; }

/* ============ 按钮 ============ */
button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    border: none;
    outline: none;
    white-space: nowrap;
    transition: var(--t-fast);
    user-select: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--r-md);
    background: linear-gradient(180deg, var(--brand-hi), var(--brand));
    color: var(--brand-ink);
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow: var(--shadow-2), 0 0 20px var(--brand-glow);
    transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(0); filter: brightness(0.97); }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-1);
    border: 1px solid var(--border);
    box-shadow: none;
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--border-strong);
    filter: none;
    box-shadow: var(--shadow-1);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(180deg, #ff5c72, var(--up));
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    box-shadow: var(--shadow-2), 0 0 20px var(--up-glow);
}

.btn-text {
    background: none;
    color: var(--text-2);
    padding: 6px 10px;
    border-radius: var(--r-sm);
    font-weight: 500;
}
.btn-text:hover { color: var(--text-1); background: var(--surface-2); }
.btn-text.danger { color: var(--up); }
.btn-text.danger:hover { background: var(--up-dim); }
.btn-text.brand { color: var(--brand); }
.btn-text.brand:hover { background: var(--brand-dim); }

.btn-icon {
    background: var(--surface-2);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; line-height: 1; padding: 0;
    font-weight: 500;
}
.btn-icon:hover { background: var(--surface-3); border-color: var(--border-strong); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--r-sm); }

/* 按钮 loading 态 */
.btn.is-loading { pointer-events: none; opacity: 0.7; }
.btn.is-loading::before {
    content: '';
    width: 13px; height: 13px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 卡片 ============ */
.card {
    position: relative;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 22px;
    margin-bottom: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-1);
    transition: border-color var(--t-med);
}
.card:hover { border-color: var(--border-strong); }

.card h3 {
    font-size: 14.5px;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 9px;
}
.card h3::before {
    content: '';
    width: 3px; height: 15px;
    background: linear-gradient(180deg, var(--brand-hi), var(--brand));
    border-radius: 2px;
    flex-shrink: 0;
}

.muted { color: var(--text-2); font-size: 13px; }
.small { font-size: 12px; }

/* ============ 品牌 Logo ============ */
.logo {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 17px;
    letter-spacing: 0.02em;
    color: var(--text-1);
}
.logo-mark {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand-hi), var(--brand));
    border-radius: 8px;
    color: var(--brand-ink);
    box-shadow: 0 2px 10px var(--brand-glow);
    flex-shrink: 0;
}
.logo-mark svg { width: 16px; height: 16px; }
.logo .beta-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--brand);
    background: var(--brand-dim);
    border: 1px solid rgba(240, 185, 11, 0.3);
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
}

/* ============ 连接状态点 ============ */
.ws-status {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--text-3);
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-1);
}
.ws-status .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-4);
    transition: var(--t-fast);
}
.ws-status.connected .dot {
    background: var(--down);
    box-shadow: 0 0 8px var(--down-glow);
    animation: pulse 2.4s ease-in-out infinite;
}
.ws-status.connected { color: var(--down); border-color: rgba(46, 189, 133, 0.25); }
.ws-status.reconnecting .dot { background: var(--warn); box-shadow: 0 0 8px var(--brand-glow); }
.ws-status.reconnecting { color: var(--warn); border-color: rgba(240, 185, 11, 0.25); }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ============ 登录 / 注册页 ============ */
.auth-page {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* 左侧品牌面板（≥900px 显示） */
.auth-brand {
    flex: 1.15;
    display: none;
    position: relative;
    overflow: hidden;
    padding: 56px;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--border);
    background:
        radial-gradient(ellipse 70% 55% at 30% 20%, rgba(240, 185, 11, 0.09), transparent),
        radial-gradient(ellipse 60% 50% at 80% 85%, rgba(46, 189, 133, 0.06), transparent),
        var(--bg-1);
}
.auth-brand::before {
    /* 网格纹理 */
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 80% 70% at 40% 30%, black, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 40% 30%, black, transparent 75%);
}
.auth-brand > * { position: relative; }
@media (min-width: 900px) { .auth-brand { display: flex; } }

.auth-brand .brand-headline {
    font-size: clamp(28px, 3.4vw, 40px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    max-width: 520px;
}
.auth-brand .brand-headline em {
    font-style: normal;
    background: linear-gradient(120deg, var(--brand-hi), var(--brand));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-brand .brand-sub {
    margin-top: 16px;
    color: var(--text-2);
    font-size: 15px;
    max-width: 460px;
    line-height: 1.7;
}
.auth-features { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.auth-feature {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.auth-feature .f-icon {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--brand);
    flex-shrink: 0;
}
.auth-feature .f-icon svg { width: 17px; height: 17px; }
.auth-brand .brand-foot { color: var(--text-4); font-size: 12px; }

/* 右侧表单区 */
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    z-index: 1;
}
.auth-container { width: 100%; max-width: 400px; animation: fadeUp 0.5s var(--ease); }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 38px 34px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-3);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(240, 185, 11, 0.55), transparent);
}
.auth-card .auth-logo { margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; letter-spacing: -0.01em; }
.auth-card .subtitle { color: var(--text-2); font-size: 13px; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .btn { margin-top: 4px; padding: 11px; font-size: 14.5px; }
.auth-footer { text-align: center; margin-top: 22px; font-size: 13px; color: var(--text-2); }
.auth-notice {
    margin-top: 18px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    background: var(--brand-dim);
    border: 1px solid rgba(240, 185, 11, 0.22);
    color: var(--brand);
    font-size: 12.5px;
    line-height: 1.6;
}

/* ============ 顶栏 ============ */
.topbar {
    display: flex;
    align-items: center;
    height: var(--topbar-h);
    padding: 0 20px;
    gap: 20px;
    position: sticky; top: 0; z-index: 100;
    background: rgba(7, 9, 13, 0.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}

.nav-tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }

.tab {
    background: none;
    color: var(--text-2);
    padding: 7px 15px;
    border-radius: var(--r-md);
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}
.tab:hover { color: var(--text-1); background: var(--surface-2); }
.tab.active { color: var(--brand); background: var(--brand-dim); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-2);
    padding: 4px 4px 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-1);
}
.user-chip .avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-hi), var(--brand));
    color: var(--brand-ink);
    font-size: 11px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    text-transform: uppercase;
}
#username-display { color: var(--text-1); font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* ============ 主内容区 ============ */
.main { position: relative; z-index: 1; padding: 22px; max-width: 1680px; margin: 0 auto; }

.tab-content { display: none; animation: fadeIn 0.28s var(--ease); }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page-head { margin-bottom: 20px; }
.page-head > p.muted { margin-top: 4px; }

/* ============ 看板布局 ============ */
.dashboard-layout {
    display: grid;
    grid-template-columns: 264px 1fr;
    gap: 16px;
    height: calc(100vh - var(--topbar-h) - 44px);
    min-height: 560px;
}

.symbol-sidebar {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    display: flex; flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h3 { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: 0.04em; text-transform: uppercase; }

.symbol-list { list-style: none; overflow-y: auto; flex: 1; padding: 8px; }

.symbol-item {
    padding: 11px 12px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background var(--t-fast);
    margin-bottom: 2px;
    position: relative;
    border: 1px solid transparent;
}
.symbol-item:hover { background: var(--surface-2); }
.symbol-item.active {
    background: var(--brand-dim);
    border-color: rgba(240, 185, 11, 0.22);
}
.symbol-item.active::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 55%;
    background: var(--brand);
    border-radius: 0 2px 2px 0;
}
.symbol-item .sym-name { font-weight: 600; font-size: 13.5px; letter-spacing: 0.01em; }
.symbol-item .sym-price {
    font-size: 12px; color: var(--text-2);
    margin-top: 3px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    display: flex; align-items: center; gap: 8px;
}
.symbol-item .sym-change { font-weight: 600; padding: 1px 6px; border-radius: 4px; font-size: 11px; }
.symbol-item .sym-change.up { color: var(--up); background: var(--up-dim); }
.symbol-item .sym-change.down { color: var(--down); background: var(--down-dim); }

/* ============ 图表区 ============ */
.chart-area {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    display: flex; flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.chart-toolbar {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.symbol-name {
    font-size: 17px; font-weight: 700;
    letter-spacing: -0.01em;
    font-family: var(--font-mono);
}

.price-info { display: flex; align-items: baseline; gap: 10px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.price-info .price { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; transition: color 0.3s; }
.price-info .price.up-flash { animation: flashUp 0.55s var(--ease); }
.price-info .price.down-flash { animation: flashDown 0.55s var(--ease); }
@keyframes flashUp {
    0%, 100% { color: var(--text-1); }
    40% { color: var(--up); text-shadow: 0 0 14px var(--up-glow); }
}
@keyframes flashDown {
    0%, 100% { color: var(--text-1); }
    40% { color: var(--down); text-shadow: 0 0 14px var(--down-glow); }
}
.price-info .change { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-sm); }
.price-info .change.up { color: var(--up); background: var(--up-dim); }
.price-info .change.down { color: var(--down); background: var(--down-dim); }

/* 周期选择（分段控件） */
.interval-selector {
    display: flex; gap: 2px;
    margin-left: auto;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
}
.interval-btn {
    background: transparent;
    color: var(--text-2);
    border-radius: 7px;
    padding: 5px 11px;
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
}
.interval-btn:hover { color: var(--text-1); }
.interval-btn.active {
    background: var(--surface-3);
    color: var(--brand);
    box-shadow: inset 0 0 0 1px rgba(240, 185, 11, 0.35);
}

.chart-actions { display: flex; gap: 8px; }

#chart { flex: 1; position: relative; min-height: 320px; background: transparent; }

/* 图表加载态 */
.chart-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(7, 9, 13, 0.55);
    backdrop-filter: blur(2px);
    z-index: 50;
    color: var(--text-2);
    font-size: 13px;
    gap: 10px;
    animation: fadeIn 0.2s var(--ease);
}
.chart-loading::before {
    content: '';
    width: 16px; height: 16px;
    border: 2px solid var(--brand);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.indicator-toggles {
    display: flex; gap: 18px;
    padding: 9px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-2);
    font-weight: 500;
    flex-wrap: wrap;
}
.indicator-toggles label {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; user-select: none;
    transition: var(--t-fast);
}
.indicator-toggles label:hover { color: var(--text-1); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    min-width: 640px;
}
.table th {
    text-align: left;
    padding: 11px 14px;
    color: var(--text-3);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-1);
    vertical-align: middle;
}
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: none; }
.table code {
    font-family: var(--font-mono);
    font-size: 11px;
    background: rgba(0, 0, 0, 0.35);
    padding: 3px 7px;
    border-radius: 5px;
    color: var(--text-2);
}
.table .actions { display: flex; gap: 2px; }

/* 空状态 */
.empty-state { text-align: center; padding: 44px 20px !important; color: var(--text-2); }
.empty-state .empty-icon {
    width: 44px; height: 44px;
    margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-3);
}
.empty-state .empty-icon svg { width: 20px; height: 20px; }
.empty-state .empty-title { font-weight: 600; color: var(--text-1); margin-bottom: 4px; font-size: 14px; }
.empty-state .empty-sub { font-size: 12.5px; color: var(--text-3); }

/* ============ 徽章 ============ */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    margin-right: 6px;
    background: currentColor;
}
.badge.active { background: var(--down-dim); color: var(--down); border-color: rgba(46, 189, 133, 0.28); }
.badge.inactive { background: rgba(148, 163, 184, 0.1); color: var(--text-2); border-color: rgba(148, 163, 184, 0.2); }
.badge.horizontal { background: rgba(76, 154, 255, 0.12); color: var(--info); border-color: rgba(76, 154, 255, 0.28); }
.badge.range { background: var(--brand-dim); color: var(--brand); border-color: rgba(240, 185, 11, 0.28); }
.badge.trend { background: var(--down-dim); color: var(--down); border-color: rgba(46, 189, 133, 0.28); }

/* ============ Toggle 开关 ============ */
.toggle { position: relative; display: inline-block; width: 42px; height: 23px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 23px;
    transition: var(--t-fast);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 15px; height: 15px;
    left: 3px; top: 50%;
    transform: translateY(-50%);
    background: var(--text-2);
    border-radius: 50%;
    transition: var(--t-fast);
}
.toggle input:checked + .toggle-slider { background: var(--down); border-color: var(--down); }
.toggle input:checked + .toggle-slider::before { transform: translate(18px, -50%); background: #fff; }
.toggle input:focus-visible + .toggle-slider { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 拖动排序 */
#symbols-table tbody tr { transition: background var(--t-fast); }
#symbols-table tbody tr[draggable=true] { cursor: grab; }
#symbols-table tbody tr[draggable=true]:active { cursor: grabbing; }
#symbols-table tbody tr.dragging { opacity: 0.4; }
#symbols-table td:first-child { cursor: grab; width: 36px; text-align: center; color: var(--text-4); user-select: none; }

/* ============ 热门品种网格 ============ */
.popular-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; align-items: start; }
.popular-card {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-1);
    transition: var(--t-fast);
    overflow: hidden;
}
.popular-card:hover { border-color: var(--border-strong); background: var(--surface-2); cursor: pointer; }
.popular-card .p-name {
    font-family: var(--font-ui); font-weight: 600; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.popular-card .p-code {
    font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.popular-card .p-vol { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.popular-card .p-price { font-family: var(--font-mono); font-weight: 600; font-size: 13px; text-align: right; }
.popular-card .p-chg { font-size: 11px; margin-top: 2px; text-align: right; font-family: var(--font-mono); font-weight: 600; }
.popular-card .popular-card-summary { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex: 1; cursor: pointer; }
.popular-card .popular-card-summary:hover .p-name { color: var(--text-1); }

/* 展开详情 */
.popular-card {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    overflow: hidden;
}
.popular-card .popular-card-summary { padding: 11px 13px; }
.popular-card .popular-card-detail {
    display: none;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    animation: slideDown 0.2s var(--ease);
}
.popular-card.expanded .popular-card-detail { display: block; }
.popular-card.expanded .popular-card-summary .p-name { color: var(--brand); }
.popular-card.expanded { grid-column: 1 / -1; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.pcd-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 12px; }
.pcd-title { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 2px; }
.pcd-sector { font-size: 11.5px; color: var(--text-3); }
.pcd-desc { font-size: 13px; line-height: 1.7; color: var(--text-2); margin: 0 0 12px; }
.pcd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px 12px; }
.pcd-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; background: var(--surface-3); border-radius: var(--r-sm); }
.pcd-l { font-size: 11px; color: var(--text-3); }
.pcd-v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.popular-add-detail { background: var(--brand-dim); color: var(--brand); border: 1px solid var(--brand); border-radius: var(--r-sm); padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.popular-add-detail:hover { background: var(--brand); color: var(--brand-ink); }

/* ============ 模态框 ============ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(4, 5, 8, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.18s var(--ease); }

.modal {
    background: var(--surface-overlay);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow-y: auto;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow: var(--shadow-3);
    animation: modalIn 0.28s var(--ease);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15.5px; font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 15px; }

/* ============ Toast ============ */
#toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 2000;
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-overlay);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-3);
    font-size: 13px; font-weight: 500;
    max-width: 360px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: toastIn 0.3s var(--ease);
    pointer-events: auto;
}
.toast.hiding { animation: toastOut 0.25s var(--ease) forwards; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(14px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(8px) scale(0.97); }
}
.toast .t-icon { flex-shrink: 0; width: 18px; height: 18px; }
.toast.success { border-left: 3px solid var(--down); }
.toast.success .t-icon { color: var(--down); }
.toast.error { border-left: 3px solid var(--up); }
.toast.error .t-icon { color: var(--up); }
.toast.info { border-left: 3px solid var(--brand); }
.toast.info .t-icon { color: var(--brand); }

/* ============ 涨跌通用 ============ */
.change.up { color: var(--up); }
.change.down { color: var(--down); }

/* ============ 骨架屏 ============ */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}
.skeleton::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ============ 点击 K 线浮层 ============ */
#chart-click-popup {
    background: var(--surface-overlay);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 10px 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-3), 0 0 24px rgba(240, 185, 11, 0.12);
    animation: popIn 0.16s var(--ease);
    min-width: 148px;
    user-select: none;
    transition: opacity 0.2s;
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.pop-price {
    font-family: var(--font-mono);
    font-size: 17px; font-weight: 700;
    text-align: center;
    padding: 4px 0 9px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.pop-actions { display: flex; flex-direction: column; gap: 5px; }
.pop-btn {
    padding: 7px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    font-size: 12px; font-weight: 600;
    text-align: center;
    background: var(--surface-2);
    color: var(--text-1);
}
.pop-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.pop-btn-down { color: var(--up); border-color: rgba(246, 70, 93, 0.3); background: var(--up-dim); }
.pop-btn-down:hover { background: rgba(246, 70, 93, 0.2); border-color: rgba(246, 70, 93, 0.45); }
.pop-btn-up { color: var(--down); border-color: rgba(46, 189, 133, 0.3); background: var(--down-dim); }
.pop-btn-up:hover { background: rgba(46, 189, 133, 0.2); border-color: rgba(46, 189, 133, 0.45); }
.pop-btn-both { color: var(--brand); border-color: rgba(240, 185, 11, 0.3); background: var(--brand-dim); }
.pop-btn-both:hover { background: rgba(240, 185, 11, 0.2); border-color: rgba(240, 185, 11, 0.45); }

/* ============ 管理员统计卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px;
    transition: border-color var(--t-fast);
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card .stat-label { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; font-family: var(--font-mono); letter-spacing: -0.02em; }
.stat-card .stat-sub { color: var(--text-3); font-size: 11.5px; margin-top: 3px; }

/* ============ 设置页 ============ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.settings-grid .card { margin-bottom: 0; }
.cfg-status { margin-top: 10px; }
.code-inline {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--brand);
}
.kv-list { display: flex; flex-direction: column; gap: 10px; }
.kv-list .kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; }
.kv-list .kv .k { color: var(--text-2); }
.kv-list .kv .v { font-weight: 600; text-align: right; word-break: break-all; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
    .dashboard-layout { grid-template-columns: 220px 1fr; }
}

@media (max-width: 820px) {
    .dashboard-layout { grid-template-columns: 1fr; height: auto; }
    .symbol-sidebar { max-height: 240px; }
    .topbar { gap: 10px; padding: 0 12px; flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding-top: 8px; padding-bottom: 8px; }
    .nav-tabs { order: 3; width: 100%; }
    .nav-tabs .tab { padding: 6px 11px; font-size: 13px; }
    .topbar-right { margin-left: auto; }
    .ws-status .ws-label { display: none; }
    .main { padding: 12px; }
    .chart-toolbar { gap: 10px; padding: 11px 12px; }
    .price-info .price { font-size: 19px; }
    .interval-selector { order: 3; margin-left: 0; width: 100%; justify-content: center; }
    .chart-actions { width: 100%; }
    .chart-actions .btn { flex: 1; }
    #chart { min-height: 380px; }
    .auth-card { padding: 30px 22px; }
    .settings-grid { grid-template-columns: 1fr; }
    #toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { max-width: none; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
