/* 猴哥策略 · 股票监控 */
:root {
    --bg: #060a12;
    --bg-soft: #0a111e;
    --panel: #0e1726;
    --panel-2: #111c2f;
    --line: #1d2a40;
    --line-soft: rgba(148, 163, 184, .12);
    --text: #e6edf7;
    --muted: #93a4bd;
    --dim: #64748b;
    --blue: #3b82f6;
    --blue-soft: rgba(59, 130, 246, .14);
    --green: #10b981;
    --green-soft: rgba(16, 185, 129, .13);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, .13);
    --orange: #f59e0b;
    --orange-soft: rgba(245, 158, 11, .14);
    --purple: #8b5cf6;
    --radius: 16px;
    --shadow: 0 18px 50px rgba(0, 0, 0, .35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

a { color: var(--blue); text-decoration: none; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: rgba(148, 163, 184, .1);
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    padding: 2px 6px;
    color: #cbd5e1;
    word-break: break-all;
}

.muted { color: var(--dim); }
.up { color: var(--red) !important; }
.down { color: var(--green) !important; }
.flat { color: var(--muted) !important; }
.strong { color: var(--text); font-weight: 600; }

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(1100px 600px at 8% -10%, rgba(37, 99, 235, .16), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(16, 185, 129, .07), transparent 55%),
        linear-gradient(rgba(148, 163, 184, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .035) 1px, transparent 1px);
    background-size: auto, auto, 44px 44px, 44px 44px;
    mask-image: linear-gradient(#000 0%, #000 60%, transparent 100%);
}

/* ============================== 登录 / 初始化 ============================== */

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(700px 480px at 50% -10%, rgba(37, 99, 235, .28), transparent 65%),
        radial-gradient(600px 420px at 85% 90%, rgba(16, 185, 129, .1), transparent 60%),
        linear-gradient(180deg, #060a12, #080e19 60%, #060a12);
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 18px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: linear-gradient(180deg, rgba(17, 28, 47, .96), rgba(10, 17, 30, .98));
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 20px;
    padding: 30px 30px 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 22px;
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #fff;
    font-weight: 800;
    font-size: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .35);
    flex: 0 0 auto;
}

.auth-title { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.auth-sub { font-size: 11px; color: var(--dim); margin-top: 3px; letter-spacing: .4px; }

.auth-h1 { font-size: 23px; margin: 0 0 8px; letter-spacing: -.4px; }
.auth-desc { color: var(--muted); font-size: 13px; margin: 0 0 20px; line-height: 1.7; }

.auth-error {
    min-height: 20px;
    color: #fca5a5;
    font-size: 12.5px;
    margin-top: 10px;
}

.auth-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--dim);
    font-size: 11px;
    border-top: 1px solid var(--line-soft);
    padding-top: 15px;
    margin-top: 20px;
}

/* ============================== 顶栏 / 布局 ============================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 28px;
    background: rgba(6, 10, 18, .82);
    border-bottom: 1px solid var(--line-soft);
    backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text h1 { font-size: 17px; margin: 0; letter-spacing: .2px; white-space: nowrap; }
.brand-text p { margin: 2px 0 0; font-size: 11px; color: var(--dim); letter-spacing: .3px; white-space: nowrap; }

.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.market-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, .7);
    padding: 7px 11px;
    border-radius: 999px;
}

.market-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dim);
    box-shadow: 0 0 0 3px rgba(100, 116, 139, .12);
}

.market-pill.live .dot {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .55; transform: scale(.85); }
}

.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 26px 28px 64px;
}

.hero-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.eyebrow {
    font-size: 10.5px;
    letter-spacing: 3px;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 6px;
}

.hero-title {
    margin: 0;
    font-size: 27px;
    line-height: 1.25;
    letter-spacing: -.6px;
    font-weight: 700;
}

.hero-sub { margin: 7px 0 0; color: var(--dim); font-size: 12.5px; }
.hero-actions { display: flex; align-items: center; gap: 10px; }

/* ============================== 指数监控 ============================== */

