:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e5eaf2;
  --text: #1c2433;
  --muted: #6e7787;
  --blue: #2563eb;
  --blue-deep: #1e50c8;
  --blue-soft: #edf3ff;
  --green: #159d67;
  --red: #dc4453;
  --amber: #b7791f;
  --num-red: #e0384a;
  --shadow: 0 1px 2px rgba(18, 26, 43, 0.04), 0 10px 30px rgba(18, 26, 43, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "PingFang SC", -apple-system, "SF Pro Text", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--blue-deep);
}

.layout {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.3px;
  margin-bottom: 26px;
}

.brand::before {
  content: "";
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 3.5px;
  background: linear-gradient(135deg, var(--blue), #7aa5ff);
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  color: #49536b;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: #f2f5fa;
  color: var(--text);
}

.nav a.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.user-badge {
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.user-badge-label,
.user-badge span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.user-badge strong {
  display: block;
  margin: 2px 0;
  overflow-wrap: anywhere;
}

.space-name-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 6px;
}

.space-name-form input {
  min-width: 0;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 13px;
}

.space-name-form button {
  min-height: 30px;
  padding: 5px 8px;
}

.logout-form {
  margin-top: 18px;
}

.content {
  padding: 20px 24px 42px;
  min-width: 0;
}

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

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.compact-topbar {
  margin-bottom: 10px;
}

.message {
  margin-bottom: 14px;
  padding: 11px 14px;
  background: #fff8e6;
  border: 1px solid #f0d99b;
  color: #665017;
  border-radius: 6px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-weight: 600;
  font-size: 15px;
}

.panel-body {
  padding: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.form-grid.compact {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

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

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #d6dded;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.small-input {
  width: 110px;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid #d6dded;
  border-radius: 8px;
  color: #3a4356;
  background: #fff;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
  box-shadow: 0 1px 1.5px rgba(18, 26, 43, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
.button:hover {
  background: #f6f8fc;
  border-color: #c6cfe0;
}

.button.primary,
button.primary {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.button.primary:hover,
button.primary:hover {
  color: #fff;
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

.button.danger,
button.danger {
  color: var(--red);
  border-color: #f2c5cb;
}

.button.danger:hover,
button.danger:hover {
  color: var(--red);
  background: #fdf3f4;
  border-color: #e9aab2;
}

.button.small,
button.small {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  border-bottom: 1px solid #edf1f7;
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f6f8fc;
  color: #5b6575;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

tr:hover td {
  background: #f7fafe;
}

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

.number {
  font-variant-numeric: tabular-nums;
}

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

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

.auth-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(37, 99, 235, 0.08), transparent 55%),
    #f2f5fa;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(360px, 430px);
  width: min(900px, 100%);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dfe7f3;
  box-shadow: 0 2px 4px rgba(18, 26, 43, 0.05), 0 24px 70px rgba(18, 26, 43, 0.12);
}

.auth-shell-single {
  grid-template-columns: minmax(360px, 440px);
  width: min(440px, 100%);
}

.auth-side {
  display: flex;
  flex-direction: column;
  padding: 42px 40px 30px;
  color: #eaf1ff;
  background:
    radial-gradient(500px 320px at 110% -20%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(160deg, #1d4ed8 0%, #2563eb 55%, #3b74f2 100%);
}

.auth-side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.auth-side-brand i {
  width: 11px;
  height: 11px;
  border-radius: 3.5px;
  background: linear-gradient(135deg, #ffffff, #bcd2ff);
}

.auth-side h2 {
  margin: 42px 0 22px;
  font-size: 26px;
  line-height: 1.45;
  color: #fff;
  letter-spacing: 0.5px;
}

.auth-side-points {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: rgba(234, 241, 255, 0.92);
}

.auth-side-points li {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.auth-side-points li::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-2px);
}

.auth-side-foot {
  margin-top: auto;
  padding-top: 30px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(234, 241, 255, 0.55);
}

.auth-card {
  width: 100%;
  padding: 42px 38px 30px;
  background: #fff;
}

.auth-card-brand {
  color: var(--blue);
  margin-bottom: 26px;
}

.auth-card-brand i {
  background: linear-gradient(135deg, var(--blue), #7aa5ff);
}

.auth-brand {
  margin-bottom: 18px;
  color: var(--blue);
  font-weight: 700;
  font-size: 16px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.auth-eyebrow,
.auth-mobile-brand,
.register-steps,
.register-note {
  display: none;
}

.auth-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-sub b {
  color: #3a4356;
}

.auth-optional {
  color: var(--muted);
  font-weight: 400;
}

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

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

.auth-link {
  font-size: 13px;
}

.auth-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.code-send-button {
  min-height: 36px;
  padding-inline: 12px;
  color: var(--blue);
  border-color: #bfd1fa;
  background: #f3f7ff;
  font-weight: 600;
}

.code-send-button:hover {
  color: var(--blue-deep);
  border-color: #9bb8f8;
  background: #eaf1ff;
}

@media (max-width: 860px) {
  .auth-body {
    padding: 14px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    width: min(440px, 100%);
    border-radius: 14px;
  }

  .auth-side {
    padding: 26px 26px 22px;
  }

  .auth-side h2 {
    margin: 18px 0 14px;
    font-size: 20px;
    line-height: 1.4;
  }

  .auth-side-points {
    gap: 8px;
    font-size: 13px;
  }

  .auth-side-foot {
    display: none;
  }

  .auth-card {
    padding: 26px 24px 22px;
  }
}

@media (max-width: 640px) {
  .auth-register-body {
    display: block;
    min-height: 100svh;
    padding: 0;
    background:
      linear-gradient(180deg, #eef4ff 0%, #f7f9fc 34%, #f7f9fc 100%);
  }

  .auth-register-body .auth-shell {
    display: block;
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }

  .auth-register-body .auth-side {
    display: none;
  }

  .auth-register-card {
    min-height: 100svh;
    padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px calc(env(safe-area-inset-bottom, 0px) + 22px);
    background: transparent;
  }

  .auth-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
  }

  .auth-mobile-brand span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #172033;
    font-size: 15px;
    font-weight: 700;
  }

  .auth-mobile-brand i {
    width: 11px;
    height: 11px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--blue), #7aa5ff);
  }

  .auth-mobile-brand a {
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid #d9e2f2;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
  }

  .auth-register-card .auth-eyebrow {
    display: none;
    align-self: flex-start;
    margin-bottom: 10px;
    padding: 5px 10px;
    border: 1px solid #d8e5fb;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .auth-register-card h1 {
    margin-bottom: 8px;
    color: #121a2b;
    font-size: 25px;
    line-height: 1.18;
    letter-spacing: 0;
  }

  .auth-register-card .auth-sub {
    max-width: 23rem;
    margin-bottom: 11px;
    color: #58657a;
    font-size: 14px;
    line-height: 1.5;
  }

  .register-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 10px;
  }

  .register-steps span {
    min-width: 0;
    padding: 7px 6px;
    border: 1px solid #dfe7f3;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.68);
    color: #6b7484;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
  }

  .register-steps .active {
    border-color: #b9cdf9;
    background: #eaf1ff;
    color: var(--blue);
  }

  .auth-register-card .message {
    margin-bottom: 12px;
    border-radius: 10px;
    font-size: 13px;
  }

  .auth-register-card .auth-form {
    gap: 8px;
    padding: 14px;
    border: 1px solid #e0e8f4;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 48px rgba(37, 51, 84, 0.10);
    backdrop-filter: blur(10px);
  }

  .auth-register-card .field {
    gap: 5px;
  }

  .auth-register-card .field label {
    color: #4b5568;
    font-size: 13px;
    font-weight: 650;
  }

  .auth-register-card input {
    min-height: 44px;
    border-color: #d9e2f0;
    border-radius: 12px;
    padding: 9px 12px;
    background: #fff;
    font-size: 16px;
  }

  .auth-register-card .verification-row {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 8px;
  }

  .auth-register-card .code-send-button {
    min-height: 44px;
    padding-inline: 8px;
    border-radius: 12px;
    box-shadow: none;
    font-size: 14px;
  }

  .auth-register-card input::placeholder {
    color: #a3adbd;
  }

  .auth-register-card .auth-submit {
    min-height: 48px;
    margin-top: 2px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
  }

  .register-note {
    display: block;
    margin: 10px 3px 0;
    color: #687487;
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
  }

  .auth-register-card .auth-footer {
    margin-top: 12px;
    color: #6b7484;
    font-size: 13px;
  }
}

@media (max-width: 640px) and (max-height: 760px) {
  .auth-register-card {
    padding: calc(env(safe-area-inset-top, 0px) + 13px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  }

  .auth-mobile-brand {
    margin-bottom: 14px;
  }

  .auth-register-card .auth-eyebrow {
    display: none;
  }

  .auth-register-card h1 {
    font-size: 24px;
  }

  .auth-register-card .auth-sub {
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.5;
  }

  .register-steps {
    gap: 6px;
    margin-bottom: 10px;
  }

  .register-steps span {
    padding: 6px 5px;
  }

  .auth-register-card .auth-form {
    gap: 8px;
    padding: 13px;
    border-radius: 16px;
  }

  .auth-register-card .field {
    gap: 5px;
  }

  .auth-register-card input {
    min-height: 44px;
    padding: 9px 12px;
  }

  .auth-register-card .code-send-button {
    min-height: 44px;
    font-size: 13px;
  }

  .auth-register-card .auth-submit {
    min-height: 46px;
  }

  .register-note {
    margin-top: 8px;
  }

  .auth-register-card .auth-footer {
    margin-top: 10px;
  }
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-check input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.auth-footer {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  font-size: 14px;
}

.auth-footer a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.shared-llm-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.shared-llm-status > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.shared-llm-status span,
.shared-llm-status strong {
  display: block;
}

.shared-llm-status span {
  color: var(--muted);
  font-size: 12px;
}

.shared-llm-status strong {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f7;
  color: #526070;
}

.status.success {
  background: #e8f7ef;
  color: var(--green);
}

.status.failed,
.status.conflict {
  background: #fdecec;
  color: var(--red);
}

.status.pending,
.status.partial {
  background: #fff4df;
  color: var(--amber);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

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

.metric-value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 700;
  color: #16202f;
  font-variant-numeric: tabular-nums;
}

.chart {
  height: 380px;
  width: 100%;
}

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

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.parse-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) 126px 96px 96px auto;
  gap: 8px;
  align-items: center;
}

.excerpt {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.5;
}

.filter-panel {
  box-shadow: none;
}

.fund-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 430px;
  margin-bottom: 14px;
}

.strategy-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label {
  color: #344054;
  white-space: nowrap;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d8e2f0;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  white-space: nowrap;
}

.filter-check input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.compact-select {
  width: 150px;
  min-height: 30px;
  padding: 4px 8px;
}

.fund-table-wrap {
  background: #fff;
}

.weekly-overview-panel {
  margin-bottom: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.weekly-overview-head h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.weekly-meta {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

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

.weekly-metric-card {
  min-width: 0;
  min-height: 104px;
  padding: 12px;
  background: #f8fbff;
  border: 1px solid #dfe8f5;
  border-radius: 8px;
}

.weekly-metric-card span,
.weekly-metric-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.weekly-metric-card strong {
  display: block;
  margin: 8px 0 6px;
  overflow-wrap: anywhere;
  color: #111827;
  font-size: 26px;
  line-height: 1.1;
}

.weekly-metric-card strong.positive {
  color: var(--red);
}

.weekly-metric-card strong.negative {
  color: var(--green);
}

.weekly-holdings-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.weekly-holdings-table {
  min-width: 980px;
  font-size: 12px;
}

.weekly-holdings-table th,
.weekly-holdings-table td {
  padding: 8px 10px;
  white-space: nowrap;
}

.weekly-holdings-table th:first-child,
.weekly-holdings-table td:first-child {
  width: 300px;
  text-align: left;
}

.fund-index-table {
  min-width: 1320px;
  font-size: 12px;
}

.fund-index-table th,
.fund-index-table td {
  padding: 8px 9px;
  white-space: nowrap;
}

.fund-index-table th {
  text-align: center;
}

.fund-index-table td {
  text-align: center;
}

.fund-index-table .fund-name-col {
  width: 360px;
  min-width: 360px;
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  box-shadow: 1px 0 0 var(--line);
}

.fund-index-table th.fund-name-col {
  background: #f4f7fc;
  z-index: 2;
}

.fund-link {
  display: inline-block;
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.fund-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.fund-mobile-list {
  display: none;
}

.ppw-holding-mobile {
  display: none;
}

.mobile-tabbar {
  display: none;
}

.pm-hero {
  display: none;
}

.perf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.perf-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #475467;
}

.perf-legend-item b {
  font-size: 15px;
}

.perf-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.perf-legend .dot-fund {
  background: #e0384a;
}

.perf-legend .dot-bench {
  background: #2563eb;
}

.perf-legend .dot-excess {
  background: #f2a900;
}

.sparkline {
  display: block;
  width: 74px;
  height: 28px;
  margin: 0 auto;
}

.sparkline-line {
  fill: none;
  stroke: #8b98a8;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-line.up {
  stroke: #eb5b68;
}

.sparkline-line.down {
  stroke: #26a269;
}

.fund-detail-page {
  margin: -20px -24px -42px;
  background: #f5f8fd;
}

.fund-detail-titlebar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 24px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.fund-detail-titlebar h1 {
  margin: 0 0 10px;
  font-size: 26px;
}

.fund-subtitle {
  color: #344054;
  font-size: 13px;
}

.tag-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  color: var(--blue);
  font-weight: 700;
}

.detail-metric-strip {
  display: grid;
  grid-template-columns: 210px 170px minmax(260px, 1fr) minmax(360px, 1.4fr) minmax(300px, 1fr);
  gap: 0;
  margin: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.detail-metric-strip > div {
  min-height: 96px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.latest-nav-value {
  color: var(--num-red);
  font-size: 32px;
  line-height: 1;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.detail-mini-metrics {
  display: grid;
  align-content: center;
  gap: 16px;
}

.rank-line,
.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 18px;
  margin: 12px 0 8px;
}

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

.rank-line strong,
.metric-row strong {
  color: var(--num-red);
  font-size: 17px;
}

.rank-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.rank-card .rank-labels {
  grid-template-columns: repeat(3, 1fr);
}

.info-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
}

.detail-filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 24px;
  margin-top: 14px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-filterbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
}

.detail-filterbar select {
  width: 150px;
  min-height: 32px;
}

.detail-filterbar select.benchmark-select {
  width: 180px;
}

.detail-analysis-layout {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 14px;
  padding: 0 24px 42px 0;
}

.detail-analysis-nav {
  background: #fff;
  border-right: 1px solid var(--line);
  min-height: 620px;
  padding: 14px 0;
}

.detail-analysis-nav a,
.analysis-group {
  display: block;
  padding: 12px 16px;
  color: #344054;
}

.analysis-group {
  color: var(--blue);
  font-weight: 700;
}

.analysis-group.folded {
  color: #344054;
  margin-top: 18px;
}

.detail-analysis-nav a.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-right: 3px solid var(--blue);
  font-weight: 700;
}

.detail-analysis-main {
  min-width: 0;
  padding-top: 14px;
}

.analysis-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  padding: 18px 20px;
}

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

.section-heading h2 {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--blue);
  font-size: 18px;
}

.excess-summary {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.excess-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.excess-summary-grid > div {
  min-width: 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e6ecf5;
  border-radius: 8px;
}

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

.excess-summary-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.excess-summary-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.excess-summary-empty {
  text-align: center;
}

.chart-table-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(520px, 1fr);
  gap: 18px;
  align-items: start;
}

.analysis-chart {
  height: 360px;
}

.chart-note {
  margin-top: 8px;
  padding: 8px 10px;
  color: #526070;
  background: #f6f9fe;
  border: 1px solid #e4edf9;
  font-size: 12px;
}

.side-table table {
  min-width: 640px;
  font-size: 12px;
}

.side-table th,
.side-table td {
  padding: 8px 9px;
  text-align: right;
}

.side-table th:first-child,
.side-table td:first-child {
  text-align: left;
}

.portfolio-page {
  margin: -20px -24px -42px;
  background: #f5f8fd;
}

.portfolio-titlebar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 24px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.portfolio-titlebar h1 {
  margin: 0 0 10px;
  font-size: 28px;
}

.portfolio-titlebar p {
  margin: 0;
  color: var(--muted);
}

.portfolio-summary {
  display: grid;
  grid-template-columns: 240px 240px minmax(420px, 1.3fr) minmax(320px, 1fr);
  gap: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.portfolio-summary-card {
  min-height: 112px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.summary-value {
  color: var(--num-red);
  font-size: 36px;
  line-height: 1;
  font-weight: 500;
}

.summary-label {
  margin-top: 28px;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  height: 100%;
  align-items: center;
}

.summary-grid strong {
  display: block;
  font-size: 19px;
  margin-bottom: 12px;
}

.summary-grid span,
.summary-list span {
  color: var(--muted);
  font-size: 12px;
}

.summary-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.summary-list div {
  display: grid;
  gap: 6px;
}

.summary-list strong {
  font-size: 15px;
}

.portfolio-filterbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 24px;
  margin-top: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.portfolio-filterbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portfolio-filterbar select {
  width: 170px;
  min-height: 32px;
}

.portfolio-anchor-nav {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.portfolio-anchor-nav a {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: #344054;
  background: #fff;
  border: 1px solid #d8e2f0;
  border-radius: 6px;
}

.portfolio-anchor-nav a:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.portfolio-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 14px;
  padding: 14px 24px 0;
}

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

.portfolio-form-grid .wide {
  grid-column: span 2;
}

.portfolio-form-grid .submit-field {
  align-self: end;
}

.portfolio-analysis-layout {
  padding: 14px 24px 42px;
}

.portfolio-analysis-main {
  min-width: 0;
}

.portfolio-chart-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) minmax(520px, 1fr);
  gap: 18px;
  align-items: start;
}

.portfolio-chart {
  height: 380px;
  min-width: 0;
}

.portfolio-two-charts {
  display: grid;
  grid-template-columns: minmax(620px, 1.15fr) minmax(420px, 0.85fr);
  gap: 18px;
  align-items: center;
}

.portfolio-correlation-chart {
  height: 520px;
  min-width: 920px;
}

.portfolio-wide-table table {
  min-width: 1180px;
}

.portfolio-cash-table table {
  min-width: 720px;
}

.ppw-portfolio-page {
  color: #2f3542;
  background: #f2f6fc;
}

.ppw-portfolio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px 14px;
  background: #fff;
  border-bottom: 1px solid #dbe6f5;
}

.ppw-portfolio-head h1 {
  margin: 0 0 10px;
  color: #242a35;
  font-size: 30px;
  font-weight: 700;
}

.ppw-portfolio-head p {
  margin: 0;
  color: #5f6b7c;
}

.ppw-head-actions {
  flex-wrap: nowrap;
}

.ppw-summary-strip {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(350px, 1.25fr) minmax(175px, 0.75fr) minmax(200px, 0.85fr) minmax(170px, 0.7fr);
  align-items: stretch;
  margin-bottom: 12px;
  background: #fff;
  border-bottom: 1px solid #dbe6f5;
}

.ppw-summary-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-right: 1px solid #dbe6f5;
}

.ppw-summary-primary > div {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 16px 16px;
}

.ppw-summary-primary > div + div {
  border-left: 1px solid #eef3fb;
}

.ppw-summary-primary strong {
  color: var(--num-red);
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

.ppw-summary-primary span,
.ppw-summary-info span,
.ppw-summary-metric-grid span {
  color: #697386;
  font-size: 12px;
}

.ppw-summary-metrics {
  display: grid;
  grid-template-rows: 32px 1fr;
  border-right: 1px solid #dbe6f5;
}

.ppw-summary-band {
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #f3f7fd;
  color: #6a7485;
  font-weight: 700;
}

.ppw-summary-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  align-items: center;
}

.ppw-summary-metric-grid > div {
  display: grid;
  gap: 12px;
  justify-items: center;
  min-width: 0;
  padding: 14px 10px;
  text-align: center;
}

.ppw-summary-metric-grid strong {
  font-size: 20px;
  font-weight: 700;
}

.ppw-summary-info {
  display: grid;
  align-content: center;
  gap: 13px;
  min-height: 116px;
  padding: 16px 18px;
  border-right: 1px solid #dbe6f5;
  font-size: 13px;
}

.ppw-builder {
  margin-bottom: 12px;
  background: #fff;
  border-top: 1px solid #dbe6f5;
  border-bottom: 1px solid #dbe6f5;
}

.ppw-builder-title {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  align-items: center;
  min-height: 70px;
  border-bottom: 1px solid #dbe6f5;
}

.ppw-builder-title h2 {
  margin: 0;
  padding-left: 30px;
  border-left: 4px solid var(--blue);
  font-size: 20px;
}

.ppw-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  max-width: 760px;
  justify-self: center;
  color: #9aa4b2;
  text-align: center;
}

