/* 攒股收息 · 退休计划 —— 深色金融风格 */
:root {
  --bg: #0d1117;
  --bg2: #10161e;
  --card: #161c24;
  --card2: #1c232d;
  --card3: #222b37;
  --border: #26303c;
  --border-soft: #1f2833;
  --text: #e6edf3;
  --muted: #8b98a5;
  --dim: #62707e;
  --up: #f0475a;        /* 中国市场惯例：涨 = 红 */
  --down: #2fbf71;      /* 跌 = 绿 */
  --accent: #4c8dff;
  --accent-2: #7aa9ff;
  --amber: #e8a33d;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(76, 141, 255, .09), transparent 60%),
    radial-gradient(700px 420px at 0% 10%, rgba(47, 191, 113, .045), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: calc(40px + var(--safe-b));
  overflow-x: hidden;
}

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

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-t);
  background: rgba(13, 17, 23, .82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  min-width: 0;
}

.logo-mark,
.goal-title .logo-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(145deg, #2a5db8, #4c8dff);
  box-shadow: 0 4px 14px rgba(76, 141, 255, .28);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: .4px;
  white-space: nowrap;
}

.brand-text span {
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: .5px;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  color: var(--muted);
  font-size: 13.5px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--card2);
}

.nav a.active {
  color: var(--text);
  background: var(--card2);
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--dim);
  font-size: 11.5px;
  background: rgba(22, 28, 36, .7);
  transition: border-color .15s;
}

.sync-chip .sync-text {
  display: none;
}

.sync-chip:hover {
  border-color: #3a4756;
}

.sync-chip .dot,
.sync-status-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 3px rgba(98, 112, 126, .12);
}

.sync-chip[data-state="ok"] .dot,
.sync-status-row .dot[data-state="ok"] {
  background: var(--down);
  box-shadow: 0 0 0 3px rgba(47, 191, 113, .14);
}

.sync-chip[data-state="sync"] .dot,
.sync-status-row .dot[data-state="idle"] {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, .15);
  animation: pulse 1.2s infinite;
}

.sync-chip[data-state="err"] .dot,
.sync-status-row .dot[data-state="err"] {
  background: var(--up);
  box-shadow: 0 0 0 3px rgba(240, 71, 90, .14);
}

@keyframes pulse {
  50% { opacity: .35; }
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- 页头 ---------- */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 12px;
}

.home-head h2,
.panel-head h2 {
  font-size: 16.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-head h2 i {
  display: block;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), #2a5db8);
}

.home-head .cnt {
  font-size: 12px;
  color: var(--dim);
  font-weight: 400;
}

.head-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.back {
  color: var(--muted);
  font-size: 13.5px;
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 0;
}

.back:hover {
  color: var(--text);
}

/* ---------- 目标卡 ---------- */
.goal-panel {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(76, 141, 255, .10), transparent 45%),
    linear-gradient(160deg, #18212e, #141a22 70%);
  box-shadow: var(--shadow);
}

.goal-panel::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(76, 141, 255, .18), transparent 66%);
  pointer-events: none;
}

.goal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.goal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.goal-title .t1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .4px;
}

.goal-title .t2 {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 1px;
}

.goal-mid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.goal-main {
  min-width: 0;
}

.g-label {
  font-size: 12.5px;
  color: var(--muted);
}

.g-num {
  font-size: 34px;
  font-weight: 750;
  font-family: var(--mono);
  line-height: 1.15;
  margin-top: 3px;
  letter-spacing: -.5px;
  white-space: nowrap;
}

.g-num .cur {
  font-size: 18px;
  color: var(--muted);
  margin-right: 4px;
  font-weight: 500;
}

.g-sub {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 4px;
}

.g-right {
  text-align: right;
  padding-bottom: 2px;
}

.g-pct {
  font-size: 26px;
  font-weight: 750;
  color: var(--amber);
  font-family: var(--mono);
  line-height: 1.1;
  white-space: nowrap;
}

.g-pct span {
  font-size: 15px;
  margin-left: 1px;
}

.g-pct.reached {
  color: var(--up);
}