.index-panel { margin-bottom: 20px; }

.index-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.index-title { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.index-sub { margin: 4px 0 0; color: var(--dim); font-size: 11px; }

.index-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--dim);
    font-size: 11px;
    white-space: nowrap;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
    animation: pulse 1.8s ease-in-out infinite;
}

.index-status.error .live-dot {
    background: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
    animation: none;
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 9px;
}

.index-card {
    background: linear-gradient(160deg, rgba(17, 28, 47, .92), rgba(10, 17, 30, .94));
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    min-width: 0;
}

.index-name {
    font-size: 10.8px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.index-price {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.4px;
    margin: 5px 0 3px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.index-change {
    display: flex;
    gap: 7px;
    font-size: 10.8px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.index-card.skeleton { height: 84px; animation: shimmer 1.5s ease-in-out infinite; }

@media (max-width: 620px) {
    .index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .index-price { font-size: 17px; }
    .index-head { align-items: flex-start; flex-direction: column; gap: 7px; }
}

/* ============================== 统计卡 ============================== */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    position: relative;
    background: linear-gradient(160deg, rgba(17, 28, 47, .92), rgba(10, 17, 30, .94));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px 18px 15px;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -55px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, .12), transparent 70%);
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.stat-mark { width: 7px; height: 7px; border-radius: 2px; }
.stat-mark.blue { background: var(--blue); }
.stat-mark.green { background: var(--green); }
.stat-mark.orange { background: var(--orange); }
.stat-mark.red { background: var(--red); }

.stat-value {
    font-size: 28px;
    font-weight: 750;
    letter-spacing: -.6px;
    margin: 6px 0 2px;
    font-variant-numeric: tabular-nums;
}

.stat-hint { font-size: 11px; color: var(--dim); }

.stat-card.skeleton { height: 101px; animation: shimmer 1.5s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: .45; } 50% { opacity: .8; } }

/* ============================== 面板 / 表格 ============================== */

.panel {
    background: linear-gradient(180deg, rgba(15, 25, 43, .92), rgba(10, 17, 30, .94));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 19px 22px;
    border-bottom: 1px solid var(--line-soft);
}

.panel-head h3 { margin: 0; font-size: 15.5px; letter-spacing: -.1px; }
.panel-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--dim); }

.add-panel { padding: 15px 18px; }

.add-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 11px;
    flex-wrap: wrap;
}

.add-title strong { font-size: 13.5px; }
.add-title span { font-size: 11.5px; color: var(--dim); }

.add-fields {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px) auto;
    gap: 10px;
}

.add-fields input {
    width: 100%;
    background: rgba(6, 10, 18, .7);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13.5px;
    font-family: var(--font);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.add-fields input:focus,
.field input:focus,
.field select:focus {
    border-color: rgba(59, 130, 246, .65);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.suggest-box {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(6, 10, 18, .82);
    overflow: hidden;
}

.suggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 10px 13px;
    color: var(--text);
    font-family: var(--font);
    cursor: pointer;
    transition: background .12s;
}

.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: rgba(59, 130, 246, .1); }
.suggest-item.added { opacity: .55; cursor: default; }
.suggest-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.suggest-name { font-weight: 650; font-size: 13px; }
.suggest-meta { color: var(--dim); font-size: 10.5px; letter-spacing: .3px; }
.suggest-action { color: #93c5fd; font-size: 11px; font-weight: 600; white-space: nowrap; }
.suggest-item.added .suggest-action { color: var(--dim); }
.suggest-loading,
.suggest-empty { padding: 12px 13px; color: var(--dim); font-size: 12px; }

.add-extra {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--dim);
    flex-wrap: wrap;
}

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: #93c5fd;
    font-family: var(--font);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.batch-panel {
    margin-top: 12px;
    border-top: 1px solid var(--line-soft);
    padding-top: 13px;
}