.ppw-steps span {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  font-weight: 700;
}

.ppw-steps span::before {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 1px;
  background: #d8e4f5;
  content: "";
}

.ppw-steps b {
  position: relative;
  z-index: 1;
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--blue);
  border-radius: 50%;
  font-size: 13px;
}

.ppw-steps .active {
  color: var(--blue);
}

.ppw-steps .active b {
  color: #fff;
  background: var(--blue);
}

.ppw-cash-toolbar,
.ppw-position-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid #dbe6f5;
}

.ppw-cash-toolbar {
  justify-content: flex-start;
  min-height: 62px;
}

.ppw-cash-toolbar strong,
.ppw-position-header strong {
  font-size: 17px;
}

.ppw-position-header > div {
  display: flex;
  align-items: center;
  gap: 18px;
}

.compact-checkbox {
  min-height: auto;
  color: #4b5565;
  font-size: 13px;
}

.compact-checkbox input {
  width: 16px;
  min-height: 16px;
}

.ppw-config-table {
  margin: 0 28px 18px;
  border: 1px solid #d7e5f6;
}

.ppw-config-table table {
  min-width: 1540px;
  font-size: 13px;
}

.ppw-config-table th,
.ppw-config-table td {
  border-right: 1px solid #e3edf9;
}

.ppw-config-table th:last-child,
.ppw-config-table td:last-child {
  border-right: 0;
}

