/* 设计令牌与排版基线。手机端和 PC 端共用。
 *
 * 配色只做一套：深色。盘中看盘多数在光线不定的环境里，深色底对
 * 数字更友好，也和本地缠论图表的取色一致（涨红跌绿）。
 */

:root {
  --bg:        #0c0e11;
  --bg-elev:   #14181e;
  --bg-elev2:  #1b212a;
  --line:      #232a34;
  --line-soft: #1a2029;

  --text:      #e6ebf2;
  --text-dim:  #98a3b2;
  --text-mute: #66707d;

  /* A 股约定：涨红跌绿。不要换成国际配色。 */
  --up:        #e5484d;
  --down:      #30a46c;
  --flat:      #8b95a3;

  --warn:      #f5a623;
  --danger:    #e5484d;
  --accent:    #4d8bf5;
  --ok:        #30a46c;

  --radius:    12px;
  --radius-sm: 8px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性必须真的隐藏。
 *
 * HTML 的 hidden 只是 UA 样式表里的一条 display:none，而本文件里
 * .app / .login 都写了 display:flex —— 作者样式优先级更高，会把
 * hidden 彻底压掉。结果是「登录遮罩永远盖在页面上」，而 DOM 里
 * 应用其实已经正常渲染了，排查时极易误判成鉴权失败。
 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

a { color: var(--accent); text-decoration: none; }

/* 所有数字一律等宽对齐。否则价格列在小数位上会抖动，
 * 盘中快速扫一眼时极难对比。 */
.num, .price, td.n, .stat-v {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.up   { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.dim  { color: var(--text-dim); }
.mute { color: var(--text-mute); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.card + .card { margin-top: 10px; }

.card-title {
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: .04em;
  margin: 0 0 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap6 > * + * { margin-left: 6px; }
.gap10 > * + * { margin-left: 10px; }

.hr { height: 1px; background: var(--line-soft); margin: 12px 0; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.up-b    { color: var(--up);    background: rgba(229,72,77,.12);  border-color: rgba(229,72,77,.28); }
.badge.down-b  { color: var(--down);  background: rgba(48,164,108,.12); border-color: rgba(48,164,108,.28); }
.badge.warn-b  { color: var(--warn);  background: rgba(245,166,35,.12); border-color: rgba(245,166,35,.3); }
.badge.mute-b  { color: var(--text-dim); background: rgba(152,163,178,.1); border-color: rgba(152,163,178,.18); }
.badge.accent-b{ color: var(--accent); background: rgba(77,139,245,.12); border-color: rgba(77,139,245,.28); }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn:active { background: #222a35; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.btn-primary:active { background: #3d78dd; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

/* 必须带 input:not([type]) 这一支：属性选择器 [type="text"] 只匹配**显式写了**
   type 的元素，<input name="note"> 这种默认就是 text，但不匹配，会掉回浏览器
   默认的白底黑字 —— 深色主题里出现一个白块，谁写谁不填 type 都会复发。 */
input:not([type]),
input[type="text"],
input[type="password"],
input[type="number"],
select {
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--text-mute); }

/* 骨架屏：数据没到时不闪白，也不留空 */
.skeleton {
  background: linear-gradient(90deg, #161b22 25%, #1d232c 37%, #161b22 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
  height: 14px;
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-b));
  transform: translateX(-50%);
  max-width: 86vw;
  background: rgba(28,34,43,.97);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
