/* 大有仓位大师 - 样式 */
:root {
  --red: #dc2626;        /* 涨 */
  --green: #16a34a;      /* 跌 */
  --primary: #3a7bc0;    /* 主色：浅蓝 */
  --primary-dark: #2c5f99;
  --bg: #f6f1e7;         /* 页面底色：浅米色 */
  --card: #fffdf9;       /* 卡片：米白 */
  --text: #2f3e4e;
  --muted: #7a8794;
  --border: #e6dfcf;
  --gold: #f59e0b;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: 76px; max-width: 720px; margin: 0 auto;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.up { color: var(--red); }
.down { color: var(--green); }

/* 头部 */
.app-header {
  background: linear-gradient(135deg, #6ba3dc 0%, #4180bf 100%);
  color: #fff; padding: 16px 18px 14px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4);
  padding: 3px 8px; border-radius: 8px; font-weight: 700; font-size: 14px; letter-spacing: 2px;
}
.brand-title { font-size: 19px; font-weight: 800; letter-spacing: 1px; }
.header-sub { font-size: 12px; opacity: .85; }

/* 提醒横幅 */
#alert-banners { position: sticky; top: 56px; z-index: 60; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.alert-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1.5px solid var(--gold); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: 0 6px 18px rgba(245,158,11,.25);
  animation: slideDown .3s ease;
}
.alert-banner.stop-loss { background: linear-gradient(135deg, #fee2e2, #fecaca); border-color: var(--red); }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert-banner .ab-title { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.alert-banner .ab-desc { font-size: 13px; color: #44403c; margin-bottom: 10px; }
.ab-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ab-actions .btn { padding: 8px 14px; font-size: 13px; }

/* 主区 */
main { padding: 12px 12px 20px; }
.sub-tabs { display: flex; background: #ece5d4; border-radius: 12px; padding: 4px; margin-bottom: 12px; gap: 2px; }
.sub-tab {
  flex: 1; border: none; background: transparent; padding: 9px 4px;
  font-size: 14px; color: var(--muted); border-radius: 9px; cursor: pointer; font-weight: 600;
}
.sub-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(15,23,42,.06); }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.summary-card { background: linear-gradient(135deg, #4180bf, #6ba3dc); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.summary-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.summary-item .si-label { font-size: 11px; opacity: .7; margin-bottom: 4px; }
.summary-item .si-value { font-size: 15px; font-weight: 700; }
.summary-item .si-value.big { font-size: 18px; }

/* 持仓卡 */
.pos-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(15,23,42,.06); border-left: 4px solid var(--border); }
.pos-card.hot-up { border-left-color: var(--red); }
.pos-card.hot-down { border-left-color: var(--green); }
.pos-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.pos-name { font-size: 17px; font-weight: 800; }
.pos-code { font-size: 12px; color: var(--muted); margin-left: 6px; }
.pos-price { text-align: right; }
.pos-price .pp { font-size: 20px; font-weight: 800; }
.pos-price .pct { font-size: 13px; font-weight: 700; margin-left: 6px; }
.pos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.pos-grid .pg-item { font-size: 12px; color: var(--muted); }
.pos-grid .pg-item b { display: block; font-size: 13.5px; color: var(--text); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* 阈值进度条 */
.threshold-bar { position: relative; height: 26px; background: #efe9da; border-radius: 13px; margin: 10px 0 4px; overflow: hidden; }
.threshold-fill { height: 100%; border-radius: 13px; transition: width .4s; }
.threshold-marks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-bottom: 8px; }
.threshold-marks span.hit { color: var(--primary); font-weight: 700; }

/* 提醒历史 chip */
.alert-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); }
.chip.pending { background: #fef3c7; border-color: var(--gold); color: #92400e; font-weight: 700; }
.chip.executed { background: #dcfce7; border-color: #86efac; color: #166534; }
.chip.ignored { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* 按钮 */
.btn-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.btn { border: none; border-radius: 10px; padding: 11px 16px; font-size: 14px; font-weight: 700; cursor: pointer; transition: filter .15s; }
.btn:active { filter: brightness(.9); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--green); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-del { background: #fff; color: #b91c1c; border: 1px solid #fca5a5; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.pos-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.form-grid label, .form-col label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.form-grid input, .form-col input, .form-col textarea {
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; font-size: 15px; width: 100%;
  background: #fdfbf5;
}
.form-grid input:focus { outline: 2px solid var(--primary); background: #fff; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.calc-line { background: #f4efe3; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.calc-line b { color: var(--text); }

/* 建议下拉 */
.suggest-box { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: -8px; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.suggest-item { padding: 9px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #f0e9d9; }
.suggest-item:hover { background: #eef5fc; }

/* 账目流水 */
.trade-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.trade-type { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.trade-type.buy { background: #fee2e2; color: var(--red); }
.trade-type.add_buy { background: #dbeafe; color: var(--primary-dark); }
.trade-type.sell_half { background: #fef3c7; color: #b45309; }
.trade-type.sell_all { background: #dcfce7; color: var(--green); }
.trade-main { flex: 1; min-width: 0; }
.trade-main .tm-top { font-weight: 700; font-size: 14.5px; }
.trade-main .tm-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.trade-pnl { text-align: right; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }

/* 复盘 */
.review-card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(15,23,42,.06); }
.review-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.score-ring { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 20px; }
.score-good { background: #dcfce7; color: #166534; }
.score-mid { background: #fef3c7; color: #92400e; }
.score-bad { background: #fee2e2; color: #991b1b; }
.problem-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.problem-tag { font-size: 12px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 3px 10px; border-radius: 14px; }

/* 自选股 */
.watch-row { display: flex; align-items: center; background: var(--card); border-radius: 12px; padding: 13px 14px; margin-bottom: 9px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.watch-main { flex: 1; }
.watch-main .w-name { font-weight: 800; font-size: 15.5px; }
.watch-main .w-code { font-size: 12px; color: var(--muted); margin-left: 6px; }
.watch-main .w-note { font-size: 11.5px; color: #94a3b8; margin-top: 3px; }
.watch-quote { text-align: right; margin-right: 10px; }
.watch-quote .wq-p { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.watch-quote .wq-pct { font-size: 12.5px; font-weight: 700; }

/* 学习页 */
.learn-intro { background: linear-gradient(135deg, #4180bf, #6ba3dc); color: #fff; }
.learn-intro h3 { color: #fff; }
.learn-intro p { font-size: 13.5px; opacity: .92; line-height: 1.7; }
.learn-card { background: var(--card); border-radius: var(--radius); margin-bottom: 10px; box-shadow: 0 1px 4px rgba(15,23,42,.06); overflow: hidden; }
.learn-toggle { width: 100%; border: none; background: none; padding: 15px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer; text-align: left; }
.learn-toggle .arrow { transition: transform .2s; color: var(--muted); font-size: 13px; }
.learn-card.open .arrow { transform: rotate(90deg); }
.learn-body { padding: 0 16px 15px; font-size: 13.8px; line-height: 1.85; color: #475569; }
.learn-body ul { padding-left: 18px; margin: 6px 0; }
.learn-body .hl { background: #fef9c3; padding: 0 3px; border-radius: 3px; }

/* 可点击股票名称（弹出即时行情） */
.name-link {
  background: none; border: none; padding: 0; margin: 0;
  font-size: 17px; font-weight: 800; color: var(--primary);
  cursor: pointer; font-family: inherit;
  border-bottom: 1px dashed var(--primary);
}
.name-link:active { opacity: .7; }

/* 底部导航 */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px; background: #fffdf9;
  display: flex; border-top: 1px solid var(--border);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom)); z-index: 80;
}
.tab-btn { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); cursor: pointer; padding: 4px 0; font-weight: 600; }
.tab-btn.active { color: var(--primary); }
.tab-ico { font-size: 21px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 720px; border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal-close { float: right; border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }

/* 问题勾选 */
.problem-check { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.problem-check label { display: flex; align-items: center; gap: 10px; font-size: 14px; background: #f4efe3; border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; cursor: pointer; }
.problem-check label.checked { background: #fef2f2; border-color: #fca5a5; color: #991b1b; font-weight: 600; }
.problem-check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Toast */
#toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,.9); color: #fff; padding: 10px 20px; border-radius: 22px; font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .3s; max-width: 85vw; text-align: center; }
#toast.show { opacity: 1; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 44px 16px; font-size: 14px; }
.empty .empty-ico { font-size: 40px; margin-bottom: 10px; }

.tip-list { padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.8; }
.muted-card { background: #f4efe3; }

@media (max-width: 420px) {
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
}

/* ================= 开机画面 ================= */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(160deg, #6ba3dc 0%, #4180bf 55%, #2c5f99 100%);
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 0.65s ease;
}
#splash.splash-out { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; color: #fff; padding: 24px; width: 100%; max-width: 320px; }
.splash-icon {
  width: 108px; height: 108px; margin: 0 auto 22px;
  border-radius: 26px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(15, 40, 70, 0.45), 0 0 0 3px rgba(255, 255, 255, 0.25);
  animation: splash-breathe 2.4s ease-in-out infinite;
}
.splash-icon img { width: 100%; height: 100%; display: block; }
@keyframes splash-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.splash-title { font-size: 26px; font-weight: 800; letter-spacing: 2px; text-shadow: 0 2px 10px rgba(15, 40, 70, 0.35); }
.splash-slogan { margin-top: 8px; font-size: 14px; letter-spacing: 6px; color: rgba(255, 255, 255, 0.85); }
.splash-bar {
  margin: 26px auto 10px; width: 200px; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.25); overflow: hidden;
}
.splash-bar-fill { height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, #ffe082, #f0b43c); }
.splash-status { font-size: 12.5px; color: rgba(255, 255, 255, 0.8); min-height: 18px; }
.splash-footer { margin-top: 34px; font-size: 11.5px; letter-spacing: 1px; color: rgba(255, 255, 255, 0.55); }