.ppw-config-table th {
  background: #f4f7fc;
  text-align: center;
}

.ppw-config-table td {
  padding: 7px 9px;
}

.table-input {
  min-height: 30px;
  padding: 4px 8px;
  border-color: #cfe0f5;
  border-radius: 4px;
  background: #fbfdff;
}

.table-input.number {
  text-align: right;
}

.ppw-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}

.fee-term-form {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(72px, 1fr) auto;
  gap: 6px;
  align-items: end;
  min-width: 210px;
}

.fee-term-form label {
  display: grid;
  gap: 3px;
  color: #667085;
  font-size: 11px;
}

.fee-term-form .table-input {
  min-height: 28px;
}

.fee-term-form {
  align-items: end;
}

.fee-status {
  align-self: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.fee-status.on {
  color: var(--amber);
  background: #fff4df;
}

.fee-status.off {
  color: var(--muted);
  background: #eef2f7;
}

.fee-hint {
  font-size: 12px;
  line-height: 1.5;
}

.link-button {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  box-shadow: none;
  font-size: inherit;
}

.link-button:hover {
  background: transparent;
  border-color: transparent;
  color: var(--blue-deep);
}

.link-button.danger-text:hover {
  color: var(--red);
}

.danger-text {
  color: var(--red);
}

.ppw-action-panels {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 14px;
  padding: 0 28px 22px;
}

.ppw-action-panels .panel {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.ppw-inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.ppw-inline-form label {
  display: grid;
  gap: 5px;
  color: #5f6b7c;
  font-size: 12px;
}

.ppw-inline-form .wide {
  grid-column: span 2;
}

.ppw-analysis-shell {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 12px;
}

.ppw-analysis-menu {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 680px;
  padding: 16px 0;
  background: #fff;
  border-right: 1px solid #dbe6f5;
}

.ppw-analysis-menu a,
.ppw-analysis-menu .menu-group {
  display: block;
  padding: 12px 20px;
  color: #2f3542;
}

.ppw-analysis-menu .menu-group {
  color: var(--blue);
  font-weight: 700;
}

.ppw-analysis-menu .active {
  color: var(--blue);
  background: #edf4ff;
  border-right: 3px solid var(--blue);
  font-weight: 700;
}

.ppw-analysis-main {
  min-width: 0;
}

.ppw-analysis-filter {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 11px 20px;
  background: #fff;
  border-top: 1px solid #dbe6f5;
  border-bottom: 1px solid #dbe6f5;
}

.ppw-analysis-filter label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #2f3542;
}

.ppw-analysis-filter select {
  width: 150px;
  min-height: 30px;
  border-radius: 4px;
}

.range-label input {
  width: 140px;
  min-height: 30px;
  border-radius: 4px;
}

.ppw-analysis-section {
  margin-bottom: 12px;
  padding: 24px 28px 28px;
  background: #fff;
  border-top: 1px solid #e2ebf8;
  border-bottom: 1px solid #e2ebf8;
}

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

.ppw-section-head h2 {
  margin: 0;
  padding-left: 12px;
  border-left: 4px solid var(--blue);
  font-size: 20px;
}

.segmented {
  display: inline-flex;
}

.segmented button {
  min-width: 88px;
  min-height: 30px;
  border-radius: 0;
}

.segmented button:first-child {
  border-radius: 4px 0 0 4px;
}

.segmented button:last-child {
  border-radius: 0 4px 4px 0;
  border-left: 0;
}

.segmented .active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.ppw-chart-table {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(430px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.ppw-chart {
  height: 360px;
  min-width: 0;
}

.ppw-wide-table table {
  min-width: 1320px;
}

.ppw-holding-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.ppw-holding-head > div:first-child {
  display: grid;
  gap: 10px;
}

.ppw-holding-head p {
  margin: 0;
  color: #8a94a6;
  font-size: 13px;
}

.info-dot {
  display: inline-grid;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  place-items: center;
  color: #2f73ff;
  border: 1px solid #2f73ff;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  vertical-align: 3px;
}

.holding-tools {
  justify-content: flex-end;
}

.ppw-holding-table {
  position: relative;
  border: 1px solid #d5e6fb;
  background: #fff;
}

.ppw-holding-table table {
  min-width: 2540px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.ppw-holding-table th,
.ppw-holding-table td {
  height: 40px;
  padding: 8px 11px;
  border-right: 1px solid #dceafa;
  border-bottom: 1px solid #dceafa;
  text-align: right;
  white-space: nowrap;
}

.ppw-holding-table th {
  background: #f4f7fc;
  color: #596579;
  font-weight: 700;
}

.ppw-holding-table tbody tr:hover td {
  background: #f7fbff;
}

.ppw-holding-table .select-col {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  padding-left: 8px;
  padding-right: 8px;
  background: #fff;
  text-align: center;
}

.ppw-holding-table th.select-col {
  z-index: 4;
  background: #f4f7fc;
}

.ppw-holding-table .name-col {
  position: sticky;
  left: 38px;
  z-index: 2;
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  overflow: hidden;
  background: #fff;
  box-shadow: 8px 0 10px rgba(123, 148, 188, 0.12);
  text-align: left;
  text-overflow: ellipsis;
}

.ppw-holding-table th.name-col {
  z-index: 4;
  background: #f4f7fc;
}

.ppw-holding-table td:nth-child(3),
.ppw-holding-table th:nth-child(3) {
  min-width: 70px;
  text-align: left;
}

.ppw-holding-table td:nth-child(4),
.ppw-holding-table th:nth-child(4) {
  min-width: 100px;
}

.ppw-holding-table td:nth-child(5),
.ppw-holding-table th:nth-child(5),
.ppw-holding-table td:nth-child(6),
.ppw-holding-table th:nth-child(6),
.ppw-holding-table td:nth-child(9),
.ppw-holding-table th:nth-child(9),
.ppw-holding-table td:nth-child(11),
.ppw-holding-table th:nth-child(11),
.ppw-holding-table td:nth-child(13),
.ppw-holding-table th:nth-child(13),
.ppw-holding-table td:nth-child(14),
.ppw-holding-table th:nth-child(14),
.ppw-holding-table td:nth-child(18),
.ppw-holding-table th:nth-child(18),
.ppw-holding-table td:nth-child(17),
.ppw-holding-table th:nth-child(17) {
  min-width: 140px;
}

.ppw-holding-table td:nth-child(7),
.ppw-holding-table th:nth-child(7),
.ppw-holding-table td:nth-child(8),
.ppw-holding-table th:nth-child(8),
.ppw-holding-table td:nth-child(10),
.ppw-holding-table th:nth-child(10),
.ppw-holding-table td:nth-child(12),
.ppw-holding-table th:nth-child(12),
.ppw-holding-table td:nth-child(15),
.ppw-holding-table th:nth-child(15),
.ppw-holding-table td:nth-child(16),
.ppw-holding-table th:nth-child(16) {
  min-width: 130px;
}

.ppw-holding-table input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  padding: 0;
  border-color: #cfe0f5;
  border-radius: 3px;
}

.sort-mark {
  color: #c8d0da;
  font-size: 12px;
}

.holding-cash-row td,
.holding-total-row td {
  background: #fff;
}

.holding-total-row td {
  font-weight: 500;
}

.holding-total-row .name-col,
.holding-cash-row .name-col {
  color: var(--blue);
}

.ppw-cash-table table {
  min-width: 760px;
}

.ppw-two-charts {
  display: grid;
  grid-template-columns: minmax(500px, 1.15fr) minmax(360px, 0.85fr);
  gap: 24px;
  align-items: center;
}

.ppw-correlation-chart {
  height: 520px;
  min-width: 960px;
}

/* Portfolio detail visual refresh */
.ppw-portfolio-page {
  margin: -20px -24px -42px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 1px);
  padding-bottom: 30px;
  color: #1f2937;
  background: #eef3f8;
}

.ppw-portfolio-head {
  order: 1;
  padding: 20px 28px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
  border-bottom: 1px solid #d8e2ee;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.82);
}

.ppw-portfolio-head h1 {
  margin-bottom: 8px;
  color: #111827;
  font-size: 26px;
  letter-spacing: 0;
}

.ppw-portfolio-head p {
  color: #667085;
}

.ppw-summary-strip,
.ppw-builder,
.ppw-analysis-menu,
.ppw-analysis-filter,
.ppw-analysis-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.ppw-summary-strip {
  order: 2;
  grid-template-columns: minmax(210px, 1.05fr) minmax(380px, 1.55fr) repeat(3, minmax(180px, 0.85fr));
  margin: 14px 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.ppw-summary-primary > div {
  min-height: 104px;
  padding: 17px 18px 15px;
}

.ppw-summary-primary strong {
  color: var(--num-red);
  font-size: clamp(24px, 2.2vw, 32px);
  font-weight: 650;
}

.ppw-summary-band {
  background: #f2f6fb;
  color: #475467;
}

.ppw-summary-metric-grid > div {
  gap: 9px;
  padding: 13px 10px;
}

.ppw-summary-metric-grid strong {
  color: #263241;
  font-size: 19px;
}

.ppw-summary-info {
  min-height: 104px;
  gap: 10px;
  padding: 14px 16px;
  color: #344054;
}

.ppw-builder {
  order: 4;
  margin: 0 18px 14px;
  overflow: hidden;
  border-top: 1px solid #dbe5f0;
  border-bottom: 1px solid #dbe5f0;
}

.ppw-builder-title {
  min-height: 60px;
}

.ppw-builder-title h2 {
  color: #111827;
  font-size: 18px;
}

.ppw-cash-toolbar,
.ppw-position-header {
  padding: 12px 20px;
}

.ppw-cash-toolbar {
  min-height: 54px;
}

.ppw-config-table {
  margin: 0 20px 14px;
  overflow: auto;
  border-color: #dbe7f3;
  border-radius: 6px;
  background: #fff;
}

.ppw-config-table th {
  background: #f4f7fc;
  color: #475467;
}

.ppw-config-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.ppw-action-panels {
  gap: 12px;
  padding: 0 20px 18px;
}

.ppw-action-panels .panel {
  border-color: #dbe5f0;
  border-radius: 8px;
  background: #fbfdff;
}

.ppw-analysis-shell {
  order: 3;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 0 18px 28px;
}

.ppw-analysis-main {
  display: flex;
  flex-direction: column;
}

.ppw-analysis-filter {
  order: 1;
}

#performance {
  order: 2;
}

#holdings {
  order: 3;
}

#drawdown {
  order: 4;
}

