/* 灵枢 · 个人工作台 —— 样式（无构建，纯 CSS，浅色主题） */
:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #e2e7f0;
  --line-soft: #edf1f7;
  --text: #1b2333;
  --muted: #5c6679;
  --faint: #8c95a6;
  --accent: #c8860a;
  --accent-strong: #a86f00;
  --accent-2: #0d6fd8;
  --up: #d92b3a;
  --down: #0e9f6e;
  --ok: #0e9f6e;
  --warn: #c8860a;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(27, 35, 51, .07);
  --shadow-lg: 0 16px 44px rgba(27, 35, 51, .16);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 15% -10%, #e8eefb 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* ── 侧栏 ───────────────────────────────────────────────── */
.sidebar {
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px;
  background: linear-gradient(180deg, #ffffff, #f8fafd);
  border-right: 1px solid var(--line-soft);
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 11px; font-size: 19px; font-weight: 700; color: #4a3200;
  background: linear-gradient(140deg, #ffd166, var(--accent));
  box-shadow: 0 6px 16px rgba(200, 134, 10, .22);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: .5px; }
.brand-text span { font-size: 11px; color: var(--faint); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  text-align: left; transition: background .15s, color .15s;
}
.nav-item i { font-style: normal; width: 18px; text-align: center; opacity: .9; }
.nav-item:hover { background: #f1f4fa; color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(200, 134, 10, .13), rgba(200, 134, 10, .02));
  color: var(--accent-strong); box-shadow: inset 2px 0 0 var(--accent);
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.health { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(14, 159, 110, .16); }
.dot.bad { background: var(--up); box-shadow: 0 0 0 3px rgba(217, 43, 58, .16); }
.side-meta { font-size: 11px; color: var(--faint); word-break: break-all; }

/* ── 主区 ───────────────────────────────────────────────── */
.main { padding: 24px 30px 60px; max-width: 1520px; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 22px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 23px; letter-spacing: .4px; }
.topbar .sub { margin: 4px 0 0; color: var(--faint); font-size: 12.5px; }
.topbar-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ── 通用组件 ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: #ffffff; color: var(--text);
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:hover { background: #f4f7fc; border-color: #cfd8e6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(140deg, #ffd166, var(--accent)); color: #4a3200; border-color: transparent; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.05); background: linear-gradient(140deg, #ffd166, var(--accent)); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-danger { color: #c0272d; border-color: #f0c9cc; }
.btn-danger:hover { background: #fdf1f2; border-color: #e8a9ae; }

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; letter-spacing: .3px; }
.card-head .hint { color: var(--faint); font-size: 12px; }

.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

.stat {
  background: var(--panel);
  border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 15px 17px;
  box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--faint); }
.stat .v { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: .3px; }
.stat .x { font-size: 12px; color: var(--muted); margin-top: 3px; }

.tag {
  display: inline-block; padding: 1.5px 8px; border-radius: 999px;
  font-size: 11.5px; background: #f2f5fa; color: var(--muted); border: 1px solid var(--line);
}
.tag.accent { background: rgba(200, 134, 10, .1); color: var(--accent-strong); border-color: rgba(200, 134, 10, .28); }
.tag.cyan { background: rgba(13, 111, 216, .08); color: var(--accent-2); border-color: rgba(13, 111, 216, .24); }
.tag.up { background: rgba(217, 43, 58, .08); color: var(--up); border-color: rgba(217, 43, 58, .24); }
.tag.down { background: rgba(14, 159, 110, .09); color: var(--down); border-color: rgba(14, 159, 110, .26); }

.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th { font-size: 12px; color: var(--faint); font-weight: 500; background: #f8fafd; position: sticky; top: 0; }
tbody tr:hover { background: #f8fafd; }
.table-wrap { overflow-x: auto; }

input, select, textarea {
  background: #ffffff; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: #8fbdf0; box-shadow: 0 0 0 3px rgba(13, 111, 216, .1); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar input[type=text] { flex: 1 1 220px; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #ffffff; color: var(--muted); font-size: 12.5px;
}
.chip:hover { color: var(--text); border-color: #cfd8e6; }
.chip.active { background: rgba(200, 134, 10, .1); color: var(--accent-strong); border-color: rgba(200, 134, 10, .35); }

/* 情报条目 */
.item { border-bottom: 1px solid var(--line-soft); padding: 13px 2px; }
.item:last-child { border-bottom: 0; }
.item h3 { margin: 0 0 5px; font-size: 14.5px; line-height: 1.5; font-weight: 600; }
.item h3 a { color: var(--text); }
.item h3 a:hover { color: var(--accent-2); }
.item .meta { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.item .insight {
  margin-top: 7px; padding: 8px 11px; border-left: 2px solid rgba(200, 134, 10, .55);
  background: rgba(200, 134, 10, .05); border-radius: 0 8px 8px 0;
  font-size: 12.5px; color: #3f4a5e;
}
.item .summary { margin-top: 5px; color: var(--muted); font-size: 12.5px; }

/* 中文说明（大模型生成） */
.item .zh {
  margin-top: 7px; padding: 9px 12px; border-radius: 8px;
  background: #f7f9fc; border: 1px solid var(--line-soft);
  font-size: 13px; line-height: 1.68; color: var(--text);
}
.item .feature {
  margin-top: 6px; padding: 8px 12px; border-left: 2px solid rgba(13, 111, 216, .5);
  background: rgba(13, 111, 216, .05); border-radius: 0 8px 8px 0;
  font-size: 12.5px; line-height: 1.65; color: #3f4a5e;
}
.item .feature b { color: var(--accent-2); font-weight: 600; margin-right: 7px; }

/* 个人收藏（录入网址 → 解析标题与简介） */
.bm-row { display: flex; gap: 11px; padding: 13px 2px; border-bottom: 1px solid var(--line-soft); }
.bm-row:last-child { border-bottom: none; }
.bm-icon {
  width: 30px; height: 30px; flex: none; border-radius: 8px; margin-top: 1px;
  border: 1px solid var(--line); background: var(--panel-2); object-fit: contain; padding: 3px;
}
.bm-icon-text { display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--accent); padding: 0; }
.bm-main { flex: 1; min-width: 0; }
.bm-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; line-height: 1.5; }
.bm-title a { color: var(--text); }
.bm-title a:hover { color: var(--accent-2); }
.bm-host { font-size: 12px; font-weight: 400; color: var(--faint); }
.bm-desc { margin-top: 5px; font-size: 12.5px; line-height: 1.65; color: var(--muted); word-break: break-word; }
.bm-desc.en { color: var(--faint); font-size: 12px; margin-top: 3px; }
.bm-desc.faint { color: var(--faint); font-style: italic; }
.bm-note {
  margin-top: 6px; padding: 6px 10px; border-radius: 8px; display: inline-block;
  background: rgba(200, 134, 10, .09); border: 1px solid rgba(200, 134, 10, .22);
  font-size: 12.5px; color: #6b4a00;
}
.bm-preview {
  margin-top: 6px; padding: 12px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.bm-preview .bm-title { font-size: 13.5px; }
.modal h3 { margin: 0 0 6px; font-size: 16px; }

.bar { height: 6px; border-radius: 999px; background: #edf1f7; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

.theme-row { display: grid; grid-template-columns: 130px 1fr 74px; gap: 11px; align-items: center; padding: 7px 0; }
.theme-row .name { font-size: 13px; }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; word-break: break-all; }

.empty { padding: 26px; text-align: center; color: var(--faint); font-size: 13px; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(200, 134, 10, .25); border-top-color: var(--accent);
  animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 今日简报 ── */
.brief-headline { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.brief-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.brief-body { white-space: pre-wrap; font-size: 13px; line-height: 1.65; }
.brief-section { margin-bottom: 14px; }
.brief-section:last-child { margin-bottom: 0; }
.brief-cat { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent-strong); margin-bottom: 6px; }
.brief-item { font-size: 13px; line-height: 1.6; padding: 3px 0 3px 14px; border-left: 2px solid var(--line); margin-bottom: 4px; }
.brief-item a { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; }
.brief-item a:hover { color: var(--accent-2); border-bottom-color: var(--accent-2); }

/* Toasts & Modal */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 60; pointer-events: none; }
.toasts > * { pointer-events: auto; }
.toast {
  padding: 10px 15px; border-radius: 10px; background: #ffffff;
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13px; max-width: 380px;
  animation: slide .22s ease-out;
}
.toast.ok { border-color: rgba(14, 159, 110, .45); }
.toast.err { border-color: rgba(217, 43, 58, .45); }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(27, 35, 51, .34); display: grid; place-items: center; z-index: 70; padding: 20px; }
/* 关键：作者样式里的 display 会盖掉 [hidden] 的 UA 规则，
   不加这一条弹层会一直铺满全屏、挡住所有点击。 */
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; width: min(560px, 100%); box-shadow: var(--shadow-lg);
  max-height: 86vh; overflow: auto;
}
.modal h2 { margin: 0 0 14px; font-size: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ── 今日交易清单（半自动下单台）──────────────────────────────────────── */
.order-row { border-left: 3px solid var(--accent); padding-left: 12px; }
.order-row.is-done { border-left-color: var(--ok); opacity: .72; }
.order-text {
  margin: 12px 0 0; padding: 12px 14px; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 10px; max-height: 340px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.75; white-space: pre-wrap; color: var(--text);
}
