/* iPhone / 窄屏优先 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS 输入框 ≥16px，避免自动放大；按钮仍按操作层级显示 */
@media (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .btn {
    font-size: 14px;
  }

  /* 顶栏收紧 */
  .topbar {
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .topbar h2 {
    font-size: 18px;
    letter-spacing: -0.2px;
  }

  .eyebrow {
    font-size: 12px;
  }

  .sync-pill { display: inline-flex; }

  .topbar-actions .btn {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  /* 卡片 */
  .card {
    padding: 14px 12px 12px;
    border-radius: 12px;
  }

  .card.accent {
    border-left-width: 3px;
  }

  .cardhead {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .cardhead h3 {
    font-size: 14.5px;
  }

  .cardhead .actions,
  .cardhead .btn {
    width: 100%;
  }

  .cardhead .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .cardhead .actions .btn {
    flex: 1;
    min-width: 120px;
  }

  .hint {
    font-size: 12px;
    line-height: 1.55;
  }

  /* 指标卡：2 列更紧凑 */
  .metric {
    min-height: 0;
    padding: 10px 12px;
  }

  .metric label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .metric .value {
    font-size: 20px;
    letter-spacing: -0.3px;
  }

  .metric .value.sm {
    font-size: 17px;
  }

  .metric small {
    font-size: 12px;
    margin-top: 4px;
  }

  .grid {
    gap: 10px;
  }

  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-4 > .metric:nth-child(n + 3),
  .split-2-1 {
    grid-column: auto;
  }

  /* 两列指标在极窄屏改单列 */
  @media (max-width: 380px) {
    .grid-4,
    .grid-3,
    .grid-2,
    .overview-metrics,
    .overview-accounts {
      grid-template-columns: 1fr;
    }
  }

  .split-2-1 {
    grid-template-columns: 1fr;
  }

  /* 总览顶部 */
  .overview-top {
    grid-template-columns: 1fr;
  }

  .hero-progress {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 12px;
  }

  .hero-progress .meta .big {
    font-size: 24px;
  }

  .hero-progress .toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .hero-progress .toolbar .btn {
    flex: 1;
  }

  /* 工具栏：纵向堆叠，按钮全宽 */
  .toolbar {
    gap: 8px;
    margin-bottom: 10px;
  }

  .toolbar .field {
    flex: 1 1 100%;
  }

  .toolbar .btn {
    flex: 1 1 auto;
    min-height: 40px;
  }

  .toolbar .spacer {
    display: none;
  }

  /* 步骤条 */
  .step-strip {
    flex-direction: column;
    gap: 8px;
  }

  .step-strip .step {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px;
  }

  .step-strip .step .btn {
    min-height: 36px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* 清单 */
  .check-item {
    flex-wrap: wrap;
    padding: 10px 12px;
    min-height: 0;
    gap: 8px;
  }

  .check-body {
    flex: 1 1 calc(100% - 40px);
  }

  .check-item .btn {
    width: 100%;
    margin-top: 4px;
  }

  /* 表格：可横滑 + 更紧字号 */
  .tablewrap {
    margin: 0 -12px;
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 12.5px;
    min-width: 520px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  th {
    font-size: 11.5px;
  }

  /* 批量录入 */
  .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%;
    min-height: 44px;
  }

  .batch-actions .btn {
    flex: 1;
    min-height: 44px;
  }

  /* 弹窗贴边 */
  dialog#modal {
    width: calc(100vw - 16px);
    max-width: none;
    margin: auto auto 12px;
    border-radius: 16px 16px 12px 12px;
    max-height: min(88vh, 100%);
  }

  dialog#modal[open] {
    position: fixed;
    bottom: 0;
    left: 8px;
    right: 8px;
    top: auto;
  }

  .modal-form {
    padding: 16px 14px 14px;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-head h3 {
    font-size: 16px;
  }

  .modal-foot {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding-top: 8px;
    margin: 12px -14px -14px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
  }

  .modal-foot .btn {
    flex: 1;
    min-height: 44px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span2 {
    grid-column: auto;
  }

  /* 账户卡 */
  .account-total {
    font-size: 20px;
  }

  .account-card .kv {
    font-size: 12px;
    padding: 8px 0;
  }

  /* 说明框 */
  .noteBox {
    font-size: 12px;
    padding: 10px 12px;
  }

  .empty {
    padding: 28px 12px;
  }

  /* Toast 避开底栏 */
  .toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
    font-size: 13px;
  }

  /* 图表容器 */
  .card svg[role="img"] {
    max-width: 100%;
    height: auto;
  }

  /* 底栏增强 */
  .bottom-nav button {
    font-size: 11.5px;
    letter-spacing: 0;
  }

  .bottom-nav button span.tab-label {
    display: block;
    line-height: 1.2;
  }
}

/* 更多页抽屉 */
.more-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(33, 25, 34, 0.35);
  display: none;
  align-items: flex-end;
}

.more-sheet.open {
  display: flex;
}

.more-sheet-panel {
  width: 100%;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-md);
}

.more-sheet-panel h3 {
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 12px;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.more-grid button {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 550;
  color: var(--ink);
}

.more-grid button.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.more-sheet-close {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
}

/* 持仓明细 */
.hold-list { display: flex; flex-direction: column; gap: 0; }
.hold-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.hold-item:last-child { border-bottom: none; }
.hold-top {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 10px;
}
.hold-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.hold-name small {
  display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; margin-top: 2px;
}
.hold-daily {
  text-align: right; font-size: 16px; font-weight: 650;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hold-daily small {
  display: block; font-size: 12px; font-weight: 500; margin-top: 2px;
}
.hold-bot {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 8px;
}
.hold-bot > div {
  display: flex; flex-direction: column; gap: 2px;
}
.hold-bot span {
  font-size: 12px; color: var(--ink-3);
}
.hold-bot b {
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.hold-bot b em {
  font-style: normal; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 4px;
}
@media (max-width: 640px) {
  .hold-bot {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }
}

