:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f3f8;
  --text: #1f2329;
  --muted: #7a8291;
  --line: #e5e8ef;
  --accent: #e5484d;
  --accent-strong: #c9353b;
  --red: #e5484d;
  --green: #10a564;
  --amber: #b7791f;
  --blue: #2f6fed;
  --shadow: 0 12px 32px rgba(31, 35, 41, 0.07);
  --app-content-width: 1440px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a20;
  --surface-soft: #20242c;
  --text: #f2f3f5;
  --muted: #9ca3af;
  --line: #2a303a;
  --accent: #ff646a;
  --accent-strong: #ff7b80;
  --red: #ff6b70;
  --green: #4bd083;
  --amber: #e8b45f;
  --blue: #79a8ff;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.modal h2 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.top-user {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
}

.wechat-button {
  padding: 0;
}

.wechat-button img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.app-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  width: min(var(--app-content-width), 100%);
  margin: 0 auto;
}

.app-nav {
  position: sticky;
  top: 69px;
  align-self: start;
  height: calc(100vh - 69px);
  padding: 20px 0 20px 14px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  width: 66px;
  min-height: 62px;
  place-items: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.nav-icon {
  display: grid;
  width: 26px;
  height: 22px;
  place-items: center;
}

.nav-icon img {
  width: 21px;
  height: 21px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.56;
  transition: filter 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.nav-item.active .nav-icon img {
  filter: none;
  opacity: 1;
  transform: translateY(-1px);
}

.nav-item span:last-child {
  font-size: 12px;
}

.nav-item.active {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
}

.workspace {
  width: 100%;
  min-width: 0;
  padding: 20px clamp(14px, 3vw, 32px) 42px;
}

.view-panel {
  display: grid;
  gap: 14px;
}

.auth-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 17, 21, 0.42);
  backdrop-filter: blur(8px);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(280px, 1fr);
  gap: 22px;
  width: min(820px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  align-items: center;
  overflow: auto;
}

.auth-copy h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
}

.auth-copy p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.auth-panel-head strong {
  font-size: 16px;
}

.auth-tabs {
  width: 100%;
  margin-bottom: 16px;
}

.auth-tabs button {
  width: 100%;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form span {
  color: var(--muted);
  font-size: 12px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span,
.metric em,
.field label,
.selects span,
.form-grid span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
  word-break: break-word;
}

.metric em {
  display: block;
  margin-top: 4px;
}

.metric-primary {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
}

.command-strip,
.controls-line,
.fund-card,
.home-panel,
.discussion-board,
.mine-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
}

.home-panel,
.discussion-board,
.mine-board {
  padding: 14px;
  box-shadow: var(--shadow);
}

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.view-head h2 {
  margin: 0;
  font-size: 16px;
}

.discussion-board {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.discussion-head,
.discussion-head > div,
.discussion-head-actions,
.forum-post-title-line,
.forum-post-meta,
.forum-row-tools,
.forum-detail-head,
.forum-detail-title-line,
.forum-detail-tools,
.forum-comments-section > header,
.forum-comment-item header,
.forum-pagination {
  display: flex;
  align-items: center;
}

.discussion-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.discussion-head > div:first-child {
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.discussion-head h2 {
  margin: 0;
  font-size: 22px;
}

.discussion-head span,
.forum-post-meta,
.forum-detail-meta,
.forum-comments-section > header span {
  color: var(--muted);
}

.discussion-head-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.discussion-head-actions .primary-button {
  gap: 4px;
}

.discussion-head-actions .primary-button span {
  color: inherit;
  font-size: 18px;
}

.forum-dashboard-publish-button {
  gap: 6px;
  border-color: color-mix(in srgb, var(--amber) 35%, var(--line));
  color: #a35c00;
}

.forum-dashboard-publish-button span {
  color: inherit;
  font-size: 17px;
}

.forum-post-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.forum-post-list > .loading-state,
.forum-post-list > .empty-state {
  border: 0;
  border-radius: 0;
}

.forum-post-row {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 112px;
  align-items: start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.forum-post-row:last-child {
  border-bottom: 0;
}

.forum-post-row:hover,
.forum-post-row:focus-visible {
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
  outline: 0;
}

.forum-post-row.pinned::before {
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--amber);
  content: '';
}

.forum-avatar,
.forum-comment-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--blue) 20%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
  color: var(--blue);
  font-weight: 800;
}

.forum-avatar {
  width: 42px;
  height: 42px;
  font-size: 16px;
}

.forum-post-main {
  min-width: 0;
}

.forum-post-title-line {
  min-width: 0;
  gap: 8px;
}

.forum-post-title-line h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-pinned-label,
.forum-pin-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.forum-dashboard-label {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--blue) 25%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.forum-post-row.dashboard .forum-avatar {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--amber) 28%, var(--line));
  background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  color: #a35c00;
}

.forum-post-main > p {
  display: -webkit-box;
  margin: 7px 0 10px;
  overflow: hidden;
  color: #596274;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.forum-post-meta {
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
}

.forum-post-meta strong {
  color: var(--text);
}

.forum-row-tools {
  align-self: center;
  gap: 5px;
}

.forum-row-tools .icon-button,
.forum-detail-tools .icon-button,
.forum-modal-head .icon-button {
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--muted);
}

.forum-delete-button {
  border-color: color-mix(in srgb, var(--red) 24%, var(--line)) !important;
  color: var(--red) !important;
}

.forum-empty {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.forum-empty strong {
  color: var(--text);
  font-size: 17px;
}

.forum-pagination {
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.forum-pagination button {
  min-width: 88px;
}

.forum-pagination span {
  color: var(--muted);
  font-size: 13px;
}

.modal.forum-compose-modal {
  width: min(560px, calc(100% - 24px));
}

.forum-compose-box {
  padding: 20px;
}

.forum-modal-head h2 {
  margin: 0;
  font-size: 19px;
}

.forum-compose-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  margin-top: 14px;
  padding: 3px;
  border-radius: 8px;
  background: #ececef;
}

.forum-compose-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526078;
  font-weight: 800;
  cursor: pointer;
}

.forum-compose-switch button.active {
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(40, 80, 100, 0.1);
  color: var(--blue);
}

.forum-form-field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.forum-form-field[hidden] {
  display: none;
}

.forum-form-field > span {
  color: #4b5870;
  font-weight: 800;
}

.forum-form-field textarea {
  min-height: 210px;
  line-height: 1.6;
}

.forum-compose-box.message-mode .forum-form-field textarea {
  min-height: 132px;
}

