/* ==========================================================================
   赛博朋克 HUD 主题 · 多账户交易系统
   设计技能: .dsh/skills/cyberpunk-ui/SKILL.md
   ========================================================================== */

:root {
    color-scheme: dark;
    --bg: #04050c;
    --bg-2: #070a14;
    --surface: rgba(10, 15, 30, .92);
    --surface-2: #101a2e;
    --surface-3: #0a1222;
    --border: #1c2c46;
    --text: #e6f7ff;
    --muted: #7d92ad;
    --cyan: #00e5ff;
    --cyan-soft: #9feeff;
    --green: #00ff9f;
    --magenta: #ff2a6d;
    --magenta-soft: #ff9ab5;
    --amber: #ffb300;
    --purple: #a06bff;
    --radius: 14px;
    --cut: 13px;
    --glow-cyan: 0 0 12px rgba(0, 229, 255, .35);
    --glow-green: 0 0 12px rgba(0, 255, 159, .3);
    --glow-magenta: 0 0 12px rgba(255, 42, 109, .3);
    --glow-amber: 0 0 12px rgba(255, 179, 0, .28);
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", "Segoe UI Mono", monospace;
    --shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at 12% -8%, rgba(0, 229, 255, .13), transparent 44%),
        radial-gradient(circle at 88% 108%, rgba(255, 42, 109, .11), transparent 46%),
        linear-gradient(rgba(0, 229, 255, .03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, .03) 1px, transparent 1px),
        var(--bg);
    background-size: auto, auto, 42px 42px, 42px 42px, auto;
    background-attachment: fixed;
}
/* 极淡全屏扫描线：几乎不可见，只增加纹理 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(140, 220, 255, .012) 3px 4px);
}

button, input, select, textarea { font: inherit; }
button, .button, input, select, summary { min-height: 44px; }
button, .button {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 15px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
    transition: border-color .16s, box-shadow .16s, filter .16s, background .16s;
}
button:hover, .button:hover { filter: brightness(1.16); border-color: rgba(0, 229, 255, .55); box-shadow: var(--glow-cyan); }
button:focus-visible, input:focus-visible, summary:focus-visible, .button:focus-visible {
    outline: 2px solid rgba(0, 229, 255, .65);
    outline-offset: 2px;
}
button:disabled { opacity: .55; cursor: wait; }
.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary { background: linear-gradient(135deg, #00b8dd, #0077ff); color: #03101a; border-color: rgba(0, 229, 255, .6); }
.primary:hover { box-shadow: 0 0 16px rgba(0, 170, 255, .55); }
.success { background: linear-gradient(135deg, #00e08a, #00996a); color: #02130c; border-color: rgba(0, 255, 159, .55); }
.success:hover { box-shadow: var(--glow-green); }
.danger { background: linear-gradient(135deg, #ff2a6d, #b01246); color: #1a020a; border-color: rgba(255, 42, 109, .6); }
.danger:hover { box-shadow: var(--glow-magenta); }
.warning { background: linear-gradient(135deg, #ffb300, #c77800); color: #191002; border-color: rgba(255, 179, 0, .6); }
.warning:hover { box-shadow: var(--glow-amber); }
.ghost { background: transparent; border: 1px solid var(--border); }
.small { min-height: 38px; padding: 7px 11px; font-size: 13px; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(5, 8, 18, .92);
    color: var(--text);
    font-size: 16px;
    transition: border-color .16s, box-shadow .16s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(0, 229, 255, .75);
    box-shadow: 0 0 0 1px rgba(0, 229, 255, .35), 0 0 12px rgba(0, 229, 255, .22);
}
select option { background: #0a1222; }
textarea { resize: vertical; min-height: 92px; }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
label > input, label > select { margin-top: 6px; }
.field-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid .wide { grid-column: 1 / -1; }

.shell { width: min(1160px, 100%); margin: 0 auto; padding: 18px 18px 98px; }
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.app-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, var(--cyan), rgba(160, 107, 255, .6) 55%, transparent 85%);
    box-shadow: 0 0 8px rgba(0, 229, 255, .7);
}
.app-header h1 { margin: 0; font-size: clamp(21px, 4vw, 28px); letter-spacing: -.01em; text-shadow: 0 0 18px rgba(0, 229, 255, .18); }
.eyebrow {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .2em;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 229, 255, .6);
}
.subtle { color: var(--muted); }

.card {
    border: 1px solid var(--border);
    background: linear-gradient(158deg, rgba(15, 24, 44, .94), rgba(6, 10, 21, .95) 55%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
    filter: drop-shadow(0 0 16px rgba(0, 229, 255, .05));
    transition: border-color .2s;
}
.card:hover { border-color: #2b4a75; }
.card + .card, .section + .section { margin-top: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.section-title h2, .section-title h3 { margin: 0; font-size: 18px; color: #d9f6ff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat {
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(10, 18, 34, .95), rgba(6, 10, 20, .95));
    border-radius: 12px;
    padding: 12px;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: linear-gradient(180deg, var(--cyan), transparent);
    opacity: .7;
}
.stat-label { display: block; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.stat-value {
    display: block;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: clamp(17px, 3vw, 22px);
    font-weight: 800;
    overflow-wrap: anywhere;
    text-shadow: 0 0 14px rgba(0, 229, 255, .22);
}
.positive { color: #6dffc4; text-shadow: 0 0 12px rgba(0, 255, 159, .4); }
.negative { color: #ff8fa8; text-shadow: 0 0 12px rgba(255, 42, 109, .4); }

.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-card { min-width: 0; }
.account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.account-head h3 { margin: 0; overflow-wrap: anywhere; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric {
    background: var(--surface-3);
    border: 1px solid rgba(28, 44, 70, .6);
    border-radius: 10px;
    padding: 9px;
    min-width: 0;
}
.metric span { display: block; color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.metric strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 14px; }
.list { display: grid; gap: 7px; margin-top: 10px; }
.list-item {
    background: var(--surface-3);
    border: 1px solid rgba(28, 44, 70, .45);
    border-radius: 10px;
    padding: 9px 10px;
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
    font-size: 13px;
}
details { margin-top: 10px; border-top: 1px solid var(--border); }
summary { display: flex; align-items: center; cursor: pointer; padding-top: 10px; color: #a9cbe6; transition: color .15s; }
summary:hover { color: var(--cyan-soft); text-shadow: 0 0 8px rgba(0, 229, 255, .35); }
.error-box { border-color: rgba(255, 42, 109, .6); }
.error-text { color: var(--magenta-soft); overflow-wrap: anywhere; }
.empty { color: var(--muted); text-align: center; padding: 26px 12px; }

.status-pill {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    border-radius: 999px;
    padding: 3px 9px;
    border: 1px solid rgba(0, 229, 255, .35);
    background: rgba(0, 229, 255, .07);
    color: var(--cyan-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-shadow: 0 0 8px rgba(0, 229, 255, .35);
}
.status-pill.ok {
    border-color: rgba(0, 255, 159, .5);
    background: rgba(0, 255, 159, .08);
    color: #7dffc8;
    text-shadow: 0 0 8px rgba(0, 255, 159, .5);
}

/* ===== USDC 兑换操作条 ===== */
.convert-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(5, 8, 18, .85);
}
.convert-bar .convert-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.convert-title { color: var(--text); font-size: 13px; font-weight: 700; }
.convert-hint { color: var(--muted); font-size: 11.5px; margin-top: 1px; overflow-wrap: anywhere; }
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 38px; height: 22px; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; min-height: 0; border: 0; background: transparent; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #152238; border: 1px solid var(--border); transition: background .18s, border-color .18s, box-shadow .18s; pointer-events: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #5d7290; transition: transform .18s, background .18s, box-shadow .18s; }
.switch input:checked ~ .track { background: rgba(0, 229, 255, .2); border-color: rgba(0, 229, 255, .65); box-shadow: 0 0 10px rgba(0, 229, 255, .35); }
.switch input:checked ~ .track::after { transform: translateX(16px); background: #6dffc4; box-shadow: 0 0 8px rgba(0, 255, 159, .8); }

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 9px max(12px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: rgba(4, 6, 14, .92);
    backdrop-filter: blur(18px);
}
.bottom-nav .button { flex: 1; width: auto; min-width: 0; max-width: 180px; padding-inline: 9px; white-space: nowrap; }
.bottom-nav .active {
    background: linear-gradient(135deg, rgba(0, 229, 255, .22), rgba(0, 119, 255, .22));
    border-color: rgba(0, 229, 255, .55);
    color: #c9f6ff;
    box-shadow: 0 0 14px rgba(0, 229, 255, .3);
    text-shadow: 0 0 8px rgba(0, 229, 255, .5);
}

/* ===== 对话框 ===== */
dialog {
    width: min(480px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    border: 1px solid rgba(0, 229, 255, .4);
    border-radius: 16px;
    padding: 0;
    background: linear-gradient(160deg, rgba(13, 21, 40, .99), rgba(5, 8, 18, .99));
    color: var(--text);
    box-shadow: 0 0 40px rgba(0, 229, 255, .18), var(--shadow);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
dialog::backdrop { background: rgba(1, 2, 8, .8); backdrop-filter: blur(4px); }
.dialog-body { padding: 18px; overflow: auto; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.dialog-actions > * { flex: 1; }

/* ===== Toast ===== */
.toast-region { position: fixed; z-index: 100; top: 12px; left: 50%; width: min(420px, calc(100% - 24px)); transform: translateX(-50%); }
.toast {
    margin-bottom: 8px;
    border: 1px solid rgba(0, 229, 255, .4);
    border-radius: 12px;
    padding: 11px 13px;
    background: rgba(10, 16, 30, .97);
    box-shadow: 0 0 18px rgba(0, 229, 255, .15);
    color: var(--text);
}
.toast.error { border-color: rgba(255, 42, 109, .65); box-shadow: var(--glow-magenta); }
.toast.success { border-color: rgba(0, 255, 159, .55); box-shadow: var(--glow-green); }

.busy { position: relative; }
.busy::after { content: ""; display: inline-block; width: 13px; height: 13px; margin-left: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 登录页 ===== */
.login-page { display: grid; place-items: center; padding: 18px; }
.login-card { width: min(410px, 100%); padding: 26px; }
.login-card:hover { border-color: rgba(0, 229, 255, .45); }
.login-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 229, 255, .22), rgba(160, 107, 255, .22));
    border: 1px solid rgba(0, 229, 255, .5);
    color: var(--cyan);
    font-size: 26px;
    text-shadow: 0 0 14px rgba(0, 229, 255, .8);
    box-shadow: 0 0 20px rgba(0, 229, 255, .25);
}
.login-card h1 { margin: 16px 0 4px; font-size: 25px; letter-spacing: .02em; }
.login-card form { margin-top: 22px; }
.code-input {
    text-align: center;
    letter-spacing: .3em;
    font-size: 24px;
    font-weight: 750;
    font-family: var(--font-mono);
    text-shadow: 0 0 12px rgba(0, 229, 255, .45);
}
.full { width: 100%; }
.form-message { min-height: 24px; margin-top: 10px; color: var(--muted); text-align: center; }

/* ===== 交易页 ===== */
.trade-shell { padding-bottom: 178px; }
.symbol-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(120px, .7fr); gap: 10px; }
.symbol-row.futures-settings { grid-template-columns: minmax(160px, 1fr) minmax(120px, .8fr) minmax(100px, .45fr); }
.symbol-picker { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(120px, .85fr); gap: 8px; }
.symbol-picker select, .symbol-picker input { min-width: 0; }
.symbol-choice-note { display: block; margin-top: 6px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.account-select { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.account-select input { width: 22px; min-height: 22px; margin: 2px 0 0; accent-color: var(--cyan); flex: 0 0 auto; }
.account-select-main { flex: 1; min-width: 0; }
.trade-dock {
    position: fixed;
    z-index: 45;
    left: 0;
    right: 0;
    bottom: calc(63px + env(safe-area-inset-bottom));
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: rgba(4, 6, 14, .94);
    backdrop-filter: blur(18px);
}
.trade-dock-inner { width: min(900px, 100%); margin: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.trade-dock-inner.actions-2 { grid-template-columns: repeat(2, 1fr); }
.trade-dock-inner.actions-3 { grid-template-columns: repeat(3, 1fr); }
.trade-dock button { padding: 8px 5px; font-size: 13px; }
.trade-dock small { display: block; font-size: 10px; opacity: .8; }
.trade-dock .success { box-shadow: 0 0 18px rgba(0, 255, 159, .28); }
.trade-dock .danger { box-shadow: 0 0 18px rgba(255, 42, 109, .28); }
.percent-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 12px 0; }
.percent-options button.selected {
    background: linear-gradient(135deg, rgba(0, 229, 255, .9), rgba(0, 119, 255, .9));
    color: #03101a;
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
}
.range-row { display: flex; gap: 12px; align-items: center; }
.range-row input { padding: 0; accent-color: var(--cyan); }
.range-value { min-width: 48px; font-weight: 800; text-align: right; font-family: var(--font-mono); }
.confirm-summary { display: grid; gap: 7px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: rgba(5, 8, 18, .85); }
.confirm-summary div { display: flex; justify-content: space-between; gap: 12px; }
.confirm-summary strong { font-family: var(--font-mono); }
.compact-value { font-size: clamp(14px, 2.5vw, 19px); }
.notice {
    margin-top: 12px;
    border: 1px solid rgba(0, 229, 255, .35);
    border-radius: 12px;
    padding: 11px 12px;
    background: rgba(0, 229, 255, .06);
    color: #bfe9f7;
    font-size: 13px;
}
.warning-notice { border-color: rgba(255, 179, 0, .45); background: rgba(255, 179, 0, .06); color: #f5d8a4; }
.order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 10px;
    padding: 8px 9px;
    background: var(--surface-3);
    border: 1px solid rgba(28, 44, 70, .45);
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
    font-size: 12.5px;
}
.order-row span { min-width: 0; }
.stock-order-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.log-button { border-radius: 999px; min-width: 48px; }
.log-list { height: min(55vh, 500px); overflow: auto; display: grid; align-content: start; gap: 6px; margin-top: 10px; }
.log-line {
    border-left: 3px solid rgba(0, 229, 255, .4);
    background: var(--surface-3);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
}
.log-line.error { border-color: var(--magenta); box-shadow: inset 0 0 14px rgba(255, 42, 109, .06); }
.log-line.success { border-color: var(--green); }
.log-line.warn { border-color: var(--amber); }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
    .shell { padding: 12px 12px 94px; }
    .trade-shell { padding-bottom: 174px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-grid { grid-template-columns: 1fr; }
    .field-grid, .symbol-row, .symbol-row.futures-settings, .stock-order-grid { grid-template-columns: 1fr; }
    .metric-row { gap: 6px; }
    .metric { padding: 8px 7px; }
    .app-header { align-items: flex-start; }
    .desktop-label { display: none; }
    .small { min-height: 44px; }
    .bottom-nav { justify-content: center; gap: 4px; padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right)); }
    .bottom-nav::-webkit-scrollbar { display: none; }
    .bottom-nav .button { flex: 1 1 0; min-width: 0; padding-inline: 2px; font-size: 12px; }
}

@media (max-width: 480px) {
    .symbol-picker { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
    .card { padding: 13px; }
    .trade-dock { padding-inline: 6px; }
    .trade-dock-inner { gap: 4px; }
    .trade-dock button { font-size: 12px; }
}

@media (max-width: 350px) {
    .bottom-nav { gap: 2px; }
    .bottom-nav .button { padding-inline: 1px; font-size: 11px; }
}

/* ===== 智能提醒与手机网关 ===== */
.alert-shell { width: min(980px, 100%); }
.alert-shell [hidden] { display: none !important; }
.alert-form { margin-top: 12px; }
.alert-symbol-picker, .alert-advanced { min-width: 0; }
.alert-symbol-picker input { margin-top: 6px; }
.alert-symbol-picker > p { margin: 7px 0; overflow-wrap: anywhere; }
.alert-quote-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.alert-quote { margin: 0; min-width: 0; color: var(--text-soft); font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.alert-quote.error { color: var(--magenta-soft); }
.alert-quote-row button { flex: 0 0 auto; }
.alert-symbol-options, .alert-choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.alert-symbol-option, .alert-choice-row button { min-height: 40px; padding: 7px 11px; overflow-wrap: anywhere; }
.alert-symbol-option { text-align: left; }
.alert-choice-row button.selected { color: var(--cyan-soft); border-color: var(--cyan); background: rgba(0, 229, 255, .12); }
.alert-explain { font-size: .76rem; line-height: 1.5; margin: 5px 0 0; }
.alert-advanced { margin-top: 0; }
.alert-advanced label { margin-top: 8px; }
.alert-preview { padding: 12px; border: 1px solid rgba(0,229,255,.3); border-radius: 10px; background: rgba(0,229,255,.06); color: var(--text); font-size: .85rem; line-height: 1.6; overflow-wrap: anywhere; }
.alert-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.alert-pagination span { min-width: 85px; text-align: center; }
.alert-filter-row { margin: 0 0 12px; }
.alert-rule-section-title { align-items: flex-start; flex-wrap: wrap; }
.alert-rule-heading-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; }
.alert-rule-details { margin-top: 0; }
.alert-rule-details summary { min-height: 36px; padding-top: 4px; font-size: .8rem; }
.alert-rule-wait { color: #ffcf70; font-size: .78rem; line-height: 1.4; margin: 0; }
.alert-condition, .alert-rule-foot, .alert-rule-card small { overflow-wrap: anywhere; }
.alert-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.alert-device-note { grid-column: 1 / -1; margin: 0; font-size: .78rem; color: var(--muted); }
.alert-help { margin: -3px 0 12px; font-size: .84rem; }
.assistant-quick-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 12px; }
.assistant-quick-actions > span { color: var(--muted); font-size: .78rem; }
.assistant-quick-actions button { min-width: 62px; }
.assistant-compose { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: end; }
.assistant-compose > label { grid-column: 1 / -1; }
.assistant-input-wrap { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: stretch; }
.assistant-input-wrap textarea { width: 100%; min-width: 0; resize: vertical; }
.assistant-compose > .primary { min-width: 150px; }
.voice-button { min-width: 112px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 12px; }
.voice-button .voice-icon { font-size: 1.35rem; line-height: 1; }
.voice-button.listening { color: #fff; border-color: var(--magenta); background: rgba(255, 61, 154, .18); box-shadow: 0 0 0 3px rgba(255, 61, 154, .1); }
.voice-button.listening .voice-icon { animation: voice-pulse 1.1s ease-in-out infinite; }
.assistant-voice-controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-height: 28px; }
.assistant-voice-controls > span { font-size: .78rem; }
.assistant-voice-controls > span.error { color: var(--magenta); }
.assistant-voice-controls > span.ready { color: var(--green); }
.voice-privacy { margin: 8px 0 0; font-size: .72rem; line-height: 1.45; }
.assistant-result:empty { display: none; }
.assistant-result { margin-top: 10px; }
.assistant-result p { margin: 0; }
.assistant-proposal { display: grid; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.assistant-proposal small { color: var(--muted); }
.assistant-proposal button { justify-self: start; }
.assistant-information-note { display: block; margin-top: 9px; color: var(--muted); }
.assistant-job-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-soft); font-size: .82rem; }
.assistant-job-spinner { width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid rgba(77, 228, 255, .25); border-top-color: var(--cyan); border-radius: 50%; animation: assistant-spin .8s linear infinite; }
.information-card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.information-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; height: 100%; }
.information-card-head, .information-source { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.information-card-head time, .information-source { color: var(--muted); font-size: .72rem; }
.information-title { color: var(--text); font-weight: 800; line-height: 1.42; text-decoration: none; overflow-wrap: anywhere; }
.information-title:hover, .information-title:focus-visible { color: var(--cyan-soft); text-decoration: underline; }
.information-card p { margin: 0; color: var(--text-soft); font-size: .84rem; line-height: 1.62; overflow-wrap: anywhere; }
.information-source { margin-top: auto; align-items: flex-end; }
.information-source span { overflow-wrap: anywhere; }
.information-source small { flex: 0 0 auto; color: inherit; }
.information-card-actions { display: flex; justify-content: flex-end; }
.information-speech-button { min-width: 112px; }
.information-speech-button.speaking { color: #fff; border-color: var(--magenta); background: rgba(255, 61, 154, .18); }
.alert-check { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.alert-check input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--cyan); }
.alert-rule-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.alert-rule-card { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.alert-rule-head, .alert-rule-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.alert-rule-head h3, .alert-rule-head p { margin: 0; overflow-wrap: anywhere; }
.alert-condition { padding: 11px; border: 1px solid rgba(0, 229, 255, .25); border-radius: 10px; background: rgba(0, 229, 255, .055); color: var(--cyan-soft); font-weight: 750; }
.alert-times { display: grid; gap: 5px; margin: 0; }
.alert-times > div { display: flex; justify-content: space-between; gap: 10px; }
.alert-times dt { color: var(--muted); font-size: .76rem; }
.alert-times dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: .76rem; }
.alert-rule-foot { margin-top: auto; align-items: center; }
.alert-event-list { display: grid; gap: 8px; }
.alert-event { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3); }
.alert-event strong { font-size: .84rem; }
.alert-event time { color: var(--muted); font-family: var(--font-mono); font-size: .72rem; }
.swipe-help { margin: -5px 0 10px; font-size: .74rem; }
.swipe-row { position: relative; min-width: 0; overflow: hidden; border-radius: 12px; }
.swipe-delete { position: absolute; z-index: 0; inset: 0 auto 0 0; width: 84px; min-height: 100%; border: 0; border-radius: 12px 0 0 12px; background: linear-gradient(135deg, #ff376e, #b51143); color: #fff; font-weight: 800; }
.swipe-content { position: relative; z-index: 1; width: 100%; transform: translateX(0); transition: transform .18s ease; touch-action: pan-y; will-change: transform; }
.swipe-row.open .swipe-content { transform: translateX(84px); }
.swipe-row .alert-rule-card { height: 100%; }
.swipe-row .alert-event { background: var(--surface-3); }
.swipe-row .information-card { background: var(--surface-2); }
@media (max-width: 720px) {
    .alert-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .alert-rule-section-title { display: block; }
    .alert-rule-heading-actions { justify-content: space-between; margin-top: 8px; }
    .assistant-compose { grid-template-columns: 1fr; }
    .assistant-compose > .primary { width: 100%; }
    .alert-rule-list { grid-template-columns: 1fr; }
    .information-card-list { grid-template-columns: 1fr; }
    .alert-rule-foot { align-items: stretch; flex-direction: column; }
    .alert-rule-foot button { width: 100%; }
}

@media (max-width: 390px) {
    .assistant-input-wrap { grid-template-columns: minmax(0, 1fr) 92px; }
    .voice-button { min-width: 0; padding-inline: 7px; }
    .assistant-voice-controls { align-items: flex-start; flex-direction: column; gap: 5px; }
    .information-speech-button { width: 100%; }
}

@keyframes voice-pulse {
    0%, 100% { transform: scale(1); opacity: .78; }
    50% { transform: scale(1.14); opacity: 1; }
}

@keyframes assistant-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ===== AI 策略面板(kline-analysis) ===== */
.ai-panel .section-title { flex-wrap: wrap; }
.ai-content { display: flex; flex-direction: column; gap: 14px; }
.ai-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; color: var(--muted); align-items: center; }
.ai-summary { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--cyan); border-radius: 10px; padding: 12px 14px; }
.ai-summary h4 { margin: 0 0 6px; font-size: .95rem; color: var(--cyan); }
.ai-summary p { margin: 4px 0; line-height: 1.55; font-size: .88rem; color: var(--text); }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; align-items: stretch; }
.ai-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; min-width: 0; }
.ai-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-card-head h4 { margin: 0; font-size: 1.05rem; color: var(--text); }
.ai-bias { margin-left: auto; font-size: .76rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.ai-bias.bullish { color: var(--green); border-color: var(--green); }
.ai-bias.bearish { color: var(--magenta); border-color: var(--magenta); }
.ai-stats { gap: 8px; }
.ai-stats .stat-value { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-signal { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.ai-signal .row { display: flex; gap: 8px; font-size: .84rem; color: var(--text); line-height: 1.45; }
.ai-signal .row b { color: var(--muted); font-weight: 600; min-width: 34px; flex: none; }
.ai-levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ai-level { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 6px 4px; text-align: center; min-width: 0; }
.ai-level .lv-label { display: block; font-size: .68rem; color: var(--muted); letter-spacing: .03em; }
.ai-level .lv-price { display: block; font-size: .84rem; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-level.filled { border-color: var(--green); background: rgba(0, 255, 159, .06); }
.ai-level.filled .lv-price { color: var(--green); }
.ai-level.stop { border-color: var(--magenta); }
.ai-level.stop .lv-price { color: var(--magenta); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip { font-size: .74rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.ai-chip.ok { color: var(--green); border-color: rgba(0, 255, 159, .4); }
.ai-chip.bad { color: var(--magenta); border-color: rgba(255, 42, 109, .4); }
.ai-event { font-size: .78rem; color: #ffb454; margin: 0; }
.ai-warn { color: #ff6b6b; font-size: .8rem; margin: 0; line-height: 1.5; }
.ai-disc { color: var(--muted); font-size: .75rem; }
.ai-card-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-exec { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-exec select { padding: 6px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.ai-hold { font-size: .8rem; color: var(--muted); }
.badge-long { color: var(--green); border: 1px solid var(--green); border-radius: 999px; padding: 1px 8px; font-size: .74rem; white-space: nowrap; }
.badge-short { color: var(--magenta); border: 1px solid var(--magenta); border-radius: 999px; padding: 1px 8px; font-size: .74rem; white-space: nowrap; }
.badge-wait { color: #ffb454; border: 1px solid #ffb454; border-radius: 999px; padding: 1px 8px; font-size: .74rem; white-space: nowrap; }
.badge-state { color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: .74rem; white-space: nowrap; }
@media (max-width: 720px) {
  .ai-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== AI 技能介绍弹窗 ===== */
.ai-intro-dialog { max-width: 860px; width: min(92vw, 860px); }
.ai-intro-body { max-height: 70vh; overflow-y: auto; padding-right: 6px; font-size: .86rem; line-height: 1.65; color: var(--text); }
.ai-intro-body h3 { color: var(--cyan); font-size: .95rem; margin: 14px 0 6px; }
.ai-intro-body h3:first-child { margin-top: 0; }
.ai-intro-body p { margin: 6px 0; }
.ai-intro-body ul { margin: 6px 0; padding-left: 18px; }
.ai-intro-body li { margin: 4px 0; }
.ai-intro-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .82rem; }
.ai-intro-body th, .ai-intro-body td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.ai-intro-body th { color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.ai-intro-body .ok { color: var(--green); }
.ai-intro-body .warn { color: #ffb454; }

/* ===== AI 全托管(L2)控制面板 ===== */
.ai-custody { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface-3); }
.ai-live-signals { margin-top: 14px; }
.ai-custody .section-title { margin-bottom: 8px; }
.ai-custody .ai-summary { margin-bottom: 10px; }
.ai-custody-list { display: flex; flex-direction: column; gap: 8px; }
.ai-custody-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 10px;
  border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); }
.ai-custody-add select { padding: 4px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.ai-custody-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--surface-2); }
.ai-custody-main { display: flex; flex-direction: column; gap: 2px; }
.ai-custody-main b { font-size: .9rem; }
.ai-custody-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-custody-controls select { padding: 4px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.ai-custody-controls label.mini { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; color: var(--muted); }
.ai-custody-controls label.mini input { width: 58px; padding: 4px; border-radius: 6px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.ai-scenarios { margin-top: 10px; font-size: .82rem; color: var(--muted); }
.ai-scenarios summary { cursor: pointer; color: var(--cyan-soft); }
.ai-scenarios ul { margin: 8px 0 0; padding-left: 18px; }
.ai-scenarios li { margin: 4px 0; }

/* ===== AI 学习记录 ===== */
.ai-learning { margin-top: 10px; }
.ai-learn-scroll { overflow-x: auto; margin-top: 8px; }
.ai-learn-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ai-learn-table th, .ai-learn-table td { border: 1px solid var(--border); padding: 5px 7px; text-align: left; white-space: nowrap; }
.ai-learn-table th { color: var(--muted); background: var(--surface-2); font-weight: 600; }
.ai-learn-table .ok { color: var(--green); }
.ai-learn-table .warn { color: #ffb454; }

/* ===== 全托管信号卡判定行 ===== */
.ai-verdict { margin-top: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font-size: .82rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ai-verdict .ok { color: var(--green); }
.ai-verdict .warn { color: #ffb454; }

/* ===== 4H 信号 × 分钟路径验证 ===== */
.ai-research { border: 1px solid rgba(0, 229, 255, .28); border-radius: var(--radius); padding: 14px;
  background: linear-gradient(145deg, rgba(0, 229, 255, .045), rgba(133, 66, 255, .035)); }
.ai-research .section-title { margin-bottom: 8px; }
.ai-research .section-title h3 { margin: 2px 0 0; font-size: 1rem; color: var(--cyan); }
.ai-baseline { margin: 12px 0; padding: 11px; border: 1px solid rgba(255, 179, 0, .34);
  border-radius: 10px; background: rgba(255, 179, 0, .035); }
.ai-baseline h4 { margin: 0; font-size: .9rem; color: #ffcf70; }
.ai-baseline .ai-research-stats { margin-top: 8px; }
.ai-baseline > .ai-warn { margin: 9px 0 0; font-size: .72rem; }
.ai-research-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.ai-research-counts .stat { min-width: 0; }
.ai-research-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ai-research-stat { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-2); min-width: 0; }
.ai-research-stat span { color: var(--muted); font-size: .72rem; }
.ai-research-stat strong { font-size: .95rem; color: var(--text); }
.ai-research-stat small { color: var(--muted); font-size: .7rem; line-height: 1.4; }
.ai-latest-replay { margin-top: 12px; }
.ai-latest-replay h4 { margin: 0 0 7px; font-size: .86rem; color: var(--text); }
.ai-path-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ai-path-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-2); }
.ai-path-card span { color: var(--muted); font-size: .72rem; }
.ai-path-card strong { font-size: 1rem; }
.ai-path-card small { color: var(--muted); font-size: .68rem; line-height: 1.4; }
.ai-path-card.adverse { border-color: rgba(255, 42, 109, .35); }
.ai-path-card.minute { border-color: rgba(0, 229, 255, .42); }
.ai-path-card.favorable { border-color: rgba(0, 255, 159, .35); }
.ai-snapshot-list { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.ai-snapshot-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.ai-snapshot-row > div { min-width: 0; }
.ai-snapshot-row p { margin: 4px 0 2px; color: var(--text); font-size: .76rem; overflow-wrap: anywhere; }
.ai-snapshot-row small { display: block; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.ai-snapshot-row button { flex: none; }
.badge-alert { color: #ffb454; border: 1px solid #ffb454; border-radius: 999px; padding: 1px 8px;
  font-size: .74rem; white-space: nowrap; background: rgba(255, 179, 0, .08);
  box-shadow: 0 0 10px rgba(255, 179, 0, .25); }

@media (max-width: 720px) {
  .ai-signal .row { flex-direction: column; gap: 2px; }
  .ai-signal .row b { min-width: 0; }
  .ai-custody { margin-top: 0; padding: 10px; }
  .ai-custody-row { align-items: stretch; padding: 10px; }
  .ai-custody-main, .ai-custody-controls { width: 100%; }
  .ai-custody-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-custody-controls select, .ai-custody-controls button { width: 100%; min-height: 38px; }
  .ai-custody-controls label.mini { justify-content: space-between; min-height: 38px; }
  .ai-custody-add { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; }
  .ai-custody-add > .subtle { grid-column: 1 / -1; }
  .ai-custody-add select, .ai-custody-add button { width: 100%; min-height: 38px; }
  .ai-research { padding: 11px; }
  .ai-research-counts .stat { padding: 7px 5px; }
  .ai-research-counts .stat-value { font-size: .9rem; }
  .ai-research-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-path-grid { grid-template-columns: 1fr; }
  .ai-snapshot-row { align-items: flex-start; flex-direction: column; }
  .ai-snapshot-row button { width: 100%; }
}

@media (max-width: 390px) {
  .ai-custody-controls, .ai-custody-add { grid-template-columns: 1fr; }
  .ai-custody-add > .subtle { grid-column: auto; }
}
