/* cnstock 平台设计系统：设计令牌 + 组件 + 响应式布局（PC ≥1024 / 平板 768–1023 / 手机 <768）
   无外部依赖、无构建步骤；深浅色跟随系统，可手动切换（data-theme）。A 股习惯：红涨绿跌。 */

/* ---------- 设计令牌 ---------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --sidebar-w: 232px; --sidebar-w-collapsed: 68px; --topbar-h: 56px; --tabbar-h: 60px;

  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #eef2f7;
  --text: #111827; --text-2: #4b5563; --muted: #6b7280;
  --line: #e5e7eb; --line-strong: #d1d5db;
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-soft: #eff4ff; --on-primary: #fff;
  --up: #dc2626; --up-soft: #fef2f2; --down: #16a34a; --down-soft: #f0fdf4;
  --success: #16a34a; --success-soft: #ecfdf3; --danger: #dc2626; --danger-soft: #fef2f2;
  --warning: #d97706; --warning-soft: #fffbeb; --info: #0891b2; --info-soft: #ecfeff; --neutral-soft: #f3f4f6;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.04);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.16);
  --focus: 0 0 0 3px rgba(37,99,235,.28);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --surface: #121826; --surface-2: #161d2d; --surface-3: #1d2638;
    --text: #e5e9f0; --text-2: #b6bfcc; --muted: #8b95a5;
    --line: #232c3d; --line-strong: #2f3a4f;
    --primary: #5b8cff; --primary-hover: #7aa2ff; --primary-soft: rgba(91,140,255,.14); --on-primary: #0b0f17;
    --up: #f87171; --up-soft: rgba(248,113,113,.14); --down: #4ade80; --down-soft: rgba(74,222,128,.12);
    --success: #4ade80; --success-soft: rgba(74,222,128,.12); --danger: #f87171; --danger-soft: rgba(248,113,113,.14);
    --warning: #fbbf24; --warning-soft: rgba(251,191,36,.14); --info: #22d3ee; --info-soft: rgba(34,211,238,.12); --neutral-soft: #1d2638;
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    --focus: 0 0 0 3px rgba(91,140,255,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --surface: #121826; --surface-2: #161d2d; --surface-3: #1d2638;
  --text: #e5e9f0; --text-2: #b6bfcc; --muted: #8b95a5;
  --line: #232c3d; --line-strong: #2f3a4f;
  --primary: #5b8cff; --primary-hover: #7aa2ff; --primary-soft: rgba(91,140,255,.14); --on-primary: #0b0f17;
  --up: #f87171; --up-soft: rgba(248,113,113,.14); --down: #4ade80; --down-soft: rgba(74,222,128,.12);
  --success: #4ade80; --success-soft: rgba(74,222,128,.12); --danger: #f87171; --danger-soft: rgba(248,113,113,.14);
  --warning: #fbbf24; --warning-soft: rgba(251,191,36,.14); --info: #22d3ee; --info-soft: rgba(34,211,238,.12); --neutral-soft: #1d2638;
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  --focus: 0 0 0 3px rgba(91,140,255,.35);
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }
h1 { font-size: 20px; } h2 { font-size: 15px; } h3 { font-size: 14px; margin: var(--space-4) 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 4px; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4);
      overflow: auto; line-height: 1.55; max-height: 72vh; margin: 0; }
pre.wrap { white-space: pre-wrap; word-break: break-word; max-height: none; font-family: var(--font); font-size: 14px; line-height: 1.75; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--up); font-weight: 500; } .neg { color: var(--down); font-weight: 500; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line);
           display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 var(--space-5); font-weight: 650; font-size: 15px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--text); }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff;
               background: linear-gradient(135deg, #3b82f6, #6366f1); }
.nav { padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section { margin: var(--space-4) var(--space-3) var(--space-1); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary); }
.nav svg, .tabbar svg, .icon { width: 18px; height: 18px; flex: none; }
.sidebar-foot { border-top: 1px solid var(--line); padding: var(--space-3) var(--space-4); font-size: 12px; color: var(--muted); }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-3);
          padding: 0 var(--space-6); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(10px);
          -webkit-backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.content { max-width: 1320px; margin: 0 auto; padding: var(--space-6); }
.menu-btn { display: none; }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.page-head .actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: var(--space-5); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
             padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.card-head .hint { font-size: 12px; color: var(--muted); }
.card-body { padding: var(--space-4) var(--space-5); }
.card-body.flush { padding: 0; }
.card-foot { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* 指标块 */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); box-shadow: var(--shadow-sm); min-width: 0; }
.stat .label { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.accent { border-left: 3px solid var(--primary); }

/* ---------- 徽标 / 状态 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
         background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success, .s-success { background: var(--success-soft); color: var(--success); }
.badge.danger, .s-failed, .s-timeout, .s-interrupted { background: var(--danger-soft); color: var(--danger); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.info, .s-running { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.s-skipped { background: var(--neutral-soft); color: var(--muted); }

/* ---------- 提示 ---------- */
.alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius);
         background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); margin-bottom: var(--space-4); }
