:root {
  --bg: #f7f7f6;
  --panel: #fff;
  --line: #e2e2e0;
  --ink: #30343b;
  --muted: #9298a3;
  --red: #c93e36;
  --green: #4b8755;
  --orange: #b8792a;
  --navy-deep: #253444;
  --accent: #ee7043;
  --accent-soft: #fdf4ee;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}
button, input { font: inherit; }
.app { min-width: 1106px; padding-left: 46px; }

.global-rail {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: 46px;
  background: var(--navy-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 1px 0 0 rgba(255,255,255,.06);
}
.global-nav-item {
  width: 46px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #b6c0ca;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  line-height: normal;
  font-weight: 400;
}
.global-nav-item.home { height: 53px; padding-top: 18px; }
.global-nav-item.stock { height: 43px; padding-top: 10px; }
.global-nav-item svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.global-nav-item.stock svg { width: 19px; height: 19px; margin-bottom: 1px; stroke-width: 1.45; }
.global-nav-item.stock svg rect { fill: var(--navy-deep); }
.global-nav-item.active { color: #0798f7; }
.global-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.global-nav-item span { font-size: 11px; }

.topbar {
  position: fixed;
  z-index: 20;
  left: 46px;
  right: 0;
  top: 0;
  height: 54px;
  background: #fff;
  border-top: 4px solid #e7e7e5;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 18px;
}
.brand { font-weight: 750; font-size: 17px; color: var(--navy-deep); }
.crumb { font-size: 12px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 18px; }
.updated { margin-left: auto; color: var(--muted); font-size: 12px; }

.concepts {
  position: fixed;
  z-index: 18;
  left: 46px;
  top: 54px;
  bottom: 0;
  width: 156px;
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
}
.side-title { font-size: 15.5px; font-weight: 400; padding: 17px 14px 10px; color: #6d737b; }
.concept {
  width: 100%;
  display: flex;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid #e9ebef;
  background: #fff;
  padding: 15px 14px;
  color: #3e454d;
  font-size: 15px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.concept:hover, .concept.active { background: #f4f4f3; color: var(--ink); }
.concept.active { border-left: 3px solid var(--accent); padding-left: 11px; }
.concept .count { font-size: 13px; color: #737a82; font-weight: 400; }
.concept.draggable-concept { cursor: grab; }
.concept.dragging { opacity: .45; cursor: grabbing; }
.concept.drop-before { box-shadow: inset 0 3px var(--accent); }
.concept.drop-after { box-shadow: inset 0 -3px var(--accent); }

.main {
  margin-left: 156px;
  padding: 72px 20px 32px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.headline {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 16px;
}
.headline h1 { margin: 0 0 3px; color: var(--navy-deep); font-size: 20px; }
.headline p { margin: 0; color: var(--muted); font-size: 12px; }

/* v36 standard: signal filters are pills, with semantic active colors. */
.signal-tabs { display: flex; gap: 7px; }
.signal-tab {
  border: 1px solid #d9dde5;
  border-radius: 18px;
  background: #fff;
  padding: 6px 14px;
  color: #59606b;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.signal-tab:hover, .signal-tab[data-signal="all"].active { background: var(--accent); color: #fff; border-color: var(--accent); }
.signal-tab[data-signal="看多"].active { background: var(--red); color: #fff; border-color: var(--red); }
.signal-tab[data-signal="中性"].active { background: var(--orange); color: #fff; border-color: var(--orange); }
.signal-tab[data-signal="看空"].active { background: var(--green); color: #fff; border-color: var(--green); }

.toolbar {
  flex: none;
  min-height: 56px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(37,47,65,.05);
  padding: 11px 14px;
  display: flex;
  align-items: center;
}
.search {
  height: 32px;
  width: 240px;
  border: 1px solid #dce0e8;
  border-radius: 5px;
  padding: 0 10px;
  outline: none;
}
.search:focus { border-color: #aeb7c6; box-shadow: 0 0 0 2px rgba(117,131,154,.10); }
.view-switch { display: flex; gap: 8px; margin-left: auto; }
.view-mode {
  height: 30px;
  border: 1px solid #d9dcdf;
  border-radius: 4px;
  background: #fff;
  color: #60636a;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.view-mode:hover { border-color: #b9bec5; color: var(--ink); }
.view-mode.active { background: #f4f4f3; color: var(--ink); }
.view-mode:focus { outline: none; }
.view-mode:focus-visible { box-shadow: 0 0 0 2px rgba(89,96,107,.18); }

.home-status { padding: 70px 20px; text-align: center; color: var(--muted); background: #fff; border: 1px solid var(--line); border-top: 0; }
.home-status.error { color: #b42318; }
.table-shell { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: auto; overscroll-behavior: none; background: #fff; border: 1px solid var(--line); border-top: 0; }
.stock-table { width: 1590px; min-width: 1590px; border-collapse: collapse; table-layout: fixed; }
.stock-table col.col-name { width: 120px; }
.stock-table col.col-change { width: 80px; }
.stock-table col.col-price { width: 70px; }
.stock-table col.col-ma { width: 230px; }
.stock-table col.col-volume { width: 115px; }
.stock-table col.col-macd { width: 320px; }
.stock-table col.col-score,
.stock-table col.col-view { width: 70px; }
.stock-table col.col-flow { width: 100px; }
.stock-table col.col-amount { width: 85px; }
.stock-table col.col-profit { width: 90px; }
.stock-table col.col-change-5d,
.stock-table col.col-change-10d,
.stock-table col.col-cap { width: 80px; }
.stock-table th {
  position: sticky;
  z-index: 5;
  top: 0;
  background: #f3f3f2;
  color: #60636a;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.stock-table th:first-child, .stock-table td:first-child { position: sticky; left: 0; background: #fff; z-index: 4; }
.stock-table th:first-child { z-index: 7; background: #f3f3f2; }
.stock-table th button { border: 0; background: transparent; color: inherit; padding: 0; font-weight: 700; cursor: pointer; }
.stock-table th.sortable { cursor: pointer; }
.stock-table th.sort-desc::after { content: " ↓"; color: var(--ink); font-size: 12px; }
.stock-table th.sort-asc::after { content: " ↑"; color: var(--ink); font-size: 12px; }
.stock-table td { padding: 12px; border-bottom: 1px solid #e5e8ec; vertical-align: middle; white-space: nowrap; }
.stock-row:hover td { background: #f7f8f9; }
.stock-link { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: inherit; text-decoration: none; }
.stock-link strong { font-size: 14px; font-weight: 750; }
.tech-cell { white-space: nowrap !important; }
.num { font-variant-numeric: tabular-nums; }

.tag, .tag-chip {
  display: inline-block;
  margin: 1px 3px 1px 0;
  padding: 3px 7px;
  border-radius: 4px;
  background: #f1f3f7;
  color: #66728a;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}
.tag-chip.tag-bull, .tag.up { background: #fdf3f2; color: var(--red) !important; }
.tag-chip.tag-bear, .tag.down { background: #f1f7f1; color: var(--green) !important; }
.tag-chip.tag-neutral, .tag.neutral { background: #faf5ee; color: var(--orange) !important; }
.up { color: var(--red) !important; }
.down { color: var(--green) !important; }
.neutral { color: var(--orange) !important; }

.card-state { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: auto; overscroll-behavior: none; padding-top: 16px; }
.stock-card-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.stock-insight-card { display: block; min-width: 0; color: inherit; text-decoration: none; background: #fff; border: 1px solid #d9dde1; padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-name { font-size: 17px; font-weight: 750; }
.card-code { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-price { font-size: 28px; font-weight: 800; margin-top: 16px; }
.card-change { font-size: 14px; font-weight: 650; margin-top: 4px; }
.card-signals { margin-top: 12px; font-size: 11px; line-height: 1.8; color: #69727b; white-space: normal; }
.card-metrics { border-top: 1px solid #e5e8ec; margin-top: 16px; padding-top: 13px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; text-align: center; }
.card-metrics span, .card-metrics strong { display: block; }
.card-metrics span { font-size: 10px; color: var(--muted); }
.card-metrics strong { margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.loading { padding: 15px; color: var(--muted); font-size: 12px; }

@media (max-width: 1200px) { .stock-card-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 1050px) { .stock-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) {
  .app { min-width: 0; padding-left: 0; }
  .global-rail { position: static; width: 100%; height: 54px; padding: 0; flex-direction: row; justify-content: flex-start; }
  .global-nav-item, .global-nav-item + .global-nav-item { width: 62px; height: 54px; flex-direction: row; gap: 5px; padding: 0; justify-content: center; }
  .global-nav-item svg { width: 19px; height: 19px; margin: 0; }
  .topbar { position: static; height: 54px; padding: 0 14px; }
  .crumb, .updated { display: none; }
  .concepts { position: static; width: 100%; display: flex; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  #conceptList { display: flex; }
  .side-title { display: none; }
  .concept { border: 0; padding: 12px 14px; width: auto; white-space: nowrap; }
  .concept.active { border-left: 0; border-bottom: 3px solid var(--accent); padding-bottom: 9px; }
  .main { margin-left: 0; padding: 14px; height: auto; overflow: visible; }
  .headline { align-items: flex-start; flex-direction: column; gap: 12px; }
  .signal-tabs { overflow: auto; max-width: 100%; }
  .toolbar { flex-wrap: wrap; }
  .search { width: 100%; }
  .view-switch { width: 100%; margin: 0; }
  .card-state { padding-top: 10px; }
  .stock-card-grid { grid-template-columns: 1fr; gap: 10px; }
}
