/* Theme tokens are also consumed by the Chart.js adapter. */
:root {
  color-scheme: dark;
  --bg: #0c1924;
  --surface: #142431;
  --surface-2: #1a2e3a;
  --ink: #edf4f4;
  --muted: #a7b9c4;
  --line: #30434f;
  --accent: #8fe4d0;
  --accent-ink: #0b322c;
  --tint: #213e40;
  --up: #ff7777;
  --down: #52d3a6;
  --flat: #b5c4ce;
  --danger: #ff9191;
  --shadow: 0 14px 48px #020b1426;
  --sans: 'DM Sans', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --financial: 'DIN Alternate', 'SF Pro Display', 'Inter', 'Segoe UI', 'PingFang SC', system-ui, sans-serif;
  --page-width: 720px;
}
html[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f6f4;
  --surface: #fffefa;
  --surface-2: #eff3ef;
  --ink: #172e37;
  --muted: #526770;
  --line: #d1dbd7;
  --accent: #146656;
  --accent-ink: #fff;
  --tint: #deeee7;
  --up: #bd3237;
  --down: #087152;
  --flat: #596d75;
  --danger: #ad3438;
  --shadow: 0 14px 48px #173a300a;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  min-height: 100%;
  scroll-padding-top: 1rem;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
[hidden] {
  display: none !important;
}
.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  touch-action: manipulation;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}
button:hover {
  border-color: var(--accent);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.57rem 0.7rem;
  background: var(--bg);
}
input[type='checkbox'],
input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  accent-color: var(--accent);
}
input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  letter-spacing: -0.045em;
  line-height: 1.18;
}
h2 {
  font-size: 1.16rem;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
h3 {
  font-size: 1rem;
  line-height: 1.4;
}
b,
strong {
  font-weight: 650;
}
small,
.muted {
  color: var(--muted);
}
small {
  font-size: 0.81rem;
}
a {
  color: var(--accent);
}
.up,
.positive {
  color: var(--up) !important;
}
.down,
.negative {
  color: var(--down) !important;
}
.flat {
  color: var(--flat);
}
.brand-symbol,
.icon-button svg,
.bottom-nav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linejoin: round;
  stroke-linecap: round;
  flex: none;
}
.masthead,
#view {
  width: min(100%, var(--page-width));
  margin-inline: auto;
  padding-inline: clamp(1rem, 4.5vw, 2.4rem);
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}
.brand-symbol {
  width: 40px;
  height: 40px;
  color: var(--accent);
}
.wordmark {
  font-weight: 730;
  font-size: 1.28rem;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.wordmark span {
  font-size: 0.78rem;
  font-weight: 560;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-left: 0.65rem;
  border-left: 1px solid var(--line);
}
.masthead-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 1.45rem;
  background: transparent;
}
.icon-button[aria-pressed='true'] {
  background: var(--tint);
  border-color: var(--accent);
  color: var(--accent);
}
.icon-button svg {
  width: 21px;
  height: 21px;
}
#view {
  padding-top: clamp(1.3rem, 4vw, 2.1rem);
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
  outline: none;
}
#view > * + * {
  margin-top: 1rem;
}
.page-head,
.section-head,
.row,
.list-row,
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.section-head {
  margin-bottom: 0.85rem;
}
.section-head > * {
  min-width: 0;
}
.panel,
.fund-card,
.hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: clamp(1rem, 3.5vw, 1.5rem);
  min-width: 0;
}
.panel {
  box-shadow: var(--shadow);
}
.hero,
.lock-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(ellipse at 90% 0%, rgba(65, 175, 143, 0.13), transparent 65%), #142e35;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #f3f8f4;
}
.hero {
  padding: clamp(1.25rem, 5vw, 2.25rem);
  border-color: #37605f;
  --muted: #b8cdcf;
  --line: #446064;
  --accent: #99e7cf;
  --up: #ff8585;
  --down: #65dbad;
  --flat: #bed0d4;
}
.hero .amount,
.hero .hero-value,
.asset-value {
  font: 700 clamp(2.65rem, 9.8vw, 3.9rem) / 1.12 var(--financial);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.hero-currency {
  font-size: 0.48em;
  font-weight: 500;
  opacity: 0.78;
  vertical-align: 0.14em;
  margin-inline-end: 0.16em;
}
.hero-fraction {
  font-size: 0.62em;
  font-weight: 600;
  opacity: 0.86;
}
.hero h2 {
  color: #f1f7f5;
}
.eyebrow {
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-weight: 660;
}
.metric {
  min-width: 0;
}
.metric > small,
.metric > span:first-child {
  display: block;
  font-size: 0.83rem;
  color: var(--muted);
}
.metric strong {
  display: block;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}
.metrics,
.grid,
.toolbar,
.actions {
  display: grid;
  gap: 0.75rem;
}
.metrics,
.grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stack {
  display: grid;
  gap: 0.75rem;
}
.row {
  flex-wrap: wrap;
}
.toolbar {
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  align-items: end;
}
#tx-filter {
  grid-template-columns: minmax(0, 1fr) auto;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.secondary {
  background: var(--surface-2);
}
.danger {
  color: var(--danger);
  background: transparent;
}
.tags,
.segmented,
.actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.tag,
.chip,
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.77rem;
  line-height: 1.35;
  background: var(--tint);
  color: var(--accent);
  border-radius: 6px;
  padding: 0.25rem 0.48rem;
}
.segmented {
  padding: 0.24rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.segmented button {
  flex: 1 0 auto;
  font-size: 0.85rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 36px;
  padding: 0.35rem 0.56rem;
}
.segmented :is(.active, [aria-pressed='true'], [aria-selected='true']) {
  background: var(--surface-2);
  color: var(--accent);
}
button.fund-card {
  display: block;
  width: 100%;
  text-align: left;
  font-weight: normal;
}
.list-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.list-row:last-child {
  border-bottom: 0;
}
.empty {
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.91rem;
}
.chart-wrap {
  height: 235px;
  position: relative;
  min-width: 0;
}
canvas {
  max-width: 100%;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.84rem;
}
th,
td {
  text-align: start;
  padding: 0.62rem 0.45rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-weight: 560;
  color: var(--muted);
}
.table-scroll {
  overflow: auto;
}
.field,
label.field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}
label {
  color: var(--muted);
  font-size: 0.9rem;
}
form {
  display: grid;
  gap: 0.85rem;
}
form button {
  min-height: 44px;
}
.form-error {
  color: var(--danger);
  font-size: 0.87rem;
}
.form-error:empty {
  display: none;
}
.bottom-nav {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--page-width));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  padding: 0.42rem clamp(0.45rem, 3vw, 2rem) calc(0.42rem + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 28px #00121b12;
}
.bottom-nav button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.25rem;
  min-height: 51px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 550;
}
.bottom-nav svg {
  width: 21px;
  height: 21px;
}
.bottom-nav :is(.active, [aria-current='page'], [aria-selected='true']) {
  background: var(--tint);
  color: var(--accent);
}
.lock-screen {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 45% 15%, var(--tint), transparent 65%);
}
.lock-card {
  width: min(100%, 385px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lock-art {
  height: 112px;
  display: grid;
  align-items: center;
  padding-inline: 1.7rem;
  border-bottom: 1px solid #3d6160;
}
.lock-art .brand-symbol {
  width: 62px;
  height: 62px;
  color: #a6eed9;
}
.lock-content {
  padding: 1.55rem 1.7rem 1.85rem;
}
.lock-content h1 {
  margin: 0.9rem 0 1.15rem;
  font-size: 1.85rem;
}
.lock-content .wordmark {
  font-size: 1rem;
  color: var(--muted);
}
.lock-content form {
  gap: 0.45rem;
}
.lock-content form button {
  margin-top: 0.6rem;
}
#sheet {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: min(100%, 630px);
  max-width: 100%;
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0 1.15rem calc(1.35rem + env(safe-area-inset-bottom));
}
#sheet::backdrop {
  background: #04111bac;
  backdrop-filter: blur(3px);
}
.sheet-head {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--surface);
  padding: 1rem 0 0.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}