.alert.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.alert .close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: var(--space-3) 0 0; }

/* ---------- 按钮 / 表单 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
       border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 500 14px/1 var(--font); cursor: pointer;
       white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; text-decoration: none; }
.btn:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.input, input:not([type]), input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], select, textarea {
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: 14px var(--font); min-width: 0; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 8px 10px; line-height: 1.6; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: -3px; }
input.cron { width: 140px; font-family: var(--mono); font-size: 13px; }
input.w-xs { width: 76px; } input.w-sm { width: 120px; } input.w-md { width: 220px; } input.w-lg { width: 320px; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .field-label { font-size: 12px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 6px; }
.range { display: flex; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: var(--space-4) var(--space-5); align-items: start; }
.form-grid > label { padding-top: 8px; color: var(--text-2); font-weight: 500; }
.form-grid .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; user-select: none; white-space: nowrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: 12.5px; text-align: left;
            padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.table th.num, .table td.num { text-align: right; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.wrap { white-space: normal; min-width: 160px; }
.table .empty td { text-align: center; color: var(--muted); padding: 32px 12px; }
.table .stock b { font-weight: 500; } .table .stock .code { color: var(--muted); font-size: 12px; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* 图表 */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-strong); } .chart .tick { fill: var(--muted); font-size: 11px; }
.legends { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: var(--space-3); }
.legend { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; background: none; border: 1px solid transparent;
          border-radius: 999px; padding: 3px 8px; margin: -3px -8px; cursor: pointer; font: inherit; font-size: 12.5px; transition: opacity .15s, background .15s; }