.batch-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.batch-head strong { font-size: 13px; }
.batch-head span { font-size: 11px; color: var(--dim); }

.batch-panel textarea {
    width: 100%;
    min-height: 118px;
    resize: vertical;
    background: rgba(6, 10, 18, .7);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    outline: none;
}

.batch-panel textarea:focus {
    border-color: rgba(59, 130, 246, .65);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.batch-actions { display: flex; align-items: center; gap: 10px; margin-top: 9px; flex-wrap: wrap; }

.batch-result { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.batch-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }

.batch-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid var(--line-soft);
    color: var(--muted);
}
.batch-pill.ok { color: #6ee7b7; background: var(--green-soft); border-color: rgba(16, 185, 129, .25); }
.batch-pill.skip { color: var(--dim); }
.batch-pill.error { color: #fca5a5; background: var(--red-soft); border-color: rgba(239, 68, 68, .25); }

.batch-group-title { font-size: 10px; letter-spacing: 1px; color: var(--dim); margin-top: 4px; }

.batch-row {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 6px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    background: rgba(6, 10, 18, .35);
    font-size: 11.5px;
    flex-wrap: wrap;
}
.batch-row.ok { border-left: 2px solid var(--green); }
.batch-row.skip { border-left: 2px solid var(--dim); }
.batch-row.error { border-left: 2px solid var(--red); }
.batch-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); }
.batch-name { font-weight: 600; }
.batch-status { color: var(--dim); }
.batch-reason { color: #fca5a5; }
.batch-candidates { color: var(--dim); font-size: 10.5px; width: 100%; }

.table-panel { padding: 0; }
.table-wrap { overflow-x: auto; }

.stock-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1050px;
    font-variant-numeric: tabular-nums;
}

.stock-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: left;
    font-size: 10.5px;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: var(--dim);
    font-weight: 600;
    padding: 12px 13px;
    background: rgba(12, 20, 34, .98);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.stock-table tbody td {
    padding: 13px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
    font-size: 13px;
}

.stock-table tbody tr:last-child td { border-bottom: none; }
.stock-table tbody tr { transition: background .12s; }
.stock-table tbody tr:hover { background: rgba(59, 130, 246, .045); }
.stock-table tbody tr.row-disabled { opacity: .48; }
.stock-table .th-ops { text-align: right; }