.g-target {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 3px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(13, 17, 23, .65);
  overflow: hidden;
  margin: 16px 0 14px;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, .035);
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width .5s ease;
  background: linear-gradient(90deg, #2a5db8, var(--accent) 60%, #7aa9ff);
  box-shadow: 0 0 14px rgba(76, 141, 255, .4);
}

.g-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  position: relative;
  z-index: 1;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, .055);
}

.g-stat {
  min-width: 0;
  text-align: center;
}

.g-stat span {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
}

.g-stat b {
  display: block;
  font-size: 13px;
  margin-top: 2px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 提示条 ---------- */
.notice {
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid rgba(232, 163, 61, .28);
  border-radius: var(--radius-sm);
  background: rgba(232, 163, 61, .07);
  font-size: 12.5px;
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.notice a {
  color: var(--amber);
  text-decoration: underline;
  white-space: nowrap;
}

/* ---------- 持仓卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 12px;
}

.stock {
  background: linear-gradient(160deg, var(--card), #141a21);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px 11px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  min-width: 0;
}

.stock:hover {
  border-color: #3a4756;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.stock:active {
  transform: scale(.995);
}

.srow1,
.srow2 {
  display: grid;
  text-align: center;
  gap: 2px;
  min-width: 0;
}

.srow1 {
  grid-template-columns: 1.65fr 1fr 1fr 1fr;
  align-items: center;
}

.srow2 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border-soft);
  margin-top: 12px;
  padding-top: 10px;
}

.scell {
  min-width: 0;
  padding: 0 2px;
}

.scell .lb {
  font-size: 10.5px;
  color: var(--dim);
  line-height: 1.25;
  min-height: 27px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 1px;
}

.scell .v {
  font-size: 14.5px;
  font-weight: 600;
  font-family: var(--mono);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scell .v.name {
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.25;
  white-space: normal;
  word-break: break-all;
  overflow: visible;
}

.scell .code {
  font-size: 10px;
  color: var(--dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scell .v.muted {
  color: var(--dim);
  font-weight: 500;
}

.scell .v.pos {
  color: var(--up);
}

.scell .v.neg {
  color: var(--down);
}

.scell .v.est {
  color: var(--up);
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--dim);
  padding: 46px 18px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  grid-column: 1 / -1;
  background: rgba(22, 28, 36, .35);
}

.empty-icon {
  font-size: 34px;
  color: #354252;
  line-height: 1;
  margin-bottom: 10px;
}

.empty-title {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

.empty-sub {
  font-size: 12.5px;
  margin: 5px 0 16px;
  color: var(--dim);
}

.page-foot {
  text-align: center;
  color: #4d5a68;
  font-size: 11px;
  padding: 26px 10px 8px;
  line-height: 1.7;
}

/* ---------- 面板 / 表单 ---------- */
.panel {
  background: linear-gradient(165deg, var(--card), #141a21);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-head .tag,
.home-head .tag {
  font-size: 11px;
  color: var(--dim);
  font-weight: 400;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field label .opt {
  color: var(--dim);
  font-size: 11px;
  margin-left: 4px;
}

.field label .req {
  color: var(--up);
}

.field input {
  width: 100%;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 16px;
  line-height: 1.3;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, .12);
}

.field input::placeholder {
  color: #4e5c6a;
}

.field .hint,
.hint {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 5px;
  line-height: 1.55;
}

.field .hint code,
.hint code {
  color: var(--muted);
  background: var(--card2);
  padding: 1px 5px;
  border-radius: 5px;
  word-break: break-all;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  background: linear-gradient(180deg, #5a97ff, #3f7ee8);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 17px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .1s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(.985);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn.ghost {
  background: var(--card2);
  color: var(--text);
  border-color: var(--border);
}

.btn.ghost:hover {
  background: var(--card3);
}

.btn.small {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn.danger {
  background: rgba(240, 71, 90, .12);
  color: var(--up);
  border-color: rgba(240, 71, 90, .28);
}

.btn.danger-solid {
  background: linear-gradient(180deg, #e64b5e, #c93a4d);
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-row .spacer {
  flex: 1;
}

.form-actions {
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
  margin-top: 2px;
}

.chk {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  cursor: pointer;
}

.chk input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-btn input {
  flex: 1;
  min-width: 0;
}

.input-with-btn .btn {
  flex: 0 0 auto;
  min-height: 44px;
}

/* ---------- 分红取数 ---------- */
.div-fetch {
  margin-top: -2px;
}

.div-list {
  background: var(--card2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 11px 12px;
}

.div-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--dim);
  margin-bottom: 7px;
}

.div-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(76, 141, 255, .1);
  color: var(--accent-2);
  border: 1px solid rgba(76, 141, 255, .17);
}

.div-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
  font-family: var(--mono);
  border-bottom: 1px dashed rgba(38, 48, 60, .55);
}

.div-row:last-of-type {
  border-bottom: none;
}

.div-row span:first-child {
  white-space: nowrap;
  color: var(--muted);
}

.div-row .plan {
  flex: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
}

.div-row b {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.div-sum {
  margin-top: 7px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.div-sum b {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 13px;
}

.div-filled,
.div-same {
  font-size: 10.5px;
  color: var(--down);
  background: rgba(47, 191, 113, .09);
  border: 1px solid rgba(47, 191, 113, .2);
  border-radius: 999px;
  padding: 2px 8px;
}

.div-same {
  color: var(--dim);
  background: transparent;
  border-color: var(--border);
}

.div-sum .btn {
  margin-left: auto;
}

.about-note.warn {
  color: var(--amber);
}

.loading-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.value-flash {
  animation: flash 1.1s ease;
}

@keyframes flash {
  0%, 100% { border-color: var(--border); }
  35% { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 141, 255, .15); }
}

/* ---------- 标的页统计 ---------- */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mini-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  min-width: 0;
}

.mini-stat span {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-stat b {
  display: block;
  font-size: 13.5px;
  font-family: var(--mono);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-stat b.pos {
  color: var(--up);
}

.mini-stat b.neg {
  color: var(--down);
}

.mini-stat b.est {
  color: var(--up);
}

/* ---------- 收息记录 ---------- */
.rc-item {
  background: var(--card2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.rc-item .meta {
  color: var(--muted);
  font-size: 12.5px;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  overflow: hidden;
}

.rc-item .date {
  font-family: var(--mono);
  white-space: nowrap;
}

.rc-item .meta .note {
  color: var(--dim);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rc-item .right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.rc-item .amt {
  color: var(--up);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 13.5px;
}

.rc-item .del {
  color: var(--dim);
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 6px;
  line-height: 1;
}

.rc-item .del:hover {
  color: var(--up);
  background: rgba(240, 71, 90, .08);
}

.rc-total {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 9px;
  padding: 0 2px;
}

.rc-total b {
  color: var(--amber);
  font-family: var(--mono);
}

.rc-add {
  display: grid;
  grid-template-columns: 145px 110px minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.rc-add input {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 16px;
  outline: none;
  min-height: 42px;
  min-width: 0;
}

.rc-add input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, .1);
}

.empty-note {
  padding: 8px 0;
}

/* ---------- 仓位变动 / 已清仓 ---------- */
.trade-add {
  display: grid;
  grid-template-columns: 118px 148px 92px 100px 92px minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.trade-add select,
.trade-add input {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 16px;
  outline: none;
  min-height: 42px;
  min-width: 0;
}

.trade-add select:focus,
.trade-add input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, .1);
}

.trade-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.trade-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 11px;
  background: var(--card2);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

.trade-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.trade-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.trade-tag.buy {
  color: var(--down);
  background: rgba(47, 191, 113, .13);
}

.trade-tag.sell {
  color: var(--up);
  background: rgba(240, 71, 90, .13);
}

.trade-item .date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

.trade-item .note {
  font-size: 12px;
  color: var(--dim);
}

.trade-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12.5px;
}

.trade-right b {
  font-weight: 600;
}

.closed-banner {
  margin: 0 0 12px;
  padding: 10px 13px;
  border: 1px solid rgba(232, 163, 61, .28);
  background: rgba(232, 163, 61, .08);
  color: #e8b86d;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.closed-head {
  margin-top: 18px;
}

.closed-hint {
  font-size: 12px;
  color: var(--dim);
}

.closed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.closed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.closed-item:hover {
  border-color: #3a4756;
}

.closed-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.closed-main b {
  font-size: 14.5px;
}

.closed-main span {
  font-size: 12px;
  color: var(--dim);
}

.closed-nums {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--dim);
}

.closed-nums b {
  font-family: var(--mono);
  color: var(--text);
}

/* ---------- 设置页 ---------- */
.settings-head {
  margin-top: 4px;
}

.sync-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--card2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.syncstatus {
  font-size: 12.5px;
  color: var(--dim);
  min-height: 18px;
}

.syncstatus.ok {
  color: var(--down);
}

.syncstatus.err {
  color: var(--amber);
}

.last-sync {
  font-size: 11px;
  color: var(--dim);
  margin-left: auto;
  white-space: nowrap;
}

.sync-note {
  padding-top: 3px;
  border-top: 1px dashed var(--border-soft);
}

.about-note {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.85;
}

.about-note a {
  color: var(--accent-2);
  word-break: break-all;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: calc(14px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 430px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(28, 35, 45, .97);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  animation: slideIn .22s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(10px);
}

.toast .toast-text {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

.toast.ok {
  border-left-color: var(--down);
}

.toast.err {
  border-left-color: var(--amber);
}

.toast.info {
  border-left-color: var(--accent);
}

.toast.leaving {
  animation: slideOut .22s ease forwards;
}

.toast-action {
  flex: 0 0 auto;
  background: rgba(76, 141, 255, .16);
  color: var(--accent-2);
  border: 1px solid rgba(76, 141, 255, .25);
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@keyframes slideOut {
  to { opacity: 0; transform: translateY(-6px); }
}

/* ---------- 确认框 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: linear-gradient(165deg, #1d2530, #171e27);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 19px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  animation: modalIn .18s ease;
}

.modal p {
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.65;
}

.modal-actions {
  justify-content: flex-end;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .container {
    padding: 12px;
  }

  .g-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 11px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .mini-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rc-add {
    grid-template-columns: 1fr 1fr;
  }

  .rc-add .n {
    grid-column: 1 / -1;
  }

  .rc-add .btn {
    grid-column: 1 / -1;
  }

  .trade-add {
    grid-template-columns: 1fr 1fr;
  }

  .trade-add .n,
  .trade-add .btn {
    grid-column: 1 / -1;
  }

  .sync-chip .sync-text {
    display: none;
  }
}

@media (max-width: 620px) {
  .srow1 {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }

  .srow2 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .scell .v {
    font-size: 13px;
  }

  .scell .v.name {
    font-size: 15px;
  }

  .scell .lb {
    font-size: 10px;
  }

  .g-num {
    font-size: 29px;
  }

  .g-pct {
    font-size: 22px;
  }
}

@media (max-width: 560px) {
  .topbar-inner {
    padding: 8px 11px;
    gap: 8px;
  }

  .brand-text span {
    display: none;
  }

  .brand-text strong {
    font-size: 14px;
  }

  .logo-mark,
  .goal-title .logo-mark {
    width: 27px;
    height: 27px;
    font-size: 16px;
  }

  .nav a {
    padding: 5px 9px;
    font-size: 13px;
  }

  .sync-chip {
    padding: 4px 6px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .goal-panel {
    padding: 15px;
  }

  .goal-mid {
    margin-top: 14px;
  }

  .g-num {
    font-size: 27px;
  }

  .g-stats {
    gap: 6px;
  }

  .g-stat b {
    font-size: 12px;
  }

  .mini-stats {
    gap: 6px;
  }

  .mini-stat {
    padding: 9px 6px;
  }

  .home-head {
    margin-top: 16px;
  }

  .home-head h2 {
    font-size: 15.5px;
  }

  .btn {
    padding: 9px 14px;
  }

  .head-btns .btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12.5px;
  }

  .modal {
    padding: 17px;
  }
}

@media (max-width: 380px) {
  .scell .v {
    font-size: 12px;
  }

  .scell .lb {
    font-size: 9.5px;
  }

  .scell .v.name {
    font-size: 14.5px;
  }

  .g-num {
    font-size: 24px;
  }

  .g-num .cur {
    font-size: 15px;
  }

  .g-pct {
    font-size: 19px;
  }

  .syncstatus {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