#allocation {
  order: 5;
}

#trades {
  order: 6;
}

#cash-history {
  order: 7;
}

#correlation {
  order: 8;
}

.ppw-analysis-menu {
  top: 12px;
  min-height: auto;
  padding: 10px;
  border-right: 1px solid #dbe5f0;
}

.ppw-analysis-menu a,
.ppw-analysis-menu .menu-group {
  border-radius: 6px;
  padding: 10px 12px;
}

.ppw-analysis-menu .menu-group {
  margin-bottom: 4px;
  color: #2563eb;
}

.ppw-analysis-menu .active {
  background: #edf4ff;
  border-right: 0;
  color: #1d5bd8;
}

.ppw-analysis-filter {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-top: 1px solid #dbe5f0;
  border-bottom: 1px solid #dbe5f0;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.05);
}

.ppw-analysis-filter select,
.range-label input {
  min-height: 32px;
  border-color: #d3deeb;
  background: #fbfdff;
}

.ppw-analysis-section {
  margin-bottom: 14px;
  padding: 18px;
  border-top: 1px solid #dbe5f0;
  border-bottom: 1px solid #dbe5f0;
}

.ppw-section-head {
  margin-bottom: 14px;
}

.ppw-section-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-left: 0;
  border-left: 0;
  color: #111827;
  font-size: 18px;
}