.forum-message-label {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.forum-post-row.message .forum-post-main > p {
  margin-top: 5px;
  -webkit-line-clamp: 3;
}

.forum-compose-actions button {
  min-width: 104px;
}

.modal.forum-dashboard-compose-modal {
  width: min(640px, calc(100% - 24px));
}

.forum-dashboard-compose-box {
  padding: 20px;
}

.forum-dashboard-compose-box textarea {
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.forum-dashboard-json-status {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.forum-dashboard-json-status.valid {
  color: var(--green);
}

.forum-dashboard-json-status.invalid {
  color: var(--red);
}

.modal.forum-detail-modal {
  width: min(720px, calc(100% - 24px));
}

.modal.forum-detail-modal.dashboard-mode {
  width: min(1040px, calc(100% - 24px));
}

.forum-detail-box {
  max-height: min(780px, calc(100vh - 36px));
  overflow: auto;
  padding: 20px 22px;
}

.forum-detail-head {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.forum-detail-heading {
  min-width: 0;
}

.forum-detail-title-line {
  min-width: 0;
  gap: 8px;
}

.forum-detail-title-line h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.35;
}

.forum-detail-heading > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.forum-detail-tools {
  flex: 0 0 auto;
  gap: 5px;
}

.forum-detail-content {
  min-height: 110px;
  padding: 20px 2px 24px;
  color: var(--text);
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.forum-detail-content.dashboard-content {
  min-height: 0;
  padding: 18px 0 24px;
  line-height: normal;
  white-space: normal;
}

.forum-dashboard-board {
  display: grid;
  gap: 16px;
}

.forum-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.forum-dashboard-metric {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.forum-dashboard-metric:last-child {
  border-right: 0;
}

.forum-dashboard-metric span {
  color: var(--muted);
  font-size: 12px;
}

.forum-dashboard-metric strong {
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-dashboard-metric.blue strong { color: var(--blue); }
.forum-dashboard-metric.amber strong { color: #b56800; }
.forum-dashboard-metric.green strong { color: var(--green); }
.forum-dashboard-metric.red strong { color: var(--red); }

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

.forum-dashboard-block,
.forum-dashboard-table-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.forum-dashboard-block {
  padding: 14px;
}

.forum-dashboard-block > header,
.forum-dashboard-table-section > header,
.forum-dashboard-bar-row > div,
.forum-dashboard-ranking-list > div {
  display: flex;
  align-items: center;
}

.forum-dashboard-block > header,
.forum-dashboard-table-section > header {
  justify-content: space-between;
  gap: 12px;
}

.forum-dashboard-block h3,
.forum-dashboard-table-section h3 {
  margin: 0;
  font-size: 15px;
}

.forum-dashboard-block header span,
.forum-dashboard-table-section header span {
  color: var(--muted);
  font-size: 12px;
}

.forum-dashboard-bars {
  display: grid;
  gap: 9px;
  margin-top: 13px;
}

.forum-dashboard-bar-row {
  display: grid;
  gap: 5px;
}

.forum-dashboard-bar-row > div {
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 12px;
}

.forum-dashboard-bar-row > div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-dashboard-bar-row > div strong {
  color: var(--muted);
  font-size: 12px;
}

.forum-dashboard-bar-track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: color-mix(in srgb, var(--line) 65%, var(--surface));
}

.forum-dashboard-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.forum-dashboard-bar-track i.operation {
  background: var(--red);
}

.forum-dashboard-bar-track i.theme {
  background: var(--green);
}

.forum-dashboard-ranking-list {
  display: grid;
  gap: 3px;
  margin-top: 9px;
}

.forum-dashboard-ranking-list > div {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.forum-dashboard-ranking-list > div:last-child {
  border-bottom: 0;
}

.forum-dashboard-ranking-list strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-dashboard-ranking-value {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 58px 42px;
  gap: 6px;
  text-align: right;
}

.forum-dashboard-ranking-value b,
.forum-dashboard-ranking-value small {
  font-size: 12px;
}

.forum-dashboard-ranking-value small {
  color: var(--muted);
}

.forum-dashboard-fund-ranking.buy .forum-dashboard-ranking-value b {
  color: var(--red);
}

.forum-dashboard-fund-ranking.sell .forum-dashboard-ranking-value b {
  color: var(--green);
}

.forum-dashboard-rank {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.forum-dashboard-table-section {
  overflow: hidden;
}

.forum-dashboard-table-section > header {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.forum-dashboard-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.forum-dashboard-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.forum-dashboard-table-wrap th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--surface-soft);
  color: #4d5970;
  font-weight: 800;
  text-align: left;
}

.forum-dashboard-table-wrap th,
.forum-dashboard-table-wrap td {
  max-width: 190px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-dashboard-table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.forum-dashboard-table-wrap tbody tr:hover {
  background: var(--surface-soft);
}

.forum-dashboard-table-wrap td.fund-name {
  min-width: 210px;
  max-width: 280px;
  color: var(--text);
  font-weight: 700;
}

.forum-dashboard-action {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 800;
}

.forum-dashboard-action.buy,
.forum-dashboard-action.dca {
  background: color-mix(in srgb, var(--red) 9%, var(--surface));
  color: var(--red);
}

.forum-dashboard-action.sell {
  background: color-mix(in srgb, var(--green) 10%, var(--surface));
  color: var(--green);
}

.forum-dashboard-action.convert {
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
  color: var(--blue);
}

.forum-dashboard-no-data,
.forum-dashboard-ranking-list > p,
.forum-dashboard-error {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.forum-comments-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.forum-comments-section > header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.forum-comments-section h3 {
  margin: 0;
  font-size: 17px;
}

.forum-comment-list {
  max-height: 280px;
  overflow: auto;
}

.forum-comment-item {
  display: flex;
  gap: 11px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
}

.forum-comment-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.forum-comment-item > div {
  min-width: 0;
  flex: 1;
}

.forum-comment-item header {
  justify-content: space-between;
  gap: 12px;
}

.forum-comment-item time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.forum-comment-item p {
  margin: 5px 0 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.forum-comment-empty {
  padding: 22px 0;
  color: var(--muted);
  text-align: center;
}

.forum-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.forum-comment-form textarea {
  min-height: 74px;
  resize: none;
}

.forum-comment-form button {
  min-width: 88px;
  min-height: 42px;
}

.forum-login-prompt {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--blue);
  font-weight: 800;
}

.home-fund-list {
  display: grid;
  gap: 10px;
}

.home-fund-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.home-fund-row span:first-child {
  min-width: 0;
}

.home-fund-row strong,
.home-fund-row small {
  display: block;
}

.home-fund-row small {
  margin-top: 3px;
  color: var(--muted);
}

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

.market-dashboard {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.market-index-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(31, 35, 41, 0.035);
}

.market-index-ticker {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.market-index-ticker:hover {
  background: var(--surface-soft);
}

.market-index-panel.expanded .market-index-ticker {
  display: none;
}

.market-index-current,
.market-index-headline {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 15px;
  white-space: nowrap;
}

.market-index-current.is-changing {
  animation: market-index-enter 0.24s ease-out;
}

.market-index-current strong,
.market-index-headline strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
}

.market-index-current b,
.market-index-headline b {
  font-size: 20px;
}

.market-index-current span,
.market-index-headline span {
  font-size: 16px;
  font-weight: 800;
}

.market-index-current .loading-state {
  min-height: 0;
  padding: 0;
  border: 0;
}

.market-index-error {
  color: var(--muted) !important;
  font-weight: 700 !important;
}

.market-index-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.market-index-expanded {
  padding: 14px 18px 18px;
}

.market-index-expanded-head,
.market-index-expanded-tools {
  display: flex;
  align-items: center;
}

.market-index-expanded-head {
  min-height: 40px;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.market-index-expanded-tools {
  flex: 0 0 auto;
  gap: 6px;
}

.market-index-expanded-tools .icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.market-index-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 240px));
  gap: 12px;
}

.market-index-card {
  display: grid;
  min-width: 0;
  min-height: 132px;
  padding: 12px 14px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.market-index-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-index-card b {
  margin-top: 4px;
  font-size: 20px;
}

.market-index-card > span:not(.market-index-sparkline-placeholder) {
  font-size: 14px;
}

.market-index-sparkline,
.market-index-sparkline-placeholder {
  display: block;
  width: 100%;
  height: 42px;
  margin-top: 5px;
}

.market-index-sparkline path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes market-index-enter {
  from {
    opacity: 0.25;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.market-index-settings-modal {
  width: min(760px, calc(100% - 24px));
}

.market-index-settings-box {
  max-height: min(680px, calc(100vh - 48px));
  overflow: auto;
  padding: 20px 22px;
}

.market-index-settings-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.market-index-settings-title,
.market-index-options-head {
  display: flex;
  align-items: center;
}

.market-index-settings-title {
  gap: 10px;
}

.market-index-settings-title > span {
  font-size: 23px;
}

.market-index-settings-title h2,
.market-index-settings-section h3 {
  margin: 0;
}

.market-index-settings-section + .market-index-settings-section {
  margin-top: 20px;
}

.market-index-settings-section h3 {
  font-size: 16px;
}

.market-index-settings-section > p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.market-index-selected-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.market-index-selected-list > .empty-state {
  grid-column: 1 / -1;
  padding: 18px;
}

.market-index-selected-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
}

.market-index-selected-card.dragging {
  opacity: 0.45;
}

.market-index-selected-card > button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
  color: var(--red);
  font-size: 17px;
}

.market-index-selected-card strong {
  padding-right: 24px;
  font-size: 15px;
}

.market-index-selected-card b {
  font-size: 22px;
}

.market-index-selected-card span {
  font-size: 14px;
  font-weight: 700;
}

.market-index-options-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.market-index-options-head .icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.market-index-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.market-index-options button {
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.market-index-options button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.market-index-settings-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.market-index-settings-actions button {
  min-width: 112px;
}

.market-sector-section,
.market-comparison-section {
  min-width: 0;
}

.market-login-gate {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
}

.market-login-gate:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.market-login-gate strong {
  color: var(--accent);
  font-size: 14px;
}

.market-login-gate[hidden] {
  display: none;
}

.market-comparison-section {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.market-section-head,
.market-section-title,
.market-section-tools,
.market-sector-meta {
  display: flex;
  align-items: center;
}

.market-section-head,
.market-sector-meta {
  justify-content: space-between;
}

.market-section-head {
  gap: 16px;
  margin-bottom: 12px;
}

.market-section-title {
  min-width: 0;
  gap: 12px;
}

.market-section-title h2 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
}

.market-section-title > span {
  color: var(--muted);
  font-size: 12px;
}

.market-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 126px;
  min-height: 34px;
  padding: 3px;
  border-radius: 8px;
  background: #ececef;
}

.market-segmented button {
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526078;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.market-segmented button.active {
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(40, 80, 100, 0.1);
  color: var(--text);
}

.market-section-tools {
  gap: 8px;
}

.market-section-tools label {
  color: var(--muted);
  font-size: 12px;
}

.market-section-tools select {
  width: 144px;
  min-height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.market-refresh-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: #1294b0;
  font-size: 19px;
}

.market-sector-meta {
  margin-bottom: 10px;
  color: #526078;
  font-size: 12px;
}

.market-sector-meta small {
  font-size: 11px;
}

.market-sector-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.market-sector-grid > .loading-state,
.market-sector-grid > .empty-state {
  grid-column: 1 / -1;
  min-height: 150px;
}

.market-sector-card {
  display: grid;
  min-width: 0;
  min-height: 86px;
  padding: 13px 14px;
  align-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.market-sector-card:hover,
.market-sector-card.active {
  border-color: color-mix(in srgb, #1599b6 48%, var(--line));
  box-shadow: 0 5px 16px rgba(38, 78, 96, 0.1);
}

.market-sector-card:hover {
  transform: translateY(-1px);
}

.market-sector-card span {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.market-sector-card span strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-sector-card span b {
  flex: 0 0 auto;
  font-size: 16px;
}

.market-sector-card small {
  overflow: hidden;
  color: #526078;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-sector-card em {
  font-style: normal;
  font-weight: 700;
}

.market-reset-button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #1294b0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.market-selected-sectors {
  display: flex;
  min-height: 38px;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.market-selected-sectors button {
  display: inline-flex;
  min-height: 34px;
  padding: 0 9px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.market-selected-sectors button i {
  width: 16px;
  height: 3px;
  flex: 0 0 16px;
  border-radius: 99px;
}

.market-selected-sectors button strong {
  font-size: 12px;
}

.market-selected-sectors button b {
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.market-selection-empty {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.market-trend-chart {
  min-height: 380px;
}

.market-trend-chart > .loading-state,
.market-trend-chart > .empty-state {
  min-height: 380px;
}

.market-chart-date {
  margin-bottom: 5px;
  color: #526078;
  font-size: 12px;
  text-align: right;
}

.market-trend-figure {
  position: relative;
  min-width: 0;
  touch-action: pan-y;
}

.market-trend-figure svg {
  display: block;
  width: 100%;
  height: 360px;
}

.market-chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.market-chart-grid text {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: middle;
}

.market-chart-grid g:nth-child(-n + 6) text {
  text-anchor: start;
}

.market-chart-zero {
  stroke: #8b96a8;
  stroke-dasharray: 5 5;
  stroke-width: 1.3;
}

.market-chart-hover-line,
.market-chart-tooltip {
  position: absolute;
  pointer-events: none;
}

.market-chart-hover-line[hidden],
.market-chart-tooltip[hidden] {
  display: none;
}

.market-chart-hover-line {
  top: 18px;
  bottom: 38px;
  border-left: 1px dashed #68758a;
}

.market-chart-tooltip {
  top: 24px;
  z-index: 2;
  display: grid;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.market-chart-tooltip > div,
.market-chart-tooltip p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-chart-tooltip > div {
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}

.market-chart-tooltip > div span {
  color: var(--muted);
  font-size: 11px;
}

.market-chart-tooltip p {
  margin: 4px 0 0;
  font-size: 12px;
}

.market-chart-tooltip p i {
  width: 16px;
  height: 3px;
  flex: 0 0 16px;
  border-radius: 99px;
}

.market-chart-tooltip p span {
  min-width: 84px;
  flex: 1;
}

.market-chart-tooltip p b {
  text-align: right;
}

.mine-profile {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.mine-account-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mine-account-row .mine-profile {
  flex: 1;
  min-width: 0;
}

.mine-profile span,
.mine-profile small {
  color: var(--muted);
}

.mine-profile strong {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.mine-actions {
  display: flex;
  gap: 10px;
}

.mine-feature-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.mine-feature-row {
  display: grid;
  grid-template-columns: 42px minmax(140px, 1fr) auto 24px;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.mine-feature-row:hover {
  background: var(--surface-soft);
}

.mine-feature-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
}

.mine-feature-icon.settings-icon {
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  color: var(--green);
}

.mine-feature-name {
  font-size: 16px;
  font-weight: 750;
}

.mine-feature-value {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.mine-feature-value small {
  color: var(--muted);
  font-size: 12px;
}

.mine-feature-value strong {
  font-size: 15px;
}

.mine-feature-arrow {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.mine-settings-modal {
  width: min(720px, calc(100% - 32px));
}

.mine-settings-box {
  display: flex;
  max-height: min(780px, calc(100vh - 32px));
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.mine-settings-head {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.mine-settings-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mine-settings-head > div > span {
  font-size: 24px;
}

.mine-settings-head h2 {
  font-size: 22px;
}

.mine-settings-content {
  display: grid;
  min-height: 0;
  gap: 18px;
  padding: 16px 18px 18px;
  overflow: auto;
}

.mine-settings-content .mine-account-row {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.mine-settings-section {
  display: grid;
  gap: 10px;
}

.mine-settings-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.mine-settings-panel,
.mine-security-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.mine-setting-row {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.mine-setting-row + .mine-setting-row {
  border-top: 1px solid var(--line);
}

.refresh-setting-row {
  grid-template-columns: minmax(110px, 0.35fr) minmax(360px, 1fr);
}

.refresh-setting-row > div {
  display: grid;
  gap: 10px;
}

.settings-segment {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--line) 72%, var(--surface));
}

.settings-segment button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.settings-segment button.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 10%, transparent);
}

.settings-custom-refresh {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
}

.settings-custom-refresh input {
  width: 86px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
}

.width-setting-row {
  grid-template-columns: minmax(180px, 0.55fr) minmax(240px, 1fr) 72px;
}

.settings-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-row-label .icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
}

.width-setting-row input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.width-setting-row output {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.mine-security-trigger {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.mine-security-trigger > span:first-child {
  display: grid;
  gap: 3px;
}

.mine-security-trigger small {
  color: var(--muted);
  font-size: 12px;
}

.mine-security-trigger > span:last-child {
  color: var(--muted);
  font-size: 24px;
  transition: transform 160ms ease;
}

.mine-security-trigger[aria-expanded="true"] > span:last-child {
  transform: rotate(90deg);
}

.mine-security-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

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

.mine-security-form label {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.mine-security-form label span {
  color: var(--muted);
  font-size: 12px;
}

.mine-security-form input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.mine-security-form .primary-button {
  align-self: end;
  min-height: 38px;
}

.mine-security-form.password-form .primary-button {
  grid-column: 1 / -1;
  justify-self: end;
}

.mine-settings-actions {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.mine-settings-actions .primary-button {
  min-width: 148px;
}

.mine-profit-modal {
  width: min(860px, calc(100% - 32px));
}

.mine-profit-box {
  display: flex;
  max-height: min(760px, calc(100vh - 32px));
  flex-direction: column;
  gap: 12px;
  padding: 0;
  overflow: hidden;
}

.mine-profit-head {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.mine-profit-head h2 {
  font-size: 22px;
}

.mine-profit-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px;
}

.mine-profit-summary > div {
  display: grid;
  min-width: 0;
  min-height: 72px;
  align-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mine-profit-summary span {
  color: var(--muted);
  font-size: 13px;
}

.mine-profit-summary strong {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mine-profit-controls {
  display: grid;
  gap: 8px;
  padding: 0 18px;
}

.mine-profit-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 38px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-soft);
}

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

.mine-profit-segment button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.mine-profit-segment button.active {
  background: var(--blue);
  color: #fff;
}

.mine-profit-period {
  min-height: 0;
  padding: 0 18px 18px;
  overflow: auto;
}

.mine-profit-period-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  min-height: 68px;
  align-items: center;
  gap: 12px;
}

.mine-profit-period-head > div {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.mine-profit-period-head h3 {
  margin: 0;
  font-size: 20px;
}

.mine-profit-period-head strong {
  font-size: 16px;
}

.mine-profit-grid {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.mine-profit-weekdays,
.mine-profit-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.mine-profit-weekdays span {
  display: grid;
  height: 36px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.mine-profit-day,
.mine-profit-day-placeholder {
  min-width: 0;
  min-height: 58px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.mine-profit-day:nth-child(7n),
.mine-profit-day-placeholder:nth-child(7n) {
  border-right: 0;
}

.mine-profit-day {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 6px 4px;
  background: var(--surface);
}

.mine-profit-day.today {
  box-shadow: inset 0 0 0 1px var(--blue);
}

.mine-profit-day b {
  color: color-mix(in srgb, var(--blue) 88%, var(--text));
  font-size: 14px;
}

.mine-profit-day span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mine-profit-day span.positive,
.mine-profit-tile strong.positive {
  color: var(--red);
}

.mine-profit-day span.negative,
.mine-profit-tile strong.negative {
  color: var(--green);
}

.mine-profit-tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

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

.mine-profit-tile {
  display: grid;
  min-height: 88px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
}

.mine-profit-tile.current {
  box-shadow: inset 0 0 0 1px var(--blue);
}

.mine-profit-tile span {
  color: var(--muted);
  font-size: 14px;
}

.mine-profit-tile strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-strip {
  padding: 12px;
  margin-bottom: 12px;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 150px) minmax(120px, 160px) auto;
  gap: 10px;
  align-items: end;
}

.field,
.form-grid label,
.selects label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.search-field {
  position: relative;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 84px;
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.primary-button,
.secondary-button,
.danger-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.compact-action {
  min-height: 38px;
  padding: 0 12px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.file-button {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--line);
}

.danger-button {
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 24%, var(--line));
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.suggest-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.suggest-item {
  width: 100%;
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.suggest-item:last-child {
  border-bottom: 0;
}

.suggest-item b {
  color: var(--accent);
}

.suggest-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-item small {
  grid-column: 2;
  color: var(--muted);
}

.controls-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.segments {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segments button {
  min-width: 64px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segments button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.selects {
  display: flex;
  align-items: end;
  gap: 10px;
}

.selects label {
  width: 132px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.group-chip,
.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
}

.group-chip.active {
  border-color: var(--accent);
  color: var(--accent);
}

.fund-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.fund-table-scroll {
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.fund-table-scroll:focus {
  outline: 0;
}

.fund-table-scroll::-webkit-scrollbar {
  height: 10px;
}

.fund-table-scroll::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.fund-table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 58%, transparent);
}

.fund-table {
  width: 100%;
  min-width: 1080px;
}

.fund-list-head,
.fund-card {
  display: grid;
  grid-template-columns: minmax(390px, 1fr) 140px 150px 150px 150px 100px;
  width: 100%;
  align-items: center;
  gap: 0;
}

.fund-list-head {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 74%, var(--surface));
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.fund-list-head span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 0 18px;
  white-space: nowrap;
}

.fund-list-head span:first-child {
  justify-content: flex-start;
}

.fund-list-head span:not(:first-child) {
  text-align: center;
}

.fund-card {
  min-height: 94px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.fund-card:last-child {
  border-bottom: 0;
}

.fund-card:nth-of-type(even) {
  background: color-mix(in srgb, var(--surface-soft) 52%, var(--surface));
}

.fund-name-cell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 18px 18px 18px 22px;
}

.fund-star-button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0 1px 0 0;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--blue) 22%, var(--line));
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue);
  font-size: 22px;
  line-height: 1;
}

.fund-star-button.active {
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
}

.fund-title {
  min-width: 0;
}

.fund-title-button {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.fund-title h3 {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-title p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 7px 0 0;
  overflow: hidden;
}

.fund-card .badge {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
}

.fund-table-cell {
  display: grid;
  min-width: 0;
  gap: 6px;
  justify-items: center;
  padding: 18px;
  text-align: center;
}

.fund-table-cell strong,
.fund-table-cell small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-table-cell strong {
  font-size: 16px;
  line-height: 1.2;
}

.fund-row-cell,
.quote-block {
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: right;
}

.fund-row-cell span,
.fund-row-cell small,
.fund-table-cell small,
.quote-block small,
.returns-row em,
.history-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.fund-row-cell strong,
.quote-block strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-block > span {
  display: grid;
  min-width: 0;
  gap: 2px;
  justify-items: end;
}

.quote-block b {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.positive {
  color: var(--red);
}

.negative {
  color: var(--green);
}

.neutral {
  color: var(--muted);
}

.fund-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.fund-metrics div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.fund-metrics span,
.history-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.fund-metrics strong {
  display: block;
  margin-top: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.returns-row > span {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 4px;
}

.returns-row em {
  flex: 0 0 auto;
  white-space: nowrap;
}

.returns-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 0;
}

.fund-card .fund-actions {
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
}

.row-icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.row-icon-button:hover,
.fund-star-button:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.row-icon-button.danger {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 24%, var(--line));
  background: color-mix(in srgb, var(--red) 8%, var(--surface));
}

.card-status {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.fund-card .row-icon-button {
  min-height: 36px;
  padding: 0;
  font-size: 18px;
}

.empty-state,
.loading-state {
  padding: 30px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(720px, calc(100% - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

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

.wechat-modal {
  width: min(440px, calc(100% - 28px));
}

.wechat-box {
  display: grid;
  gap: 14px;
  max-height: min(88vh, 760px);
  overflow: auto;
}

.wechat-head {
  margin-bottom: 0;
}

.wechat-image-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.wechat-group-image {
  display: block;
  width: 100%;
  max-height: min(72vh, 640px);
  object-fit: contain;
  background: #ffffff;
}

.operation-modal,
.holding-edit-modal,
.trade-modal,
.dca-modal,
.convert-modal,
.dividend-modal {
  width: min(620px, calc(100% - 24px));
}

.operation-modal {
  width: min(440px, calc(100% - 24px));
}

.trade-modal {
  width: min(520px, calc(100% - 24px));
}

.dca-modal {
  width: min(540px, calc(100% - 24px));
}

.convert-modal {
  width: min(520px, calc(100% - 24px));
}

.dividend-modal {
  width: min(440px, calc(100% - 24px));
}

.holding-edit-modal {
  width: min(520px, calc(100% - 24px));
}

.operation-box,
.holding-edit-box,
.trade-box,
.dca-box,
.convert-box,
.dividend-box {
  padding: 24px;
}

.trade-box {
  padding: 20px 22px 22px;
  border-radius: 14px;
}

.dca-box {
  max-height: calc(100vh - 48px);
  padding: 20px 22px 22px;
  overflow: auto;
  border-radius: 14px;
}

.convert-box {
  max-height: calc(100vh - 48px);
  padding: 16px 18px 18px;
  overflow: auto;
  border-radius: 14px;
}

.dividend-box {
  padding: 18px 20px 20px;
  border-radius: 14px;
}

.holding-edit-box {
  max-height: calc(100vh - 48px);
  padding: 18px 20px 20px;
  overflow: auto;
  border-radius: 14px;
}

.operation-box {
  padding: 18px 20px 20px;
  border-radius: 14px;
}

.operation-head,
.operation-title-line,
.holding-edit-summary {
  display: flex;
  align-items: center;
}

.operation-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.operation-title-line {
  min-width: 0;
  flex: 1 1 auto;
  gap: 9px;
}

.operation-title-line h2,
.operation-fund-title h3,
.holding-edit-summary h3 {
  margin: 0;
  font-size: 24px;
}

.operation-title-line h2 {
  font-size: 21px;
}

.operation-gear {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 18px;
}

.operation-record {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 800;
}

.operation-head .operation-record {
  min-height: 34px;
  padding: 0 12px;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 13px;
}

.operation-head .icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  font-size: 24px;
}

.operation-fund-title {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
  text-align: left;
}

.operation-fund-title h3 {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.holding-edit-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

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

.operation-button {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 16px;
  font-weight: 800;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.operation-button:hover {
  box-shadow: 0 8px 18px rgba(31, 35, 41, 0.08);
  transform: translateY(-1px);
}

.op-buy {
  border-color: #0894b5;
  background: color-mix(in srgb, #0894b5 10%, var(--surface));
  color: #0894b5;
}

.op-sell,
.op-clear {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, var(--surface));
  color: var(--red);
}

.op-dca {
  border-color: #2c68ff;
  background: color-mix(in srgb, #2c68ff 10%, var(--surface));
  color: #2c68ff;
}

.op-switch {
  border-color: #b570ff;
  background: color-mix(in srgb, #b570ff 10%, var(--surface));
  color: #b570ff;
}

.op-clear {
  grid-column: 1 / -1;
}

.op-dividend {
  border-color: #ffa936;
  background: color-mix(in srgb, #ffa936 11%, var(--surface));
  color: #e89420;
}

.op-edit {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--surface);
  color: var(--text);
}

.op-clear {
  border-color: transparent;
  background: linear-gradient(180deg, #ff4d57, #ff636b);
  color: #101828;
}

.holding-edit-summary {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.holding-edit-summary > span {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 800;
}

.mode-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.mode-tabs button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tabs button.active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}

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

.holding-edit-head,
.holding-edit-title-line,
.holding-edit-field-label {
  display: flex;
  align-items: center;
}

.holding-edit-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.holding-edit-title-line {
  min-width: 0;
  gap: 10px;
}

.holding-edit-title-line h2 {
  margin: 0;
  flex: 0 0 auto;
  font-size: 21px;
}

.holding-edit-title-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  color: var(--text);
  font-size: 22px;
}

.holding-edit-buy-link {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #dfe6f0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 7px 16px color-mix(in srgb, #1398b4 10%, transparent);
  color: #1398b4;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.holding-edit-head .icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.holding-edit-box .holding-edit-summary {
  align-items: center;
  margin-bottom: 14px;
}

.holding-edit-box .holding-edit-summary > div {
  min-width: 0;
}

.holding-edit-box .holding-edit-summary h3 {
  overflow: hidden;
  font-size: 19px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-edit-box .holding-edit-summary p {
  margin-top: 3px;
  font-size: 14px;
}

.holding-edit-box .holding-edit-summary > span {
  padding: 8px 12px;
  border-color: #dfe6f0;
  color: #1398b4;
  font-size: 13px;
}

.holding-edit-mode-tabs {
  gap: 3px;
  margin: 0 0 13px;
  padding: 0;
  background: transparent;
}

.holding-edit-mode-tabs button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 15px;
}

.holding-edit-mode-tabs button.active {
  background: color-mix(in srgb, #1398b4 13%, var(--surface));
  color: #1398b4;
}

.holding-form-grid label,
.holding-edit-date-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.holding-form-grid label > span,
.holding-edit-field-label > span {
  color: #4b5870;
  font-size: 14px;
  font-weight: 800;
}

.holding-form-grid b {
  color: var(--red);
}

.holding-form-grid label > input,
.holding-edit-date-field input {
  height: 48px;
  border-color: #dfe6f0;
  border-radius: 10px;
  font-size: 16px;
}

.holding-edit-field-label {
  justify-content: space-between;
  gap: 12px;
}

.holding-edit-field-label button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1398b4;
  font-size: 13px;
  font-weight: 800;
}

.holding-days-input {
  position: relative;
}

.holding-days-input input {
  padding-right: 42px;
}

.holding-days-input > span {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--muted);
  font-size: 14px;
  transform: translateY(-50%);
}

.holding-edit-actions {
  margin-top: 15px;
}

.holding-edit-actions button {
  min-height: 44px;
}

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

.modal-head h2 {
  font-size: 18px;
}

.modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

.wide-field {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 9px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.trade-head,
.trade-title-line {
  display: flex;
  align-items: center;
}

.trade-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.trade-title-line {
  gap: 10px;
}

.trade-title-line h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.trade-title-icon {
  position: relative;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
}

.trade-title-icon::before {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  height: 12px;
  border: 1px solid #bed5ee;
  border-radius: 4px;
  background: linear-gradient(180deg, #f8fbff, #d9ebfb);
  box-shadow: inset 0 -3px 0 #70a9d6;
}

.trade-title-icon::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 50%;
  width: 10px;
  height: 13px;
  border-radius: 3px 3px 1px 1px;
  background: #ff5148;
  transform: translateX(-50%);
  clip-path: polygon(28% 0, 72% 0, 72% 48%, 100% 48%, 50% 100%, 0 48%, 28% 48%);
}

.trade-sell-mode .trade-title-icon::after {
  transform: translateX(-50%) rotate(180deg);
}

.trade-head .icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.trade-fund-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}

.trade-fund-summary h3,
.trade-fund-summary p {
  margin: 0;
}

.trade-fund-summary h3 {
  font-size: 21px;
  line-height: 1.25;
}

.trade-fund-summary p {
  color: var(--muted);
  font-size: 15px;
}

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

.trade-form-grid label,
.trade-session-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.trade-form-grid label > span,
.trade-session-field > span {
  color: #4b5870;
  font-size: 15px;
  font-weight: 800;
}

.trade-form-grid b {
  color: var(--red);
}

.trade-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trade-mode-link {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1398b4;
  font-size: 14px;
  font-weight: 800;
}

.stepped-input,
.date-input-wrap {
  position: relative;
}

.stepped-input input,
.date-input-wrap input {
  width: 100%;
  height: 46px;
  border: 1px solid #dfe6f0;
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}

.prominent-input input {
  height: 56px;
  padding-right: 66px;
  border-color: var(--red);
  font-size: 17px;
}

.stepped-input input::placeholder {
  color: #8e97a6;
}

.stepped-input input::-webkit-outer-spin-button,
.stepped-input input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.stepper-buttons {
  position: absolute;
  top: 7px;
  right: 8px;
  display: grid;
  gap: 4px;
}

.compact-step-input .stepper-buttons {
  top: 5px;
  right: 7px;
  gap: 3px;
}

.step-button {
  display: grid;
  width: 54px;
  height: 20px;
  place-items: center;
  padding: 0;
  border: 1px solid #dfe6f0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-soft));
  color: #4b5870;
  font-size: 18px;
  line-height: 1;
}

.compact-step-input input {
  padding-right: 66px;
}

.compact-step-input .step-button {
  height: 18px;
}

.date-input-wrap input {
  padding-right: 54px;
}

.trade-sell-tools {
  display: grid;
  gap: 8px;
}

.trade-sell-fractions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.trade-sell-fractions button {
  height: 36px;
  border: 0;
  border-radius: 7px;
  background: #ededf0;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.trade-sell-fractions button:hover {
  background: color-mix(in srgb, #1398b4 12%, #ededf0);
}

.trade-sell-tools p {
  margin: 0;
  color: #4b5870;
  font-size: 15px;
  font-weight: 800;
}

.trade-session-field {
  margin-top: 18px;
}

.trade-session-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 10px;
  background: #e9e9ec;
}

.trade-session-tabs button {
  height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5870;
  font-size: 15px;
  font-weight: 800;
}

.trade-session-tabs button.active {
  background: #1398b4;
  color: #fff;
}

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

.trade-actions button {
  min-height: 48px;
  border-radius: 11px;
  font-size: 17px;
  font-weight: 900;
}

.trade-actions .secondary-button {
  background: #f3f3f4;
  color: var(--text);
}

.trade-actions .primary-button {
  background: #75bee0;
}

.trade-actions .primary-button:hover {
  background: #4eb0db;
}

.dca-head {
  margin-bottom: 20px;
}

.dca-title-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid #b9d7e8;
  border-radius: 7px;
  background: linear-gradient(180deg, #f6fbff, #d7edf8);
  box-shadow: inset 0 -3px 0 #7fb3cf;
  color: #1398b4;
  font-size: 20px;
  font-weight: 900;
}

.dca-title-icon::before {
  content: "↻";
  line-height: 1;
}

.dca-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dca-head .icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.dca-head .dca-reset-button {
  color: #93c8dc;
  font-size: 26px;
}

.dca-fund-summary {
  margin-bottom: 18px;
}

.dca-enabled-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  color: #4b5870;
  font-size: 15px;
  font-weight: 800;
}

.dca-toggle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1398b4;
}

.dca-toggle-wrap input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dca-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cfd6df;
  transition: background 0.16s ease;
}

.dca-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(31, 35, 41, 0.18);
  transition: transform 0.16s ease;
}

.dca-toggle-wrap input:checked + .dca-switch {
  background: #1398b4;
}

.dca-toggle-wrap input:checked + .dca-switch::after {
  transform: translateX(20px);
}

.dca-disabled .dca-toggle-wrap {
  color: var(--muted);
}

.dca-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 15px 14px;
}

.dca-form-grid label,
.dca-period-field,
.dca-day-field,
.dca-first-date-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dca-form-grid label > span,
.dca-period-field > span,
.dca-day-field > span,
.dca-first-date-field > span {
  color: #4b5870;
  font-size: 15px;
  font-weight: 800;
}

.dca-form-grid b,
.dca-period-field b,
.dca-day-field b {
  color: var(--red);
}

.dca-period-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border-radius: 10px;
  background: #e9e9ec;
}

.dca-period-tabs button {
  height: 38px;
  min-width: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5870;
  font-size: 14px;
  font-weight: 800;
}

.dca-period-tabs button.active {
  background: #1398b4;
  color: #fff;
}

.dca-day-field {
  margin-top: 16px;
}

.dca-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: #ededf0;
}

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

.dca-day-grid button {
  height: 32px;
  min-width: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5870;
  font-size: 14px;
  font-weight: 800;
}

.dca-day-grid button.active {
  background: #1398b4;
  color: #fff;
}

.dca-first-date-field {
  margin-top: 14px;
}

.dca-first-date-field input[readonly] {
  background: #f3f3f4;
  cursor: default;
}

.dca-schedule-note {
  margin: 0;
  color: #4b5870;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.dca-actions {
  margin-top: 18px;
}

.dividend-head {
  margin-bottom: 14px;
}

.dividend-head .icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.dividend-title-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid #c6a348;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8df81, #d6a93e);
  box-shadow: inset 0 -3px 0 #a77b21;
  color: #6f4b0a;
  font-size: 17px;
  font-weight: 900;
}

.dividend-fund-summary {
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
  text-align: center;
}

.dividend-fund-summary h3,
.dividend-fund-summary p {
  margin: 0;
}

.dividend-fund-summary h3 {
  overflow: hidden;
  font-size: 19px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dividend-fund-summary p {
  color: var(--muted);
  font-size: 14px;
}

.dividend-options {
  display: grid;
  gap: 9px;
}

.dividend-option {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid #dfe6f0;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.dividend-option:hover {
  border-color: color-mix(in srgb, #1398b4 45%, #dfe6f0);
}

.dividend-option.selected {
  border-color: #1398b4;
  background: color-mix(in srgb, #1398b4 9%, var(--surface));
  box-shadow: 0 7px 16px color-mix(in srgb, #1398b4 9%, transparent);
}

.dividend-option:focus-within {
  outline: 2px solid color-mix(in srgb, #1398b4 35%, transparent);
  outline-offset: 2px;
}

.dividend-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dividend-radio {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid #dfe6f0;
  border-radius: 50%;
  background: var(--surface);
}

.dividend-option.selected .dividend-radio {
  border-color: #1398b4;
}

.dividend-option.selected .dividend-radio::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #1398b4;
}

.dividend-option-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.dividend-option-copy strong {
  color: var(--text);
  font-size: 16px;
}

.dividend-option.selected .dividend-option-copy strong {
  color: #1398b4;
}

.dividend-option-copy small {
  color: #4b5870;
  font-size: 13px;
}

.dividend-sync-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  margin-top: 12px;
  color: #4b5870;
  cursor: pointer;
}

.dividend-sync-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dividend-sync-row > span {
  position: relative;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1px solid #dfe6f0;
  border-radius: 5px;
  background: var(--surface);
}

.dividend-sync-row input:checked + span {
  border-color: #1398b4;
  background: #1398b4;
}

.dividend-sync-row input:checked + span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.dividend-sync-row:focus-within > span {
  outline: 2px solid color-mix(in srgb, #1398b4 35%, transparent);
  outline-offset: 2px;
}

.dividend-sync-row em {
  overflow: hidden;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dividend-actions {
  margin-top: 13px;
}

.dividend-actions button {
  min-height: 44px;
}

.convert-head {
  margin-bottom: 10px;
}

.convert-head .icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.convert-title-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid #9ab7cf;
  border-radius: 7px;
  background: linear-gradient(180deg, #f5fbff, #cfe4f2);
  box-shadow: inset 0 -3px 0 #7198b7;
  color: #467796;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.convert-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 10px;
  padding: 7px 11px;
  border: 1px solid #f2bb8b;
  border-radius: 8px;
  background: color-mix(in srgb, #fff1e5 76%, var(--surface));
  color: #c35d1e;
}

.convert-notice > span {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
}

.convert-notice p {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.convert-fund-summary {
  gap: 3px;
  margin-bottom: 10px;
}

.convert-fund-summary h3 {
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.convert-fund-summary p {
  font-size: 14px;
}

.convert-form-grid {
  display: grid;
  gap: 9px;
}

.convert-form-grid label,
.convert-target-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.convert-form-grid label > span,
.convert-target-field > span {
  color: #4b5870;
  font-size: 14px;
  font-weight: 800;
}

.convert-form-grid b,
.convert-target-field b {
  color: var(--red);
}

.convert-form-grid label > input,
.convert-target-trigger {
  width: 100%;
  height: 44px;
  border: 1px solid #dfe6f0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}

.convert-form-grid label > input[readonly] {
  background: color-mix(in srgb, var(--surface-soft) 64%, var(--surface));
  color: #4b5870;
}

.convert-amount-input input {
  height: 50px;
}

.convert-source-tools {
  display: grid;
  gap: 5px;
  margin-top: -1px;
}

.convert-fractions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.convert-fractions button {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #ededf0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.convert-fractions button:hover,
.convert-fractions button.active {
  border-color: #1398b4;
  background: color-mix(in srgb, #1398b4 12%, #ededf0);
  color: #1089a3;
}

.convert-source-tools p {
  margin: 0;
  color: #4b5870;
  font-size: 13px;
  font-weight: 800;
}

.convert-source-tools p::before {
  content: "* ";
}

.convert-target-picker {
  position: relative;
}

.convert-target-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px;
  text-align: left;
}

.convert-target-trigger > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.convert-target-trigger strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.convert-target-trigger small {
  color: var(--muted);
  font-size: 12px;
}

.convert-target-trigger i {
  flex: 0 0 auto;
  color: #4b5870;
  font-size: 25px;
  font-style: normal;
  line-height: 1;
  transition: transform 0.16s ease;
}

.convert-target-trigger[aria-expanded="true"] i {
  transform: rotate(90deg);
}

.convert-target-trigger.selected {
  border-color: color-mix(in srgb, #1398b4 55%, #dfe6f0);
}

.convert-target-list {
  display: grid;
  gap: 5px;
  max-height: 172px;
  margin-top: 6px;
  padding: 6px;
  overflow: auto;
  border: 1px solid #dfe6f0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(31, 35, 41, 0.12);
}

.convert-target-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.convert-target-option:hover,
.convert-target-option[aria-selected="true"] {
  background: color-mix(in srgb, #1398b4 10%, var(--surface-soft));
}

.convert-target-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.convert-target-option strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.convert-target-option small,
.convert-target-option em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.convert-target-option em {
  flex: 0 0 auto;
}

.convert-target-empty {
  padding: 16px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.convert-actions {
  margin-top: 12px;
}

.convert-actions button {
  min-height: 44px;
}

.trade-history-mode .trade-fund-summary,
.trade-history-mode .trade-form-grid,
.trade-history-mode .trade-session-field {
  display: none;
}

.trade-history {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin-top: 14px;
}

.history-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-modal {
  width: min(920px, calc(100% - 28px));
}

.detail-modal-box {
  max-height: min(84vh, 820px);
  overflow: auto;
}

.detail-content {
  display: grid;
  gap: 12px;
}

.detail-hero-card,
.detail-section-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-hero-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
}

.detail-quote-main span,
.detail-quote-main strong,
.detail-quote-main em {
  display: block;
}

.detail-quote-main span,
.detail-stat-grid span,
.detail-return-grid span,
.detail-info-grid span,
.detail-holding-grid span {
  color: var(--muted);
  font-size: 12px;
}

.detail-quote-main strong {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.detail-quote-main em {
  margin-top: 8px;
  font-size: 18px;
  font-style: normal;
  font-weight: 800;
}

.detail-stat-grid,
.detail-return-grid,
.detail-info-grid,
.detail-holding-grid {
  display: grid;
  gap: 8px;
}

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

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

.detail-stat-grid div,
.detail-return-grid div,
.detail-info-grid div,
.detail-holding-grid div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.detail-stat-grid strong,
.detail-return-grid strong,
.detail-info-grid strong,
.detail-holding-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.detail-section-card {
  padding: 14px;
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-section-head h3 {
  margin: 0;
  font-size: 16px;
}

.detail-section-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.detail-trend-head {
  align-items: flex-start;
}

.detail-trend-head > div:first-child {
  min-width: 0;
}

.detail-trend-head h3 + span {
  display: block;
  margin-top: 4px;
  text-align: left;
}

.detail-trend-ranges {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  overflow-x: auto;
  max-width: min(420px, 54vw);
  padding-bottom: 2px;
}

.detail-trend-ranges button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.detail-trend-ranges button.active {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-weight: 700;
}

.detail-trend-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.detail-trend-meta strong {
  font-size: 20px;
}

.detail-trend-meta span {
  color: var(--muted);
  font-size: 12px;
}

.detail-trend-figure {
  position: relative;
  min-width: 0;
  touch-action: pan-y;
}

.detail-trend-figure svg {
  display: block;
  width: 100%;
  height: 260px;
}

.trend-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.trend-grid text {
  fill: var(--muted);
  font-size: 12px;
}

.trend-zero-line {
  stroke: color-mix(in srgb, var(--accent) 34%, var(--line));
  stroke-dasharray: 5 5;
  stroke-width: 1.4;
}

.detail-trend-hover-line,
.detail-trend-hover-dot,
.detail-trend-tooltip {
  position: absolute;
  pointer-events: none;
}

.detail-trend-hover-line[hidden],
.detail-trend-hover-dot[hidden],
.detail-trend-tooltip[hidden] {
  display: none;
}

.detail-trend-hover-line {
  top: 0;
  bottom: 22px;
  border-left: 1px dashed color-mix(in srgb, var(--accent) 58%, var(--line));
}

.detail-trend-hover-dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(39, 74, 140, 0.22);
  transform: translate(-50%, -50%);
}

.detail-trend-tooltip {
  top: 8px;
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  transform: translateX(-50%);
}

.detail-trend-tooltip strong,
.detail-trend-tooltip span {
  display: block;
  white-space: nowrap;
}

.detail-trend-tooltip span {
  color: var(--muted);
}

.detail-trend-tooltip b {
  font-weight: 800;
}

.detail-trend-axis,
.detail-trend-legend {
  display: flex;
  align-items: center;
}

.detail-trend-axis {
  justify-content: space-between;
  padding-left: 62px;
  color: var(--muted);
  font-size: 12px;
}

.detail-trend-legend {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.detail-trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-trend-legend i {
  width: 18px;
  height: 3px;
  border-radius: 99px;
}

.stock-holding-table {
  overflow: auto;
}

.stock-holding-head,
.stock-holding-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.6fr) repeat(4, minmax(92px, 1fr));
  gap: 10px;
  align-items: center;
  min-width: 680px;
}

.stock-holding-head {
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 12px;
}

.stock-holding-row {
  padding: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.stock-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stock-name b {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.stock-name span,
.stock-name strong,
.stock-name small {
  display: block;
  min-width: 0;
}

.stock-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-name small {
  margin-top: 3px;
  color: var(--muted);
}

.detail-modal {
  width: min(720px, calc(100% - 32px));
  border-radius: 14px;
}

.detail-modal-box {
  display: flex;
  max-height: min(84vh, 740px);
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  border-radius: 14px;
}

.fund-detail-modal-head {
  min-height: 58px;
  margin: 0;
  padding: 13px 20px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}

.fund-detail-modal-head h2 {
  font-size: 18px;
}

.fund-detail-modal-head p:empty {
  display: none;
}

.fund-detail-modal-head .icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
}

.detail-content {
  display: block;
  min-height: 320px;
  padding: 15px 20px 20px;
  overflow: auto;
}

.detail-content:focus {
  outline: 0;
}

.fund-detail-overview {
  min-width: 0;
}

.fund-detail-identity-row,
.fund-detail-identity,
.fund-detail-source-actions,
.fund-detail-market-row,
.fund-detail-market-main,
.fund-detail-rate-pair,
.fund-detail-collapse-line,
.fund-detail-holdings-head,
.fund-detail-stock-name,
.fund-detail-stock-metrics {
  display: flex;
  align-items: center;
}

.fund-detail-identity-row {
  justify-content: space-between;
  gap: 16px;
}

.fund-detail-identity {
  min-width: 0;
  gap: 10px;
}

.detail-favorite-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
}

.detail-favorite-button.active {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
}

.fund-detail-identity > div {
  min-width: 0;
}

.fund-detail-identity h3 {
  max-width: 450px;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-detail-identity p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0 0;
  color: #4c5a72;
}

.fund-detail-identity p strong {
  font-size: 15px;
}

.fund-detail-identity p span {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-size: 12px;
}

.fund-detail-source-actions {
  flex: 0 0 auto;
  gap: 7px;
}

.fund-detail-source-card {
  display: grid;
  min-width: 72px;
  min-height: 48px;
  padding: 6px 8px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.fund-detail-source-card:first-child {
  border-color: transparent;
  background: color-mix(in srgb, #1599b6 10%, var(--surface));
}

.fund-detail-source-card span,
.fund-detail-market-row span,
.fund-detail-position-grid span,
.fund-detail-extra-grid span,
.fund-detail-period-grid span,
.fund-detail-holding-summary span {
  color: #526078;
  font-size: 12px;
}

.fund-detail-source-card strong {
  max-width: 78px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-detail-delete {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0;
  line-height: 1;
}

.fund-detail-delete::before {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 12px;
  height: 13px;
  border: 2px solid #fff;
  border-top: 0;
  border-radius: 0 0 2px 2px;
  content: "";
}

.fund-detail-delete::after {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 5px -3px 0 -1px #fff;
  content: "";
}

.fund-detail-market-row {
  justify-content: space-between;
  gap: 22px;
  margin-top: 12px;
}

.fund-detail-market-main {
  align-items: flex-start;
  gap: 40px;
}

.fund-detail-market-main > div,
.fund-detail-rate-pair > div,
.fund-detail-position-grid > div,
.fund-detail-extra-grid > div,
.fund-detail-period-grid > div,
.fund-detail-holding-summary > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.fund-detail-market-main strong {
  font-size: 18px;
}

.fund-detail-rate-pair {
  align-items: flex-start;
  gap: 34px;
  text-align: right;
}

.fund-detail-rate-pair strong {
  font-size: 18px;
}

.fund-detail-position-grid,
.fund-detail-extra-grid,
.fund-detail-period-grid,
.fund-detail-holding-summary,
.fund-detail-tabs,
.fund-detail-stock-grid {
  display: grid;
}

.fund-detail-position-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 13px;
}

.fund-detail-position-grid strong {
  font-size: 22px;
  line-height: 1.2;
}

.fund-detail-position-grid span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fund-detail-position-grid span button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8a95a7;
  line-height: 1;
}

.fund-detail-collapse-line {
  gap: 14px;
  margin: 12px 0 10px;
}

.fund-detail-collapse-line > span {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.fund-detail-collapse-line button {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #526078;
  font-size: 12px;
  font-weight: 700;
}

.fund-detail-extra-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.fund-detail-extra-grid strong {
  font-size: 15px;
}

.fund-detail-period-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.fund-detail-period-grid strong {
  font-size: 15px;
}

.fund-detail-tabs-section {
  margin-top: 12px;
}

.fund-detail-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eff0f2;
}

.fund-detail-tabs button {
  min-width: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4c5a72;
  font-size: 14px;
  font-weight: 700;
}

.fund-detail-tabs button.active {
  background: color-mix(in srgb, #1599b6 14%, var(--surface));
  box-shadow: 0 2px 7px rgba(40, 80, 100, 0.08);
  color: #1294b0;
}

.fund-detail-tab-content {
  min-height: 220px;
  padding-top: 12px;
}

.fund-detail-empty-tab {
  min-height: 230px;
}

.fund-detail-holding-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 12px;
}

.fund-detail-holding-summary strong {
  font-size: 16px;
}

.fund-detail-holdings-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.fund-detail-holdings-head h3 {
  margin: 0;
  font-size: 15px;
}

.fund-detail-holdings-head span,
.fund-detail-report-meta {
  color: #526078;
  font-size: 12px;
}

.fund-detail-stock-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fund-detail-stock-card {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 10px;
  min-width: 0;
  min-height: 54px;
  padding: 7px 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.fund-detail-stock-name {
  min-width: 0;
  gap: 7px;
}

.fund-detail-stock-name b {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.fund-detail-stock-name span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.fund-detail-stock-name strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-detail-stock-name small {
  color: var(--muted);
  font-size: 11px;
}

.fund-detail-stock-metrics {
  justify-content: flex-end;
  gap: 8px;
}

.fund-detail-stock-metrics strong {
  min-width: 44px;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.fund-detail-report-meta {
  margin: 8px 0 0;
  text-align: right;
}

.fund-detail-holdings-empty .empty-state {
  min-height: 150px;
}

.fund-performance-panel {
  min-width: 0;
}

.fund-performance-toolbar,
.fund-performance-legend,
.fund-performance-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.fund-performance-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 184px;
  min-height: 34px;
  padding: 3px;
  border-radius: 8px;
  background: #ececef;
}

.fund-performance-mode button,
.fund-performance-ranges button {
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526078;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.fund-performance-mode button.active,
.fund-performance-ranges button.active {
  background: color-mix(in srgb, #1599b6 15%, var(--surface));
  box-shadow: 0 2px 7px rgba(40, 80, 100, 0.08);
  color: #1294b0;
}

.fund-performance-return {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #526078;
  font-size: 14px;
}

.fund-performance-return strong {
  font-size: 20px;
}

.fund-performance-legend {
  margin-top: 12px;
  color: #526078;
  font-size: 12px;
}

.fund-performance-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.fund-performance-legend i {
  width: 18px;
  height: 3px;
  border-radius: 99px;
  background: #df2f34;
}

.fund-performance-legend small {
  font-size: 12px;
}

.fund-performance-chart {
  margin-top: 5px;
}

.fund-performance-chart .detail-trend-figure svg {
  height: 210px;
}

.fund-performance-chart .detail-trend-axis {
  font-size: 11px;
}

.fund-performance-ranges {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  min-height: 38px;
  margin-top: 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ececef;
}

.fund-performance-history {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.fund-performance-history-title {
  margin-bottom: 8px;
}

.fund-performance-history-title h3 {
  margin: 0;
  font-size: 15px;
}

.fund-performance-history-title span {
  color: #526078;
  font-size: 11px;
}

.fund-performance-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fund-performance-table-row {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  min-height: 40px;
  padding: 0 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.fund-performance-table-row:first-child {
  border-top: 0;
}

.fund-performance-table-row.head {
  min-height: 36px;
  background: var(--surface-soft);
  color: #526078;
  font-size: 12px;
}

.fund-performance-table-row > :not(:first-child) {
  text-align: right;
}

.fund-performance-table-row span,
.fund-performance-table-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-performance-more {
  display: block;
  min-height: 34px;
  margin: 7px auto 0;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #526078;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fund-profit-panel {
  min-width: 0;
}

.fund-profit-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 34px;
  color: #526078;
  font-size: 15px;
}

.fund-profit-summary strong {
  font-size: 21px;
}

.fund-profit-note {
  margin: -2px 0 8px;
  color: #526078;
  font-size: 11px;
}

.fund-profit-chart .detail-trend-figure svg {
  height: 215px;
}

.fund-profit-chart .detail-trend-axis {
  font-size: 11px;
}

.fund-profit-ranges {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  min-height: 38px;
  margin-top: 8px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ececef;
}

.fund-profit-ranges button {
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526078;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.fund-profit-ranges button.active {
  background: color-mix(in srgb, #1599b6 15%, var(--surface));
  box-shadow: 0 2px 7px rgba(40, 80, 100, 0.08);
  color: #1294b0;
}

.fund-profit-history {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.fund-profit-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.fund-profit-history-title h3 {
  margin: 0;
  font-size: 15px;
}

.fund-profit-history-title span {
  color: #526078;
  font-size: 11px;
}

.fund-profit-table-row {
  grid-template-columns: 1.25fr repeat(2, 1fr);
}

.fund-profit-loading .loading-state,
.fund-profit-empty .empty-state,
.fund-profit-error .empty-state {
  min-height: 260px;
}

.fund-profit-error {
  text-align: center;
}

.fund-profit-error button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100% - 24px));
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

dialog.toast-host::after,
.auth-view.toast-host::after {
  content: attr(data-toast);
  position: fixed;
  top: 42vh;
  left: 50%;
  z-index: 2147483647;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: normal;
}

dialog.toast-host.show-toast::after,
.auth-view.toast-host.show-toast::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .app-nav {
    padding-left: 10px;
  }

  .nav-item {
    width: 60px;
  }

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

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

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

  .search-field {
    grid-column: 1 / -1;
  }

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

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

  .detail-hero-card {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .app-layout {
    display: block;
  }

  .app-nav {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px);
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
  }

  .nav-item {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 8px;
  }

  .nav-icon {
    height: 20px;
    font-size: 17px;
  }

  .workspace {
    padding: 14px 10px calc(92px + env(safe-area-inset-bottom));
  }

  .summary-band,
  .add-form,
  .auth-card,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-view {
    align-items: start;
    padding: 12px;
  }

  .auth-copy h2 {
    font-size: 26px;
  }

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

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

  .top-user {
    display: none;
  }

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

  .controls-line {
    align-items: stretch;
    flex-direction: column;
  }

  .segments {
    width: 100%;
  }

  .segments button {
    min-width: 0;
  }

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

  .selects label {
    width: 100%;
  }

  .fund-list {
    overflow: hidden;
  }

  .fund-table-scroll {
    overflow-x: auto;
  }

  .fund-list-head {
    display: grid;
  }

  .fund-card {
    grid-template-columns: minmax(390px, 1fr) 140px 150px 150px 150px 100px;
    align-items: center;
    gap: 0;
  }

  .fund-row-cell,
  .quote-block {
    min-width: 0;
    text-align: left;
  }

  .quote-block > span {
    justify-content: flex-start;
  }

  .fund-metrics,
  .returns-row,
  .detail-stat-grid,
  .detail-return-grid,
  .detail-info-grid,
  .detail-holding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-section-head {
    display: grid;
  }

  .detail-trend-ranges {
    max-width: 100%;
  }

  .detail-trend-figure svg {
    height: 210px;
  }

  .detail-section-head span {
    text-align: left;
  }

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

  .fund-actions button {
    width: 100%;
  }

  .fund-card .fund-actions {
    display: flex;
    justify-content: center;
  }

  .fund-card .fund-actions button {
    width: 36px;
  }

  .modal {
    width: calc(100% - 16px);
  }

  .modal-box {
    padding: 14px;
  }

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

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

@supports not (background: color-mix(in srgb, white, black)) {
  .topbar {
    background: var(--surface);
  }

  .primary-button:hover {
    background: var(--accent);
  }
}