#sheet-body > * + * {
  margin-top: 0.85rem;
}
body:has(#sheet[open]) {
  overflow: hidden;
}
#toast {
  position: fixed;
  z-index: 12;
  bottom: calc(86px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  pointer-events: none;
}
#toast:empty {
  display: none;
}
@media (min-width: 700px) {
  .bottom-nav button {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
  }
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Each amount and its date/coverage stay together as disclosure dates move independently. */
.hero-value {
  margin: 0.45rem 0 0.25rem;
}
.hero-metrics {
  grid-template-columns: repeat(3, minmax(max-content, 1fr));
  gap: clamp(0.35rem, 1.5vw, 1rem);
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-top: 1.2rem;
}
.hero-metrics strong {
  margin-top: 0.2rem;
  font-family: var(--financial);
  font-size: clamp(1.15rem, 4.6vw, 1.3rem);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 650;
  letter-spacing: -0.025em;
}
.summary-grid > .panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}
.summary-grid .metric strong {
  margin-top: 0.2rem;
  font-size: 1.25rem;
}
.sync-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}
.sync-strip small,
.list-row small,
.log-entry small,
.fund-card > small {
  display: block;
}
.sync-strip button,
.list-row button {
  flex-shrink: 0;
}
.rank-row {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.rank-row b,
.list-row b {
  overflow-wrap: anywhere;
}
.rank-row strong {
  white-space: nowrap;
}
.rank-stat {
  display: grid;
  justify-items: end;
  gap: 0.22rem;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}
.rank-stat strong {
  font-family: var(--financial);
  font-size: 1.06rem;
  font-weight: 720;
  letter-spacing: -0.02em;
}
.rank-stat small {
  color: inherit;
  opacity: 0.9;
  white-space: nowrap;
}
.rate-pill {
  display: inline-block;
  padding: 0.06rem 0.42rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: color-mix(in srgb, currentColor 13%, transparent);
}
.daily-tally {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.daily-filter {
  margin-bottom: 0.65rem;
}
.daily-filter button {
  font-size: 0.81rem;
  min-height: 36px;
  padding: 0.28rem 0.5rem;
}
.daily-filter button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 680;
}
.daily-sub {
  font-size: 0.83rem;
  margin-bottom: 0.55rem;
}
.daily-sub b {
  font-variant-numeric: tabular-nums;
}
.daily-sub > b:not(.up):not(.down) {
  color: var(--ink);
}
.daily-sub:empty {
  display: none;
}
#daily-list {
  display: grid;
  gap: 0.48rem;
}
.daily-row {
  padding: 0.68rem 0.85rem;
  min-height: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3.5px solid var(--line);
  border-radius: 12px;
}
.daily-row:last-child {
  border-bottom: 1px solid var(--line);
}
.daily-row.daily-up {
  border-left-color: var(--up);
}
.daily-row.daily-down {
  border-left-color: var(--down);
}
.daily-row:hover {
  border-color: var(--accent);
}
.daily-row > span:first-child > b {
  font-size: 0.95rem;
  font-weight: 660;
  color: var(--ink);
  line-height: 1.35;
}
.daily-row > span:first-child small {
  margin-top: 0.14rem;
}
.daily-row .daily-val {
  font-size: inherit;
  color: var(--ink);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}
.detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.detail-hero-item {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}
.detail-hero-item.right {
  justify-items: end;
  text-align: right;
}
.detail-hero-item strong {
  font-family: var(--financial);
  font-size: 1.38rem;
  font-weight: 720;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.detail-cell {
  display: grid;
  gap: 0.16rem;
  padding: 0.68rem 0.78rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}
.detail-cell strong {
  font-family: var(--financial);
  font-size: 1.02rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums lining-nums;
  overflow-wrap: anywhere;
}
.detail-sub {
  font-size: 0.74rem;
  opacity: 0.85;
}
.today-tag {
  display: inline-block;
  margin-left: 0.32rem;
  padding: 0.05rem 0.36rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--tint);
  color: var(--accent);
  vertical-align: 1px;
}
.stale-tag {
  display: inline-block;
  margin-left: 0.32rem;
  padding: 0.05rem 0.36rem;
  border-radius: 4px;
  font-size: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: 1px;
}
.review-tag {
  display: inline-block;
  margin-left: 0.32rem;
  padding: 0.06rem 0.4rem;
  border-radius: 4px;
  font-size: 0.71rem;
  font-weight: 650;
  background: color-mix(in srgb, #f59e0b 18%, var(--surface));
  border: 1px solid color-mix(in srgb, #f59e0b 50%, var(--line));
  color: #f59e0b;
  vertical-align: 1px;
}
.pending-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.pending-actions button {
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}
.pulse-panel .section-head {
  flex-wrap: wrap;
  gap: 0.45rem;
}
.pulse-est {
  font-weight: 640;
}
.pulse-refresh {
  min-height: 30px;
  padding: 0.2rem 0.62rem;
  font-size: 0.78rem;
  border-radius: 8px;
}
.pulse-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.pulse-time {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 0.5rem;
}
.pulse-item {
  display: grid;
  gap: 0.14rem;
  padding: 0.58rem 0.68rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}
.pulse-item small {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.74rem;
  white-space: nowrap;
}
.pulse-item strong {
  font-family: var(--financial);
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
}
.pulse-price {
  font-size: 0.74rem;
  opacity: 0.85;
}
.hero-mask {
  letter-spacing: 0.16em;
}
.fund-grid {
  display: grid;
  gap: 0.8rem;
}
.fund-card > b {
  font-size: 1.04rem;
}
.fund-card .tags {
  margin: 0.55rem 0 0.9rem;
}
.fund-card .metrics {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  margin-bottom: 0.55rem;
}
.fund-card .fund-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.fund-card .fund-metrics strong {
  font-size: clamp(0.9rem, 3.6vw, 1.04rem);
  white-space: nowrap;
}
.fund-card > small {
  margin-top: 0.24rem;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.check input {
  margin: 0;
}
summary {
  cursor: pointer;
  font-weight: 620;
  min-height: 34px;
}
summary small {
  margin-left: 0.4rem;
  font-weight: 400;
}
details[open] > summary {
  margin-bottom: 0.7rem;
}
.scroll-list {
  max-height: 330px;
  overflow: auto;
  margin-top: 1rem;
}
.log-entry {
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}
[data-sheet-error] {
  color: var(--danger);
}
@media (max-width: 600px) {
  .rank-grid:has(.rank-row) {
    grid-template-columns: 1fr;
  }
  .summary-grid small {
    line-height: 1.45;
  }
}
@media (min-width: 700px) {
  .fund-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