.ppw-section-head h2::before {
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: #2563eb;
  content: "";
}

.segmented button {
  min-height: 32px;
  border-color: #d4dfec;
  background: #fbfdff;
}

.segmented .active {
  border-color: #2563eb;
  background: #2563eb;
}

.ppw-chart-table {
  grid-template-columns: minmax(520px, 1.08fr) minmax(460px, 0.92fr);
  gap: 14px;
  align-items: stretch;
}

.ppw-chart-card,
.ppw-chart-table .side-table,
.ppw-wide-table,
.ppw-cash-table {
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.ppw-chart-card {
  min-width: 0;
  min-height: 386px;
  padding: 12px 12px 6px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.ppw-chart-card .ppw-chart {
  height: 368px;
}

.ppw-chart-table .side-table {
  max-height: 386px;
  overflow: auto;
}

.ppw-chart-table .side-table table {
  min-width: 760px;
  font-size: 12px;
}

.ppw-chart-table .side-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f7fc;
  color: #475467;
}

.ppw-chart-table .side-table tbody tr:nth-child(even) td,
.ppw-wide-table tbody tr:nth-child(even) td,
.ppw-cash-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.ppw-wide-table,
.ppw-cash-table {
  max-height: 460px;
  overflow: auto;
}

.ppw-wide-table th,
.ppw-cash-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f7fc;
}

.ppw-holding-head {
  margin-bottom: 12px;
}

.ppw-holding-head p {
  color: #8a94a6;
}

.ppw-holding-table {
  max-height: 430px;
  overflow: auto;
  border-color: #dbe5f0;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.ppw-holding-table table {
  font-size: 12px;
}

.ppw-holding-table th,
.ppw-holding-table td {
  height: 38px;
  padding: 7px 10px;
  border-right-color: #e1eaf5;
  border-bottom-color: #e1eaf5;
}

.ppw-holding-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f4f7fc;
  color: #475467;
}

.ppw-holding-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.ppw-holding-table tbody tr:hover td {
  background: #f4f9ff;
}

.ppw-holding-table .select-col,
.ppw-holding-table .name-col {
  background: #fff;
}

.ppw-holding-table th.select-col,
.ppw-holding-table th.name-col {
  z-index: 5;
  background: #f4f7fc;
}

.holding-cash-row td {
  background: #f6f9fd !important;
}

.holding-total-row td {
  background: #f1f6fc !important;
  font-weight: 700;
}

.ppw-two-charts {
  gap: 14px;
}

