.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.card.accent {
  border-left: 4px solid var(--brand);
}

.cardhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cardhead h3 {
  font-size: 15px;
  font-weight: 650;
}

.cardhead .hint,
.hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 3px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.split-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 14px;
}

@media (max-width: 960px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-2-1,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 96px;
}

.metric label {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.metric .value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.metric .value.sm {
  font-size: 20px;
}

.metric small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 550;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-hover);
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: var(--ink-3);
}

.btn.soft {
  background: var(--brand-soft-solid);
  color: var(--brand);
}

.btn.danger {
  color: var(--brand);
  border-color: rgba(230, 0, 35, 0.35);
  background: transparent;
}

.btn.recorded {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.pill.brand {
  background: var(--brand-soft-solid);
  color: var(--brand);
  border-color: transparent;
}

.pill.ok {
  background: var(--down-soft);
  color: var(--down);
  border-color: transparent;
}

.tablewrap {
  overflow-x: auto;
  margin: 0 -4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  text-align: left;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-3);
  background: var(--surface-2);
}

th.num,
td.num {
  text-align: right;
}

tr:last-child td {
  border-bottom: none;
}

tr.selected-row td {
  background: var(--brand-soft);
}

td small {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  margin-top: 2px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar .spacer {
  flex: 1;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

input[type="date"],
input[type="month"] {
  min-height: 44px;
  padding-right: 8px;
  position: relative;
}

/* 放大原生日历/月份图标，便于点击 */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  width: 28px;
  height: 28px;
  padding: 6px;
  margin-right: -2px;
  border-radius: 8px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  background: var(--brand-soft-solid);
}

input[type="date"]::-webkit-calendar-picker-indicator:active,
input[type="month"]::-webkit-calendar-picker-indicator:active {
  background: var(--brand-soft);
  transform: scale(0.96);
}

/* 整行右侧也可点开日历（扩大热区） */
input[type="date"],
input[type="month"] {
  background-image: none;
}

input[type="number"],
input.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .span2 {
  grid-column: 1 / -1;
}

.form-section {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.kv:last-child {
  border-bottom: none;
}

.kv span {
  color: var(--ink-3);
}

.kv b {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-3);
}

.empty h3 {
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 6px;
}

.empty p {
  font-size: 13px;
  margin-bottom: 14px;
}

.noteBox {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.65;
}

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

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 56px;
}

.check-item.done {
  background: #f3f2ee;
  border-color: #e8e6e1;
}

.check-item.done .check-body strong {
  color: var(--ink-2);
  font-weight: 550;
}

.check-item.todo {
  background: #fff8f8;
  border-color: rgba(230, 0, 35, 0.28);
}

.check-item.todo .check-dot {
  border-color: var(--brand);
}

.check-item.todo .check-body strong {
  color: var(--brand-ink);
}

.check-item.todo .check-body span {
  color: var(--brand);
  opacity: 0.85;
}

/* 已完成：浅灰幽灵钮，仍可点开更正 */
.btn.done-btn,
.btn.ghost.done-btn {
  background: #eceae4;
  border: 1px solid transparent;
  color: var(--ink-2);
  font-weight: 500;
}

.btn.done-btn:hover,
.btn.ghost.done-btn:hover {
  background: #e2dfd7;
  color: var(--ink);
}

/* Codex 风格步骤条：完成有标记，可点击更正 */
.step-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.step-strip .step {
  flex: 1 1 180px;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.step-strip .step.done {
  background: var(--brand-soft);
  border-color: transparent;
}

.step-strip .step i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-3);
  flex-shrink: 0;
}

.step-strip .step.done i {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.step-strip .step span {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-3);
}

.step-strip .step span b {
  display: block;
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.step-strip .step .btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.check-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #fff;
}

.check-item.done .check-dot {
  background: var(--brand);
  border-color: var(--brand);
}

.check-body {
  flex: 1;
  min-width: 0;
}

.check-body strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.check-body span {
  font-size: 12px;
  color: var(--ink-3);
}

.alloc-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.alloc-bar span {
  display: block;
  height: 100%;
}

.bar-stock {
  background: var(--stock);
}

.bar-bond {
  background: var(--bond);
}

.bar-gold {
  background: var(--gold-bar);
}

.progress-ring-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.progress-ring-wrap .meta .big {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.progress-ring-wrap .meta p {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.error {
  background: var(--brand);
}

dialog#modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  box-shadow: var(--shadow-md);
}

dialog#modal::backdrop {
  background: rgba(33, 25, 34, 0.35);
}

.modal-form {
  padding: 18px 18px 16px;
}

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

.modal-head h3 {
  font-size: 16px;
  font-weight: 650;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.error {
  color: var(--brand);
  font-size: 12.5px;
  min-height: 1.2em;
  margin-top: 8px;
}

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

.tabs button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
}

.tabs button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.ref-note {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

.hero-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.hero-progress .meta .big {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

/* 总览：累计投入指标 + 双平台账户 */
.overview-top {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.overview-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.overview-metrics .metric {
  min-height: 88px;
  padding: 12px 14px;
}

.overview-metrics .metric .value {
  font-size: 22px;
}

.overview-accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.account-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
}

.account-total {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 8px;
}

.account-card .kv {
  padding: 7px 0;
  font-size: 12px;
}

.account-card .kv b {
  font-size: 12px;
  text-align: right;
}

@media (max-width: 960px) {
  .overview-top {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .overview-metrics,
  .overview-accounts {
    grid-template-columns: 1fr;
  }

  .hero-progress {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .hero-progress .toolbar {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .hero-progress {
    grid-template-columns: 1fr;
  }

  .metric .value {
    font-size: 22px;
  }

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

.skeleton {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.batch-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.3fr) 56px minmax(100px, 0.7fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

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

.batch-row .name {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
}

.batch-row .name small {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 400;
  margin-top: 1px;
}

.batch-row .pct {
  font-size: 12px;
  color: var(--ink-2);
  text-align: right;
}

.batch-row .plan {
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}

.batch-row .plan b {
  color: var(--ink-2);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.batch-row input {
  min-height: 36px;
  height: 36px;
  font-size: 13px;
  padding: 4px 10px;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.batch-actions .btn {
  min-height: 36px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .batch-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
  }

  .batch-row .name {
    grid-column: 1 / -1;
  }

  .batch-row input {
    grid-column: 1 / -1;
    width: 100%;
  }
}
