/* ==========================================================================
   See Fresh · Quant Agent — Design System (2026-08)
   Financial terminal style: dark sidebar + light content + insight rail
   A股惯例:涨(利多)=红,跌(利空)=绿
   ========================================================================== */

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

:root {
    --bg: #F2F4F8;
    --panel: #FFFFFF;
    --line: #E7EAF0;
    --line-strong: #D8DEE8;
    --ink: #0F1728;
    --ink-2: #475467;
    --ink-3: #98A2B3;
    --brand: #2563EB;
    --brand-deep: #1E40AF;
    --brand-soft: #EEF4FF;
    --up: #E5484D;          /* 利多 / 涨 */
    --up-bg: #FDECEC;
    --up-border: #F5C6C8;
    --down: #0E9F6E;        /* 利空 / 跌 */
    --down-bg: #E6F6EF;
    --down-border: #BDE7D4;
    --neu: #667085;
    --neu-bg: #F1F4F8;
    --gold: #F59E0B;
    --sidebar: #0B1220;
    --sidebar-2: #111B2E;
    --r: 14px;
    --r-sm: 9px;
    --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
    --shadow-md: 0 8px 20px -6px rgba(16,24,40,.10), 0 2px 6px rgba(16,24,40,.05);
}

html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100dvh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: tabular-nums;
}
a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-deep); }
input, select, button { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* === App layout === */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100dvh; }
body.with-insights .app { grid-template-columns: 240px minmax(0, 1fr) 322px; }

