:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #172235;
  --muted: #5e6a80;
  --ccb: #1f6feb;
  --icbc: #e74a3b;
  --line: #d9dfec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 15% -5%, #deecff 0%, transparent 60%),
    radial-gradient(900px 420px at 100% 0%, #ffe8e3 0%, transparent 60%),
    var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 14px 28px;
}

.hero h1 {
  margin: 6px 0 4px;
  font-size: 27px;
}

.hero p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.cards {
  margin-top: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(0, 21, 60, 0.07);
}

.card h2 {
  margin: 0;
  font-size: 18px;
}

.priceRow {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

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

.price {
  font-size: 34px;
  line-height: 1;
}

.redeemPrice {
  font-size: 26px;
  opacity: 0.82;
}

#ccbCard .price {
  color: var(--ccb);
}

#icbcCard .price {
  color: var(--icbc);
}

.meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  margin-top: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(0, 21, 60, 0.07);
}

.hidden {
  display: none !important;
}

.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panelHead h3 {
  margin: 0;
  font-size: 19px;
}

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

.monthLabel {
  min-width: 98px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.minorMeta {
  font-size: 12px;
  color: var(--muted);
}

.panelHead button {
  border: 0;
  background: #1b2944;
  color: #fff;
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 999px;
}

.subline {
  margin: 6px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.chartWrap {
  position: relative;
}

#lineChart {
  width: 100%;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfefe;
  touch-action: none;
}

.miniWrap {
  margin-top: 8px;
}

#miniMap {
  width: 100%;
  height: 78px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdff;
  cursor: crosshair;
  touch-action: none;
}

#pnlChart {
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdff;
  touch-action: none;
  cursor: crosshair;
}

.pnlSubPanel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #d6e2f4;
}

.pnlSubPanel .panelHead h3 {
  font-size: 18px;
}

.chartBadge {
  position: absolute;
  max-width: min(88%, 260px);
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
  background: rgba(27, 41, 68, 0.92);
  line-height: 1.35;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chartBadge.profit {
  background: rgba(209, 71, 63, 0.9);
}

.chartBadge.loss {
  background: rgba(31, 141, 69, 0.9);
}

.chartBadge.flat {
  background: rgba(27, 41, 68, 0.92);
}

.chartTooltip {
  position: absolute;
  min-width: 160px;
  background: rgba(38, 46, 60, 0.88);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
  z-index: 5;
}

.chartTooltip.hidden {
  display: none;
}

.legend {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.holdingsGrid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metricCard {
  background: #f8fbff;
  border: 1px solid #d7e4f8;
  border-radius: 12px;
  padding: 10px 12px;
}

.metricCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metricCard strong {
  display: block;
  margin-top: 6px;
  font-size: 25px;
  color: #1b2944;
  line-height: 1;
}

.metricCard strong.pnlProfit {
  color: #d1473f;
}

.metricCard strong.pnlLoss {
  color: #1f8d45;
}

.metricCard strong.pnlFlat {
  color: #1b2944;
}

.totalsLine {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13px;
  color: var(--muted);
}

.tradeGrid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tradePanel {
  overflow-x: hidden;
}

.tradeGrid > * {
  min-width: 0;
}

.tradeCard {
  border: 1px solid #dce6f6;
  border-radius: 12px;
  padding: 10px;
  background: #fcfdff;
  min-width: 0;
  max-width: 100%;
}

.tradeCard h4 {
  margin: 0;
  font-size: 16px;
}

.tradeCardHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.manageBtn {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  background: #1b2944;
  cursor: pointer;
}

.manageBox {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #cfdbf0;
}

.tradeForm {
  margin-top: 8px;
  display: grid;
  gap: 7px;
}

.tradeForm label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.tradeForm input {
  width: 100%;
  border: 1px solid #cdd8eb;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}

.tradeForm input:focus {
  outline: none;
  border-color: #7ea6e9;
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.12);
}

.formActions {
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

.formActions button {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  color: #fff;
  background: #1b2944;
}

.formActions .ghost {
  color: #1b2944;
  background: #dde6f6;
}

.tableWrap {
  margin-top: 10px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tableExpand {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tableExpandActions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tableExpandHint {
  font-size: 12px;
  color: var(--muted);
}

.tableExpandBtn {
  border: 1px solid #c9d9f2;
  border-radius: 999px;
  background: #eef4ff;
  color: #1b2944;
  padding: 5px 11px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tableCollapseBtn {
  border: 1px solid #d2dcec;
  border-radius: 999px;
  background: #fff;
  color: #41506b;
  padding: 5px 11px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tableExpandBtn .arrow {
  transition: transform 0.2s ease;
}

.tableExpandBtn.isCollapse .arrow {
  transform: rotate(180deg);
}

.tradeTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
  font-size: 12px;
}

.tradeTable th,
.tradeTable td {
  border-bottom: 1px solid #e4ebf7;
  padding: 7px 6px;
  text-align: left;
}

.tradeTable th {
  color: var(--muted);
  font-weight: 500;
}

.emptyCell {
  color: #9aa4b8;
}

.opCol {
  white-space: nowrap;
}

.miniBtn {
  border: 0;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 12px;
  color: #1b2944;
  background: #e7eefb;
  cursor: pointer;
}

.miniBtn.danger {
  color: #912f27;
  background: #ffe5e1;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot.ccb {
  background: var(--ccb);
}

.dot.icbc {
  background: var(--icbc);
}

.calendarPanel {
  margin-top: 12px;
}

.calendarWeek {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.calendarGrid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calDay {
  border: 1px solid #d5deee;
  border-radius: 10px;
  min-height: 40px;
  background: #fff;
  color: #8e98ab;
  font-size: 13px;
  position: relative;
}

.calDay.hasData {
  color: #1c2a44;
  border-color: #9dc0ff;
  background: #eef4ff;
  cursor: pointer;
}

.calDay.hasData::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ccb);
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}

.calDay.noData {
  color: #b6bfd0;
  border-color: #e4e9f2;
  background: #f5f7fb;
}

.calDay.selected {
  border: 2px solid #1b2944;
  color: #1b2944;
  font-weight: 600;
}

.calDay.today {
  box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.45);
}

.calDay.outMonth {
  opacity: 0.45;
}

.tips {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 680px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 24px;
  }

  .price {
    font-size: 30px;
  }

  #lineChart {
    height: 280px;
  }

  #miniMap {
    height: 66px;
  }

  #pnlChart {
    height: 190px;
  }

  .panelHead {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .tradeCardHead {
    flex-wrap: wrap;
  }

  .tradeTable {
    min-width: 320px;
  }

  .metricCard strong {
    font-size: 22px;
  }
}
