/* ============================================================================
   麦吉优交易智能体平台 —— 设计系统
   基调：白底、细边框、克制留白；品牌红取自 logo（#E8322F）。
   涨跌配色遵循中国习惯：涨/买/多 = 红，跌/卖/空 = 绿。
   ========================================================================== */
:root {
  --brand: #E8322F;
  --brand-deep: #C4231F;
  --brand-soft: #FEF0EF;
  --brand-soft-2: #FDE3E1;

  --ink: #14161A;
  --ink-2: #33373F;
  --ink-3: #5C636E;
  --ink-4: #8A919C;
  --ink-5: #B4BAC4;

  --line: #EBECEF;
  --line-2: #F2F3F5;
  --bg: #F7F8FA;
  --surface: #FFFFFF;

  --up: #E8322F;
  --down: #0FA36B;

  --c1: #E8322F;
  --c2: #2E6BFF;
  --c3: #12A594;
  --c4: #F5A524;
  --c5: #8B5CF6;
  --c6: #EC4899;
  --c7: #0EA5E9;
  --c8: #10B981;
  --c9: #F97316;
  --c10: #6366F1;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-2: 0 10px 30px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- 框架 */
.app-shell { height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  height: 62px; padding: 0 26px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-logo { height: 26px; width: auto; border-radius: 4px; }
.brand-divider { width: 1px; height: 22px; background: var(--line); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 14.5px; letter-spacing: .01em; }
.brand-text i { font-style: normal; font-size: 11px; color: var(--ink-4); letter-spacing: .02em; }

.mainnav { display: flex; align-items: center; gap: 4px; flex: 1; }
.mainnav a {
  position: relative; padding: 7px 13px; border-radius: 8px;
  color: var(--ink-3); font-size: 13.5px; font-weight: 500; transition: .16s;
  white-space: nowrap;          /* 窄屏不允许「首/页」竖排断字 */
}
.mainnav a:hover { background: var(--line-2); color: var(--ink); }
.mainnav a.active { color: var(--brand); background: var(--brand-soft); }
.mainnav a[data-auth] { display: none; }
body.auth-operate .mainnav a[data-auth="operate"],
body.auth-admin .mainnav a[data-auth="admin"] { display: inline-flex; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.lang-btn {
  height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-3);
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
}
.lang-btn:hover { border-color: var(--ink-5); color: var(--ink); }

.user-slot { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-soft-2); color: var(--brand-deep);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta b { font-size: 12.5px; }
.user-meta span { font-size: 10.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .06em; }

.view { flex: 1; min-height: 0; overflow-y: auto; }
.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 26px; border-top: 1px solid var(--line);
  background: var(--surface); color: var(--ink-4); font-size: 11.5px;
}
.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-logo { height: 16px; opacity: .85; border-radius: 3px; }
.footer-copy { letter-spacing: .02em; }
.footer-right { letter-spacing: .04em; }

/* ---------------------------------------------------------------- 通用 */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 26px 40px; }
.wrap-wide { max-width: 1440px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card-pad { padding: 20px 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 26px 0 12px; }
.section-head h2 { font-size: 16px; margin: 0; letter-spacing: .01em; }
.section-head p { margin: 0; color: var(--ink-4); font-size: 12.5px; }
.muted { color: var(--ink-4); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; transition: .16s; white-space: nowrap;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--ink-5); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--line-2); color: var(--ink-3);
}
.tag.brand { background: var(--brand-soft); color: var(--brand-deep); }
.tag.up { background: #FDECEB; color: var(--up); }
.tag.down { background: #E9F8F1; color: var(--down); }
.tag.off { background: #F4F4F6; color: var(--ink-4); }

/* ---------------------------------------------------------------- 首页 */
.hero { position: relative; overflow: hidden; background: var(--surface); border-bottom: 1px solid var(--line); }
.hero-inner { max-width: 1180px; margin: 0 auto; padding: 64px 26px 58px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--brand); text-transform: uppercase; }
.hero-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--brand); }
.hero h1 { font-size: 40px; line-height: 1.22; margin: 16px 0 14px; letter-spacing: -.02em; font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lede { font-size: 15px; color: var(--ink-3); max-width: 30em; line-height: 1.85; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-slogan { margin-top: 26px; padding-top: 20px; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; letter-spacing: .06em; }
.hero-slogan b { color: var(--ink); font-weight: 600; }
.hero-art { position: relative; }
.hero-logo-card {
  background: linear-gradient(160deg, #fff 0%, #FAFAFB 100%);
  border: 1px solid var(--line); border-radius: 20px; padding: 34px;
  box-shadow: var(--shadow-2); display: grid; gap: 18px; place-items: center;
}
.hero-logo-card img { width: 100%; max-width: 300px; border-radius: 6px; }
.hero-logo-card .meta { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.hero-logo-card .meta div { padding: 9px 6px; border-radius: 10px; background: var(--bg); }
.hero-logo-card .meta b { display: block; font-size: 17px; letter-spacing: -.01em; }
.hero-logo-card .meta span { font-size: 10.5px; color: var(--ink-4); letter-spacing: .06em; text-transform: uppercase; }

/* 5 张卡片：上排 3 张、下排 2 张（各占一半宽），避免末行留空 */
.feature-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.feature { grid-column: span 2; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feature:nth-child(4), .feature:nth-child(5) { grid-column: span 3; }
.feature .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 17px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-size: 14px; }
.feature p { margin: 0; color: var(--ink-4); font-size: 12.8px; line-height: 1.75; }

/* ---------------------------------------------------------------- KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 15px; display: flex; flex-direction: column; gap: 6px;
}
.kpi .lab { font-size: 11.5px; color: var(--ink-4); letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 12px; font-weight: 600; color: var(--ink-4); margin-left: 3px; letter-spacing: 0; }
.kpi .sub { font-size: 11.5px; color: var(--ink-4); }
.kpi.accent { background: linear-gradient(180deg, #FFF 0%, #FFF8F8 100%); border-color: #F6DAD8; }

/* ---------------------------------------------------------------- 图表 */
.chart-card { padding: 18px 20px 10px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.chart-head h3 { margin: 0; font-size: 14.5px; }
.chart-head p { margin: 3px 0 0; font-size: 11.8px; color: var(--ink-4); }
.chart-tools { display: flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; padding: 2px; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); }
.seg button {
  border: none; background: transparent; padding: 4px 10px; border-radius: 6px;
  font-size: 11.5px; color: var(--ink-4); font-weight: 600;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 2px 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.8px; color: var(--ink-3); cursor: pointer; user-select: none; }
.legend-item .swatch { width: 9px; height: 9px; border-radius: 3px; }
.legend-item.off { opacity: .35; text-decoration: line-through; }
.legend-item b { font-weight: 600; }

.chart-canvas-wrap { position: relative; width: 100%; height: 340px; }
.chart-canvas-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: rgba(20, 22, 26, .94); color: #fff; border-radius: 9px;
  padding: 9px 11px; font-size: 11.5px; line-height: 1.6; min-width: 132px;
  box-shadow: var(--shadow-2); opacity: 0; transition: opacity .12s;
  transform: translate(-50%, -108%);
}
.chart-tip .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chart-tip .row span { color: rgba(255, 255, 255, .62); }
.chart-tip .hd { font-size: 10.5px; color: rgba(255, 255, 255, .5); margin-bottom: 4px; letter-spacing: .04em; }
.chart-tip i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* ---------------------------------------------------------------- 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.tbl.tbl-fixed { table-layout: fixed; }
/* Top10 列宽：桌面上由这里控制（不再写行内 style，窄屏才能覆盖）*/
table.tbl col.c-bar { width: 250px; }
table.tbl col.c-split { width: 150px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--ink-4); font-size: 11.3px;
  letter-spacing: .04em; text-transform: uppercase; padding: 10px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFCFD;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #FCFCFD; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.4px; }
table.tbl .name-cell { display: flex; align-items: center; gap: 9px; }
table.tbl .name-cell .swatch { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
table.tbl .name-cell b { font-weight: 600; }
.up-text { color: var(--up); }
.down-text { color: var(--down); }
.dim-text { color: var(--ink-4); }

/* Top10 条形：浅轨道 + 品牌色条，数字压在条右端 */
.barline { display: flex; align-items: center; justify-content: flex-end; gap: 9px; max-width: 220px; margin-left: auto; }
.barline .track { flex: 1; min-width: 80px; height: 10px; border-radius: 4px; background: #F3F4F6; overflow: hidden; }
.barline .bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #F7C9C6 0%, #E8322F 140%); }
.barline b { width: 30px; text-align: right; font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }

/* Top10 的智能体切换（分段标签，可横向滚动，窄屏不换行）*/
.seg {
  display: flex; gap: 6px; padding: 12px 14px 4px; overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg-btn {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  white-space: nowrap; transition: all .15s;
}
.seg-btn:hover { border-color: var(--brand); color: var(--brand); }
.seg-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- 消息页 */
.chat-shell { display: grid; grid-template-columns: 262px 1fr; height: 100%; }
.chat-side { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line-2); }
.chat-side-head h3 { margin: 0 0 2px; font-size: 13px; }
.chat-side-head p { margin: 0; font-size: 11px; color: var(--ink-4); }
.chat-list { overflow-y: auto; padding: 8px; flex: 1; }
.chat-item {
  display: flex; gap: 10px; padding: 10px 10px; border-radius: 10px; cursor: pointer;
  align-items: flex-start; transition: .14s;
}
.chat-item:hover { background: var(--bg); }
.chat-item.active { background: var(--brand-soft); }
.chat-item .ci-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--line-2); color: var(--ink-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.chat-item.active .ci-ico { background: var(--brand); color: #fff; }
.chat-item .ci-body { min-width: 0; flex: 1; }
.chat-item .ci-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .ci-meta { font-size: 10.8px; color: var(--ink-4); display: flex; gap: 6px; align-items: center; }
.chat-item .ci-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-top {
  padding: 12px 20px; background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px;
}
.chat-top .ct-title { min-width: 0; }
.chat-top .ct-title h2 { margin: 0; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top .ct-title p { margin: 1px 0 0; font-size: 11px; color: var(--ink-4); }
.search-box { margin-left: auto; position: relative; width: 320px; max-width: 42vw; }
.search-box input {
  width: 100%; height: 34px; padding: 0 32px 0 32px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); font-size: 12.5px; color: var(--ink);
  outline: none; transition: .16s;
}
.search-box input:focus { background: #fff; border-color: var(--ink-5); box-shadow: 0 0 0 3px rgba(20,22,26,.04); }
.search-box .mag { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: 13px; }
.search-box .clr { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--ink-4); font-size: 15px; padding: 3px 5px; border-radius: 6px; }

.msg-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 28px; scroll-behavior: smooth; }
.msg-scroll.searching { background: #FCFCFD; }
.msg-day { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--ink-5); font-size: 10.8px; letter-spacing: .06em; }
.msg-day::before, .msg-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.bubble-row { display: flex; margin-bottom: 14px; }
.bubble {
  max-width: min(880px, 86%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; box-shadow: var(--shadow-1); overflow: hidden;
}
.bubble-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: #FCFCFD; border-bottom: 1px solid var(--line-2); }
.bubble-head .bh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.bubble-head b { font-size: 12px; font-weight: 600; }
.bubble-head .bh-time { margin-left: auto; font-size: 10.8px; color: var(--ink-4); font-family: var(--mono); }
.bubble-body { padding: 12px 14px 13px; font-size: 12.9px; line-height: 1.78; color: var(--ink-2); }
.bubble-body .md-h { font-size: 13px; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.bubble-body .md-quote { color: var(--ink-4); font-size: 11.8px; margin: 0 0 2px; }
.bubble-body .md-p { margin: 0 0 6px; }
.bubble-body .md-list { margin: 2px 0 8px; padding-left: 16px; }
.bubble-body .md-list li { margin-bottom: 3px; }
.bubble-body .k-up { color: var(--up); font-weight: 700; }
.bubble-body .k-down { color: var(--down); font-weight: 700; }
.bubble-body .k-close { color: var(--ink-4); font-weight: 700; }
.bubble-body .k-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.bubble-body .md-sec { font-weight: 700; font-size: 12.4px; margin: 10px 0 5px; color: var(--ink); }

.empty-state { display: grid; place-items: center; padding: 60px 20px; text-align: center; color: var(--ink-4); }
.empty-state .ico { font-size: 30px; margin-bottom: 10px; opacity: .5; }
.empty-state h3 { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.empty-state p { margin: 0; font-size: 12.5px; max-width: 30em; }

.load-more { text-align: center; padding: 6px 0 10px; font-size: 11.5px; color: var(--ink-5); }

/* 智能体卡片页 */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.agent-card { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: .16s; cursor: pointer; }
.agent-card:hover { border-color: var(--ink-5); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.agent-card h3 { margin: 0 0 4px; font-size: 13.5px; }
.agent-card .ac-meta { font-size: 11.5px; color: var(--ink-4); display: flex; gap: 10px; flex-wrap: wrap; }
.agent-card .ac-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--ink-4); }

/* ---------------------------------------------------------------- 管理台 */
.admin-grid { display: grid; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 13.5px; }
.panel-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-4); }
.panel-body { padding: 0; }

.inp {
  height: 30px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; font-size: 12.3px; color: var(--ink); outline: none; width: 100%;
  font-family: var(--mono);
}
.inp:focus { border-color: var(--ink-4); box-shadow: 0 0 0 3px rgba(20,22,26,.04); }
.inp.text { font-family: var(--sans); }
select.inp { font-family: var(--sans); padding-right: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; font-size: 11.5px; color: var(--ink-3); cursor: pointer;
}
.chip.on { background: var(--brand-soft); border-color: #F6D4D1; color: var(--brand-deep); font-weight: 600; }
.chip input { display: none; }

.sub-panel { background: #FCFCFD; border-top: 1px dashed var(--line); }
.sub-panel td { padding: 14px 16px !important; }
.perm-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.perm-row .lab { font-size: 11.5px; color: var(--ink-4); padding-top: 5px; min-width: 68px; }

.stat-line { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--ink-4); }
.stat-line b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- 弹层 / 提示 */
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(16, 24, 40, .38);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px;
  animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  position: relative; width: 100%; max-width: 400px; background: #fff;
  border-radius: 18px; box-shadow: 0 24px 60px -12px rgba(16,24,40,.35); padding: 26px 26px 22px;
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-close { position: absolute; right: 12px; top: 10px; border: none; background: transparent; font-size: 21px; color: var(--ink-4); line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.modal-brand img { height: 24px; border-radius: 4px; }
.modal-brand h3 { margin: 0; font-size: 16px; }
.modal-brand p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-4); }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 5px; font-weight: 600; letter-spacing: .02em; }
.field input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; outline: none; transition: .16s;
}
.field input:focus { border-color: var(--ink-4); box-shadow: 0 0 0 3px rgba(20,22,26,.05); }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; font-family: var(--mono); letter-spacing: .18em; }
.row-inline .btn { height: 38px; flex: 0 0 auto; }

.form-error { min-height: 17px; margin: 2px 0 10px; font-size: 11.8px; color: var(--brand); }
.auth-links { display: flex; gap: 14px; justify-content: center; margin-top: 14px; font-size: 11.8px; }
.auth-links a { color: var(--ink-3); border-bottom: 1px solid transparent; }
.auth-links a:hover { color: var(--brand); border-color: var(--brand); }
.auth-note { margin: 12px 0 0; font-size: 11px; color: var(--ink-4); text-align: center; line-height: 1.6; }
.auth-note code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
/* 演示邮件模式：做成醒目的告示条，避免误以为已经发了邮件 */
.auth-note.demo {
  margin: 14px 0 0; text-align: left; font-size: 11.5px; line-height: 1.65;
  padding: 9px 11px; border-radius: 9px; color: #8A5300;
  background: #FFF7E8; border: 1px solid #F3DDAF;
}
.auth-note.demo b { color: #C4791A; margin-right: 3px; }

.toast-wrap { position: fixed; right: 20px; bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; font-size: 12.5px; padding: 10px 14px; border-radius: 10px;
  box-shadow: var(--shadow-2); animation: slidein .2s ease-out; max-width: 340px;
}
.toast.ok { background: #0E7A52; }
.toast.err { background: #B3251F; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0 } to { transform: none; opacity: 1 } }

.skeleton { background: linear-gradient(90deg, #F2F3F5 25%, #EAEBEE 37%, #F2F3F5 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: 1fr; padding: 44px 22px; }
  .hero-art { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  /* 收成单列时必须清掉 6 栏的 span，否则会撑出隐式列 */
  .feature-grid { grid-template-columns: 1fr; }
  .feature, .feature:nth-child(4), .feature:nth-child(5) { grid-column: auto; }
}
@media (max-width: 860px) {
  .topbar { padding: 0 14px; gap: 12px; height: 56px; }
  .brand-text i { display: none; }
  .mainnav { gap: 0; overflow-x: auto; }
  .mainnav a { padding: 6px 9px; font-size: 12.5px; }
  .user-meta { display: none; }
  .wrap { padding: 18px 14px 30px; }
  .hero h1 { font-size: 28px; }
  .chat-shell { grid-template-columns: 1fr; height: 100%; }
  .chat-side { display: none; }
  .chat-side.mobile-open { display: flex; position: absolute; z-index: 30; inset: 56px 0 0 0; }
  .search-box { width: 160px; }
  .chart-canvas-wrap { height: 260px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ---------------------------------------------------------------- 手机竖屏 */
@media (max-width: 720px) {
  /* 顶栏：只留 logo，把宽度让给导航，避免导航被挤成竖排 */
  .brand-text, .brand-divider { display: none; }
  .topbar { gap: 8px; }
  .mainnav { gap: 0; overflow-x: auto; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .topbar-right { gap: 6px; }

  /* 段落标题：窄屏改为上下排，标题不再被副文案挤压换行 */
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; margin: 22px 0 10px; }
  .section-head h2 { font-size: 15px; }

  /* Top10：固定布局在窄屏会把「标的」列压成 0 宽 ⇒ 退回自动布局并按比例收窄 */
  table.tbl.tbl-fixed { table-layout: auto; }
  table.tbl col.c-bar { width: 96px; }
  table.tbl col.c-split { width: 70px; }
  table.tbl th, table.tbl td { padding: 10px 8px; }
  table.tbl th { font-size: 11.5px; }
  .barline { max-width: 96px; gap: 6px; }
  .barline .track { min-width: 28px; height: 8px; }
  .barline b { width: auto; min-width: 20px; font-size: 11.5px; }
  /* 标的单元格：代码与名称上下排，避免逐字换行 */
  table.tbl .name-cell { flex-direction: column; align-items: flex-start; gap: 1px; line-height: 1.3; }
  table.tbl .name-cell b { font-size: 12px; word-break: break-all; }
  table.tbl .name-cell .dim-text { font-size: 11px; }
  table.tbl .num { font-size: 11.8px; }

  /* KPI 与小节留白收紧 */
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px 14px; }
  .chart-card { padding: 14px 12px 6px; }
  .chart-canvas-wrap { height: 230px; }
  .seg { padding: 10px 10px 2px; }
  .seg-btn { padding: 5px 10px; font-size: 12px; }

  /* 各智能体指标：7 列在 390px 里会被压到每列 ~50px，中文逐字换行 ⇒
     给表一个下限宽度让它横向滚动，而不是纵向压扁 */
  #agent-table table { min-width: 660px; }
  #agent-table .name-cell { flex-wrap: nowrap; white-space: nowrap; }
  #agent-table th, #agent-table td { padding: 10px 10px; }
}
