/* ============================================================
   stock-tracker 共享样式
   移动优先（对标截图），桌面端居中显示为手机宽度卡片
   ============================================================ */
:root {
  --blue: #29a9ea;
  --blue-dark: #1b8fcc;
  --green: #2fa96b;
  --green-soft: #e8f7ef;
  --orange: #ef9a2d;
  --orange-soft: #fdf3e3;
  --slate: #7ea6cc;
  --slate-soft: #eef4fa;
  --up: #e5453f;
  --down: #14a05e;
  --ink: #1f2329;
  --ink-2: #5b6673;
  --ink-3: #9aa4af;
  --line: #eceef1;
  --bg: #f4f5f7;
  --pink: #fdeef1;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; }
.wrap { max-width: 560px; margin: 0 auto; background: var(--bg); min-height: 100vh; position: relative; }
.wrap.card-bg { background: #fff; }

/* ---------- 顶部导航 ---------- */
.nav {
  height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav .title { font-size: 17px; font-weight: 600; flex: 1; }
.nav .icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--bg);
  color: var(--ink-2); font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.nav .icon-btn:active { background: #e6e8eb; }
.nav .back { font-size: 20px; color: var(--ink-2); cursor: pointer; width: 28px; }

/* ---------- 列表页 ---------- */
.list-head {
  display: grid; grid-template-columns: 76px 1fr 92px 92px;
  gap: 8px; padding: 11px 12px 9px; font-size: 13px; color: var(--ink-3);
  background: #fff; border-bottom: 1px solid var(--line);
}
.list-head span:nth-child(3), .list-head span:nth-child(4) { text-align: right; }
.list-head .sortable { cursor: pointer; }

.stock-row {
  display: grid; grid-template-columns: 76px 1fr 92px 92px;
  gap: 8px; align-items: center; padding: 10px 12px;
  background: #fff; border-bottom: 1px solid var(--line); cursor: pointer;
}
.stock-row:active { background: #fafbfc; }

.badge {
  border-radius: 10px; padding: 6px 4px; text-align: center; color: #fff;
}
.badge .pct { font-size: 17px; font-weight: 700; line-height: 1.1; }
.badge .lbl { font-size: 11px; opacity: .95; margin-top: 1px; }
.badge.cheap { background: linear-gradient(135deg, #43bd7c, #2a9b60); }
.badge.buy { background: linear-gradient(135deg, #f5ab3d, #e58e1c); }
.badge.sell { background: linear-gradient(135deg, #f2626e, #d8383f); }
.badge.watch { background: linear-gradient(135deg, #8fb8dc, #6a99c4); }
.badge.none { background: #c3cbd4; }

.stock-name { min-width: 0; }
.stock-name .nm {
  font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stock-name .cd { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; letter-spacing: .2px; }

.col-price, .col-buy { text-align: right; }
.col-price .p { font-size: 15.5px; font-weight: 600; }
.col-price .c { font-size: 12px; margin-top: 1px; }
.col-buy .b { font-size: 15px; font-weight: 600; color: var(--ink); }
.col-buy .d { font-size: 12px; margin-top: 1px; color: var(--ink-3); }
.col-buy .d.pos { color: var(--green); font-weight: 600; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--ink-2); }

.empty {
  padding: 70px 24px; text-align: center; color: var(--ink-3); background: #fff;
}
.empty .big { font-size: 34px; margin-bottom: 10px; }
.empty .hint { font-size: 13px; margin-top: 6px; line-height: 1.7; }

.footer-tip { padding: 14px; text-align: center; font-size: 11.5px; color: var(--ink-3); }

/* ---------- 详情页 ---------- */
.hero {
  background: var(--blue); color: #fff; padding: 14px 16px 16px;
}
.hero .row1 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero .nm { font-size: 22px; font-weight: 700; }
.hero .cd { font-size: 14px; opacity: .92; }
.hero .slogan {
  margin-top: 9px; display: inline-block; font-size: 12.5px;
  background: rgba(255,255,255,.22); border-radius: 999px; padding: 3px 11px;
}

.metrics {
  background: #fff; padding: 4px 12px 6px;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px;
}
.metrics .m {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.metrics .m:nth-last-child(-n+2) { border-bottom: none; }
.metrics .k { color: var(--ink-2); font-size: 14px; }
.metrics .v { font-weight: 600; font-size: 15.5px; }
.metrics .v.stale { opacity: .55; }

.section-title {
  text-align: center; color: var(--blue); font-weight: 700; font-size: 15.5px;
  padding: 16px 0 12px; background: #fff; border-top: 1px solid var(--line);
}
.section-title .info {
  display: inline-flex; width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--blue); color: var(--blue); font-size: 10px;
  align-items: center; justify-content: center; vertical-align: 1px; margin-left: 4px; cursor: pointer;
}

.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.tabs .tab {
  flex: 1; text-align: center; padding: 11px 0; color: var(--ink-3); font-size: 15px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabs .tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }

.form-area { background: #fff; padding: 6px 16px 18px; }
.group-title {
  font-size: 13px; font-weight: 600; color: var(--ink-3);
  padding: 14px 0 2px; letter-spacing: .3px;
}
.group-title.sell-t { color: #c2597a; }
.field { display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.field label { width: 84px; color: var(--ink-2); font-size: 14.5px; flex: none; }
.field .input-box {
  flex: 1; display: flex; align-items: center; background: #fff;
  border: 1px solid #d8dde3; border-radius: 6px; padding: 0 10px; height: 40px;
  max-width: 190px;
}
.field .input-box input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 16px; font-weight: 600; width: 100%; min-width: 0;
}
.field .input-box input::placeholder { font-weight: 400; color: #c3cbd4; }
.field .unit { color: var(--ink-3); font-size: 14px; flex: none; }
.field .dev-group { display: flex; align-items: center; gap: 6px; margin-left: 2px; }
.field .dev-group .dev-lbl { color: var(--ink-3); font-size: 12.5px; flex: none; }
.field .dev-group .input-box { max-width: 72px; }
.field.pink { background: var(--pink); border-radius: 6px; padding: 11px 10px; margin: 4px -10px 0; }
.field.pink .input-box { border-color: #f3ccd4; }

.pos-note {
  font-size: 12.5px; color: var(--ink-2); background: var(--slate-soft);
  border-radius: 6px; padding: 8px 11px; margin-top: 12px; line-height: 1.6;
}
.dev-note { font-size: 12px; color: var(--ink-3); padding: 8px 0 0; line-height: 1.6; }

.btn-primary {
  display: block; width: 100%; max-width: 480px; margin: 18px auto 0;
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 14px 0; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:active { background: var(--blue-dark); }
.btn-primary:disabled { background: #b9d9ec; }
.btn-ghost {
  display: block; width: 100%; max-width: 480px; margin: 10px auto 0;
  background: #fff; color: var(--ink-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 0; font-size: 15px; cursor: pointer;
}
.danger { color: #d9484a; }

/* ---------- 添加股票弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-mask.on { display: flex; }
.sheet {
  background: #fff; width: 100%; max-width: 560px; border-radius: 14px 14px 0 0;
  padding: 16px 16px 22px; max-height: 78vh; overflow: auto;
}
.sheet h3 { margin: 0 0 12px; font-size: 16px; }
.sheet .search-box {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border-radius: 8px; padding: 0 12px; height: 42px;
}
.sheet .search-box input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; }
.hit {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.hit:active { background: #fafbfc; }
.hit .nm { font-weight: 600; }
.hit .sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.hit .add { color: var(--blue); font-weight: 600; font-size: 14px; }
.hit .already { color: var(--ink-3); font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 32px 24px; max-width: 420px; margin: 0 auto;
}
.login-wrap .brand { text-align: center; margin-bottom: 26px; }
.login-wrap .brand .logo {
  width: 62px; height: 62px; border-radius: 16px; margin: 0 auto 12px;
  background: linear-gradient(135deg, #48b8f0, #1c8fd0); color: #fff;
  font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.login-wrap .brand h1 { font-size: 20px; margin: 0 0 6px; }
.login-wrap .brand p { color: var(--ink-3); font-size: 13px; margin: 0; }
.login-card { background: #fff; border-radius: 12px; padding: 20px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.login-card .lf { margin-bottom: 13px; }
.login-card .lf label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.login-card .lf input {
  width: 100%; height: 44px; border: 1px solid #d8dde3; border-radius: 8px;
  padding: 0 12px; outline: none; font-size: 15px;
}
.login-card .lf input:focus { border-color: var(--blue); }
.tip { font-size: 13px; color: var(--ink-3); text-align: center; margin-top: 16px; }
.tip a { color: var(--blue); font-weight: 600; cursor: pointer; }
.msg { font-size: 13px; padding: 9px 11px; border-radius: 7px; margin-bottom: 12px; display: none; }
.msg.err { display: block; background: #fdecec; color: #c93a3c; }
.msg.ok { display: block; background: var(--green-soft); color: #1f7d4e; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 68px; transform: translateX(-50%);
  background: rgba(30,34,40,.9); color: #fff; font-size: 13.5px;
  padding: 9px 16px; border-radius: 8px; z-index: 60; opacity: 0;
  transition: opacity .22s; pointer-events: none; max-width: 80vw; text-align: center;
}
.toast.on { opacity: 1; }

.spinner-row { text-align: center; color: var(--ink-3); padding: 22px; font-size: 13px; }

@media (min-width: 600px) {
  body { background: #e9ebee; }
  .wrap { box-shadow: 0 0 24px rgba(0,0,0,.06); }
}