.ppw-two-charts .ppw-chart,
.ppw-correlation-chart {
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
}

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

  .sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(5, minmax(90px, 1fr));
  }

  .content {
    padding: 16px;
  }

  .form-grid,
  .form-grid.compact,
  .metrics,
  .weekly-metric-grid {
    grid-template-columns: 1fr;
  }

  .fund-search-row {
    max-width: none;
  }

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

  .fund-detail-page {
    margin: -16px -16px -42px;
  }

  .fund-detail-titlebar,
  .detail-filterbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .detail-metric-strip,
  .detail-analysis-layout,
  .chart-table-grid,
  .portfolio-summary,
  .portfolio-action-grid,
  .portfolio-chart-grid,
  .portfolio-two-charts {
    grid-template-columns: 1fr;
  }

  .detail-analysis-layout {
    padding: 0 16px 32px;
  }

  .detail-analysis-nav {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portfolio-page {
    margin: -16px -16px -42px;
  }

  .portfolio-titlebar,
  .portfolio-filterbar,
  .portfolio-anchor-nav,
  .portfolio-action-grid,
  .portfolio-analysis-layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .portfolio-summary-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portfolio-correlation-chart {
    min-width: 780px;
  }

  .ppw-portfolio-head,
  .ppw-cash-toolbar,
  .ppw-position-header {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ppw-summary-strip,
  .ppw-builder-title,
  .ppw-action-panels,
  .ppw-analysis-shell,
  .ppw-chart-table,
  .ppw-two-charts {
    grid-template-columns: 1fr;
  }

  .ppw-summary-strip {
    gap: 10px;
    padding: 10px;
    background: #f7f9fc;
    border-bottom: 0;
  }

  .ppw-summary-primary,
  .ppw-summary-metrics,
  .ppw-summary-info {
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
  }

  .ppw-summary-info {
    min-height: auto;
  }

  .ppw-builder-title {
    gap: 12px;
    padding: 16px;
  }

  .ppw-builder-title h2 {
    padding-left: 12px;
  }

  .ppw-steps {
    width: 100%;
    max-width: none;
  }

  .ppw-config-table {
    margin-left: 16px;
    margin-right: 16px;
  }

  .ppw-action-panels {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ppw-inline-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .ppw-inline-form .wide {
    grid-column: span 1;
  }

  .ppw-inline-form button {
    width: 100%;
  }

  .ppw-analysis-menu {
    position: sticky;
    top: 0;
    z-index: 7;
    display: flex;
    gap: 8px;
    min-height: auto;
    padding: 10px 16px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #dbe6f5;
  }

  .ppw-analysis-menu .menu-group {
    display: none;
  }

  .ppw-analysis-menu a {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #d7e2f2;
    border-radius: 6px;
    background: #fff;
  }

  .ppw-analysis-menu .active {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
  }

  .ppw-analysis-filter {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ppw-analysis-section {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 720px) {
  body {
    background: #f7f9fc;
    font-size: 14px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .small-input,
  .table-input {
    font-size: 14px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    box-shadow: 0 6px 18px rgba(35, 47, 74, 0.08);
  }

  .brand {
    margin-bottom: 0;
    font-size: 16px;
  }

  .user-badge {
    display: none;
  }

  .logout-form {
    grid-row: 1;
    grid-column: 2;
    margin-top: 0;
  }

  .nav {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav a {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    border-radius: 6px;
    font-size: 13px;
  }

  .nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--blue);
  }

  .content {
    padding: 12px;
  }

  .topbar {
    display: block;
    margin-bottom: 10px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    display: none;
  }

  .page-actions {
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .page-actions > *,
  .page-actions .button,
  .page-actions button {
    flex: 0 0 auto;
  }

  .panel {
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 5px 18px rgba(35, 47, 74, 0.06);
  }

  .panel-header,
  .panel-body {
    padding: 12px;
  }

  .panel-header {
    align-items: flex-start;
  }

  .fund-toolbar-tools {
    display: none;
  }

  .weekly-overview-panel {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
  }

  .weekly-overview-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    margin-bottom: 10px;
  }

  .weekly-overview-head h2 {
    font-size: 17px;
  }

  .weekly-meta {
    gap: 5px;
  }

  .weekly-meta span {
    flex: 1 1 100%;
  }

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

  .weekly-metric-card {
    min-height: 94px;
    padding: 10px;
  }

  .weekly-metric-card strong {
    font-size: 20px;
  }

  .weekly-holdings-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .weekly-holdings-table,
  .weekly-holdings-table thead,
  .weekly-holdings-table tbody,
  .weekly-holdings-table tr,
  .weekly-holdings-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .weekly-holdings-table thead {
    display: none;
  }

  .weekly-holdings-table tr {
    margin-bottom: 8px;
    padding: 10px;
    background: #fbfdff;
    border: 1px solid #e1e9f5;
    border-radius: 8px;
  }

  .weekly-holdings-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border: 0;
    white-space: normal;
    text-align: right;
  }

  .weekly-holdings-table td:first-child {
    display: block;
    width: 100%;
    margin-bottom: 5px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f8;
    text-align: left;
    font-weight: 700;
    line-height: 1.35;
  }

  .weekly-holdings-table td:not(:first-child)::before {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
  }

  .weekly-holdings-table td:nth-child(2)::before {
    content: "策略";
  }

  .weekly-holdings-table td:nth-child(3)::before {
    content: "上周";
  }

  .weekly-holdings-table td:nth-child(4)::before {
    content: "净值";
  }

  .weekly-holdings-table td:nth-child(5)::before {
    content: "数据点";
  }

  .weekly-holdings-table td:nth-child(6)::before {
    content: "市值";
  }

  .weekly-holdings-table td:nth-child(7)::before {
    content: "权重";
  }

  .fund-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 10px;
  }

  .strategy-filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
  }

  .filter-label {
    flex: 0 0 auto;
  }

  .filter-check {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 9px;
  }

  .fund-table-wrap {
    display: none;
  }

  .fund-mobile-list {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: #f7f9fc;
  }

  .fund-mobile-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(35, 47, 74, 0.06);
  }

  .fund-mobile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .fund-mobile-name {
    min-width: 0;
    color: #1f2937;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
  }

  .fund-mobile-index {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }

  .fund-mobile-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
  }

  .fund-mobile-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 12px;
    align-items: center;
    padding: 10px;
    background: #f6f9fe;
    border: 1px solid #e4edf9;
    border-radius: 8px;
  }

  .fund-mobile-label,
  .fund-mobile-kpis span {
    color: var(--muted);
    font-size: 12px;
  }

  .fund-mobile-nav {
    margin-top: 4px;
    color: #111827;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
  }

  .fund-mobile-spark {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 44px;
  }

  .fund-mobile-spark .sparkline {
    width: 104px;
    height: 40px;
  }

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

  .fund-mobile-kpis > div {
    min-width: 0;
    padding: 8px 7px;
    background: #fbfdff;
    border: 1px solid #e6edf6;
    border-radius: 6px;
  }

  .fund-mobile-kpis strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    font-size: 14px;
  }

  .fund-mobile-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
  }

  .fund-mobile-actions .button,
  .fund-mobile-actions button {
    width: 100%;
  }

  .fund-mobile-empty {
    padding: 18px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
  }

  .form-grid {
    gap: 10px;
  }

  .portfolio-page {
    margin: -12px -12px -42px;
  }

  .portfolio-titlebar {
    display: grid;
    gap: 10px;
    padding: 14px 12px 12px;
  }

  .portfolio-titlebar h1 {
    font-size: 22px;
  }

  .portfolio-page-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .portfolio-page-actions .button {
    flex: 0 0 auto;
  }

  .portfolio-summary {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: #f7f9fc;
    border-bottom: 0;
  }

  .portfolio-summary-card {
    min-height: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(35, 47, 74, 0.06);
  }

  .summary-value {
    font-size: 32px;
  }

  .summary-label {
    margin-top: 14px;
  }

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

  .portfolio-filterbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px;
    margin-top: 0;
  }

  .portfolio-filterbar label,
  .portfolio-filterbar select {
    width: 100%;
  }

  .portfolio-filterbar label {
    display: grid;
    gap: 4px;
  }

  .portfolio-anchor-nav {
    top: 100px;
    padding: 8px 12px;
    box-shadow: 0 5px 14px rgba(35, 47, 74, 0.06);
  }

  .portfolio-anchor-nav a {
    padding: 8px 10px;
    font-size: 13px;
  }

  .portfolio-action-grid,
  .portfolio-analysis-layout {
    padding: 10px 10px 32px;
  }

  .portfolio-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .portfolio-form-grid .wide,
  .portfolio-form-grid .submit-field {
    grid-column: 1 / -1;
  }

  .portfolio-form-grid button {
    width: 100%;
  }

  .portfolio-chart-grid,
  .portfolio-two-charts {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .portfolio-chart {
    height: 300px;
  }

  .portfolio-correlation-chart {
    height: 430px;
    min-width: 720px;
  }

  #correlation {
    overflow-x: auto;
  }

  .portfolio-wide-table,
  .portfolio-cash-table {
    max-height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .ppw-portfolio-head {
    display: grid;
    gap: 10px;
    padding: 14px 12px 12px;
  }

  .ppw-portfolio-head h1 {
    font-size: 24px;
  }

  .ppw-head-actions {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .ppw-head-actions > * {
    flex: 0 0 auto;
  }

  .ppw-summary-strip {
    padding: 10px;
  }

  .ppw-summary-primary {
    grid-template-columns: 1fr;
  }

  .ppw-summary-primary > div {
    min-height: auto;
    gap: 16px;
    padding: 13px 14px;
  }

  .ppw-summary-primary > div + div {
    border-left: 0;
    border-top: 1px solid #eef3fb;
  }

  .ppw-summary-primary strong {
    font-size: 30px;
  }

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

  .ppw-summary-info {
    gap: 9px;
    padding: 12px 14px;
  }

  .ppw-builder-title {
    padding: 14px 12px;
  }

  .ppw-builder-title h2 {
    font-size: 18px;
  }

  .ppw-steps {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .ppw-cash-toolbar,
  .ppw-position-header {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .ppw-position-header > div {
    align-items: flex-start;
    justify-content: space-between;
  }

  .ppw-config-table {
    margin: 0 10px 12px;
  }

  .ppw-config-table table {
    min-width: 1400px;
  }

  .ppw-action-panels {
    padding: 0 10px 14px;
  }

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

  .ppw-inline-form .wide {
    grid-column: auto;
  }

  .ppw-analysis-menu {
    top: 100px;
    padding: 8px 10px;
    box-shadow: 0 5px 14px rgba(35, 47, 74, 0.06);
  }

  .ppw-analysis-menu a {
    padding: 8px 10px;
    font-size: 13px;
  }

  .ppw-analysis-filter {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
  }

  .ppw-analysis-filter label,
  .ppw-analysis-filter select,
  .range-label input,
  .ppw-analysis-filter .button,
  .ppw-analysis-filter button {
    width: 100%;
  }

  .ppw-analysis-filter label {
    display: grid;
    gap: 5px;
  }

  .range-label {
    grid-template-columns: 1fr;
  }

  .ppw-analysis-section {
    padding: 12px 10px 14px;
  }

  .ppw-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ppw-section-head h2 {
    font-size: 17px;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1 1 0;
  }

  .ppw-chart-table,
  .ppw-two-charts {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ppw-chart {
    height: 300px;
  }

  .ppw-chart-card {
    min-height: auto;
    padding: 8px;
  }

  .ppw-chart-card .ppw-chart {
    height: 300px;
  }

  .ppw-chart-table .side-table,
  .ppw-holding-table {
    max-height: 420px;
  }

  .ppw-wide-table,
  .ppw-cash-table,
  .side-table,
  #correlation {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .ppw-wide-table table {
    min-width: 1120px;
  }

  .ppw-correlation-chart {
    height: 430px;
    min-width: 760px;
  }

  .fund-detail-page {
    margin: -12px -12px -42px;
    background: #f7f9fc;
  }

  .fund-detail-titlebar {
    display: grid;
    gap: 10px;
    padding: 14px 12px 12px;
  }

  .fund-detail-titlebar h1 {
    margin-bottom: 6px;
    font-size: 19px;
    line-height: 1.35;
  }

  .fund-subtitle {
    font-size: 12px;
    line-height: 1.5;
  }

  .fund-subtitle .tag-button,
  .fund-subtitle .muted {
    display: none;
  }

  .detail-title-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .detail-title-actions button {
    display: none;
  }

  .detail-title-actions .button {
    flex: 0 0 auto;
  }

  .detail-metric-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    background: #f7f9fc;
    border-bottom: 0;
  }

  .detail-metric-strip > div {
    min-height: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(35, 47, 74, 0.06);
  }

  .detail-latest-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px 12px;
  }

  .latest-nav-value {
    grid-row: span 2;
    margin-bottom: 0;
    font-size: 34px;
  }

  .detail-latest-nav > div:not(.latest-nav-value) {
    text-align: right;
  }

  .detail-mini-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .rank-card {
    display: none;
  }

  .metric-row,
  .rank-labels {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .metric-row {
    margin: 10px 0 6px;
  }

  .metric-row strong {
    overflow-wrap: anywhere;
    font-size: 15px;
  }

  .rank-labels {
    font-size: 11px;
  }

  .info-card {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .detail-filterbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 12px;
    margin-top: 0;
    border-top: 1px solid var(--line);
  }

  .detail-filterbar label {
    display: grid;
    gap: 4px;
    font-size: 12px;
  }

  .detail-filterbar select,
  .detail-filterbar select.benchmark-select {
    width: 100%;
    min-height: 34px;
  }

  .detail-filterbar .button,
  .detail-filterbar button {
    width: 100%;
  }

  .detail-analysis-layout {
    display: block;
    padding: 0 10px 32px;
  }

  .detail-analysis-nav {
    position: sticky;
    top: 100px;
    z-index: 8;
    display: flex;
    min-height: auto;
    margin: 0 -10px 10px;
    padding: 8px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 5px 14px rgba(35, 47, 74, 0.06);
  }

  .detail-analysis-nav .analysis-group,
  .detail-analysis-nav .analysis-group.folded {
    display: none;
  }

  .detail-analysis-nav a {
    flex: 0 0 auto;
    padding: 8px 11px;
    border: 1px solid #d8e2f0;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
  }

  .detail-analysis-nav a.active {
    border-right: 1px solid var(--blue);
    background: var(--blue);
    color: #fff;
  }

  .detail-analysis-main {
    padding-top: 0;
  }

  .analysis-section {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
  }

  .section-heading {
    display: block;
    margin-bottom: 10px;
  }

  .section-heading h2 {
    margin-bottom: 8px;
    font-size: 16px;
  }

  .section-heading .inline-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .chart-table-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .excess-summary-grid strong {
    font-size: 16px;
  }

  .analysis-chart {
    height: 290px;
    min-width: 0;
  }

  .chart-note {
    line-height: 1.5;
  }

  .side-table {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .side-table table {
    min-width: 620px;
  }

  #nav-maintenance .form-grid.compact {
    grid-template-columns: 1fr 1fr;
  }

  #nav-maintenance .field[style] {
    grid-column: 1 / -1 !important;
  }

  #nav-maintenance .field:last-child {
    grid-column: 1 / -1;
  }

  #nav-maintenance button {
    width: 100%;
  }

  #nav-table .table-wrap {
    max-height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  /* 组合页手机端重排：业绩走势图提到首屏（标题 → 菜单 → 图 → 汇总 → 其余） */
  .ppw-analysis-shell,
  .ppw-analysis-main {
    display: contents;
  }

  .ppw-portfolio-head {
    order: 1;
  }

  .ppw-analysis-menu {
    order: 2;
  }

  #performance {
    order: 3;
  }

  .ppw-summary-strip {
    order: 4;
  }

  .ppw-builder {
    order: 5;
  }

  .ppw-analysis-filter {
    order: 6;
    margin-left: 10px;
    margin-right: 10px;
  }

  #holdings {
    order: 7;
  }

  #drawdown {
    order: 8;
  }

  #allocation {
    order: 9;
  }

  #trades {
    order: 10;
  }

  #cash-history {
    order: 11;
  }

  #correlation {
    order: 12;
  }

  .ppw-analysis-section {
    margin-left: 10px;
    margin-right: 10px;
  }

  .ppw-portfolio-head p {
    display: none;
  }

  /* 当前持仓：隐藏宽表，改用卡片 */
  .ppw-holding-table {
    display: none;
  }

  .ppw-holding-mobile {
    display: grid;
    gap: 10px;
  }

  .holding-mobile-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(35, 47, 74, 0.06);
  }

  .holding-mobile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .holding-mobile-name {
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .holding-mobile-weight {
    flex: 0 0 auto;
    padding: 2px 8px;
    color: var(--blue);
    background: var(--blue-soft);
    border-radius: 999px;
    font-size: 12px;
  }

  .holding-mobile-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
  }

  .holding-mobile-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    background: #f6f9fe;
    border: 1px solid #e4edf9;
    border-radius: 8px;
  }

  .holding-mobile-main span {
    color: var(--muted);
    font-size: 12px;
  }

  .holding-mobile-main strong {
    display: block;
    margin-top: 4px;
    font-size: 17px;
    overflow-wrap: anywhere;
  }

  .holding-mobile-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .holding-mobile-kpis > div {
    min-width: 0;
    padding: 8px 7px;
    background: #fbfdff;
    border: 1px solid #e6edf6;
    border-radius: 6px;
  }

  .holding-mobile-kpis span {
    color: var(--muted);
    font-size: 11px;
  }

  .holding-mobile-kpis strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .holding-mobile-more summary {
    color: var(--blue);
    font-size: 13px;
    cursor: pointer;
  }

  .holding-mobile-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-top: 10px;
  }

  .holding-mobile-detail > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }

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

  .holding-mobile-summary {
    background: #f1f6fc;
  }

  .holding-mobile-total .holding-mobile-name {
    color: var(--blue);
  }

  /* 调仓历史 / 现金流水 / 持仓条款：宽表改纵向堆叠 */
  .ppw-wide-table,
  .ppw-cash-table,
  .ppw-config-table {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ppw-config-table {
    margin: 0 12px 12px;
  }

  .ppw-wide-table table,
  .ppw-cash-table table,
  .ppw-config-table table,
  .ppw-wide-table tbody,
  .ppw-cash-table tbody,
  .ppw-config-table tbody,
  .ppw-wide-table tr,
  .ppw-cash-table tr,
  .ppw-config-table tr,
  .ppw-wide-table td,
  .ppw-cash-table td,
  .ppw-config-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .ppw-wide-table thead,
  .ppw-cash-table thead,
  .ppw-config-table thead {
    display: none;
  }

  .ppw-wide-table tr,
  .ppw-cash-table tr,
  .ppw-config-table tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(35, 47, 74, 0.06);
  }

  .ppw-wide-table td,
  .ppw-cash-table td,
  .ppw-config-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border: 0;
    white-space: normal;
    text-align: right;
  }

  .ppw-wide-table tbody tr:nth-child(even) td,
  .ppw-cash-table tbody tr:nth-child(even) td,
  .ppw-config-table tbody tr:nth-child(even) td,
  .ppw-wide-table tbody tr:hover td,
  .ppw-cash-table tbody tr:hover td,
  .ppw-config-table tbody tr:hover td {
    background: transparent;
  }

  .ppw-wide-table td:first-child,
  .ppw-cash-table td:first-child,
  .ppw-config-table td:first-child {
    display: block;
    margin-bottom: 5px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f8;
    text-align: left;
    font-weight: 700;
    line-height: 1.35;
  }

  .ppw-wide-table td:not(:first-child)::before,
  .ppw-cash-table td:not(:first-child)::before,
  .ppw-config-table td:not(:first-child)::before {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
  }

  .ppw-wide-table td:nth-child(2)::before { content: "投资策略"; }
  .ppw-wide-table td:nth-child(3)::before { content: "业务类型"; }
  .ppw-wide-table td:nth-child(4)::before { content: "确认日期"; }
  .ppw-wide-table td:nth-child(5)::before { content: "交易单价"; }
  .ppw-wide-table td:nth-child(6)::before { content: "确认份额"; }
  .ppw-wide-table td:nth-child(7)::before { content: "交易金额"; }
  .ppw-wide-table td:nth-child(8)::before { content: "费用"; }
  .ppw-wide-table td:nth-child(9)::before { content: "预提条款"; }
  .ppw-wide-table td:nth-child(10)::before { content: "备注"; }

  .ppw-cash-table td:nth-child(2)::before { content: "类型"; }
  .ppw-cash-table td:nth-child(3)::before { content: "金额"; }
  .ppw-cash-table td:nth-child(4)::before { content: "备注"; }

  .ppw-config-table td:nth-child(2)::before { content: "投资策略"; }
  .ppw-config-table td:nth-child(3)::before { content: "单位净值"; }
  .ppw-config-table td:nth-child(4)::before { content: "净值日期"; }
  .ppw-config-table td:nth-child(5)::before { content: "初始申购日期"; }
  .ppw-config-table td:nth-child(6)::before { content: "初始申购金额(元)"; }
  .ppw-config-table td:nth-child(7)::before { content: "初始申购净值"; }
  .ppw-config-table td:nth-child(8)::before { content: "初始费用(元)"; }

  .ppw-config-table .table-input {
    width: 150px;
    flex: 0 0 auto;
    text-align: right;
  }

  .ppw-config-table td:nth-child(9) {
    display: block;
    text-align: left;
  }

  .ppw-config-table td:nth-child(9)::before {
    content: "预提条款(费率%)";
    display: block;
    margin-bottom: 6px;
  }

  .ppw-config-table .fee-term-form {
    min-width: 0;
  }

  .ppw-config-table .fee-term-form .table-input {
    width: 100%;
  }

  .ppw-wide-table td:last-child,
  .ppw-cash-table td:last-child,
  .ppw-config-table td:last-child {
    justify-content: flex-end;
    padding-top: 8px;
  }

  .ppw-wide-table td:last-child::before,
  .ppw-cash-table td:last-child::before,
  .ppw-config-table td:last-child::before {
    content: "";
  }

  .ppw-config-table .ppw-row-actions {
    justify-content: flex-end;
    width: 100%;
  }

  /* 一级目录：底部 Tab 栏（顶部导航在手机端隐藏） */
  .sidebar .nav {
    display: none;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(35, 47, 74, 0.07);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-tabbar a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 8px 2px 7px;
    color: #7a8496;
    font-size: 11px;
    line-height: 1.2;
  }

  .mobile-tabbar svg {
    width: 22px;
    height: 22px;
  }

  .mobile-tabbar a.active {
    color: var(--blue);
    font-weight: 600;
  }

  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
  }

  /* 组合页手机端首屏收益卡 */
  .pm-hero {
    display: block;
    order: 1;
    margin: 12px 10px 0;
    padding: 14px;
    background: #fff;
    border: 1px solid #dfe7f2;
    border-radius: 12px;
    box-shadow: 0 5px 16px rgba(35, 47, 74, 0.06);
  }

  .pm-hero-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf2f8;
  }

  .pm-hero-main {
    grid-column: 1 / -1;
  }

  .pm-hero-top span {
    display: block;
    color: var(--muted);
    font-size: 11px;
  }

  .pm-hero-top strong {
    display: block;
    margin-top: 5px;
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .pm-hero-main strong {
    font-size: 27px;
  }

  .pm-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
    margin-top: 11px;
  }

  .pm-hero-grid > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }

  .pm-hero-grid span {
    color: var(--muted);
    font-size: 12px;
  }

  .pm-hero-grid b {
    font-size: 13px;
  }

  /* 汇总条首卡与首屏收益卡重复，手机端隐藏 */
  .ppw-summary-primary {
    display: none;
  }

  /* 组合页历史净值表在手机端精简为：日期/净值/变化率/基准 */
  .ppw-chart-table .side-table th:nth-child(4),
  .ppw-chart-table .side-table td:nth-child(4),
  .ppw-chart-table .side-table th:nth-child(6),
  .ppw-chart-table .side-table td:nth-child(6) {
    display: none;
  }

  .ppw-chart-table .side-table table {
    min-width: 0;
  }

  .perf-legend {
    gap: 6px 14px;
    padding: 9px 11px;
  }

  .perf-legend-item {
    font-size: 12px;
  }

  .perf-legend-item b {
    font-size: 13px;
  }

  /* 顶部导航隐藏后头部变矮，吸附位置同步校准 */
  .portfolio-anchor-nav,
  .ppw-analysis-menu,
  .detail-analysis-nav {
    top: 52px;
  }
}

@media (max-width: 380px) {
  .fund-mobile-main {
    grid-template-columns: 1fr;
  }

  .fund-mobile-spark {
    justify-content: flex-start;
  }

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

  .info-card,
  .detail-filterbar,
  #nav-maintenance .form-grid.compact {
    grid-template-columns: 1fr;
  }

  .metric-row,
  .rank-labels {
    gap: 6px;
  }

  .metric-row strong {
    font-size: 13px;
  }

  .rank-labels {
    font-size: 10px;
  }

  .detail-mini-metrics {
    grid-template-columns: 1fr;
  }

  .detail-latest-nav {
    grid-template-columns: 1fr;
  }

  .detail-latest-nav > div:not(.latest-nav-value) {
    text-align: left;
  }
}