.legend:hover { background: var(--surface-2); }
.legend:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.legend[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.legend-all { font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; margin-left: auto; }
svg.chart polyline.off { display: none; }
.chart-box { position: relative; }
.chart-box svg.chart { cursor: crosshair; touch-action: pan-y; }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .dot { stroke: var(--surface, #fff); stroke-width: 1.5; }
.chart-tip { position: absolute; top: 0; z-index: 5; pointer-events: none; min-width: 190px; padding: 8px 10px;
             background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
             font-size: 12.5px; line-height: 1.6; }
.chart-tip .d { font-weight: 600; margin-bottom: 2px; }
.chart-tip .r { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-tip .r i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip .r .v { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.chart-tip .r .s { color: var(--muted); font-size: 11.5px; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.chart-tip .h { color: var(--muted); font-size: 11px; display: flex; justify-content: flex-end; gap: 6px; }
.chart-tip .h span:first-child { margin-left: auto; padding-left: 12px; }
.chart-tip .h span:last-child { min-width: 64px; text-align: right; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* 主题切换 */
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; } :root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .sun { display: block; } :root:not([data-theme="light"]) .theme-toggle .moon { display: none; } }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 12px; }

/* 手机底部标签栏（默认隐藏） */
.tabbar { display: none; }
.scrim { display: none; }

/* ---------- 平板：侧栏收为图标栏 ---------- */
@media (max-width: 1023.98px) {
  .sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar .brand span, .sidebar .nav span, .sidebar .nav-section, .sidebar-foot { display: none; }
  .sidebar .brand { justify-content: center; padding: 0; }
  .sidebar .nav a { justify-content: center; padding: 11px 0; }
  .main { margin-left: var(--sidebar-w-collapsed); }
  .content { padding: var(--space-5); }
  .topbar { padding: 0 var(--space-5); }
  .grid-2 { grid-template-columns: minmax(0,1fr); }
}

/* ---------- 手机：抽屉侧栏 + 底部标签栏 + 表格变卡片 ---------- */
@media (max-width: 767.98px) {
  body { font-size: 14.5px; }
  .sidebar { width: 264px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar .brand span, .sidebar .nav span, .sidebar .nav-section, .sidebar-foot { display: initial; }
  .sidebar .nav-section { display: block; }
  .sidebar .brand { justify-content: flex-start; padding: 0 var(--space-5); }
  .sidebar .nav a { justify-content: flex-start; padding: 11px 12px; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--space-3); }
  .topbar .hide-sm { display: none; }
  .content { padding: var(--space-4) var(--space-3); }
  .page-head { margin-bottom: var(--space-4); }
  h1 { font-size: 18px; }
  .card { border-radius: var(--radius); margin-bottom: var(--space-4); }
  .card-head, .card-body { padding: var(--space-3) var(--space-4); }
  .grid-kpi { grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--space-3); }
  .stat { padding: var(--space-3); } .stat .value { font-size: 19px; }
  .form-grid { grid-template-columns: minmax(0,1fr); gap: var(--space-2); }
  .form-grid > label { padding-top: var(--space-2); }
  input.w-md, input.w-lg { width: 100%; }
  .toolbar { gap: var(--space-2); } .toolbar .field { flex: 1 1 140px; } .toolbar .btn { flex: 1 1 auto; }
  .toolbar input[type=date] { width: 100%; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
            height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
            background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
            border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
            color: var(--muted); background: none; border: 0; font-family: var(--font); cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .on { color: var(--primary); }
  .tabbar svg { width: 22px; height: 22px; }

  /* 表格 → 卡片：每行一张卡，单元格显示“列名：值”（列名由 app.js 从表头写入 data-label） */
  table.table.stack thead { display: none; }
  table.table.stack, table.table.stack tbody, table.table.stack tr, table.table.stack td { display: block; width: 100%; }
  table.table.stack tr { border-bottom: 1px solid var(--line); padding: var(--space-3) var(--space-4); }
  table.table.stack tbody tr:last-child { border-bottom: 0; }
  table.table.stack tbody tr:hover td { background: none; }
  table.table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: var(--space-3); white-space: normal; text-align: right; }
  table.table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; max-width: 45%; }
  table.table.stack td.primary-cell { font-size: 15px; font-weight: 600; justify-content: flex-start; text-align: left; padding-bottom: 6px; }
  table.table.stack td.primary-cell::before { display: none; }
  table.table.stack td:empty, table.table.stack td.hide-sm { display: none; }
  table.table.stack td.wrap { min-width: 0; }
  table.table.stack .empty td { justify-content: center; }
  table.table.stack .empty td::before { display: none; }
}

/* ---------- 登录页 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5);
        background: radial-gradient(1200px 600px at 10% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
             box-shadow: var(--shadow-lg); padding: 32px 28px; }
.auth-card .brand { padding: 0; height: auto; margin-bottom: var(--space-5); font-size: 18px; }
.auth-card .field { margin-bottom: var(--space-4); } .auth-card input { width: 100%; height: 40px; }
.auth-card .btn { width: 100%; height: 42px; margin-top: var(--space-2); }

@media print { .sidebar, .topbar, .tabbar { display: none !important; } .main { margin: 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- 个股分析报告 ---------- */
.prose { font-size: 14.5px; line-height: 1.8; color: var(--text); max-width: 860px; }
.prose h2, .prose h3, .prose h4, .prose h5 { margin: 1.4em 0 .5em; line-height: 1.4; }
.prose h2 { font-size: 20px; } .prose h3 { font-size: 17px; } .prose h4, .prose h5 { font-size: 15px; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: .6em 0; } .prose ul, .prose ol { margin: .5em 0; padding-left: 1.4em; } .prose li { margin: .25em 0; }
.prose blockquote { margin: .8em 0; padding: 6px 12px; border-left: 3px solid var(--line-strong); color: var(--text-2); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.prose code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pick-list button { text-align: left; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--info-soft); border-top-color: var(--info); animation: spin 1s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
details.ctx summary { cursor: pointer; color: var(--text-2); }

/* ---------- 可视化排期（流水线 cron） ---------- */
.cron-ui { display: flex; flex-direction: column; gap: 6px; min-width: 248px; }
.cron-ui .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cron-ui .tm { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.cron-ui .tm select { width: 66px; min-width: 0; padding-right: 20px; }
.cron-ui .adv { align-self: flex-start; }
.cron-ui .dow { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.cron-ui .dow button { border: 0; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; width: 30px; height: 30px; cursor: pointer; padding: 0; }
.cron-ui .dow button + button { border-left: 1px solid var(--line); }
.cron-ui .dow button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.cron-ui .dow button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.cron-ui .presets { display: flex; gap: 10px; font-size: 12px; }
.cron-ui .presets button, .cron-ui .adv { border: 0; background: none; padding: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: 12px; }
.cron-ui .adv { color: var(--muted); }
.cron-ui .sum { font-size: 12px; color: var(--muted); }
.cron-ui .sum.bad { color: var(--danger); }
.cron-ui.simple input.cron { display: none; }
.cron-ui:not(.simple) .vis { display: none; }

/* ---------- 删除 / 批量操作 ---------- */
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost.danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.table th.sel, .table td.sel { width: 36px; padding-right: 0; }
.table td.ops { white-space: nowrap; }
.bulk-bar { display: flex; align-items: center; gap: 12px; }
@media (max-width: 767px) { table.table.stack td.sel { justify-content: flex-start; } table.table.stack td.sel::before { content: "选择"; } }

/* ---------- 推荐统计 ---------- */
.stats-filter { display: flex; flex-direction: column; gap: 12px; }
.stats-filter .frow { display: flex; gap: 12px; align-items: flex-start; }
.stats-filter .flabel { flex: none; width: 64px; font-size: 12.5px; color: var(--muted); padding-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; flex: 1; min-width: 0; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 12.5px; color: var(--text-2); background: var(--surface); transition: all .12s; }
.chip:hover span { border-color: var(--primary); }
.chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 500; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.linkbtn { border: 0; background: none; color: var(--primary); cursor: pointer; font: inherit; font-size: 12.5px; padding: 0 2px; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-left: 4px; }
.custom-range input { width: 140px; }
.chips .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; padding: 5px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sortable.on { color: var(--text); }
th.sortable .arr { margin-left: 3px; color: var(--primary); }
@media (max-width: 767px) {
  .stats-filter .frow { flex-direction: column; gap: 6px; }
  .stats-filter .flabel { width: auto; padding-top: 0; }
  .custom-range { margin-left: 0; width: 100%; } .custom-range input { flex: 1; width: auto; }
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 767px) { table.table.stack .badges { justify-content: flex-end; } }

/* ---------- 单只股票推荐记录 + K 线 ---------- */
.kline-host { position: relative; }
.kline-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kline { display: block; }
.kline .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.kline .kline-out { fill: var(--surface-2); opacity: .7; }
.kline-tip { min-width: 170px; }
.kline-tip .r.rec { margin-top: 2px; }
.src-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.rec-table tbody tr[data-buy] { cursor: pointer; }
.rec-table tbody tr.sel td { background: var(--primary-soft); }
.seg-table tbody tr[data-buy] { cursor: pointer; }
.seg-table tbody tr.sel td { background: var(--primary-soft); }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.card-head .chips { flex: 0 1 auto; justify-content: flex-end; }

/* ---------- 总览 ---------- */
.ov-status .card-body { display: flex; align-items: center; gap: 12px 36px; flex-wrap: wrap; }
.ov-item { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ov-k { font-size: 12px; color: var(--muted); }
.ov-v { font-weight: 600; font-size: 14.5px; }
.ov-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.ov-dot.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.ov-dot.warn { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.ov-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.ov-dot.info { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.ov-go { margin-left: auto; }
.ov-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5, 20px); }
.ov-pick { display: flex; flex-direction: column; margin-bottom: 0; }
.ov-pick.hl { border-top: 3px solid var(--primary); }
.ov-pick .card-head h2 { font-size: 15px; }
.ov-list { list-style: none; counter-reset: ov; margin: 0; padding: 4px 16px 8px; flex: 1; }
.ov-list li { counter-increment: ov; display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ov-list li:last-child { border-bottom: 0; }
.ov-list li::before { content: counter(ov); width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ov-list li.muted::before { display: none; }
.ov-list li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ov-list li a:hover { color: var(--primary); }
.ov-more { display: block; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--primary); }
.ov-bottom { align-items: start; }
.ov-bottom .card { margin-bottom: 0; }
.ov-timeline { list-style: none; margin: 0; padding: 8px 16px 12px; }
.ov-timeline li { display: grid; grid-template-columns: 48px 14px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; position: relative; }
.ov-timeline .tm { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.ov-timeline .tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); justify-self: center; }
.ov-timeline li.st-success .tl-dot { background: var(--success); }
.ov-timeline li.st-failed .tl-dot, .ov-timeline li.st-timeout .tl-dot, .ov-timeline li.st-interrupted .tl-dot { background: var(--danger); }
.ov-timeline li.st-running .tl-dot { background: var(--info); }
.ov-timeline li.st-skipped .tl-dot { background: var(--warning); }
.ov-timeline li.st-upcoming .tl-dot { background: var(--surface); border: 2px solid var(--info); }
.ov-timeline li.st-none { opacity: .5; }
@media (max-width: 1023px) { .grid-2.ov-bottom { grid-template-columns: 1fr; } }
@media (max-width: 767px) { .ov-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .ov-list { padding: 2px 12px 6px; } .ov-pick .card-head { padding: 10px 12px; } .ov-more { padding: 8px 12px; } }
.table tr.is-paused td.primary-cell { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* ---------- K 线预测区与关键价位 ---------- */
.kline .kline-future { fill: var(--surface-2); opacity: .55; }
.kline .fc-p95 { fill: #94a3b8; opacity: .13; }
.kline .fc-p68 { fill: #94a3b8; opacity: .22; }
.kline .fc-agent { fill: #2563eb; opacity: .16; stroke: #2563eb; stroke-opacity: .45; stroke-width: 1; stroke-dasharray: 3 3; }
.kline .fc-center { fill: none; stroke: #2563eb; stroke-width: 1.8; stroke-dasharray: 6 4; }
.kline .fc-dot { fill: #2563eb; stroke: var(--surface); stroke-width: 1.5; }
.kline .fc-lbl { fill: #2563eb; font-weight: 600; }
.kline .lv { stroke-width: 1; stroke-dasharray: 2 3; }
.kline .lv-stat { stroke: var(--muted); opacity: .55; }
.kline .lv-support { stroke: var(--success); }
.kline .lv-resist { stroke: var(--danger); }
.kline .lv-t { font-size: 10.5px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.kline .lv-t-support { fill: var(--success); } .kline .lv-t-resist { fill: var(--danger); }
.fc-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.fc-legend i { display: inline-block; width: 18px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.fc-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fc-summary .stat .value { font-size: 18px; }
.mf-chart { display: block; max-width: 100%; }
.mf-chart .tick { fill: var(--muted); font-size: 11px; }
.seg a.seg-a { display: inline-block; color: var(--text-2); font-size: 12.5px; padding: 5px 12px; }
.seg a.seg-a + a.seg-a { border-left: 1px solid var(--line); }
.seg a.seg-a[aria-pressed="true"] { background: var(--primary); color: #fff; }

/* ---------- 实时行情 ---------- */
.rt-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; margin-right: 8px; cursor: pointer; }
.rt-chip input { margin: 0 0 0 4px; }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.rt-dot.on { background: var(--danger); box-shadow: 0 0 0 0 rgba(220,38,38,.5); animation: rtpulse 2s infinite; }
@keyframes rtpulse { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.45); } 70% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); } }
.rt-tag { display: inline-block; font-size: 10.5px; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: 4px; padding: 0 4px; line-height: 15px; vertical-align: 1px; }

/* ---------- 盘中推荐 ---------- */
.ir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 0 var(--space-4); }
.ir-grid .card.hl { border-top: 3px solid var(--primary); }
@media (max-width: 767px) { .ir-grid { grid-template-columns: 1fr; } }

/* ---------- 推荐跟踪：按日汇总热力表 ---------- */
.grid-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 10px; }
.table.heat td, .table.heat th { padding: 6px 10px; }
.table.heat td.hc { padding: 0; }
.table.heat td.hc a { display: block; padding: 6px 10px; color: var(--text); }
.table.heat td.hc a:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.table.heat td.hc a.pend b, .table.heat td.hc a.pend div { font-style: italic; }
.table.heat tr.tot td { background: var(--surface-2); border-bottom: 2px solid var(--line-strong); }
.table.heat .nowrap { white-space: nowrap; }
.table.heat tbody tr:hover td { background: inherit; }
details.detail-list > summary { cursor: pointer; padding: 12px 16px; color: var(--primary); font-size: 13.5px; border-bottom: 1px solid var(--line); }

/* ---------- 分时图 ---------- */
.mt-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.mt-head select { width: auto; }
#minute-box .kline-host { position: relative; }
.seg button[role=tab] { min-width: 64px; }
.k-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.k-range .chips { flex: 1; }

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager a[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* 只读权限：隐藏会修改数据的表单和按钮 */
body.readonly .content form[method="post"], body.readonly .content form[method="POST"], body.readonly .content [data-op] { display: none !important; }
.perm-grid td, .perm-grid th { white-space: nowrap; }
.perm-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.perm-seg label { padding: 3px 10px; font-size: 12.5px; cursor: pointer; border-left: 1px solid var(--line); user-select: none; }
.perm-seg label:first-child { border-left: 0; }
.perm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.perm-seg input:checked + span { font-weight: 600; }
.perm-seg label:has(input:checked) { background: var(--primary-soft); color: var(--primary); }
.perm-seg label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.lv-0 { color: var(--muted); } .lv-1 { color: var(--primary); } .lv-2 { color: #16a34a; font-weight: 600; }