/* === Sidebar === */
.sidebar {
    position: sticky; top: 0; height: 100dvh;
    background: linear-gradient(178deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #C6D0E0;
    display: flex; flex-direction: column;
    padding: 22px 14px 18px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.brand-logo {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: .8rem; letter-spacing: -.5px;
    box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.brand-name { color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: -.2px; line-height: 1.25; }
.brand-sub { color: #66789A; font-size: .68rem; letter-spacing: .4px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
    font-size: .66rem; font-weight: 600; color: #4E5E7C;
    letter-spacing: 1.2px; padding: 16px 10px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--r-sm);
    color: #93A3BC; font-size: .86rem; font-weight: 500;
    text-decoration: none; position: relative; transition: all .15s;
}
.nav-item svg { width: 17px; height: 17px; opacity: .8; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #D8E1EE; }
.nav-item.active { background: rgba(59,130,246,.14); color: #fff; }
.nav-item.active::before {
    content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: #3B82F6;
}
.nav-badge {
    margin-left: auto; font-size: .68rem; font-weight: 700;
    background: rgba(59,130,246,.22); color: #7FA9F5;
    padding: 1px 8px; border-radius: 10px;
}

.crawl-card {
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px; padding: 14px 16px;
}
.crawl-head { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 600; color: #9FB2CC; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #34D399; animation: pulse 2s infinite; flex-shrink: 0; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.45); } 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.crawl-count { font-size: 1.55rem; font-weight: 750; color: #fff; letter-spacing: -.5px; margin: 6px 0 2px; }
.crawl-meta { font-size: .72rem; color: #66789A; }
.crawl-sources { display: flex; gap: 5px; margin-top: 10px; }
.crawl-sources i { width: 8px; height: 8px; border-radius: 50%; background: #34D399; }
.crawl-sources i.off { background: #475569; }

/* === Main === */
.main { max-width: 800px; width: 100%; margin: 0 auto; padding: 30px 30px 90px; }

/* === Page header === */
.page-header, .page-head {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
    flex-wrap: wrap; margin-bottom: 20px;
}
.page-header h1, .page-head h1 { font-size: 1.45rem; font-weight: 750; letter-spacing: -.5px; }
.page-sub { color: var(--ink-3); font-size: .8rem; margin-top: 2px; }
.date-tag {
    color: var(--ink-2); font-size: .82rem; font-weight: 600;
    background: var(--panel); padding: 6px 14px; border-radius: 20px;
    border: 1px solid var(--line); box-shadow: var(--shadow);
}

.head-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search-input, .search input, .form-select {
    padding: 8px 13px; font-size: .85rem; outline: none;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s;
}
.search input { width: 230px; padding-left: 33px; }
.search-input:focus, .search input:focus, .form-select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.search-input::placeholder, .search input::placeholder { color: var(--ink-3); }

/* === Buttons === */
.btn {
    padding: 8px 16px; border-radius: var(--r-sm);
    font-size: .83rem; font-weight: 600; transition: all .15s;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn.primary { background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.btn.primary:hover { background: #26314A; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.primary:disabled { opacity: .55; transform: none; cursor: wait; }
.btn.ghost { background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--ink-3); color: var(--ink); }
button, .btn-primary {
    background: #FFFFFF; color: var(--ink-2); border: 1px solid var(--line-strong);
    border-radius: var(--r-sm); padding: 8px 18px;
    font-weight: 600; font-size: .83rem; transition: all .15s; white-space: nowrap;
}
button:hover, .btn-primary:hover { background: var(--neu-bg); color: var(--ink); border-color: var(--ink-3); }
.btn-secondary {
    background: #F3F4F6; color: var(--ink); border: 1px solid var(--line);
    padding: 8px 18px; border-radius: var(--r-sm); font-size: .83rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-secondary:hover { background: #E5E7EB; }

/* === Filters === */
.filters {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); padding: 13px 16px; margin-bottom: 22px;
    display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow);
}
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.frow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fname { font-size: .74rem; font-weight: 600; color: var(--ink-3); width: 44px; flex-shrink: 0; }
.chip {
    font-size: .78rem; font-weight: 550; color: var(--ink-2);
    padding: 4px 12px; border-radius: 15px; border: 1px solid transparent;
    transition: all .13s; display: inline-flex; align-items: center; gap: 5px;
}
.chip:hover { background: var(--neu-bg); color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; }
.chip.active.chip-up { background: var(--up); }
.chip.active.chip-down { background: var(--down); }
.chip .n { font-size: .68rem; opacity: .55; font-weight: 700; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.up { background: var(--up); } .dot.down { background: var(--down); } .dot.neu { background: #B0B8C4; }
.chip.active .dot { background: rgba(255,255,255,.85); }

/* Legacy filter chips (old pages) */
.filter-chip {
    font-size: .75rem; font-weight: 500; padding: 5px 12px; border-radius: 14px;
    border: 1px solid var(--line); background: var(--panel); cursor: pointer;
    transition: all .15s; white-space: nowrap; color: var(--ink-2);
}
.filter-chip:hover { border-color: var(--brand); color: var(--brand); }
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* === Status bar === */
.status-bar {
    padding: 10px 16px; border-radius: var(--r-sm); font-size: .82rem;
    margin-bottom: 16px; font-weight: 500;
}
.status-loading { background: var(--brand-soft); color: var(--brand); border: 1px solid #BFDBFE; }
.status-ok      { background: var(--down-bg); color: var(--down); border: 1px solid var(--down-border); }
.status-error   { background: var(--up-bg); color: var(--up); border: 1px solid var(--up-border); }

/* === Feed === */
.day-group { margin-bottom: 26px; }
.day-head {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: baseline; gap: 10px;
    padding: 8px 4px 10px;
    background: linear-gradient(var(--bg) 82%, transparent);
    font-size: .82rem; font-weight: 700; letter-spacing: -.1px;
}
.day-head .cnt { font-size: .72rem; font-weight: 600; color: var(--ink-3); }

.ev {
    position: relative; display: flex;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); margin-bottom: 10px;
    box-shadow: var(--shadow); overflow: hidden;
    transition: box-shadow .18s, border-color .18s, transform .18s;
}
.ev:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); transform: translateY(-1px); }
.ev-rail { width: 4px; flex-shrink: 0; }
.ev-rail.up { background: var(--up); } .ev-rail.down { background: var(--down); } .ev-rail.neu { background: #D3D9E2; }
.ev-body { flex: 1; padding: 15px 18px 13px; min-width: 0; }

.ev-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.ev-time { font-size: .76rem; color: var(--ink-3); font-weight: 600; }
.bdg {
    font-size: .68rem; font-weight: 650; padding: 1.5px 8px;
    border-radius: 5px; letter-spacing: .3px; line-height: 1.5;
}
.bdg-region { background: #1E293B; color: #F1F5F9; }
.bdg-cat { background: var(--brand-soft); color: var(--brand-deep); }
.ev-dur { font-size: .7rem; color: var(--ink-3); }
.ev-sent {
    margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
    font-size: .72rem; font-weight: 700; padding: 2.5px 10px; border-radius: 12px;
}
.ev-sent i { width: 6px; height: 6px; border-radius: 50%; font-style: normal; }
.ev-sent.up { background: var(--up-bg); color: var(--up); border: 1px solid var(--up-border); }
.ev-sent.up i { background: var(--up); }
.ev-sent.down { background: var(--down-bg); color: var(--down); border: 1px solid var(--down-border); }
.ev-sent.down i { background: var(--down); }
.ev-sent.neu { background: var(--neu-bg); color: var(--neu); border: 1px solid var(--line); }
.ev-sent.neu i { background: #B0B8C4; }

.ev-title { font-size: 1.02rem; font-weight: 680; line-height: 1.45; letter-spacing: -.2px; margin-bottom: 5px; }
.ev-summary {
    font-size: .83rem; color: var(--ink-2); line-height: 1.65;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 10px;
}

.ev-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.tg { font-size: .74rem; font-weight: 600; color: var(--brand-deep); background: var(--brand-soft); padding: 2px 9px; border-radius: 11px; }
.tg-sub { font-size: .74rem; font-weight: 500; color: var(--ink-3); }
.tg-sub::before { content: '#'; margin-right: 1px; opacity: .7; }
.tg-stock {
    font-size: .74rem; font-weight: 600;
    color: #B45309; background: #FEF3C7;
    padding: 2px 9px; border-radius: 11px; cursor: pointer;
    transition: all .13s;
}
.tg-stock:hover { background: #FDE68A; border-color: var(--gold); }
.tg-stock b { font-weight: 700; }
.tg-stock i { font-style: normal; font-weight: 500; opacity: .75; margin-left: 3px; }

.ev-stocks { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }
.stock {
    display: inline-flex; align-items: center; gap: 6px;
    background: #F8FAFC; border: 1px solid var(--line);
    padding: 3.5px 10px; border-radius: 7px; font-size: .76rem;
    transition: all .13s; cursor: pointer;
}
.stock:hover { border-color: var(--brand); background: var(--brand-soft); }
.stock b { font-weight: 650; }
.stock i { font-style: normal; color: var(--ink-3); font-size: .68rem; }
.stock em { font-style: normal; font-size: .68rem; font-weight: 700; color: var(--ink-2); border-left: 1px solid var(--line-strong); padding-left: 6px; }
.stock.hot { border-color: #F2C94C; background: #FFF9E8; }
.stock.hot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

.ev-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 9px; }
.stars { display: inline-flex; align-items: center; gap: 1px; }
.stars i { font-style: normal; color: #E2E6EC; font-size: .82rem; }
.stars i.on { color: var(--gold); }
.stars b { font-size: .74rem; font-weight: 750; color: var(--ink-2); margin-left: 5px; }
.foot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
.ev-cert { font-size: .72rem; color: var(--ink-3); }
.ev-src { font-size: .73rem; color: var(--ink-3); margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-src b { color: var(--ink-2); font-weight: 650; }
.ev-src-link { color: var(--ink-2); font-weight: 600; text-decoration: none; transition: color .13s; }
.ev-src-link::after { content: ' ↗'; font-size: .66rem; opacity: .55; }
.ev-src-link:hover { color: var(--brand); text-decoration: underline; }
.ev-src-txt { color: var(--ink-3); }

.empty-feed, .empty {
    text-align: center; padding: 60px 20px; color: var(--ink-3);
    font-size: .9rem;
}
.empty-feed { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--r); margin-bottom: 10px; }
.empty-feed .big { font-size: 2rem; margin-bottom: 8px; }

.scroll-sentinel { text-align: center; padding: 14px 0 26px; color: var(--ink-3); font-size: .78rem; }

/* === Insights rail === */
.insights {
    position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    border-left: 1px solid var(--line);
    background: #FAFBFD;
    padding: 24px 18px 40px;
    scrollbar-width: thin;
}
.ins-card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); padding: 16px 17px; margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.ins-card h4 { font-size: .8rem; font-weight: 700; letter-spacing: -.1px; margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; }
.ins-card h4 .hint { font-size: .68rem; color: var(--ink-3); font-weight: 500; }

.ov-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ov-grid > div { text-align: center; background: #F8FAFC; border-radius: var(--r-sm); padding: 10px 4px; }
.ov-grid b { display: block; font-size: 1.35rem; font-weight: 780; letter-spacing: -.5px; line-height: 1.2; }
.ov-grid span { font-size: .66rem; color: var(--ink-3); font-weight: 550; }
.ov-grid .hl b { color: var(--up); }

.senti-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; margin-bottom: 11px; }
.senti-bar div { border-radius: 5px; transition: width .4s; }
.sb-up { background: var(--up); } .sb-neu { background: #CBD3DE; } .sb-dn { background: var(--down); }
.senti-legend { display: flex; flex-direction: column; gap: 6px; }
.senti-legend .row { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--ink-2); }
.senti-legend .row b { margin-left: auto; font-weight: 700; }
.sq { width: 9px; height: 9px; border-radius: 3px; }
.sq.up { background: var(--up); } .sq.neu { background: #CBD3DE; } .sq.dn { background: var(--down); }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 9px; font-size: .74rem; }
.bar-row .lbl { width: 44px; color: var(--ink-2); font-weight: 600; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 7px; background: var(--neu-bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #FBBF24, var(--gold)); transition: width .4s; }
.bar-fill.blue { background: linear-gradient(90deg, #60A5FA, var(--brand)); }
.bar-row .val { width: 22px; text-align: right; font-weight: 700; color: var(--ink-2); }

.top-ev { display: flex; flex-direction: column; gap: 4px; }
.top-ev-item {
    display: flex; gap: 10px; padding: 8px 9px; border-radius: var(--r-sm);
    transition: background .13s; cursor: pointer; align-items: flex-start;
}
.top-ev-item:hover { background: #F4F7FB; }
.top-ev-rank {
    width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem; font-weight: 800; color: #fff; background: #B0B8C4;
    margin-top: 1px;
}
.top-ev-item:nth-child(1) .top-ev-rank { background: var(--up); }
.top-ev-item:nth-child(2) .top-ev-rank { background: #F2711C; }
.top-ev-item:nth-child(3) .top-ev-rank { background: var(--gold); }
.top-ev-title { font-size: .78rem; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top-ev-meta { font-size: .67rem; color: var(--ink-3); margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.mini-stars { color: var(--gold); font-size: .66rem; letter-spacing: .5px; }

/* === Metric cards (dashboard) === */
.metrics-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px; margin-bottom: 26px;
}
.metric-card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); padding: 18px 20px;
    box-shadow: var(--shadow); position: relative; overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.metric-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--brand); opacity: 0; transition: opacity .2s;
}
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metric-card:hover::before { opacity: 1; }
.metric-card.accent-green::before { background: var(--down); }
.metric-card.accent-red::before { background: var(--up); }
.metric-card.accent-yellow::before { background: var(--gold); }
.metric-label {
    color: var(--ink-3); font-size: .76rem; font-weight: 600;
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px;
}
.metric-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.5px; line-height: 1.2; }
.metric-change { font-size: .78rem; font-weight: 600; margin-top: 4px; display: inline-flex; align-items: center; gap: 3px; color: var(--ink-3); }
.metric-change.up { color: var(--up); }
.metric-change.down { color: var(--down); }

/* === Sections (dashboard / analysis) === */
.section { margin-bottom: 26px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h2 { font-size: .95rem; font-weight: 650; }
.section-badge {
    font-size: .74rem; font-weight: 650; color: var(--ink-2);
    background: var(--neu-bg); padding: 3px 10px; border-radius: 12px;
}

/* === Lists (legacy pages) === */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); padding: 13px 16px;
    box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s;
}
.list-item:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: .88rem; }
.meta { color: var(--ink-3); font-size: .78rem; white-space: nowrap; flex-shrink: 0; }
.score {
    font-weight: 750; font-size: .88rem; color: var(--brand);
    background: var(--brand-soft); padding: 4px 10px; border-radius: 6px; flex-shrink: 0;
}
.signal {
    font-weight: 650; font-size: .78rem; padding: 4px 12px; border-radius: 6px; flex-shrink: 0;
}
.signal.buy  { background: var(--up-bg); color: var(--up); }
.signal.sell { background: var(--down-bg); color: var(--down); }
.signal.hold { background: var(--neu-bg); color: var(--neu); }

/* === Tags (legacy) === */
.tag {
    font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 14px;
    white-space: nowrap; letter-spacing: .3px; flex-shrink: 0;
}
.tag-source { background: var(--neu-bg); color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.source-icon { border-radius: 2px; flex-shrink: 0; }
.tag-stock { background: var(--brand-soft); color: var(--brand); }
.tag-bull, .sent-bullish, .sent-pos { background: var(--up-bg); color: var(--up); }
.tag-bear, .sent-bearish, .sent-neg { background: var(--down-bg); color: var(--down); }
.tag-neutral, .sent-neutral { background: var(--neu-bg); color: var(--neu); }
.tag-cat { background: #FEF3C7; color: #92400E; }
.tag-keyword { background: var(--neu-bg); color: var(--ink-2); font-weight: 400; font-size: .7rem; }
.tag-region { background: #1E293B; color: #F8FAFC; font-weight: 700; font-size: .7rem; padding: 2px 8px; border-radius: 4px; }
.tag-l1 { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.tag-l2 { background: var(--down-bg); color: #166534; }
.tag-l3 { background: #FEF3C7; color: #92400E; font-size: .68rem; }

/* === Legacy event cards (dashboard high-impact list) === */
.event-card { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; padding: 15px 18px !important; }
.event-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.event-title { font-weight: 650; font-size: .92rem; line-height: 1.4; flex: 1; }
.event-summary { font-size: .82rem; color: var(--ink-2); line-height: 1.5; }
.event-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.event-meta-row .meta { font-size: .76rem; }
.impact-stars { color: var(--gold); font-size: .82rem; letter-spacing: 1px; }
.impact-duration { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--neu-bg); color: var(--ink-2); }
.event-sources { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.source-count { font-size: .72rem; color: var(--ink-2); font-weight: 500; }
.news-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.link { color: var(--brand); font-size: .78rem; font-weight: 500; }

/* === Status dots (dashboard agent status) === */
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    background: #D1D5DB;
}
.status-dot.online { background: var(--down); box-shadow: 0 0 6px rgba(14,159,110,.4); }
.status-dot.offline { background: #D1D5DB; }
.status-dot.busy { background: var(--gold); box-shadow: 0 0 6px rgba(245,158,11,.4); }

/* === Countdown badge (legacy news header) === */
.countdown-badge {
    font-size: .74rem; font-weight: 500; padding: 5px 14px; border-radius: 14px;
    border: 1px solid var(--line); background: var(--panel);
    color: var(--ink-2); white-space: nowrap;
}
.countdown-active {
    background: var(--brand-soft); color: var(--brand); border-color: #BFDBFE;
    animation: pulse 1.5s ease-in-out infinite;
}

/* === Forms === */
.form-card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r); padding: 22px 24px;
    box-shadow: var(--shadow); margin-bottom: 16px;
}
.form-card h2 { font-size: .92rem; font-weight: 650; margin-bottom: 14px; }
.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.form-row label {
    display: block; color: var(--ink-2); font-size: .8rem;
    font-weight: 550; margin-bottom: 6px;
}
.form-row input, .form-card input {
    width: 100%; background: #F9FAFB; border: 1px solid var(--line);
    border-radius: var(--r-sm); padding: 10px 14px; font-size: .88rem;
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus, .form-card input:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.08); background: var(--panel);
}
.form-row input::placeholder, .form-card input::placeholder { color: var(--ink-3); }

/* === Login === */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100dvh; padding: 20px;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(37,99,235,.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(37,99,235,.04) 0%, transparent 60%);
}
.login-box {
    width: 100%; max-width: 380px; text-align: center;
    background: var(--panel); padding: 40px 36px;
    border-radius: 18px; border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}
.login-logo {
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 1rem; margin: 0 auto 16px;
    box-shadow: 0 6px 16px rgba(37,99,235,.35);
}
.login-box h1 { font-size: 1.5rem; color: var(--ink); margin-bottom: 4px; font-weight: 750; }
.login-box .subtitle { color: var(--ink-3); margin-bottom: 32px; font-size: .9rem; }
.login-box input {
    width: 100%; background: #F9FAFB; border: 1px solid var(--line);
    border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 12px;
    font-size: .93rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-box input:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.08); background: #fff;
}
.login-box button { width: 100%; padding: 12px; font-size: .93rem; margin-top: 4px; border-radius: var(--r-sm); }
.error-msg { color: var(--up); margin-top: 16px; font-size: .85rem; min-height: 20px; }
.hint { color: var(--ink-3); margin-top: 20px; font-size: .85rem; }
.hint a { font-weight: 600; }

/* === Toast === */
.toast {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: #fff; padding: 10px 22px; border-radius: 22px;
    font-size: .83rem; font-weight: 550; z-index: 200; opacity: 0;
    transition: all .3s; pointer-events: none; box-shadow: var(--shadow-md);
    max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === Mobile bar === */
.mobilebar { display: none; }

/* === Responsive === */
@media (max-width: 1280px) {
    .app, body.with-insights .app { grid-template-columns: 240px minmax(0, 1fr); }
    .insights { display: none; }
}
@media (max-width: 880px) {
    .app, body.with-insights .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .mobilebar {
        display: flex; align-items: center; gap: 10px;
        position: sticky; top: 0; z-index: 50;
        background: var(--sidebar); color: #fff; padding: 10px 12px;
    }
    .mobilebar .brand-logo { width: 30px; height: 30px; font-size: .68rem; flex-shrink: 0; }
    .mobilebar-title { font-size: .9rem; flex-shrink: 0; }
    /* 导航横向可滑动：窄屏放不下时靠滑动取用，绝不裁掉入口。
       （原来不换行也不滚动，360~390px 屏幕上 ETF / 设置 / 词表会被挤出屏幕） */
    .mobilebar nav {
        margin-left: auto; display: flex; gap: 4px;
        flex: 1 1 auto; min-width: 0;
        overflow-x: auto; overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }
    .mobilebar nav::-webkit-scrollbar { display: none; }
    .mobilebar nav a {
        color: #93A3BC; font-size: .78rem; padding: 5px 10px;
        border-radius: 7px; text-decoration: none;
        white-space: nowrap; flex: 0 0 auto;
        scroll-snap-align: center;
    }
    .mobilebar nav a.active { background: rgba(59,130,246,.2); color: #fff; }
    .main { padding: 20px 14px 70px; }
    .search input { width: 150px; }
    .metrics-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .metric-card { padding: 14px 16px; }
    .metric-value { font-size: 1.4rem; }
    .page-header h1, .page-head h1 { font-size: 1.25rem; }
}
@media (max-width: 430px) {
    /* 极窄屏：品牌名让位给导航，保证至少 4 个入口一眼可见 */
    .mobilebar-title { display: none; }
    .mobilebar nav a { padding: 5px 9px; }
}
@media (max-width: 380px) {
    .metrics-row { grid-template-columns: 1fr; }
}