.stock-name { font-weight: 650; font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stock-code { color: var(--dim); font-size: 11px; margin-top: 2px; letter-spacing: .4px; }
.price-main { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.sub { color: var(--dim); font-size: 10.8px; margin-top: 3px; line-height: 1.45; }
.status-reason { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 650;
    padding: 2px 7px;
    border-radius: 5px;
    letter-spacing: .3px;
}

.badge.bull { color: #fca5a5; background: var(--red-soft); border: 1px solid rgba(239, 68, 68, .22); }
.badge.bear { color: #6ee7b7; background: var(--green-soft); border: 1px solid rgba(16, 185, 129, .22); }

.mini-tag {
    display: inline-block;
    font-size: 9.5px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(148, 163, 184, .12);
    color: var(--muted);
    vertical-align: 1px;
}

.mini-tag.danger { color: #fca5a5; background: var(--red-soft); }
.mini-tag.ok { color: #6ee7b7; background: var(--green-soft); }
.mini-tag.muted { color: var(--dim); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(148, 163, 184, .1);
    color: var(--muted);
    border: 1px solid rgba(148, 163, 184, .14);
    white-space: nowrap;
}

.chip.lv-danger { color: #fca5a5; background: var(--red-soft); border-color: rgba(239, 68, 68, .25); }
.chip.lv-action { color: #93c5fd; background: var(--blue-soft); border-color: rgba(59, 130, 246, .28); }
.chip.lv-ok { color: #6ee7b7; background: var(--green-soft); border-color: rgba(16, 185, 129, .25); }
.chip.lv-warn { color: #fcd34d; background: var(--orange-soft); border-color: rgba(245, 158, 11, .25); }
.chip.lv-info { color: #cbd5e1; background: rgba(148, 163, 184, .1); }
.chip.lv-muted { color: var(--dim); }

.stage-dots { display: flex; gap: 4px; margin-bottom: 4px; }
.stage-dots i {
    width: 15px;
    height: 4px;
    border-radius: 2px;
    background: rgba(148, 163, 184, .2);
}
.stage-dots i.on { background: linear-gradient(90deg, #2563eb, #38bdf8); }

.ops { text-align: right; white-space: nowrap; }

.icon-btn {
    width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, .07);
    border: 1px solid var(--line-soft);
    color: var(--muted);
    border-radius: 7px;
    font-size: 11.5px;
    cursor: pointer;
    font-family: var(--font);
    transition: all .14s;
    margin-left: 3px;
    padding: 0;
}

.icon-btn:hover { color: #fff; border-color: rgba(59, 130, 246, .5); background: var(--blue-soft); }
.icon-btn.danger:hover { border-color: rgba(239, 68, 68, .5); background: var(--red-soft); color: #fca5a5; }
.icon-btn.ai { color: #c4b5fd; border-color: rgba(139, 92, 246, .28); }
.icon-btn.ai:hover { border-color: rgba(139, 92, 246, .55); background: rgba(139, 92, 246, .15); color: #ede9fe; }

.loading-row { color: var(--dim); text-align: center; padding: 34px 10px !important; font-size: 12px; }
.loading-row.error { color: #fca5a5; }

.empty-state { padding: 46px 20px; text-align: center; }
.empty-state.small { padding: 34px 16px; }
.empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin: 0 auto 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, .1);
    border: 1px solid rgba(59, 130, 246, .2);
    color: var(--blue);
    font-size: 22px;
}
.empty-state h3 { margin: 0 0 6px; font-size: 15px; }
.empty-state p { margin: 0; color: var(--dim); font-size: 12.5px; }

.hint-bar {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    color: var(--dim);
    font-size: 11.5px;
    line-height: 1.75;
    background: rgba(15, 23, 42, .5);
}

.hint-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue);
    margin-top: 6px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .12);
}

/* ============================== Tabs ============================== */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin: 22px 0 16px;
}

.tab {
    position: relative;
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    padding: 11px 16px 13px;
    cursor: pointer;
    transition: color .15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: #fff; }
.tab.active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #2563eb, #0ea5e9);
    border-radius: 2px;
}

.tab-count {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    background: rgba(59, 130, 246, .16);
    color: #93c5fd;
    border-radius: 99px;
    padding: 1px 6px;
    vertical-align: 1px;
}

.tab-pane { display: none; scroll-margin-top: 82px; }
.tab-pane.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ============================== 信号 ============================== */

.seg {
    display: inline-flex;
    background: rgba(6, 10, 18, .65);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
    flex-wrap: wrap;
}

.seg-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--font);
    font-size: 11.5px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all .14s;
    white-space: nowrap;
}

.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: rgba(59, 130, 246, .18); color: #bfdbfe; }

.signal-list { padding: 16px; display: grid; gap: 11px; }

.signal-card {
    position: relative;
    background: rgba(6, 10, 18, .55);
    border: 1px solid var(--line);
    border-left: 3px solid var(--dim);
    border-radius: 12px;
    padding: 15px 17px;
}

.signal-card.lv-danger { border-left-color: var(--red); }
.signal-card.lv-action { border-left-color: var(--blue); }
.signal-card.lv-ok { border-left-color: var(--green); }
.signal-card.lv-warn { border-left-color: var(--orange); }
.signal-card.lv-info { border-left-color: #64748b; }

.signal-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.signal-stock { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.signal-stock em { font-style: normal; color: var(--dim); font-weight: 400; margin-left: 3px; }
.signal-time { margin-left: auto; color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }

.signal-title { margin: 8px 0 6px; font-size: 15.5px; letter-spacing: -.2px; }
.signal-price { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.signal-price b { color: var(--text); font-size: 15px; }
.signal-detail { color: var(--muted); font-size: 12.5px; line-height: 1.8; margin-bottom: 9px; }
.signal-action {
    background: rgba(148, 163, 184, .06);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 12.5px;
    line-height: 1.7;
    font-weight: 600;
    color: #dbeafe;
}
.signal-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tag {
    font-size: 10.5px;
    color: var(--dim);
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    padding: 2px 6px;
}
.tag-ok { color: #6ee7b7; border-color: rgba(16, 185, 129, .25); background: var(--green-soft); }
.exec-note { font-size: 11px; color: var(--dim); }

/* ============================== 表单 / 设置 ============================== */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .2px; }

.field input,
.field select {
    width: 100%;
    background: rgba(6, 10, 18, .7);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 9px;
    padding: 9px 11px;
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.field select {
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 30px;
}

.field input::placeholder { color: #475569; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px 16px;
    padding: 20px 22px;
}

.field-wide { grid-column: span 2; }

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 22px 20px;
}

.form-tip { font-size: 11.5px; color: var(--dim); }
.form-tip.ok { color: #6ee7b7; }
.form-tip.warn { color: #fcd34d; }
.form-tip.down { color: #fca5a5; }

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    grid-column: span 2;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
    padding-top: 7px;
    cursor: pointer;
}

.checkbox-field input {
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: var(--blue);
    flex: 0 0 auto;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.switch input { width: 16px; height: 16px; accent-color: var(--blue); }

.cron-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px 10px;
}

.cron-box code {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 9px 11px;
    display: block;
}

.cron-note {
    padding: 0 22px 18px;
    margin: 0;
    font-size: 11.5px;
    color: var(--dim);
    line-height: 1.8;
}

.mail-logs { padding: 14px 22px 20px; display: flex; flex-direction: column; gap: 7px; }
.log-row {
    display: grid;
    grid-template-columns: 120px 46px minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    font-size: 11.5px;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: rgba(6, 10, 18, .45);
}
.log-row.fail { border-color: rgba(239, 68, 68, .22); }
.log-time { color: var(--dim); font-variant-numeric: tabular-nums; }
.log-status { font-weight: 700; color: var(--green); }
.log-row.fail .log-status { color: var(--red); }
.log-subject { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-error { color: #fca5a5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================== 按钮 ============================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 8px 15px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
    line-height: 1.3;
}

.btn:disabled { cursor: wait; opacity: .65; }
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-color: rgba(59, 130, 246, .5);
    box-shadow: 0 5px 16px rgba(37, 99, 235, .22);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
    background: rgba(148, 163, 184, .06);
    border-color: var(--line);
    color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { color: #fff; border-color: rgba(59, 130, 246, .45); background: rgba(59, 130, 246, .1); }
.btn-danger-ghost {
    background: transparent;
    border-color: rgba(239, 68, 68, .3);
    color: #fca5a5;
}
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-block { width: 100%; padding: 10px 15px; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }

.btn-spinner {
    width: 11px;
    height: 11px;
    border: 1.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
}

.btn.is-busy .btn-spinner { display: inline-block; animation: spin .7s linear infinite; }
.btn.is-busy { opacity: .8; cursor: wait; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== 模态 ============================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 14, .74);
    backdrop-filter: blur(5px);
}

.modal-card {
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, #0e1726, #0a111e);
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
    max-height: calc(100vh - 48px);
    overflow: auto;
    animation: modalIn .18s ease;
}

@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-chart { max-width: 1080px; }
.modal-form { max-width: 620px; }

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding: 16px 20px 13px;
    border-bottom: 1px solid var(--line-soft);
}

.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head p { margin: 3px 0 0; font-size: 11px; color: var(--dim); }
.modal-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.icon-btn[data-close] { font-size: 17px; line-height: 1; margin: 0; }

.chart-canvas {
    width: 100%;
    height: 480px;
    padding: 4px 8px 0;
}

.chart-loading,
.chart-error {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dim);
    font-size: 12.5px;
    padding: 20px;
    text-align: center;
}
.chart-error { color: #fca5a5; }

.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 2px 22px 15px;
    font-size: 10.5px;
    color: var(--dim);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-legend i.dash { background-image: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }

.modal-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.modal-ai { max-width: 800px; }

.ai-body {
    padding: 18px 22px;
    font-size: 13px;
    line-height: 1.9;
    color: #cbd5e1;
    max-height: 62vh;
    overflow: auto;
}

.ai-body h4 { margin: 15px 0 5px; font-size: 14px; color: #e2e8f0; }
.ai-body p { margin: 6px 0; }
.ai-body ul { margin: 4px 0 8px; padding-left: 20px; }
.ai-body li { margin: 3px 0; }
.ai-body strong { color: #f1f5f9; }
.ai-num { margin: 4px 0; }

.ai-loading {
    padding: 36px 12px;
    text-align: center;
    color: var(--dim);
    font-size: 12.5px;
}

.ai-error {
    padding: 16px 18px;
    border: 1px solid rgba(239, 68, 68, .25);
    background: var(--red-soft);
    border-radius: 10px;
    color: #fca5a5;
    line-height: 1.8;
}

.ai-hint { margin-top: 10px; color: #fcd34d; font-size: 12px; }

.ai-foot {
    padding: 12px 22px 16px;
    color: var(--dim);
    font-size: 10.5px;
    border-top: 1px solid var(--line-soft);
}

/* ============================== Toast ============================== */

.toast-host {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: rgba(15, 23, 42, .97);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
    color: #dbe4f3;
    font-size: 12.5px;
    line-height: 1.6;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    pointer-events: auto;
}

.toast.show { opacity: 1; transform: none; }
.toast-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--blue); }
.toast-success { border-color: rgba(16, 185, 129, .35); }
.toast-success .toast-dot { background: var(--green); }
.toast-error { border-color: rgba(239, 68, 68, .4); }
.toast-error .toast-dot { background: var(--red); }
.toast-warn { border-color: rgba(245, 158, 11, .38); }
.toast-warn .toast-dot { background: var(--orange); }
.toast-info .toast-dot { background: var(--blue); }

/* ============================== 响应式 ============================== */

@media (max-width: 1180px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field-wide { grid-column: span 2; }
    .checkbox-field { grid-column: span 2; }
}

@media (max-width: 860px) {
    .topbar { padding: 11px 16px; }
    .brand-text p { display: none; }
    .market-pill { display: none; }
    .container { padding: 20px 16px 50px; }
    .hero-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .hero-title { font-size: 22px; }
    .add-fields { grid-template-columns: 1fr 1fr; }
    .add-fields button { grid-column: span 2; }
    .panel-head { flex-direction: column; }
    .chart-canvas { height: 400px; }
    .log-row { grid-template-columns: 100px 40px 1fr; }
    .log-error { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { padding: 13px; }
    .stat-value { font-size: 22px; }
    .add-fields { grid-template-columns: 1fr; }
    .add-fields button { grid-column: auto; }
    .form-grid { grid-template-columns: 1fr; padding: 16px; }
    .field-wide, .checkbox-field { grid-column: span 1; }
    .form-actions, .cron-box, .cron-note, .mail-logs { padding-left: 16px; padding-right: 16px; }
    .modal { padding: 12px 8px; }
    .modal-form .form-grid { grid-template-columns: 1fr; }
    .chart-canvas { height: 340px; }
    .signal-list { padding: 10px; }
    .signal-time { margin-left: 0; width: 100%; }
    .auth-card { padding: 24px 20px 18px; }
    .tabs { overflow-x: auto; }
    .tab { padding: 10px 12px 12px; white-space: nowrap; }
}
