/* VectorTrade PWA —— 飞书 Config 配置编辑器 */

:root {
  --bg: #000;
  --surface: #121212;
  --surface-2: #1b1b1b;
  --line: #262626;
  --text: #f4f4f5;
  --muted: #8b8b91;
  --ok: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 16px;
  --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; }

html, body {
  height: 100%; margin: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}
body { overflow: hidden; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
@supports (height: 100dvh) { .screen { height: 100dvh; } }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; line-height: 1.6; }
.hint { font-size: 11.5px; color: #6b6b70; line-height: 1.7; margin: 0 2px; }

/* ───────── 设置页 ───────── */
#setup { align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.setup-box { width: 100%; max-width: 380px; text-align: center; }
.logo {
  width: 92px; height: 92px; margin: 0 auto 18px;
  background: #fff; color: #000; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 58px; font-weight: 900; line-height: 1;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
}
.setup-box h1 { font-size: 21px; margin: 0 0 8px; letter-spacing: .5px; }
.setup-box > p { margin: 0 0 20px; font-size: 13px; line-height: 1.6; }
.setup-box .field { text-align: left; }

input {
  width: 100%; height: 52px; padding: 0 15px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  font-size: 16px; outline: none;
}
input:focus { border-color: #555; }
input::placeholder { color: #5b5b60; }

.err { color: #f87171; font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ───────── 顶栏 ───────── */
.topbar {
  flex: 0 0 auto;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.86); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 28px; height: 28px; background: #fff; color: #000; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; font-family: "Arial Black", Arial, sans-serif;
}
.name { font-weight: 700; letter-spacing: .3px; }
.right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.conn { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.conn.online i { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.conn.online span { color: var(--ok); }
.conn.offline i { background: var(--danger); }

/* ───────── 主体 ───────── */
main { flex: 1 1 auto; min-height: 0; position: relative; }
.panel {
  position: absolute; inset: 0;
  padding: 14px 14px calc(14px + var(--safe-b));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 12px;
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.card > .label, .label {
  font-size: 12px; color: var(--muted); margin-bottom: 10px; letter-spacing: .3px;
}

/* 开关行 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px;
}
.switch-row:first-of-type { border-top: 0; }
.toggle {
  width: 56px; height: 32px; border-radius: 16px; border: 0; padding: 0;
  background: #333; position: relative; cursor: pointer; transition: background .18s;
  flex: 0 0 auto;
}
.toggle i {
  position: absolute; top: 3px; left: 3px; width: 26px; height: 26px;
  border-radius: 50%; background: #fff; transition: transform .18s;
}
.toggle[aria-pressed="true"] { background: var(--ok); }
.toggle[aria-pressed="true"] i { transform: translateX(24px); }
.toggle[disabled] { opacity: .5; }

/* 股票标签 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px 7px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px;
}
.chip button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; padding: 0 2px; cursor: pointer;
}
.chip button:active { color: var(--danger); }
.chips .empty { color: #5b5b60; font-size: 13px; padding: 8px 0; }

.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1 1 auto; height: 46px; font-size: 15px; }
.add-row .btn { flex: 0 0 auto; height: 46px; border-radius: 12px; }

/* 表单 */
.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* 按钮 */
.btn {
  height: 58px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2); color: var(--text);
  font-size: 16px; font-weight: 600; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s, background .15s, opacity .15s;
  user-select: none; cursor: pointer;
}
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.primary { background: #fff; color: #000; border-color: #fff; }
.btn.ghost { background: var(--surface); }
.btn.tiny { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }

/* ───────── 底栏 ───────── */
.tabbar {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  background: rgba(0,0,0,.92); backdrop-filter: blur(12px);
}
.tabbar.four { grid-template-columns: repeat(4, 1fr); }
.tab {
  height: 62px; background: transparent; border: 0; color: var(--muted);
  font-size: 12px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; cursor: pointer;
}
.tab .ico { font-size: 17px; line-height: 1; }
.tab.active { color: #fff; }

/* ───────── Toast ───────── */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b));
  transform: translate(-50%, 20px);
  max-width: 86vw; padding: 12px 18px;
  background: rgba(28,28,30,.96); border: 1px solid var(--line);
  border-radius: 14px; font-size: 13px; line-height: 1.5; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(239,68,68,.5); color: #fca5a5; }
.toast.ok { border-color: rgba(34,197,94,.5); color: #86efac; }
